Skip to content

Commit

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

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: Hemant Agrawal <hemant.agrawal@nxp.com>
  • Loading branch information
Jie Hai authored and kevintraynor committed Oct 31, 2023
1 parent 87695a1 commit 09058bb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/net/dpaa2/dpaa2_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,11 @@ dpaa2_dev_start(struct rte_eth_dev *dev)
if (priv->en_ordered)
dev->tx_pkt_burst = dpaa2_dev_tx_ordered;

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

Expand All @@ -1260,6 +1265,7 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
struct rte_device *rdev = dev->device;
struct rte_intr_handle *intr_handle;
struct rte_dpaa2_device *dpaa2_dev;
uint16_t i;

dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device);
intr_handle = dpaa2_dev->intr_handle;
Expand Down Expand Up @@ -1294,6 +1300,11 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(dev, &link);

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 09058bb

Please sign in to comment.