[16/36] net/ipn3ke: fix Rx and Tx queue state

Message ID 20230908112901.1169869-17-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/ipn3ke/ipn3ke_representor.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Xu, Rosen Sept. 10, 2023, 2:56 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 7:29 PM
> To: dev@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Lijun Ou <oulijun@huawei.com>; Chengwen Feng
> <fengchengwen@huawei.com>; Konstantin Ananyev
> <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>;
> Thomas Monjalon <thomas@monjalon.net>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [PATCH 16/36] net/ipn3ke: fix Rx and Tx queue state
> 
> 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/ipn3ke/ipn3ke_representor.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c
> b/drivers/net/ipn3ke/ipn3ke_representor.c
> index c82f8b533370..d904d3f251e3 100644
> --- a/drivers/net/ipn3ke/ipn3ke_representor.c
> +++ b/drivers/net/ipn3ke/ipn3ke_representor.c
> @@ -120,6 +120,7 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev)
>  	uint64_t base_mac;
>  	uint32_t val;
>  	char attr_name[IPN3KE_RAWDEV_ATTR_LEN_MAX];
> +	uint16_t i;
> 
>  	rawdev = hw->rawdev;
> 
> @@ -190,6 +191,11 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev)
> 
>  	ipn3ke_rpst_link_update(dev, 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 0;
>  }
> 
> @@ -198,6 +204,7 @@ ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev)  {
>  	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
>  	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
> +	uint16_t i;
> 
>  	if (hw->retimer.mac_type ==
> IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) {
>  		/* Disable the TX path */
> @@ -207,6 +214,11 @@ ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev)
>  		ipn3ke_xmac_rx_disable(hw, rpst->port_id, 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;
>  }
> 
> --
> 2.30.0

Reviewed-by: Rosen Xu <rosen.xu@intel.com>
  

Patch

diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index c82f8b533370..d904d3f251e3 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -120,6 +120,7 @@  ipn3ke_rpst_dev_start(struct rte_eth_dev *dev)
 	uint64_t base_mac;
 	uint32_t val;
 	char attr_name[IPN3KE_RAWDEV_ATTR_LEN_MAX];
+	uint16_t i;
 
 	rawdev = hw->rawdev;
 
@@ -190,6 +191,11 @@  ipn3ke_rpst_dev_start(struct rte_eth_dev *dev)
 
 	ipn3ke_rpst_link_update(dev, 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 0;
 }
 
@@ -198,6 +204,7 @@  ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(dev);
 	struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(dev);
+	uint16_t i;
 
 	if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) {
 		/* Disable the TX path */
@@ -207,6 +214,11 @@  ipn3ke_rpst_dev_stop(struct rte_eth_dev *dev)
 		ipn3ke_xmac_rx_disable(hw, rpst->port_id, 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;
 }