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 0510EA0543; Tue, 25 Oct 2022 10:00:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3BB142BEC; Tue, 25 Oct 2022 10:00:11 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2099.outbound.protection.outlook.com [40.107.223.99]) by mails.dpdk.org (Postfix) with ESMTP id 17ED542BE9 for ; Tue, 25 Oct 2022 10:00:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YxHZyNihzOUt9xj7ftdi0tFO/zaHYauUz54Qapn8uDHle4b8dL014YQ0wo1OiqsFkl5FbSQbSnT/zx8CiEK+BNKt7vCas9+gJbxTzTvS5vTxS724AzvlyK8ak1PaNHdzfqTD9fkKVOMYIcI/ho9wkW+ElsxEpxt/SAc506pAAYj7TzTy0xT/3S1T2Euo44C87mkh4Q17s4xS1DTjxFi9+BwXlrhWDwYtZMMrBvcm5QaEzmyYd1Vmlxm+5wAsN1ZovQgbJPOrtnU0UbeQUEJiJVxfubOJC8CDMcPJNxg4CCENOfwU1TXpTPwBIsEliwTpe0816ewVemDsMilEBH03kA== 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=u/6O6AXtdtmXzwHPzC90Rk6bMjlznA0EiuBpaR6PoRk=; b=isANva7st94bORApUXs8fPMuQHSl0lo09G6BGXqewmsE1R+itgPdicziwOzdHM/ENiQHE9fGptvwxRS1Wx77+hx5NW9Hcs8+Gx3tW90zfwUUHukTVDNkjJVP8wtUUN+IJ6a3FPIRq4sfd+wgzrBsGve7HX4mK7Ev7QsaOcQx9shF56bHDGODp1bmhcWT1LIPBBZt4qEhKIbxL9+uJDLs/55yfirdBEzpJvQOTzSEKqt6CObzdbdgPvi432jKP5U8EX0N+FvZdaMpBvV+MajsJtOhxjEPPr4nsgACdyxzqvTObc++G55hojVhaZ80Z6N6zFz3DqGoCmIPQ/G6ueIGdA== 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=u/6O6AXtdtmXzwHPzC90Rk6bMjlznA0EiuBpaR6PoRk=; b=izWal4pgMa62DIZnospOIZDKOOkUlsHewAudmmJBp5OBdyukbHNYXHZhI0sr99bkopaQ39M0vu5NqTLDUH4tpmQv8zjNQP6480hQ4kTURGCkl3xgtWCOgJjFIHtUE4E2Oqp4igP3jvjU9NhcbuOGJ0goBOp63LjfK6goj0E7MB8= 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 BY5PR13MB4405.namprd13.prod.outlook.com (2603:10b6:a03:1d4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Tue, 25 Oct 2022 08:00:05 +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; Tue, 25 Oct 2022 08:00:05 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 07/26] net/nfp: support IPv6 VXLAN encap flow action Date: Tue, 25 Oct 2022 15:58:59 +0800 Message-Id: <20221025075918.7778-8-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20221025075918.7778-1-chaoyong.he@corigine.com> References: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> <20221025075918.7778-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY5PR13MB4405:EE_ X-MS-Office365-Filtering-Correlation-Id: 1566f093-be71-4b0a-fe37-08dab65eed9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6shezFjb9onS5wTGEsVyYCeM1AD3/NgusAm0yviAlcqWy4w4C4yYeRFwgp+6FmZcVENJKHvRlGHT5e4FRjtH7rQ65tixWtyE56HtFEhKBLq7k4SufLGNe+t7Mhb+podfCjeaenRCBbamUV3qC1hEVHSwEtTlvnUhbkpr36dvnMYyjmL2uix5i0ReV5osTt4XwUvG9Y8ivTNQ0IOIaKtrfymzZqqEdVtKzqI3AYg6JoML5EHDWinPCrj4K9l4CQBbdHEsKEEaa50B1T5n8K8zVP21Vd59383l33Z4xor4BQPomJoDZ1UJW6FpWDSkdEV8w5VY55Pt8VA+h/0OIoZi1uxa4/SsKknUnx88qJGqMlDviESA5jbIn0J7wbuh4iugIZd16j6RS3mk/jZ/VPD1kKr+YzguqhGjEqkykiAx58J2wDMzI/aW8F3k6TM4y7+R4Wi67lsCLN+O2AtFfoLCaWmBZMBLdPj5iKRZcgmarYb00aSsV/TolTaIHbp16cqGRGzRvhxdyI6ZGlHkqwFJ5tAZDkkiqjK4BUnhDwCW92qwlnq/mirRtubKPZmDK3u65QjoTwz8eFwq3wrlhVJ4iNcfV1IJZH7GjoZKQ0LVsEUI45BfWcruCevzk1IaSWbjRU++FOzNicz+BdxJc+7JM2SKeSl51DQGk/ERCeGJdKNnp+wd8KOdGCQnYroiapo66vgaO3iY1zozJxUiMDuHSzSeNZOpggV/L/1lFyp2ZUYwN8+VKSFrIXeTj066SnYk3udzs3i7hjTanaYYfJu5YA== 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)(39830400003)(346002)(136003)(376002)(366004)(396003)(451199015)(36756003)(6486002)(5660300002)(66946007)(66476007)(8936002)(38350700002)(38100700002)(66556008)(83380400001)(86362001)(44832011)(6916009)(2616005)(26005)(107886003)(186003)(6512007)(1076003)(316002)(478600001)(52116002)(8676002)(41300700001)(4326008)(2906002)(6506007)(6666004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eXJBcTdpSkVJaHJOcWhkYjZ1SGJ6YjUwNmE0RVRIcktUenRqR3Z0SUtxZFNG?= =?utf-8?B?Tk5pYm94dVkwVU1qKzBydUNnWXh4bmtvQys0ZG1kTHlRNHVxOGZRN3ZDME1p?= =?utf-8?B?UXIzSkxSRkxnTk9wMFlGR0daRVNWbFQ5YzhhVTZyYUtZbU1sSWFjS0JNLzZa?= =?utf-8?B?TE5RWXFLWndsa0RDdjZ5RnZPTm96bThyYTRVT2t1dkYyMmJlUmFVdExVZTFG?= =?utf-8?B?NGZDUzgwbWw5UVBiTldPdWNMQy8yNkRRWTcwTS9tK3RZMTFra0R3VU5QN2c3?= =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dExxR1hnZWlDc3UvYzliaDVodnBlQWpPMzZs?= =?utf-8?B?L1JYcFo2R1g3Y0hJVHRaWDcwWnRFUEJNMWs1ckxSODNpSDdkQUNWbXlybytY?= =?utf-8?B?V2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1566f093-be71-4b0a-fe37-08dab65eed9f X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 08:00:05.8243 (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: rtBu9D2fhAp39+ckGjoYOLNVD1ztQLElN/WZ2K3jYQ7R0G6iVBq0nZKhzVfgAKtPE/CLh/hx/kRnzkf1uWT5h1416oIDqArXbU7salPwq1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB4405 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 for IPv6 VXLAN tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index d2e779ca96..9ee02b0fb9 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -1799,7 +1799,7 @@ nfp_flow_pre_tun_v4_process(struct nfp_fl_act_pre_tun *pre_tun, pre_tun->ipv4_dst = ipv4_dst; } -__rte_unused static void +static void nfp_flow_pre_tun_v6_process(struct nfp_fl_act_pre_tun *pre_tun, const uint8_t ipv6_dst[]) { @@ -1885,7 +1885,7 @@ nfp_flower_del_tun_neigh_v4(struct nfp_app_fw_flower *app_fw_flower, return nfp_flower_cmsg_tun_neigh_v4_rule(app_fw_flower, &payload); } -__rte_unused static int +static int nfp_flower_add_tun_neigh_v6_encap(struct nfp_app_fw_flower *app_fw_flower, struct nfp_fl_rule_metadata *nfp_flow_meta, struct nfp_fl_tun *tun, @@ -2013,6 +2013,42 @@ nfp_flow_action_vxlan_encap_v4(struct nfp_app_fw_flower *app_fw_flower, tun, ð->hdr, ipv4); } +static int +nfp_flow_action_vxlan_encap_v6(struct nfp_app_fw_flower *app_fw_flower, + char *act_data, + char *actions, + const struct vxlan_data *vxlan_data, + struct nfp_fl_rule_metadata *nfp_flow_meta, + struct nfp_fl_tun *tun) +{ + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; + const struct rte_flow_item_eth *eth; + const struct rte_flow_item_ipv6 *ipv6; + const struct rte_flow_item_vxlan *vxlan; + 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_flow_item_eth *)vxlan_data->items[0].spec; + ipv6 = (const struct rte_flow_item_ipv6 *)vxlan_data->items[1].spec; + vxlan = (const struct rte_flow_item_vxlan *)vxlan_data->items[3].spec; + + 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); + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_VXLAN, vxlan->hdr.vx_vni, + ipv6->hdr.hop_limits, + (ipv6->hdr.vtc_flow >> RTE_IPV6_HDR_TC_SHIFT) & 0xff); + set_tun->tun_flags = vxlan->hdr.vx_flags; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v6_encap(app_fw_flower, nfp_flow_meta, + tun, ð->hdr, ipv6); +} + static int nfp_flow_action_vxlan_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, @@ -2027,7 +2063,8 @@ nfp_flow_action_vxlan_encap(struct nfp_app_fw_flower *app_fw_flower, vxlan_data = action->conf; if (vxlan_data->items[0].type != RTE_FLOW_ITEM_TYPE_ETH || - vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV4 || + (vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV4 && + vxlan_data->items[1].type != RTE_FLOW_ITEM_TYPE_IPV6) || vxlan_data->items[2].type != RTE_FLOW_ITEM_TYPE_UDP || vxlan_data->items[3].type != RTE_FLOW_ITEM_TYPE_VXLAN || vxlan_data->items[4].type != RTE_FLOW_ITEM_TYPE_END) { @@ -2048,8 +2085,9 @@ nfp_flow_action_vxlan_encap(struct nfp_app_fw_flower *app_fw_flower, if (vxlan_data->items[1].type == RTE_FLOW_ITEM_TYPE_IPV4) return nfp_flow_action_vxlan_encap_v4(app_fw_flower, act_data, actions, vxlan_data, nfp_flow_meta, tun); - - return 0; + else + return nfp_flow_action_vxlan_encap_v6(app_fw_flower, act_data, + actions, vxlan_data, nfp_flow_meta, tun); } static int -- 2.29.3