From: longli@linuxonhyperv.com
To: Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: dev@dpdk.org, Ajay Sharma <sharmaajay@microsoft.com>,
Long Li <longli@microsoft.com>
Subject: [PATCH] net/mana: set the correct queue state
Date: Fri, 7 Jul 2023 11:53:15 -0700 [thread overview]
Message-ID: <1688755996-25172-1-git-send-email-longli@linuxonhyperv.com> (raw)
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
next reply other threads:[~2023-07-07 18:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 18:53 longli [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1688755996-25172-1-git-send-email-longli@linuxonhyperv.com \
--to=longli@linuxonhyperv.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=longli@microsoft.com \
--cc=sharmaajay@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).