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 DFC10455C3; Mon, 8 Jul 2024 07:59:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33E7240E03; Mon, 8 Jul 2024 07:59:19 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2111.outbound.protection.outlook.com [40.107.237.111]) by mails.dpdk.org (Postfix) with ESMTP id 8375B40DF6 for ; Mon, 8 Jul 2024 07:59:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hbRdz9H+9JyWSulVkujPQpLxgK702Fpmks0Go12vVA3dqfjQIXIvjQHLMo2DTRoQdJHy9qsa00POrUNxwvpabUw7dWJgdR63OZ5zSBlvEjvf9+JpMfg+6OLvM+Q99+sxNd+h+eu34QYo06h/lVdJDJFwZv5mEq+Uohf3C71yhSwokThEXDXL7ffRCG6rAwh1Lh4VQN2znaMgZF1Ezh2nnXJXwkB4T7h53pHrODlLEau6Q6x9YnPC3+BxduRZpK5UnuElEVAl0Z2tc6CZHQxs5uFTaEiuh5paJvlVJakGw1lZ9P8OVOUDua51og1d900jdt6vGHqFE8P0E3rAUXv67w== 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=/YHnSUZEU46GqXL23kg1z70eGyV0lm5d0UZHOvyYa6k=; b=YEjqe+vAIvO3vtNhwQjZyLcs1BTUdN3yLsiZTH1EFag1cwe6PYwUeGlTZoKUhkZxf1Sk4vnA/Iqf/CuxU5BZEbHBTFnTFG5alWlBI3JJ3MQrS93fpZmf0mMtOjDNWB3AJCb3fYFLv3SvjfZPYTSE+onBl27xuDtG++H48sFzl95olFqYeUMebtukLah81I9H8cwJTul8MDaRKGeIk4NvbcZI0LlfbykhI+Ie0pzF37kZLY1pDoKBiE2CV2G7KlKUXDqUNFcvRe5ezBXupJNdiuqm5fV3VQ4WV2Mq5tm/tNnCDx5zrYG2/0q99EjQZewwf2aqVvkejVFTnFe4VtICiA== 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=/YHnSUZEU46GqXL23kg1z70eGyV0lm5d0UZHOvyYa6k=; b=Yny4FAGZy05e+VF/J7oeVef9jXRBMbEfGK0hw5kguHrXD/IND1j9da4dDhA+adkmAtuWz9WJlW234Bfb9fUUJ3Y21yGz57BmQ/bgFYM2kRJwkDBeLaorVUt3DKCw83A0V/kFN0v5oLzyCfoVjJKbrH+M0swag1ErN4EQ4S5eUyE= 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 SJ0PR13MB5499.namprd13.prod.outlook.com (2603:10b6:a03:425::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Mon, 8 Jul 2024 05:59:15 +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.7741.033; Mon, 8 Jul 2024 05:59:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v2 1/4] net/nfp: export more interfaces of NFDk Date: Mon, 8 Jul 2024 13:58:51 +0800 Message-Id: <20240708055854.107739-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240708055854.107739-1-chaoyong.he@corigine.com> References: <20240619025914.3216054-1-chaoyong.he@corigine.com> <20240708055854.107739-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR05CA0168.namprd05.prod.outlook.com (2603:10b6:a03:339::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_|SJ0PR13MB5499:EE_ X-MS-Office365-Filtering-Correlation-Id: fa23469f-475a-4b59-b42e-08dc9f1318f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?V374jR1mQGIS9Wq5kJBaAKt71gzgBAcD3rcwsQk/CMcgf5BW8KwwtxsBfZ+r?= =?us-ascii?Q?Y7b4EwWVPLFX76uXNVTLvaX+STJhvUCJ8XSK43srT7hag5Qs5vZUzDtpPS6i?= =?us-ascii?Q?a8TWzs3NLigwwQk5a20HnGiwWoQv/1vOpnDUx0u4HG90bYiCKyl3DTKVsGua?= =?us-ascii?Q?9GL2BdjbzWPICYU1lIY5b1F+X8tC1/TIQtXK9wTcQ6g7RARhG69NdS5dzKng?= =?us-ascii?Q?Lkvg4xfIgrKDjs67LgNZvchRBdSeYgSnR2s0fnX5ORo7G2NBAczMEFwS/Ogg?= =?us-ascii?Q?bQNBIEb73GXnT0C79RLbdaWdXpt2/Q7DUh3M/ogoJHkK726kABa2wsXsiawn?= =?us-ascii?Q?qBdRXSwRVr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=?us-ascii?Q?7MSvgfb90zNJf9qfDC2M8N432nPv7/K6VUBgRn7gxgVQmJMs/0sYUYGPagyN?= =?us-ascii?Q?52v6LKbw5L9zkbu5EyxJ0xRCylSELf1pLYTKXxnQicrKjihtVywAEFPR1R5u?= =?us-ascii?Q?5mTMIIZNHadO6IdGV2vhhc26gkltjVZqSmiU0uiZgfSs0GMabQ=3D=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:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5+GC27nQS503HSJ9lEk+2GNABt3T+OddDbEyVKqKvyMbxMK0Rq/gzeqwy9tD?= =?us-ascii?Q?gdV2Vab7UpLdT/2e56+p0t53RsrxuyPkDTSKfPHkBH4Eqf6woY9TlIa2QA9E?= =?us-ascii?Q?EXF3mzTeCd9AaFSBfYUAKDdHSQw9aU+71U7aCsCxcPW9gnM8aAGSjdHqjnWE?= =?us-ascii?Q?sx+AOecPRqKtuIMLmW92DZLmoglG8K5LWbkv1uo1M0RJwmHNO91RuNaOuMoc?= =?us-ascii?Q?jfuEkgN7ZBzej/E4LrQ0L49SW5RSwZ7yhi9+jQKaOnQkqL12egbl/taUZHp1?= =?us-ascii?Q?JSIenpzJ8NBW+bjl/UfJvLrsu/cjCxPJ4lY8RAcO8zopCi5nhXecxoaByq0o?= =?us-ascii?Q?IH17hCw/vhh8smnHIBKJ7cucb5Q5y5GLDG4OmpGapl0UmlifuaGs40DS0QAI?= =?us-ascii?Q?Y3s5fLwmPumWCrAcKEiNeDzkuzSEhCXQ17US7ye0V+kSP+FpYbvIZbfmdt4n?= =?us-ascii?Q?WTyoegniDPqsvZ3DKWgwpeKMp3k5wXA7dT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q?Dvv/wiMHOzZ5tXFHtobkadjkIG9a6GDcKKWfZezfbt201w4zqQ5fgmgPL1C7?= =?us-ascii?Q?Dzk6/EILfZtYriKgvtxJ/7zrarwZl11G8T58l94JptVBYu6bcn3XbvCNt1Bk?= =?us-ascii?Q?/P9mDrC7PmfR2nOqpn/rEWCt2j7GvWvA/0wfJD16fKQT1z60vmBxPkQNBiZ8?= =?us-ascii?Q?Dcjrofev1ncJcOOjqeueL2J2HuKsOn39YlpqrlKNpRwPqcSU4EMdB/XuxBLc?= =?us-ascii?Q?NQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa23469f-475a-4b59-b42e-08dc9f1318f3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 05:59:15.4910 (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: +1DuSBoFmYzDI5wL1WkbQumAqrQweuSgBpfGEwAd7BFNqVyYVpKX5xu/866PMc6GUmqOhImdEw3jdX2tp0B3/Zh0YEAtiaxFhFXl3rBCzR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5499 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 8b8c191b82..173aabf0b9 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