Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Mar 2026 01:29:57 +0000
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Christos Longros <chris.longros@gmail.com>
Subject:   git: 930a790c2abb - main - rge: make rx_process_limit a sysctl tunable
Message-ID:  <69c33a95.192a0.4d7236e0@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=930a790c2abb3680a3449a1f9ce2eff2be7acc36

commit 930a790c2abb3680a3449a1f9ce2eff2be7acc36
Author:     Christos Longros <chris.longros@gmail.com>
AuthorDate: 2026-03-25 01:27:14 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-03-25 01:27:14 +0000

    rge: make rx_process_limit a sysctl tunable
    
    The number of packets processed per interrupt was hardcoded to 16.
    Add a per-interface sysctl dev.rge.%d.rx_process_limit tunable so
    users can adjust this value at runtime.
    
    Signed-off-by: Christos Longros <chris.longros@gmail.com>
    
    Reviewed by:    ziaee, adrian
    Differential Revision:  https://reviews.freebsd.org/D56014
---
 share/man/man4/rge.4        | 5 +++++
 sys/dev/rge/if_rge.c        | 3 ++-
 sys/dev/rge/if_rge_sysctl.c | 5 +++++
 sys/dev/rge/if_rgevar.h     | 2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/share/man/man4/rge.4 b/share/man/man4/rge.4
index eea49e12af78..2b781e287e3c 100644
--- a/share/man/man4/rge.4
+++ b/share/man/man4/rge.4
@@ -147,6 +147,11 @@ tunables:
 .Bl -tag -width "xxxxxx"
 .It Va dev.rge.%d.debug
 Configure runtime debug output.  This is a 32 bit bitmask.
+.It Va dev.rge.%d.rx_process_limit
+Maximum number of RX packets to process per interrupt.
+The default value is 16.
+Increasing this value may improve throughput on high-speed links at the
+cost of increased interrupt latency.
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
diff --git a/sys/dev/rge/if_rge.c b/sys/dev/rge/if_rge.c
index 5ae0b98f95a1..0007b07e0fa6 100644
--- a/sys/dev/rge/if_rge.c
+++ b/sys/dev/rge/if_rge.c
@@ -2099,9 +2099,10 @@ rge_rxeof(struct rge_queues *q, struct mbufq *mq)
 	uint32_t rxstat, extsts;
 	int i, mlen, rx = 0;
 	int cons, prod;
-	int maxpkt = 16; /* XXX TODO: make this a tunable */
+	int maxpkt;
 	bool check_hwcsum;
 
+	maxpkt = sc->sc_rx_process_limit;
 	check_hwcsum = ((if_getcapenable(sc->sc_ifp) & IFCAP_RXCSUM) != 0);
 
 	RGE_ASSERT_LOCKED(sc);
diff --git a/sys/dev/rge/if_rge_sysctl.c b/sys/dev/rge/if_rge_sysctl.c
index a7d6e1572168..16001b4c1d94 100644
--- a/sys/dev/rge/if_rge_sysctl.c
+++ b/sys/dev/rge/if_rge_sysctl.c
@@ -232,6 +232,11 @@ rge_sysctl_attach(struct rge_softc *sc)
 	    "debug", CTLFLAG_RW, &sc->sc_debug, 0,
 	    "control debugging printfs");
 
+	sc->sc_rx_process_limit = 16;
+	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+	    "rx_process_limit", CTLFLAG_RW, &sc->sc_rx_process_limit, 0,
+	    "max number of RX packets to process per interrupt");
+
 	/* Stats */
 	rge_sysctl_drv_stats_attach(sc);
 	rge_sysctl_mac_stats_attach(sc);
diff --git a/sys/dev/rge/if_rgevar.h b/sys/dev/rge/if_rgevar.h
index d516537e6524..89d02e8acb72 100644
--- a/sys/dev/rge/if_rgevar.h
+++ b/sys/dev/rge/if_rgevar.h
@@ -204,6 +204,8 @@ struct rge_softc {
 
 	uint32_t		sc_debug;
 
+	int			sc_rx_process_limit;
+
 	struct rge_drv_stats	sc_drv_stats;
 
 	struct rge_mac_stats	sc_mac_stats;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c33a95.192a0.4d7236e0>