[2/3] common/cnxk: added new API to enable disable SQ

Message ID 20231205100048.1387058-2-rkudurumalla@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/3] common/cnxk: optimize ethdev teardown time |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Rakesh Kudurumalla Dec. 5, 2023, 10 a.m. UTC
  Added a new roc API to disable SQB aura FC
and update SQ state to disabled state in TX queue
stop.The same SQ status is verified during sq flush
to enable or disable SQB aura FC during ethdev
teardown.This fix reduces teardown time by 90%.

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
 drivers/common/cnxk/roc_nix.h       |  2 ++
 drivers/common/cnxk/roc_nix_queue.c | 15 +++++++++++++++
 drivers/common/cnxk/roc_nix_tm.c    | 20 ++++++++++++--------
 drivers/common/cnxk/version.map     |  1 +
 4 files changed, 30 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index a96cf73757..82997c38ce 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -401,6 +401,7 @@  struct roc_nix_sq {
 	void *sqe_mem;
 	void *fc;
 	uint8_t tc;
+	bool enable;
 };
 
 struct roc_nix_link_info {
@@ -952,6 +953,7 @@  void __roc_api roc_nix_cq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid,
 					uint32_t *head, uint32_t *tail);
 int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq);
 int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq);
+int __roc_api roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable);
 void __roc_api roc_nix_sq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid,
 					uint32_t *head, uint32_t *tail);
 
diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c
index f96d5c3a96..ae4e0ea40c 100644
--- a/drivers/common/cnxk/roc_nix_queue.c
+++ b/drivers/common/cnxk/roc_nix_queue.c
@@ -92,6 +92,20 @@  nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable)
 	return rc;
 }
 
+int
+roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable)
+{
+	int rc = 0;
+
+	rc = roc_nix_tm_sq_aura_fc(sq, enable);
+	if (rc)
+		goto done;
+
+	sq->enable = enable;
+done:
+	return rc;
+}
+
 int
 roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable)
 {
@@ -1409,6 +1423,7 @@  roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq)
 	}
 	mbox_put(mbox);
 
+	sq->enable = true;
 	nix->sqs[qid] = sq;
 	sq->io_addr = nix->base + NIX_LF_OP_SENDX(0);
 	/* Evenly distribute LMT slot for each sq */
diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index ece88b5e99..6a61e448a1 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -887,10 +887,12 @@  nix_tm_sq_flush_pre(struct roc_nix_sq *sq)
 		if (!sq)
 			continue;
 
-		rc = roc_nix_tm_sq_aura_fc(sq, false);
-		if (rc) {
-			plt_err("Failed to disable sqb aura fc, rc=%d", rc);
-			goto cleanup;
+		if (sq->enable) {
+			rc = roc_nix_tm_sq_aura_fc(sq, false);
+			if (rc) {
+				plt_err("Failed to disable sqb aura fc, rc=%d", rc);
+				goto cleanup;
+			}
 		}
 
 		/* Wait for sq entries to be flushed */
@@ -997,10 +999,12 @@  nix_tm_sq_flush_post(struct roc_nix_sq *sq)
 			once = true;
 		}
 
-		rc = roc_nix_tm_sq_aura_fc(s_sq, true);
-		if (rc) {
-			plt_err("Failed to enable sqb aura fc, rc=%d", rc);
-			return rc;
+		if (s_sq->enable) {
+			rc = roc_nix_tm_sq_aura_fc(s_sq, true);
+			if (rc) {
+				plt_err("Failed to enable sqb aura fc, rc=%d", rc);
+				return rc;
+			}
 		}
 	}
 
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index aa884a8fe2..4907b62013 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -339,6 +339,7 @@  INTERNAL {
 	roc_nix_rx_queue_intr_disable;
 	roc_nix_rx_queue_intr_enable;
 	roc_nix_sq_dump;
+	roc_nix_sq_ena_dis;
 	roc_nix_sq_fini;
 	roc_nix_sq_head_tail_get;
 	roc_nix_sq_init;