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 E5026A0A02; Thu, 20 Oct 2022 04:22:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6A5742CA1; Thu, 20 Oct 2022 04:21:21 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2114.outbound.protection.outlook.com [40.107.101.114]) by mails.dpdk.org (Postfix) with ESMTP id 2389542C62 for ; Thu, 20 Oct 2022 04:21:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rz5IPR6u7oih2qab7kbzTF6jzJTYeVCTcbHuTaHCChrvPbVdB9jrK5RoJHF2KLpQmGsVkJa/wqp2ZJvO3SXdfxlxNqfr5r+OdKvgTtO2UETUX6bO7Lybh5JO1/lGRgMsjRFQDchcENbWzmgPO9Wz+pnVNCZhVXuuiMeIh8DpNjR1PoWiu2SrEtbKp6A4hd8TM8u8dohYBjKVsNF70rEy37hxF7q8mzstN611EVVfRuqj65ttBUWSMqAv5B8SMlAqsjLWTtskxPjK5o1Ni/QPwWdMdQqWevggcb0+q56oAOkDK7+tKeQn1DkDIttSebPuYObA1GQiP5jurRSBGceqVQ== 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=p8T/yNVABRcN40r2raI6dL8x8zb3wPz63yjKp1oPXFg=; b=N7+elnRCYebV34moRErrKTrSIHc+DaFQvWN9NoiOaNysqww1ipv6J7eHLKWw0CAeXUWIwaLD6YxYzL2PUH3akkWVtKIQUo164GRTzIay+G1KqLV1yTTzE6/bnXE8Phcqec7E8shKuMmo7IRqD7tYnaXFpDZA/1amhDaWxpQkD2hzgEr2dMdA+37InR5PF3In3YZ8V6jUlacBtkW7rsKVq9Qjln4gjFvwFWetRuets1oMFS+XF7QtfKi01qrhmgOvqM6B84zNPBb+TqmN4ZQMao7SXVUqYHZbFMAE49+XnwF2LHUVkrbUF53aaSrUaH43I8S9wQqr4R4EIGo7rkxZHw== 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=p8T/yNVABRcN40r2raI6dL8x8zb3wPz63yjKp1oPXFg=; b=ZiAOStTVNl6CK7E6NZnGi8DtxReIhioiIdWbmJYb9mxlXRhXGV5QCOYHqa6/uqrrhRAdegivkGav0rOkpiLPpOWsw+JIAol+Wp4+WQ+XxVge8td2TORK1PhicmA2QE4y7sp91ZqTussD0oxJa4CML5wip025xgqpK5CQ+dsu5U4= 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 DM4PR13MB5906.namprd13.prod.outlook.com (2603:10b6:8:4c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16; Thu, 20 Oct 2022 02:21:16 +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; Thu, 20 Oct 2022 02:21:16 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 11/25] net/nfp: support UDP flow item Date: Thu, 20 Oct 2022 10:19:37 +0800 Message-Id: <1666232391-29152-12-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:196::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM4PR13MB5906:EE_ X-MS-Office365-Filtering-Correlation-Id: ccf53f83-77ea-4273-1d1d-08dab241c44a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HIfiOJc4iTUPNFlwxU3e9q7aKCaCMwQRd2XM/HUj1/xnuTmT8O4OZ1FskFgS4xq8UEjZKrOXhdQ3+v/JNHdOVV57vKdJgQ9sTRaXgxjpn9AjfKX10o5lfKCR40fNQyneohHx3lKDTQ4X/3tz3UKv3xrAfzkoDWXDj+Bzx5P4GTYyvZEIjUVLeQfhtVNFwXADXiu5NOxcGORH6NtNty+1p6Mfp1oGZs+sT9iT/TPKGRdj08MXpH9+CATK0Tuh054vuiMiKqUP1f169BVdcvMWItiAWqiQp71BbE5VS4p9jEuc3+6YtW9tpOZ/sHXyqnRE4aFUKyGl2Cw6CkY8LcqkoHpuPOG8GOaLX1sarmDd+cpVY5x2EWoCrZRle4tOz5+aq1uxYx4iwA5mSPtpYXS7oaoYWuQzynK6RNEeTd+AjUnq+dQMciDyknB6K62Ztf951hvklcRCwfHyjz+ubDG4OyykK4jXrLQq4nhnDwa8c9h35t4krSKCTiKf5gp1tCt83axOXx54gtYFCqyS7LkHkEs9z+yeGufNXezXhBde0PTxi20WIjIcOwQsY5wvyx7FuUQAuQEf+XhU2BV/8pt4q8ZHeWv7vomsZZBqvQ6FYNt+6hnhB+BpUcu3Rm8hkemz4SoKv0XCAVJ+Ea8Ye5RpO3yXsZ5YQFMyuoe0uuv5q5V7VKlNd853u1OI632kX6SQmvlQuPF8eOs/wPTBwFtWdL3GyeyCg/ZPb1u3b++bXgFyNU7h3kdFZf0peFkh/STPWB3zt/+dtp3FARI/wqlpBnu/6z/5q9ciwvS5p/sDLgiqWsp8mGBPLGS549zMWRQl 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)(376002)(39840400004)(346002)(396003)(366004)(451199015)(38100700002)(478600001)(38350700002)(316002)(6916009)(2906002)(186003)(66476007)(52116002)(66556008)(6666004)(66946007)(107886003)(4326008)(6506007)(2616005)(41300700001)(5660300002)(36756003)(8676002)(6486002)(8936002)(26005)(44832011)(86362001)(83380400001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R0dRODdFSG5iYlBERW05dkRNb0tRZUkwUVdCMG9Bd0I2RExHY1IvNWR5b1VU?= =?utf-8?B?WVZORjBmMjhHbXZNc3dpWVN6VmsrQlJIK0JHWmV2SEdzWm9zMk5McGRJS2Y2?= =?utf-8?B?dFl6Sk0xODRLZFdGVFhvV2VGZ3dXaHNmb1d4UGRZNTRDTXBpQnd3ZG56VGVl?= =?utf-8?B?d05GUGdYUkNVQzExNjZPVWZaUWVaeUp1ejZtc00vNGRKT0gvbmpDV2twZE56?= =?utf-8?B?NnJ4WGticVFYRUFuVEJ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lu?= =?utf-8?B?VU1qVytKS2hOL2hGanJXVzUyU0NHSjhGU1BaMlB0VWF3UlVTbGQ2eUkvd2VC?= =?utf-8?B?aG5JTGMvVTYyL3g1bmFrS1FDRVRGdTN1UGxYNnU0VHNhb095alJIK2dDdVRD?= =?utf-8?B?V1E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccf53f83-77ea-4273-1d1d-08dab241c44a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 02:21:16.5649 (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: 9+HBwM0s80UH+dZpYUpaggW6is2+ENAp2TQYmBR9zwFOV/o9M/8DmDEtw09sjGBxQUfEC6CB6RQmk4x2osJ9ETwF1oR/9S/4extxa6zfO58= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR13MB5906 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 UDP item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 63 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 670c12f..0af740a 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -32,6 +32,7 @@ ipv4 = Y ipv6 = Y port_id = Y tcp = Y +udp = Y vlan = Y [rte_flow actions] diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 2e89a22..5dcdbc6 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -537,6 +537,11 @@ struct nfp_mask_id_entry { key_ls->key_layer |= NFP_FLOWER_LAYER_TP; key_ls->key_size += sizeof(struct nfp_flower_tp_ports); break; + case RTE_FLOW_ITEM_TYPE_UDP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_UDP detected"); + key_ls->key_layer |= NFP_FLOWER_LAYER_TP; + key_ls->key_size += sizeof(struct nfp_flower_tp_ports); + break; default: PMD_DRV_LOG(ERR, "Item type %d not supported.", item->type); return -ENOTSUP; @@ -838,6 +843,47 @@ struct nfp_mask_id_entry { return 0; } +static int +nfp_flow_merge_udp(struct rte_flow *nfp_flow, + char **mbuf_off, + const struct rte_flow_item *item, + const struct nfp_flow_item_proc *proc, + bool is_mask) +{ + char *ports_off; + struct nfp_flower_tp_ports *ports; + const struct rte_flow_item_udp *spec; + const struct rte_flow_item_udp *mask; + struct nfp_flower_meta_tci *meta_tci; + + spec = item->spec; + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge udp: no item->spec!"); + return 0; + } + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) { + ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv4) - + sizeof(struct nfp_flower_tp_ports); + } else {/* IPv6 */ + ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv6) - + sizeof(struct nfp_flower_tp_ports); + } + ports = (struct nfp_flower_tp_ports *)ports_off; + + mask = item->mask ? item->mask : proc->mask_default; + if (is_mask) { + ports->port_src = mask->hdr.src_port; + ports->port_dst = mask->hdr.dst_port; + } else { + ports->port_src = spec->hdr.src_port; + ports->port_dst = spec->hdr.dst_port; + } + + 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] = { @@ -874,7 +920,8 @@ struct nfp_mask_id_entry { .merge = nfp_flow_merge_vlan, }, [RTE_FLOW_ITEM_TYPE_IPV4] = { - .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP), + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_UDP), .mask_support = &(const struct rte_flow_item_ipv4){ .hdr = { .type_of_service = 0xff, @@ -890,7 +937,8 @@ struct nfp_mask_id_entry { .merge = nfp_flow_merge_ipv4, }, [RTE_FLOW_ITEM_TYPE_IPV6] = { - .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP), + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_UDP), .mask_support = &(const struct rte_flow_item_ipv6){ .hdr = { .vtc_flow = RTE_BE32(0x0ff00000), @@ -919,6 +967,17 @@ struct nfp_mask_id_entry { .mask_sz = sizeof(struct rte_flow_item_tcp), .merge = nfp_flow_merge_tcp, }, + [RTE_FLOW_ITEM_TYPE_UDP] = { + .mask_support = &(const struct rte_flow_item_udp){ + .hdr = { + .src_port = RTE_BE16(0xffff), + .dst_port = RTE_BE16(0xffff), + }, + }, + .mask_default = &rte_flow_item_udp_mask, + .mask_sz = sizeof(struct rte_flow_item_udp), + .merge = nfp_flow_merge_udp, + }, }; static int -- 1.8.3.1