ice: fix ice_tx_ring:: Xdp_tx_active underflow
authorAlexander Lobakin <alexandr.lobakin@intel.com>
Fri, 10 Feb 2023 17:06:13 +0000 (18:06 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 13 Feb 2023 18:13:12 +0000 (19:13 +0100)
commitbc4db83470034b4644a8bf164a984bdb68b61622
tree11bd2542890fa9d1afebfc0112861de307854994
parent0b0757244754ea1d0721195c824770f5576e119e
ice: fix ice_tx_ring:: Xdp_tx_active underflow

xdp_tx_active is used to indicate whether an XDP ring has any %XDP_TX
frames queued to shortcut processing Tx cleaning for XSk-enabled queues.
When !XSk, it simply indicates whether the ring has any queued frames in
general.
It gets increased on each frame placed onto the ring and counts the
whole frame, not each frag. However, currently it gets decremented in
ice_clean_xdp_tx_buf(), which is called per each buffer, i.e. per each
frag. Thus, on completing multi-frag frames, an underflow happens.
Move the decrement to the outer function and do it once per frame, not
buf. Also, do that on the stack and update the ring counter after the
loop is done to save several cycles.
XSk rings are fine since there are no frags at the moment.

Fixes: 3246a10752a7 ("ice: Add support for XDP multi-buffer on Tx side")
Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/bpf/20230210170618.1973430-2-alexandr.lobakin@intel.com
drivers/net/ethernet/intel/ice/ice_txrx_lib.c