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 4135EA0560; Tue, 18 Oct 2022 05:24:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFC9342B90; Tue, 18 Oct 2022 05:23:37 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 76BF142B90 for ; Tue, 18 Oct 2022 05:23:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JRlA1QLSCaxRTJQecFN70JbGizillDpB4duJmswZ8PMszvwc+hYu6oF7aMwAcvj2CdLhjRQVcn9MBQ7qPzwAbu6zp7vCxwhoTyAC1Ld1WNK9FnEcltP7LFpDpusta4Um4bSi21jJsPuRv7f3hW/FZV6r95S5i/tLx1k60RRktbnAEH6zq38lV1+J+P4JsEHdZVFkfbqFuOvhtHULzKBhsUKMI5/bouHY0RQVRKdOIURk/PWcXnRo/SRnvfa5waVEwxsbzeQjneP4suW5yRzrsHYoDL3JLM3dS/EORv87uIgLY4q7N9vBil9qENbA8lWbNmX6WNep4VSNb5uYnJ1T0g== 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=n4xC8m8BD0050iYQu7aQQttUk4UVL8SiFIGKJnVD5hY=; b=bYyxeHkOTIVhZmsv8ARQ+XrYx7uHagyggmpNHegBpvHvYMRgG0eOjuNyeESjEfGrb7sSSG9d/OSkGvsnBrgnV8Batqgj2TGepXtux+y9FJ8dtU0UA4qCwvncctxydzRB6LwnRiQXBHyJDL5iW+uDLdLRmxdyVYYEqXhls8fOg39el8dfziYqEBClRUOs+Atsj89WU8WiMAtWKyMJb+cwQqqBvtgB2nO/WeeoAfgNt2gS+P6V2xGeRE+tZcz59J4bSY/JfuIShovHT57qeI5djBGGmcGwlfburmZBBras0tVbUNjWc3ivTLRm4nyhZUc2HKAfqbFCfAozBk5KNe63Cg== 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=n4xC8m8BD0050iYQu7aQQttUk4UVL8SiFIGKJnVD5hY=; b=IJnzpyXENW6WN0bAP5FBb+yIoXn66FEz0vxPxpl2stuF6C0MSSkbbnqNl697T7Rgx2KdJXrDVpIOwxR1og06rXRXTaAH7ugblapzVhQO/V5nfVtQgvqXyNZqDV56ti/Yf22jmjxAmfngI1hCg83DKoy4inOZcMsvhVOhAswWLPE= 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:33 +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:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 17/25] net/nfp: add the offload support of IPv4 NVGRE encap action Date: Tue, 18 Oct 2022 11:22:31 +0800 Message-Id: <1666063359-34283-18-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: 274ab8ca-0d33-46f0-ba28-08dab0b8228c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +66LKZeB7wkt40FRQHrdzO7xwH41+BLaMV+qx9o8RZaQswg3SJCDAY06LuZqjz69gMisV5HYSLNiisUY+GKLLfOSu9WYcezk8Wx5DXLz/WSt20Y/KazN1b81EAuspUC+MFwOrFBm98mXo/eDhVH9n1HVKFPJFsGvhd3NPBFMNB8PZcwAZyq49s9cvPPyceAdks90+pQWdeV54l23eVvcbqOW4TvJUet0YytdNk9nh60Y2kbe/SRJ+5Iam+8KmM3xk/vD11cM83mmiw60wY2QsF7d2aQUQ27tprA7OUZpg40stMJKVxH1TtkrvjMdypp0nTsKawxVPyKmo0HpAdlhIMlVtclDEV5MbBiUqVqyRQzoDpI68Sond/Pd7BhWmBYjcPoQKbvb9jdgFgsF27qM2aBZHwFzwzDYjlT/wKOyI1vzg/0HkBpbZtGcxKHjmcZ2k9De9OygzixnJFUG9nd8IZ/SHo9ltfZDcJw6mB/FMcnhS2POfLc41uJvm8ld/K3zo5yYruT0OQgaCZamRcnCeIGQ592SVvL66PC0xLjONrhUwGPlRNohepi1EKwbaheV36DAAt5voosNm1JTg7rTDucGL9noGSKnLPpkeQ4IaOzwPjl7bn+sMABq4qNkTZ7hGKpdj6xBNClLFowWxQLD26hvuEvX7k1k6ZzIKi88U5FWtVkv/nZLmkIq4We421V6VS6HY1K1anlnLKbHQNdK/LieS8Y6m4ISUQQbNqOa/U2MiybJ2ONiAsRmstFbR/lGKL+e8Zaav8z7uCpcUZoOiw== 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)(6486002)(478600001)(26005)(6512007)(6506007)(52116002)(41300700001)(8936002)(2906002)(44832011)(8676002)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SG45ZFJZbFRBK3d3UDVTVlpDOVVsSk81bTVXZXNuMmlFTnRhUUJHRnJnYTA0?= =?utf-8?B?b1BvYWtQRi9DcFg3Z0pENHlQK1hkUitBTFdMeHpSbXZQam04VG9lZFJ2QzBZ?= =?utf-8?B?NitZdUwvV2ZRNi9nWkptbnFjL29XQnp6ZzRRSXNmc0VUSmpTK3BWYUdma1Z0?= =?utf-8?B?RE9wYWxMSi9NUm83TFUzZzNRUkFRMTBHMDA0SzUxOUgyWUdZNm9XUXIzOXNE?= =?utf-8?B?cTVoTDBVczZORkhqUTlTcEs1MnFRb2V6UHludGpsdk9oMTVyeDZ5ZEpPSDVn?= =?utf-8?B?NUwwVVVZZzJKRkhoVmFVR0hUQ1FXazJHQ2VYNX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Wmc3NTFHUElmcHpneHF4SVFzSG1vL3R5STkzY3MrZ2pibkpEdUdE?= =?utf-8?B?YXc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 274ab8ca-0d33-46f0-ba28-08dab0b8228c 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:32.9433 (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: 2VY9cmX1vGRGwsDdqMQEYAwPvMItmp1TXZ9zIupQeKb6hTVoXcypj/ijBVQDfsbkJvEFmOfAseYnsHPYi0X2N8BKEBj0BPctWlJ86diiR5A= 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 of IPv4 NVGRE tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 7453109..5a3d0a8 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -43,6 +43,7 @@ vxlan = Y count = Y dec_ttl = Y drop = Y +nvgre_encap = Y of_pop_vlan = Y of_push_vlan = Y of_set_vlan_pcp = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index f42cf77..823b02a 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -47,6 +47,10 @@ struct vxlan_data { sizeof(struct rte_ipv6_hdr) + \ sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_flow_item_geneve)) +#define NVGRE_V4_LEN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_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 { @@ -2846,6 +2850,41 @@ struct nfp_pre_tun_entry { } static int +nfp_flow_action_nvgre_encap_v4(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) +{ + const struct rte_ether_hdr *eth; + const struct rte_flow_item_ipv4 *ipv4; + 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; + ipv4 = (const struct rte_flow_item_ipv4 *)(eth + 1); + gre = (const struct rte_flow_item_gre *)(ipv4 + 1); + + pre_tun = (struct nfp_fl_act_pre_tun *)actions; + memset(pre_tun, 0, act_pre_size); + nfp_flow_pre_tun_v4_process(pre_tun, ipv4->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_GRE, 0, + ipv4->hdr.time_to_live, ipv4->hdr.type_of_service); + set_tun->tun_proto = gre->protocol; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v4_encap(app_fw_flower, nfp_flow_meta, + tun, eth, ipv4); +} + +static int nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, char *actions, @@ -2883,6 +2922,10 @@ struct nfp_pre_tun_entry { ret = nfp_flow_action_geneve_encap_v6(app_fw_flower, act_data, actions, raw_encap, nfp_flow_meta, tun); break; + case NVGRE_V4_LEN: + ret = nfp_flow_action_nvgre_encap_v4(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