]> git.baikalelectronics.ru Git - kernel.git/commit
ice: xsk: check if Rx ring was filled up to the end
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Thu, 17 Mar 2022 17:57:27 +0000 (18:57 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 14 Apr 2022 15:08:40 +0000 (08:08 -0700)
commit2d757b64cb3116827dec7536e4ed64d3d890f2f7
tree56362e197fd4db0e3888eeeb9388351ccdb8036f
parentd5a6e36da8eb4a80286d3051b8f02ea919ba6793
ice: xsk: check if Rx ring was filled up to the end

__ice_alloc_rx_bufs_zc() checks if a number of the descriptors to be
allocated would cause the ring wrap. In that case, driver will issue two
calls to xsk_buff_alloc_batch() - one that will fill the ring up to the
end and the second one that will start with filling descriptors from the
beginning of the ring.

ice_fill_rx_descs() is a wrapper for taking care of what
xsk_buff_alloc_batch() gave back to the driver. It works in a best
effort approach, so for example when driver asks for 64 buffers,
ice_fill_rx_descs() could assign only 32. Such case needs to be checked
when ring is being filled up to the end, because in that situation ntu
might not reached the end of the ring.

Fix the ring wrap by checking if nb_buffs_extra has the expected value.
If not, bump ntu and go directly to tail update.

Fixes: 5eb364b55b04 ("ice: xsk: Handle SW XDP ring wrap and bump tail more often")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Shwetha Nagaraju <Shwetha.nagaraju@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_xsk.c