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 47874455DF; Tue, 9 Jul 2024 10:24:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9558A4325E; Tue, 9 Jul 2024 10:24:29 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2121.outbound.protection.outlook.com [40.107.237.121]) by mails.dpdk.org (Postfix) with ESMTP id 6492543258 for ; Tue, 9 Jul 2024 10:24:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rGqgSAaO1XWrMCuxXjDoEknS8vHwv0a0xRjWSuiJZ14u0AKPEbHjlmEogWgi6/ta68b4mUEeFm20GBzivvjlblqVPrtVPjImKovc+cAOQm/e+9JJBepWthTJBJNhZoLC0iCIBtmtmQSPvpoVThpr5o5MVZt2g951CdFTNQma+AfxINDrijlzJ247lzKGiR8JN/lyWI0brwRUmSMuA3HBgopiymt/RfbypjQNfbGGrpSvP8mR5vIbKGNVIRZW/op0N8gkWm8xAtcCyyODwKjtaugSXLxICcntAnZ6H5IwaVNG0V0r4uRPraoOvl9eYDke5/X8PJD1998Pbld6CVdV6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=tNTv60060ob9rZWhbSIyHu+bmG1mrYWaRDDnGPZjIOXzvxHMLp7x8pkG9sp75Kk2TSYVupy1vVLFm1JZgbWK7ww0Ib3jhDrYlQ2T/lNKfrl7ql1DO7x9u7qbHC5S7GAF9MOTjan2/rBZXov0kd2J+uSm+zFElbHPTPN6OXYIRl9QIkNVocokWL0K8hMES/wvB+xHZndNai8NMPWGoqnUc0Zx8uzH79+qq26gdlkHkTNwhcWh72h6LqDvppx3gFBcE8bApXiubZBjI8CZsSUpH7nja+gh/GKvspqc7u6Evpw2OKJk67xZBtR8X4DYc+QG49uimDY888Rf/tYV80vTBA== 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=LpNZkFt+PA1LN/exxrLN0daBEILubHdX+PwW0NTDVjkm3J3CZCtN/ejZdmZrZPR0hd7PEoFfAgEZKSMDrY4DELdxduRQ0cClv5oEyqr6sWGqVqUDgE65ogb2fzHasob0hgoJH6T4ShkKNJxJn4PijxDzKEj848OAsscmPOIpzYU= 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 PH7PR13MB6194.namprd13.prod.outlook.com (2603:10b6:510:245::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Tue, 9 Jul 2024 08:24:25 +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; Tue, 9 Jul 2024 08:24:25 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH v4 2/5] net/nfp: export more interfaces of NFDk Date: Tue, 9 Jul 2024 16:24:02 +0800 Message-Id: <20240709082405.248641-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240709082405.248641-1-chaoyong.he@corigine.com> References: <20240709072921.246520-1-chaoyong.he@corigine.com> <20240709082405.248641-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR05CA0064.namprd05.prod.outlook.com (2603:10b6:a03:74::41) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB6194:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b5d47d0-9092-400c-ff27-08dc9ff08aee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7k76mN2ohaz94uMz8ZiZBd++O7hn7vI9g595PmgUNQZlAEgkaiIeFn9hTg/m?= =?us-ascii?Q?+t8+lnXb5gWWFu6trC7VaYKDEb+PmLRGi7xl48jYN/RsoVV1ocI5G1wOLQ3k?= =?us-ascii?Q?jUE8e/8UcP4asHDOj3bQaaadBH14QDVZIVN9D6ClfeEk1Nx/PEOL0+4PBIC7?= =?us-ascii?Q?NFvuBmOKT6Ycfx/F7jCRR6ffTCu0TuA5gtJiyNCbu/SAjezLmvRpzbjTdZfv?= =?us-ascii?Q?wABjTsxd4ttWbvkv9W5ROvGJQlulC1N5GVU9z25GBknCfAqk1OXGSPZ5lqFp?= =?us-ascii?Q?uxtiFFYMMjCfPkKBoq6XjNSNieXKK+tahY3kqdLDqYL+zlHqWDDln4/uNx1c?= =?us-ascii?Q?4lQWQ3wCY2uPfOWaBKZvWpvxeRPXORdn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?Q?VbFV+ebv9/fhzFMGgO5cjjMbiBn0qEeE56n/JR6Lhug+ZSlsrNBbJX+2lXEU?= =?us-ascii?Q?SYQdwY5v5wSMTPe/qAK6pYFShdd/UbRkfDoilX47REXra9XVMSygwBxWjH8C?= =?us-ascii?Q?LxU2n5GIf2aZHVMv+5BVcN/tPP1btgK5tXP1gaUKnyjKw0/NSA=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)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GAFd0hLx28VADJ5LHv96ZoKhL5CObCOGE6LfnldZ06k/DoqGUdo+DqnrVjky?= =?us-ascii?Q?EL57uiFhwgoMNQDYYorPSqdHA87bCC3tlg8yvIUOU/Qg1yYHKHYBLgQedD1P?= =?us-ascii?Q?eJkzFScYzh56pXMGozyqLTw4YvHACPGw6nMSKCS4dk/tcZlZyaKOlr4Go7/4?= =?us-ascii?Q?gWZviThTVFu4SrW6r2hZcZ0x59rRI5mBds84/Hv4uMGL9SUYmYHN9s1noGT8?= =?us-ascii?Q?FSK9ppFaP5LapVUm+NQP6rLfc93Hl6q4L+3kYiMDsIG80HelKGCDtOoqVmzu?= =?us-ascii?Q?TWlpgiHTWCAVMM7lpmiIY1omeZYV7LFsXVsFJ9bf5APndEXBSTqE2/hC/B8s?= =?us-ascii?Q?/ZUNeerwQpaUbg7PrArJkCE3xdNHUNs9zai+FgNU48CWlWHvUNdKdciS2M+Y?= =?us-ascii?Q?WlWH1X9BYKneLxdLBQosARrjNhO9UsnlHxG29JIanulW0/k0BQeFb7GFHZLQ?= =?us-ascii?Q?sxYpcFsA4HgoW8SkLWmU0fvowV3/YdimV4QL8q7tpJ3CLMLPhyKWp7g5Ro9s?= =?us-ascii?Q?AUGDxp86vz9zxftx3okFtPd/5izCiEWhA0ay6GudwqgCSuumN+4vtEdDq2tU?= =?us-ascii?Q?R14gbBeEy/5W1zRHm3DIHPaeaKolqbAlOSeVBpMCJ2EcaZcbqajpt39q8xO+?= =?us-ascii?Q?+47iUt2qTP0W7WLQYCfAj71PlqiwgKQ72XsSolpGjZLfaYnm+sD0UZvbP5cM?= =?us-ascii?Q?WF0HofMl2H2VEGY2RdFV/6/PxQsIIQfT4uabS164pO0QSntKegf/kTchiqPH?= =?us-ascii?Q?j76++quYCX1rFgveVSpY7yZE3bjxcTxZxnck+rvJDoUFfzkjTsHFpmUCb/sx?= =?us-ascii?Q?ZU7ilf7QihFtqg+F1wwV3S19F2Jrhl8au8F8rHmiGtHqOw10yXpooqcON/zN?= =?us-ascii?Q?eU14FxxK6fkDa51x/paR/QDLu8Sd7uDnS8eHL1lb/prSUWmW/lEpm0SrJgNs?= =?us-ascii?Q?PPnTmKEQKIjjT3Wwq+FDOm07OI9QXJqWkGE+Q/PLAFqKTPTdZWRL71l5NzNv?= =?us-ascii?Q?DljyarU89G5jtr4XamVGVQW/SyNVvgAo/jNiBk3L5D+CkuG/pA3ZptxOXKG7?= =?us-ascii?Q?BHCO0ewn+cxE2wSvQKWk236USLTYycrl8ojbXJGBzhiEL+P7mJgr8guVoQc9?= =?us-ascii?Q?H6MtfmOxSRGSgElk/XjSO95LuvI52Nc1QdFh3iFcV7bhQfJoragwgkhAz61p?= =?us-ascii?Q?7arL2wM0z2lsz/6sjEaaF6Cnvk4iWOtmGtUcTMTechQBm9kaBFpccBvvg66C?= =?us-ascii?Q?UbewbN6hZCHvEdZnwcwbESeafww5K1dx1khFyDRMv3G9NIOFdCixYXilzYqB?= =?us-ascii?Q?XcvctHSwK2guhPs1moKeHc6kAbSU4fKS+iVzAs1zAB7oduukq6xJ7Clrvokd?= =?us-ascii?Q?25wlfLgtnSYSl9w+fFgUIWmTlV77iqlEkZcBsJ73bLtVin8FF/diU/+rnT4Q?= =?us-ascii?Q?hWmVoPfMl6+fCUjjU8b1LgxfugQspLDSRlAiCTSl639oTxbsKwDRXzPwKYxf?= =?us-ascii?Q?yM9KEnuE4Hd3FBQuTudzrJOTolfTxMlTRHYpsUoX/bZDQ06XjitkpBJjhUPP?= =?us-ascii?Q?TUd2IhGw+xvgwVsDpaHN4kgrj2NpvLq1YKHPdYUOEF++41aNey5vm/CLu11o?= =?us-ascii?Q?FQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5d47d0-9092-400c-ff27-08dc9ff08aee X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2024 08:24:25.4975 (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: Iqh9Zuf1KxaKKi/dcjlewLAz+H0A0fCZss8yiTrfYVAmZHGPyvey82f77QGjuEFpAMYgfWEvn9ypBZ0usCbICCU/qutnCGMwL4r9ujLx9XY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6194 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