git: 7b80eaa41130 - stable/15 - iflib: clear the deferred TX descriptor state when a queue is stopped

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 06:03:09 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b80eaa41130ba111fd8469dd2e0268c647496c8

commit 7b80eaa41130ba111fd8469dd2e0268c647496c8
Author:     Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2026-08-04 16:44:54 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 05:28:17 +0000

    iflib: clear the deferred TX descriptor state when a queue is stopped
    
    Stopping an interface frees the queued mbufs and zeroes a transmit
    queue's descriptor accounting, but the three counters that track
    descriptors deferred to a later doorbell write or report-status
    request are not cleared there: they only reach zero when the code
    that acts on them runs.  After a reset they therefore describe
    descriptors that no longer exist, until enough new traffic flushes
    them.
    
    The consequences are small - one doorbell written from a stale
    count, and a report-status request on the first packet after the
    reset - but the state is simply wrong, and the transmit-hang check
    in iflib_timer() reads one of them.
    
    Assisted-by:    Claude Code (Opus 5)
    
    (cherry picked from commit 65349af4422ffffe40850168c5feb808d43ad06d)
---
 sys/net/iflib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 9e02cfa80325..05bec333e7c1 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -2827,6 +2827,8 @@ iflib_stop(if_ctx_t ctx)
 		txq->ift_outstanding_prev = 0;
 		txq->ift_wdog_armed = 0;
 		txq->ift_in_use = txq->ift_gen = txq->ift_no_desc_avail = 0;
+		txq->ift_npending = txq->ift_db_pending = 0;
+		txq->ift_rs_pending = 0;
 		if (sctx->isc_flags & IFLIB_PRESERVE_TX_INDICES)
 			txq->ift_cidx = txq->ift_pidx;
 		else