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 DC641A0560; Tue, 18 Oct 2022 05:24:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A95D642B8C; Tue, 18 Oct 2022 05:23:30 +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 EC4504114B 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=HoMkC/ixv4HFUdFebifBTyUtp1ScsJnCaYdwwgRuuCVKC+m5oinmLPO6bey/EAcJjtYrWsJWFCB0rEI9UWXxDJWtgymL0uRHAj4qg2ynu/P7z+SZ8F3ZBZ3me8Y9rxJksVyRksbhBXG779jbYeE3N+Okg/p202rFbsweKhpbLWyWyI9fxalJnG2/RL3cLf8cC+8ESGBAHcMN5htixGOQ+ewoNOHi3S3A12HYlkUo+HJkZWPYV1KgM6SZXPLa6TZ6ng/SYw8KuW+TzvIsfATcDwVCbh36bqutfppCzynwVfS0nhDbkPhEVfXm0/kvMwAG4l/i1b4YdbilKC2D410m9A== 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=1oa96l1hElyoVc+0w9bfFAMacAhLaEb8BLFCaD6mOys=; b=C8QENM38GCCfqpNDoa4xBdxYbM4YEvA3eHRTkOhfcbgzXO8Ewo174U1E1Bf+y5FFuNgY46gLX9KWVouMxec72ckEYgD6wQZMiGlOoXdYeWjBK18SdtmZhDjaXLDy58VsP8U1UFU5LY+yVjj74p3quCMTRgY/yAjpezuUMfy5kTJ3K95gvhK1Y5bYmuRtXd6FZ6NGVy+KMGYzae0s1oTUkDiH3dfwEu0M166dJA9DCzoa+mEEFbuSZZKHXkWFw2X1MehAbG6FlyyFQXn9Vzqwj/sBY/KXaLsJQLubQfzyszGawo3kV07fBPco7n2yMwHvAbw2Rdphbusb+EOj0JkvGA== 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=1oa96l1hElyoVc+0w9bfFAMacAhLaEb8BLFCaD6mOys=; b=EhAISLNEU5zzrV75X16DjJgYY8YxsQmn8qW1Y2/yFLniqVMXrU6IYjcyFjPyy2eaQxk4/kg/uxys4dXJVTQeqyGPK8MrEA5L7bBsL7YeeaNurjmeFrPrJFrdpGnFsxLM507/hrBoP4UcHPIAmnMwETnvZCjoaxLCDgWgvHnalzk= 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:24 +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:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 13/25] net/nfp: add the offload support of IPv4 GENEVE item Date: Tue, 18 Oct 2022 11:22:27 +0800 Message-Id: <1666063359-34283-14-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: af8185be-82ee-4ee1-742c-08dab0b81db2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g7JnPqUmuZHoT6Xbkdgpvw8tdMrEE1P0MVrOir3OfiNz7rYZ/l+RgvOuu8ICqBKcg7SRxilR2K0CQx1HnDz848p7RznkRFZT8L6vajft0Uj84lFCnUrQkvhj2s9LjdzerF1ZWrKjp3HhclPXl59I2VoZWzyvauzQe46TL5/KZ/S8VIgklubdENgWYMLZWHvdvwaSGUtrjFZUFeW0z/mclGCsKG3rOiMznxhn9wMy9pj9c0MAOSxLDatYSxILnpPIT/7zGDQYhVYe04yQ410eRymmxsX+TkKxda1XKVwhN1xFCK7sbGWm1l5i5FTIY4dqL1XfVkHbO/8hGHdiPChx33NA4mxPzhaXmXrl0Jjnc+wFDBBh7ZMdwNZjO4dHKAicOnW2QPsfWn+UBk2fVfyYdLcjoGEkSwJYD/LdgETMUeEul/ftwnkSW5hGVFhnXWXz5f1XP4DPDU7Nk+Lcl6uKFXsEozVe+vYbOvWciiFr7FaOh+VnABXVoIaN0e1+NhGAByA4EXQUZqm7Bf8FbafeG7evPCepx+1RA/SoSIP5HkAjU/gqH9KW9zcsCcu2R7JzXeMZegx8Iv2S4lQRAFII75IkUsjoiTUDVhrmt7WOTVZzvPGTkKANIB8bWeLdmxDrjWopq3JVEcBKY+GLj8Jb4ab61/QiSmTJsCr/tC0umneYxZJGiZUw0rtRuSbe3F4jSoUtmKdaOwThlUeAriSukLY01xo0lTovrm0I7O256sA8g1RPG2laI8b/ikbho/fzDopIMfSfW+EmEP51D4FjQw== 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?K1Z6YXRTdEd1ZmRGQXc0VTJiZ085LzN0bUxJUGI3WTJubTVMY2hJUlB6ZjhS?= =?utf-8?B?aVAvZGVrSEhUVmcvb0NqTjR5L25kZFJjaWxYcXNjMldxeUNTWFp6b2ppV2x3?= =?utf-8?B?UWRnZWRkWDBHTVl2aVAvU21vam16b1dUc1dHVDhJOGFDSGViaW5GSmlmQ3V0?= =?utf-8?B?SDdWdjAraC9QV1RQQTdIVGlOTkJyeVEyQ2xpTjZrR1E0d2VoME1aeHJXbDY3?= =?utf-8?B?UE9HbTZQZDRzZ2pEQXlOOVA5MUNhTnJQc1pwT05oYXh1c082QjlhQ0EzamVz?= =?utf-8?B?TDdRZlVhL0VHSDkvR3h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?utf-8?B?SjV2T2JFRFQwbmJEclI2Yk5BVURtRWpTWng2OHpVanBkVkUwNUlsYXVkdTdL?= =?utf-8?B?Unc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: af8185be-82ee-4ee1-742c-08dab0b81db2 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:24.8032 (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: 2AWqnBCVPakxxmASPoyohNVxeg0bjY8/x5BYZLNG1CHZm+SOxsvyxUeYNL9Oj9UbAmUCusWeIO2L1QQaw544yTY2aUySrFzCSvT9Hsmo0P4= 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 corresponding logics to support the offload of IPv4 GENEVE item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 75 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 171b633..4c0d1ab 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -28,6 +28,7 @@ Usage doc = Y [rte_flow items] eth = Y +geneve = Y ipv4 = Y ipv6 = Y ipv6_frag_ext = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index d93883a..da3ac69 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -781,6 +781,23 @@ struct nfp_pre_tun_entry { return -EINVAL; } break; + case RTE_FLOW_ITEM_TYPE_GENEVE: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_GENEVE detected"); + /* Clear IPv4 bits */ + key_ls->key_layer &= ~NFP_FLOWER_LAYER_IPV4; + key_ls->tun_type = NFP_FL_TUN_GENEVE; + key_ls->key_layer |= NFP_FLOWER_LAYER_EXT_META; + key_ls->key_layer_two |= NFP_FLOWER_LAYER2_GENEVE; + key_ls->key_size += sizeof(struct nfp_flower_ext_meta); + if (outer_ip4_flag) { + key_ls->key_size += sizeof(struct nfp_flower_ipv4_udp_tun); + /* + * The outer l3 layer information is + * in `struct nfp_flower_ipv4_udp_tun` + */ + key_ls->key_size -= sizeof(struct nfp_flower_ipv4); + } + break; default: PMD_DRV_LOG(ERR, "Item type %d not supported.", item->type); return -ENOTSUP; @@ -978,12 +995,22 @@ struct nfp_pre_tun_entry { static bool nfp_flow_is_tunnel(struct rte_flow *nfp_flow) { + uint32_t key_layer2; + struct nfp_flower_ext_meta *ext_meta; struct nfp_flower_meta_tci *meta_tci; meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_VXLAN) return true; + if (!(meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META)) + return false; + + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); + key_layer2 = rte_be_to_cpu_32(ext_meta->nfp_flow_key_layer2); + if (key_layer2 & NFP_FLOWER_LAYER2_GENEVE) + return true; + return false; } @@ -1404,6 +1431,39 @@ struct nfp_pre_tun_entry { return ret; } +static int +nfp_flow_merge_geneve(__rte_unused struct nfp_app_fw_flower *app_fw_flower, + __rte_unused struct rte_flow *nfp_flow, + char **mbuf_off, + const struct rte_flow_item *item, + const struct nfp_flow_item_proc *proc, + bool is_mask, + __rte_unused bool is_outer_layer) +{ + struct nfp_flower_ipv4_udp_tun *tun4; + const struct rte_flow_item_geneve *spec; + const struct rte_flow_item_geneve *mask; + const struct rte_flow_item_geneve *geneve; + + spec = item->spec; + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge geneve: no item->spec!"); + goto geneve_end; + } + + mask = item->mask ? item->mask : proc->mask_default; + geneve = is_mask ? mask : spec; + + tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off; + tun4->tun_id = rte_cpu_to_be_32((geneve->vni[0] << 16) | + (geneve->vni[1] << 8) | (geneve->vni[2])); + +geneve_end: + *mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun); + + return 0; +} + /* Graph of supported items and associated process function */ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { [RTE_FLOW_ITEM_TYPE_END] = { @@ -1492,7 +1552,8 @@ struct nfp_pre_tun_entry { .merge = nfp_flow_merge_tcp, }, [RTE_FLOW_ITEM_TYPE_UDP] = { - .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_VXLAN), + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_VXLAN, + RTE_FLOW_ITEM_TYPE_GENEVE), .mask_support = &(const struct rte_flow_item_udp){ .hdr = { .src_port = RTE_BE16(0xffff), @@ -1525,6 +1586,15 @@ struct nfp_pre_tun_entry { .mask_sz = sizeof(struct rte_flow_item_vxlan), .merge = nfp_flow_merge_vxlan, }, + [RTE_FLOW_ITEM_TYPE_GENEVE] = { + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_ETH), + .mask_support = &(const struct rte_flow_item_geneve){ + .vni = "\xff\xff\xff", + }, + .mask_default = &rte_flow_item_geneve_mask, + .mask_sz = sizeof(struct rte_flow_item_geneve), + .merge = nfp_flow_merge_geneve, + }, }; static int @@ -1581,7 +1651,8 @@ struct nfp_pre_tun_entry { static bool nfp_flow_is_tun_item(const struct rte_flow_item *item) { - if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) + if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN || + item->type == RTE_FLOW_ITEM_TYPE_GENEVE) return true; return false; -- 1.8.3.1