The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=29fcb8556681a8920d6b61ade35e4d1a238ea443
commit 29fcb8556681a8920d6b61ade35e4d1a238ea443 Author: Andrew Gallatin <[email protected]> AuthorDate: 2026-09-16 16:08:17 +0000 Commit: Andrew Gallatin <[email protected]> CommitDate: 2026-09-16 17:11:19 +0000 iflib: add a new global tunable "prefer_mpring" net.iflib.prefer_mpring can be used to control whether or not all iflib driver instances default to mp_ring or simple_tx. This is intended to be temporary, to allow easy testing (now) of simple_tx, and to allow an easy fallback to the legacy path (later) once the default is switched to simple_tx --- share/man/man4/iflib.4 | 17 +++++++++++++++-- sys/net/iflib.c | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/share/man/man4/iflib.4 b/share/man/man4/iflib.4 index ca1b7918412e..2a752871d9a8 100644 --- a/share/man/man4/iflib.4 +++ b/share/man/man4/iflib.4 @@ -1,4 +1,4 @@ -.Dd September 14, 2026 +.Dd September 16, 2026 .Dt IFLIB 4 .Os .Sh NAME @@ -79,7 +79,9 @@ resource contention is not a problem (well behaved applications on systems where there are as many NIC queues as CPU cores). Note that when this is enabled, the tx_abdicate sysctl is no longer applicable and is ignored. -Defaults to zero. +By default, this is the inverse of +.Va net.iflib.prefer_mpring . +An explicitly configured value takes precedence over that global default. .El .Pp These @@ -144,6 +146,17 @@ Some NICs allow processing completed transmit descriptors in batches. Doing so usually increases the transmit throughput by reducing the number of transmit interrupts. Setting this to a non-zero value will disable the use of this feature. +.It Va net.iflib.prefer_mpring +When set, use the +.Va mp_ring +transmit path by default instead of the simple transmit path. +This is a read-only tunable that must be set before +.Nm +is loaded. +An explicitly configured per-device +.Va simple_tx +value takes precedence. +The default is one. .It Va net.iflib.simple_drain_quota Sets the maximum number of packets that the transmit task may remove from a simple transmit deferral ring in one drain operation. diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 2257e64a5a8e..1c43792c9857 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -704,6 +704,10 @@ static int iflib_simple_txbr_size = IFLIB_SIMPLE_TXBR_SIZE; SYSCTL_INT(_net_iflib, OID_AUTO, simple_txbr_size, CTLFLAG_RDTUN, &iflib_simple_txbr_size, 0, "number of entries in the simple tx deferral ring"); +static bool iflib_prefer_mpring = true; +SYSCTL_BOOL(_net_iflib, OID_AUTO, prefer_mpring, CTLFLAG_RDTUN, + &iflib_prefer_mpring, 0, + "prefer the mp_ring transmit path by default"); static u_int iflib_simple_drain_quota = 8; SYSCTL_UINT(_net_iflib, OID_AUTO, simple_drain_quota, CTLFLAG_RWTUN, &iflib_simple_drain_quota, 0, @@ -7641,6 +7645,7 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) "tx_watchdog_events", CTLFLAG_RD, &ctx->ifc_tx_watchdog_events, 0, "TX watchdog resets initiated by iflib"); + ctx->ifc_sysctl_simple_tx = !iflib_prefer_mpring; SYSCTL_ADD_BOOL(&ctx->ifc_sysctl_ctx, oid_list, OID_AUTO, "simple_tx", CTLFLAG_RDTUN, &ctx->ifc_sysctl_simple_tx, 0, "use simple tx ring");
