]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/mlx5e: IPsec, fix ASO poll timeout with read_poll_timeout_atomic()
authorGal Pressman <gal@nvidia.com>
Thu, 9 Apr 2026 20:28:52 +0000 (23:28 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 21:37:08 +0000 (14:37 -0700)
commitedccdd1eb94712da97a6ce71123ec27890add754
tree56bf72a5ccdb482c232959f9e7b365d542974c31
parent9994ad4df82d64e57135c0f0906897685f5a9e87
net/mlx5e: IPsec, fix ASO poll timeout with read_poll_timeout_atomic()

The do-while poll loop uses jiffies for its timeout:
  expires = jiffies + msecs_to_jiffies(10);

jiffies is sampled at an arbitrary point within the current tick, so the
first partial tick contributes anywhere from a full tick down to nearly
zero real time. For small msecs_to_jiffies() results this is
significant, the effective poll window can be much shorter than the
requested 10ms, and in the worst case the loop exits after a single
iteration (e.g., when HZ=100), well before the device has delivered the
CQE.

Replace the loop with read_poll_timeout_atomic(), which counts elapsed
time via udelay() accounting rather than jiffies, guaranteeing the full
poll window regardless of HZ.

Additionally, read_poll_timeout_atomic() executes the poll operation one
more time after the timeout has expired, giving the CQE a final chance
to be detected. The old do-while loop could exit without a final poll if
the timeout expired during the udelay() between iterations.

Fixes: 76e463f6508b ("net/mlx5e: Overcome slow response for first IPsec ASO WQE")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260409202852.158059-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c