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 28CF043B80; Tue, 5 Mar 2024 03:30:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EFEA410E8; Tue, 5 Mar 2024 03:29:56 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2132.outbound.protection.outlook.com [40.107.212.132]) by mails.dpdk.org (Postfix) with ESMTP id 1AF5740EE1 for ; Tue, 5 Mar 2024 03:29:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A8//e1Cor/P4IG3lXIVrcnysMjaIhiclQgZQpTF13XQEzAYQuY8cPydjr1UKY9Q2z+hvx54NjLpebQk0xsNSM1MTn2dMhuWWfpv9KBaeddb2bfl5bgvPkQNJesUbtQkXUTQ6JboCsGKl7Jkhyosjh2+Qb+Cp19Che3FJc+jJH/6qmJhdVdo0Xgl/JBUDFC4i3wzbfGDFfS57QxyytqHq4WUv9MECMOTRTBGNuKwqNmfCEJRYXdae39FbdkyRjXJaXjfjALeB9MjaNHjbRX3onwakzFlHDl6oKaM5tcMjbg8CZvT+lk14M50aj1tZbOxavUNyuz3CHmgRonn9gMHwww== 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=Zhs+EXiXL5KKr667LOIpymup/c2ewlCO1yQ++P/1Fj0=; b=R1u0B13tYPpXDq/aWheAOtrrYcbP2pmY1txOFqMoEdg1XZEqd5pokYgTQKVc80TrkrFCQzhVJ4hDQTEQxUlpCpPZ36ebyTPKDxkYBYOhRY2bftnfWldSCvYtgbC2/1lD/hkWFvXr5LCh9zmOIjO6/ok9uov2b491lx+5yYqmqDsnUmlPaLS/+sL3E/VgXe7WSfab+VVOkM/TqDnUAwgP+46NAYkZdflOJimg84J7uUX4J6YcfWLuIF0WnctNP1eV59dyt0n6SE4M30CyServoDY6NTrunMSGCKB2MkuPqvfoTw25BiSXzwjyRwb1YEK4HNccardfueDh8pMtYOR+mA== 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=Zhs+EXiXL5KKr667LOIpymup/c2ewlCO1yQ++P/1Fj0=; b=XbLgTesWMquySXnhevzDCFDGaGM0VMNLk3AzqKrtap7POCdLp9zTudTB+7SLHAXVLH1Rk+nU8uQzRvzBB5KzDfF6WfDMm+FqILX30qzWNe+w75LBiZgF58wOvRSRTRCj2KdjzaGYhTect2oyADqmQ97pH+xDToWoUP0N2E6Gv8Q= 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 DS7PR13MB4768.namprd13.prod.outlook.com (2603:10b6:5:3a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 02:29:51 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7339.035; Tue, 5 Mar 2024 02:29:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH 4/5] net/nfp: use flag bits to control parsing meta data Date: Tue, 5 Mar 2024 10:29:22 +0800 Message-Id: <20240305022923.891544-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240305022923.891544-1-chaoyong.he@corigine.com> References: <20240305022923.891544-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BY5PR04CA0028.namprd04.prod.outlook.com (2603:10b6:a03:1d0::38) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DS7PR13MB4768:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a64f537-329b-428d-1f16-08dc3cbc2166 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KestRzBuWvtHPV/3OmOM6ZVXKv2zpvtNncXVkDso51enr6y2Bgu6EuUdOI1fEwfqelwb5BhNFIgLWcSEvicLyU1KLIpGMnbgoN9hr2lGEFe5LxdmBqaKAzJjt501cTpQDTnPhGBtVkHQPOOlE7x9mEfasnyF3LakVAvzSbKnyunuClFhQqLUR3gXXbMWaLXxGZUp54J892s2dBDwVjPCOhUGzyd51Dk2EVrKR2dwqPzQLwAszLwsAfFUyWolKz6GOXjNYeTGkZQw/nSUfmNyFAaUobkMoBYW8itS5F5iBj0ClB8jM7VbOkzbaRmY+7ecEXq75h6R6a0DF4pE6yR4kam/QVj2sEYoBSaK8blzD48DkUZ/Yem4wH/A84WD3495otcGCnVc36HnU8WXFMj/nCb+d8dEh8GyYaCt+9MSqHLZxNk+kh13rYEQNF+Jm7k23RspTmOW2uuw0FNoL8VURRL4I6RRVkLN1E05jCIx/JS7axXniGeiq5UTzk+wcUC/nGUA6QPr8aGWlxWVt4xPLrw3PNjSfbVh+w2J6mvtyQp7kEpS4os19X18RYhdZHGzKq7ZQ1e6Zr6scpIeGgzcAanV4EYO792rP/9fUex/9b43AL5Zhts/3/cJeDYYlYS1ftj/XRRP+HZ8/8ThYabq8xfE/Eh8+5A1vHoqEb0de9LpumSTBsqCmgStGWmtS75q+u3G+U9NLjnp49vp3GMwpFWO6Po4CsjwyjVigP8ABnQ= 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:(13230031)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?M0+XvwdUHS+oVd9rZjLIIcsJgrdI4Vumv3cG+JbEim6LjIuy1VVyHV2uAFZW?= =?us-ascii?Q?lP1BSdCDRq9MPZuuB2yBYvbqIvJDKaH6QTEFAA6AC8T2NAdg6jUq+RbVGuFO?= =?us-ascii?Q?od261JjSqZIcJHYceeptGnESGULzabkL6igBul0FpJJQNBUL9nnSboFhMSKH?= =?us-ascii?Q?TQ5vMEQ4GD2yHSQnwqB0Z4BLYoIU4g6PkQLnQ31IpbWr65Y8pMvMBvS8FsLA?= =?us-ascii?Q?wHdVd1or3UOGEXt3wPXXFuaKyKUroMfaBI9+xU/Cgxgi1psSN0KSwjwuVsI6?= =?us-ascii?Q?/7eYBWAGweU2YLZWQmRZihT2sto1hMMk4fb1VWcQTop+fy5Yhzye1+nsQlmi?= =?us-ascii?Q?jbQm3SsenuFpi1OOu9tC3ZLG/itALHBcT97EGMRseauNufesqcXuAY5+Cd/z?= =?us-ascii?Q?PniuzwCyibvakQbk/NRC40Jw/cKRu2UtYXpce5K8LlgBBz/+HJ2yhqcLVC9g?= =?us-ascii?Q?colZqVAcwEBttMyl7vYASOFET5Wz64ohfYrTbXpGoVXPR1qlUEy8kJHDrSUS?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zVIC117SCzDsXZcbJ4HUUnPe/Nf?= =?us-ascii?Q?x4jbO1xTPomcRQmIcaWOXpARFojG0pOHhjJFZ1vNXFu+w/4KCjlnJ3iElT/U?= =?us-ascii?Q?DwzllsSuQT36Bh1kpoLY8Fzi1uIkaTW9UIRrrq0EYtWDkGoS8j/Rok6nkf/i?= =?us-ascii?Q?ahKgsb5cfICbb/RSZZ/Td1GYcIDa4GYsGWNonlCduMgHF66ySAlFvr2J1Z+N?= =?us-ascii?Q?xQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a64f537-329b-428d-1f16-08dc3cbc2166 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 02:29:49.4254 (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: bV0KTwjESWyxkRijO4dM2tP3HGdIrH9Ci24A977WeGm5yNXsRl5nSfXOK4cSEikMC/XVCFbjD6jJ5yHwdFmhMertIhWuh1dipeZCsCNRMpc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR13MB4768 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 From: Long Wu Use flag bits to indicate whether meta data exists and determine whether it needs to be parsed. Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/nfp_net_meta.c | 22 ++++++++++++++++++---- drivers/net/nfp/nfp_net_meta.h | 1 - drivers/net/nfp/nfp_rxtx.c | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_net_meta.c b/drivers/net/nfp/nfp_net_meta.c index 2ec20aba7d..b39c55a868 100644 --- a/drivers/net/nfp/nfp_net_meta.c +++ b/drivers/net/nfp/nfp_net_meta.c @@ -27,13 +27,16 @@ nfp_net_meta_parse_chained(uint8_t *meta_base, meta_info = rte_be_to_cpu_32(meta_header); meta_offset = meta_base + 4; + meta->flags = 0; for (; meta_info != 0; meta_info >>= NFP_NET_META_FIELD_SIZE, meta_offset += 4) { switch (meta_info & NFP_NET_META_FIELD_MASK) { case NFP_NET_META_PORTID: + meta->flags |= (1 << NFP_NET_META_PORTID); meta->port_id = rte_be_to_cpu_32(*(rte_be32_t *)meta_offset); break; case NFP_NET_META_HASH: + meta->flags |= (1 << NFP_NET_META_HASH); /* Next field type is about the hash type */ meta_info >>= NFP_NET_META_FIELD_SIZE; /* Hash value is in the data field */ @@ -41,6 +44,7 @@ nfp_net_meta_parse_chained(uint8_t *meta_base, meta->hash_type = meta_info & NFP_NET_META_FIELD_MASK; break; case NFP_NET_META_VLAN: + meta->flags |= (1 << NFP_NET_META_VLAN); vlan_info = rte_be_to_cpu_32(*(rte_be32_t *)meta_offset); meta->vlan[meta->vlan_layer].offload = vlan_info >> NFP_NET_META_VLAN_OFFLOAD; @@ -50,8 +54,8 @@ nfp_net_meta_parse_chained(uint8_t *meta_base, meta->vlan_layer++; break; case NFP_NET_META_IPSEC: + meta->flags |= (1 << NFP_NET_META_IPSEC); meta->sa_idx = rte_be_to_cpu_32(*(rte_be32_t *)meta_offset); - meta->ipsec_type = meta_info & NFP_NET_META_FIELD_MASK; break; case NFP_NET_META_MARK: meta->flags |= (1 << NFP_NET_META_MARK); @@ -77,6 +81,7 @@ nfp_net_meta_parse_single(uint8_t *meta_base, rte_be32_t meta_header, struct nfp_net_meta_parsed *meta) { + meta->flags |= (1 << NFP_NET_META_HASH); meta->hash_type = rte_be_to_cpu_32(meta_header); meta->hash = rte_be_to_cpu_32(*(rte_be32_t *)(meta_base + 4)); } @@ -92,6 +97,9 @@ nfp_net_meta_parse_hash(const struct nfp_net_meta_parsed *meta, if ((hw->super.ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) return; + if (((meta->flags >> NFP_NET_META_HASH) & 0x1) == 0) + return; + mbuf->hash.rss = meta->hash; mbuf->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; } @@ -109,6 +117,9 @@ nfp_net_meta_parse_vlan(const struct nfp_net_meta_parsed *meta, if ((ctrl & (NFP_NET_CFG_CTRL_RXVLAN | NFP_NET_CFG_CTRL_RXVLAN_V2)) == 0) return; + if (((meta->flags >> NFP_NET_META_VLAN) & 0x1) == 0) + return; + /* * The firmware support two ways to send the VLAN info (with priority) : * 1. Using the metadata when NFP_NET_CFG_CTRL_RXVLAN_V2 is set, @@ -156,6 +167,9 @@ nfp_net_meta_parse_qinq(const struct nfp_net_meta_parsed *meta, (hw->cap & NFP_NET_CFG_CTRL_RXQINQ) == 0) return; + if (((meta->flags >> NFP_NET_META_VLAN) & 0x1) == 0) + return; + if (meta->vlan_layer < NFP_NET_META_MAX_VLANS) return; @@ -184,12 +198,12 @@ nfp_net_meta_parse_ipsec(struct nfp_net_meta_parsed *meta, struct nfp_net_hw *hw; struct nfp_tx_ipsec_desc_msg *desc_md; + if (((meta->flags >> NFP_NET_META_IPSEC) & 0x1) == 0) + return; + hw = rxq->hw; sa_idx = meta->sa_idx; - if (meta->ipsec_type != NFP_NET_META_IPSEC) - return; - if (sa_idx >= NFP_NET_IPSEC_MAX_SA_CNT) { mbuf->ol_flags |= RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED; } else { diff --git a/drivers/net/nfp/nfp_net_meta.h b/drivers/net/nfp/nfp_net_meta.h index 1d26b089d5..69d08cf3a7 100644 --- a/drivers/net/nfp/nfp_net_meta.h +++ b/drivers/net/nfp/nfp_net_meta.h @@ -77,7 +77,6 @@ struct nfp_net_meta_parsed { uint32_t mark_id; /**< Mark id value */ uint16_t flags; /**< Bitmap to indicate if meta exist */ uint8_t hash_type; /**< RSS hash type */ - uint8_t ipsec_type; /**< IPsec type */ uint8_t vlan_layer; /**< The valid number of value in @vlan[] */ /** * Holds information parses from NFP_NET_META_VLAN. diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 716a6af34f..65ae19212d 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -497,7 +497,7 @@ nfp_net_recv_pkts(void *rx_queue, mb->next = NULL; mb->port = rxq->port_id; - struct nfp_net_meta_parsed meta = {}; + struct nfp_net_meta_parsed meta; nfp_net_meta_parse(rxds, rxq, hw, mb, &meta); nfp_net_parse_ptype(rxq, rxds, mb); -- 2.39.1