[04/36] net/avp: fix Rx and Tx queue state

Message ID 20230908112901.1169869-5-haijie1@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series fix Rx and Tx queue state |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Sept. 8, 2023, 11:28 a.m. UTC
  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/avp/avp_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

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;