Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2026 17:35:05 +0000
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 52e7958702be - main - iflib: ignore reclaim coalescing when low on tx descriptors
Message-ID:  <69e26f49.329ea.298f2de3@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by gallatin:

URL: https://cgit.FreeBSD.org/src/commit/?id=52e7958702be469a61a5e3173c20a08fc0721b4d

commit 52e7958702be469a61a5e3173c20a08fc0721b4d
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2026-04-17 15:52:36 +0000
Commit:     Andrew Gallatin <gallatin@FreeBSD.org>
CommitDate: 2026-04-17 17:34:27 +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
---
 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 b58544255efd..085b69b62553 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -703,6 +703,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);
@@ -3600,7 +3601,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);
@@ -3789,6 +3790,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)
 {


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e26f49.329ea.298f2de3>