FreeBSD/src 7e2a425share/man/man4 iflib.4, sys/net iflib.c

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]
DeltaFile
+570-39sys/net/iflib.c
+48-3share/man/man4/iflib.4
+618-422 files

FreeBSD/src c1fa70csys/dev/virtio/network if_vtnet.c

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]
DeltaFile
+42-47sys/dev/virtio/network/if_vtnet.c
+42-471 files

FreeBSD/src 5fb3aeasys/compat/linuxkpi/common/include/asm cpu_device_id.h, sys/compat/linuxkpi/common/include/linux bits.h mod_devicetable.h

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
DeltaFile
+37-0sys/compat/linuxkpi/common/src/linux_compat.c
+25-0sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
+17-0sys/compat/linuxkpi/common/include/linux/mod_devicetable.h
+2-0sys/compat/linuxkpi/common/include/linux/bits.h
+81-04 files

FreeBSD/src e1ad124. UPDATING, sys/sys param.h

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
DeltaFile
+6-0UPDATING
+1-1sys/sys/param.h
+7-12 files

FreeBSD/src b0094b5sys/compat/linuxkpi/common/include/linux device.h

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)
DeltaFile
+6-4sys/compat/linuxkpi/common/include/linux/device.h
+6-41 files

FreeBSD/src 73166d2sys/compat/linuxkpi/common/src linux_80211.c linux_80211_macops.c

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
DeltaFile
+6-0sys/compat/linuxkpi/common/src/linux_80211_macops.c
+2-0sys/compat/linuxkpi/common/src/linux_80211.c
+8-02 files

FreeBSD/src a424fb3sys/compat/linuxkpi/common/include/linux pm.h, sys/compat/linuxkpi/common/src linux_compat.c

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
DeltaFile
+17-0sys/compat/linuxkpi/common/include/linux/pm.h
+6-0sys/compat/linuxkpi/common/src/linux_compat.c
+23-02 files

FreeBSD/src cfb23b0sys/compat/linuxkpi/common/include/linux interrupt.h pci.h, sys/compat/linuxkpi/common/src linux_pci.c

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
DeltaFile
+2-1sys/compat/linuxkpi/common/include/linux/pci.h
+1-1sys/compat/linuxkpi/common/src/linux_pci.c
+1-0sys/compat/linuxkpi/common/include/linux/interrupt.h
+4-23 files

FreeBSD/src c3fa17asys/compat/linuxkpi/common/include/linux dma-mapping.h, sys/compat/linuxkpi/common/src linux_pci.c

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
DeltaFile
+50-0sys/compat/linuxkpi/common/src/linux_pci.c
+36-0sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+86-02 files

FreeBSD/src c40219csys/compat/linuxkpi/common/include/linux pci.h

LinuxKPI: pci: add reset_{prepare,done} to pci_error_handlers

Needed by an upcoming wireless driver.

MFC after:      3 days
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58882
DeltaFile
+2-0sys/compat/linuxkpi/common/include/linux/pci.h
+2-01 files

FreeBSD/src b589e40sys/compat/linuxkpi/common/include/linux pci.h, sys/compat/linuxkpi/common/src linux_pci.c

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
DeltaFile
+3-0sys/compat/linuxkpi/common/src/linux_pci.c
+1-0sys/compat/linuxkpi/common/include/linux/pci.h
+4-02 files

FreeBSD/src 4570a1bsys/compat/linuxkpi/common/include/linux ethtool.h

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
DeltaFile
+2-1sys/compat/linuxkpi/common/include/linux/ethtool.h
+2-11 files

FreeBSD/src 55c07afsys/compat/linuxkpi/common/include/linux pci.h

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
DeltaFile
+29-0sys/compat/linuxkpi/common/include/linux/pci.h
+29-01 files

FreeBSD/src 401d092sys/compat/linuxkpi/common/include/linux types.h

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
DeltaFile
+2-0sys/compat/linuxkpi/common/include/linux/types.h
+2-01 files

FreeBSD/src e975ce8sys/compat/linuxkpi/common/include/linux rculist.h

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
DeltaFile
+4-2sys/compat/linuxkpi/common/include/linux/rculist.h
+4-21 files

FreeBSD/src a5dc51ausr.bin/truss/tests truss_test.sh

tests/truss: xfail accepted ABIs test if linux(4) not implemented

Split accepted ABIs test into separate case and conditionally
xfail it on archs that don't have linux(4) support.

This fixes a CI test failure[0].

[0] https://ci.freebsd.org/job/FreeBSD-main-riscv64-test/16706/testReport/usr.bin.truss/truss_test/unknown_syscall/

Reviewed by:    dteske
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59594
DeltaFile
+31-7usr.bin/truss/tests/truss_test.sh
+31-71 files

FreeBSD/src 44b7382sys/dev/thunderbolt router.c

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
DeltaFile
+4-4sys/dev/thunderbolt/router.c
+4-41 files

FreeBSD/src 808c82dsys/dev/thunderbolt router.c

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
DeltaFile
+19-35sys/dev/thunderbolt/router.c
+19-351 files

FreeBSD/src 9c6e9bfsys/dev/thunderbolt router.c

thunderbolt: Support writing to router config space

Reviewed by:    adrian, ngie
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49452
DeltaFile
+96-1sys/dev/thunderbolt/router.c
+96-11 files

FreeBSD/src bcd1e7asys/kern kern_rangelock.c

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()")
DeltaFile
+5-5sys/kern/kern_rangelock.c
+5-51 files

FreeBSD/src c4f32e7sys/dev/qcom_ess_edma qcom_ess_edma_var.h qcom_ess_edma_tx.h, sys/dev/xen/pcifront pcifront.c

Trim various $FreeBSD$ that have snuck back in since the mass removal

Sponsored by:   Chelsio Communications
DeltaFile
+0-3sys/dev/xen/pcifront/pcifront.c
+0-3sys/dev/qcom_ess_edma/qcom_ess_edma_var.h
+0-3sys/dev/qcom_ess_edma/qcom_ess_edma_tx.h
+0-3sys/dev/qcom_ess_edma/qcom_ess_edma_tx.c
+0-3sys/dev/qcom_ess_edma/qcom_ess_edma_rx.h
+0-3sys/dev/qcom_ess_edma/qcom_ess_edma_rx.c
+0-1839 files not shown
+0-11445 files

FreeBSD/src 354069bcddl/usr.sbin/dtrace/tests dtrace.test.mk, cddl/usr.sbin/dtrace/tests/amd64/arrays Makefile

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]
DeltaFile
+23-1cddl/usr.sbin/dtrace/tests/tools/dtest.sh
+10-8cddl/usr.sbin/dtrace/tests/dtrace.test.mk
+3-1cddl/usr.sbin/dtrace/tests/common/arrays/Makefile
+3-1cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile
+3-1cddl/usr.sbin/dtrace/tests/common/aggs/Makefile
+3-1cddl/usr.sbin/dtrace/tests/amd64/arrays/Makefile
+45-1387 files not shown
+306-10093 files

FreeBSD/src 73d67bclib/googletest/tests Makefile.inc

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)
DeltaFile
+3-3lib/googletest/tests/Makefile.inc
+3-31 files

FreeBSD/src 09f68adsbin/camcontrol persist.c

camcontrol: remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    ken, imp
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59540

(cherry picked from commit 076c9db51f95291f73c25b39a8c9c4206c050bc1)
DeltaFile
+2-3sbin/camcontrol/persist.c
+2-31 files

FreeBSD/src 6f7e47dsys/netinet sctp_usrreq.c

sctp: remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    tuexen
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59590

(cherry picked from commit b7e91f238c2f70e8432f56762499aebd0ab9960b)
DeltaFile
+2-5sys/netinet/sctp_usrreq.c
+2-51 files

FreeBSD/src f006552cddl/contrib/opensolaris/common/ctf ctf_hash.c

libctf: remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    markj
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59537

(cherry picked from commit 8e75ea59b085fb6dedfe5911481e6673a60b48fe)
DeltaFile
+1-2cddl/contrib/opensolaris/common/ctf/ctf_hash.c
+1-21 files

FreeBSD/src 63d78dfsys/netpfil/ipfilter/netinet ip_nat.c

ipfilter: remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    cy
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 94f7019668f8a02416c5b32ba8a9c32a68edd261)
DeltaFile
+3-4sys/netpfil/ipfilter/netinet/ip_nat.c
+3-41 files

FreeBSD/src c9213eftests/sys/fs/fusefs utils.cc Makefile

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)
DeltaFile
+7-0tests/sys/fs/fusefs/Makefile
+1-1tests/sys/fs/fusefs/utils.cc
+8-12 files

FreeBSD/src cf48fccsys/dev/cxgb cxgb_sge.c

cxgb(4): remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    np
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59545

(cherry picked from commit d5047ddeddab45923ff4870cf9a0e158619e3a30)
DeltaFile
+2-2sys/dev/cxgb/cxgb_sge.c
+2-21 files

FreeBSD/src 8362395sbin/fsck_msdosfs dir.c

fsck_msdosfs: remove unused variable

This fixes the build with gcc 16 after the changes
to -Wunused*[0].

[0] https://gcc.gnu.org/gcc-16/porting_to.html#changes-to-wunused

Reviewed by:    delphij
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59543

(cherry picked from commit fead44b3ed61a09c2a0c4f79537462e837067fce)
DeltaFile
+3-3sbin/fsck_msdosfs/dir.c
+3-31 files