RE: [RFC PATCH 27/27] net/intel: remove index for tracking end of packet

Morten Brørup
2025-12-20T09:05:50Z

> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Friday, 19 December 2025 18.26
>
> The last_id value in each tx_sw_queue entry was no longer used in the
> datapath, remove it and its initialization. For the function releasing
> packets back, rather than relying on "last_id" to identify end of
> packet, instead check for the next pointer being NULL.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

[...]

> @@ -2523,14 +2523,13 @@ i40e_tx_done_cleanup_full(struct ci_tx_queue
> *txq,
> pkt_cnt < free_cnt &&
> tx_id != tx_last; i++) {
> if (swr_ring[tx_id].mbuf != NULL) {
> - rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
> - swr_ring[tx_id].mbuf = NULL;
> -
> /*
> * last segment in the packet,
> * increment packet count
> */
> - pkt_cnt += (swr_ring[tx_id].last_id == tx_id);
> + pkt_cnt += (swr_ring[tx_id].mbuf->next == NULL)
> ? 1 : 0;

Note to reviewers:
Dereferencing the mbuf (instead of checking last_id) does not add a potential cache miss, because rte_pktmbuf_free_seg() dereferences it anyway.

> + rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
> + swr_ring[tx_id].mbuf = NULL;
> }
>
> tx_id = swr_ring[tx_id].next_id;