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/avp/avp_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index b2a08f563542..53d9e38c939b 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -2036,6 +2036,7 @@ static int avp_dev_start(struct rte_eth_dev *eth_dev) { struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + uint16_t i; int ret; rte_spinlock_lock(&avp->lock); @@ -2056,6 +2057,11 @@ avp_dev_start(struct rte_eth_dev *eth_dev) /* remember current link state */ avp->flags |= AVP_F_LINKUP; + for (i = 0; i < avp->num_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + for (i = 0; i < avp->num_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + ret = 0; unlock: @@ -2067,6 +2073,7 @@ static int avp_dev_stop(struct rte_eth_dev *eth_dev) { struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + uint16_t i; int ret; rte_spinlock_lock(&avp->lock); @@ -2086,6 +2093,11 @@ avp_dev_stop(struct rte_eth_dev *eth_dev) ret); } + for (i = 0; i < avp->num_rx_queues; i++) + eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + for (i = 0; i < avp->num_tx_queues; i++) + eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; + unlock: rte_spinlock_unlock(&avp->lock); return ret; -- 2.30.0