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/octeon_ep/otx_ep_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c 
b/drivers/net/octeon_ep/otx_ep_ethdev.c
index 57b965ad0670..970372bbd791 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -156,6 +156,11 @@ otx_ep_dev_start(struct rte_eth_dev *eth_dev)
        otx_ep_dev_link_update(eth_dev, 0);
        otx_ep_info("dev started\n");
 
+       for (q = 0; q < eth_dev->data->nb_rx_queues; q++)
+               eth_dev->data->rx_queue_state[q] = RTE_ETH_QUEUE_STATE_STARTED;
+       for (q = 0; q < eth_dev->data->nb_tx_queues; q++)
+               eth_dev->data->tx_queue_state[q] = RTE_ETH_QUEUE_STATE_STARTED;
+
        return 0;
 }
 
@@ -164,9 +169,15 @@ static int
 otx_ep_dev_stop(struct rte_eth_dev *eth_dev)
 {
        struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+       uint16_t i;
 
        otx_epvf->fn_list.disable_io_queues(otx_epvf);
 
+       for (i = 0; i < eth_dev->data->nb_rx_queues; i++)
+               eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+       for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+               eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+
        return 0;
 }
 
-- 
2.30.0

Reply via email to