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 A4FECA0560; Tue, 18 Oct 2022 05:24:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C833642B88; Tue, 18 Oct 2022 05:23:29 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2109.outbound.protection.outlook.com [40.107.92.109]) by mails.dpdk.org (Postfix) with ESMTP id BAEB641145 for ; Tue, 18 Oct 2022 05:23:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9uqIxfGKjKorcagUDe5yci1j84IYZGsxE5TJ0TcQcHCCyQLpBKFONnyRrJOTjnQOE4UtptKSzIfmDAOfQy+EtjJ8UVKlIWFKI0aw+KM+q7M8Qh7GJSvLppajXwWLjhmOg5EdTXHls8X2uXooPUsTBLVq7UFWsid52r+NuLQeCudSdS+dDkwGiAaLnUKOlUT87ihpgcs7QtaBhoa5FSjt2Ot61AZEAOJDb2wxcXI+tUpIqM/UwaT/k8pPMXWw08QuWKX1G3HcIoauJ0bgy2ZfSHNWWkcEO6iOGluxSEnI1KZYNa4LvdMo5GvO7UgxHvRclk1SgHKhxIbgC/6EZg62g== 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=7GHBLz1cR/VmFQTrIPDkcU7ajdKSd8zffLPogdhvviY=; b=SK60qhvrDd1pqvRY1sU5CJh9+iiZGnlCKVfuIdLFpkxMLnUqQKhwv3s15eCNAelSxdVjCXLjJYlWudiPUXnVLTCwPWs3sxT51jWvlMhH5Vp7EgGd1pSnUlJRvsHahs6TgDgVqzV5wxrF2H/LrGzA4FrOyBLy52i5+0m8P7/Xy5d5E3ho3jsaK4POKsgiVuDhceJklgUG9o8rLQx/UEZ6rbVVobvqJGhkSrVWMhjeyH5AY72mZQ0UCXsBoQlcJobqJcrlfSGdZx0v8xT2ZluUyCWex3ATluFwscznHtZnuHiIGcMTFqYGMsCbHskcqThU6Scw+BpssMosdMLj9GlNTQ== 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=7GHBLz1cR/VmFQTrIPDkcU7ajdKSd8zffLPogdhvviY=; b=Z4JlUkod7RN1ihqRpi2P5RtSnIOBBRCs+jvSlZrs93OFY3PYyiuFerIjKzvg0J+L928NQm/NSR3/sRn2quGcEKpOMdFSza2G1p+l9hIt0bzZYQwAJtIInYbfHpjuhvhKik+UBAHZAo99JnkRIiW3AUTdIMcUPYn1DGQNqTytwFQ= 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:22 +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:22 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 12/25] net/nfp: add the offload support of IPv6 GENEVE encap action Date: Tue, 18 Oct 2022 11:22:26 +0800 Message-Id: <1666063359-34283-13-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: b56c3797-7793-463f-fd27-08dab0b81c79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4vBXtcIEDew3EXOVJA3BAsbGIkG+qQXhwaSfWRvcwKRs5yPkfPsFQjhy8XjiTVs6iPLobuiZ4wdrLbdDBKz/p+7+Fz/Iq+Niq1vdt+rFve+z/hYxgZrApE+41bPe/i8ET7mpmLk215C6TiZbRIFWzKJ0Trjh4FsxNpDbIYIn6emSc5PboefrNWylPTvyY4ctjDTsVN8ApDrzdcqJ2YMXzv9eg8T9UMtQJv+/xjDmtUoeXmuIJzqoe2JnKDdTFPchI3P14USbDne1I/HGIMgc+vFIKn3J5NmUdi834NVZQs/kRJegd+C9W1ozX63TcJp+0yum/nuH7nDawsBsJpUsb8i3mLUQttorNcCj8DhsFpPcaRZrsAjJi5yK0xoBRNixzfCJ6CH/aRWTdfOmPpqNim5lgFQXUg5gzDQ7FUcmAKPwCxAa6I3rfKCmRBUReYFXanUNuDqpowPHzFhnEixeVnuWWHiiNgPl5hEnWs619IMZ+Ipu4NiyV+HBlZ/71wizDOZOlA4Ms85ePg/uLJtImnRJf4xTrlCwTx4rRl2FeGBhH72gRjxjJ5/naCqR8Itha+IZxPqTchCXDserhuSt+2GXVj/H3I3aykMKbhAz5oCtULXvY/RgDAjcsq5FVM0SjVPftv7jkH0kHgmAC8XDMIbzUs/zgELTwNF87iRJ9oU/641FcuLt6GfLEaYOy5asPsNI7e47vo2zzqaTXC/PMfuq7pbeOuCppkoCzMf313oJnYzjLyL1q3ZdG7HKoIdsqE4buHpLsE7V9Ee0Rc1loQ== 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)(83380400001)(186003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OTI5djN6ODFSZ0d4UmNRWnlCK1RjOEt3TUY0aGFwTy9hMWZnNlpFZnI2dWZM?= =?utf-8?B?bzJuQm9abXppZkF0WnZlN2VqSWQxUEF3OE1qOXcvdWlvK0NCbGZmNG5naUl4?= =?utf-8?B?ZVFqbUNsMzVRNThla3VmaUNXaXVzeFA4M0c3S3Vxb1dBc0pxRDU2elZwR2Iy?= =?utf-8?B?TXkyUm1YM3FHQ21pV3poNUJVZTUxYyt0T1l2ZytOVFRpdWJkQkdlc2ZCR0Qv?= =?utf-8?B?MmNocXpYTVduZkRudnBOUUZCQlBkdkl3NDgrU2hlU3YvRTUwSGxMZm9FRkFi?= =?utf-8?B?az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zJYa2V0VENsVExWTmxP?= =?utf-8?B?dHZHbjliZVFXSDNydUx0bnMvbEpkOFYzcGgyMUxCbmlvVUtOcjZvZFYyMnNv?= =?utf-8?B?S0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b56c3797-7793-463f-fd27-08dab0b81c79 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:22.7711 (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: sboCwb74JzP+P4/uO+omS6ci9WyreA/00+ffMj/t2QlxYRAA6JlgCVZebv0j4eFtTS1fsfSd4H0wXRNHtADRqHICOL67uxbyNdzV9i8DOSQ= 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 GENEVE 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 | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 49e92cc..92a0d64 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -185,6 +185,7 @@ New Features * Set the TTL * Set the DSCP of IPv4 and IPv6 * Encap and decap of VXLAN tunnel + * Encap of GENEVE tunnel * **Updated NXP dpaa2 driver.** diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 265c7e8..d93883a 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -43,6 +43,10 @@ struct vxlan_data { sizeof(struct rte_ipv4_hdr) + \ sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_flow_item_geneve)) +#define GENEVE_V6_LEN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv6_hdr) + \ + sizeof(struct rte_udp_hdr) + \ + sizeof(struct rte_flow_item_geneve)) /* Process structure associated with a flow item */ struct nfp_flow_item_proc { @@ -2691,6 +2695,47 @@ struct nfp_pre_tun_entry { } static int +nfp_flow_action_geneve_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; + uint64_t tun_id; + const struct rte_ether_hdr *eth; + const struct rte_flow_item_udp *udp; + const struct rte_flow_item_ipv6 *ipv6; + const struct rte_flow_item_geneve *geneve; + 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); + udp = (const struct rte_flow_item_udp *)(ipv6 + 1); + geneve = (const struct rte_flow_item_geneve *)(udp + 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; + tun_id = (geneve->vni[0] << 16) | (geneve->vni[1] << 8) | geneve->vni[2]; + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_GENEVE, tun_id, + ipv6->hdr.hop_limits, tos); + set_tun->tun_proto = geneve->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, @@ -2724,6 +2769,10 @@ struct nfp_pre_tun_entry { ret = nfp_flow_action_geneve_encap_v4(app_fw_flower, act_data, actions, raw_encap, nfp_flow_meta, tun); break; + case GENEVE_V6_LEN: + ret = nfp_flow_action_geneve_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