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 D075FA0548; Thu, 8 Sep 2022 10:46:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E057F42B7D; Thu, 8 Sep 2022 10:45:47 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2126.outbound.protection.outlook.com [40.107.237.126]) by mails.dpdk.org (Postfix) with ESMTP id 276CB427F9 for ; Thu, 8 Sep 2022 10:45:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCHd7EQVMcTg84AmDe8Nd6sJCpij/JPrWH0QvUoeAg8jMOwxJRi7fxzLq62hQpw56UExuCsoKqj6GgAfWfEqA2E9Lx3Uls8Tzy3J3Z1D4i7WmZ+FJUqkZQU53PHycS2iIc54HCmT5ckAdkWtjNAhPGBZ3g4DSoPke2uso57BhFJioAfpDFJKpLOdHqIG7zQcCjYs/osGlQX1BNUSHWme1YbojMBbdVJi/sybtq+mpDhLKTgtEZ0PdVdX14k5m58ts9ZOU1muHML+Q0yWHF9EBCvpANXZOXv0jOYhEB+tdh3CPbodP2s8vgwTbCQ5K9APq+eWyUAAJsQhjpjbk8r7Ww== 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=GzQgExWfI2kSr84aCe80fnBccBdk/Ve66iYXJiEdspo=; b=n/5Gr5lH0yAJXkw2cxTOX3Xec/z4MH52gbvqK6/Q21xSjxF1X9RphSdgnIpcfNn36J4UEKoasldlhPh0MbOeBbBcgn86TtHLOMY3XmudTaoEjA5Ok8wBDfKDUQ1ED3tJS5S+bzlWEzQfNaaaP610X0kgnwnxN76vOre3wrokWAQxzzBfG6pEUpT5DxPYBB0vJA7+yEwHFKjsQYZGCehtI7LXipQRQa8Oa9uRTArM/eA83QOR4KIlCIGzn6Z0mO3uOUZpGKOXel+ZNGrn2SBgrlpz3Dpd4kNgOxykRkSAHydFTSHiinaSCVv4kw3faoUIJJ9Y7lUqrauFlW6R/n3u4Q== 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=GzQgExWfI2kSr84aCe80fnBccBdk/Ve66iYXJiEdspo=; b=PW5eV5vtsGzqwHieN6iaW3++ptTyTHUEzP70Suoc1biNmvNg94eJCMwU2BFMhpWqvM6WUfn7EHBUwFRGQZY1gruh1EAL9WjjK7ExMSL8KoUUlsPbsrcZhlv11inIyP3U27s/1bF1Vwuo1vPnV8ILIUwRnG6GhBjZYp2I7S6x2cU= 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 MW4PR13MB5940.namprd13.prod.outlook.com (2603:10b6:303:1b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.3; Thu, 8 Sep 2022 08:45:45 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%6]) with mapi id 15.20.5612.009; Thu, 8 Sep 2022 08:45:43 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v8 08/12] net/nfp: move common rxtx function for flower use Date: Thu, 8 Sep 2022 16:44:58 +0800 Message-Id: <1662626702-17254-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0023.apcprd01.prod.exchangelabs.com (2603:1096:4:192::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: 1974efb9-634e-407a-4d8b-08da91768390 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vfiezGBMlzXJ2osq9fz8pVvE/6xmT5mfvw+HMcrqVMcv0F0Gk4Y4fJwFtUp8ZGUMLRaWqefwUIylvY91uPk8ZlgmblXRnSMCrEfC97HC3w8lHkEIePZ9LCJiEjpazEYzW1vwFlVcGmXVRKIE94go7BwIVmOdN+/toL1nV/G//BiFk5WR1gb79UJM3tcOw0vAcC8A3Do5+E3OfvyGQ7qJ01xc1VkawvDJnVC5g1voGMpxjSFdOory0yZwAIj7a4JID9xX+NtnBOlm6sR3FaD7JqlVLrAbF9kffrauN99rzHbj78TmABSV/4+hwgcC6kme/I+RLlhHX81PDFjxC9KrZrxQVt3O8o+mXKhJwJP/2pDLnPr4PNRwhI6FuSELXszfwQTUDoH/0ezEfiA4lWLzbdKNggJ6Goc1RSehG7YE3ywszQSiyTFghavVJCMq64eNVFpLoqj9scErMXHGsybwlK5mtsqhy1DF2fo/9tEwDXe4l7KPEB1LnjtcRmEHyHkr4msKsgljwxA4MVuCKyK4dTJAiewxdCrwMGjvJnxZfQfei18OJ4JscH8vISM98DlvkNK/h6dnVgABSWIGreSoGZok+gPwZp2/E564AKuc0gwgccf7RdUMGUU99EuoQhxb0c+Y0qfR3wqMAqitIseIUm6VQ2EVM5MFjKqiPlY63KB02YfgX+LXMczygyAz527i5Y/6PWmfPQhXSG8RosX/AVczpqUlqYPx51L48gLWg6HX/q6jD97JrFATg/pREXHbu9OWQsX7Jg/Yrq9OTgJbSg== 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)(396003)(366004)(39840400004)(346002)(376002)(136003)(107886003)(44832011)(2616005)(41300700001)(6916009)(38350700002)(83380400001)(26005)(6512007)(186003)(36756003)(38100700002)(4326008)(54906003)(2906002)(6506007)(316002)(66946007)(478600001)(86362001)(5660300002)(66476007)(52116002)(6486002)(6666004)(8936002)(8676002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U2NlUUhsVXByQjJlV0lSMjVYU3lTejkvaUZoV1hYUGtrQ0FwdTJwMW9oYkZP?= =?utf-8?B?QlZzWHNkN21VbUFQMnlydVI0YVBUM3BLY0pRa2l5QW5BNjRYblI4d3RZTzdM?= =?utf-8?B?amwzZWlYbGNZcTVQNE1mK1RRWVdjV2ZVYzBLdU5rcGEySEd5OUpKZXJZdmpq?= =?utf-8?B?ZGp2Smp0VVZUMFAzeVJjbnBYMDlYV0EyQkIyWFViNjlSV1ZwSjZVQmFYbW9r?= =?utf-8?B?emNtZ0FhMjlubmZCVXNBZmVCWlJDbGxVRHVYYlVteFpUU1J6UFNtWmZqc205?= =?utf-8?B?YWlBUTVTajlD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ZlSE8wSHV4MTd2ckFh?= =?utf-8?B?OHMvSktDVjVianpWWndOeVFlR0VSTXplbHlkMmtXaU83eFUvM25rRWxiaHgz?= =?utf-8?B?aEE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5940 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 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