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 C63D7A00C4; Fri, 5 Aug 2022 08:34:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82CF842C93; Fri, 5 Aug 2022 08:33:19 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2119.outbound.protection.outlook.com [40.107.223.119]) by mails.dpdk.org (Postfix) with ESMTP id 8370F42C7D for ; Fri, 5 Aug 2022 08:33:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=frCHa/dVj++g4LF2T1lITg/lnzqqAp8MHxaJiKd0pIcwu6VqGHgnaA3dghPy63xCfZVmono0o892wz/3ehVBz/lwnOHuch9VfvcDqf4EWKHtbWUAGibbuieeWgWUXazKFdMtTqUIgHbfl/fcRujNpzl8JiO8wl1nAOE+sRNmGWIRQ2vGHRHzmt3gVn3YJy6dMPBXlxG5UWdSwVD8s5G6AjRnax5/hGMOnSZv22p6qkToQjrdDl3bLnSK39S0CtiNWsBYGXAKvZijxMhYtz8JEtn3uuVEPDAznkgkV5BOczsp4W5cjp+h5PUMuDSBo/9R2jiem48YP5A0b1vlEK/Afw== 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=ZRozswKP/oBX2MzcA/lRQl0eJbISaJOlWT83WKBs5Vs=; b=b5WbBp6iwJfqrKGVG7bPgqmke6LQy8Zs2iuZ7HL2RB59Yr+UEJHTWr9ZtG4+SaO0XAH/h9wVs08MAEHgxyA7HOCYLViOYuapYVqeyHZVMgF1ZQLGfXOdRpeOdxl++TdxTOb9vNUZ6QQmZanUmairUlUYCaVbzdMDGHcbWBgs6GHhgxgFMMDOfNv7s8EcT0pDXhS16KVdqm5ocF/hOo5ILAHKuTDOFCtKnr2eQOGfrKDnqTGzLeYTCcc0LJHujpNfW+HPk+Pt+UM5yZPH/ohrfb2c+DuSYIp0uweUDWGvWNuqKtl+4ZzBN5AymczPcO++gob+QLQR3zjX+qYVR+nPEg== 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=ZRozswKP/oBX2MzcA/lRQl0eJbISaJOlWT83WKBs5Vs=; b=nAoJFOOPxxSZphaoJHmApOoRHxwZPKblawQYZPajjicF/V455fxFuZL3RjkxkBV0BdNJdrJKz0eNnp2SKRJUoavUs5SGZjgA0ukJQ7t2LHahhY6oN9j7oy96Es66BVH9+KQE2X8ufHRlTMirDgEMJ83v8YkPVeEEEPeIJ4hieQI= 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 DM5PR13MB1772.namprd13.prod.outlook.com (2603:10b6:3:135::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15; Fri, 5 Aug 2022 06:33:16 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%5]) with mapi id 15.20.5504.014; Fri, 5 Aug 2022 06:33:16 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v5 08/12] net/nfp: move common rxtx function for flower use Date: Fri, 5 Aug 2022 14:32:31 +0800 Message-Id: <1659681155-16525-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1659681155-16525-1-git-send-email-chaoyong.he@corigine.com> References: <1659681155-16525-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR04CA0157.apcprd04.prod.outlook.com (2603:1096:4::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00210560-ee8b-4ecb-9899-08da76ac60ee X-MS-TrafficTypeDiagnostic: DM5PR13MB1772:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LHTs0Ws1pFem+N+mfGx4TNTrvd6VVnqkoq28DsC015POh7GZPxugSxylAAY2tzkyDBgS4GibXm+I7mm4OjLFot3s2gAcjewIzRFz1EveTaA8cK9u6AZYd5/nDbph6mfBX5G/zMOEd5X8WYwz94ELnP1JrhGp1jxaMXa7LQSiL1T7udujYK40LYvG174WLSQqq4bf+vcXmixals/2YRbBhU39Q1tCB2EMvsoWAe352lc/J5rNbgqTaTBIbXSK/lyynFj45OAUBlrRWKLnl/VaKCljofpnwOp77ACKa9VV1+b8rNd5tYYH4RxkkW7rXuv/Xp6HQMBe/QB8PEVmTOxM2VrxBF+TcTYyK2lJRs6gxFCTRIfrqCNWj8smyFOKqEBEYe8PdmmBBc26OwaXjZDlXMf0sQIowrGgX2zMGzAEBKaR72wgfyiw/E/DUfBLmjP+h5izwB4HVSIB6tvRhLU0ufPIR1SGVE5LMSk3Km6lFDehPum8wx9szzbN+u8s7Wn68zwWc2sx8j+BXlnFNiEAYaQzs1zJZtNh5VtpWuyL1nXzLSv+nhNXnB3wabKOF6wEm8kjQykB/OjlpVfeTmE/4FbaFShGoDtq+z8jV4uTSCoInoi8Cby2HOGcfCN79L9nYXfxBu2/4L1ZuLI48wpQjPsJEmFjoqRk0/U1Bk5EUoMSm4BGBBj3RfpOApnrheeFeuu0xXNAgbacon7iv3u0Jj06uULEDtKsTjHRa4DoPQBhd+vcTmBxmJ/l8Wo2yCyZshx8tESxoRpajOt6lWtT6YYyLfdtHfUdOZ4B+U48S8I= 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:(13230016)(4636009)(136003)(396003)(366004)(39840400004)(376002)(346002)(26005)(6512007)(6506007)(2616005)(107886003)(5660300002)(52116002)(36756003)(6486002)(44832011)(186003)(6666004)(41300700001)(478600001)(86362001)(38100700002)(38350700002)(83380400001)(66476007)(66556008)(66946007)(54906003)(8936002)(316002)(2906002)(6916009)(4326008)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bjJKNUV2a0paOTBEWTREci8rVkxLa21SL2NZekxUNGM1SVRnbU9hNjRhdkVa?= =?utf-8?B?RlhtY0o3cmMxcGI2cW1RRWwyQ1RyYVhnWXorMVFVTm9La2c0RklTY1BYOUVG?= =?utf-8?B?aXpxSWJhdkgrenNjb2ZFTkJKSEc0SlFod1NwYzJENE90K1AxU1hxYnFsTnFK?= =?utf-8?B?ZWQzcGYvakNFR0VwbjRSeWZZd25kdFA5eE1KWHRnQjUxWFNzZENFQlVXMytB?= =?utf-8?B?VTY1UjBtbC9vM0lzalgxYUhpazE3My9CSGwvU3ZtdEt5QmNRVXNJK3NBQW9B?= =?utf-8?B?T0ZhVXJVZlk4Z3BCZVlCak9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zRRcUtr?= =?utf-8?B?dHhpUWwyZHU1ZFpTSTJtRGx5N1Fna25aRStNeVl6Y0lnYyt4SU41TDNmS283?= =?utf-8?B?d1E9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00210560-ee8b-4ecb-9899-08da76ac60ee X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2022 06:33:16.1849 (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: cgnHdhXcOQhGj5TI54x2lAJVqMRonNO6Ps8hVr/WiE3fMfDrK0qpPNCnWV8Zq1fvTVzoK/X4IeBD/eSNJ/IcFhfjowjzE6bnNe1AWcIV0ic= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR13MB1772 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 This commit move some common Rx and Tx logic to the rxtx header file so that they can be re-used by flower tx and rx logic. Signed-off-by: Chaoyong He Signed-off-by: Heinrich Kuhn Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_rxtx.c | 32 +------------------------------- drivers/net/nfp/nfp_rxtx.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 8429b44..8d63a7b 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -116,12 +116,6 @@ return count; } -static inline void -nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq) -{ - rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; -} - /* * nfp_net_set_hash - Set mbuf hash data * @@ -583,7 +577,7 @@ * @txq: TX queue to work with * Returns number of descriptors freed */ -static int +int nfp_net_tx_free_bufs(struct nfp_net_txq *txq) { uint32_t qcp_rd_p; @@ -774,30 +768,6 @@ return 0; } -/* Leaving always free descriptors for avoiding wrapping confusion */ -static inline -uint32_t nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq) -{ - if (txq->wr_p >= txq->rd_p) - return txq->tx_count - (txq->wr_p - txq->rd_p) - 8; - else - return txq->rd_p - txq->wr_p - 8; -} - -/* - * nfp_net_txq_full - Check if the TX queue free descriptors - * is below tx_free_threshold - * - * @txq: TX queue to check - * - * This function uses the host copy* of read/write pointers - */ -static inline -uint32_t nfp_net_nfd3_txq_full(struct nfp_net_txq *txq) -{ - return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh); -} - /* nfp_net_tx_tso - Set TX descriptor for TSO */ static inline void nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq, struct nfp_net_nfd3_tx_desc *txd, diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 5c005d7..a30171f 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -330,6 +330,36 @@ struct nfp_net_rxq { int rx_qcidx; } __rte_aligned(64); +static inline void +nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq) +{ + rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; +} + +/* Leaving always free descriptors for avoiding wrapping confusion */ +static inline uint32_t +nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq) +{ + if (txq->wr_p >= txq->rd_p) + return txq->tx_count - (txq->wr_p - txq->rd_p) - 8; + else + return txq->rd_p - txq->wr_p - 8; +} + +/* + * nfp_net_nfd3_txq_full - Check if the TX queue free descriptors + * is below tx_free_threshold + * + * @txq: TX queue to check + * + * This function uses the host copy* of read/write pointers + */ +static inline uint32_t +nfp_net_nfd3_txq_full(struct nfp_net_txq *txq) +{ + return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh); +} + int nfp_net_rx_freelist_setup(struct rte_eth_dev *dev); uint32_t nfp_net_rx_queue_count(void *rx_queue); uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, @@ -355,6 +385,7 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, uint16_t nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +int nfp_net_tx_free_bufs(struct nfp_net_txq *txq); #endif /* _NFP_RXTX_H_ */ /* -- 1.8.3.1