Skip to content

Commit

Permalink
net/mlx4: fix Rx and Tx queue state
Browse files Browse the repository at this point in the history
[ upstream commit 7cc3ea8934785226c6fe6d403ea5b31761d5f52f ]

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: 9ad9ff4 ("ethdev: add queue state in queried queue information")

Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  • Loading branch information
Jie Hai authored and kevintraynor committed Oct 31, 2023
1 parent 7278617 commit 789097d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/net/mlx4/mlx4.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
struct rte_flow_error error;
uint16_t i;
int ret;

if (priv->started)
Expand Down Expand Up @@ -327,6 +328,12 @@ mlx4_dev_start(struct rte_eth_dev *dev)
dev->rx_pkt_burst = mlx4_rx_burst;
/* Enable datapath on secondary process. */
mlx4_mp_req_start_rxtx(dev);

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;
err:
mlx4_dev_stop(dev);
Expand All @@ -345,6 +352,7 @@ static int
mlx4_dev_stop(struct rte_eth_dev *dev)
{
struct mlx4_priv *priv = dev->data->dev_private;
uint16_t i;

if (!priv->started)
return 0;
Expand All @@ -359,6 +367,11 @@ mlx4_dev_stop(struct rte_eth_dev *dev)
mlx4_rxq_intr_disable(priv);
mlx4_rss_deinit(priv);

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;
}

Expand Down

0 comments on commit 789097d

Please sign in to comment.