From patchwork Wed Jan 24 12:39:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satha Koteswara Rao Kottidi X-Patchwork-Id: 136104 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6276E439B5; Wed, 24 Jan 2024 13:39:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B34A40294; Wed, 24 Jan 2024 13:39:29 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id D11C54026F for ; Wed, 24 Jan 2024 13:39:27 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O7fu1f008082 for ; Wed, 24 Jan 2024 04:39:27 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= pfpt0220; bh=5iZ5hLY0uQ+W1/7TZuF75leObfv1zfWQURP3Q2N/Jfs=; b=U5N V+BY+ExXEWTLj/MZPKKp/Kp7wEMYKLekcJlJXT3W5YCqSfgew7QoNmtLH2BgMg+U aNeBEhrzCaYX0OQBwzzmgtFaq+aQBa5wmUtDJmJPeQdjbL3V7LCzYEeZPEan+Px7 NVyfcTXSimuzRY9464jsUaSQEXfhtjnolxSUFkrH9anvZtdakJdJA9YF9ZRPUgUa BMajnzHCQDeAxYvwh8/mRJwtDZtmPmi5QqIvy4wHyMBWCopi7HinIYRRFmwtM1xx 6rA/hVzhh46ChQDQ4WPguQRANNmdvGYrdA0qS0IgY2KeWeNe4jJGpurPrAH6FDUT InhF0H5xkgJ/JK/mD2Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vtmgvjky0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 24 Jan 2024 04:39:26 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 24 Jan 2024 04:39:24 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 24 Jan 2024 04:39:24 -0800 Received: from Cavium-PET630-BM22.localdomain (unknown [10.28.34.26]) by maili.marvell.com (Postfix) with ESMTP id 5FB853F7041; Wed, 24 Jan 2024 04:39:22 -0800 (PST) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH] net/cnxk: support Tx queue descriptor count Date: Wed, 24 Jan 2024 07:39:12 -0500 Message-ID: <1706099953-27845-1-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: SyQyLn4Y50jz-H2nGKlltVxGkxi47RxB X-Proofpoint-GUID: SyQyLn4Y50jz-H2nGKlltVxGkxi47RxB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-24_06,2024-01-24_01,2023-05-22_02 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: Satha Rao Added cnxk APIs to get used txq descriptor count. Signed-off-by: Satha Rao --- doc/guides/nics/features/cnxk.ini | 1 + drivers/net/cnxk/cn10k_ethdev.c | 10 ++++++++++ drivers/net/cnxk/cn9k_ethdev.c | 10 ++++++++++ drivers/net/cnxk/cnxk_ethdev.h | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini index ac7de9a..5cc12ef 100644 --- a/doc/guides/nics/features/cnxk.ini +++ b/doc/guides/nics/features/cnxk.ini @@ -40,6 +40,7 @@ Timesync = Y Timestamp offload = Y Rx descriptor status = Y Tx descriptor status = Y +Tx queue count = Y Basic stats = Y Stats per queue = Y Extended stats = Y diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 4a4e972..3a3b8db 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -768,6 +768,14 @@ return rc; } +static int +cn10k_nix_tx_queue_count(void *tx_queue) +{ + struct cn10k_eth_txq *txq = (struct cn10k_eth_txq *)tx_queue; + + return cnxk_nix_tx_queue_count(txq->fc_mem, txq->sqes_per_sqb_log2); +} + /* Update platform specific eth dev ops */ static void nix_eth_dev_ops_override(void) @@ -866,6 +874,8 @@ return -ENOENT; } + eth_dev->tx_queue_count = cn10k_nix_tx_queue_count; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { /* Setup callbacks for secondary process */ cn10k_eth_set_tx_function(eth_dev); diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c index bae4dda..b7c4f59 100644 --- a/drivers/net/cnxk/cn9k_ethdev.c +++ b/drivers/net/cnxk/cn9k_ethdev.c @@ -689,6 +689,14 @@ cn9k_nix_timesync_read_tx_timestamp; } +static int +cn9k_nix_tx_queue_count(void *tx_queue) +{ + struct cn9k_eth_txq *txq = (struct cn9k_eth_txq *)tx_queue; + + return cnxk_nix_tx_queue_count(txq->fc_mem, txq->sqes_per_sqb_log2); +} + /* Update platform specific eth dev ops */ static void nix_tm_ops_override(void) @@ -759,6 +767,8 @@ return -ENOENT; } + eth_dev->tx_queue_count = cn9k_nix_tx_queue_count; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { /* Setup callbacks for secondary process */ cn9k_eth_set_tx_function(eth_dev); diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 4d3ebf1..0fe8b72 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -458,6 +458,17 @@ struct cnxk_eth_txq_sp { return ((struct cnxk_eth_txq_sp *)__txq) - 1; } +static inline int +cnxk_nix_tx_queue_count(uint64_t *mem, uint16_t sqes_per_sqb_log2) +{ + uint64_t val; + + val = rte_atomic_load_explicit(mem, rte_memory_order_relaxed); + val = (val << sqes_per_sqb_log2) - val; + + return (val & 0xFFFF); +} + /* Common ethdev ops */ extern struct eth_dev_ops cnxk_eth_dev_ops;