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 D2CC2A00C5; Thu, 15 Sep 2022 12:45:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19C9B42B71; Thu, 15 Sep 2022 12:45:08 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2130.outbound.protection.outlook.com [40.107.101.130]) by mails.dpdk.org (Postfix) with ESMTP id 9791142B79 for ; Thu, 15 Sep 2022 12:45:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KvAed6y+3wYDq+3bWjNbBgy+tYJgUCWMCBaZVroCA1MXfG+HX6jZ7ViqWRXQFAHHbaiK2E8aAQ+G+0qea9fmTSzmFltserG7KW9qZvcrraK2zWRzzwHMRDRe1OHRkYRBr3JLajCrDxsKMVbo7bPilW0E6Ke3zifTKUi8Pk5rqfEIUCrwIGcm5AXu9z8G7wT9DvORfTBdZMt9bqz5ik3ibh3tLC+kqLbk7O4oTPYZsQGzI7cPVg+xzN3a5RdccEv6HQvZBGKJKu59vc2ekvNC3VcWHgvVapSUtzqA9E2tRcq4yMhtozmmBmwMaDdshInwqIts9/GeWa6b1rifQ3BFjg== 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=HVKuP7tUbIZLw6xgolmmPujd42xFro8GShmm2ItScIM=; b=K6Q+SavP7LVObkTIcMJoBIXWIJ4zRKifsd+fCd0YSPaMc8WFCqhPl565FG6Y0C8qq3cXIdzqzjbmcZ/tOPWCMdKIDzhQtUsbDnG2gdWpMSQuZOj4OSNaZda2t7lERPtGvzjKPEo8JjqprDsQkKhtxQgGbo3U1L36S6ULviuDTb5TOJbtwu5DZKVYTBtDb4b+VY26RCV5BCk76X8dk6weQJMceOqLHIDjecp8oKNm+E9zmYpfu0BGEbTTa2jjNRFBweTPNHC6ZIAZmLKtCTNz5TTFU/JgFynnTYfZnqxZSaNZgrZmlqHQFpywQCSuWwjHgivZdLYXNt1iEEvfHRb3ow== 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=HVKuP7tUbIZLw6xgolmmPujd42xFro8GShmm2ItScIM=; b=RdO9IKlT8WjrISZmWuLhweM4X1b+X3ue2nyJPL7angFhI5IbDKN8XpWIliumcuvpuwzyeTgehxSHmk73d/OIR6tUBQJth3deBdfqom1WQKWmm96htFG3nSDYI9Dhyxj76ROvf/GVZT8rWbeEA3upwPj+c+CdOU8e1Lh3ARMocDg= 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 SA0PR13MB4158.namprd13.prod.outlook.com (2603:10b6:806:9b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.5; Thu, 15 Sep 2022 10:45:04 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::819:38c:6513:bf15%4]) with mapi id 15.20.5632.012; Thu, 15 Sep 2022 10:45:04 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v9 08/12] net/nfp: move common rxtx function for flower use Date: Thu, 15 Sep 2022 18:44:25 +0800 Message-Id: <1663238669-12244-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> References: <1663238669-12244-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR11CA0071.namprd11.prod.outlook.com (2603:10b6:a03:80::48) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB4158:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f43a82b-09b7-4ca2-62f0-08da970758d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /FJuJ9o1nTeNFmhgHbBtAn6+yYThce2tDNrovAeWzCL4N/SRMhMLLfWZT5iWauIPno1exYxVen27EwA9+nFgqZvVoOdksX1A30WrfZe5STmkH0I6RDvGaDiIRx0Nw3G5Gjt2gKqlIXa87AGkZ+vfvcTDWUfR89gzF+IFkFwhKGb9gqQlQQ2Z7qqHRSwXvtJB5cNO1OneKJ8uis5Gfd6FXsssQIpbEz9UGTKPpZfF16Fybi3o4BU/7pkdz3tMKET3QY/7I+HqJHR1scp3pjDTW73LRR+ieVkUPDLTyBCx2cijTWXJXAuRjRWwpA2MPXAbZ3Mc/O0f4rPI+U5J8jv1vyrd378Rdgzriv12g1epTz7qsNZ3Il/HX7uxVPidVeLijDcBQHCVfx4NdE1NrX7JzO7+MHain8PLVA5DRduOzaLQZ81ethD6SHazUohk2UV/ktHAD1P5vPDG4PwbvomXX3eax+nulVKyBeumb4/Jjn54cWdQBhc5Si5vd/bicfPRNnw0/PLTbS+IBFHI5QlGi0iGN5f142muJVJ5jJBQ3pfe68JWsNloniOSZUuM3HWyPYxLKyNud0DzyijZJJTB65nPnZrUzOaKmC2U0WZRmgCG8V8D6XNqSCxS2iLRwh7+7VCqHXhO7kP/iJTkyPzYOeQo5/HEL1zdetlZsh8c5JFrvwy6RNcY2ygJCjA7gNKWa5rLU/8wx7Q9tzeSg2HyoaWhEuxRxbSQHwSfrQbs4/xGGaz1HwzdVByIx2FpIx22rCytzBhJAXkCqWmibZQTdQ== 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:(13230022)(4636009)(396003)(346002)(366004)(376002)(39840400004)(136003)(451199015)(2616005)(38350700002)(38100700002)(186003)(86362001)(83380400001)(107886003)(8676002)(66946007)(66476007)(4326008)(66556008)(44832011)(8936002)(41300700001)(2906002)(5660300002)(6506007)(478600001)(6666004)(316002)(6512007)(26005)(6486002)(52116002)(54906003)(6916009)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N3NZdG5KQW5SZ0xZaHdLZUhyVVF0MlNmSXVLUEZ1MjR5bE53QjVNb1FRL0ZB?= =?utf-8?B?TnNRdW9FNW8vUGYvN1cvWUZQU0QrcHZoZU1sT3VzNTFhaThtcXZpOHRoNFd3?= =?utf-8?B?alcyam5vKzN0bnNTZGI4RDFUT3pyVW5lNXczRWpzaGRBVy9sNUZWNGRXQWdN?= =?utf-8?B?SGo5a256SW4vSlJTaHpwWjJwYkk4Z3ZZak1BV2VIb0l2YWJKTlBnMnhHV2Qz?= =?utf-8?B?d3Y0VnRFVDRQTWZqYTE5QlFKenk1bUszai9tM3FZOGthak5ZSHVJZHY1c3lB?= =?utf-8?B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DU4YjJkV0pWUWhkV2lOWkU4ZVVjdmx4eHBXRzFNbjZK?= =?utf-8?B?NEc4eVB6bURGVlRZRTFUcjhkeE1qVGpTRVdlRld2a0RuMHE5T21uWUk3ZUIw?= =?utf-8?B?NlE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4158 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 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