Andrew Gallatin 7e2a425f7e iflib: Use a bounded buf_ring for simple_tx
Implement buf_ring/drbr deferred transmit in iflib. This is intended
to allow the new simpler code path to replace mp_ring. This patch
makes the simple_tx outperform mp_ring by a wide margin when CPU is
the bottleneck (eg, cannot fill the NIC). See graphs at:
https://people.freebsd.org/~gallatin/mpring_vs_simple_tx

Note that the buf ring is used for contention, not capacity. Eg,
it is used as a place for contending threads to put packets without
waiting for a mutex. It is not designed to act as a software ring
on top of the hardware descriptors provided by the underlying NIC
driver. "stranded packets" are exceedingly rare due to the fact that
if there is enough load to use the buf_ring, there will probably be
more load coming that can be a drainer. Not scheduling a gtask to
drain is intentional, and we really on the timer as a fallback.

One thing I noticed while developing this patch is that a simple mutex
with no deferral generally outperformed both mp_ring and drbr at high
levels of contention for the same queue. This is inherent in a
bounded MPSC queue where multiple producers are contending on claiming
ring entries. So I came up with the idea of bounding the number of
producers such that the deferral ring would devolve to a mutex when
contention was high.

Identifying the crossover point in a general way was hard. On
different machines, the point between a mutex and a deferral ring was
very different and also depended on the placement of the producers. I
eventually realized that on the large AMD EPYC servers that I was
testing on, the crossover point generally coincided with the work
spilling into another CCX. So I developed an approach where we limit
the number of producers by limiting simultanious producers to the same
L3 AND by bounding the number of simultanious producers.

This limit can be adjusted via the sysctl net.iflib.max_producers.

The number of packets drained from the deferral ring is limited
by net.iflib.simple_drain_quota. The intent is to process just
enough packets in the gtaskq context so as to make space to
allow threads to make progress. The task also uses a trylock
so as to avoid blocking, waiting for a thread to drain.

This change also enables ALTQ support for simple tx.

Reviewed by: kbowling
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D58901
2026-09-14 16:18:40 -04:00
2026-09-14 14:37:46 +02:00
2026-09-13 18:09:38 -07:00
2026-07-27 07:01:21 -07:00
2026-09-07 00:54:04 -07:00
2026-07-07 08:47:36 +02:00
2026-09-13 14:27:50 +02:00
…
2026-03-07 00:51:15 -07:00
2026-08-11 14:29:44 +03:30
2026-08-25 21:25:22 -07:00
2026-01-01 00:29:23 +00:00
…
2026-07-07 08:47:40 +02:00
2026-07-07 08:47:40 +02:00
2026-07-07 08:47:40 +02:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

For official FreeBSD bootable images, see the release page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Source code for third-party software under the Common Development and Distribution License.
contrib Source code for third-party software.
crypto Source code for cryptographic libraries and commands (see crypto/README).
etc Template files for /etc.
include System include files.
kerberos5 Build system for Kerberos 5 (Heimdal).
krb5 Build system for Kerberos 5 (MIT).
lib System libraries.
libexec System commands intended to be executed by other commands or daemons.
packages Base system packages.
release Makefiles and scripts used for building releases and VM images.
rescue Build system for statically linked /rescue commands.
sbin System commands.
secure Build system for cryptographic libraries and commands (excluding Kerberos).
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Tests which can be run by Kyua. See tests/README for additional information.
tools Ancillary utilities and tests (not included in the build).
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.

S
Description
No description provided
Readme
4 GiB
0 Stars 1 Watchers 0 Forks
Languages
C 59.9%
C++ 26.8%
Roff 4.5%
Shell 2.8%
Assembly 1.7%
Other 3.7%