The DPDK framework reports the queue state, which is stored in
dev->data->tx_queue_state and dev->data->rx_queue_state. The
state is maintained by the driver. Users may determine whether
a queue participates in packet forwarding based on the state.
Therefore, the driver needs to modify the queue state in time
according to the actual situation.

Fixes: 9ad9ff476cac ("ethdev: add queue state in queried queue information")
Cc: sta...@dpdk.org

Signed-off-by: Jie Hai <haij...@huawei.com>
---
 drivers/net/mvneta/mvneta_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/mvneta/mvneta_ethdev.c 
b/drivers/net/mvneta/mvneta_ethdev.c
index d7953ac7cbac..ad27b3e663ec 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -376,6 +376,10 @@ mvneta_dev_start(struct rte_eth_dev *dev)
                goto out;
        }
 
+       /* start rx queues */
+       for (i = 0; i < dev->data->nb_rx_queues; i++)
+               dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
        /* start tx queues */
        for (i = 0; i < dev->data->nb_tx_queues; i++)
                dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
@@ -412,6 +416,14 @@ mvneta_dev_stop(struct rte_eth_dev *dev)
 
        priv->ppio = NULL;
 
+       /* stop rx queues */
+       for (i = 0; i < dev->data->nb_rx_queues; i++)
+               dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+
+       /* stop tx queues */
+       for (i = 0; i < dev->data->nb_tx_queues; i++)
+               dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+
        return 0;
 }
 
-- 
2.30.0

Reply via email to