ixgbe: rebuild the shared multicast table
The MTA is shared by the PF and all VFs. The VF mailbox handler only
ORs new bits, so hashes survive list removal and VF reset. Conversely,
PF multicast updates replace the whole table with PF-only state and
discard live VF filters.
Rebuild the table from the PF list and every active VF whenever either
changes. Clear VF multicast state during reset and PF reinitialization,
and remove all VF hashes on SR-IOV teardown. Keep the software shadow
and multicast control state synchronized, and avoid writes to unchanged
MTA registers.
Adapt the aggregate desired-state rebuild introduced for igb(4) in
a2ed165f0049 and its write-elision scheme from 350211ab1782 to ixgbe's
shared MTA.
MFC after: 1 week
ixv: reconcile the PF-approved MAC address
The shared VF set-RAR helper restores hw.mac.addr when the PF rejects a
requested address, but ixv ignores the error and leaves the interface
link-layer address unchanged. Subsequent initialization repeats the
rejected request while the interface appears to use an address the PF
will not deliver.
Refresh the permanent address returned by the PF after every successful
reset handshake. Copy the resulting PF-approved address back to the
interface and emit the normal link-layer address notification without
re-entering the driver initialization path. This also recovers from a
prior mailbox transport failure or a PF-side reassignment.
Adapt the igb VF address reconciliation added in a6bb3850e7c6.
MFC after: 1 week
ixv: defer every admin-vector interrupt
The VF admin vector carries both link and PF mailbox causes, but the
filter schedules the admin task only for link-status changes. Defer
administration for every interrupt so reset and control notifications
are serviced promptly.
MFC after: 1 week
tcp: improve SEG.SEQ validation for RST segments
A RST segment can be sent in response to
(a) received segment or
(b) by the upper layer protocol.
The SEG.SEQ validation consists of two checks:
(1) the in-window check of SEG.SEQ and
(2) the exact match check of SEG.SEQ.
For the in-window check (1), the left edge of the window needs to be
based on tp->last_ack_sent to cover the delayed ACK case, whereas the
right edge needs to be based on tp->rcv_nxt + tp->rcv_wnd. This both
assumes that tp->rcv_wnd is not zero. For the special case of
tp->rcv_wnd being zero, add checks against tp->last_ack_sent for (a)
and on tp->rcv_nxt for (b). This applies to all TCP stacks.
When the exact match (2) of SEG.SEQ is performed, it should be based
on tp->last_ack_sent for (a) and on tp->rcv_nxt for (b). To cover both,
[9 lines not shown]
tcp: improve handling of stopped timers
When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the
corresponding t_precisions[], if it is not zero, would result in
overflows in tcp_timer_next(). To avoid this, skip stopped timers.
The problem was identified while debugging uperf by Lukas Book and
an initial patch was provided by him. The committed patch was
suggested by glebius.
The problem can be observed by running netstat -nxptcp and looking for
negative timer values and by observing very long running timers in
some cases.
Reported by: Lukas Book <lkbook at outlook.de>
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58484
(cherry picked from commit 52b7cbcb78c14e89f6faec8da5acc2caa3d37208)
tests: fix checksum computation
This fixes an endianness bug in sys/netinet/ip_reass_test.
Just use the code from RFC 1071.
Reported by: glebius
Reviewed by: glebius, Timo Völker
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D57988
(cherry picked from commit fbc039e512c3bb1635ad20cc8f70ad608ea818b7)
loopback: improve checksum offloading
* Allow disabling IFCAP_RXCSUM_IPV6 or IFCAP_TXCSUM_IPV6.
* Do not pretend the checksum is correct by setting the LO_CSUM_SET
flags if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is enabled. Instead,
remove the LO_CSUM_SET flags (in case they have been set somehow)
if IFCAP_RXCSUM_IPV6 or IFCAP_RXCSUM is disabled.
* Do not unset the transmit checksum offload flags LO_CSUM_FEATURES or
LO_CSUM_FEATURES6 since they now have a meaning for the receive path.
Reviewed by: glebius, pouria, tuexen
Okayed by: bz
Differential Revision: https://reviews.freebsd.org/D57518
(cherry picked from commit d6c4cea7740d5c5c673a06ba37e4f1bdcddb2ece)
virtio_pci_modern: Remove endianness conversion for config space
The bus_* functions already handle converting from PCI endianness
(i.e. little-endian) to native endianness when accessing the config
space (see ofw_pcib_bus_get_bus_tag), so converting again with
virtio_htogX/virtio_gtohX undoes any byte-swapping and breaks
big-endian systems. They should only be used for operating on shared
memory.
Note part of this reverts commit fb53b42e36a9 ("virtio-modern: fix PCI
common read/write functions on big endian targets").
PR: 294706
Reviewed by: adrian, tuexen
Fixes: fb53b42e36a9 ("virtio-modern: fix PCI common read/write functions on big endian targets")
Fixes: 9da9560c4dd3 ("virtio: Add VirtIO PCI modern (V1) support")
Differential Revision: https://reviews.freebsd.org/D57392
(cherry picked from commit 07b5d1ca52b113cecad3cda73ff5e782d8f4d07d)
tcp: cleanup resource handling in SYN handling
Handle cred, ipopts, and maclabel using the same pattern:
allocate at the beginning and set to NULL when the object is
transferred to a struct syncache. When exiting the function, free
these objects if not transferred or when transferred to the on-stack
struct syncache. This makes use of a new function syncache_release().
This fixes a use after free problem: ipopts should only be freed,
if the on-stack struct syncache is used and the pointer in this
structure still points to the allocated ipopts. If the ipopts
are moved from the struct syncache to the struct inpcb in
syncache_socket(), which is called by syncache_tfo_expand(),
the pointer in the struct syncache is set to NULL.
In a FreeBSD default setup this problem is mitigated by
1. TCP fast open support on the server side not being enabled
(the sysctl-variable net.inet.tcp.fastopen.server_enable is 0).
2. Incoming IP packet with source routing options are not being
[12 lines not shown]
autofs: try to avoid waiting for timeouts of in-flight requests for forced unmounts
Do the advisory aborts of the in-flight requests before flushing the
vnodes. It should mostly eliminate the waits due to requests busying
the mp.
Reported and reviewed by: rew
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D58637
igb: Stop writing the legacy TADV register
TADV is an em-class interrupt delay register and is absent from the
82575 and later register model. The igb attach path does not expose or
initialize that control, but transmit initialization still wrote its
zero valued storage into a reserved queue-window offset.
Apply the same igb_mac_min boundary already used for TIDV and the
absolute-delay sysctls.
Sponsored by: BBOX.io
(cherry picked from commit c637d474045a41b1763c17a8b4b7763d4159504f)
igb: Reprogram descriptor queues while disabled
Disable each igb-class transmit and receive queue and flush before
changing its descriptor-ring registers. Restore the head and tail
indices that Intel documents as surviving a VF reset.
Use the igb queue-enable control instead of programming legacy TXDCTL
granularity, low-water, and reserved bits that do not belong to the
82575 and later.
Sponsored by: BBOX.io
(cherry picked from commit f879d1cd7df3c5afa69428cc2b07e1675d7776c9)
igb: Correct I350 loopback VLAN byte order
I350 loopback receive descriptors report VLAN tags byte-swapped for
both PFs and VFs. The receive path handled the PF device types but
omitted e1000_vfadapt_i350, causing an admitted VF VLAN packet to be
delivered untagged to the VF parent.
Include the I350 VF type in the existing correction. This matches the
dedicated IGB_RXQ_FLAG_LB_BSWAP_VLAN handling in DPDK igbvf.
Sponsored by: BBOX.io
(cherry picked from commit 7eb7ff6459219e802d51add3ba9d1d9d874db561)
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)
igb: Stop writing the legacy TADV register
TADV is an em-class interrupt delay register and is absent from the
82575 and later register model. The igb attach path does not expose or
initialize that control, but transmit initialization still wrote its
zero valued storage into a reserved queue-window offset.
Apply the same igb_mac_min boundary already used for TIDV and the
absolute-delay sysctls.
Sponsored by: BBOX.io
(cherry picked from commit c637d474045a41b1763c17a8b4b7763d4159504f)
igb: Reprogram descriptor queues while disabled
Disable each igb-class transmit and receive queue and flush before
changing its descriptor-ring registers. Restore the head and tail
indices that Intel documents as surviving a VF reset.
Use the igb queue-enable control instead of programming legacy TXDCTL
granularity, low-water, and reserved bits that do not belong to the
82575 and later.
Sponsored by: BBOX.io
(cherry picked from commit f879d1cd7df3c5afa69428cc2b07e1675d7776c9)
igb: Correct I350 loopback VLAN byte order
I350 loopback receive descriptors report VLAN tags byte-swapped for
both PFs and VFs. The receive path handled the PF device types but
omitted e1000_vfadapt_i350, causing an admitted VF VLAN packet to be
delivered untagged to the VF parent.
Include the I350 VF type in the existing correction. This matches the
dedicated IGB_RXQ_FLAG_LB_BSWAP_VLAN handling in DPDK igbvf.
Sponsored by: BBOX.io
(cherry picked from commit 7eb7ff6459219e802d51add3ba9d1d9d874db561)
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)
gpio: add Intel Tiger Lake-H GPIO driver
Add a GPIO driver for the Intel Tiger Lake-H platform based on the generic
intelgpio framework. The driver defines five GPIO communities with pad groups
GPP_A through GPP_K, vGPIO and JTAG, and matches ACPI hardware ID INT34C6.
The kernel module build infrastructure and the wiring into files.x86 are
included.
Reviewed by: vexeduxr
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Pull Request: https://github.com/freebsd/freebsd-src/pull/2205
gpio: add Intel Alder Lake-N GPIO driver
Add a GPIO driver for the Intel Alder Lake-N platform based on the generic
intelgpio framework. The driver provides pad group definitions for four GPIO
communities covering groups GPP_A through GPP_T, vGPIO and HVCMOS, and matches
ACPI hardware IDs INTC1056, INTC1057 and INTC1085. The kernel module build
infrastructure and the wiring into files.x86 are included.
Reviewed by: vexeduxr
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Pull Request: https://github.com/freebsd/freebsd-src/pull/2205
gpio: add generic Intel GPIO pin controller framework
Add a platform-independent driver framework for Intel GPIO pin controllers
found on modern Intel SoCs. The driver accesses GPIO pad registers through
ACPI-provided memory-mapped resources and implements the gpio interface [1]
including pin enumeration, capability reporting, configuration, and
read/write/toggle operations. A common data model of communities and pad groups
allows individual SoC-specific drivers to supply their own pad tables and ACPI
hardware IDs while sharing all register-level logic.
[1] https://wiki.freebsd.org/GPIO
Reviewed by: vexeduxr
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Pull Request: https://github.com/freebsd/freebsd-src/pull/2205
sctp: initialize inp to avoid uninitialized use
If we take an early goto out_unlocked inp is uninitialized and then
may be used in SCTP_LTRACE_ERR_RET(). Initialize inp to NULL
to avoid warnings.
Found with: gcc15 tinderbox build
Reviewed by: tuexen, pouria
Differential Revision: https://reviews.freebsd.org/D56503
(cherry picked from commit 4cdbcc2b6a2e551529f7133665ef406869b48bf7)
tcp: improve SEG.SEQ validation for RST segments
A RST segment can be sent in response to
(a) received segment or
(b) by the upper layer protocol.
The SEG.SEQ validation consists of two checks:
(1) the in-window check of SEG.SEQ and
(2) the exact match check of SEG.SEQ.
For the in-window check (1), the left edge of the window needs to be
based on tp->last_ack_sent to cover the delayed ACK case, whereas the
right edge needs to be based on tp->rcv_nxt + tp->rcv_wnd. This both
assumes that tp->rcv_wnd is not zero. For the special case of
tp->rcv_wnd being zero, add checks against tp->last_ack_sent for (a)
and on tp->rcv_nxt for (b). This applies to all TCP stacks.
When the exact match (2) of SEG.SEQ is performed, it should be based
on tp->last_ack_sent for (a) and on tp->rcv_nxt for (b). To cover both,
[9 lines not shown]
tcp: improve handling of stopped timers
When a TCP timer is stopped, t_timers[] is set to SBT_MAX. Adding the
corresponding t_precisions[], if it is not zero, would result in
overflows in tcp_timer_next(). To avoid this, skip stopped timers.
The problem was identified while debugging uperf by Lukas Book and
an initial patch was provided by him. The committed patch was
suggested by glebius.
The problem can be observed by running netstat -nxptcp and looking for
negative timer values and by observing very long running timers in
some cases.
Reported by: Lukas Book <lkbook at outlook.de>
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58484
(cherry picked from commit 52b7cbcb78c14e89f6faec8da5acc2caa3d37208)
tests: fix checksum computation
This fixes an endianness bug in sys/netinet/ip_reass_test.
Just use the code from RFC 1071.
Reported by: glebius
Reviewed by: glebius, Timo Völker
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D57988
(cherry picked from commit fbc039e512c3bb1635ad20cc8f70ad608ea818b7)