From: Ravi Kumar Date: Mon, 19 Mar 2018 12:23:42 +0000 (-0400) Subject: crypto/ccp: support stats related ops X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ba9a6f14c61d1c11a94df08f81d7be7c124e59f2;p=dpdk.git crypto/ccp: support stats related ops Signed-off-by: Ravi Kumar --- diff --git a/drivers/crypto/ccp/ccp_pmd_ops.c b/drivers/crypto/ccp/ccp_pmd_ops.c index bd0aea4a3c..d3708f491b 100644 --- a/drivers/crypto/ccp/ccp_pmd_ops.c +++ b/drivers/crypto/ccp/ccp_pmd_ops.c @@ -41,6 +41,36 @@ ccp_pmd_close(struct rte_cryptodev *dev __rte_unused) return 0; } +static void +ccp_pmd_stats_get(struct rte_cryptodev *dev, + struct rte_cryptodev_stats *stats) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct ccp_qp *qp = dev->data->queue_pairs[qp_id]; + + stats->enqueued_count += qp->qp_stats.enqueued_count; + stats->dequeued_count += qp->qp_stats.dequeued_count; + + stats->enqueue_err_count += qp->qp_stats.enqueue_err_count; + stats->dequeue_err_count += qp->qp_stats.dequeue_err_count; + } + +} + +static void +ccp_pmd_stats_reset(struct rte_cryptodev *dev) +{ + int qp_id; + + for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { + struct ccp_qp *qp = dev->data->queue_pairs[qp_id]; + + memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + } +} + static void ccp_pmd_info_get(struct rte_cryptodev *dev, struct rte_cryptodev_info *dev_info) @@ -255,8 +285,8 @@ struct rte_cryptodev_ops ccp_ops = { .dev_stop = ccp_pmd_stop, .dev_close = ccp_pmd_close, - .stats_get = NULL, - .stats_reset = NULL, + .stats_get = ccp_pmd_stats_get, + .stats_reset = ccp_pmd_stats_reset, .dev_infos_get = ccp_pmd_info_get,