[PATCH 21.11 2/2] net/nfp: fix Rx and Tx queue state

Jie Hai haijie1 at huawei.com
Thu Apr 11 10:49:54 CEST 2024


[ upstream commit c46216e77ac3b1890eb622bea4bcc8c54f9da820 ]

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 at dpdk.org

Signed-off-by: Jie Hai <haijie1 at huawei.com>
Acked-by: Chaoyong He <chaoyong.he at corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c    | 6 ++++++
 drivers/net/nfp/nfp_ethdev_vf.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e1da0bdebed1..4edf08251c77 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -89,6 +89,7 @@ nfp_net_start(struct rte_eth_dev *dev)
 	struct rte_eth_conf *dev_conf;
 	struct rte_eth_rxmode *rxmode;
 	uint32_t intr_vector;
+	uint16_t i;
 	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -185,6 +186,11 @@ nfp_net_start(struct rte_eth_dev *dev)
 		nfp_eth_set_configured(dev->process_private,
 				       hw->nfp_idx, 1);
 
+	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;
 
 error:
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0dda3961ce57..a61c73a96e1c 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -57,6 +57,7 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 	struct rte_eth_conf *dev_conf;
 	struct rte_eth_rxmode *rxmode;
 	uint32_t intr_vector;
+	uint16_t i;
 	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -133,6 +134,11 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
+	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;
 
 error:
-- 
2.30.0



More information about the stable mailing list