From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Nicolas Chautru <nicolas.chautru@intel.com>
Subject: [PATCH 02/10] bbdev: add per-queue statistics API
Date: Fri, 17 Jul 2026 11:29:57 +0200 [thread overview]
Message-ID: <20260717093006.229370-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20260717093006.229370-1-david.marchand@redhat.com>
Add rte_bbdev_queue_stats_get() to retrieve statistics for a specific
queue. This allows applications to get per-queue stats without
accessing internal data structures.
Update test-bbdev to use the new API.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
app/test-bbdev/test_bbdev_perf.c | 38 +++++---------------------
doc/guides/rel_notes/release_26_07.rst | 5 ++++
lib/bbdev/rte_bbdev.c | 20 ++++++++++++++
lib/bbdev/rte_bbdev.h | 20 ++++++++++++++
4 files changed, 52 insertions(+), 31 deletions(-)
diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 9fb0a25948..b75d8387bd 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -5849,30 +5849,6 @@ validation_test(struct active_device *ad, struct test_op_params *op_params)
return validation_latency_test(ad, op_params, false);
}
-static int
-get_bbdev_queue_stats(uint16_t dev_id, uint16_t queue_id,
- struct rte_bbdev_stats *stats)
-{
- struct rte_bbdev *dev = &rte_bbdev_devices[dev_id];
- struct rte_bbdev_stats *q_stats;
-
- if (queue_id >= dev->data->num_queues)
- return -1;
-
- q_stats = &dev->data->queues[queue_id].queue_stats;
-
- stats->enqueued_count = q_stats->enqueued_count;
- stats->dequeued_count = q_stats->dequeued_count;
- stats->enqueue_err_count = q_stats->enqueue_err_count;
- stats->dequeue_err_count = q_stats->dequeue_err_count;
- stats->enqueue_warn_count = q_stats->enqueue_warn_count;
- stats->dequeue_warn_count = q_stats->dequeue_warn_count;
- stats->acc_offload_cycles = q_stats->acc_offload_cycles;
- stats->enqueue_depth_avail = q_stats->enqueue_depth_avail;
-
- return 0;
-}
-
static int
offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs,
struct rte_bbdev_fft_op *ref_op, uint16_t dev_id,
@@ -5906,7 +5882,7 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs,
&ops_enq[enq], burst_sz - enq);
} while (unlikely(burst_sz != enq));
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -5988,7 +5964,7 @@ offload_latency_test_mldts(struct rte_mempool *mempool, struct test_buffers *buf
&ops_enq[enq], burst_sz - enq);
} while (unlikely(burst_sz != enq));
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -6069,7 +6045,7 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs,
&ops_enq[enq], burst_sz - enq);
} while (unlikely(burst_sz != enq));
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -6163,7 +6139,7 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool,
} while (unlikely(burst_sz != enq));
enq_sw_last_time = rte_rdtsc_precise() - enq_start_time;
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -6251,7 +6227,7 @@ offload_latency_test_enc(struct rte_mempool *mempool, struct test_buffers *bufs,
enq_sw_last_time = rte_rdtsc_precise() - enq_start_time;
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -6332,7 +6308,7 @@ offload_latency_test_ldpc_enc(struct rte_mempool *mempool,
} while (unlikely(burst_sz != enq));
enq_sw_last_time = rte_rdtsc_precise() - enq_start_time;
- ret = get_bbdev_queue_stats(dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, dev_id);
@@ -6482,7 +6458,7 @@ offload_cost_test(struct active_device *ad,
rte_get_tsc_hz());
struct rte_bbdev_stats stats = {0};
- ret = get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+ ret = rte_bbdev_queue_stats_get(ad->dev_id, queue_id, &stats);
TEST_ASSERT_SUCCESS(ret,
"Failed to get stats for queue (%u) of device (%u)",
queue_id, ad->dev_id);
diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
index 6badd6d91b..dbad975d8c 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -190,6 +190,11 @@ New Features
* Added ``eof`` devarg to use link state to signal end of receive file input.
* Added unit test suite.
+* **Added per-queue statistics API in bbdev.**
+
+ Added ``rte_bbdev_queue_stats_get()`` function to retrieve statistics
+ for a specific queue, complementing the existing device-level statistics API.
+
* **Updated Marvell cnxk crypto driver.**
* Added support for ML-KEM and ML-DSA on CN20K platform.
diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 90095578cb..3f032a8e32 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -819,6 +819,26 @@ rte_bbdev_stats_reset(uint16_t dev_id)
return 0;
}
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_stats_get, 26.07)
+int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats)
+{
+ struct rte_bbdev *dev = get_dev(dev_id);
+
+ VALID_DEV_OR_RET_ERR(dev, dev_id);
+ VALID_QUEUE_OR_RET_ERR(queue_id, dev);
+
+ if (stats == NULL) {
+ rte_bbdev_log(ERR, "NULL stats structure");
+ return -EINVAL;
+ }
+
+ *stats = dev->data->queues[queue_id].queue_stats;
+
+ rte_bbdev_log_debug("Retrieved stats for queue %u of device %u",
+ queue_id, dev_id);
+ return 0;
+}
+
RTE_EXPORT_SYMBOL(rte_bbdev_info_get)
int
rte_bbdev_info_get(uint16_t dev_id, struct rte_bbdev_info *dev_info)
diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h
index 36dabf8fa6..9fcfbf4c69 100644
--- a/lib/bbdev/rte_bbdev.h
+++ b/lib/bbdev/rte_bbdev.h
@@ -316,6 +316,26 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);
int
rte_bbdev_stats_reset(uint16_t dev_id);
+/**
+ * Retrieve the statistics of a specific queue.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param queue_id
+ * The index of the queue.
+ * @param stats
+ * Pointer to structure to where statistics will be copied. On error, this
+ * location may or may not have been modified.
+ *
+ * @return
+ * - 0 on success
+ * - -ENODEV if dev_id is invalid
+ * - -EINVAL if stats is NULL
+ * - -ERANGE if queue_id is out of range
+ */
+__rte_experimental
+int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats);
+
/** Device information supplied by the device's driver */
/* Structure rte_bbdev_driver_info 8< */
--
2.54.0
next prev parent reply other threads:[~2026-07-17 9:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 9:29 [PATCH 00/10] Limit usage of internal API in tests David Marchand
2026-07-17 9:29 ` [PATCH 01/10] bbdev: fix stats aggregation from queues David Marchand
2026-07-17 17:22 ` Chautru, Nicolas
2026-07-17 9:29 ` David Marchand [this message]
2026-07-17 9:29 ` [PATCH 03/10] hash: fix GFNI stubs export David Marchand
2026-07-17 9:38 ` Bruce Richardson
2026-07-17 9:55 ` Konstantin Ananyev
2026-07-17 9:29 ` [PATCH 04/10] test: uninline helper for forking David Marchand
2026-07-17 9:39 ` Bruce Richardson
2026-07-17 9:30 ` [PATCH 05/10] test/bonding: get MAC address with public API David Marchand
2026-07-17 9:30 ` [PATCH 06/10] test/devargs: check driver presence " David Marchand
2026-07-17 9:55 ` Bruce Richardson
2026-07-17 10:08 ` David Marchand
2026-07-17 10:14 ` Bruce Richardson
2026-07-17 12:34 ` David Marchand
2026-07-17 12:56 ` Thomas Monjalon
2026-07-17 9:30 ` [PATCH 07/10] test/vdev: find device " David Marchand
2026-07-17 9:30 ` [PATCH 08/10] test: limit internal API usage David Marchand
2026-07-17 9:30 ` [PATCH 09/10] ci: make ABI reference generation faster David Marchand
2026-07-17 9:30 ` [PATCH 10/10] ci: run reference unit tests against ABI David Marchand
2026-07-17 9:35 ` [PATCH 00/10] Limit usage of internal API in tests David Marchand
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=20260717093006.229370-3-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=nicolas.chautru@intel.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