git: 65349af4422f - main - iflib: clear the deferred TX descriptor state when a queue is stopped

Alexander Leidinger <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by netchild:

URL: https://cgit.FreeBSD.org/src/commit/?id=65349af4422ffffe40850168c5feb808d43ad06d

commit 65349af4422ffffe40850168c5feb808d43ad06d
Author:     Alexander Leidinger <[email protected]>
AuthorDate: 2026-08-04 16:44:54 +0000
Commit:     Alexander Leidinger <[email protected]>
CommitDate: 2026-08-04 17:14:58 +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.
    
    MFC after:      1 week
    Assisted-by:    Claude Code (Opus 5)
---
 sys/net/iflib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index f865f2414281..63455fb46d70 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -2701,6 +2701,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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.