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 BF88F454A2; Wed, 19 Jun 2024 04:59:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 307BD4275A; Wed, 19 Jun 2024 04:59:37 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2131.outbound.protection.outlook.com [40.107.236.131]) by mails.dpdk.org (Postfix) with ESMTP id 867234014F for ; Wed, 19 Jun 2024 04:59:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enbCm6EgaGkdC7aZMK5KuVC93mROn5KKFH00hprrQXTnS7DM0d4L4Ov0PPRTXq1mAQMKjzXs9rGQHTDSWfQ5WN2gE5Dq9teCmsT/SjP+rtB0VL/irdCgD6PukFddmk1BfyhH+RPAOLMCIVQHSaMePtiYhHesQv8TxegDU+fQve7NP9yOkQUBDswIRKW/MgqVq4yNCC7rl5Z7qeIW94AXZAHpE7DTPsZIvJ0PR3e3Ovhp2CObahUmjujAtk2StBSpDNw9MmW9TvrkN+oQzR42Om/sr6nyawUE/hFwpQNpwtnQj7U5dxMkLXBT+zQLuof/PU1eu0h2AtzL7lQiP8FAHw== 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=Zo36lE0WnJTyLObOWVonHnEu90h0hmXYgm3kzdTGIKY=; b=JMgqpYZ2w7eqIfDkjq3kKRBNt9cCVrMOJ2Y1oKh7SHgQqOqRZhlePDRSeK0OweYq68EiKwskAkxvz1E42AZAlQGyrbZZZdvyTVYXAb+tDaZYFFXGlyYsy4PAiZDWAsl0yStvr/lwNw9LivoU8xLz3FXjgJbeVrAlQcyCgMfvsDo8xGIxbtRvfqOYBF+NfjpB4/XEJrcD4XqZs3/VNxkTGlSGUAPalo4/5k9vFFNBRi5G/GAQXfqYoa2vrAc5dz8JXkZOaZ57fOXf3eBxvCZTtmlXWuUQo2G6XMNhYSO4oSIR4S0JpYKy2Gv2KqOtvlDpOvDoluiczfxB4lJTb4a8mQ== 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=Zo36lE0WnJTyLObOWVonHnEu90h0hmXYgm3kzdTGIKY=; b=H9u2QjIe8SrpTogxJXFFkk4SZ/j5yOuZ+sB6vjIZDMCo+BbgDTJHVzlGUreBTvTsKyY1tAHcyBhe6QWWQMfTAzf6EuU3DU48NWMTwjMadXQy3CVV4ctCUa6OJk7oWPSj4E6JiRXSlZ2HDpE/cnXjtsW2Pi46UAS2hE7n9TtfHi8= 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 SN4PR13MB5775.namprd13.prod.outlook.com (2603:10b6:806:217::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 02:59:33 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 02:59:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH 1/4] net/nfp: export more interfaces of NFDk Date: Wed, 19 Jun 2024 10:59:11 +0800 Message-Id: <20240619025914.3216054-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619025914.3216054-1-chaoyong.he@corigine.com> References: <20240619025914.3216054-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0189.namprd13.prod.outlook.com (2603:10b6:a03:2c3::14) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SN4PR13MB5775:EE_ X-MS-Office365-Filtering-Correlation-Id: 205dd905-b7e3-4fa6-1d94-08dc900bd85b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|376011|52116011|366013|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5GSLu3lsT1LucuqK83D8mIuBUtlTEIxkHPGDZIOMprC9WiR1K04wHlJymJD6?= =?us-ascii?Q?Z7uj/Bt+OhnAvlQuydUKwH8Yy+HaVR2O0VYF+CWzCTBPCT2JPRMQtz+jGP5U?= =?us-ascii?Q?Iy//MVSGeWWu3ndxufkQc0t4GUkGdUFKQn812Mt7EkSuCp8raJJNMqH2h8SC?= =?us-ascii?Q?G67ihFAsDnZgqIdwEWc1fO3JGDWzYmyRs7+71LjDZVFIkrE9o5XZOJM8kTGm?= =?us-ascii?Q?RS5zgaCh6WrnkmZH8Dzgb+mHf9GwWRb3SRolXW5Y7Brne4HNDIvm3mptZbM/?= =?us-ascii?Q?r2uVaQXK3OP5/YbNZQnurB1YtYN3zSCYUIh1IZXshMpEvyPwfHhYM7OyE6HO?= =?us-ascii?Q?yAUPz13u3Row/AQNd7nXYn87trOq/JpHk8Z60XO9v1gqsZZKk/r1TpsgdKka?= =?us-ascii?Q?Sjc+I1YDBqpFOcLX1rCgn0l0OX6LqFZai6XXauFH4PS6D5EbU8kwtg+7WWjm?= =?us-ascii?Q?T9eErlQuXExXHc5ANmmydShEPnf4760uW9Obb//rn1r7b+TXjS7gur61HxXl?= =?us-ascii?Q?hu08nuCDSipMydOdAv8/NUowoyC35GPU4zsxHXZRqbuDK9sCI4EBK/rXtRXK?= =?us-ascii?Q?zIecdYR2dRQZTFe6rDlWcOmzc+7Xl4WylnxxjYowV2fripS6G/GH4FTPlYxF?= =?us-ascii?Q?/UlVhwccF1T80v5mzhdpr4lg8fs+f7qHQDtx0BC3GXlL+tCA1JewQaHkYt7d?= =?us-ascii?Q?hjzdPtpxEImvKNQtFmvpxOS1jGH4gyQYHeiR5ZT2D2+BJ/hSZqkqyQDkJRA9?= =?us-ascii?Q?ohAZ6f/iblmTZiCphcPyAsR4mjXGoG8RNkUq1xSYyHq14bOI6viKkXd9NYCI?= =?us-ascii?Q?YPZbuNXoGRjqGSQHfYmcnbRNmw+r0YGauxjdKpI5p96qHyI6NMCGoBlqeHnr?= =?us-ascii?Q?d3B5oh9yziqUqKuFivpmy5JqmybdMfhWPp3RXa7dGsjJJp3C2HgOstYyLj+D?= =?us-ascii?Q?YEpQwUMRFkfv79Blqdl9BZLgFfwZjWWfYR59fVJp68R+FRSu2PlpcxtvI3ai?= =?us-ascii?Q?qTMykdgVxMz149RvTj6Aq7qreeXqIws3Hpd/rOUr9rauhb740Kzz+gJYVKiT?= =?us-ascii?Q?IiP6sRWisWrp6trfoKQkBayqM68ERJuui1DhOgccK6zFs3U+W08uNAdoHWvs?= =?us-ascii?Q?xuM1oOHt2PckJUGxthxVUntUYgBOhXEx39r/gtW3Vs+KgeChfsBRU375BAaE?= =?us-ascii?Q?tGxEH25D7qqI0rvUUKnvYVdLJ8jAet57h5+QMSTm99KzOS0eysnlZO04KO//?= =?us-ascii?Q?KbcI90dKsWm2gpe8Sek1J7zRkykSDLv8UJBxYEy0Q0X6dkpfwViQJ9AG0GhT?= =?us-ascii?Q?Z7shruFIW7frzRdawJOGILwMY7WYAnVmKRBrkPd+Lk7uT/0I+KwbJgVZncK2?= =?us-ascii?Q?kirgymc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(376011)(52116011)(366013)(1800799021)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CL+nJgn7hH0UTyBHraj6FepoVY7GZDhBQpUxaPPB6TFAFhiNY/8oTzQ8HhAt?= =?us-ascii?Q?/ZonMpxPOlJjAnN8Ey/lIf/nXrov5dGx16ltz1nnDn/RWMg4I2cAcQ8hozDb?= =?us-ascii?Q?MCw9sPTRoNDPqzxMaUfCgkuIdw/PQ7aI440ipy+d93FCy9PJ+4Em/WOErFkZ?= =?us-ascii?Q?B72UOjC4dv0g3yiOdA0cr/JK79sWB9sD5LOr3w0o05rong6283y5l1y8xTwk?= =?us-ascii?Q?A44fvYPY+1IpJ/E4Cerq/B1+n2QG1O9LFpug7QAGwLac1+54PdraDKc3momv?= =?us-ascii?Q?QxVqvnWv6FXlvOMxIgdUxJhC4PttEozOkuGDbPMFFvLPHC+FCzdV0l42SdmS?= =?us-ascii?Q?FPNnswPaFF9qR/tTrX1LiCg7bhmE9DD8GGZb4G+o+8+Sgm+cSBp84bCj6fA+?= =?us-ascii?Q?FmUUFAH6bM0KaenzFkcywffQCZhg7fWzVixGAlJjSKoMuDTB2ngwJc8PgVqU?= =?us-ascii?Q?Be5IDcw57ZP8eQcBED/Sqt/a1YTnryAKAlPK4TZ9WcKkPhz87GGuBc88wPU2?= =?us-ascii?Q?nQVegPQezClzui4v3gY+hFjQT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dPskjxdfRs1zELaXF0YVcIbW1FUkjfRot5J0Ur+rpTEzqFTjawvxqh0Du?= =?us-ascii?Q?hQd+58OC3qK/rtLz9bgGZ2G3pWV9fTdcfq2WdMltnGOKpnUGsQ4VlZTE5VU2?= =?us-ascii?Q?zXZiYDMvt0Cjxzl1iJeFpe6lQOhl02Pjyy7IvinhzAyvPdnvxm69wv0jx9cp?= =?us-ascii?Q?7Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 205dd905-b7e3-4fa6-1d94-08dc900bd85b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 02:59:33.1315 (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: ac60nxKoOnY7wI0lW/zK0s8i4cheG24in02cVcyQhxzIlcrfuoUZj6uJZ7bkVImNQln/8XM4iId/39s01wBWNUiH6eURqrepKHJRaL9ZynI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR13MB5775 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 NFP will support NFDk vector Tx function, so move some functions to header file for use by vector Tx function. Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/nfdk/nfp_nfdk.h | 45 ++++++++++++++++++++++++++++++ drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 43 +--------------------------- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/drivers/net/nfp/nfdk/nfp_nfdk.h b/drivers/net/nfp/nfdk/nfp_nfdk.h index 2767fd51cd..89a98d13f3 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk.h +++ b/drivers/net/nfp/nfdk/nfp_nfdk.h @@ -6,7 +6,10 @@ #ifndef __NFP_NFDK_H__ #define __NFP_NFDK_H__ +#include + #include "../nfp_rxtx.h" +#include "nfp_net_common.h" #define NFDK_TX_DESC_PER_SIMPLE_PKT 2 @@ -161,6 +164,45 @@ nfp_net_nfdk_txq_full(struct nfp_net_txq *txq) return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh); } +static inline uint16_t +nfp_net_nfdk_headlen_to_segs(uint16_t headlen) +{ + /* First descriptor fits less data, so adjust for that */ + return DIV_ROUND_UP(headlen + NFDK_TX_MAX_DATA_PER_DESC - NFDK_TX_MAX_DATA_PER_HEAD, + NFDK_TX_MAX_DATA_PER_DESC); +} + +/* Set TX CSUM offload flags in TX descriptor of nfdk */ +static inline uint64_t +nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, + struct rte_mbuf *mb, + uint64_t flags) +{ + uint64_t ol_flags; + struct nfp_net_hw *hw = txq->hw; + + if ((hw->super.cap & NFP_NET_CFG_CTRL_TXCSUM) == 0) + return flags; + + ol_flags = mb->ol_flags; + + /* Set TCP csum offload if TSO enabled. */ + if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0) + flags |= NFDK_DESC_TX_L4_CSUM; + + if ((ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) != 0) + flags |= NFDK_DESC_TX_ENCAP; + + /* IPv6 does not need checksum */ + if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) != 0) + flags |= NFDK_DESC_TX_L3_CSUM; + + if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) != 0) + flags |= NFDK_DESC_TX_L4_CSUM; + + return flags; +} + uint32_t nfp_flower_nfdk_pkt_add_metadata(struct rte_mbuf *mbuf, uint32_t port_id); uint16_t nfp_net_nfdk_xmit_pkts_common(void *tx_queue, @@ -177,5 +219,8 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf); int nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt); +int nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, + struct nfp_net_txq *txq, + uint64_t *metadata); #endif /* __NFP_NFDK_H__ */ diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 3ba97e23a9..77021aa612 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -6,7 +6,6 @@ #include "nfp_nfdk.h" #include -#include #include #include "../flower/nfp_flower.h" @@ -15,38 +14,6 @@ #define NFDK_TX_DESC_GATHER_MAX 17 -/* Set TX CSUM offload flags in TX descriptor of nfdk */ -static uint64_t -nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, - struct rte_mbuf *mb, - uint64_t flags) -{ - uint64_t ol_flags; - struct nfp_net_hw *hw = txq->hw; - - if ((hw->super.ctrl & NFP_NET_CFG_CTRL_TXCSUM) == 0) - return flags; - - ol_flags = mb->ol_flags; - - /* Set L4 csum offload if TSO/UFO enabled. */ - if ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) != 0 || - (ol_flags & RTE_MBUF_F_TX_UDP_SEG) != 0) - flags |= NFDK_DESC_TX_L4_CSUM; - - if ((ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) != 0) - flags |= NFDK_DESC_TX_ENCAP; - - /* IPv6 does not need checksum */ - if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) != 0) - flags |= NFDK_DESC_TX_L3_CSUM; - - if ((ol_flags & RTE_MBUF_F_TX_L4_MASK) != 0) - flags |= NFDK_DESC_TX_L4_CSUM; - - return flags; -} - /* Set TX descriptor for TSO of nfdk */ static uint64_t nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, @@ -100,14 +67,6 @@ nfp_flower_nfdk_pkt_add_metadata(struct rte_mbuf *mbuf, return FLOWER_PKT_DATA_OFFSET; } -static inline uint16_t -nfp_net_nfdk_headlen_to_segs(uint16_t headlen) -{ - /* First descriptor fits less data, so adjust for that */ - return DIV_ROUND_UP(headlen + NFDK_TX_MAX_DATA_PER_DESC - NFDK_TX_MAX_DATA_PER_HEAD, - NFDK_TX_MAX_DATA_PER_DESC); -} - static inline void nfp_net_nfdk_tx_close_block(struct nfp_net_txq *txq, uint32_t nop_slots) @@ -170,7 +129,7 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, return nop_slots; } -static int +int nfp_net_nfdk_set_meta_data(struct rte_mbuf *pkt, struct nfp_net_txq *txq, uint64_t *metadata) -- 2.39.1