[v2,3/9] crypto/zsda: add statistics

Message ID 20250303082751.1053432-4-li.hanxiao@zte.com.cn (mailing list archive)
State Changes Requested
Delegated to: akhil goyal
Headers
Series crypto/zsda: add zsda cryptodev driver |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hanxiao Li March 3, 2025, 8:27 a.m. UTC
Add crypto statistics operations for zsda devices.

Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn>
---
 drivers/crypto/zsda/zsda_sym_pmd.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

-- 
2.27.0
  

Comments

Akhil Goyal May 14, 2025, 7:08 a.m. UTC | #1
> Add crypto statistics operations for zsda devices.
> 
> Signed-off-by: Hanxiao Li <li.hanxiao@zte.com.cn>
> ---
>  drivers/crypto/zsda/zsda_sym_pmd.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/zsda/zsda_sym_pmd.c
> b/drivers/crypto/zsda/zsda_sym_pmd.c
> index 22c8d482fb..31ba582b68 100644
> --- a/drivers/crypto/zsda/zsda_sym_pmd.c
> +++ b/drivers/crypto/zsda/zsda_sym_pmd.c
> @@ -90,6 +90,25 @@ zsda_sym_dev_info_get(struct rte_cryptodev *dev,
>      }
>  }
> 
> +static void
> +zsda_sym_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_sym_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_sym_dev_config,
> @@ -98,8 +117,8 @@ static struct rte_cryptodev_ops crypto_zsda_ops = {
>      .dev_close = zsda_sym_dev_close,
>      .dev_infos_get = zsda_sym_dev_info_get,
> 
> -    .stats_get = NULL,
> -    .stats_reset = NULL,
> +    .stats_get = zsda_sym_stats_get,
> +    .stats_reset = zsda_sym_stats_reset,

Same comment here also for 'sym'

>      .queue_pair_setup = NULL,
>      .queue_pair_release = NULL,
> 
> --
> 2.27.0
  

Patch

diff --git a/drivers/crypto/zsda/zsda_sym_pmd.c b/drivers/crypto/zsda/zsda_sym_pmd.c
index 22c8d482fb..31ba582b68 100644
--- a/drivers/crypto/zsda/zsda_sym_pmd.c
+++ b/drivers/crypto/zsda/zsda_sym_pmd.c
@@ -90,6 +90,25 @@  zsda_sym_dev_info_get(struct rte_cryptodev *dev,
 	}
 }
 
+static void
+zsda_sym_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_sym_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_sym_dev_config,
@@ -98,8 +117,8 @@  static struct rte_cryptodev_ops crypto_zsda_ops = {
 	.dev_close = zsda_sym_dev_close,
 	.dev_infos_get = zsda_sym_dev_info_get,
 
-	.stats_get = NULL,
-	.stats_reset = NULL,
+	.stats_get = zsda_sym_stats_get,
+	.stats_reset = zsda_sym_stats_reset,
 	.queue_pair_setup = NULL,
 	.queue_pair_release = NULL,