net/mlx5: HWS, Add timeout mechanism to draining send queues

HWS has a timeout mechanism for usual polling for completion,
but it was missing such a mechanism for draining the send queues.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260915111912.3926585-5-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yevgeny Kliteynik 2026-09-15 14:19:10 +03:00 committed by Jakub Kicinski
parent 23aacde378
commit 7bf7c4367d
2 changed files with 15 additions and 2 deletions

View File

@ -460,7 +460,9 @@ int mlx5hws_bwc_queue_poll(struct mlx5hws_context *ctx,
got_comp = !!ret;
if (unlikely(!got_comp && time_after(jiffies, timeout))) {
mlx5hws_err(ctx, "BWC poll error: polling queue %d - TIMEOUT\n", queue_id);
mlx5hws_err(ctx,
"BWC poll error: polling queue %d - TIMEOUT (%d sec)\n",
queue_id, MLX5HWS_BWC_POLLING_TIMEOUT);
return -ETIMEDOUT;
}
}

View File

@ -1192,6 +1192,8 @@ int mlx5hws_send_queue_action(struct mlx5hws_context *ctx,
u16 queue_id,
u32 actions)
{
unsigned long timeout = jiffies +
secs_to_jiffies(MLX5HWS_BWC_POLLING_TIMEOUT);
struct mlx5hws_send_ring_sq *send_sq;
struct mlx5hws_send_engine *queue;
bool wait_comp = false;
@ -1213,9 +1215,18 @@ int mlx5hws_send_queue_action(struct mlx5hws_context *ctx,
mlx5hws_send_engine_flush_queue(queue);
/* Poll queue until empty */
while (wait_comp && !mlx5hws_send_engine_empty(queue))
while (wait_comp && !mlx5hws_send_engine_empty(queue)) {
hws_send_engine_poll_cq(queue, NULL, &polled, 0);
if (unlikely(time_after(jiffies, timeout))) {
mlx5hws_err(ctx,
"Error draining send queue %d - TIMEOUT (%d sec)\n",
queue_id,
MLX5HWS_BWC_POLLING_TIMEOUT);
return -ETIMEDOUT;
}
}
break;
default:
return -EINVAL;