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 F031FA0032; Fri, 21 Oct 2022 10:04:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ADAF142C1A; Fri, 21 Oct 2022 10:02:53 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id E68A542C16 for ; Fri, 21 Oct 2022 10:02:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TRwOs/cqVwoEPY/BNqNDQN30L83Anvjx6bMQP5NWyQfy2PUgmGgcF+daUZS7TH3YUhRsZNf2mdEZ9F0tnwRZ1HwFqvp51R6JHdDnE1u1vS0lpPCsdOEfGWd7nslArRwAeGDgQZMxSJZkbm6Q7TCRFTO9FV5dgSdz3NEd0O0SrnITRoA+6NBy0IlVx2NYNZHe10PWvYn8ePpP3CuChtchrhiDfOP/lqb+thVVAkcgVFAx+KykbFvnVWQLYyQ/fKtyRZ271XVsQ+x1E5xjyATHPqxF19bGXKpRJtwTCkkSVWxspiOCuKjMKUnpBnXPURWLECnR0onfBvmkduXuQZjsFQ== 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=5GTwaf7eRhMf1p7Bt/oTTMOIZOp5qkols6zBLU2MVno=; b=NK8wPNoyV2Ok51v2343fbTfGeNbpRtsj4/R0cvkv7eDQB+GOKdWyLnApr1GBJbzvu5tZaavZMANthdG7S1rBWoPeOP3BSgmYAqWkfKVVHXu1b/BNbZfPrenPMdfhBr6zfJdO2X/7VPNu94bx4exeqAZE1rxp1PIpzbii+6K0ETeldEC7AzrnyKCrL4JqeX4EJLHtAhmERCegwULUZ8LH2Jinq9VcS3v6Rvym1eKOQfATvcLAXm7Wu8nYcdKbsbTs/plWzE17SStY1Q/E6uvvgQHAf2a71LNb0YsW3Htnk4JHR6QrH5IfwquMrUsRibqMEIJcgB2PhRUKT4XtOxaOTA== 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=5GTwaf7eRhMf1p7Bt/oTTMOIZOp5qkols6zBLU2MVno=; b=ftmx5bCCJ7JFwrsV3cBwTIftEK8IL3X7Smuw6Nn5Zxylk9A3W8Lich/tOqXxJTtrDqa+HN+c892ne5qQk3YOlIf2soJfGWigHsYeREG8QTezUGXkzZiPrkjljtg5u9foE9lA42wUuudj+JRBONcUizGeaywnslYajaXPaY9hX24= 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 BL3PR13MB5162.namprd13.prod.outlook.com (2603:10b6:208:339::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.17; Fri, 21 Oct 2022 08:02:47 +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; Fri, 21 Oct 2022 08:02:47 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 13/27] net/nfp: support UDP flow item Date: Fri, 21 Oct 2022 16:01:49 +0800 Message-Id: <1666339323-24016-14-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BL3PR13MB5162:EE_ X-MS-Office365-Filtering-Correlation-Id: 004966b9-711a-4b5a-f7dc-08dab33aa444 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 27py5lzNgJlxN5kJo0rMvpA89NiYWWSzMUM/H27131UcGjb/rtJzl1SqwvzwcTOBdc4scUry+pG9IHlA8SRgSbkT8C19dihnzL2WLLKhkp5RvuQT5CDg/Npxb5+rbEIFg8JIZ5aTLwtcJtDijv6QvYm1AhIi9epMPfwmdXa5wHbInn6mXL+sTG/ovGfPr+xKMmDxYoGCuTWBpPZzl7PtP3XDLE/eVFZsy2Mjz/xeKXdPPXk6WZnb5cJXjf50mjBDCRRkLzBM5S3631lxEMT5mGEinjgmSNd4EtHgtG0o+hjIucTq3xbo0aUmr9mUnP2ug4pkWGAByzQz5c+8mVN8jCQHW3LLMoe255qSH2A2cKN092iL541Vbc2/2Gh8ElvBzZcHXCINIwnVlXKYDD3p2Ddi/7a5lR494petJQwdKYA3GdoynxPINWy431o49Lak2yTRhyDNh5uul5h2/E8zWJiNjfhpCFs0HpEHjTcyu6rmWNTpKSmoz0gZE92VKfa55JqjVxiPvQmrCxhUd19GMMJIRMSioE5Wn1RhJ0TxjUilJ9Yx/jJstXbjINjn8bzXjEfRRy3sz6IStc4osJes8uwOsjzF0TNqucNiz2BqZAjzxUfDCfBN9pEFYcqeh+VDs+Nfqhc7kaUk3TUItX7r2Vc3RodzE6IaEIUftcKk+gFkc9gi4ow57DOI8x08WQGQmJ/ARIawnedme05fxmysCSs5pCBSrlhiL+WUaGb+Hz01jfcvN2H+xa5p8i4qCc0IAPcVJYxSZ77fJZTKdc/zBw== 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)(346002)(136003)(39840400004)(366004)(451199015)(2616005)(6916009)(38350700002)(6512007)(6506007)(52116002)(8936002)(66946007)(4326008)(186003)(107886003)(8676002)(41300700001)(2906002)(66556008)(316002)(66476007)(38100700002)(44832011)(26005)(5660300002)(83380400001)(478600001)(6486002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?LzI1VC9OWEs3Zi9GOXcwQWJQMy9MOG1NNW9KYTZzWUZWTjlwYmJJNkF2OXBo?= =?utf-8?B?S1VuTXlSTUpWTVdDemcrb1E1S0dwS0loakZIKzc5OXBjSzRPL2duQTlWenU1?= =?utf-8?B?V2hacFoyZzFvcm92YS9YTDdJN1UxbEQ2T2g5WWZaWDd0QUtnTzU0R254L3RB?= =?utf-8?B?UWpvVUh3K3J5c1pJaFdpRnhrTHg3T2pJS2ZDU0RRYXBYRE1qQm82Znc1RVFm?= =?utf-8?B?L3NHd1lPUXRIMW5rMEV4cE9sQjhIYnVSS09mb1BJalBpdjVZWEZBdDdZVTdv?= =?utf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KNERwWGo1?= =?utf-8?B?czZNQkZjaWk4UUVnb0FTazBHTDF5cittTDdVL2wxU1VpM2NuS1ZUNGc3cmR5?= =?utf-8?B?a0E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 004966b9-711a-4b5a-f7dc-08dab33aa444 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:02:47.5085 (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: d3blgRuJVtYEmgY6CpWuPPy2y5aS0e1PyOTLk9OG5X1gOiTvfz1CIZ928qDHkcIsnIIGPvzpFFcAknP/16TpblEaoKT9YCYwnWxu9A2a8vw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5162 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 da6b31a..b13559b 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; @@ -832,6 +837,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] = { @@ -868,7 +914,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, @@ -884,7 +931,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), @@ -913,6 +961,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