net/mlx5: fix testpmd quit with available desc threshold

When testpmd quit with mlx5 avail_thresh enabled, a rte timer handler
delays to reconfigure rx queue to re-arm this event. However at the same
time, testpmd is destroying rx queues.
It's never a valid use case for mlx5 avail_thresh. Before testpmd quit,
user should disable avail_thresh configuration to not handle the events.
This is documented in mlx5 driver guide.

To avoid the crash in such use case, check port status, if it is not
RTE_PORT_STARTED, don't process the avail_thresh event.

Fixes: f41a5092e6 ("app/testpmd: add host shaper command")
Cc: stable@dpdk.org

Signed-off-by: Spike Du <spiked@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Spike Du 2022-11-02 13:44:25 +02:00 committed by Raslan Darawsheh
parent d9bad05024
commit 0f3ba0d4a8

View File

@ -39,7 +39,15 @@ mlx5_test_host_shaper_disable(void *args)
uint16_t port_id = port_rxq_id & 0xffff;
uint16_t qid = (port_rxq_id >> 16) & 0xffff;
struct rte_eth_rxq_info qinfo;
struct rte_port *port;
port = &ports[port_id];
if (port->port_status != RTE_PORT_STARTED) {
printf("%s port_status(%d) is incorrect, stop avail_thresh "
"event processing.\n",
__func__, port->port_status);
return;
}
printf("%s disable shaper\n", __func__);
if (rte_eth_rx_queue_info_get(port_id, qid, &qinfo)) {
printf("rx_queue_info_get returns error\n");