From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BAF4A0032; Sat, 22 Oct 2022 10:26:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA96042B91; Sat, 22 Oct 2022 10:25:31 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2124.outbound.protection.outlook.com [40.107.95.124]) by mails.dpdk.org (Postfix) with ESMTP id 5B1F442686 for ; Sat, 22 Oct 2022 10:25:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lC/Ux0sI7UT+Uix4b1bYuNVPw15KB5MWRBcIwxgj1BCi3a1yktY+c68dMP1luUVFJIxNwSq7AK/miexSDVKRW48pblosxMH5yT5C+DJyzBzaAtFlExywrbzbgzsopg1NyW0pZI3IGKijgi/r3V8IuiOu/YezWzcq3rljJ3bTTgsmZW9bTCzYNhy4/rNwLtu+DPRj2n3ynBR52HhAXVW4IJS2Cp/cjXCLqRFE5kftw0TLgkuzgAuboA2P/JD36a7zKbd37oCV2T+mRzLr0Z7kRKAAH6IcpXvqpYlhCFcdeuy8SmWkJHZvwmpUmvWJIdll5xU3nUhbwJ7t6oNUhDZK1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2bEZraHnJd1fnqaK6FpASssHMl+YMDZpKO/GdXe8zmw=; b=nmf2sPzQnkbP611SNhW/oDQJHXI2lrt2j0Px3f0dYrZvFH+woI0tUot+0Msz2eSTFy+4HXJ4mLHwbsrtukiMVVAXzCghQTVyUQRzUajIdrgoxK2HaVTWscOHM8CEXsZag6MBPImyOxtABZJIW0Q/p86vS1rI00nwRuNZUCJbEqylEA1I3n6OnJ7RyIQFhqyrMKOAt0FBYksmL4jwX/bFuYo3uHRMNJGEm7Z/KtnIc799DrDDzHdhHz3EQ2TKwThBgZ/8O0z79TKhSs4WSZUAoD7qEtNZs73Ch98k+XMPZcRynGoKtctOvcou12rtLEyNR6YBkw/I5oSTgcJSsXEbZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2bEZraHnJd1fnqaK6FpASssHMl+YMDZpKO/GdXe8zmw=; b=OGWvw8VmdtcYHBHcVX5UnfFqsV21h9umldGN+3J+ffIB8LhU2PA9iaFQcMfmVIgcVg5Rz92HQork1X6Awwyckk5LOEivi0qHMu5U0Y6/88KsUSgu5JszydGLb3URGR4keAK5PPkiYe9W/ZSyz7ErYyXRMAzkEES4qNeifwqxKK4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CH2PR13MB3848.namprd13.prod.outlook.com (2603:10b6:610:9d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Sat, 22 Oct 2022 08:25:26 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Sat, 22 Oct 2022 08:25:25 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 18/25] net/nfp: support IPv6 NVGRE encap flow action Date: Sat, 22 Oct 2022 16:24:22 +0800 Message-Id: <1666427069-10553-19-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0056.apcprd02.prod.outlook.com (2603:1096:4:54::20) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CH2PR13MB3848:EE_ X-MS-Office365-Filtering-Correlation-Id: 71f753bb-778d-4c37-0c2a-08dab406f850 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x5IEIO4Pwv2TAWMv8A5PY98i+4KpwEmgrmmPuR69TP9qYHIBL9XqPij7ZS/xrmy/xLrmSdktnePr6oNig5cLivczAgQjcPgp2K9WSjP5cYTtKyCjB4NqONnWsFq+m7FmNQs+HhmGDyZZLBaCM9rUICzYfWvhbhTCVFdIPRYARUJCSypiMmwpmZuNv2ShGRlcGcHtwM/EitXfMjNCgftFVjqCcU9stRSmEXzz5vKg5/h11jzdexJ4vWwW+M/tBAaX3lFg8ZFFiYlQv4FZiomyrE8De1N562kbvHbHDH12cILf5bygc+NFZTUFRThxM6aLn/Yse8XY2Yfj3cdtC5Hz5sC4fuXJ+DKJOGifZgW6uLK9iGaqwSGQhhu8BH1bVHr1IaHnbd6D70GMF1jPTulKAmy+j1uwu+J3Ev7+PxREVeaj/xS+NUDGuj37P4q6GDK9dOAP6yQDCxaMIl8Ru7oVQiXqHF1Z+/61KAR/mzc3CtFw0VNwVtVv4rDeUKNxcNbSDUa8XQT7gANVXmfoM7b521fLdHNLkDzPeI7rv3TGcR9FtEeqYkjn18oLO6tuhc7hb5Sb35Vt/FyoLMicgaZ4zcNR3mYLyZ9zpWqSt9H7mLZSeVsj2sZ/Quo+aQGIyeEUJ6WwE6hGq7LmIAuCRuXENPaYc8FomrufGnFFRfZUEtkqqY6YK5jEiWF3bK52rCsnAfUeuPeYn+6LKV+zsAXk2s7OdquqPgUmekR3C9TgqKtZVqFE6cjxaE7OT6/IGbZ/gxrpGysOiO4HGm29OSWWlA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(366004)(396003)(39830400003)(346002)(376002)(451199015)(4326008)(107886003)(36756003)(38100700002)(66946007)(66556008)(316002)(6512007)(83380400001)(52116002)(66476007)(8676002)(44832011)(6666004)(6506007)(38350700002)(5660300002)(8936002)(6916009)(2616005)(478600001)(186003)(41300700001)(26005)(6486002)(86362001)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YUNtZlYzVHRzVEFud3BWNmc5OVhDRlk3L0srcjRtVXA5MWxQN0ZCdHF6YWhw?= =?utf-8?B?TUl4elZaeGtHVldqdFdZSVdORGFvdUpOQi9GSm5HS0pDV2Y4ODhkazMzTWsr?= =?utf-8?B?MFZDK0FRLzJOVmR4em0rTk0vTTRtblBWZkorRW0wWlo0NUFFZGVCY2pocTA0?= =?utf-8?B?VmY1U3U5VFV5eHpYR3ZvZG00ODhtVHpFMi9tUHdybEdibHpraFhHVmlKOWlE?= =?utf-8?B?bWJwUkhLVHVqL0Vac2kvejR2bDE1VDkwZ21qWStzc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utf-8?B?SVIvdjhkN2lJMDNhZVRCQy9qczYyYW9Lc1BGNTIxNTlIN213UGVuSmlJb20z?= =?utf-8?B?MzdZV2REbHdPdmlNTW5BWm1PK0tZQ21hSHlRd3J4MWozNXF4bnVNUjZiVWdD?= =?utf-8?B?QUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71f753bb-778d-4c37-0c2a-08dab406f850 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2022 08:25:25.8738 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XsCsHffAbBm4AqjbEtZPferoUnL7m892IdYZwVYnv+gzmGgMsy/69WDPBmdLf7dyHGtVix5yZAcGG2C36W+sVx2PFuSiX0biMKyFjYGnk9E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3848 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add the offload support of encap action of IPv6 NVGRE tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 00b4c6d..fd64da8 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -51,6 +51,10 @@ struct vxlan_data { sizeof(struct rte_ipv4_hdr) + \ sizeof(struct rte_flow_item_gre) + \ sizeof(rte_be32_t)) /* gre key */ +#define NVGRE_V6_LEN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv6_hdr) + \ + sizeof(struct rte_flow_item_gre) + \ + sizeof(rte_be32_t)) /* gre key */ /* Process structure associated with a flow item */ struct nfp_flow_item_proc { @@ -2867,6 +2871,43 @@ struct nfp_pre_tun_entry { } static int +nfp_flow_action_nvgre_encap_v6(struct nfp_app_fw_flower *app_fw_flower, + char *act_data, + char *actions, + const struct rte_flow_action_raw_encap *raw_encap, + struct nfp_fl_rule_metadata *nfp_flow_meta, + struct nfp_fl_tun *tun) +{ + uint8_t tos; + const struct rte_ether_hdr *eth; + const struct rte_flow_item_ipv6 *ipv6; + const struct rte_flow_item_gre *gre; + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; + size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); + size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); + + eth = (const struct rte_ether_hdr *)raw_encap->data; + ipv6 = (const struct rte_flow_item_ipv6 *)(eth + 1); + gre = (const struct rte_flow_item_gre *)(ipv6 + 1); + + pre_tun = (struct nfp_fl_act_pre_tun *)actions; + memset(pre_tun, 0, act_pre_size); + nfp_flow_pre_tun_v6_process(pre_tun, ipv6->hdr.dst_addr); + + set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size); + memset(set_tun, 0, act_set_size); + tos = (ipv6->hdr.vtc_flow >> RTE_IPV6_HDR_TC_SHIFT) & 0xff; + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_GRE, 0, + ipv6->hdr.hop_limits, tos); + set_tun->tun_proto = gre->protocol; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v6_encap(app_fw_flower, nfp_flow_meta, + tun, eth, ipv6); +} + +static int nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, char *actions, @@ -2908,6 +2949,10 @@ struct nfp_pre_tun_entry { ret = nfp_flow_action_nvgre_encap_v4(app_fw_flower, act_data, actions, raw_encap, nfp_flow_meta, tun); break; + case NVGRE_V6_LEN: + ret = nfp_flow_action_nvgre_encap_v6(app_fw_flower, act_data, + actions, raw_encap, nfp_flow_meta, tun); + break; default: PMD_DRV_LOG(ERR, "Not an valid raw encap action conf."); ret = -EINVAL; -- 1.8.3.1