100 Commits
Author SHA1 Message Date
John Baldwin 19a5023e45 github: Only run the checklist checker for PRs against main
Currently this check is run on every push to stable branches which all
fail since they fail to fetch the non-existent .github/path-rules.txt
from the just-updated branches.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D60709
2026-10-17 11:24:23 -04:00
John Baldwin 9c8be6518e ctld: Fix namespace IDs for exported NVMe namespaces
NVMe namespace IDs are 1-based, but CTL LUN IDs are 0-based.  The
in-kernel NVMe ctl(4) target accounts for this by adding one to the
LUN ID to compute a namespace ID.  ctld was attempting to handle this
by translating namespace IDs from config files to internal LUN IDs,
but it did this incorrectly resulting in the namespace configured for
as namespace N actually showing up as namespace N + 1.

Fixes:		66b5296f1b ("ctld: Add support for NVMe over Fabrics")
Sponsored by:	Chelsio Communications
2026-10-08 11:24:45 -04:00
John Baldwin 3b0eacaed3 nvmf: Limit namespace character device I/O size
Set si_iosize_max for namespace character devices matching the fix
from commit 125ec0e307.

Sponsored by:	Chelsio Communications
2026-10-08 11:24:45 -04:00
John Baldwin 23be969c12 libsysdecode: Fix some cpp conditionals
While testing the bare values happens to work, the intent is to test
for their definition.

Reviewed by:	emaste
Fixes:		9a16bd169e ("libsysdecode: support errno and syscalls for arm64 Linux")
Fixes:		b69ae1a34c ("libsysdecode: Add preliminary support for decoding Linux syscalls")
Differential Revision:	https://reviews.freebsd.org/D60415
2026-10-08 11:21:06 -04:00
John Baldwin b40ba68a65 bhyve: Remove unneeded include of <machine/iodev.h>
This is a kernel-only header for /dev/io.  The user-facing header
defining the ioctl commands is <dev/io/iodev.h>.

Reviewed by:	bnovkov, imp
Differential Revision:	https://reviews.freebsd.org/D60399
2026-10-08 11:20:45 -04:00
John Baldwin 228dd4eaae sys: Enable pcfclock.ko on all architectures
This driver has been in sys/conf/NOTES (and thus enabled in LINT
builds on all architectures) since the file was renamed from the i386
LINT and there is no i386-specific code in the driver.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D60177
2026-10-08 11:20:21 -04:00
John Baldwin cb55ad8ff8 sendfile: Include opt_inet*.h
Pointy hat to:	jhb
Reported by:	markj
Fixes:		1d8c5f8e02 ("sendfile: Fix build for kernels without INET or INET6")
2026-10-08 11:19:25 -04:00
John Baldwin 1d8c5f8e02 sendfile: Fix build for kernels without INET or INET6
Don't cap the new low watermark to a TCP-specific setting in kernels
without TCP.

Fixes:		6948f4d5e2 ("sendfile: keep the lowat hack more conservative")
2026-10-05 22:35:15 -04:00
John Baldwin c907302c12 zstream: Downgrade -Watomic-alignment to a warning
Don't complain about unaligned atomic operations on i386.  This
same approach is already used for libspl.
2026-10-05 22:35:14 -04:00
John Baldwin 9cf774a577 cxgbe: Add a sysctl/tunable to control KTLS offload of AES-CBC cipher suites
Disable these by default as they are less efficient and rarely used.

Sponsored by:	Chelsio Communications
2026-09-30 16:50:12 -04:00
John Baldwin 1bc81d3bb0 cxgbe tls: Send final data as immediate when trailing waste is trimmed
When a request needs to drop data from the crypto output (via a split
mode request), send the last 16 bytes of input as immediate data
instead of via DSGL.  Requests with small payloads (16 bytes or fewer)
are now sent as immediate data only without any DSGL at all.

Sponsored by:	Chelsio Communications
2026-09-30 15:19:11 -04:00
John Baldwin 613e7ce43f cxgbe: Greatly simplify ktls_wr_len for T7
Don't try to fine-tune the WR size when estimating the work request
length when parsing the packet.  Use a much simpler worst-case
estimate that only depends on a few fields in the mbuf metadata.

Sponsored by:	Chelsio Communications
2026-09-30 15:19:11 -04:00
John Baldwin 6d587ff04b cxgbe: Don't cache nsegs for KTLS requests
KTLS mbufs are initially parsed when they are first enqueued to
estimate the number of transmit descriptors needed so that the mbuf is
queued until enough descriptors are available.  As part of this
estimate, the number of DSGL segments required by each KTLS mbuf is
calculated.  Originally, the count for the first TLS record in a chain
was cached in the header mbuf to avoid having to recalculate it when
writing out the actual work request for the first TLS record, but this
requires duplicating fairly complex logic both when parsing and
transmitting requests.

Sponsored by:	Chelsio Communications
2026-09-30 15:19:11 -04:00
John Baldwin 17126d54c4 cxgbe: Various assertions for lengths in KTLS work requests
The construction of KTLS work requests is quite fragile, and these
assertions ensure that the constructed work requests match the length
fields encoded in some of the WR structures.

Sponsored by:	Chelsio Communications
2026-09-30 15:19:11 -04:00
John Baldwin 1dd03aa321 cxgbe: Don't query mbuf_nsegs for header-only requests
Sponsored by:	Chelsio Communications
2026-09-30 15:19:11 -04:00
John Baldwin 878856b7a1 acpi: Remove support for /dev/apmctl and apmd(8) compatibility
This simplifies the logic around ACKing suspend requests as there is
no longer the potential for multiple listeners, only devd and the
acknowledgement via acpiconf -k.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D59942
2026-09-30 12:22:00 -04:00
John Baldwin 40ce54ccd9 apm(8): Remove support for APM BIOS
Drop support for queries and commands that are not supported by ACPI's
/dev/apm interface.  This includes dropping support for
enabling/disabling APM BIOS used by /etc/rc.d/apm.

Reviewed by:	ziaee, imp
Differential Revision:	https://reviews.freebsd.org/D59941
2026-09-30 12:21:45 -04:00
John Baldwin 8cf4fe39e8 acpi/apm: Store the ACPI softc in si_drv1
This avoids looking it up via a slower path in apmopen.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D59940
2026-09-30 12:21:34 -04:00
John Baldwin 1d7f0c7428 acpi/apm: Don't claim silent success for APMIO_BIOS ioctls
Report failure as if the request had failed.  This causes apm(8) to
correctly report the resume timer as "unknown" rather than random
garbage.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D59939
2026-09-30 12:21:16 -04:00
John Baldwin e10eb35d25 apm.4: Trim down to describing the compat interface exposed by acpi(4)
Reviewed by:	ziaee, imp
Differential Revision:	https://reviews.freebsd.org/D59938
2026-09-30 12:21:06 -04:00
John Baldwin 247503fedb apmd: Retire the APM daemon
The original purpose of this daemon was to route power management
requests to userspace, e.g. when the suspend button was pressed, the
APM driver posted an event read by apmd(8) that would invoke zzz(8) to
suspend.  However, on ACPI systems this is handled by devd(8) events
instead and running apmd(8) in addition just adds extra complexity.
This probably should have been axed when the APM BIOS support was
retired in commit 8c576a279e.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D59937
2026-09-30 12:20:02 -04:00
John Baldwin 34cf45a93c acpi_timer: Add a softc to avoid use of global variables
Add a softc and use it to mostly replace the use of global variables
in this driver.  Simplify the suspend and resume event handlers by
saving the old timecounter in the softc and passing the softc pointer
to the handlers.

Differential Revision:	https://reviews.freebsd.org/D59936
2026-09-30 12:04:59 -04:00
John Baldwin 381840e880 acpi_timer: Remove unneeded acpi_timer_freq global variable
This was just an alias of acpi_timer_timecounter.tc_frequency.  While
here, register the machdep.acpi_timer_freq sysctl node dynamically
only if the driver attaches rather than making the handler fail with
EOPNOTSUPP if the driver had not attached.

Differential Revision:	https://reviews.freebsd.org/D59935
2026-09-30 12:04:59 -04:00
John Baldwin 8d70bf332c acpi_timer: I/O resource cleanups
- Use bus_read_4 and remove explicit bus_space tag and handle

- Pass rid by value to bus_alloc_resource_any

Differential Revision:	https://reviews.freebsd.org/D59934
2026-09-30 12:04:59 -04:00
John Baldwin d23d186ff2 acpi_timer: Trim some more leftovers from the ACPI-safe timer
The "safe" variant of the hook to read the timer is no longer used and
can be removed.  Instead, initialize the get_timecount member of
acpi_timer_timecounter to the normal hook statically.  While here,
initialize a few more fields in acpi_timer_timecounter statically.
I've kept the name as just "ACPI" instead of "ACPI-fast" now.

During device probe there is no longer any reason to alloc the
register resource since it is not used, so remove all that.  While
here, defer registration of the timecounter until attach (kind of odd
to do such a thing during probe leaving a window where the timer
register was unallocated but in theory could still be read via the
timecounter).

Reviewed by:	cperciva
Fixes:		00d061855d ("Garbage-collect ACPI-safe timer and friends")
Differential Revision:	https://reviews.freebsd.org/D59933
2026-09-30 12:04:59 -04:00
John Baldwin ea392ed9b9 inotify: Move 'td' to the first argument of kern_inotify_*
This is consistent with other system call helpers.

Reviewed by:	markj
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D60173
2026-09-30 11:04:08 -04:00
John Baldwin c934939aa7 apm.8: Don't claim that zzz(8) invokes apm(8)
Fixes:		aba599a6cc ("zzz: Rewrite to use new power device")
2026-09-23 15:16:05 -04:00
John Baldwin 9cfc15bdfb ObsoleteFiles.inc: Add another entry for perfmon.4.gz
This was installed in two different places.
2026-09-23 15:15:28 -04:00
John Baldwin e702b1af00 sys: Remove orphaned build glue for le(4)
Fixes:		7a323f8736 ("sys: Retire le(4)")
2026-09-23 15:15:21 -04:00
John Baldwin 600c16c71b x86/NOTES: Drop stale comments about si(4)
This driver was removed several years ago.

Fixes:		c1c9764296 ("Remove the si(4) driver and sicontrol(8) for Specialix serial cards.")
2026-09-23 15:15:11 -04:00
John Baldwin df7b905568 dtrace: Remove bogus Makefile.inc
This was added in the initial import of dtrace and overrides the
normal load/unload targets with a custom target that loads a hardcoded
set of modules.  Over time, the set of modules has not been updated
and is now incomplete.  It's also not really useful compared to the
default implementation of these targets used for loading or unloading
an individual module being actively developed.

This functionality is also available via dtraceall.ko which is how
users commonly load the full suite of dtrace modules.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D59821
2026-09-23 15:13:22 -04:00
John Baldwin ed5fc8066f cxgbe: Use the correct GHASH offset for a GMAC from a full TLS record
If a TLS request transmits all but a part of the GMAC at the end of a
TLS record, the work request asks the crypto engine to return the
calculated GMAC to the driver so it can be sent in a simple TCP packet
when the rest of the TLS record is transmitted in the future.
However, the offset of the returned GHASH offset was calculated
incorrectly in this case causing the driver to not recognize the
cached GMAC and instead use a more wasteful work request in the future
that encrypted the entire TLS record discarding all but the needed
bytes of the trailer.

Note that this does not effect correctness, just efficiency.

Reviewed by:	np
Fixes:		9e269eafeb ("cxgbe: Use partial GCM mode for partial TLS records on T7")
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D59711
2026-09-16 15:56:20 -04:00
John Baldwin 05057380ca iw_cxgbe: Miscellaneous changes from the iw_cxgb4 driver
These include changes to use newer APIs, cosmetic changes to reduce
diffs between the two drivers, and other minor fixes.

Sponsored by:	Chelsio Communications
Co-authored-by:	Arjun V <[email protected]>
Co-authored-by:	Krishnamraju Eraparaju <[email protected]>
Co-authored-by:	Vishal Kulkarni <[email protected]>
2026-09-15 10:22:40 -04:00
John Baldwin 0d635085b8 cxgbe: Enable RDMA WRITE_CMPL work requests if the firmware supports them
This work request permits combining RDMA WRITE and SEND_INV commands
into a single work request.

Sponsored by:	Chelsio Communications
2026-09-15 10:22:39 -04:00
John Baldwin 2a580b30cf cxgbe: Query the ability to use RDMA WRITE_WITH_IMMEDIATE requests
Sponsored by:	Chelsio Communications
2026-09-15 10:22:38 -04:00
John Baldwin c957af2c21 iw_cxgbe/libcxgb4: Support 64B CQEs
The larger CQE exports the RSS header to userspace.  Note that this
changes the ABI between the driver and library, so the ABI version is
bumped.  A new user->kernel create_cq request message is defined to
disallow a CQE size mismatch between iw_cxgbe and libcxgb4.

Sponsored by:	Chelsio Communications
Co-authored-by:	Steve Wise <[email protected]>
2026-09-15 10:22:38 -04:00
John Baldwin bcd1e7a8ca rangelock: Enable rl_q_owner tracking under INVARIANT_SUPPORT
This fixes the build for kernels with INVARIANT_SUPPORT but without
INVARIANTS.

Fixes:		2e376cca37 ("rangelock: Reimplement _rangelock_cookie_assert()")
2026-09-14 11:33:12 -04:00
John Baldwin c4f32e7a35 Trim various $FreeBSD$ that have snuck back in since the mass removal
Sponsored by:	Chelsio Communications
2026-09-14 11:11:34 -04:00
John Baldwin 0ffad4ce56 bhyve: Tidy lobits handling in pci_passthru
- The lobits field in the "physical" BAR settings is never used, so
  don't bother setting it.

- Expand the comment explaining why the existing lobits are preserved
  (namely, to preserve the prefetch flag on memory BARs).

Reviewed by:	bnovkov
Differential Revision:	https://reviews.freebsd.org/D58894
2026-08-26 15:31:01 -04:00
John Baldwin b00bb87a61 bhyve: Refactor initial PCI BAR setup
Fully initialize BARs with an address of 0 in pci_emul_alloc_bar()
instead of deferring some of that initialization to
pci_emul_assign_bar().  Now, the latter is only used to allocate an
initial address range for PCI BARs.

Note that this means that the pci_passthru model now overrides the
initial lobits after they are set removing the need for a workaround
in pci_emul_assign_bar().

Reviewed by:	bnovkov
Differential Revision:	https://reviews.freebsd.org/D58893
2026-08-26 15:30:44 -04:00
John Baldwin 3807c8be46 bhyve: Don't set the prefetch flag for large 64-bit memory BARs
The only device model that can create a large 64-bit memory BAR is the
passthru device model, and that device model reuses the lobits of the
existing BAR explicitly.

Fixes:		e87a6f3ef2 ("bhyve: use physical lobits for BARs of passthru devices")
2026-08-26 15:30:37 -04:00
John Baldwin b29dc5a30c bhyve: Return void from pci_emul_alloc_bar
This function never fails.

Reviewed by:	bnovkov, chuck, markj
Differential Revision:	https://reviews.freebsd.org/D58579
2026-08-26 15:30:17 -04:00
John Baldwin 22293f8c54 release: Use "debug info" for lib32 set description
This mirrors the changes applied to kernel debug symbol sets in commit
9a354a41be.

Reviewed by:	emaste
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D59058
2026-08-26 15:01:39 -04:00
John Baldwin 82a3337952 pmc: Use isascii(3) to check if a character is ASCII
The previous check did not work on architectures where `char` is
unsigned as noted by GCC on aarch64:

usr.sbin/pmc/view.cc: In member function 'void pmcview::loadsymboltable(image*, Elf*, Elf_Scn*, GElf_Shdr*)':
usr.sbin/pmc/view.cc:627:38: error: comparison is always false due to limited range of data type [-Werror=type-limits]
  627 |                         if (fname[i] < 0) {
      |                             ~~~~~~~~~^~~

Reported by:	GCC 15
2026-08-21 16:56:05 -04:00
John Baldwin 850203655b thunderbolt: Fix v2.0 reset to reliably wait for the reset to finish
The `reg` value was never initialized, so the loop could potentially
abort without a single read of the register.  This was found by the
following warning from GCC:

sys/dev/thunderbolt/nhi.c: In function 'nhi_reset_v2':
sys/dev/thunderbolt/nhi.c:272:35: error: 'reg' is used uninitialized [-Werror=uninitialized]
  272 |         for (size_t i = 0; i < 10 && reg; i++) {
      |                                   ^~
sys/dev/thunderbolt/nhi.c:257:18: note: 'reg' was declared here
  257 |         uint32_t reg;
      |                  ^~~

Reported by:	GCC 15
Fixes:		efdb824139 ("thunderbolt: Reset controllers")
2026-08-20 15:49:36 -04:00
John Baldwin 78bbe9fc3e pmc: Use distinct names for arguments to the pmc_config constructor
This pacifies shadow warnings from GCC:

usr.sbin/pmc/cmd_pmc_record.cc: In constructor 'pmc_config::pmc_config(const std::__1::string&, uint64_t, cpuset_t)':
usr.sbin/pmc/cmd_pmc_record.cc:96:71: error: declaration of 'cpumask' shadows a member of 'pmc_config' [-Werror=shadow]
   96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
      |                                                              ~~~~~~~~~^~~~~~~
usr.sbin/pmc/cmd_pmc_record.cc:90:25: note: shadowed declaration is here
   90 |         cpuset_t        cpumask;
      |                         ^~~~~~~
usr.sbin/pmc/cmd_pmc_record.cc:96:55: error: declaration of 'count' shadows a member of 'pmc_config' [-Werror=shadow]
   96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
      |                                              ~~~~~~~~~^~~~~
usr.sbin/pmc/cmd_pmc_record.cc:89:25: note: shadowed declaration is here
   89 |         uint64_t        count;
      |                         ^~~~~
usr.sbin/pmc/cmd_pmc_record.cc:96:39: error: declaration of 'event' shadows a member of 'pmc_config' [-Werror=shadow]
   96 |         pmc_config(const std::string &event, uint64_t count, cpuset_t cpumask)
      |                    ~~~~~~~~~~~~~~~~~~~^~~~~
usr.sbin/pmc/cmd_pmc_record.cc:88:25: note: shadowed declaration is here
   88 |         std::string     event;
      |                         ^~~~~

Reported by:	GCC 15
Fixes:		a79a051e7d ("pmc: pmc record command")
2026-08-20 15:49:36 -04:00
John Baldwin 01c0ddf44a exterr: Fix build with GCC on 32-bit architectures
Use an intermediate uintptr_t cast to avoid casting a uint64_t value
directly to void * on 32-bit platforms (including lib32 builds).

lib/libc/gen/uexterr_format.c: In function 'uexterr_format_msg':
lib/libc/gen/uexterr_format.c:248:35: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  248 |                         PFMT(fmt, (void *)ARG(nextarg));
      |                                   ^
lib/libc/gen/uexterr_format.c:144:47: note: in definition of macro 'PFMT'
  144 |                 psz = snprintf(buf, bufsz, f, a);                       \
      |                                               ^

Reported by:	GCC 15
Fixes:		2f024a7cfd ("exterr: relax format restrictions")
2026-08-20 15:49:36 -04:00
John Baldwin 6c41d1e266 libcxgb4: Use t4fw_interface.h from the cxgbe driver sources
In Linux these are maintained in separate places so a separate copy is
needed, but in FreeBSD take advantage of the shared tree to avoid
having a duplicate copy that can be stale.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D58575
2026-08-13 13:02:17 -04:00
John Baldwin ec8985a100 rtld: Remove a stale #ifdef PIC
rtld has always been built PIC since commit
7ca8e6a670.  The stale #ifdef might
confuse a reader by thinking rtld can be built as non-PIC.

Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D58623
2026-08-13 13:02:17 -04:00
John Baldwin f7e7fab7ba linuxkpi: Add xa_insert_irq wrapper
This just invokes xa_insert similar to other xa_*_irq wrappers.

Reviewed by:	bz
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D58576
2026-07-31 14:00:38 -04:00
John Baldwin c7400fe1df stand: Reject ELF files with PT_LOAD segments where filesz > memsz
Reviewed by:	jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D58543
2026-07-31 13:52:56 -04:00
John Baldwin 486dfbb67e kld: Reject kernel modules with PT_LOAD segments where filesz > memsz
All sorts of places in the ELF loading code assume that filesz <=
memsz, so check that explicitly up front.

Reported by:	Jane Smith <[email protected]> (via D57785)
Reviewed by:	jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D58542
2026-07-31 13:52:42 -04:00
John Baldwin b9eaf9b7ce libc: Reject static ELF exectables with PT_TLS segments were filesz > memsz
Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D58558
2026-07-31 13:52:34 -04:00
John Baldwin 535eb24d84 rtld: Reject ELF files with PT_LOAD or PT_TLS segments where filesz > memsz
All sorts of places in the ELF loading code assume that filesz <=
memsz, so check that explicitly up front.  The kernel already performs
this check for the PT_LOAD segments in the main binary and rtld in
imgact_elf.c.

Reviewed by:	jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D58541
2026-07-31 13:52:24 -04:00
John Baldwin 80ee17c028 stand: Improve error handling when loading ELF files
Previously all the 'goto out' statements after the image was loaded into
memory returned success rather than an error.  This is despite comments
indicating some of these conditions were in fact errors, and some of
these error conditions (such as missing PT_DYNAMIC) are treated as errors
in the kernel linker.

In addition, when failing to looking up the symbols for the linker
set, those cases returned failure leaking memory (though it's clear
from the original code from commit ca49b3342d that only the second
failure was intended to be an actual error).

To avoid more confusion, move the assignment of `ret` to just before
the `out` label so that `goto out` always returns an error.  This is a
more consistent pattern with other code in the tree that tends to use
labels for the error case.

Restructure some other code to avoid a few bogus errors.
Specifically, a symbol table is not required so don't treat lack of a
symbol table as an error.  Also, if the start symbol for the module
metadata linker set is not found, don't treat that as an error either.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D58540
2026-07-31 13:51:37 -04:00
John Baldwin 8aec309852 stand: Remove a pointless goto
Commit 505222d35f removed a batch of code that this goto used to skip
around.

Reviewed by:	olce, kib, markj
Fixes:		505222d35f ("Implement the long-awaited module->file cache database.  A userland tool (kldxref(8)) keeps a cache of what modules and versions are inside what .ko files.  I have tested this on both Alpha and i386.")
Differential Revision:	https://reviews.freebsd.org/D58539
2026-07-31 13:50:33 -04:00
John Baldwin ea44c37d0b OFED: Add generic function to extract IB speed from netdev
Reviewed by:	kib
Obtained from:	Linux commit d41861942fc55c14b6280d9568a0d0112037f065
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D57952
2026-07-29 14:42:19 -04:00
John Baldwin ee7258cfbb tools/tools/git: Add git-mfc to Makefile similar to git-arc
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D58531
2026-07-29 14:38:22 -04:00
John Baldwin ec73badfbc rtld: Remove write-only text_end local variable from map_object
Reviewed by:	kib
Fixes:		561991144e ("Remove Obj_Entry textsize member.")
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D58522
2026-07-29 14:38:08 -04:00
John Baldwin db3afbe5a6 wg(4): Add a test that the driver handles a decryption failure
The test uses a fail point to inject a decryption error in OCF while
sending a ping across the tunnel.  The driver should then fail to
respond to the ping and increment the input error counter on the
interface.

Approved by:	so
Security:	FreeBSD-SA-26:52.if_wg
Security:	CVE-2026-58085
Reviewed by:	markj
Sponsored by:	Chelsio Communications
2026-07-29 17:45:02 +00:00
John Baldwin 3427182452 wg(4): Check for crypto operation errors
In particular, handle authentication errors due to bad MACs when
decrypting packets.

Since the current dispatch code assumes synchronous OCF sessions by
design, explicitly reject any created OCF session that is not
synchronous.  Software sessions are always synchronous in practice, so
this should be a nop.

Approved by:	so
Security:	FreeBSD-SA-26:52.if_wg
Security:	CVE-2026-58085
Reviewed by:	markj
Sponsored by:	Chelsio Communications
2026-07-29 17:45:02 +00:00
John Baldwin 98bbfef2ea OCF: Add a fail point to inject EBADMSG decryption errors
Approved by:	so
Security:	FreeBSD-SA-26:52.if_wg
Security:	CVE-2026-58085
Reviewed by:	markj
Sponsored by:	Chelsio Communications
2026-07-29 17:45:02 +00:00
John Baldwin c13a9982b5 kdump: Treat a flags argument of 0 to shmat as valid
Sponsored by:	AFRL, DARPA
2026-07-27 14:09:03 -04:00
John Baldwin 9bf1bcf749 Regenerate after fixing getfhat(2) prototype 2026-07-27 14:09:03 -04:00
John Baldwin 09da089955 getfhat: Add missing 'const' to path argument
This matches the documented prototype and avoids spurious
-Wincompatible-pointer-types-discards-qualifiers warnings when passing
a constant pathname.

Sponsored by:	AFRL, DARPA
2026-07-27 14:09:03 -04:00
John Baldwin 81bab70dc6 einj: Tool to manage APEI error injection
This tool supports two commands.  The list command outputs a summary
of injectable errors supported by the current system.  The inject
command injects the requested error.

Reviewed by:	gallatin, imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D58026
2026-07-07 14:15:49 -04:00
John Baldwin bc49842769 acpi_einj: Support for ACPI error injection
This driver parses the ACPI EINJ table and builds a list of
instructions associated with known actions.  It then exports ioctls to
fetch the set of supported errors and inject system errors by
executing specific sequences of actions.  This can be used to test
error reporting facilities for events such as ECC errors.

Reviewed by:	gallatin
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D58025
2026-07-07 14:15:27 -04:00
John Baldwin 9313f6b014 acpi: Add a pseudo-bus for APEI devices to manage resources
Different APEI tables can reuse the same registers (and sometimes
different views of the same register, e.g. 32- vs 64-bit mappings of
the same register).  To enable this sharing, apei0 now acts as a bus
device managing a pool of allocated resources and handing out mappings
to child devices which handle individual tables.

Most of the previous apei(4) driver has been moved into a new
hest0 device that is a child of apei0.

Reviewed by:	gallatin
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D58024
2026-07-07 14:13:51 -04:00
John Baldwin 9cee48180d ktls: Centralize the check for CBC ciphers
Move the check out of ktls_enable_(rx|tx) and into ktls_create_session.

Reviewed by:	gallatin, markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D57973
2026-06-30 20:52:55 -04:00
John Baldwin 1756d1cab3 ktls CBC decrypt: Avoid creating zero length iovec entries
If an mbuf's length in the chain for an encrypted TLS record exactly
matches the remaining length of header bytes to skip, skip the mbuf
entirely rather than adding a zero-length iovec entry.

Sponsored by:	Chelsio Communications
2026-06-30 14:11:29 -04:00
John Baldwin ba4c8cc6e8 ktls CBC decrypt: Only increment iovec index when an entry is used
If an mbuf in the chain was skipped because it only contained bytes
from the header, the iovec index ('i') was incremented even though the
entry was not populated.  Only increment 'i' when an iovec entry is
consumed.

Add a new type of KTLS receive test which writes a single TLS record
via two separate write(2) calls over a TCP_NODELAY socket to trigger
a split in the mbuf chain in the kernel.  Test various split locations
including after the "plain" TLS header (5 bytes), after the full TLS
header, in the middle of the data payload, just before the start of
the trailer, and in the middle of the trailer.  These tests are also
run against all supported ciphers, not just CBC.  The 'header' test
for CBC ciphersuites was able to trigger the bug.

Approved by:	so
Security:	FreeBSD-SA-26:46.ktls
Security:	CVE-2026-49423
Sponsored by:	Chelsio Communications
2026-06-30 17:00:23 +00:00
John Baldwin 21e94133eb ctld: Cleanup redundant handling of duplicate kernel ports
Sponsored by:	Chelsio Communications
2026-06-27 12:01:55 -04:00
John Baldwin 4907d1c5c7 ctld: Normalize physical port names
Don't require ioctl port names to be fully expanded as this
contradicts the syntax documented in the ctl.conf(5).  However, don't
require users to exactly guess when pp or vp can be omitted.  Instead,
normalize all physical port names by parsing any port name with a pp
or vp value and reformatting them to a standardized format.  This
format is also used when generating names for kernel-enumerated ports.

Reported by:	Seth Hoffert <[email protected]>
Fixes:		caef3c50ac ("ctld: Refactor ioctl port handling")
Sponsored by:	Chelsio Communications
2026-06-27 12:01:55 -04:00
John Baldwin 4e57c2aa30 makefs: Fix build on systems without st_birthtime such as Linux
Reviewed by:	emaste
Fixes:		0a301f3330 ("makefs cd9660: Populate creation time stamps in RockRidge extensions")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2297
2026-06-25 11:37:55 -04:00
John Baldwin b6354f0408 OFED: Calculate UDP source port based on flow label or lqpn/rqpn
Calculate and set UDP source port based on the flow label. If flow label
is not defined in GRH then calculate it based on lqpn/rqpn.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Obtained from:	Linux commit 18451db82ef7f943c60a7fce685f16172bda5106
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 45c0d87c57 OFED: A few channges from Linux 5.0
The main point of these changes is the last commit adding a couple of
helper functions used in ROCE drivers.

This contains changes from the following Linux commits:

a70c07397fd8 RDMA: Introduce and use GID attr helper to read RoCE L2 fields
8f9748602491 IB/cm: Reduce dependency on gid attribute ndev check
adb4a57a7a1d RDMA/cma: Use rdma_read_gid_attr_ndev_rcu to access netdev
b4fb4cc5ba83 RDMA/cma: Fix unbalanced cm_id reference count during address resolve
d5665a21250e RDMA/core: Add hash functions to calculate RoCEv2 flowlabel and UDP source port

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 4726b80d93 OFED: Various changes from Linux 4.20
This contains changes from the following Linux commits:

627212c9d49b RDMA/core: Replace open-coded variant of get_device
adee9f3f3bbb RDMA/core: Depend on device_add() to add device attributes
954a8e3aea87 RDMA/cma: Protect cma dev list with lock
722c7b2bfead RDMA/{cma, core}: Avoid callback on rdma_addr_cancel()
f9d08f1e1939 RDMA/core: Rate limit MAD error messages
e1f540c3ed0e RDMA/core: Define client_data_lock as rwlock instead of spinlock
2d65f49ff961 RDMA/core: Use simpler spin lock irq API from blocking context
4512acd0d34c RDMA/core: Remove context entries from list while unregistering device
f7b65d9bf2db RDMA/core: Use simplified list_for_each
93688ddbe1da RDMA/core: No need to protect kfree with spin lock and semaphore
50704e039ab1 RDMA/umem: Restore lockdep check while downgrading lock
eb93c82ed8c7 RDMA/core: Document QP @event_handler function
4269024639f6 RDMA/core: Document CM @event_handler function
77addc524473 RDMA/core: Rename rdma_copy_addr to rdma_copy_src_l2_addr
a362ea1d9e1a RDMA/core: Introduce and use rdma_set_src_addr() between IPv4 and IPv6
89c5691cdd95 RDMA/core: Let protocol specific function typecast sockaddr structure
caf1e3ae9fa6 RDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu
c31d4b2ddf07 RDMA/core: Protect against changing dst->dev during destination resolve
0e9d2c19bff1 RDMA/core: Consider net ns of gid attribute for RoCE
d6b1764a8c5a RDMA/core: Introduce rdma_read_gid_attr_ndev_rcu() to check GID attribute
6aaecd385685 RDMA/core: Simplify roce_resolve_route_from_path()
0965cc953a23 RDMA/core: Properly return the error code of rdma_set_src_addr_rcu
d4b4dd1b9706 RDMA/umem: Do not use current->tgid to track the mm_struct
c9990ab39b6e RDMA/umem: Move all the ODP related stuff out of ucontext and into per_mm
597ecc5a0954 RDMA/umem: Get rid of struct ib_umem.odp_data
41b4deeaa123 RDMA/umem: Make ib_umem_odp into a sub structure of ib_umem
b5231b019d76 RDMA/umem: Use ib_umem_odp in all function signatures connected to ODP
56ac9dd9177c RDMA/umem: Avoid synchronize_srcu in the ODP MR destruction path
be7a57b41ad8 RDMA/umem: Handle a half-complete start/end sequence
ca748c39ea3f RDMA/umem: Get rid of per_mm->notifier_count
f27a0d50a4bc RDMA/umem: Use umem->owning_mm inside ODP

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 6a75471dbc OFED: Various changes from Linux 4.19
Many of these changes deal with shifting from fetcing SGID attributes
via an index in drivers to including references to SGID attributes in
other structures passed to driver callbacks which can be used directly
avoiding the need for fetching attributes via lookup functions.  I had
to fixup the ROCE GID management code directly as the version in
FreeBSD is very different from Linux.

I also tweaked the change from commit
475c8de7bf to use a goto to reduce diffs
with upstream to minimize conflicts when merging upstream changes.

This contains changes from the following Linux commits:

a1a4caeebac9 IB/core: Do not set the gid type when reserving default entries
1c36cf912ad1 IB/core: Store default GID property per-table instead of per-entry
1dfce2945771 IB: Replace ib_query_gid/ib_get_cached_gid with rdma_query_gid
83f6f8d29dd3 IB/core: Make rdma_find_gid_by_filter support all protocols
c3d71b69a75c IB/core: Provide rdma_ versions of the gid cache API
77e786fcbe2e IB/core: Replace ib_query_gid with rdma_get_gid_attr
bf399c2cadfa IB/core: Introduce GID attribute get, put and hold APIs
f4df9a7c34d8 RDMA: Use GID from the ib_gid_attr during the add_gid() callback
b150c3862d21 IB/core: Introduce GID entry reference counts
47ec38666210 RDMA: Convert drivers to use sgid_attr instead of sgid_index
d97099fe53ed IB{cm, core}: Introduce and use ah_attr copy, move, replace APIs
947c99ecfcb4 IB/core: Tidy ib_resolve_eth_dmac
8d9ec9addd6c IB/core: Add a sgid_attr pointer to struct rdma_ah_attr
89af969a6653 RDMA: Convert drivers to use the AH's sgid_attr in post_wr paths
1a1f460ff151 RDMA: Hold the sgid_attr inside the struct ib_ah/qp
7492052a186b IB/mlx4: Use GID attribute from ah attribute
59d40813328f IB/core: Free GID table entry during GID deletion
881456789248 RDMA/cma: Consider net namespace while leaving multicast group
4ed13a5f2d60 IB/cm: Keep track of the sgid_attr that created the cm id
aa74f4878d61 IB: Make init_ah_attr_grh_fields set sgid_attr
f685c19529f0 IB: Make ib_init_ah_from_mcmember set sgid_attr
b7403217656d IB: Make ib_init_ah_attr_from_wc set sgid_attr
ea8c2d8f6014 RDMA/core: Remove unused ib cache functions
a8872d53e9b7 IB/cm: Use sgid_attr from the AV
398391071f25 IB/cm: Replace members of sa_path_rec with 'struct sgid_attr *'
815d456ef21a IB/cm: Pass the sgid_attr through various events
4eefd62c17a9 include/rdma/opa_addr.h: Fix an endianness issue
f8c2d2280cf6 RDMA/core: Remove set-but-not-used variables
28e39894ed4f RDMA/core: Remove ib_find_cached_gid() and ib_find_cached_gid_by_port()
07e7056aff6c IB/core: Simplify check for RoCE route resolve
40ddacf2dda9 RDMA/umem: Don't hold mmap_sem for too long
1215cb7c88ec RDMA/umem: Refactor exit paths in ib_umem_get
c012691508f5 IB/cm: Remove cma_multicast->igmp_joined
4b4671a0f269 IB/IPoIB: Simplify ib_post_(send|recv|srq_recv)() calls
1fec77bf8fcd RDMA/core: Simplify ib_post_(send|recv|srq_recv)() calls
bb039a870c05 IB/core: Allow ULPs to specify NULL as the third ib_post_(send|recv|srq_recv)() argument
643d213a9a03 RDMA/cma: Do not ignore net namespace for unbound cm_id
d274e45ce1ed RDMA/cma: Consider netdevice for RoCE ports
cee104334c98 IB/core: Introduce and use sgid_attr in CM requests
7150c3d5544b RDMA/core: Remove {create,destroy}_ah from mandatory verbs
854633165164 RDMA/core: Prefix _ib to IB/RoCE specific functions
7582df826734 RDMA/core: Avoid holding lock while initializing fields on stack
79d684f02647 RDMA/core: Simplify gid type check in cma_acquire_dev()
ca3a8ace2b12 RDMA/core: Return bool instead of int
05e0b86c413d RDMA/cma: Get rid of 1 bit boolean
e7ff98aefc9e RDMA/cma: Constify path record, ib_cm_event, listen_id pointers
2df7dba855e1 RDMA/core: Constify dst_addr argument
219d2e9dfda9 RDMA/cma: Simplify rdma_resolve_addr() error flow
26e551c5aec5 RDMA: Fix return code check in rdma_set_cq_moderation
58796e67d5d5 IB/ucm: Initialize sgid request GID attribute pointer
dd81b2c8a333 IB/core: Change filter function return type from int to bool
93065ac753e4 mm, oom: distinguish blockable mode for mmu notifiers
0d23ba6034b9 RDMA/ucma: check fd type in ucma_migrate_id()

Part of cee104334c98 was previously merged into FreeBSD.  Namely, SGID
index fields had been added to the two param structures instead and
roce_get_net_dev_by_cm_event was implemented using SGID indices.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin f08a980902 OFED: Malloc API cleanups from Linux 4.18
This contains changes from the following Linux commits:

acafe7e30216 treewide: Use struct_size() for kmalloc()-family
fad953ce0b22 treewide: Use array_size() in vzalloc()
6396bb221514 treewide: kzalloc() -> kcalloc()
6da2ec56059c treewide: kmalloc() -> kmalloc_array()

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin cd567a22e2 OFED: Various changes from Linux 4.18
This contains changes from the following Linux commits:

e822ff213fe6 IB/cm: Store and restore ah_attr during CM message processing
0e225dcb7681 IB/cm: Store and restore ah_attr during LAP msg processing
a5c57d327272 IB/cm: Avoid AV ah_attr overwriting during LAP message handling
724631a9c6e9 IB/core: Introduce and use rdma_gid_table()
25e62655c793 IB/core: Reduce the places that use zgid
08bb558ac11a IB/core: Make testing MR flags for writability a static inline function

Commit 0e225dcb7681 was partially merged previously as
cm_init_av_for_lap() already existed in FreeBSD matching the version
from the Linux commit.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 75cde38e94 OFED: Various changes from Linux 4.17
This contains changes from the following Linux commits:

a3b641af72ba RDMA/CM: move rdma_id_private to cma_priv.h
6612b4983f7e IB/core: Fix comments of GID query functions
b26c4a1138df IB/{core, ipoib}: Simplify ib_find_gid() for unused ndev
5ac08a341303 IB/cma: Use rdma_protocol_roce() and remove cma_protocol_roce_dev_port()
a9c06aeba997 IB/core: Remove rdma_resolve_ip_route() as exported symbol
a22af59ea9a5 IB/cm: Add and use a helper function to add cm_id's to the port list
cb12a8e2fa5f IB/cm: Introduce and use helper function to get cm_port from path
0a5141593567 IB/core: Refactor ib_init_ah_attr_from_path() for RoCE
e41a7c41947d IB/core: Move rdma_addr_find_l2_eth_by_grh to core_priv.h
98f1f4e0ed26 IB/core: Refer to RoCE port property instead of GID table property
114cc9c4b182 IB/cma: Resolve route only while receiving CM requests
9137108cc3d6 RDMA/rdma_cm: Fix use after free race with process_one_req
190fb9c4d130 IB/core: Refer to RoCE port property to decide building cache
22d24f75a193 IB/core: Search GID only for IB link layer
4ab7cb4bf362 IB/core: Refer to RoCE port property instead of GID table property
3401857ea347 IB/core: Generate GID change event regardless of RoCE GID table property
218b9e3eb8b5 RDMA/cma: Move rdma_cm_state to cma_priv.h
8435168d50e6 RDMA/ucma: Don't allow setting RDMA_OPTION_IB_PATH without an RDMA device
72e1ff0fb7e0 RDMA/core: Update query_gid documentation for HCA drivers
0e1f9b924471 RDMA/providers: Simplify query_gid callback of RoCE providers
598ff6bae689 IB/core: Refactor GID modify code for RoCE
f35faa4ba956 IB/core: Simplify ib_query_gid to always refer to cache
14169e333e71 IB/providers: Avoid zero GID check for RoCE
414448d249d8 RDMA: Use ib_gid_attr during GID modification
ee6548d1d98d RDMA/rdma_cm: Delete rdma_addr_client
44e75052bc2a RDMA/rdma_cm: Make rdma_addr_cancel into a fence
e19c0d237873 RDMA/rdma_cm: Remove process_req and timer sorting
a66ed149b0da IB/core: Don't allow default GID addition at non reseved slots
dc5640f294e4 IB/core: Fix deleting default GIDs when changing mac adddress
22c01ee4b8a8 IB/core: Fix to avoid deleting IPv6 look alike default GIDs
9aa169213d11 RDMA/cma: Do not query GID during QP state transition to RTR
aec05afe641b IB/core: Remove redundant return

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 1d99feddd6 OFED: Various changes from Linux 4.16
This contains changes from the following Linux commits:

c5c4e40e90b5 IB/CM: Change sgid to IB GID when handling CM request
54a6d63f14bd IB/mlx4: Potential buffer overflow in _mlx4_set_path()
56d0a7d9a0f0 IB/core: Depend on IPv6 stack to resolve link local address for RoCEv2
1060f8653414 IB/{core/cm}: Fix generating a return AH for RoCEE
981b5a2384b7 RDMA/cma: Introduce and use helper functions to init work
c42388053758 RDMA/cma: Avoid setting path record type twice
4367ec7fe2dd RDMA/cma: Simplify netdev check
151ed9d70097 IB/core: Refactor to avoid unnecessary check on GID lookup miss
b0dd0d335364 IB/core: Avoid unnecessary type cast
86937fcd6ed2 RDMA/core: Avoid redundant memcpy in rdma_addr_find_l2_eth_by_grh
1c43d5d308f0 IB/core: Avoid exporting module internal ib_find_gid_by_filter()
dbb12562f7c2 IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link layer
f6bdb14267ba IB/{core, umad, cm}: Rename ib_init_ah_from_wc to ib_init_ah_attr_from_wc
4ad6a0245ec8 IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to ib_init_ah_attr_from_path
33f93e1ebcf5 IB/cm: Fix sleeping while spin lock is held
16c72e402867 IB/cm: Refactor to avoid setting path record software only fields
af808ece5ce9 IB/SA: Check dlid before SA agent queries for ClassPortInfo
8d20a1f0ecd5 RDMA/cma: Fix rdma_cm raw IB path setting for RoCE
fe75889f2794 RDMA/{cma, ucma}: Simplify and rename rdma_set_ib_paths
9327c7afdce3 RDMA/cma: Provide a function to set RoCE path record L2 parameters
89838118a515 RDMA/cma: Fix rdma_cm path querying for RoCE
cd2a6e7d384b IB/core: Fix ib_wc structure size to remain in 64 bytes boundary
f2290d6d522d IB/core: Attempt DMAC resolution for only RoCE
a6532e713966 RDMA/core: Clarify rdma_ah_find_type
246d8b184c10 IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct
aaebd377c0e9 IB/core: postpone WR initialization during queue drain
15cbc5197693 RDMA/core: Simplify rdma_addr_get_sgid() to not support RoCE
7a2f64ee4a95 RDMA/ucma: Use rdma cm API to query GID
411460ac50b0 RDMA/cma: Introduce API to read GIDs for multiple transports
2493a57bc10f RDMA/cma: Refactor to access multiple fields of rdma_dev_addr
00db63c128dd RDMA/cma: Check existence of netdevice during port validation
925f7ea7a6ba RDMA/cm: Fix access to uninitialized variable
87daac68f77a IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
87915bf82eea RDMA/verbs: Return proper error code for not supported system call
d3b9e8ad425c RDMA/core: Reduce poll batch for direct cq polling

Parts of 1060f8653414 were already merged into FreeBSD.  Cosmetic
changes made in rdma_addr_find_l2_eth_by_grh while merging this change
were just to reduce the diff with Linux to ease merging future
changes.

The merge of 56d0a7d9a0f0 differs slightly from the Linux commit as
FreeBSD was missing the original changes to check for link-local
addresses in ib_resolve_eth_dmac.

The merge of 2493a57bc10f is mostly a cosmetic change to reduce diffs
with upstream as local changes in FreeBSD passed the dev_addr as the
last argument instead of the dev_type and if_index already.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:56 -04:00
John Baldwin 85893a8399 OFED: Various changes from Linux 4.15
This contains changes from the following Linux commits:

c0b64f58e8d4 RDMA/cma: Avoid triggering undefined behavior
c0348eb06968 IB: Let ib_core resolve destination mac address
5a3dc3237243 IB/cm: Fix memory corruption in handling CM request
fec99ededf6b RDMA/umem: Avoid partial declaration of non-static function
19b57c6c4499 IB/core: Convert OPA AH to IB for Extended LIDs only
e08ce2e82b2f RDMA/core: Make function rdma_copy_addr return void
4190b4e96954 RDMA/core: Rename kernel modify_cq to better describe its usage

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin 687057e712 OFED: Various changes from Linux 4.14
This contains changes from the following Linux commits:

1cb2fc0db764 IB/mad: Change slid in RMPP recv from 16 to 32 bits
7e93e2cb835c IB/IPoIB: Increase local_lid to 32 bits
d541e45500bd IB/core: Convert ah_attr from OPA to IB when copying to user
6b3c0e6e6d5a IB/CM: Create appropriate path records when handling CM request
e92aa00a5189 IB/CM: Add OPA Path record support to CM
7db20ecd1d97 IB/core: Change wc.slid from 16 to 32 bits
db58540b021a IB/core: Change port_attr.sm_lid from 16 to 32 bits
582faf3150f5 IB/core: Change port_attr.lid size from 16 to 32 bits
ac3a949fb2ff IB/CM: Set appropriate slid and dlid when handling CM request
06f8174a9782 IB/core: Protect sysfs entry on ib_unregister_device
62ede7779904 Add OPA extended LID support
13c19222889d IB/rdmavt, hfi1, qib: Modify check_ah() to account for extended LIDs
d98bb7f7e6fa IB/hfi1: Determine 9B/16B L2 header type based on Address handle
dcc9881e6767 RDMA/(core, ulp): Convert register/unregister event handler to be void
f808c13fd373 lib/interval_tree: fast overlap detection

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin ba5c6caae7 OFED: Various changes from Linux 4.13
This contains changes from the following Linux commits:

28b5b3a23ba6 RDMA/core: Document confusing code
5fff41e1f89d IB/core: Fix race condition in resolving IP to MAC
b1a89257f28e IB/umem: update to new mmu_notifier semantic

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin 774a662063 OFED: Various changes from Linux 4.12
Most of the changes involve renaming InfiBand address handles (AH) to
RDMA address handles including renaming various types and functions.
Address handles now also include type-specific fields and a set of
wrapper accessor functions for getting and setting fields.  For some
of the type and function renames, drivers in sys/dev had to be updated
directly (typically via sed).

This contains changes from the following Linux commits:

f039f44fc331 IB/core: Add support for draining IB_POLL_DIRECT completion queues
fedd9e1f7582 IB/cq: Don't process more than the given budget
403cd12e2cf7 IB/umem: Add contiguous ODP support
0008b84ea9af IB/umem: Add support to huge ODP
3e7e1193e28a IB: Replace ib_umem page_size by page_shift
cb8637660ae8 IB/SA: Move functions update_sm_ah() and ib_sa_event()
680562b56939 IB/SA: Remove unwanted braces
dbb6c91fd8e0 IB/SA: Add braces when using sizeof
f96a31871449 IB/SA: Fix lines longer than 80 columns
94d595c56077 IB/core: Add rdma_cap_opa_ah to expose opa address handles
ee1c60b1bff8 IB/SA: Modify SA to implicitly cache Class Port info
aa4656d9a429 IB/core: Move opa_class_port_info definition to header file
2196f2716292 IB/SA: Add support to query opa classport info.
64b4646eaf3d IB/core: Define 'opa' rdma_ah_attr type
44c58487d51a IB/core: Define 'ib' and 'roce' rdma_ah_attr types
d8966fcd4c25 IB/core: Use rdma_ah_attr accessor functions
2224c47ace23 IB/core: Add accessor functions for rdma_ah_attr fields
365231593409 IB/core: Rename ib_destroy_ah to rdma_destroy_ah
bfbfd661c9ea IB/core: Rename ib_query_ah to rdma_query_ah
67b985b6c755 IB/core: Rename ib_modify_ah to rdma_modify_ah
0a18cfe4f6d7 IB/core: Rename ib_create_ah to rdma_create_ah
766b7f6cf0c0 IB/mthca: Rename to_ib_ah_attr to to_rdma_ah_attr
38349389fece IB/mlx5: Rename to_ib_ah_attr to to_rdma_ah_attr
71d53ab47ee6 IB/mlx4: Rename to_ib_ah_attr to to_rdma_ah_attr
90898850ec4e IB/core: Rename struct ib_ah_attr to rdma_ah_attr
4ba66093bdc6 IB/core: Check for global flag when using ah_attr
cf0b9395d084 IB/core: Add braces when using sizeof
cfd519358f50 IB/IPoIB: Remove 'else' when the 'if' has a return.
82ffc226483c IB/CM: Add braces when using sizeof
dfa834e1d97e IB/SA: Introduce path record specific types
c2f8fc4ec440 IB/SA: Rename ib_sa_path_rec to sa_path_rec
9fdca4da4d8c IB/SA: Split struct sa_path_rec based on IB and ROCE specific fields
4c33bd1926cc IB/SA: Add support to query OPA path records
57520751445b IB/SA: Add OPA path record type
87f0faadc685 IB/SA: Add OPA addr header
eed7624552ca RDMA/mlx4: Fix MAD tunneling when SRIOV is enabled
f937d93a9122 RDMA/uverbs: Declare local function static and add brackets to sizeof
d3957b86a406 RDMA/SA: Fix kernel panic in CMA request handler flow

The IPoIB portions of ee1c60b1bff8 were already present in FreeBSD
from an earlier sync with OFED.  Likewise, the ib_uverbs_cmd.c
changes from 4ba66093bdc6 were also already present.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin 8d57de34d5 OFED: Various changes from Linux 4.11
This contains changes from the following Linux commits:

55efcfcd7776 RDMA/core: Fix incorrect structure packing for booleans
aaaca121c7cf RDMA/core: add port state cache
9e2c3f1c7f3e RDMA/core: export ib_get_cached_port_state
93b1f29de71f RDMA/cma: resolve to first active ib port
d43dbacfc063 IB/core: Change the type of an ib_dma_alloc_coherent() argument
6532c380bf40 IB/core: Remove ib_dma_*map_single_attrs()
0bbb3b7496ea IB/rxe, IB/rdmavt: Use dma_virt_ops instead of duplicating it
f57e8ca50e23 IB/mad: Add port_num to error message
828f6fa65ce7 IB/umem: Release pid in error and ODP flow
19b752a19dce IB/cma: Allow port reuse for rdma_id
21d6454a392d RDMA/core: create struct ib_port_cache
25bf14d6f589 IB/core: Add implicit MR flag
d9d0674c0f8a IB/umem: Indicate that process is being terminated
d07d1d70ce1a IB/umem: Update on demand page (ODP) support
a748d60df32e IB/mlx4: Take source GID by index from HW GID table
89052d784bc9 IB/cma: Add default RoCE TOS to CMA configfs
6df6b4a9ce43 IB/cma: Destination and source addr families must match

On FreeBSD, the default RoCE TOS setting is available as per-port
sysctls similar to the existing default RoCE mode sysctls.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin 38d9ce1f58 OFED: Various changes from Linux 4.10
This contains changes from the following Linux commits:

850d8fd76507 IB/mlx4: Handle IPv4 header when demultiplexing MAD
a0b3455fcb2d IB/core: Remove debug prints after allocation failure
74226649f42d IB/ipoib: Remove and fix debug prints after allocation failure
870b28524552 IB/mthca: Remove debug prints after allocation failure
aa6aae38f7fb IB/core: Release allocated memory in cache setup failure
f73a1dbc45a5 infiniband: remove WARN that is not kernel bug
5f24410408fd rdma_cm: add rdma_consumer_reject_data helper function
5042a73d3e9d rdma_cm: add rdma_is_consumer_reject() helper function
d3f4aadd614c RDMA/core: Add the function ib_mtu_int_to_enum

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin eaf9f1aafa OFED: Use _ib_modify_qp to implement ib_modify_qp
This was missed when merging in ib_modify_qp_with_udata() previously.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Fixes:		b633e08c70 ("ibcore: Kernel space update based on Linux 5.7-rc1.")
Sponsored by:	Chelsio Communications
2026-06-24 15:30:55 -04:00
John Baldwin 03ac6fe4f6 ctld: Simplify handling of non-iSCSI and non-NVMe kernel ports
Just add these directly to the kports object rather than treating them
as iSCSI ports.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D57283
2026-06-24 11:28:51 -04:00
John Baldwin 9522100a17 arm64: Fix build of gicv5 driver without SMP
Fixes:		c84261da6f ("arm64: Add an initial GICv5 driver")
2026-06-23 20:56:41 -04:00
John Baldwin 0e0d464226 LinuxKPI: Retire <linux/dma-attrs.h>
Move the attribute constants to <linux/dma-mapping.h> to match
upstream.

Reviewed by:	bz, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D57749
2026-06-23 11:52:57 -04:00
John Baldwin 1a03b40a13 ktls: Make ktls_mbuf_crypto_state private and simplify
Sponsored by:	Chelsio Communications
2026-06-23 11:51:43 -04:00
John Baldwin 0a301f3330 makefs cd9660: Populate creation time stamps in RockRidge extensions
Differential Revision:	https://reviews.freebsd.org/D57527
2026-06-23 11:51:43 -04:00
John Baldwin 3d945604ef cd9660: Add support for birth times
Both the Extended Attribute Record in the base ISO-9660 standard and
the RockRidge timestamp extension support a file creation timestamp.
Use this to populate the birthtime if present.

Reviewed by:	markj (earlier version)
Differential Revision:	https://reviews.freebsd.org/D57526
2026-06-23 11:51:43 -04:00
John Baldwin f6dd01b417 cd9660: Adjust parsing of timestamps in the extended atttributes record
The extended attribute record includes four different timestamps: file
creation, file modification, file expiration, and file effective date.
Only the first two are meaningful for stat(2).  The latter two (if
handled) would presumably affect if a file is visible for not.

Previously, the logic here was a bit contorted and made use of the
effective time.  It also seemed to treat the creation time as a change
time timestamp.

Instead, simplify the logic such that the modification time is set to
either the modification time (if present), or the creation time.  The
access and change times are then set to the modification time.

NB: This is not used if RockRidge extensions are present, and makefs
does not generate the extended attributes record.

Differential Revision:	https://reviews.freebsd.org/D57748
2026-06-23 11:51:43 -04:00
John Baldwin c6eb9f16cf pciconf: Minor cleanups in the config register methods
This is mostly to provide cleaner code for future changes to copy
from.

- Use NULL instead of casting 0 to pointer types.

- Inline readone() in the sole caller now that it is just a single line.

- Use a helper variable for the count of items on each line of output
  in readit().

- Fix the double space in the middle of byte output to only trigger
  for width 1.  For other widths it would output spurious spaces at
  the end of the line which doesn't really hurt, but is buggy
  nonetheless.

- Avoid using implicit booleans by explicitly comparing integer
  expressions against zero.

- Don't compare the endptr returned from strtol() against NULL.

Differential Revision:	https://reviews.freebsd.org/D57535
2026-06-23 11:51:43 -04:00
John Baldwin e4c4c6eeb2 RDMA: dma-mapping: use unsigned long for dma_attrs
Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Obtained from:	Linux commit 00085f1efa387a8ce100e3734920f7639c80caa3
Sponsored by:	Chelsio Communications
2026-06-22 14:36:53 -04:00
John Baldwin 49ee94b291 IB/ipoib: Prevent hung task or softlockup processing multicast response
Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Obtained from:	Linux commit 3874397c0bdec3c21ce071711cd105165179b8eb
Sponsored by:	Chelsio Communications
2026-06-22 14:36:53 -04:00
John Baldwin fbe76ea44c OFED: Use vmalloc() and vzalloc() in various places
This contains changes from the following Linux commits:

10313cbb9220 IPoIB: Allocate priv->tx_ring with vmalloc()
b1404069f644 IPoIB/cm: Use vmalloc() to allocate rx_rings
948579cd8c6e RDMA: Use vzalloc() to replace vmalloc()+memset(0)

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Tested by:	John Baldwin <[email protected]> (iw_cxgbe)
Sponsored by:	Chelsio Communications
2026-06-22 14:36:52 -04:00