ice: account for XDP_TX buffers when cleaning a Tx ring
xdp_tx_active counts the XDP_TX buffers on an XDP ring, so that
ice_clean_xdp_irq_zc() can complete AF_XDP zero-copy frames in bulk when
there are none. ice_clean_tx_ring() frees the buffers that are still on
the ring, both through ice_xsk_clean_xdp_ring() and through
ice_unmap_and_free_tx_buf(), but leaves the counter as it was.
After a ring is cleaned with XDP_TX frames in flight, for example when
an AF_XDP socket is bound or unbound, xdp_tx_active therefore stays
non-zero for the lifetime of the ring. ice_clean_xdp_irq_zc() then
always takes the per-descriptor slow path.
ice_xsk_clean_xdp_ring() used to decrement the counter for the XDP_TX
buffers it freed, through ice_clean_xdp_tx_buf(), until that helper was
replaced with a plain xsk_buff_free(). Decrement it again for each
XDP_TX buffer it frees. ice_unmap_and_free_tx_buf() frees buffers on
regular XDP rings, which count XDP_TX and redirected frames rather than
buffers, so reset the counter in ice_clean_tx_ring() as well, so that a
zero-copy socket bound afterwards starts from zero.
Fixes: 59e92bfe4df7 ("ice: xsk: Borrow xdp_tx_active logic from i40e")
Fixes: a24b4c6e9aab ("ice: xsk: Do not convert to buff to frame for XDP_TX")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
2 files changed