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 780D4A0032; Sat, 22 Oct 2022 10:26:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEBD742B95; Sat, 22 Oct 2022 10:25:21 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2102.outbound.protection.outlook.com [40.107.244.102]) by mails.dpdk.org (Postfix) with ESMTP id 955654114B for ; Sat, 22 Oct 2022 10:25:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eHgOBHlEHSbadG1EOeNuF3vYQwIGJYtGYWOLzeV4POxNhoUBPDJ1iWt8+lVfYVDAGkUCVJW7u7TziEkUoYtsR3Y23Kz72UXxB/IQh54QgZUXmu4AIzoWxvTcdcctYM8A1RTWGF7FQMyGol1JbRUsFW2URRIBg40bD+Nl5EtWs7JhudxoSxblACJ/Dod11++Gxt2UmgJvBfyuYX+7J4ax5gnsJBp27rcVm71S1NWVsWKOojhcRuWpRhXSuVadKsJLtCepdyfHycFFDocuMlXSTnNORHZKdik3W3mgtHDDeZXCSGJ/kOM+7UPNnhuX8FAvFABS+NvveKYePmSNsyU7ZQ== 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=apHINvhEFdlWYqxiH5+vjIx7Ith5rok4er2UwCTQoPo=; b=ZPmYEGulzIPa+ZbJ+CHzz5E156iklGcPWfcIIz9wuK6bM4e+kUykyac0OBwgJ8olcoIj8OPNSrwFrGQpwXREuuXHJ2nF/F00WW1rIUN7ciWm7UPPBo6I0HA2GhGrqjqle+8k1XMBO1v8fWKdrZq/hNVHvgCGoPbZXfqQvGf9hWb2HUv5S9ZXoo1mGRGsoQCr9axKdGzu9E3g6m/x+iMkJdC/fVRmjBSm3gRcljagIbkrYpd6BZ6F+mCZpa+4zlYmarpzL2eHkBJ/tzJ4RjIxZi6Hw7zxnBlYuj2b8mnWBuNTrdZgLRghxC2HlrOsNu7J7IidBj0jfz5ZX0fSiHslgw== 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=apHINvhEFdlWYqxiH5+vjIx7Ith5rok4er2UwCTQoPo=; b=AkYe0wU9O49VjtyC70aAQL2IY7XyNnhxGhwQMzG5/VwIR0inmeksfqJmarT2nYDzELJGRgUbf03C8e5HLf+xZR8RnxSVs3bf2qmzjgKiwYcpsZ/raw+7gixY58ewwQqN6446RijrI5mKzu0Jtc6xDpDp4EI2hEpwHuC1f+9c3sw= 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 DM6PR13MB3690.namprd13.prod.outlook.com (2603:10b6:5:24e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Sat, 22 Oct 2022 08:25:14 +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; Sat, 22 Oct 2022 08:25:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v2 13/25] net/nfp: support IPv4 GENEVE flow item Date: Sat, 22 Oct 2022 16:24:17 +0800 Message-Id: <1666427069-10553-14-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> References: <1666063359-34283-1-git-send-email-chaoyong.he@corigine.com> <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0056.apcprd02.prod.outlook.com (2603:1096:4:54::20) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB3690:EE_ X-MS-Office365-Filtering-Correlation-Id: e13d9566-32a9-4c78-caf0-08dab406f12c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6605vzkRwgHC7BPPfW5xzrVFFEb13euRBQrXGfBNniURM37oU25HQwCrdiqWbF/hUqRmyEY/jhSAncKDNzvhxVc0q4jaRGBDa2uSs6vTWu/9Y9L1wuRCfrHyBBHDuTI6vyQK1R/4Rd8vnljh5OuQmpqQZCI9MwxJ8DhIKdQReje7h6wxeYLAuFGtpoknCPnkVGrN8hYewEdGvGns/cfSIn19MJ0pgbQLN0Yl95AUSuCNG6YmQEOX7Jeh47AjGtSLin83NVWrZe9cJzfdQmWYurwCCBUNN1srA8s8JGVxIPrWogj3aKrRcJx0BFWOnMwyKZnc30In1eUE47sqzCZ1BlC7go34xQuqjrguDqDqjLWGgaMkt3k9G9hYxW0weFo2TdVzSsbDkKL0smUXHbQyGEGJmu2/9uUhi8sjrq67L797Xo57Kp5XLvMe4rzvw2v4Y1Qe+5SLb0ySHozduIYS++oU+aTeO87QYhjVcp9jL5SHiIl/NWNTCjr1YI/XN4BDFbCYTcIPGbrXlYU9NOl1EXTcOgN0hRayBE942LxdAmXME3ZaUlWln8O2CMQQSYLRKT5n+BNnPSXeyukS0TMN63IlSsLKhGAp1c0ZFI4wFjnYxPHrmFQ6h289Dk+xZp7AvoPeUMHZ/EQ4CLlEYVHUOjvormjBT8fUnzUV4HCp4IW7fPxrjFLkfk63k1/qdqodBuLJOkwhe9R01AVDEWUYUlg3iVPqs2ZKCeQzW4V6yx4yVT0hDjz/FaZHu2ucvTTFXgS5MCM2hM8BsQuPnbNh8Q== 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)(396003)(366004)(346002)(136003)(39830400003)(451199015)(6916009)(316002)(6506007)(66946007)(4326008)(52116002)(6486002)(8676002)(66556008)(66476007)(107886003)(478600001)(6512007)(2616005)(44832011)(41300700001)(2906002)(8936002)(186003)(26005)(5660300002)(83380400001)(36756003)(38350700002)(86362001)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RnFZVGdiWTBPRlZPUnphYVNZSE8wRWJCclJPbjdabmt3aktpeU9WSGJ0S0xo?= =?utf-8?B?NHFFMElSTk9pZFEzYzFsMndqNDZCRXVqekh3YzFmRmpRR2d0OWgxRjByc2xG?= =?utf-8?B?YXNLamxNM3NobjNnT1JEMHJUNDREdHViYktQbHVlaVorZFRKMUJQTDhkbzRV?= =?utf-8?B?OHp5OHFnY1NnNmJuR1lyU3hPTFBoVzRxblBXdGNuc1pWZmxPcjYvZGFBR2VN?= =?utf-8?B?K2hRRXFpbzZaZmhkVHpiNTJpWmZmNk1TUXBqbm94VmFsYkh2V1h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N0Uybk5zcEFVTFpCOEUvY0JnMUxSdVhKcEFN?= =?utf-8?B?NnRSMTA0dmxFZjYyZEFUemJVRW1rYlpTYzVBV0YyOEE1eXZvZXhKS05LZnRk?= =?utf-8?B?eWc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e13d9566-32a9-4c78-caf0-08dab406f12c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2022 08:25:13.8362 (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: p0Q87HxUBvLzwQliSFprE42FaOoqcB1uT84bcv6v0JeXoMEgOkmldI6vckOn77FjkaTM3/5/SvjNeUZH20mmEZyY0f06b37FWXh7fWGuFLU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3690 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 95c97c2..14fb6e0 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 ef19231..a6adfa5 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -769,6 +769,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; @@ -960,12 +977,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; } @@ -1386,6 +1413,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] = { @@ -1474,7 +1534,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), @@ -1507,6 +1568,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 @@ -1563,7 +1633,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