60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
From 9a204f7e4e86d8270cae3cdec2b7949f5954fde2 Mon Sep 17 00:00:00 2001
|
|
From: Jie Hai <haijie1@huawei.com>
|
|
Date: Fri, 8 Sep 2023 19:28:28 +0800
|
|
Subject: [PATCH] net/af_xdp: fix Rx and Tx queue state
|
|
|
|
[ upstream commit 9a204f7e4e86d8270cae3cdec2b7949f5954fde2 ]
|
|
|
|
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: 9ad9ff476cac ("ethdev: add queue state in queried queue information")
|
|
Cc: stable@dpdk.org
|
|
|
|
Signed-off-by: Jie Hai <haijie1@huawei.com>
|
|
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
|
|
---
|
|
drivers/net/af_xdp/rte_eth_af_xdp.c | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
|
|
index c7786cc53a..0cc51223ba 100644
|
|
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
|
|
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
|
|
@@ -694,7 +694,13 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
|
|
static int
|
|
eth_dev_start(struct rte_eth_dev *dev)
|
|
{
|
|
+ uint16_t i;
|
|
+
|
|
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;
|
|
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
|
|
+ }
|
|
|
|
return 0;
|
|
}
|
|
@@ -703,7 +709,14 @@ eth_dev_start(struct rte_eth_dev *dev)
|
|
static int
|
|
eth_dev_stop(struct rte_eth_dev *dev)
|
|
{
|
|
+ uint16_t i;
|
|
+
|
|
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;
|
|
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
|
|
+ }
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|