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 43795A0560; Tue, 18 Oct 2022 05:23:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE4DA415D7; Tue, 18 Oct 2022 05:23:13 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2119.outbound.protection.outlook.com [40.107.92.119]) by mails.dpdk.org (Postfix) with ESMTP id 70EB24282E for ; Tue, 18 Oct 2022 05:23:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2bZLOsjywGVSh0jKOrm5VblU660eqoONOExbaWGEfdBxkiCUDVAzFos2DNRytDgZSjHoNWlXMAvNv88jcf6ZRgXUDW5oZO7Zso9RVX0gmTkQrWVpNVXjU6U3ggcpWIOOBzGKExdk5rSfYFdyXEHVqPjPOtU891FuP0rJA2P536c6ZgaRreZlJ0/kpWIMaFfer2kkq/w+t3ydLhuqL8IoG2MaCZ5fe8id3iuxaGpHOLTSmkyYphrlFWmpeKuJuZVsksc7iRUdlUPM5EMAFC5SAVHbB++KilucrQbKn8yNx6cHNYAgson6sByxU1vMxYIGODxPiLxECtsgmW0sgvDlw== 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=1QFDkLsZiRHjafhygBu2xgvNNIssy8dqSvB8BUs4Uv8=; b=Vsi59NmsiKy3QMop5bpeN9XyHsgPjLuejj/HLOg5oQwctxcg4KidQJxgY+DJHi4TYuF/U3fxn/9K3n/qWrL1E9A/F3TUQxnjnclW7A3P/lkmGKkpzy9PUJJXp4wTwEzudkCSbGtaKw+pXf9wBIfgZUZAOudNqqA9FR7K162zibkNs0bO3iWwYr2gG6yo6opTVYmVOpoEtwzHtD0lLbZ8O7D8erhvOrSLWgNp9eB14O+Koz6raoF3/1QVMhzV8oopsJwJhgbNY3Xi556MITOkcOnVx7Lv9Y8gV+Wfe9J/G7bVGZm4HhO69NcMin/7ViM4O+LchWAxmmy2uRsptf7Xlw== 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=1QFDkLsZiRHjafhygBu2xgvNNIssy8dqSvB8BUs4Uv8=; b=CpnDOvflPGknXRXU2kXaNmN4UD+Xe2TFUR4P19mt8h2AqKHlpoPEG+GbxWNmBpDrR0zsNm8XaIJa1gKr0Vrw7jHZmLvc8EpPzK7i+hwVPX6cRRDXx9QFhuDjxlxpmjAgSmDqKcieXZ51uRcBFOr/9DkryBjYVkTGCq6eMtmG9q0= 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 BL3PR13MB5147.namprd13.prod.outlook.com (2603:10b6:208:33a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 03:23:10 +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, 18 Oct 2022 03:23:10 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 06/25] net/nfp: add the offload support of IPv6 VXLAN encap action Date: Tue, 18 Oct 2022 11:22:20 +0800 Message-Id: <1666063359-34283-7-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BL3PR13MB5147:EE_ X-MS-Office365-Filtering-Correlation-Id: 05377338-c292-4b2b-897b-08dab0b8155b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yc7FZkq4TVyt8OczvS9bo48ps47Pyf3RzPhMBVR3bLJsIa9jx7Qu0IKX7ReIUBGUsG+PjGT+su74Ip2oW40K7T4YXjvTVHo75bc7LSFFfa085xFgOlSLOhI4EhkZPS7iMYo4QSAt4m6pRrdjgEzjAMSbUtBbgfop1mGr3MU8d01HCyzXnG1wqMNYRskXDs8TgW86pPFcvPd8aEHvujbPEXxxsa/IZoZQFTjRiNDB7Jm2g5BXD0wrWN6DjJcAT/zVaLPtDSh7CXeOEbo5qBnaAME3TIYFAaxLoBDQEErYGBPEnFn/tG+dxxHNMc93TAOM5kQ9EvD07mIAGsjlSM58O6aR2I/Dk7TSfGeYtPU62B+Z2VPcKQX3oy288XxU+rDjw0kpzH7rQUvE12M2c9DUQl7PZ2tgv0rnaoEOE9VQg0i8bNVdfDKvxdrmidhwdfFMrpX520BoEqYShjxGkG69ZXhSJz8s5fI7CABUuFfNNRifL1eGmK4I+kqQHdVcnh2iw0axDfRx1DdfpJjO6rXZfZB4npPzPxz0rGHyaJqGn3/DT5OfZQxsTmEd69008VWu00QgNSC01M2I55A3IYRtlr1LaICZUalb2RFMIgRtnoO7q0oQ9/PyEUAei6ChUcpTbHXeanlvAJNgoEzRVf1kIk1DP5LotHiXwle7MNPeS0I9Jg3lIPBau6lPBnqvlIRo3xGb2DTZFZCvVCEYnUAIMIdudY/ZQGjNN1McvFg+5QqGI+kI0DPs3i3wxJP7+Oi4bvTWxQNqJR4Pm+Tj4FurmQ== 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)(346002)(39840400004)(396003)(376002)(451199015)(36756003)(4326008)(66946007)(6916009)(316002)(5660300002)(66476007)(66556008)(38100700002)(38350700002)(86362001)(107886003)(6666004)(6486002)(478600001)(26005)(6512007)(6506007)(52116002)(41300700001)(8936002)(2906002)(44832011)(8676002)(83380400001)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OTZqTHBGc2dKYzZSUkNDS3NZRGNlVFNlMmd0M0FhaW85dmFGYkRuSjhBazZP?= =?utf-8?B?TVptWEdoOENmNFhud090OEo4ZXk1K0ZlOEZVaHVkZnNTMjZ6RVJpTFZMV0tY?= =?utf-8?B?WVpvQXo0U3JBZVNrVUYxMEFBQU4xODI1amNWOHg1UFR5eUFodUQwVG9XMGVa?= =?utf-8?B?ZmVQcjhOdVAvVjdweXUxU0hzWkFWSHhqSGhSeWdzZEFxbmYzWkY5cmlBanpP?= =?utf-8?B?NkpSV1JwaHhpM2lyaWtJZjFXUm96S0xsaWtyUFFqbzYvRU9Wejd2aFZyTlFL?= =?ut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DFlVTJ2S1NjOElZNmFCVzJmWW1sUlBIM2dWenRW?= =?utf-8?B?aW1RMHNVWHVPbHY2V3VTeitpeUdFUko3cngrVGY4ZkhCUE9rN1VrakUzdWE5?= =?utf-8?B?ZUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05377338-c292-4b2b-897b-08dab0b8155b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 03:23:10.8275 (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: cZz2wTZFOpo6K3A1z+vNCo7GYySqhqvNbtTz7rDnHqCBisCubMW/WpML1pNIai+9h0/OdjZU5dp7byTIbEhALCExe9DKa519Qsp0goHNPc4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5147 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 --- doc/guides/rel_notes/release_22_11.rst | 1 + drivers/net/nfp/nfp_flow.c | 48 ++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index c2bf721..351fb02 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -184,6 +184,7 @@ New Features * Set the port number * Set the TTL * Set the DSCP of IPv4 and IPv6 + * Encap of VXLAN tunnel * **Updated NXP dpaa2 driver.** diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 2f04fdf..b9c37b6 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -1817,7 +1817,7 @@ struct nfp_mask_id_entry { 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[]) { @@ -1903,7 +1903,7 @@ struct nfp_mask_id_entry { 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, @@ -2032,6 +2032,42 @@ struct nfp_mask_id_entry { } 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, char *actions, @@ -2045,7 +2081,8 @@ struct nfp_mask_id_entry { 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) { @@ -2066,8 +2103,9 @@ struct nfp_mask_id_entry { 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 -- 1.8.3.1