[27/36] net/octeontx: 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/octeontx/octeontx_ethdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
Comments
Hi Jie,
What issue did you observe which the following patch resolves? Can you please provide steps.
Because we are setting the respective queue state in octeontx_dev_tx_queue_start/stop() ethdev_ops
Thanks
Harman
> -----Original Message-----
> From: Jie Hai <haijie1@huawei.com>
> Sent: Friday, September 8, 2023 4:59 PM
> To: dev@dpdk.org; Harman Kalra <hkalra@marvell.com>; Chengwen Feng
> <fengchengwen@huawei.com>; Lijun Ou <oulijun@huawei.com>; Thomas
> Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>;
> Konstantin Ananyev
> <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>
> Cc: haijie1@huawei.com; lihuisong@huawei.com
> Subject: [EXT] [PATCH 27/36] net/octeontx: fix Rx and Tx queue state
>
> External Email
>
> ----------------------------------------------------------------------
> 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/octeontx/octeontx_ethdev.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c
> b/drivers/net/octeontx/octeontx_ethdev.c
> index a6ae51a42c4e..2a8378a33ea2 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -732,6 +732,11 @@ octeontx_dev_start(struct rte_eth_dev *dev)
> }
>
> /* Success */
> + 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 ret;
>
> pki_port_stop_error:
> @@ -746,6 +751,7 @@ static int
> octeontx_dev_stop(struct rte_eth_dev *dev) {
> struct octeontx_nic *nic = octeontx_pmd_priv(dev);
> + uint16_t i;
> int ret;
>
> PMD_INIT_FUNC_TRACE();
> @@ -772,6 +778,11 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
> return ret;
> }
>
> + 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
On 2023/11/2 17:59, Harman Kalra wrote:
> Hi Jie,
>
> What issue did you observe which the following patch resolves? Can you please provide steps.
> Because we are setting the respective queue state in octeontx_dev_tx_queue_start/stop() ethdev_ops
>
> Thanks
> Harman
>
Hi, Harman,
If dev_start are called, all queues except for the deferred one should
forward packets.
I have not tested for this driver, please try the following steps to see
if there is any problem.
For the original question, please see commit:
37b68fa1445c app/testpmd: fix primary process not polling all queues applied
If applied this patch without drivers reporting their queue state in
dev_start and dev_stop ops, perform the following opertation:
step1: Start the testpmd app.
dpdk-testpmd -a 0000:35:00.0 -l 0-3 -- -i --rxq=10 --txq=10
step2: Perform the following steps and send traffic. As expected,
queue 7 does not send or receive packets, and other queues do.
port 0 rxq 7 stop
port 0 txq 7 stop
set fwd mac
start
step3: Perform the following steps and send traffic. All queues
are expected to send and receive packets normally, but that's not
the case for queue 7. The queue may be enabled on hardware, but
not allowed to participate in forwarding in app level for the wrong state.
stop
port stop all
port start all
start
show port xstats all
If drivers support checking queue state by command 'show rxq info 0 7'
and 'show txq info 0 7', we see queue 7 is stopped as other queues are
started. That makes queue 7 not forward.
Please refer to
https://inbox.dpdk.org/dev/20230721160422.3848154-1-ferruh.yigit@amd.com/
and
https://inbox.dpdk.org/dev/20230928074305.2991100-9-haijie1@huawei.com/.
Thanks,
Jie Hai
>> -----Original Message-----
>> From: Jie Hai <haijie1@huawei.com>
>> Sent: Friday, September 8, 2023 4:59 PM
>> To: dev@dpdk.org; Harman Kalra <hkalra@marvell.com>; Chengwen Feng
>> <fengchengwen@huawei.com>; Lijun Ou <oulijun@huawei.com>; Thomas
>> Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>;
>> Konstantin Ananyev
>> <"konstantin.v.ananyev@yandex.rukonstantin.ananyev"@huawei.com>
>> Cc: haijie1@huawei.com; lihuisong@huawei.com
>> Subject: [EXT] [PATCH 27/36] net/octeontx: fix Rx and Tx queue state
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> 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/octeontx/octeontx_ethdev.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/net/octeontx/octeontx_ethdev.c
>> b/drivers/net/octeontx/octeontx_ethdev.c
>> index a6ae51a42c4e..2a8378a33ea2 100644
>> --- a/drivers/net/octeontx/octeontx_ethdev.c
>> +++ b/drivers/net/octeontx/octeontx_ethdev.c
>> @@ -732,6 +732,11 @@ octeontx_dev_start(struct rte_eth_dev *dev)
>> }
>>
>> /* Success */
>> + 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 ret;
>>
>> pki_port_stop_error:
>> @@ -746,6 +751,7 @@ static int
>> octeontx_dev_stop(struct rte_eth_dev *dev) {
>> struct octeontx_nic *nic = octeontx_pmd_priv(dev);
>> + uint16_t i;
>> int ret;
>>
>> PMD_INIT_FUNC_TRACE();
>> @@ -772,6 +778,11 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
>> return ret;
>> }
>>
>> + 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
>
> .
@@ -732,6 +732,11 @@ octeontx_dev_start(struct rte_eth_dev *dev)
}
/* Success */
+ 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 ret;
pki_port_stop_error:
@@ -746,6 +751,7 @@ static int
octeontx_dev_stop(struct rte_eth_dev *dev)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+ uint16_t i;
int ret;
PMD_INIT_FUNC_TRACE();
@@ -772,6 +778,11 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
return ret;
}
+ 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;
}