Skip to content

Commit

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

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 36cbe79 commit 0a4aa9f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/net/avp/avp_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,7 @@ static int
avp_dev_start(struct rte_eth_dev *eth_dev)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
uint16_t i;
int ret;

rte_spinlock_lock(&avp->lock);
Expand All @@ -2056,6 +2057,11 @@ avp_dev_start(struct rte_eth_dev *eth_dev)
/* remember current link state */
avp->flags |= AVP_F_LINKUP;

for (i = 0; i < avp->num_rx_queues; i++)
eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
for (i = 0; i < avp->num_tx_queues; i++)
eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;

ret = 0;

unlock:
Expand All @@ -2067,6 +2073,7 @@ static int
avp_dev_stop(struct rte_eth_dev *eth_dev)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
uint16_t i;
int ret;

rte_spinlock_lock(&avp->lock);
Expand All @@ -2086,6 +2093,11 @@ avp_dev_stop(struct rte_eth_dev *eth_dev)
ret);
}

for (i = 0; i < avp->num_rx_queues; i++)
eth_dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
for (i = 0; i < avp->num_tx_queues; i++)
eth_dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;

unlock:
rte_spinlock_unlock(&avp->lock);
return ret;
Expand Down

0 comments on commit 0a4aa9f

Please sign in to comment.