net/cnxk: support Tx queue descriptor count
Checks
Commit Message
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(+)
Comments
On Wed, Jan 24, 2024 at 6:09 PM <skoteshwar@marvell.com> wrote:
>
> 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 +
Please update release notes
@@ -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
@@ -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);
@@ -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);
@@ -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;