[15/36] net/hinic: fix Rx and Tx queue state
Checks
Commit Message
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: stable@dpdk.org
Signed-off-by: Jie Hai <haijie1@huawei.com>
---
drivers/net/hinic/hinic_pmd_ethdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
@@ -980,6 +980,7 @@ static int hinic_dev_start(struct rte_eth_dev *dev)
int rc;
char *name;
struct hinic_nic_dev *nic_dev;
+ uint16_t i;
nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
name = dev->data->name;
@@ -1047,6 +1048,11 @@ static int hinic_dev_start(struct rte_eth_dev *dev)
rte_bit_relaxed_set32(HINIC_DEV_START, &nic_dev->dev_status);
+ for (i = 0; i < dev->data->nb_rx_queues; i++)
+ dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+ for (i = 0; i < dev->data->nb_tx_queues; i++)
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
return 0;
en_port_fail:
@@ -1169,6 +1175,7 @@ static int hinic_dev_stop(struct rte_eth_dev *dev)
uint16_t port_id;
struct hinic_nic_dev *nic_dev;
struct rte_eth_link link;
+ uint16_t i;
nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
name = dev->data->name;
@@ -1215,6 +1222,11 @@ static int hinic_dev_stop(struct rte_eth_dev *dev)
hinic_free_all_rx_mbuf(dev);
hinic_free_all_tx_mbuf(dev);
+ for (i = 0; i < dev->data->nb_rx_queues; i++)
+ dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+ for (i = 0; i < dev->data->nb_tx_queues; i++)
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+
return 0;
}