netpfil tests: Make divapp packet loop handling opt-in
This generalizes the divapp logic and makes it usable for other test
scenarios such as diverted TCP connections.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59067
LinuxKPI: 802.11: assert wiphy lock for lkpi_bss_info_change() and MO
Finish reviewing all callers for lkpi_80211_mo_link_info_changed() and
lkpi_80211_mo_bss_info_changed(), which are called from
lkpi_bss_info_change() only. Add the lockdep_assert_wiphy() to
lkpi_bss_info_change() and make sure all callers are holding the
wiphy lock.
PR: 297228
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
i2c/sensor/w83793g: Fix unused function warning
w83793g_writereg is unused so silence it.
Fixes: cd3cc6e910c0f ("i2c/sensors: Add driver for W83793 hardware monitor")
install: Fix two bugs in stdin code
* Fix case where the source is - and the target exists.
* Only call chflags() (to remove flags that might prevent us from
replacing an existing target) in the exists case; otherwise,
to_sb.st_flags is uninitialized.
* Rename the source file in the stdin test case.
* Extend null and stdin test cases to cover the case where the
target already exists.
PR: 297681
MFC after: 1 week
Fixes: d34870708db9 ("install: Allow installing stdin")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59144
(cherry picked from commit a5ff4125cf08a83f7e67f498e423f3e354144327)
build: Use -f when copying sources
If one of the source files we copy is non-writeable, cp will create a
non-writeable copy. If the original is later modified, cp will fail to
overwrite the copy since it is not writeable. Using cp -f ensures the
copy always succeeds, as long as the object directory is writeable.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
(cherry picked from commit 336b6d11922ac3d080de50f789d40ff95b540cdf)
kern/sched: Hide scheduler selection from C++
The scheduler selection interface uses names that are reserved words in
C++, causing problems for downstream projects that use C++ in the
kernel. Work around this by hiding the interface from C++ compilers
until we can come up with a better solution.
Fixes: ce38acee8d0b ("Add kern/sched_shim.c")
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: siderop1_netapp.com, imp, kib
Differential Revision: https://reviews.freebsd.org/D58991
(cherry picked from commit f2366851616083f923e8101363802678a03dc0b9)
build: Use -f when copying sources
If one of the source files we copy is non-writeable, cp will create a
non-writeable copy. If the original is later modified, cp will fail to
overwrite the copy since it is not writeable. Using cp -f ensures the
copy always succeeds, as long as the object directory is writeable.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
(cherry picked from commit 336b6d11922ac3d080de50f789d40ff95b540cdf)
install: Fix two bugs in stdin code
* Fix case where the source is - and the target exists.
* Only call chflags() (to remove flags that might prevent us from
replacing an existing target) in the exists case; otherwise,
to_sb.st_flags is uninitialized.
* Rename the source file in the stdin test case.
* Extend null and stdin test cases to cover the case where the
target already exists.
PR: 297681
MFC after: 1 week
Fixes: d34870708db9 ("install: Allow installing stdin")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59144
(cherry picked from commit a5ff4125cf08a83f7e67f498e423f3e354144327)
yes: Avoid static initialization
Our buffer is half a megabyte, but we are only initializing the first
two bytes. Switching from static to dynamic initialization moves it
from .data to .bss, greatly reducing the size of the binary.
Fixes: cf74b63d61b4 ("yes: Completely overengineer")
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D58890
(cherry picked from commit 557ba0c2a5138ce026c0ea9cb02f374f97378b7c)
bnxt: Add led(4) identification support
Query the firmware for the LEDs on each physical port and expose
/dev/led/bnxt* only when alternate blinking is supported. Configure
every LED in the advertised group for identification and restore its
default firmware state before a function reset.
This follows the DPDK and Linux bnxt HWRM identification paths.
Reviewed against: DPDK, Linux
Reviewed by: Sumit Saxena <sumit.saxena at broadcom.com>
Sponsored by: BBOX.io
(cherry picked from commit 98b5640786f874949e441bee7c4ad5740cd6a649)
bnxt: Add led(4) identification support
Query the firmware for the LEDs on each physical port and expose
/dev/led/bnxt* only when alternate blinking is supported. Configure
every LED in the advertised group for identification and restore its
default firmware state before a function reset.
This follows the DPDK and Linux bnxt HWRM identification paths.
Reviewed against: DPDK, Linux
Reviewed by: Sumit Saxena <sumit.saxena at broadcom.com>
Sponsored by: BBOX.io
(cherry picked from commit 98b5640786f874949e441bee7c4ad5740cd6a649)
ufshci: handle a recovery reset before the SIM attach
When the first start attempt fails early, the recovery reset
runs the start sequence again without a SIM. That pass still
looked up the WLUN, so it dereferenced a NULL SIM and panicked.
Attach the SIM whenever it does not exist yet. Also make the
WLUN lookup return NULL when there is no SIM.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D58947
ufshci: build valid fake responses for manual completion
The manual completion wrote the fake response to the wrong
descriptor for task management slots. It also left the task tag
at zero, which tripped the task tag check under INVARIANTS.
Write the fake response where the completion path reads it.
Copy the task tag from the request.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D58946
ufshci: reject new requests on a failed controller
A failed controller accepted new requests, but nothing ever
completed them, so the caller waited forever. The admin retry
path could also resubmit a request to a dead queue.
Reject new submits and admin retries on a failed controller.
The submit check runs under the queue lock, so it cannot race
with the queue walk in the fail path.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D58948
ufshci: run the controller fail path only once
Two threads could run ufshci_ctrlr_fail() at the same time.
Each one walked the queues and completed the same trackers
again, which caused a double free and a panic.
Turn is_failed into an atomic gate, so only the first caller
walks the queues. The reset task now returns early on a failed
controller instead of re-enabling it.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D58944
ufshci: claim trackers before failing them
ufshci_req_queue_fail() drops the queue lock to complete each
tracker. In that window the completion path could complete the
same tracker again.
Claim the slot before dropping the lock, so the completion scan
skips it. Reserved slots are left to their submit thread, which
completes them itself. The manual request completion helper
lost its only caller, so drop it.
Reviewed by: imp (mentor)
Sponsored by: Samsung Electronics
Differential Revision: https://reviews.freebsd.org/D58945
acpi_pci: Inherit PF locality for SR-IOV VFs
SR-IOV VFs are instantiated from their PF and intentionally do not
receive an ACPI handle by matching their runtime BDF. Consequently,
ACPI locality queries for a VF fall back to the upstream bus. This is
usually sufficient, but loses a _PXM supplied specifically for the PF.
Use the PCI core's owning-PF accessor for BUS_GET_DOMAIN and
BUS_GET_CPUS requests made for a VF. This preserves the VF's lack of
an ACPI handle while allowing its CPU and NUMA placement to follow the
PF.
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59062
acpi_pci: Do not match SR-IOV VFs to ACPI devices
SR-IOV VFs are instantiated dynamically from their PF rather than
enumerated from ACPI. A VF's runtime slot and function can match an
unrelated _ADR below the bridge. acpi_pci_save_handle() stores that
handle in the VF's devinfo before acpi_pci_update_device() runs.
If the handle is already bound to another device_t whose parent is not
acpi0, acpi_pci_update_device() panics under INVARIANTS. Without
INVARIANTS, the VF retains the unrelated handle, so subsequent ACPI
lookups, including NUMA and power-management operations, can act on the
wrong namespace node.
Skip ACPI namespace matching for VFs.
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59061
chflags.1: Change dontcache to nocache
Commit 290e563166b4 changed the flag's name from dontcache
to nocache. This patch fixes the man page.
This is a content change.
Reviewed by: kib (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D58181
Fixes: 4830670a3f94 ("chflags.1: Document the new UF_DONTCACHE flag")
chflags: Add a new UF_NOCACHE flag
This internet draft (which is close to being an RFC)
specifies a new NFSv4.2 attribute which tells the NFSv4.2
client to not cache file data. (Similar to O_DIRECT, but
triggered by this attribute set on the file on the NFSv4.2
server and not by the application's open(2).)
https://datatracker.ietf.org/doc/draft-ietf-nfsv4-uncacheable-files/
This patch adds a new chflags(1) flag called UF_NOCACHE to
implement this.
Patches for NFS and ZFS will be done separately.
This is a redo of the patch, with a requested name change
and a #ifdef in strtofflags.c so that it doesn't break some
Linux cross build. The name change was requested by fuz@.
[3 lines not shown]
xhci: Only reset the data toggle value when the USB stack asks for it
The previous patch assumes that we don't want to reset toggle bit in
STOPPED_STEP. However, a device can explicitly call
usbd_clear_data_toggle if necessary. As a result, instead of not
dropping the bit unconditionally, we added a field in xhci to specify
that we want to drop it, so that usbd_clear_data_toggle can handle it
correctly.
Reported by: oh
Reviewed by: kevans
Tested by: oh
Fixes: 28d85db46b48 ("xhci: Do not drop and add bits in xhci")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D59186
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
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
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: e87a6f3ef284 ("bhyve: use physical lobits for BARs of passthru devices")