Commit graph

44873 commits

Author SHA1 Message Date
Kevin Bowling
61272c8a2a pci: Expose PME support by power state
The presence of the PCI power management capability does not imply that
a function can signal PME# from every power state.  Drivers which
advertise wake based only on pci_has_pm() can consequently expose wake
modes that cannot work.

Add pci_has_pme() to query the PME_Support bitmap for a specific state.
Use it to implement LinuxKPI pci_pme_capable(), removing its duplicate
PME_Support decoder.

Validated the helper against PCI PMC capability values from 82571EB,
82573L, 82579LM, I210, I225, and I226-V controllers.  The 82571 and
82573 reported PMC 0xc822, while the I226-V reported 0xc823.  In both
values, bits 15, 14, and 11 advertise PME from D3cold, D3hot, and D0;
the low-bit difference is only the PM capability version.

Sponsored by:	BBOX.io

(cherry picked from commit c4e24e95c3f905b817d4bfc6e93457eb297bfa4b)
2026-09-23 12:01:02 +02:00
Kevin Bowling
e82714ece2 pci: Expose a VF's owning PF to bus subclasses
ofw_pcibus now uses pci_iov_get_pf() to inherit PF locality for
VFs, but the accessor was inadvertently left in an uncommited ACPI
change.  This breaks powerpc builds.

Expose the accessor from the PCI core and provide a stub when PCI_IOV
is omitted.  Record VF ownership before pci_add_child() so child added
callbacks can safely query it, and remove the later redundant
assignment.

Sponsored by:	BBOX.io

(cherry picked from commit 3481a9cdc4dc26ef583bb0f46a04d5d059cde466)
2026-09-23 12:01:02 +02:00
Kevin Bowling
cb40e05354 pci_iov: Permit non-ARI VFs on a secondary bus
A non-zero VF device number does not always require ARI. The Intel
82576 and I350 [1] explicitly support a non-ARI layout that places VFs
on the next bus.

Check every requested VF RID and reject a non-zero device only when it
is on the PF bus. This retains the ARI guard for invalid same-bus
layouts while permitting the documented second-bus layout.

[1] Intel I350 Datasheet, sections 7.8.2.6.1.2, 9.6.4.6

Sponsored by:	BBOX.io

(cherry picked from commit e795a31cb4d66368bdbe5ac7f61c0899d3ed39f8)
2026-09-23 12:01:02 +02:00
Kevin Bowling
83d8500469 pci: Export pcie_flr_supported()
Move the capability and quirk checks used by pcie_flr() into a public
side effect free helper.  This lets callers determine whether an FLR
can be attempted before quiescing a device or saving state.

The helper considers the advertised PCIe FLR capability and both the
enable and disable FLR quirks.

Sponsored by:	BBOX.io

(cherry picked from commit 5b48968c1a57bd1a7f086d7e09add59afa158340)
2026-09-23 12:01:01 +02:00
Kevin Bowling
c2c56a68d6 pci_iov: Roll back failed VF enumeration
pci_iov_enumerate_vfs() logged a failed VF creation or driver
configuration but still reported the whole SR-IOV configuration as
successful.  The PF remained enabled with the requested NumVFs and
driver state even though one or more VF children were absent.

Make VF enumeration atomic.  Delete children created by the failed
attempt, invoke the PF driver cleanup, disable VF memory space and VF
Enable, release the IOV resources, and return the original error to
iovctl.  Also treat failure to create a VF child as an error instead
of silently accepting a partial configuration.

(cherry picked from commit 4b195f1a25d5003117653a1a323ad19561dc8705)
2026-09-23 12:01:01 +02:00
Kevin Bowling
eb3e5c410f pci: Do not reconcile MPS across PCI domains
A PCI function can provide a host bridge into a synthetic PCI domain.
Intel VMD does this: the host facing VMD function remains in its
original domain while the hidden Root Ports and endpoints appear in a
separate domain.  The VMD function's Device Control does not describe
an upstream link in that synthetic hierarchy.

The hierarchy wide cold pass incorrectly used the VMD function's MPS
to reprogram the hidden ports and their endpoints.  Stop both cold
reconciliation and runtime path walks at a PCI domain boundary.  The
real Root Ports within the VMD domain continue to reconcile their
endpoints normally.

Reviewed by:	imp
Tested by:	Michael Butler <imb@protected-networks.net>
Fixes:		8e9fe9996a1f ("pci: Reconcile MPS before attaching PCIe devices")
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D58837

(cherry picked from commit 57293f4541cdea8e4158f751a4439f69b3ec1711)
2026-09-23 12:01:01 +02:00
Kevin Bowling
a8461f1e8b pci: Skip PF SR-IOV state handling for VFs
A VF's pci_devinfo references its PF's pcicfg_iov for resource
bookkeeping, but only the PF implements the SR-IOV capability.
pci_cfg_save() and pci_cfg_restore() treated any non-NULL cfg.iov as
an owned capability and accessed the PF capability offset in VF
configuration space. Saving a VF could therefore replace the shared
PF settings with unrelated VF register values.

Skip SR-IOV capability save and restore for PCICFG_VF children. The
generic PCI and PCIe state of the VF remains preserved. This is also
required by drivers that save VF state around a PF-driven
function-level reset.

(cherry picked from commit 78547d542f776d366c36b5a2fc747ddfe99523c6)
2026-09-23 12:01:01 +02:00
Kevin Bowling
a5c515a502 pci: Optionally disable endpoints with unsafe MPS
Keep warn-only behavior as the default. Add an opt-in policy that
clears endpoint decoding and bus mastering when a newly discovered
function cannot match its active path, while never disabling bridge
functions and their subtrees.

(cherry picked from commit 114f4a68f21345e1e6680b7acf1bf733d9047002)
2026-09-23 12:01:01 +02:00
Kevin Bowling
f4ed8f72df pci: Add a hierarchy-wide MPS limit
Add a boot-time ceiling for MPS reconciliation. Apply it only while an
entire cold-enumerated link can be configured consistently, and leave
an established active path unchanged.

(cherry picked from commit 673cb5265a2df2228982fc220f4e7ea62ab765b2)
2026-09-23 12:01:01 +02:00
Kevin Bowling
d8801c064c pci: Reconcile MPS before attaching PCIe devices
Reconcile each newly enumerated link as a unit before child drivers
attach. Firmware may leave Bus Master Enable set after handoff, so use
the bus attachment state rather than that bit to identify the cold
phase.

Preserve an established hierarchy during rescan and hot-add. Refuse a
reduction below a switch because recursive enumeration may already have
made a sibling subtree live; lowering only the local port or Root Port
would produce an inconsistent path. Report capability and active-use
conflicts distinctly.

Handle OFW PCI buses that clone the generic enumeration path.

(cherry picked from commit 8e9fe9996a1fbdb79033b082e6a96b9e1266e33f)
2026-09-23 12:01:01 +02:00
Kevin Bowling
09dfd54d75 pci: Preserve adjusted PCIe control state
The PCI bus changes live capability registers after the initial
configuration snapshot has been saved. A later driver reprobe restores
that snapshot and can silently undo the adjustment.

Update the cached Device Control and Root Control bits together with
pcie_adjust_config() writes. Route the persistent Maximum Read Request
setter and the bus-owned AER control changes through that helper as
well, so they share the same restore semantics as MPS reconciliation.

Document the persistent-write contract. Merge only explicitly adjusted
bits into the saved image so unrelated or transient bits observed during
the hardware read-modify-write cannot become persistent.

(cherry picked from commit a9752e9ac8a635f49ca058dd7268298840c7e915)
2026-09-23 12:01:00 +02:00
Kevin Bowling
98c5321a68 pci: Permit function-level reset of 82599 VFs
Intel 82599 supports FLR on VFs but reports FLR support only in the PF
Device Capabilities register.  The VF register therefore leaves the FLR
Capable bit clear, and pcie_flr() rejects the reset.

Intel documents the zeroed VF PCIe capability structure as erratum 35
in the 82599 Specification Update (B0=Yes; NoFix).

Add a positive FLR quirk for the 82599 VF.  Keep the capability check
for every other function, so an unknown nonconforming VF cannot make
pcie_flr() report success when its reset request was ignored.

SR-IOV requires VFs to support FLR, but a clear capability bit cannot
distinguish the 82599's misadvertisement from a VF that fails to
implement it.

(cherry picked from commit ee776a8e291cb73845a8611d3dec5a2a966106b9)
2026-09-23 12:01:00 +02:00
Kevin Bowling
b8f38f3dde pci: Ignore SR-IOV VFs when tuning MPS
The VF Device Control MPS and MRRS fields are reserved and preserved.
VF transactions use the PF MPS, so a hardwired VF value must not be
used to retune the shared PCIe hierarchy.

Document the previously undocumented tuning knob and clarify why a VF
may continue to display its reserved hardwired value.

This fixes an instant crash/reboot on my Zen3 system with 82599 VFs.

(cherry picked from commit 5aab6164161db397d84e5fff88e1af1a9e405875)
2026-09-23 12:01:00 +02:00
Michael Adler
1c38992d6b pci: Add L1 PM definitions
Add register/bit definitions for the L1 PM substates capability
(PCIZ_L1PM) to pcireg.h.

Signed-off-by: Michael Adler <madler@tapil.com>

Pull-Request:	https://github.com/freebsd/freebsd-src/pull/2318

(cherry picked from commit 04f8a6aeeba5cbaa48be7134765ee49d5b1b9857)
2026-09-23 12:01:00 +02:00
Kevin Bowling
5888110c73 pci_iov: Clear NumVFs when configuration fails
pci_iov_config() programs NumVFs before validating the final VF RID
layout and allocating all generic resources. A subsequent error ran the
driver uninit callback but left the hardware NumVFs register programmed
while the software VF count returned to zero.

Clear NumVFs in the error path after the driver uninit callback,
matching normal SR-IOV teardown ordering. This prevents stale hardware
state after a failed configuration and permits a clean retry.

Sponsored by:	BBOX.io

(cherry picked from commit 621498b58cdab36a237d5f0b5c902952ad743fa9)
2026-09-23 12:01:00 +02:00
Franco Fichtner
525ebac42c Revert "pci: Preserve adjusted PCIe control state"
This reverts commit 2c6c05c8ee.
2026-09-23 12:00:43 +02:00
Franco Fichtner
4965a00236 Revert "pci: Add L1 PM definitions"
This reverts commit dd064f22c8.
2026-09-23 11:59:45 +02:00
Kevin Bowling
2c6c05c8ee pci: Preserve adjusted PCIe control state
The PCI bus changes live capability registers after the initial
configuration snapshot has been saved. A later driver reprobe restores
that snapshot and can silently undo the adjustment.

Update the cached Device Control and Root Control bits together with
pcie_adjust_config() writes. Route the persistent Maximum Read Request
setter and the bus-owned AER control changes through that helper as
well, so they share the same restore semantics as MPS reconciliation.

Document the persistent-write contract. Merge only explicitly adjusted
bits into the saved image so unrelated or transient bits observed during
the hardware read-modify-write cannot become persistent.

(cherry picked from commit a9752e9ac8a635f49ca058dd7268298840c7e915)
2026-09-23 11:58:16 +02:00
John Baldwin
1e7a1849a5 sys: Use is_pci_device instead of direct comparisons to devclasses
Reviewed by:	bz
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D56997

(cherry picked from commit 6dc813301a173e2e1993c3064df162e6218c1231)
2026-09-23 11:30:15 +02:00
John Baldwin
db4e600872 pci: Add is_pci_device helper function
This returns true if a given device is a PCI device (child of a PCI
bus).

Reviewed by:	bz, kib
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D56996

(cherry picked from commit ffcf5e356644252f2f6c89ba01057af45c216559)
2026-09-23 10:52:51 +02:00
John Baldwin
070b6adf01 bus: Document special ranges of IVARs
Some IVAR indices are special in that they have global meaning across
multiple buses where as other IVARs are always private to the local bus.
Try to document this a bit and add constants for the various ranges to
avoid future conflicts.

This is a no-op, but IVAR indices are now generally defined as enums
as that makes it easier to define them in terms of ranges.

Reviewed by:	imp, royger, andrew
Differential Revision:	https://reviews.freebsd.org/D54159

(cherry picked from commit 6cf4e30252fe48b230b9d76cac20576d5b3d2ffa)
2026-09-23 10:52:48 +02:00
Kyle Evans
ed5b1f4fb4 pci: pci_host_generic: provide cleanup methods outside of detach
If device_attach() fails, we're expected to actually cleanup after
ourselves because device_detach() will not be called.  Factor out the
cleanup bits that don't rely on attach having actually succeeded so
that we can cleanup properly in bcm2838_pci.

Reviewed by:	andrew, imp

(cherry picked from commit 31a94ec32b53ebf6227bc868ce4f7aa07650680d)
2026-09-23 10:52:48 +02:00
Gisle Nes
94da6be5e6 pci: use uint32_t for eecp
eecp holds the extended capability offset. If that offset is larger
than 0xff, storing it in uint8_t truncates it, which can make the
early EHCI/XHCI capability walk read the wrong location and loop during
boot.

Seen on AMD device 1022:151e, where HCCPARAMS1 = 0x0118ffc5 and the
first xHCI extended capability offset is 0x460. Widen eecp to uint32_t
in xhci_early_takeover(), matching xhci_pci_take_controller().

Signed-off-by: Gisle Nes <gisle@gisle.net>
Reviewed by:    zlei, aokblast
MFC after:      3 days
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2127
Closes:         https://github.com/freebsd/freebsd-src/pull/2127
(cherry picked from commit 555ffd9022de0c497881bafc413e3e1d05af10d4)
2026-09-23 10:52:48 +02:00
Bjoern A. Zeeb
6b68108147 net80211: define a type for rssi values
Due to net80211 keeping values in 0.5dBm relative to the noise floor
an int8_t is not good enough to prevent a double wrap around, which
means the reported rssi values can be wrong (see D50928 or likely
a commit in the future for more information).

In order to address the problem and not break the userspace API,
start by defining a type within the kernel and use that.  In a
next step we will then update the int8_t to int16_t to avoid the
problem up to the ioctl code.  This will then allow us to work
on the the user space API indepedently (see PR 293016 for possible
impact outside the base system).

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D57021

(cherry picked from commit 96eaa6857ffe009c141c5a6dbea88f96efed9b2d)
2026-09-23 09:08:44 +02:00
Kevin Bowling
7edf126e6c ixl: Honor iflib transmit completion batching
ixl uses head writeback by default.  Hardware publishes the transmit
ring head through DMA only after completing a descriptor marked RS.
Marking every packet requested much more frequent head updates than
iflib needs to reclaim descriptors.

iflib marks selected packets with IPI_TX_INTR as completion
checkpoints.  It forces a checkpoint as deferred work or ring pressure
grows.  Retain EOP on every packet, but set RS only at those
checkpoints.  This batches head writebacks while preserving bounded
descriptor reclamation.

The optional descriptor writeback mode benefits as well.  ixl already
recorded only IPI_TX_INTR descriptors in its report-status queue, so
status written for every other packet was not inspected.

DPDK uses the same sparse RS design.  Let iflib choose the adaptive
interval for FreeBSD.  This is a PCIe/memory bandwidth savings.

(cherry picked from commit dd32931271c784caf2c51e27f24514093b81429c)
2026-09-23 08:56:31 +02:00
Kevin Bowling
ceb7c0a7cc ixl: Fix build after VF reset changes
VF_FLAG_INITIALIZED belongs to the SR-IOV status-reporting interface,
which was not merged to stable/15.  The VF reset MFCs accidentally kept
two status-only clears without the flag definition or the corresponding
set operation.

Remove the clears rather than pulling the unrelated reporting interface
into stable/15.  They do not participate in hardware reset sequencing.

Fixes:		d252dd2a841c ("ixl: Rebuild VF resources after a PF reset")
Fixes:		1319574637fb ("ixl: Quiesce VF DMA before a PF reset")
2026-09-23 08:56:17 +02:00
Kevin Bowling
fe7843e0f0 ixl: Avoid a signed PHY capability shift
The PHY capability display examines all 32 bits of the firmware bitmap.
Use an unsigned value so examining bit 31 does not shift a signed
integer into its sign bit.

(cherry picked from commit f7427f890c7f34d0842a35eb9df814adad11a95a)
2026-09-23 08:55:11 +02:00
Kevin Bowling
179c389d84 ixl: Add led(4) identification support
Expose each physical port identification LED through /dev/led/ixl*.
Use the existing GPIO LED helpers for most devices and the PHY
provisioning interface for X710 10GBASE-T adapters.

Preserve and restore the original GPIO or PHY indication mode,
including before the interface is stopped.

(cherry picked from commit 8b2e75970c0328e7397290417cc06e9d9c763d2a)
2026-09-23 08:54:07 +02:00
Kevin Bowling
6ef997c047 ixl: Quiesce VF DMA before a PF reset
A PF reset has a warning interval before the hardware reset begins.
Cooperative VF drivers respond to the reset event by stopping and
releasing their receive buffers, but notifying VFs did not stop the
hardware queues.  An active VF could therefore DMA through its old
rings into freed mbuf clusters during the warning interval.

Put every enabled VF in reset, drain its PCIe transactions, disable its
queues, wait for receive queue shutdown, and drain transactions again
before tearing down the PF HMC and AdminQ.

Hold VFs in reset again while rebuilding the firmware topology.  Release
VF reset before programming the replacement VSI and queue mappings,
since VF reset clears those registers, and publish VFACTIVE only after
reconstruction succeeds.  Leave a VF held in reset if rebuilding it
fails.

Fixes:		983e628a0c47 ("ixl: Rebuild VF resources after a PF reset")

(cherry picked from commit 0048dfddc049f3ef050ba16544f42503d5c42db8)
2026-09-23 08:52:03 +02:00
Kevin Bowling
dda939de39 ixl: Track and recover MDD-blocked VFs
The hardware identifies each VF with TX and RX malicious-driver
status latches, but the driver combined all events into one counter
and reported only the last VF found.  It also did not record that
hardware had blocked the VF, leaving the condition invisible to
management tools.

Consume every PF and VF latch, keep per-direction VF counters,
rate-limit per-VF diagnostics, and report the blocked and
traffic-enabled state via the VF status interface.  Clear the
software block only after a successful VF or PF reset reconstructs
its resources.

Match Linux i40e policy by leaving a detected VF blocked by default.
Add an opt-in hw.ixl.mdd_auto_reset_vf tunable that notifies and
resets the VF for installations that prefer availability.  DPDK
provides the register clear and per-VF attribution precedent; Linux
provides the recovery policy.

(cherry picked from commit 93f1065920d806400ace6b60b025faf91926bdaa)
2026-09-23 08:51:42 +02:00
Kevin Bowling
b86fcb4ad3 ixl: Report PF initialization failures to iflib
ixl_if_init() returned early after AdminQ reconstruction, LAA, or
VSI initialization failures.  Since IFDI_INIT has no return value,
iflib then marked the interface RUNNING and enabled its interrupts
and timers despite the incomplete hardware state.

Use iflib_init_failed() on each incomplete path.  Also stop at the
first ring-enable error and tear down any partially enabled rings
before reporting failure.  This keeps the interface stopped and
makes a later initialization attempt start from a bounded state.

(cherry picked from commit f008b582c9f1e1a636e88a5f330ff3a167094440)
2026-09-23 08:51:32 +02:00
Kevin Bowling
380ab39b00 ixl: Rebuild VF resources after a PF reset
A PF or EMP reset destroys the firmware switch topology, including
every VF VSI.  The driver rebuilt only its PF VSI and left configured
VFs with stale switch element and VSI identifiers.

Notify VFs before a driver initiated reset, recreate the IOV VEB, and
rebuild each configured VF VSI and queue mapping after the PF switch
is restored.  Keep a VF out of VFACTIVE if its reconstruction fails
so one failure cannot expose incomplete resources or prevent the PF
and other VFs from recovering.

Invalidate cached VF firmware identifiers and runtime state before
recreating the VEB.  If VEB creation itself fails, teardown and mailbox
paths can no longer use pre-reset SEIDs or VSI data.

Factor the common VEB setup out of IOV initialization so initial
setup and post-reset reconstruction use the same topology and filter
sequence.

(cherry picked from commit 983e628a0c47afb47d201ce629e9619fb751254d)
2026-09-23 08:51:20 +02:00
Kevin Bowling
e2f7dbfd2e ixl: Enforce VF VLAN policy
Add access and trunk VLAN policy to the SR-IOV schema.  Access VFs
use a hardware PVID and cannot alter their VLAN membership.  Trunk VFs
may register up to 16 VLANs, while VLAN 0 remains implicitly admitted
for untagged and priority-tagged traffic.

Enable hardware VLAN anti-spoofing and maintain the MAC-by-VLAN filter
cross-product used by DPDK.  Apply Linux's untrusted-VF limits of 18 MAC
addresses and 16 VLANs so one guest cannot consume the shared PF filter
table without bound.

Report the effective policy through the VF status interface and document
the iovctl schema.

Relnotes:	yes

(cherry picked from commit e2daa5c06c2febacf141f9fd3a6a18cf86df8fe1)
2026-09-23 08:51:20 +02:00
Kevin Bowling
e31e97a224 ixl: Make VF reset resource reconstruction fallible
Treat each stage of VF reset and VSI reconstruction as fallible.  Keep
the VF out of VFACTIVE when PCIe drain, reset completion, VSI
release, or VSI allocation fails, following the DPDK PF reset model.
Propagate initial reset failures back through pci_iov_vf_add and unwind
the VF queue allocation.

Free the old software filter list before initializing a replacement VSI.
ixl_init_filters() previously replaced the list head without freeing its
entries, so every VF FLR leaked all MAC and VLAN filter objects.  Reset
the associated counters and VLAN bitmap with the list.

Avoid allocating an initial VSI only to destroy it during the required
initial VF reset, and remove redundant broadcast/filter programming from
VSI setup.  Also delete a partially created VSI when later Admin Queue
setup fails.

(cherry picked from commit ee52b925fa08158e510d5dddfd1c8fa26f120575)
2026-09-23 08:50:58 +02:00
Kevin Bowling
af2890a6aa ixl: Validate VF virtchnl configuration
Bound variable-length virtchnl messages before computing their expected
length, following the newer Intel virtchnl implementation.

Validate VF ring sizes and alignments before programming HMC contexts.
DPDK uses 128-byte ring alignment and 64 through 8160 descriptors;
the virtchnl ABI further specifies TX multiples of 8 and RX multiples
of 32.  Preserve the 4096-descriptor limit on X722.

Validate queue bitmaps before changing any rings, validate all queue
and interrupt contexts before applying a request, and reject invalid
RSS table entries.  Also avoid sending an ACK after VLAN-strip setup
fails and reply to delete-VLAN errors with the correct opcode.

These checks prevent malformed or oversized requests from an untrusted
VF from partially programming resources outside its allocation.

(cherry picked from commit e779914354db5cb3a20f4ec894d08b0f81d05ba2)
2026-09-23 08:50:57 +02:00
Kevin Bowling
3101cf03c8 ixl: Initialize VF sysctl contexts before use
The VF array is zeroed at allocation, but its sysctl contexts were
only populated after each VF was successfully added.  If VF setup
failed, IOV teardown still passed every requested VF context to
sysctl_ctx_free().  An untouched context is not an initialized empty
TAILQ and caused a page fault during teardown.

Initialize every VF context with the array so both successful setup
and partial-failure cleanup have a valid lifetime.

(cherry picked from commit ae122c5443882ae4d3d19aacfcfd16a2c8d7b688)
2026-09-23 08:50:40 +02:00
Kevin Bowling
20da00c48f ixl: enforce the assigned VF MAC address
When allow-set-mac is disabled, the MAC filter validation condition
rejects the assigned VF unicast address while allowing any different
unicast address. The equality test was accidentally inverted when this
code moved to the boolean address helper.

Accept multicast and the assigned unicast address, and reject other
unicast addresses as intended.

Fixes:		7d4dceec10 ("ixl(4): Fix VLAN HW filtering")

(cherry picked from commit d2309d9d6dc6d5a9141314652d6c96ab46a9a62c)
2026-09-23 08:50:40 +02:00
Kevin Bowling
e2976062f9 ixl: Reset VSI statistics after initial sampling
The initial statistics update runs before the PF VSI has obtained its
firmware-assigned statistics counter index.  Discard that provisional
VSI baseline so the first update after initialization records the
correct hardware counter.

Without this reset, subtracting a larger provisional value from a newly
selected counter can be mistaken for a 32-bit wrap and report nearly
UINT32_MAX receive drops immediately after boot.

Reported by:	Daniel Braniss <danny@cs.huji.ac.il>
Tested by:	Daniel Braniss <danny@cs.huji.ac.il>
Obtained from:	Intel ixl 1.14.2
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D59336

(cherry picked from commit 429cb537015ea11808de23dac8c1cc7ade3a4552)
2026-09-23 08:49:14 +02:00
Kevin Bowling
b3a89d275d ixl: Route suspend and resume through iflib
Register the iflib device suspend and resume methods.  Remove the
direct initialization from the driver resume callback because
iflib_device_resume() performs the datapath restart after the callback
returns.

Sponsored by:	BBOX.io

(cherry picked from commit d5aa8022da56c5188e9f2c7068d95009ff2019be)
2026-09-23 08:49:02 +02:00
Kevin Bowling
c9ebaf98e9 ixgbe: Correct Wake-on-LAN configuration
Wake-on-LAN capability was inferred from NVM bits on every MAC even
though 82599 support is board and sometimes port specific.  Private
sysctls formed a second policy interface, and the driver neither
coordinated the controller wake source with PCI PME nor reliably
rebuilt address filters erased by the stop-time reset.

Use the standard ifconfig wake capabilities.  Derive support from the
82599 board and port matrix or the X540-and-newer NVM capability.
Require D3hot PME support, and use the NVM APME bit only to select the
initial magic-packet policy after initializing the LAN function number.

Snapshot requested filters before the terminal stop so shared reset and
PHY code sees the active wake policy.  After reset, restore RAR0, the
multicast table, receive filtering, and the optical laser before arming
WUFC, WUC, and PCI PME.  Remove device wake sources before clearing PCI
PME on detach, resume, and when wake is disabled.  Clear autonomous APM
so ifconfig remains authoritative.

Treat X550EM low-power-link-up failure as best effort and allow shutdown
to continue after a wake-programming error.

The 82599, X540, X550, and E610 datasheets document the standard ACPI
wake filters used here; the E610 ACPI path includes magic-packet wake.

Validated on a dual-port E610.  Both ports completed three direct-D3
cycles covering wake disabled and magic-packet wake armed.  A system S3
cycle woke through ix0 with WUS 0x00000002 (magic packet).  Link and
traffic recovered after each transition.

Note that many add-in cards in this family do not support WoL; LOM and
OCP cards are more likely.  The E610 as tested does.

Sponsored by:	Dirk-Willem van Gulik from Web Weaving (E610 hardware)
Sponsored by:	BBOX.io

(cherry picked from commit c004384343bece0b984cfe3520ec077ef2483e1f)
2026-09-23 08:48:03 +02:00
Kevin Bowling
8d203db2d4 ixv: Wire iflib suspend and resume methods
Register the standard iflib device suspend and resume methods so the
framework reinitializes the VF datapath after a system power
transition.

Sponsored by:	BBOX.io

(cherry picked from commit 10d09e6e8a7ff141b5dc39e6ddca5b7c2cb0b66b)
2026-09-23 08:46:23 +02:00
Hareshx Sankar Raj
5f261ee00d qat: driver updates to enhance qat infrastructure
- Updated QAT infrastructure FW version/AE mask/num_banks fields
  to facilitate integration of future QAT products.
- Exposed service as sym;asym instead of cy for gen4
- Enhanced cpaGetInstances() for accurate instance retrieval
- Added 57-bit virtual address support to lac_lock_free_stack
- Minor bug fixes and improvements

Signed-off-by: Hareshx Sankar Raj <hareshx.sankar.raj@intel.com>

Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D57746

(cherry picked from commit 682f135f5de39cfc24cfd529ea8a161e94c76c8e)
2026-09-13 13:58:02 +02:00
Krzysztof Galazka
a6b97d3e1b ice(4): Add two more 4-part IDs for E835 adapters
Two additional subdevice IDs were introduced
to distinguish between adapters with and without
manageability over USB support.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>

Reviewed by:	erj
Tested by:      Mateusz Moga <mateusz.moga@intel.com>
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D57337

(cherry picked from commit f370d9e4d5844daa06d77e57236e03bd7c5f4ba1)
2026-09-13 13:53:23 +02:00
Pawel Sobczyk
716a3c00e9 ice(4): Add support for E835 CNSA 2.0 adapters
Added support for E835 adapters with post-quantum cryptographic (PQC)
algorithms in firmware/software signage and in SPDM attestation.

Signed-off-by: Pawel Sobczyk <pawel.sobczyk@intel.com>

Reviewed by:	Miłosz Linkiewicz <milosz.linkiewicz@intel.com>
Differential Revision:	https://reviews.freebsd.org/D57868

(cherry picked from commit 8194c32827e9c3867d4b295edca9842b71608526)
2026-09-13 13:53:15 +02:00
Kevin Bowling
3b63e75ca9 ice: Report initialization failures to iflib
The primary and mirror-VSI ifdi_init callbacks can return early when
reset state or hardware queue and filter setup prevents initialization.
Iflib then marks the interface running and enables interrupts although
the driver did not finish bringing it up.

Report each non-detach failure through iflib_init_failed().  Keep the
existing ice reset and subinterface-reinitialization machinery
responsible for scheduling recovery.

(cherry picked from commit dcdc00a41d3e4be0e75eb625cd3a23d5a927ed15)
2026-09-13 13:52:10 +02:00
Kevin Bowling
a5f6cebe39 ice: Add led(4) identification support
Expose the firmware-controlled physical port identification LED
through /dev/led/ice*.  Use the AdminQ port-identification command to
select blinking mode and restore the netlist-selected original mode
before the interface is stopped.

Sponsored by:	BBOX.io

(cherry picked from commit a781965b91ea390f9576ae42c35c842db74aab86)
2026-09-13 13:51:31 +02:00
Kevin Bowling
b8a3d9c626 e1000: Report corrected LAN management FIFO ECC errors
I350 and I354 report a corrected ECC error in the LAN transmit
management FIFO through LANPERRSTS bit 16.  Unlike the parity status in
the same register, this condition neither interrupts nor stops traffic.

Poll the latch with the other corrected error status, increment a
dedicated counter, and clear only its RW1C bit.  Expose it as
dev.igb.N.memory_errors.corrected_lan_mng_fifo.

Fatal error handling returns before the periodic statistics sweep and
may reset the device.  Drain all I350 and I354 corrected-error status in
the admin task before recovery so the reset does not discard pending
indications.

This follows section 6.21.16 of the Intel Atom Processor C2000 Product
Family Integrated GbE Controller Programmer's Reference Manual,
document 537426 revision 1.5.

Sponsored by:	BBOX.io

(cherry picked from commit 2f095faebb195735879d9caad164ce807d85ddf7)
2026-09-13 13:49:24 +02:00
Kevin Bowling
fb68099015 e1000: Handle I354 internal memory errors
The Atom C2000 integrated GbE programming reference documents the I354
internal memory error architecture.  It shares the I350 PEIND and
ICR.FER routing, DMA and packet-buffer status, LAN parity status, and
required reset recovery.

Extend the existing I350 recovery and corrected error accounting paths
to I354.  Keep the PCIe corrected error mask family-specific.  C2000
PCIEECCSTS ends at the transmit write-data indication in bit 4 and does
not implement the I350 retry buffer indication in bit 5.  Do not expose
the corresponding retry counter on I354.

The PRM overview says a PCIe region failure requires a system reboot,
while the individual PCIEERRSTS fields prescribe CTRL.RST followed by
port reinitialization.  Use the register specific recovery, matching the
existing I350 path; failed reinitialization still leaves the port down.

This follows sections 5.6 and 6.21 of the Intel Atom Processor C2000
Product Family Integrated GbE Controller Programmer's Reference Manual,
document 537426 revision 1.5.

Sponsored by:	BBOX.io

(cherry picked from commit 5b4a7fd9378abba882a87330af31351c6353aea7)
2026-09-13 13:49:21 +02:00
Kevin Bowling
332d07c446 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@broadcom.com>
Sponsored by:	BBOX.io

(cherry picked from commit 98b5640786f874949e441bee7c4ad5740cd6a649)
2026-09-11 10:53:05 +02:00
Kevin Bowling
e4f36724d2 bnxt: Report initialization failures to iflib
HWRM failures currently return from the void ifdi_init callback.
iflib then marks the interface running and enables interrupts despite an
incomplete ring or VNIC setup.

Move the hardware setup into an error-returning helper.  The ifdi_init
wrapper can report failure through iflib_init_failed(), while firmware
recovery can propagate the same error through bnxt_open().  Also clear
the initialized state after partial setup is torn down.

(cherry picked from commit cb0e8f5fb6de03428137c096b1c8b62710829029)
2026-09-11 10:52:55 +02:00