[09/36] net/dpaa: fix Rx and Tx queue state

Message ID 20230908112901.1169869-10-haijie1@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series fix Rx and Tx queue state |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Sept. 8, 2023, 11:28 a.m. UTC
  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/dpaa/dpaa_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Hemant Agrawal Sept. 16, 2023, 10:07 a.m. UTC | #1
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 4:59 PM
> To: dev@dpdk.org; Hemant Agrawal <hemant.agrawal@nxp.com>; Sachin
> Saxena <sachin.saxena@nxp.com>; Lijun Ou <oulijun@huawei.com>; Ferruh
> Yigit <ferruh.yigit@intel.com>; Konstantin Ananyev
> <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>;
> Thomas Monjalon <thomas@monjalon.net>; Chengwen Feng
> <fengchengwen@huawei.com>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [PATCH 09/36] net/dpaa: fix Rx and Tx queue state
> Importance: High
> 
> 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/dpaa/dpaa_ethdev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/dpaa/dpaa_ethdev.c
> b/drivers/net/dpaa/dpaa_ethdev.c index a6c86113d125..ef4c06db6a4d
> 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -399,6 +399,7 @@ static void dpaa_interrupt_handler(void *param)
> static int dpaa_eth_dev_start(struct rte_eth_dev *dev)  {
>  	struct dpaa_if *dpaa_intf = dev->data->dev_private;
> +	uint16_t i;
> 
>  	PMD_INIT_FUNC_TRACE();
> 
> @@ -413,12 +414,18 @@ static int dpaa_eth_dev_start(struct rte_eth_dev
> *dev)
> 
>  	fman_if_enable_rx(dev->process_private);
> 
> +	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 dpaa_eth_dev_stop(struct rte_eth_dev *dev)  {
>  	struct fman_if *fif = dev->process_private;
> +	uint16_t i;
> 
>  	PMD_INIT_FUNC_TRACE();
>  	dev->data->dev_started = 0;
> @@ -427,6 +434,11 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev
> *dev)
>  		fman_if_disable_rx(fif);
>  	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
> 
> +	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;
>  }
> 
> --
> 2.30.0
  

Patch

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a6c86113d125..ef4c06db6a4d 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -399,6 +399,7 @@  static void dpaa_interrupt_handler(void *param)
 static int dpaa_eth_dev_start(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -413,12 +414,18 @@  static int dpaa_eth_dev_start(struct rte_eth_dev *dev)
 
 	fman_if_enable_rx(dev->process_private);
 
+	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 dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 {
 	struct fman_if *fif = dev->process_private;
+	uint16_t i;
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
@@ -427,6 +434,11 @@  static int dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 		fman_if_disable_rx(fif);
 	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
 
+	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;
 }