idpf: simplify and fix splitq Tx packet rollback error path
authorJoshua Hay <joshua.a.hay@intel.com>
Fri, 25 Jul 2025 18:42:20 +0000 (11:42 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 21 Aug 2025 16:04:58 +0000 (09:04 -0700)
commitb61dfa9bc4430ad82b96d3a7c1c485350f91b467
tree4d56b2eab76bc8205b61512a66192921079b9876
parentf2d18e16479cac7a708d77cbfb4220a9114a71fc
idpf: simplify and fix splitq Tx packet rollback error path

Move (and rename) the existing rollback logic to singleq.c since that
will be the only consumer. Create a simplified splitq specific rollback
function to loop through and unmap tx_bufs based on the completion tag.
This is critical before replacing the Tx buffer ring with the buffer
pool since the previous rollback indexing will not work to unmap the
chained buffers from the pool.

Cache the next_to_use index before any portion of the packet is put on
the descriptor ring. In case of an error, the rollback will bump tail to
the correct next_to_use value. Because the splitq path now supports
different types of context descriptors (and potentially multiple in the
future), this will take care of rolling back any and all context
descriptors encoded on the ring for the erroneous packet. The previous
rollback logic was broken for PTP packets since it would not account for
the PTP context descriptor.

Fixes: 1a49cf814fe1 ("idpf: add Tx timestamp flows")
Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
drivers/net/ethernet/intel/idpf/idpf_txrx.c
drivers/net/ethernet/intel/idpf/idpf_txrx.h