Thread (90 messages) 90 messages, 3 authors, 2022-01-21
STALE1650d
Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 06/25] crypto/cnxk: only enable queues that are allocated

From: Anoob Joseph <hidden>
Date: 2021-12-07 06:52:52
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

From: Shijith Thotton <sthotton@marvell.com>

Only enable/disable queue pairs that are allocated during cryptodev
start/stop.

Fixes: 6a95dbc1a291 ("crypto/cnxk: add dev start and dev stop")

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index a2281fb..21ee09f 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -100,8 +100,13 @@ cnxk_cpt_dev_start(struct rte_cryptodev *dev)
 	uint16_t nb_lf = roc_cpt->nb_lf;
 	uint16_t qp_id;
 
-	for (qp_id = 0; qp_id < nb_lf; qp_id++)
+	for (qp_id = 0; qp_id < nb_lf; qp_id++) {
+		/* Application may not setup all queue pair */
+		if (roc_cpt->lf[qp_id] == NULL)
+			continue;
+
 		roc_cpt_iq_enable(roc_cpt->lf[qp_id]);
+	}
 
 	return 0;
 }
@@ -114,8 +119,12 @@ cnxk_cpt_dev_stop(struct rte_cryptodev *dev)
 	uint16_t nb_lf = roc_cpt->nb_lf;
 	uint16_t qp_id;
 
-	for (qp_id = 0; qp_id < nb_lf; qp_id++)
+	for (qp_id = 0; qp_id < nb_lf; qp_id++) {
+		if (roc_cpt->lf[qp_id] == NULL)
+			continue;
+
 		roc_cpt_iq_disable(roc_cpt->lf[qp_id]);
+	}
 }
 
 int
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help