HardenedBSD/src 2d5b7c0sys/dev/qlnx/qlnxe qlnx_os.c ecore_l2.c, sys/net if_lagg.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+97-254sys/dev/qlnx/qlnxe/qlnx_os.c
+38-21sys/net/if_lagg.c
+21-20sys/dev/qlnx/qlnxe/ecore_l2.c
+3-8sys/dev/qlnx/qlnxe/ecore_vf.c
+4-5sys/dev/qlnx/qlnxe/ecore_l2_api.h
+1-6sys/dev/qlnx/qlnxe/qlnx_def.h
+164-3143 files not shown
+165-3179 files

HardenedBSD/src 0233e3fsys/net if_lagg.c

lagg: Remove the member pr_num from struct lagg_proto

It is set but never used. Remove it to avoid confusion and save a
little space.

While here, use designated initializers to initialize the LAGG protocol
table. That improves readability, and it will be safer to initialize the
table if we introduce new protocols in the future.

No functional change intended.

Reviewed by:    glebius
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D55124

(cherry picked from commit 5ba503fc2cabc1a614997f102ace671d996bcc53)
DeltaFile
+6-13sys/net/if_lagg.c
+6-131 files

HardenedBSD/src 0cfc114sys/dev/qlnx/qlnxe qlnx_os.c ecore_l2.c

qlnxe: Overhaul setting the multicast MAC filters

When operating the multicast MAC filters, the current usage of
ECORE_FILTER_ADD and ECORE_FILTER_REMOVE are rather misleading.
ECORE_FILTER_ADD reads "adding new filter", but it actually removes
any existing filters and then addes a new one. ECORE_FILTER_REMOVE
reads "removing a filter", but it actually removes all filters.
Let's use ECORE_FILTER_REPLACE and ECORE_FILTER_FLUSH instead to
avoid confusion.

In the current implementation, only one MAC address is passed to
ecore_sp_eth_filter_mcast() and any previously installed filters are
removed, hence it breaks the multicast function. That can be observed
via either assigning new IPv6 addresses to the interface or putting
the interface as a member of lagg(4) interface with LACP aggregation
protocol. Fix that by calculating the multicast filter bins directly
from multicast MAC addresses and replace the filters every time
the bins changes.


    [20 lines not shown]
DeltaFile
+37-153sys/dev/qlnx/qlnxe/qlnx_os.c
+21-20sys/dev/qlnx/qlnxe/ecore_l2.c
+3-8sys/dev/qlnx/qlnxe/ecore_vf.c
+4-5sys/dev/qlnx/qlnxe/ecore_l2_api.h
+1-4sys/dev/qlnx/qlnxe/qlnx_def.h
+66-1905 files

HardenedBSD/src 18c70c7sys/net if_lagg.c

lagg: Make the none protocol a first-class citizen

All the other protocols have corresponding start and input routines,
which are used in the fast path. Currently the none protocol is
treated specially. In the fast path it is checked to indicate whether
a working protocol is configured. There are two issues raised by this
design:

1. In production, other protocols are commonly used, but not the
none protocol. It smells like an overkill to always check it in the
fast path. It is unfair to other commonly used protocols.

2. PR 289017 reveals that there's a small window between checking the
protocol and calling lagg_proto_start(). lagg_proto_start() is possible
to see the none protocol and do NULL deferencing.

Fix them by making the none protocol a first-class citizen so that it
has start and input routines just the same as other protocols. Then we
can stop checking it in the fast path, since lagg_proto_start() and

    [15 lines not shown]
DeltaFile
+33-9sys/net/if_lagg.c
+33-91 files

HardenedBSD/src 425b9cesys/dev/qlnx/qlnxe qlnx_os.c

qlnxe: Allow tapping the TX packets

Currently only the packets in the RX path can be captured by tcpdump
as the ETHER_BPF_MTAP call in the TX path is missing. Add it so that
packets in both directions can be captured.

PR:             290973
Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54891

(cherry picked from commit 968647502ec21464ad3aecc7577ff0e8dfd41693)
DeltaFile
+1-0sys/dev/qlnx/qlnxe/qlnx_os.c
+1-01 files

HardenedBSD/src b8d2c1csys/dev/qlnx/qlnxe qlnx_os.c qlnx_def.h

qlnxe: Refactor setting the promiscuous and allmulti mode

There are two entry points to set the promiscuous and allmulti mode.
One is ioctl, and another is the init routine. Given they share almost
the identical logic, refactor a little to make the code more clear.

While here, for the ioctl, translate the error to EINVAL to avoid
confusing the net stack.

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54890

(cherry picked from commit 45b1718fadae7d56051ba04ef9d7a175a602a226)
DeltaFile
+38-46sys/dev/qlnx/qlnxe/qlnx_os.c
+0-1sys/dev/qlnx/qlnxe/qlnx_def.h
+38-472 files

HardenedBSD/src 926e44bsys/modules/qlnx/qlnxev Makefile

qlnxev: Remove now unneeded include for opt_inet.h

Since the change [1], this is not required anymore.

This change partially reverts commit 8a847947153e.

[1] 4012b63889e4 qlnxe: Let ether_ioctl() handle SIOCSIFADDR ioctl

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54889

(cherry picked from commit ec7950fe42344900567cb72c83845ea4dc5a7114)
DeltaFile
+0-1sys/modules/qlnx/qlnxev/Makefile
+0-11 files

HardenedBSD/src 8731ff4sys/dev/qlnx/qlnxe qlnx_os.c

qlnxe: Avoid reinitializing the interface when it is already initialized

qlnx_init_locked() unconditionally uninitialize the interface thus is
actually reinitializing the interface. Well the init routine qlnx_init()
is to initialize the interface by net stack when assigned with the first
inet or inet6 address. The ioctl SIOCSIFADDR for the first inet6 address
is handled by ether_ioctl() thus the interface is reinitialized no matter
it was initialized or not.

Add a driver status check for that to avoid reinitializing. Further plan
is removing SIOCSIFADDR ioctl from the driver and let ether_ioctl() handle
it.

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54887

(cherry picked from commit c10e6bc0f0079e90cb484323ad71d437f1882422)
DeltaFile
+2-1sys/dev/qlnx/qlnxe/qlnx_os.c
+2-11 files

HardenedBSD/src 285b25csys/dev/qlnx/qlnxe qlnx_os.c

qlnxe: Prevent potential concurrency between ioctls

The driver-managed status flags should be lock protected to be touched.
Also this can serialize ioctls those check the IFF_DRV_RUNNING status.

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54886

(cherry picked from commit 0df8a998a9fe28af659cb401c537c6d785e55f81)
DeltaFile
+9-8sys/dev/qlnx/qlnxe/qlnx_os.c
+9-81 files

HardenedBSD/src 0f383f7sys/dev/qlnx/qlnxe qlnx_os.c, sys/modules/qlnx/qlnxe Makefile

qlnxe: Let ether_ioctl() handle SIOCSIFADDR ioctl

Since the change [1], the init routine qlnx_init() works as intended.
Let ether_ioctl() handle SIOCSIFADDR to simplify the code.

Combined with the change [1], this shall be a better fix for PR 287445.

[1] c10e6bc0f007 qlnxe: Avoid reinitializing the interface when it is already initialized

PR:             287445
Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54888

(cherry picked from commit 4012b63889e40bb877bc0e4c8da1792bce472c08)
DeltaFile
+0-25sys/dev/qlnx/qlnxe/qlnx_os.c
+0-1sys/modules/qlnx/qlnxe/Makefile
+0-262 files

HardenedBSD/src 23ffd16sys/dev/qlnx/qlnxe qlnx_os.c

qlnxe: Remove a pointless copy back from the link-layer address

On ifnet attaching, ether_ifattach() makes the link-layer address by
shadow copying the ha->primary_mac. Well, the link-layer address will
not be altered during attaching, thus it is pointless to copy it back.

No functional change intended.

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54883

(cherry picked from commit 4ac3081b282800158df7abe93f307d76e1b5b808)
DeltaFile
+0-2sys/dev/qlnx/qlnxe/qlnx_os.c
+0-21 files

HardenedBSD/src 6d138e9sys/dev/qlnx/qlnxe qlnx_os.c

qlnxe: Fix setting the unicast MAC filter of RX path

When an Ethernet interface is added to lagg(4) as a child interface, its
type, aka if_type, is changed from IFT_ETHER to IFT_IEEE8023ADLAG. Well
changing the link-layer address of the lagg(4) interface will be
propagated to all child interfaces, hence the drivers of child interfaces
shall not presume the type of the interface will not be changed.

Meanwhile, on initializing, an ifnet has been fully attached and it is
guaranteed to have non-null link-layer address so stop NULL checking for
it.

Reviewed by:    kbowling
Fixes:          792226e53023 qlnxe: Allow MAC address override
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54885

(cherry picked from commit f250852c9a0c1021c3be4b498e27cfc7b42a81db)
DeltaFile
+3-13sys/dev/qlnx/qlnxe/qlnx_os.c
+3-131 files

HardenedBSD/src 6462189sys/dev/qlnx/qlnxe qlnx_os.c qlnx_def.h

qlnxe: Avoid memcpy with same source and destination

In case the device is VF, qlnx_get_mac_addr() returns ha->primary_mac
hence it ends up memcpy with same source and destination. Refactor
slightly to avoid that.

Reviewed by:    kbowling
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D54884

(cherry picked from commit 3aeeedc7e0dc231c16406ff64f4a08a716964c40)
DeltaFile
+7-6sys/dev/qlnx/qlnxe/qlnx_os.c
+0-1sys/dev/qlnx/qlnxe/qlnx_def.h
+7-72 files

HardenedBSD/src 4d3b126release/scripts pkg-stage.sh

release: Turn off debugging in pkg(8)

Running `pkg -d` in pkg-stage.sh results in multiple GB of network
traffic being written into the log files, which is less than helpful
when it comes to tracking down build failures.  Remove the -d flag.

MFC after:      5 days
X-MFC-note:     The code in 15 has diverged from 14, but the flag is
                there, just in a different place.

(cherry picked from commit 18721be356043f6749a6e2470bc9f7351c450c6e)
DeltaFile
+1-1release/scripts/pkg-stage.sh
+1-11 files

HardenedBSD/src fcc5ac0sys/kern sched_ule.c sched_4bsd.c, sys/net iflib.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+224-221sys/kern/sched_ule.c
+214-183sys/kern/sched_4bsd.c
+325-0sys/kern/sched_shim.c
+103-7sys/sys/sched.h
+3-79sys/net/iflib.c
+47-34sys/kern/subr_smp.c
+916-52424 files not shown
+995-58630 files

HardenedBSD/src c08ee1esys/dev/iwx if_iwx.c

iwx: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Locally tested:

 * STA mode - iwx0: <Wi-Fi 6 AX210> mem 0x84c00000-0x84c03fff at device 0.0 on pci4

Differential Revision:  https://reviews.freebsd.org/D54463
DeltaFile
+6-4sys/dev/iwx/if_iwx.c
+6-41 files

HardenedBSD/src f064d44sys/dev/usb/wlan if_rum.c if_run.c

run: rum: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Locally tested:

 * STA mode - run0: MAC/BBP RT2860 (rev 0x0101), RF RT2820 (MIMO 2T2R), address 00:0e:2e:e5:ae:3a

Differential Revision:  https://reviews.freebsd.org/D54462
DeltaFile
+16-10sys/dev/usb/wlan/if_rum.c
+10-5sys/dev/usb/wlan/if_run.c
+26-152 files

HardenedBSD/src 7a5288asys/net80211 ieee80211_ht.c

net80211: clean up time comparison in HT code

There's at least one place where the time comparison is wrong, leading
to some bad beahaviour around deciding to try and establish/reestablish
AMPDU TX sessions.

Start addressing these!

Differential Revision:  https://reviews.freebsd.org/D54390
DeltaFile
+5-3sys/net80211/ieee80211_ht.c
+5-31 files

HardenedBSD/src 8cec474sys/kern sched_ule.c sched_shim.c, sys/sys smp.h

Re-introduce kern.sched.topology_spec

PR:     292574

(cherry picked from commit 120ca8d74b46caa260702485e30fe5f9f9984682)
DeltaFile
+0-92sys/kern/sched_ule.c
+91-0sys/kern/sched_shim.c
+47-34sys/kern/subr_smp.c
+6-3sys/sys/smp.h
+144-1294 files

HardenedBSD/src 164d8afsys/i386/i386 swtch.S

i386: Fix build and remove empty unused macro

(cherry picked from commit 9e0fe126714cc0b2045bec16fe8d06dbcd663144)
DeltaFile
+1-3sys/i386/i386/swtch.S
+1-31 files

HardenedBSD/src 68feaa1sys/kern sched_4bsd.c kern_synch.c, sys/sys sched.h proc.h

SCHED_4BSD: maybe_resched() cannot schedule ast() for curthread

(cherry picked from commit b249cb2b18b3fddae186d45fe6d984fc7bde10c4)
DeltaFile
+19-2sys/kern/sched_4bsd.c
+1-1sys/kern/kern_synch.c
+2-0sys/sys/sched.h
+1-0sys/sys/proc.h
+23-34 files

HardenedBSD/src a3fb3d0sys/kern sched_4bsd.c sched_shim.c, sys/sys sched.h

kern/sched: deduplicate sdt probes

(cherry picked from commit 9409e86980302cd495376861de3475b78734bc37)
DeltaFile
+0-18sys/kern/sched_4bsd.c
+18-0sys/kern/sched_shim.c
+0-18sys/kern/sched_ule.c
+11-0sys/sys/sched.h
+29-364 files

HardenedBSD/src e642bf4sys/kern sched_ule.c sched_4bsd.c, sys/net iflib.c

net/iflib.c: move out scheduler-depended code into the hook

(cherry picked from commit b602ba1b5fd92bb226e32f5720885f856a5cb0bb)
DeltaFile
+3-79sys/net/iflib.c
+68-0sys/kern/sched_ule.c
+8-0sys/sys/sched.h
+7-0sys/kern/sched_4bsd.c
+1-0sys/kern/sched_shim.c
+87-795 files

HardenedBSD/src a3b5dafsys/amd64/conf GENERIC, sys/conf NOTES

sys: enable both SCHED_ULE and SCHED_4BSD for some configs

(cherry picked from commit 1322760fd1274930cbb61048d9a6ba3bc1782b2a)
DeltaFile
+1-1sys/conf/NOTES
+1-0sys/amd64/conf/GENERIC
+2-12 files

HardenedBSD/src 20f2249sys/kern sched_shim.c sched_4bsd.c, sys/sys sched.h

kern/sched: deduplicate dtrace hook vars

(cherry picked from commit 783b8a0fd880255a8315db7f59d0450bd7276f4d)
DeltaFile
+6-0sys/kern/sched_shim.c
+0-6sys/kern/sched_4bsd.c
+0-6sys/kern/sched_ule.c
+6-0sys/sys/sched.h
+12-124 files

HardenedBSD/src 1d4bc18sys/kern sched_ule.c

sysctl kern.sched.ule.topology_spec: allow to run if ULE is not initialized

(cherry picked from commit 5a6e0e31bc2e8ed8f655be63fa5b8c41f3d60753)
DeltaFile
+2-1sys/kern/sched_ule.c
+2-11 files

HardenedBSD/src bd74830sys/kern sched_4bsd.c sched_shim.c

sched_shim: restore kern.ccpu sysctl

(cherry picked from commit ff870b783f098cafd8b938379eada6b8cfe9a4fb)
DeltaFile
+6-4sys/kern/sched_4bsd.c
+4-0sys/kern/sched_shim.c
+10-42 files

HardenedBSD/src f491e0dsys/x86/x86 cpu_machdep.c

x86/cpu_machdep.c: unconditionally fence

(cherry picked from commit 1c4e16f6db81254376f4919aede03267fe572aea)
DeltaFile
+0-3sys/x86/x86/cpu_machdep.c
+0-31 files

HardenedBSD/src 4e5c15fshare/man/man7 tuning.7

tuning.7: document schedulers knobs

(cherry picked from commit 0730a05cd383276ca8eedf295509e869ac9b88a0)
DeltaFile
+26-0share/man/man7/tuning.7
+26-01 files

HardenedBSD/src 916cc38sys/kern sched_shim.c sched_4bsd.c, sys/sys sched.h

kern/sched: move duplicate preemption stat vars into sched_shim.c

(cherry picked from commit a84a39dfe5d1fd98afdf29a74017fce29441b730)
DeltaFile
+5-0sys/kern/sched_shim.c
+0-4sys/kern/sched_4bsd.c
+0-4sys/kern/sched_ule.c
+3-0sys/sys/sched.h
+8-84 files