[31/36] net/softnic: fix Rx and Tx queue state
Checks
Commit Message
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/softnic/rte_eth_softnic.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 12:29 PM
> To: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.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>; Chengwen Feng <fengchengwen@huawei.com>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [PATCH 31/36] net/softnic: 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>
> ---
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
@@ -134,6 +134,7 @@ pmd_dev_start(struct rte_eth_dev *dev)
{
struct pmd_internals *p = dev->data->dev_private;
int status;
+ uint16_t i;
/* Firmware */
status = softnic_cli_script_process(p,
@@ -146,6 +147,11 @@ pmd_dev_start(struct rte_eth_dev *dev)
/* Link UP */
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;
+ for (i = 0; i < dev->data->nb_tx_queues; i++)
+ dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
return 0;
}
@@ -153,6 +159,7 @@ static int
pmd_dev_stop(struct rte_eth_dev *dev)
{
struct pmd_internals *p = dev->data->dev_private;
+ uint16_t i;
/* Link DOWN */
dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
@@ -163,6 +170,11 @@ pmd_dev_stop(struct rte_eth_dev *dev)
softnic_softnic_swq_free_keep_rxq_txq(p);
softnic_mempool_free(p);
+ 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;
}