git: 1e57a31b1195 - stable/15 - iflib: ignore reclaim coalescing when low on tx descriptors

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

URL: https://cgit.FreeBSD.org/src/commit/?id=1e57a31b11959ff0490027adb0fa146b6dd030d0

commit 1e57a31b11959ff0490027adb0fa146b6dd030d0
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2026-04-17 15:52:36 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 05:28:16 +0000

    iflib: ignore reclaim coalescing when low on tx descriptors
    
    If we are low on TX descriptors, bypass iflib_txq_can_reclaim()
    and force a reclaim. This is intended to reduce the number of
    output drops under heavy load when using simple transmit.
    
    Differential Revision: https://reviews.freebsd.org/D56339
    Sponsored by: Netflix
    
    (cherry picked from commit 52e7958702be469a61a5e3173c20a08fc0721b4d)
---
 sys/net/iflib.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 6be0c21edb7e..3bc762d919f0 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -769,6 +769,7 @@ static struct mbuf *iflib_fixup_rx(struct mbuf *m);
 #endif
 static __inline int iflib_completed_tx_reclaim(iflib_txq_t txq,
     struct mbuf **m_defer);
+static __inline void iflib_completed_tx_reclaim_force(iflib_txq_t txq);
 
 static SLIST_HEAD(cpu_offset_list, cpu_offset) cpu_offsets =
     SLIST_HEAD_INITIALIZER(cpu_offsets);
@@ -3739,7 +3740,7 @@ defrag:
 	 *        cxgb
 	 */
 	if (__predict_false(nsegs > TXQ_AVAIL(txq))) {
-		(void)iflib_completed_tx_reclaim(txq, NULL);
+		iflib_completed_tx_reclaim_force(txq);
 		if (__predict_false(nsegs > TXQ_AVAIL(txq))) {
 			txq->ift_no_desc_avail++;
 			bus_dmamap_unload(buf_tag, map);
@@ -3928,6 +3929,20 @@ iflib_completed_tx_reclaim(iflib_txq_t txq, struct mbuf **m_defer)
 	return (reclaim);
 }
 
+/*
+ * Reclaim any transmit descriptors possible, ignoring coalescing
+ */
+static __inline void
+iflib_completed_tx_reclaim_force(iflib_txq_t txq)
+{
+	int reclaim;
+
+	iflib_tx_credits_update(txq->ift_ctx, txq);
+	reclaim = DESC_RECLAIMABLE(txq);
+	if (reclaim != 0)
+		_iflib_completed_tx_reclaim(txq, NULL, reclaim);
+}
+
 static struct mbuf **
 _ring_peek_one(struct ifmp_ring *r, int cidx, int offset, int remaining)
 {