Skip to content

Commit

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

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 4cdfd0b commit b86f868
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/net/null/rte_eth_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,36 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
static int
eth_dev_start(struct rte_eth_dev *dev)
{
uint16_t i;

if (dev == NULL)
return -EINVAL;

dev->data->dev_link.link_status = RTE_ETH_LINK_UP;

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

static int
eth_dev_stop(struct rte_eth_dev *dev)
{
uint16_t i;

if (dev == NULL)
return 0;

dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;

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 b86f868

Please sign in to comment.