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
[28 lines not shown]
vtnet: offer VIRTIO_NET_F_GUEST_CSUM
Always offer the VIRTIO_NET_F_GUEST_CSUM feature to the host, and not
only if RXCSUM is enabled on vtnet. Instead of using RXCSUM to control
whether this feature will be negotiated with the host, just use it to
control whether the VIRTIO_NET_HDR_F_DATA_VALID flag on an incoming
packet is processed (i.e., translated to the corresponding mbuf flag
only if RXCSUM is enabled on the vtnet interface).
This has two benefits:
1. Enabling/disabling RXCSUM on vtnet does not require feature
renegotiation.
2. The host is always allowed to send locally generated TCP or UDP
packets to the guest without computing a full checksum (by setting
the VIRTIO_NET_HDR_F_NEEDS_CSUM flag) and not only if the guest has
enabled RXCSUM on vtnet. Since locally generated packets do not
require a checksum, this saves otherwise unnecessarily wasted
computing power.
If a user of a FreeBSD guest really does not want to negotiate the
VIRTIO_NET_F_GUEST_CSUM feature with the host, it still can disable
[6 lines not shown]
linuxkpi: Add x86 CPU ID matching functions and macros
There are two parts that go together:
* `X86_MATCH_VFM()` to declare a matching pattern
* `x86_match_cpu()` to check if the current CPU matches one of the
patterns in an array.
The i915 DRM driver started to use this in Linux 6.14.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57700
UPDATING: bump __FreeBSD_version to 1600026 for LinuxKPI changes
The size of multiple embedded structs have changed and may lead to
problems (pci_error_handlers in pci_driver, dev_pm_info in struct device).
Allow these changes to be detected by bumping __FreeBSD_version.
MFC after: 3 days
Revert "linuxkpi: Add device under parent, not under class"
This reverts commit fc0a5ae094308609927e9c355928d08923278325.
This changed the sysctl node path and broke IB user space tools (ibv_*).
PR: 298485
Reported by: Ariel Ehrenberg (aehrenberg nvidia.com)
LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()
Add the missing locking to another two MO driver downcalls, as drivers
always expect it (e.g. rtw89 by assertion).
Add the lock and might_sleep assertions to the respective lkpi_80211_mo_*
downcalls.
PR: 298417
Reviewed by: bz
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D59608
LinuxKPI: add can_wakeup option and accessor functions
We can implement device_set_wakeup_capable() in the !CONFIG_PM_SLEEP
case; we do not have the infrastructure in place for the CONFIG_PM_SLEEP
case so leave a pr_debug TODO.
Needed by an upcoming wireless driver.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58883
LinuxKPI: fix argument type to lkpi_pci_msi_desc_alloc()
lkpi_pci_msi_desc_alloc() takes an unsigned int, not an int.
While here make sure the prototype is visibile in interrupt.h as
well before use to avoid -Wimplicit-function-declaration errors.
Discovered while working on a wireless driver.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58879
LinuxKPI: implement dma_{alloc,free}_{noncoherent,attrs}
We use one to implement the other given direction stays unused.
This is needed by an upcoming wifi driver.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58880
LinuxKPI: add PCI_IRQ_AFFINITY #define
Add the #define for PCI_IRQ_AFFINITY and leave a pr_debug note in
pci_alloc_irq_vectors() that it is unimplemented.
The flag is needed by an upcoming WiFi driver.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58881
LinuxKPI: add #include of rculist.h to ethtool.h for Linux conformance
Add #include rculist.h to ethtool.h to fullfill expectations of
Linux drivers without having to modify them.
MFC after: 3 days
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D58874
LinuxKPI: pci: add pci_select_bars() and pci_msix_vec_count()
For pci_select_bars() we use the LinuxKPI internal information, while
for pci_select_bars() we fall back to the native PCI stack.
Needed by a wifi driver.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58878
LinuxKPI: add typedef for clockid_t
Needed by a wireless driver (not really using it) to compile.
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58877
LinuxKPI: rcu: add optional condition to list_for_each_entry_rcu()
list_for_each_entry_rcu() can take an optional condition. Add the
macro argument so code remains compiling but do not do anything with
it just yet.
Leave comments as list_for_each_entry_rcu() likely should have a
different implementation.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D59292
thunderbolt: Change len from int to size_t in router_prepare_{read,write}()
Suggested by: ngie
Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59668
thunderbolt: Factor out router_prepare_cmd()
Common code between router_prepare_read() & router_prepare_write().
Eventually will be used by other commands (e.g. hotplugging) aswell.
Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59668
thunderbolt: Support writing to router config space
Reviewed by: adrian, ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49452
rangelock: Enable rl_q_owner tracking under INVARIANT_SUPPORT
This fixes the build for kernels with INVARIANT_SUPPORT but without
INVARIANTS.
Fixes: 2e376cca379b ("rangelock: Reimplement _rangelock_cookie_assert()")
dtrace/tests: compile D sources at runtime on test target
Previously, we would precompile D test dependencies using the
host's dtrace, which unconditionally outputs ELF files in the
host's format. This breaks the cross-compile build with errors
like the following:
dtrace: failed to link script: incorrect ELF machine type for
object file: tst.usdt.pieo
--- usdt.o ---
*** Failed target: usdt.o
This patch moves compilation to runtime for all C-based testcases
that have a dependent D source file.
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59030
[2 lines not shown]
lib/googletest: also use -O0 for internal tests with GCC
This fixes the build with gcc 16's aggressive inlining.
Reviewed by: ngie
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59538
(cherry picked from commit 243bdaff75853606ce477807e87e4fbcc1decfb1)
tests/fusefs: fix the build with gcc 16
Reviewed by: asomers
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0e3dae1ca8fc371eb5c451032adc5e0813b00db6)