Commit 3f1baa91 authored by Sankararaman Jayaraman's avatar Sankararaman Jayaraman Committed by Jakub Kicinski
Browse files

vmxnet3: Fix tx queue race condition with XDP



If XDP traffic runs on a CPU which is greater than or equal to
the number of the Tx queues of the NIC, then vmxnet3_xdp_get_tq()
always picks up queue 0 for transmission as it uses reciprocal scale
instead of simple modulo operation.

vmxnet3_xdp_xmit() and vmxnet3_xdp_xmit_frame() use the above
returned queue without any locking which can lead to race conditions
when multiple XDP xmits run in parallel on different CPU's.

This patch uses a simple module scheme when the current CPU equals or
exceeds the number of Tx queues on the NIC. It also adds locking in
vmxnet3_xdp_xmit() and vmxnet3_xdp_xmit_frame() functions.

Fixes: 54f00cce ("vmxnet3: Add XDP support.")
Signed-off-by: default avatarSankararaman Jayaraman <sankararaman.jayaraman@broadcom.com>
Signed-off-by: default avatarRonak Doshi <ronak.doshi@broadcom.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250131042340.156547-1-sankararaman.jayaraman@broadcom.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a8aa6a6d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment