Skip to content

Commit

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

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 5c8a283 commit 7278617
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/net/memif/rte_eth_memif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ memif_dev_start(struct rte_eth_dev *dev)
{
struct pmd_internals *pmd = dev->data->dev_private;
int ret = 0;
uint16_t i;

switch (pmd->role) {
case MEMIF_ROLE_CLIENT:
Expand All @@ -1257,13 +1258,28 @@ memif_dev_start(struct rte_eth_dev *dev)
break;
}

if (ret == 0) {
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 ret;
}

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

memif_disconnect(dev);

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 7278617

Please sign in to comment.