From: <skoteshwar@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, <jerinj@marvell.com>
Subject: [PATCH] net/cnxk: support Tx queue descriptor count
Date: Wed, 24 Jan 2024 07:39:12 -0500 [thread overview]
Message-ID: <1706099953-27845-1-git-send-email-skoteshwar@marvell.com> (raw)
From: Satha Rao <skoteshwar@marvell.com>
Added cnxk APIs to get used txq descriptor count.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
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;
--
1.8.3.1
next reply other threads:[~2024-01-24 12:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 12:39 skoteshwar [this message]
2024-02-22 11:33 ` Jerin Jacob
2024-02-23 15:33 ` [PATCH v2] " skoteshwar
2024-02-25 15:33 ` Jerin Jacob
2024-03-01 6:48 ` [PATCH v3] " skoteshwar
2024-03-01 9:48 ` [PATCH v4] " skoteshwar
2024-03-01 13:51 ` Jerin Jacob
2024-03-04 9:40 ` [PATCH v5] " skoteshwar
2024-03-04 9:52 ` [PATCH v6] " skoteshwar
2024-03-04 11:44 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1706099953-27845-1-git-send-email-skoteshwar@marvell.com \
--to=skoteshwar@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).