pmc(8): revert unnecessary lvalue reference change from prior commit
I need to do more work before references can be accepted in other
sections of the code. This was an unnecessary drive-by change that was
not tested in `make universe`.
Reported by: CI
Fixes: fd809148 ("pmc(8): resolve -Wshadow issues")
ixgbe: supply PF transmit contexts under SR-IOV
X550-family malicious-driver detection validates the transmit
context selected by a data descriptor with Check Context set. ixgbe
sets that bit on every transmit data descriptor, but ordinary PF
packets without a VLAN or checksum offload do not create a context
descriptor. The empty context then reports an invalid MAC-header
length and blocks the PF queue as soon as MDD is enabled.
Create the existing context descriptor for every PF packet while
SR-IOV is active. This supplies the required MAC-header length and
keeps MDD from mistaking normal PF traffic for a malicious-driver
event.
(cherry picked from commit 0787b1f5b8bdfcaed97eeee7bfbd7f14ac162b0d)
ixgbe: supply PF transmit contexts under SR-IOV
X550-family malicious-driver detection validates the transmit
context selected by a data descriptor with Check Context set. ixgbe
sets that bit on every transmit data descriptor, but ordinary PF
packets without a VLAN or checksum offload do not create a context
descriptor. The empty context then reports an invalid MAC-header
length and blocks the PF queue as soon as MDD is enabled.
Create the existing context descriptor for every PF packet while
SR-IOV is active. This supplies the required MAC-header length and
keeps MDD from mistaking normal PF traffic for a malicious-driver
event.
(cherry picked from commit 0787b1f5b8bdfcaed97eeee7bfbd7f14ac162b0d)
e1000: Correct 82542 flow-control mode handling
The 82542-specific setup routine unconditionally reads the NVM
default, overwriting a flow-control mode selected by software. It
also removes transmit PAUSE support from all 82542 revisions even
though the hardware restriction applies only to rev 2.0.
Resolve the NVM default only when requested, scope the transmit
restriction to rev 2.0, and replace integer bit masking of the enum
with explicit valid mode transitions. This restores the behavior
from before the Intel shared-code split and resolves -Wassign-enum.
Reported by: glebius
MFC after: 2 weeks
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.
MFC after: 2 weeks
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.
MFC after: 2 weeks
ixgbe: Enable PF RSS across queues with SR-IOV
PSRTYPE is indexed by pool in VMDq+RSS mode, and its RQPL
field selects the number of receive queues available within the pool.
The PF occupies the last pool, but the driver programmed pool zero and
left the PF RQPL value at zero. As a result, all PF receive traffic
was directed to its first queue while SR-IOV was enabled.
Program PSRTYPE for the PF pool and encode its allocated receive queue
count.
MFC after: 2 weeks
ixv: Recover when the PF mailbox is unavailable
A failed VF reset or mailbox API negotiation currently returns from
the void ifdi_init callback. Iflib then marks the interface running
even though ixv left its adapter stopped. Stopped media queries can
continue polling the PF, and no timer remains active to retry when the
PF returns.
Track mailbox readiness and report unsuccessful initialization to
iflib. Stopped admin and media-status passes now publish cached
link-down state without touching the mailbox. While the VF remains
administratively up, retry complete initialization after 250 ms, one
second, four seconds, and then at a capped eight-second interval.
Preserve the requested MAC across reset, then program it once after
mailbox API negotiation. The previous two pre-reset requests each
could wait a full mailbox timeout after an established PF disappeared,
holding the iflib context lock for about two seconds before the reset
handshake.
[8 lines not shown]
igbv: Recover when the PF mailbox is unavailable
A VF reset can sanitize its retained queue registers even when the PF
does not complete the cooperative mailbox handshake. Keep those two
states separate. Do not program or enable the rings until both queue
sanitation and mailbox initialization have succeeded.
Report either initialization failure to iflib so the interface remains
stopped. Stopped admin and media-status passes now publish cached
link-down state without polling the mailbox. While the VF remains
administratively up, retry complete initialization after 250 ms, one
second, four seconds, and then at a capped eight-second interval.
Conditional iflib reset requests ensure an intervening administrative
down cancels a queued retry.
Avoid a redundant mailbox reset in the stop half of an immediate iflib
reinitialization; the following init performs the required reset.
Preserve the reset on an ordinary administrative stop and keep the
existing bounded queue-sanitation retry policy independent from
mailbox liveness recovery.
iflib: Support recoverable initialization failure
The ifdi_init method cannot report an error, so iflib always marks an
interface running and enables its interrupts after the callback returns.
Drivers whose hardware initialization depends on an unavailable peer can
only return early and leave a falsely running interface.
Add iflib_init_failed() so a callback can leave the interface stopped.
Also add a conditional reset request for asynchronous recovery: it is
discarded if the interface is administratively down when the admin task
runs, preventing a queued retry from resurrecting a stopped interface.
Do not restore saved driver flags after an MTU or capability change when
initialization failed. Restoring the pre-init flags would overwrite the
stopped result with stale RUNNING state.
Document that reset requests require the caller to schedule the admin
task, that output remains blocked during recovery, and that iflib rather
than the driver owns the driver flags.
[2 lines not shown]
cpuset(9): correct markup
- Remove `\(em` from .Nm section as it's not valid mandoc markup.
- Remove the section from the .Nm directive (it's handled under the .Dt
directive).
MFC after: 1 week
Reported by: make manlint
pmc(8): add missing headers to not rely on header pollution
This mutes a number of complains from g++ about needing specific headers
for functionality related to C strings and other function prototypes.
Reported by: g++ 14
pmc(8): resolve -Wshadow issues
- Prefix all structs with the struct keyword to avoid collisions between
the types and variables with the same "name".
- Use `_` suffixed variables in initializers to distinguish input
parameters from public members [1].
Resolve some trailing whitespace issues while here.
NOTE: this doesn't resolve the -pedantic issue reported by g++ with
`pmchdr_cpuidinfo::cpuid` about the field being a flexible array in an
otherwise empty struct.
1. I generally do this the other way around, i.e., suffix private/protected
members with `_`, but these are public members in structs and I don't want
to introduce a lot of churn in calling code.
Reported by: g++14 with FreeBSD CI (powerpc64 tinderbox)
Fixes: ce6ab51f ("pmc: enable the new pmc commands")
aq(4): report link transitions and previously silent failures
A link flap left nothing in the log to work from. Both the link up and
link down messages were gated on bootverbose while the message for a
speed change that keeps carrier was not, so a default kernel was silent
about a flap yet loud about a downshift -- the inverse of what an
operator wants. The generic message from if_link_state_change() carries
no speed, so gating the driver's own left the negotiated rate
unrecorded. Report both transitions unconditionally.
Say more than the rate. aq_hw_get_link_state() already negotiates flow
control and throws it away, and Atlantic 2 reports duplex and EEE in the
same link status word the rate comes from; decode them through a new
get_link_info firmware op and name all of it on the up transition. EEE
matters for a flap: low power idle transitions are a common source of
marginal link trouble on multi-gigabit copper, and whether it was active
is otherwise invisible.
Give the down transition a cause. The PHY global fault code was only
[73 lines not shown]
libpmc: Fix AMD L3 counter parameter parsing
Fix two small bugs affecting the event parsing of AMD L3 counters.
AMD's manual and JSON disagree about the naming scheme on recent
processors. I use the naming scheme present in the recent PPRs to be
consistent, so in the JSON parser we rename 'allslices' to 'allsources'
just as we already do with sliceid and sourceid. Also ensure that we
parse the 0x prefix present in the newer JSON files.
Reviewed by: mhorne
Sponsored by: Netflix
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/2180
video: disable the static assertions for now
The previous version of this work included the definitions but
not the static asserts. It's tripping up in some CI builds, likely
due to compat API building.
Since this isn't any more or less broken than before, disable the
static assertions until we figure out a proper path for this.
Fixes: 9c9428825f4c55e3cb37412c661bb9d385db4c68 (video: add generic video(4) capture framework)
fwcam: release the IR DMA channel when starting the stream fails
Disabled the IR DMA channel on the error path, which clears the flag and
frees the descriptor blocks before the chunks go away.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58502
uvideo: limit isochronous transfers to 32 frames
Raising UVIDEO_NFRAMES_MAX from 40 to 128 in 3b6f833c95eb improved
throughput on xhci but made every camera on an ehci bus fail to
stream. Integrated webcams became unusable.
Measured on a MacBookPro9,2 with two ehci(4) FaceTime HD cameras and an
xhci(4) Logitech C920:
128 32
ehci, 12 captures 0 ok 12 ok
xhci 1920x1080 5 fps 5 fps
xhci 1280x720 10 fps 10 fps
Fixes: 3b6f833c95eb
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D58501
fwcamctl: remove, superseded by the video(4) interface
fwcam(4) no longer creates its own character device or implements the
FWCAM_* ioctls; it registers with video(4) and is driven through the
standard V4L2 interface on /dev/videoN.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58500
video: add generic video(4) capture framework
Add a new video(4) framework that provides /dev/videoN, buffer
management, mmap lifetime, and V4L2 ioctl dispatch for video capture
drivers. Hardware drivers implement struct video_hw_ops callbacks
and use video_buf_acquire/write/done to deliver frames.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58367
pci_iov: Use native types for status ioctl
IOV_CONFIG and IOV_GET_SCHEMA expose native pointers and size_t
lengths, and pci_iov has no compat32 ioctl translation. Using
fixed-width fields for IOV_GET_STATUS alone does not make the
interface usable by 32-bit binaries on a 64-bit kernel. It instead
complicates otherwise ordinary pointer and length handling.
Use void * and size_t like the existing ioctls. This also makes the
%zu diagnostic in iovctl correct on ILP32 and removes the unneeded
PTRIN conversion.
Fixes: 6f8b3be1fbd6 ("pci: Add SR-IOV status reporting")
iflib: Avoid locking for unsupported VF status queries
ifconfig -v requests SR-IOV VF status from every interface. iflib
previously acquired the context lock before dispatching the request even
for VFs and drivers using the default unsupported method. Mailbox work
on a VF could therefore delay the complete interface listing.
VF status describes the children of an SR-IOV PF. Reject requests on
VF contexts and classes using the default method without taking the
context lock. Keep the lock for actual PF status providers.
Fixes: 1ccf543b21ef ("ifconfig: Add SR-IOV VF status output")