[PATCH v6 3/9] crypto/zsda: add statistics

Hanxiao Li li.hanxiao at zte.com.cn
Thu May 22 11:30:29 CEST 2025


Add crypto statistics operations for zsda devices.

Signed-off-by: Hanxiao Li <li.hanxiao at zte.com.cn>
---
 drivers/crypto/zsda/zsda_crypto_pmd.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/zsda/zsda_crypto_pmd.c b/drivers/crypto/zsda/zsda_crypto_pmd.c
index 04c4e45843..8b44ebe61f 100644
--- a/drivers/crypto/zsda/zsda_crypto_pmd.c
+++ b/drivers/crypto/zsda/zsda_crypto_pmd.c
@@ -78,6 +78,26 @@ zsda_dev_info_get(struct rte_cryptodev *dev,
 	}
 }
 
+static void
+zsda_crypto_stats_get(struct rte_cryptodev *dev, struct rte_cryptodev_stats *stats)
+{
+	struct zsda_qp_stat comm = {0};
+
+	zsda_stats_get(dev->data->queue_pairs, dev->data->nb_queue_pairs,
+		       &comm);
+	stats->enqueued_count = comm.enqueued_count;
+	stats->dequeued_count = comm.dequeued_count;
+	stats->enqueue_err_count = comm.enqueue_err_count;
+	stats->dequeue_err_count = comm.dequeue_err_count;
+}
+
+static void
+zsda_crypto_stats_reset(struct rte_cryptodev *dev)
+{
+	zsda_stats_reset(dev->data->queue_pairs, dev->data->nb_queue_pairs);
+}
+
+
 static struct rte_cryptodev_ops crypto_zsda_ops = {
 	.dev_configure = zsda_dev_config,
 	.dev_start = zsda_dev_start,
@@ -85,8 +105,8 @@ static struct rte_cryptodev_ops crypto_zsda_ops = {
 	.dev_close = zsda_dev_close,
 	.dev_infos_get = zsda_dev_info_get,
 
-	.stats_get = NULL,
-	.stats_reset = NULL,
+	.stats_get = zsda_crypto_stats_get,
+	.stats_reset = zsda_crypto_stats_reset,
 	.queue_pair_setup = NULL,
 	.queue_pair_release = NULL,
 
-- 
2.27.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20250522/594420cb/attachment.htm>


More information about the dev mailing list