git: 927151737725 - main - ixl/iavf: Start the head write-back completion index at the head

From: R. Christian McDonald <rcm_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 14:30:53 UTC
The branch main has been updated by rcm:

URL: https://cgit.FreeBSD.org/src/commit/?id=927151737725e88b050bfcae17f8a38448869aa8

commit 927151737725e88b050bfcae17f8a38448869aa8
Author:     R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-11-23 14:29:06 +0000
Commit:     R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-11-23 14:30:48 +0000

    ixl/iavf: Start the head write-back completion index at the head
    
    With head write-back, tx_cidx_processed holds the head value that the
    credits update consumed last: the index of the next descriptor to
    complete.  With the Report Status queue it is the index of the last
    completed descriptor.  088a0b27adb4 made both start at the last
    descriptor of the ring, which is right for the Report Status queue
    only.  With head write-back, the default in ixl(4), the first credits
    update after every initialization reports a completed descriptor that
    was never sent.
    
    iflib's own reclaim holds back isc_tx_nsegments descriptors and does
    not notice.  netmap uses the count as it is: iflib_netmap_txsync()
    puts the tail of its ring one slot too far.  Once the card has sent
    everything, the tail meets the head, which netmap reads as a ring
    without a free slot, and no completion is left that would move it.
    The ring never transmits again: pkt-gen at full rate stops after a few
    thousand packets, and a ring that one pkt-gen has used cannot be used
    by the next.
    
    The workaround has been hw.ixl.enable_head_writeback=0.
    
    Start at the head of the cleared ring, as before that change.  iavf(4)
    has a copy of the code and gets the same change.
    
    PR:                     255671
    Reviewed by:            kgalazka
    Fixes:                  088a0b27adb4 ("intel iflib drivers: correct...")
    MFC after:              1 week
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D61715
---
 sys/dev/iavf/if_iavf_iflib.c | 4 ++--
 sys/dev/ixl/ixl_txrx.c       | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c
index 4f908a8d9a7b..e9be44046175 100644
--- a/sys/dev/iavf/if_iavf_iflib.c
+++ b/sys/dev/iavf/if_iavf_iflib.c
@@ -2539,14 +2539,14 @@ iavf_init_tx_rsqs(struct iavf_vsi *vsi)
 void
 iavf_init_tx_cidx(struct iavf_vsi *vsi)
 {
-	if_softc_ctx_t scctx = vsi->shared;
 	struct iavf_tx_queue *tx_que;
 	int i;
 
 	for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) {
 		struct tx_ring *txr = &tx_que->txr;
 
-		txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1;
+		/* Next descriptor to complete (the head), not the last one. */
+		txr->tx_cidx_processed = 0;
 	}
 }
 
diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c
index 7ce1c24c814a..bd4f46b1e62a 100644
--- a/sys/dev/ixl/ixl_txrx.c
+++ b/sys/dev/ixl/ixl_txrx.c
@@ -795,14 +795,14 @@ ixl_init_tx_rsqs(struct ixl_vsi *vsi)
 void
 ixl_init_tx_cidx(struct ixl_vsi *vsi)
 {
-	if_softc_ctx_t scctx = vsi->shared;
 	struct ixl_tx_queue *tx_que;
 	int i;
-	
+
 	for (i = 0, tx_que = vsi->tx_queues; i < vsi->num_tx_queues; i++, tx_que++) {
 		struct tx_ring *txr = &tx_que->txr;
 
-		txr->tx_cidx_processed = scctx->isc_ntxd[0] - 1;
+		/* Next descriptor to complete (the head), not the last one. */
+		txr->tx_cidx_processed = 0;
 	}
 }