DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mana: set the correct queue state
@ 2023-07-07 18:53 longli
  2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
  2023-10-16 11:52 ` [PATCH] net/mana: " Ferruh Yigit
  0 siblings, 2 replies; 9+ messages in thread
From: longli @ 2023-07-07 18:53 UTC (permalink / raw)
  To: Ferruh Yigit, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

From: Long Li <longli@microsoft.com>

Set the queue state when queue is started/stopped

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/net/mana/rx.c | 15 +++++++++++++++
 drivers/net/mana/tx.c | 13 +++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c
index 220b372b15..1047ac1743 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -131,6 +131,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev)
 	struct mana_priv *priv = dev->data->dev_private;
 	int ret, i;
 
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED)
+			return -EINVAL;
+
 	if (priv->rwq_qp) {
 		ret = ibv_destroy_qp(priv->rwq_qp);
 		if (ret)
@@ -187,7 +191,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev)
 
 		memset(&rxq->gdma_rq, 0, sizeof(rxq->gdma_rq));
 		memset(&rxq->gdma_cq, 0, sizeof(rxq->gdma_cq));
+
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
+
 	return 0;
 }
 
@@ -199,6 +206,11 @@ mana_start_rx_queues(struct rte_eth_dev *dev)
 	struct ibv_wq *ind_tbl[priv->num_queues];
 
 	DRV_LOG(INFO, "start rx queues");
+
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_rxq *rxq = dev->data->rx_queues[i];
 		struct ibv_wq_init_attr wq_attr = {};
@@ -373,6 +385,9 @@ mana_start_rx_queues(struct rte_eth_dev *dev)
 			goto fail;
 	}
 
+	for (i = 0; i < priv->num_queues; i++)
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
 	return 0;
 
 fail:
diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c
index 5947efbe8d..eb4b60cc10 100644
--- a/drivers/net/mana/tx.c
+++ b/drivers/net/mana/tx.c
@@ -15,6 +15,10 @@ mana_stop_tx_queues(struct rte_eth_dev *dev)
 	struct mana_priv *priv = dev->data->dev_private;
 	int i, ret;
 
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_txq *txq = dev->data->tx_queues[i];
 
@@ -51,6 +55,8 @@ mana_stop_tx_queues(struct rte_eth_dev *dev)
 
 		memset(&txq->gdma_sq, 0, sizeof(txq->gdma_sq));
 		memset(&txq->gdma_cq, 0, sizeof(txq->gdma_cq));
+
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
 	return 0;
@@ -63,6 +69,11 @@ mana_start_tx_queues(struct rte_eth_dev *dev)
 	int ret, i;
 
 	/* start TX queues */
+
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_txq *txq;
 		struct ibv_qp_init_attr qp_attr = { 0 };
@@ -142,6 +153,8 @@ mana_start_tx_queues(struct rte_eth_dev *dev)
 			txq->gdma_cq.id, txq->gdma_cq.buffer,
 			txq->gdma_cq.count, txq->gdma_cq.size,
 			txq->gdma_cq.head);
+
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-16 12:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07 18:53 [PATCH] net/mana: set the correct queue state longli
2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
2023-07-07 20:16   ` Stephen Hemminger
2023-07-07 20:43     ` Long Li
2023-07-08  1:52       ` Stephen Hemminger
2023-07-10  8:34         ` Ferruh Yigit
2023-08-29 18:29   ` [Patch v2] " longli
2023-10-16 12:02     ` Ferruh Yigit
2023-10-16 11:52 ` [PATCH] net/mana: " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).