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 24095A0543; Tue, 25 Oct 2022 10:02:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1F5742BF7; Tue, 25 Oct 2022 10:00:29 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2139.outbound.protection.outlook.com [40.107.212.139]) by mails.dpdk.org (Postfix) with ESMTP id 6510942670 for ; Tue, 25 Oct 2022 10:00:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V8gYYScp+O1ohbGAQbrFitf0dneHo7XZFnHMUTbdU2BKZt/hLGjXFBN6/XTmIbQq2gXtrIRNj5iidHFLWXt3sZC6hzBRzQGRMWwfF54kKYvGFhOfBKww0PkjYfa/zsBca9vozTFFJ9o/6Pc+1NlyRAGmrsjJzw8S71M7EE3Hc/rasqc+/uZHOMHjeN7Im0iwa2QJ8833wfGDUF9P8YemLI3v5xKiShZ/ATxECOQggTnSgtyd71ZaVT0pmvXgIlD0TTgn4C8bwuhiSXpmHsC9xpTJELNeZYtciLHhzonPNz/8WaImFHvj0PsesFYovT2+66pI9YActKvYes/ofi3M7w== 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=nuS26QShNul5FItYgUTXFQiwVrr8Ny3loLniPF3lAwQ=; b=Brcy2xKgIesKtzGSoVk9W3BH0ciqjraDnnpH22oD4L6egg+GpIlqR/wJqh16NQ4tNjZ0wOIDW8EiyheMMWCJebcxoPv3CewE6l95SEabqO0cvwGVMdYNVd7LPgL0gWwM9XZbYlkm2MxlrPzDHbNsk0uXwccRxNm24Dr88+uFCebdDzC4XWKBpCb8PK/TEUSu/Q8Dt3rTUEhg03Le9aoN8Ze07tlsHJt36vScMreQsChxIVlzm+zkeyLbxzIt7ZcHEQYQ4ChwPt/cVFsHTd08weTgI7/mM+iYrkyIK29anXYURsIYGEzCIfLe/ouNNwKiXmtjkrIAepyP9T5LHZmhgA== 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=nuS26QShNul5FItYgUTXFQiwVrr8Ny3loLniPF3lAwQ=; b=gB2AKYky57L9pvAaMEfgrnEMjCeeg3N0gxnq2yP9sxTQ76Nbem6/YhZGawejEFi4Tyv1ATAk3eVoxcXzwvK7WOUHXX6rq80M2MwN90BOOg15kBTtNyNTlDItbp4wYkwynGp6I6qt7r2a0mvWHYtPXX+2AsTbUzzCOMcgwR4+qOQ= 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 DM6PR13MB3924.namprd13.prod.outlook.com (2603:10b6:5:28f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Tue, 25 Oct 2022 08:00:20 +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:20 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 14/26] net/nfp: support IPv4 GENEVE flow item Date: Tue, 25 Oct 2022 15:59:06 +0800 Message-Id: <20221025075918.7778-15-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_|DM6PR13MB3924:EE_ X-MS-Office365-Filtering-Correlation-Id: ec6e4e4f-df74-4b0d-d662-08dab65ef632 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /F7Hjr87Ma8c0BATvMwgZ1ugFcq7JJ7/F4j4TIThxCKRlCy9D7hRdPwKIQ0BrHEL07YvZ3wpmJBuseYeVcZ7hZnecw+IcQlqYWFoCj8kCyHCxh1G34+5wag2pGPvlxqUGbdX1rl6FPS47KYyTiqvLnRXbmNS1YtFI1kIbmFtpzgB4lPbjlOSGrHQAoyMPX+hb4aQKlCozYulHhl5E14AyUWlR2MzAAjHBaIE2doIsoydrMJms60G3t+oTvaV65yKTDPdL+Ryg7lXR3MiVGPd7jxdhdXnbcKgRh6XN/6dyVUyCcVtCoIqKGU2X1lgmJBCR2OyFigGcN0TBJaqsH6Ep9kSli+QQyYZVKq9RGoA/n/qi0o9V456svrf9KI9w41D/Z0n68lpS+u/5Hy0ae4ldpxkuwohN2Ks4ODEdo8hnCUbyEBf30+mcLg6XDAJAQ0jH/RnTyx5o/Ii0SOOcKqLmSJnLbI4NUVpj0mdtKeDu5LFuI5mqfWixvhTwWL9JmSkjuR6BakyG2S5g4JWo4t/7i1cjSVco7Re6taglsNZQJrFp/WMNT1Rb9xjKIWLs1x2+TtAmJin2gMg2e3GmMeK2mliG6qgOuSozXznNg2RcpVtNN6iKdiLVIiDZvMSUb765L9b7arZGmycfmoI1Let4JZRy6nw4Tq+NfzwIOgM8jY0aM/ZKiwM++UNJyX9XaYK/IySjaLJx04nLCB9FXTYy8LjL6up1NkZSWIR23KrOBV6bG/Ih9BvkecduOwI1ghd2S0v4IDN0kvJ2LhpSZ4Thw== 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)(376002)(366004)(136003)(346002)(39850400004)(396003)(451199015)(86362001)(2906002)(6666004)(186003)(1076003)(107886003)(83380400001)(38100700002)(41300700001)(2616005)(8936002)(6512007)(36756003)(5660300002)(66476007)(66556008)(4326008)(8676002)(52116002)(66946007)(26005)(44832011)(6506007)(478600001)(6486002)(6916009)(38350700002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bFh3ZVU1TWdpajFpcXl3TWRoYVhzbDdaZTc2RldLVHQzU09nZ0lUZVZOQU9H?= =?utf-8?B?UnFWaXpLOUdWWnRDU1JRUytrTXpwWGtuMHp4TXV6VkhJNnExMkovMnBUWGR0?= =?utf-8?B?OUNGTGRvbjRlZVJONEhsRHU1SkN0WGhaNytkRTRON0Jad2FjYnYraXJuMjha?= =?utf-8?B?QllUVDkrRnJCZXYzZ050UWNMVG5CenVFTFE5a3pNQllEN3VCc2dUYUJ6S3dK?= =?utf-8?B?ejAxSjVISGs1bWt6TGdvQzRtRXhxSGs5RXBhMElVZUwrNWd0N0FjZW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2anUvMUNZeXQwN1RkbDVrR1k2Nk1wM3ht?= =?utf-8?B?VmY2SFhFckNqRmNsSTBTR2VzOTliUUJ4cWZvZHkyNUVtajBYR1FmWUJSNWFw?= =?utf-8?B?Z2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec6e4e4f-df74-4b0d-d662-08dab65ef632 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:20.1787 (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: REXVvKS41BqNE9mQiQHmeLdxM6P6ZIiPTGDs0TQ8gTO/Oew0bEjucAIBO98yOne2rtfD4zEeihIFfeYObIzj+WthdY0NX6KI0RvqxkYNlAQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3924 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 deb27ee2d8..2e215bb324 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 port_id = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 8416229f20..39ed279778 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -769,6 +769,23 @@ nfp_flow_key_layers_calculate_items(const struct rte_flow_item items[], 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; @@ -960,12 +977,22 @@ nfp_flow_key_layers_calculate(const struct rte_flow_item items[], 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; } @@ -1386,6 +1413,39 @@ nfp_flow_merge_vxlan(struct nfp_app_fw_flower *app_fw_flower, 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] = { @@ -1474,7 +1534,8 @@ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { .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), @@ -1507,6 +1568,15 @@ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { .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 @@ -1563,7 +1633,8 @@ nfp_flow_item_check(const struct rte_flow_item *item, 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; -- 2.29.3