From: Jie Hai <haijie1@huawei.com>
To: dev@dpdk.org, "Chaoyong He" <chaoyong.he@corigine.com>,
"Niklas Söderlund" <niklas.soderlund@corigine.com>,
"Chengwen Feng" <fengchengwen@huawei.com>,
"Lijun Ou" <oulijun@huawei.com>,
"Konstantin Ananyev"
<"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"Ferruh Yigit" <ferruh.yigit@intel.com>
Cc: <haijie1@huawei.com>, <lihuisong@huawei.com>
Subject: [PATCH 23/36] net/nfp: fix Rx and Tx queue state
Date: Fri, 8 Sep 2023 19:28:48 +0800 [thread overview]
Message-ID: <20230908112901.1169869-24-haijie1@huawei.com> (raw)
In-Reply-To: <20230908112901.1169869-1-haijie1@huawei.com>
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>
---
drivers/net/nfp/flower/nfp_flower.c | 8 ++++++++
drivers/net/nfp/flower/nfp_flower_representor.c | 12 ++++++++++++
drivers/net/nfp/nfp_common.c | 2 ++
drivers/net/nfp/nfp_ethdev.c | 6 ++++++
drivers/net/nfp/nfp_ethdev_vf.c | 6 ++++++
5 files changed, 34 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 77dab864f319..eb7b40a6eb25 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -85,6 +85,7 @@ int
nfp_flower_pf_start(struct rte_eth_dev *dev)
{
int ret;
+ uint16_t i;
uint32_t new_ctrl;
uint32_t update = 0;
struct nfp_net_hw *hw;
@@ -137,6 +138,11 @@ nfp_flower_pf_start(struct rte_eth_dev *dev)
return -EIO;
}
+ 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;
}
@@ -159,11 +165,13 @@ nfp_flower_pf_stop(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++) {
this_tx_q = dev->data->tx_queues[i];
nfp_net_reset_tx_queue(this_tx_q);
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
}
for (i = 0; i < dev->data->nb_rx_queues; i++) {
this_rx_q = dev->data->rx_queues[i];
nfp_net_reset_rx_queue(this_rx_q);
+ dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
}
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 5f94d20f1b0c..3f97bc9f8a39 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -303,6 +303,7 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev)
{
struct nfp_flower_representor *repr;
struct nfp_app_fw_flower *app_fw_flower;
+ uint16_t i;
repr = dev->data->dev_private;
app_fw_flower = repr->app_fw_flower;
@@ -314,6 +315,11 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev)
nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, true);
+ 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;
}
@@ -322,6 +328,7 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev)
{
struct nfp_flower_representor *repr;
struct nfp_app_fw_flower *app_fw_flower;
+ uint16_t i;
repr = dev->data->dev_private;
app_fw_flower = repr->app_fw_flower;
@@ -333,6 +340,11 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev)
repr->nfp_idx, 0);
}
+ 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;
}
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 5092e5869de4..c0d4708f2b3e 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -1927,6 +1927,7 @@ nfp_net_stop_rx_queue(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_rx_queues; i++) {
this_rx_q = dev->data->rx_queues[i];
nfp_net_reset_rx_queue(this_rx_q);
+ dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
}
}
@@ -1952,6 +1953,7 @@ nfp_net_stop_tx_queue(struct rte_eth_dev *dev)
for (i = 0; i < dev->data->nb_tx_queues; i++) {
this_tx_q = dev->data->tx_queues[i];
nfp_net_reset_tx_queue(this_tx_q);
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
}
}
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e3ff3d80873d..bdfd5530c55f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -65,6 +65,7 @@ nfp_net_start(struct rte_eth_dev *dev)
struct rte_eth_conf *dev_conf;
struct rte_eth_rxmode *rxmode;
uint32_t intr_vector;
+ uint16_t i;
int ret;
hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -176,6 +177,11 @@ nfp_net_start(struct rte_eth_dev *dev)
hw->ctrl = new_ctrl;
+ 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;
error:
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index eaf815d06da5..3e8aeef51ab4 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -39,6 +39,7 @@ nfp_netvf_start(struct rte_eth_dev *dev)
struct rte_eth_conf *dev_conf;
struct rte_eth_rxmode *rxmode;
uint32_t intr_vector;
+ uint16_t i;
int ret;
hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -115,6 +116,11 @@ nfp_netvf_start(struct rte_eth_dev *dev)
hw->ctrl = new_ctrl;
+ 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;
error:
--
2.30.0
next prev parent reply other threads:[~2023-09-08 11:34 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 11:28 [PATCH 00/36] " Jie Hai
2023-09-08 11:28 ` [PATCH 01/36] net/axgbe: " Jie Hai
2023-09-08 11:28 ` [PATCH 02/36] net/af_packet: " Jie Hai
2023-09-08 11:28 ` [PATCH 03/36] net/af_xdp: " Jie Hai
2023-09-08 11:28 ` [PATCH 04/36] net/avp: " Jie Hai
2023-09-08 11:28 ` [PATCH 05/36] net/bnx2x: " Jie Hai
2023-09-08 11:28 ` [PATCH 06/36] net/bnxt: " Jie Hai
2023-09-08 11:28 ` [PATCH 07/36] net/bonding: " Jie Hai
2023-09-08 11:28 ` [PATCH 08/36] net/cxgbe: " Jie Hai
2023-09-08 11:28 ` [PATCH 09/36] net/dpaa: " Jie Hai
2023-09-16 10:07 ` Hemant Agrawal
2023-09-08 11:28 ` [PATCH 10/36] net/dpaa2: " Jie Hai
2023-09-16 10:07 ` Hemant Agrawal
2023-09-08 11:28 ` [PATCH 11/36] net/e1000: " Jie Hai
2023-09-08 11:28 ` [PATCH 12/36] net/ena: " Jie Hai
2023-09-08 11:28 ` [PATCH 13/36] net/enetc: " Jie Hai
2023-09-08 11:28 ` [PATCH 14/36] net/enic: " Jie Hai
2023-09-08 11:28 ` [PATCH 15/36] net/hinic: " Jie Hai
2023-09-08 11:28 ` [PATCH 16/36] net/ipn3ke: " Jie Hai
2023-09-10 2:56 ` Xu, Rosen
2023-09-08 11:28 ` [PATCH 17/36] net/memif: " Jie Hai
2023-09-08 11:28 ` [PATCH 18/36] net/mana: " Jie Hai
2023-09-08 11:28 ` [PATCH 19/36] net/mlx4: " Jie Hai
2023-09-08 11:28 ` [PATCH 20/36] net/mvneta: " Jie Hai
2023-09-08 11:28 ` [PATCH 21/36] net/mvpp2: " Jie Hai
2023-09-08 11:28 ` [PATCH 22/36] net/netvsc: " Jie Hai
2023-09-08 11:28 ` Jie Hai [this message]
2023-09-11 1:45 ` [PATCH 23/36] net/nfp: " Chaoyong He
2023-09-08 11:28 ` [PATCH 24/36] net/ngbe: " Jie Hai
2023-09-08 11:28 ` [PATCH 25/36] net/null: " Jie Hai
2023-09-08 11:28 ` [PATCH 26/36] net/octeon_ep: " Jie Hai
2023-09-08 11:28 ` [PATCH 27/36] net/octeontx: " Jie Hai
2023-11-02 9:59 ` [EXT] " Harman Kalra
2023-11-02 12:34 ` Jie Hai
2023-09-08 11:28 ` [PATCH 28/36] net/pfe: " Jie Hai
2023-09-08 11:28 ` [PATCH 29/36] net/ring: " Jie Hai
2023-09-08 11:28 ` [PATCH 30/36] net/sfc: " Jie Hai
2023-09-08 12:01 ` Andrew Rybchenko
2023-09-12 2:39 ` Jie Hai
2023-09-08 11:28 ` [PATCH 31/36] net/softnic: " Jie Hai
2023-09-18 11:24 ` Dumitrescu, Cristian
2023-09-08 11:28 ` [PATCH 32/36] net/txgbe: " Jie Hai
2023-09-08 11:28 ` [PATCH 33/36] net/vhost: " Jie Hai
2023-09-08 11:28 ` [PATCH 34/36] net/virtio: " Jie Hai
2023-09-08 11:29 ` [PATCH 35/36] net/vmxnet3: " Jie Hai
2023-09-08 11:29 ` [PATCH 36/36] app/testpmd: fix primary process not polling all queues Jie Hai
2023-09-08 11:50 ` [PATCH 00/36] fix Rx and Tx queue state David Marchand
2023-09-18 16:54 ` Ferruh Yigit
2023-09-22 2:41 ` Jie Hai
2023-09-22 6:41 ` David Marchand
2023-09-26 13:59 ` Jie Hai
2023-09-28 12:51 ` Ferruh Yigit
2023-09-28 7:42 ` [PATCH v2 0/8] " Jie Hai
2023-09-28 7:42 ` [PATCH v2 1/8] lib/ethdev: update Rx and Tx queue status Jie Hai
2023-09-28 9:24 ` lihuisong (C)
2023-09-28 13:15 ` Ferruh Yigit
2023-10-07 8:36 ` Jie Hai
2023-10-16 11:23 ` Ferruh Yigit
2023-09-28 7:42 ` [PATCH v2 2/8] net/cpfl: support getting queue information Jie Hai
2023-10-01 16:04 ` Ali Alnubani
2023-09-28 7:43 ` [PATCH v2 3/8] net/enetc: save deferred start configuratin for queues Jie Hai
2023-09-28 7:43 ` [PATCH v2 4/8] net/enetc: support getting queue information Jie Hai
2023-09-28 7:43 ` [PATCH v2 5/8] net/failsafe: " Jie Hai
2023-09-28 7:43 ` [PATCH v2 6/8] net/fm10k: " Jie Hai
2023-09-28 7:43 ` [PATCH v2 7/8] net/idpf: " Jie Hai
2023-09-28 7:43 ` [PATCH v2 8/8] app/testpmd: fix primary process not polling all queues Jie Hai
2023-10-01 16:08 ` [PATCH v2 0/8] fix Rx and Tx queue state Ali Alnubani
2023-10-16 11:51 ` [PATCH 00/36] " Ferruh Yigit
2023-10-16 12:01 ` Ferruh Yigit
2023-10-17 14:11 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230908112901.1169869-24-haijie1@huawei.com \
--to=haijie1@huawei.com \
--cc="konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com \
--cc=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@intel.com \
--cc=lihuisong@huawei.com \
--cc=niklas.soderlund@corigine.com \
--cc=oulijun@huawei.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).