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")
libgcc_s: export the IEEE-128 long double runtime on powerpc64le
On powerpc64le with IEEE-128 long double, the long-double compiler-runtime
helpers are the *kf* soft-float functions (built from the tf sources,
renamed via -D in lib/libcompiler_rt/Makefile.inc) plus the complex
multc3/__divtc3. They are compiled into libgcc_s.so by the powerpc64le
SRCF block, but were never added to Symbol.map, so they stayed local and
unexported.
Every other IEEE-128 architecture already exports its scalar long-double
runtime -- aarch64 and riscv list the tf helpers in GCC_4.6.0. powerpc64le
was simply missed.
Because the helpers are unexported, any clang-built shared library that uses
long double leaves them undefined (permitted in a DSO), and linking an
executable against that DSO then fails under lld's default
--no-allow-shlib-undefined. For example science/harminv fails to link its
binary against its own libharminv.so with undefined multc3/divtc3; at
-O0, mulkf3/addkf3/__subkf3/__unordkf2 appear as well.
[8 lines not shown]
freebsd-tips: Tip about drivers licenses
Reviewed by: fuz, ngie
Co-authored-by: Robert Clausecker <fuz at FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D58727
ixgbe: Add missing mailbox API 1.6 definition
The SR-IOV status change reports mailbox API 1.6 but omitted its enum
definition, leaving main unable to compile.
API 1.6 is an established ixgbe mailbox wire revision. Add it at the
end of the revision enum, before the unknown sentinel as required by
the stable numbering contract. Naming the revision does not enable
negotiation or operations which will come with the E610 support.
Reported by: Herbert J. Skuhra <herbert at gojira.at>
Fixes: c30021fe0df9 ("ixgbe: Report SR-IOV VF status")
rescue: Satisfy libifconfig's libnv dependency in crunched links
libifconfig now calls nv(9) routines for the SR-IOV VF status query, so
crunched builds that link the static library must also provide libnv.
The per-program CRUNCH_LIBS_ifconfig hook cannot do this: crunchgen
partially links per-program libraries into the program object and
crunchide then localizes every symbol except the stub entry, so members
absorbed there cannot satisfy references from another archive on the
final link's library list.
List libnv globally next to libifconfig.a in rescue(8) and bsdbox. This
also makes the existing per-program libnv links redundant; remove them
to avoid embedding private localized copies in the crunched binary.
Fixes: 2d6114f6d26b ("libifconfig: Add an SR-IOV VF status query")
ixgbe: Report SR-IOV VF status
Expose cached VF configuration, policy, and runtime state through the
iflib VF status method. Include access or trunk VLAN mode, the queue
count selected by the current virtualization mode, negotiated mailbox
API, whether traffic is enabled, and the MDD-blocked and quarantine
state.
The query runs under the iflib context lock and does not issue mailbox
requests or read hardware registers.
igb: Report SR-IOV VF status
Expose the cached per-VF configuration through the iflib VF status
method. Report mailbox handshake state, MAC address, access or trunk
VLAN mode, hardware queue count, administrator policy, and MDD blocking
state without issuing mailbox requests or reading hardware registers.
rtnetlink: Report SR-IOV VF status
Honor RTEXT_FILTER_VF on RTM_GETLINK requests and expose the versioned
SR-IOV VF status through typed nested FreeBSD attributes. Report
IFLA_NUM_VF with a successful requested query and preserve per-provider
errors in the status container.
Map the common nvlist schema to native integer, boolean, string, and
binary attributes. Carry namespaced driver extensions as packed
versioned nvlists so adding a driver-specific field does not expand the
common netlink ABI.
Add SNL parsers, parser verification, a constructed nested-status test,
and an RTM_GETLINK test for an interface without SR-IOV support.
Document the query contract and every attribute.
ifconfig: Use nvlist to report SR-IOV VF status
Replace the records with a versioned nvlist transported through struct
ifreq, following SIOCGIFCAPNV. The network stack now packs and copies
results, supports bounded retry for larger results, and handles native
and 32-bit callers centrally. Drivers only populate a kernel nvlist
while their state is locked.
Define optional common fields for identity, configuration and handshake
state, VLAN policy, queue resources, runtime blocks, PF link state, and
namespaced driver extensions. Document the extension and versioning
contract and require providers to omit values they cannot observe.
Improve the ixl provider to track its mailbox handshake and report the
expanded common policy. Render the expanded status as grouped output
under ifconfig -v.
iovctl: Report SR-IOV status
Add -L to query the generic packed-nvlist IOV_GET_STATUS interface.
Report PF enable state and configured and total VF counts. For each VF,
print its PCI address, newbus attachment, bound driver, and ppt state.
Retry size negotiation if the topology changes between ioctls and reject
malformed or incompatible status records.
Keep NIC-specific operational state in ifconfig -v; iovctl owns the
device-neutral PCI topology and applies to any SR-IOV device class.
Relnotes: yes
pci: Add SR-IOV status reporting
Add a generic packed-nvlist status query to each /dev/iov/<PF>
control device. Report the live VF Enable state, configured and total
VF counts, and one record for each configured VF.
Each VF record contains its PF-local index, computed PCI location,
newbus attachment state, attached driver, and ppt binding. Construct
records for hardware VFs whose newbus child is absent so attachment
failures remain visible.
Version the extensible schema in sys/iov.h. Use fixed-width request
fields so the ioctl command and layout are identical for 32-bit callers.
Serialize the topology snapshot with Giant, then pack and copy it after
releasing Giant.
libifconfig: Add an SR-IOV VF status query
Provide a public helper which retrieves, unpacks, and validates the
versioned VF status nvlist. Validate the required VF indices and the
shape and version of driver-specific extension namespaces while allowing
unknown optional fields.
The ioctl argument is not copied back when the command returns EFBIG.
Start with a practical buffer and grow it geometrically rather than
relying on the required length being observable.
Use the helper in ifconfig so other consumers share the same transport
and validation behavior.
ifconfig: Add SR-IOV VF status output
- Adds SR-IOV VF status to the existing ifconfig "-v" output
- Adds ioctl command for reporting VF status info from drivers
- Adds support to iflib for drivers to handle this new ioctl
- Add support for ioctl in ixl(4)
Signed-off-by: Eric Joyner <erj at freebsd.org>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D19647
igbv: Do not replay VLANs while stopped
iflib clears IFF_DRV_RUNNING before the driver stop callback but leaves
IFF_DRV_OACTIVE set. Consequently, an already queued admin task can
run after the VF reset. If that task consumes a pending timer sample,
it can retry failed VLAN mailbox operations and restore PF filters for
the stopped VF.
Continue sampling statistics, but only run the VLAN retry worker while
the interface is running.
vfs_mountroot: unmute console in interactive prompt
If boot_mute is set the system appears to hang during the mountroot
prompt. Temporarily unmute the console so the prompt is visible.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D58549
(cherry picked from commit e96f1cbd690e68594fc8812de634f43c6711aa97)
ixv: Negotiate VF queue-set limits
ixv uses one queue set on 82599 and X540 VFs and assumes two on
X550-family VFs. The PF reports the queues assigned to each VF with
GET_QUEUES after mailbox API 1.1 negotiation.
Query the PF during attach. Bound symmetric iflib queue sets by the PF
grant and available MSI-X data vectors. Retain one queue set per data
vector: ixgbe VFs expose at most three vectors and one is reserved for
the mailbox. The hardware permits each pool to use a subset of its RSS
queues, so a two-queue ceiling is valid when the PF assigns four.
This enables the second data vector on 82599 and X540 while avoiding an
assumed second queue when an X550-family VF is granted only one. Keep
the existing family limits if the mailbox is unavailable or the PF uses
an older API.
MFC after: 2 weeks
ix/ixv: Match Tx writeback thresholds to iflib
PTHRESH controls when the device prefetches transmit descriptors,
HTHRESH controls how many host descriptors must be ready, and WTHRESH
controls completion writeback batching.
iflib places RS on selected descriptors and reclaims through those
checkpoints. The data sheets require WTHRESH to be zero when software
uses RS. Clear WTHRESH while retaining the established PTHRESH 32 and
HTHRESH 1 fetch policy.
This also follows DPDK in pairing sparse RS descriptors with
WTHRESH zero. DPDK defaults to 32/0/0, while Linux ixgbevf uses
32/1/8. The 32/1/0 setting preserves FreeBSD's prefetch policy and the
data-sheet requirement that HTHRESH be nonzero when PTHRESH is used.
MFC after: 2 weeks
igc: Correct descriptor control programming
The transmit-ring setup was copied from the e1000 path. On I225
and I226, bits 22 through 24 are reserved and bit 25 enables the
queue; it is not a legacy low-water threshold. Correct the field
masks, remove the nonapplicable legacy definitions, and program only
defined fields.
Use PTHRESH=8 and HTHRESH=1. Keep WTHRESH at zero so the hardware
honors sparse RS descriptors issued by iflib. Linux and DPDK use a
writeback threshold of 16, but request status on every packet. A
nonzero threshold makes hardware ignore individual RS bits and is
unsuitable for the iflib completion model.
The receive-ring setup likewise used a magic mask that left bit 20
of the five-bit WTHRESH field untouched. Define the receive threshold
fields and replace them exactly before installing the established
PTHRESH=8, HTHRESH=8, WTHRESH=4 policy.
MFC after: 2 weeks
igb: Program Rx descriptor thresholds by family
82576 specification-update erratum 26 says MSI-X EITR expiration can
fail to trigger receive descriptor writeback. A WTHRESH above one can
therefore leave received packets invisible until the threshold fills.
The shared threshold macros selected policy by enum ordering, so an
82576 VF fell into the generic WTHRESH=4 case. VFs always use MSI-X
and require the same WTHRESH=1 workaround as the PF.
Use PTHRESH=8 for 82575 and 82576 PFs and VFs, matching DPDK and the
current Linux PF driver. The legacy FreeBSD PF and Linux igbvf value
of 16 thrashes limited descriptor cache; no specification or erratum
requires it. Retain the i354 PTHRESH=12 exception.
Enumerate every supported igb PF and VF MAC type so each receives its
intended policy. Also clear every threshold bit before installing the
new values. The old mask retained the high WTHRESH bit, and 82575
uses six-bit fields while later controllers use five-bit fields.
[2 lines not shown]
igb: Match Tx descriptor control to iflib
iflib requests transmit completion status only on selected descriptors.
Program a zero writeback threshold so igb hardware honors those sparse
RS bits instead of writing back every descriptor in threshold-sized
batches.
Use the existing family specific prefetch threshold: eight descriptors
on most controllers and 20 on I354, with a host threshold of one. These
values match the Intel-derived Linux and DPDK drivers. Their nonzero
writeback settings are not appropriate here because those drivers set
RS on every packet.
A zero writeback threshold also avoids depending on interrupt timer
flushes affected by 82576 specification update erratum 26. Remove the
old IGB_TX_WTHRESH macro as well. It has had no callers since the iflib
conversion, so its 82575 conditional no longer implements any policy.
MFC after: 2 weeks
e1000: Correct Rx descriptor threshold programming
Jumbo receive tuning on integrated controllers enabled PTHRESH without
a nonzero HTHRESH, contrary to the hardware programming requirements.
It also covered only the integrated MAC generations present when the
workaround was added. Enumerate every jumbo-capable ICH and PCH type
and program PTHRESH=3 with HTHRESH=1. Linux fixed the same HTHRESH
omission in b701cacdbcfb.
The 82574 path combined threshold values with the reset values using
bitwise OR. Requesting WTHRESH=4 while the reset value was one thus
programmed five. Clear the complete threshold fields before installing
the established PTHRESH=32, HTHRESH=4, WTHRESH=4 descriptor-granularity
policy.
MFC after: 2 weeks
e1000: Program Tx descriptor control by family
TXDCTL programming is family dependent. 82543 erratum 35 and
82544 erratum 20 require WTHRESH to remain zero; a nonzero value
can corrupt descriptor writebacks and hang the controller. Leave all
descriptor-control thresholds at their reset values on 82542, 82543,
and 82544.
On the remaining em controllers, retain the established PTHRESH=31,
HTHRESH=1, WTHRESH=1, and descriptor granularity policy. Several
legacy specification updates identify full descriptor writeback as a
workaround for transmit descriptor-queue errata.
TXDCTL bit 22 is also family dependent. It is COUNT_DESC on the
82571 family and 80003ES2LAN. Intel shared initialization explicitly
sets raw bit 22 on both transmit queues of every supported ICH/PCH
generation, although the integrated public documentation marks it
reserved. Preserve that required setting when iflib programs the
thresholds, as DPDK does. Clearing it caused a persistent I219
[12 lines not shown]
ixv: Advertise SCTP checksum offload
The shared ixgbe transmit path already creates SCTP context
descriptors, and the hardware exposes the same checksum capability to
VFs. Advertise it through iflib as the PF driver does.
MFC after: 2 weeks
ixv: Remove unused loader tunables
The flow_control and hdr_split variables have never been read. VF
flow control is controlled by the PF, while implementing header split
would require receive-path support that ixv does not provide.
MFC after: 2 weeks
ixgbe: Reject Flow Director with SR-IOV
The iflib Flow Director path does not assign filters using the
absolute queue and pool identifiers required by SR-IOV. Reject the
combination during preflight validation rather than allowing an
unsupported configuration to alter the PF receive path.
The loader tunable is fixed before VFs can be created, so validation
also prevents the reverse ordering of this combination.
MFC after: 2 weeks
amd_iommu: Honor disabled interrupt remapping
Do not instantiate an interrupt-remapping context for a unit whose IRTE
support is disabled. In that mode the caller must retain the ordinary
interrupt path.
Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D58725
iflib: Add sysctl stat for TX watchdog reset events
iflib counts resets initiated by its transmit watchdog in 69c3e0de01c1.
Export the counter in the per-device iflib sysctl tree so every
driver provides the diagnostic without a driver callback or duplicate
storage.
A watchdog reset does not establish how many packets failed. It can
recover a hardware stall involving several queued packets or a missed
completion involving no packet loss. Stop adding one output error per
watchdog event in em(4), igb(4), and igc(4).
Remove the redundant driver counters and move the diagnostic to
dev.<driver>.<unit>.iflib.tx_watchdog_events.
MFC after: 1 month
Relnotes: yes
pfsync: handle large MTU pfsync interfaces
pfsync packets were allocated with m_get2(), which can't return packets
larger than MJUMPAGESIZE. As a result 9k MTU pfsync interfaces simply didn't work.
Use m_get3(), which can allocate sufficiently large mbufs.
Extend the pfsync:bulk test case to provoke this problem.
PR: 297307
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
net: don't panic on ifconfig pfsync0 mtu 9000
pfsync interfaces do not have ifp->if_inet6 set, so when we update the
MTU for those interfaces we panicked.
Add an explicit check for this. This should be temporary, until pfsync
is no longer a struct ifnet (as we've already done for pflog).
Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D58701
vmm: Tear down the IOMMU before AMD-Vi detach
Register the vmm module handler after both the bundled device drivers
and SMP. On platforms without EARLY_AP_STARTUP, SI_SUB_SMP follows
SI_SUB_DRIVERS; using the later subsystem preserves the
smp_rendezvous() requirement.
The resulting reverse unload order performs IOMMU cleanup while every
IVHD softc remains valid. Refuse an independent IVHD detach while
translation state remains initialized.
MFC after: 2 weeks