Page MenuHomeFreeBSD

LinuxKPI: 802.11: adjust locking and work on chanctx
ClosedPublic

Authored by bz on Apr 9 2025, 1:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 26, 5:20 PM
Unknown Object (File)
Tue, Sep 23, 6:02 PM
Unknown Object (File)
Sep 17 2025, 12:22 PM
Unknown Object (File)
Sep 9 2025, 7:26 PM
Unknown Object (File)
Aug 15 2025, 12:11 AM
Unknown Object (File)
Aug 10 2025, 8:32 AM
Unknown Object (File)
Aug 5 2025, 8:32 AM
Unknown Object (File)
Jul 28 2025, 3:15 AM
Subscribers

Details

Summary

This is a series of changes I am putting out as a combined review
for people to test.

LinuxKPI: 802.11: reduce code duplication introducing lkpi_remove_chanctx()

We have the same code three times, so factor it out into its own
function to make it easier to maintain.

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: move chanctx_conf from vif to vif->bss_conf

In preparations for MLD support chanctx_conf was moved from vif to
the bss_conf as it will be per-link later.  Follow accordingly.

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: more fields moved from vif to bss_conf

csa_active, color_change_active, mu_mimo_owner also moved from
vif to bss_conf; we already have the fields in bss_conf (adjust type
for one) so all we have to do is remove the old relics in vif.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days

LinuxKPI: 802.11: adjust locking around lkpi_remove_chanctx()

With the adjusted locking as a first step and the single code path
into lkpi_80211_mo_unassign_vif_chanctx() we also move the "setting
chnactx to NULL" into the caller to simplify the code.

Before we can adjust the other places touchting vif->bss_conf.chanctx
we need to adjust the overall locking in LinuxKPI 802.11.

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: switch to wiphy_lock

Replace the LKPI_80211_LHW_LOCK (lhw->sx) with the wiphy lock (which
is a Linux mutex, so also an sx lock).  Apart from two places the
change was mostly mechanically.
Further remove the now recursive lock acquisitions.

This lays the ground for us to use more Linux(KPI) 802.11 internal
locking as well as more rcu equivalents, e.g., for the chanctx,
and live better to the synchronisation expectations of the drivers.
[I wish there would be more assertions in the drivers themselves,
especially in the mac80211 ops and the iteration callbacks.]

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors

Adjust the init and lkpi_sta_scan_to_auth() chanctx_conf accesses to
use rcu functions as needed.
linuxkpi_ieee80211_iterate_chan_contexts() which is
ieee80211_iter_chan_contexts_atomic() needs further work to get rid
of the vif locks by keeping all chanctx_conf on a list in lhw.
This will be done in a follow-up commit.

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: add a lchanctx list to lhw

While we are currently only supporting a single VAP (vif) it is
less of a trouble but in order to get locking and rcu accesses
[from drivers] more right add a list for all chanctx_conf we have
for one hw.  Use that list in the iterator function to avoid
having to lock the vif but not protecting the chanctx list
(against a parallel removal) due to different locking.

Sponsored by:	The FreeBSD Foundation
PR:		280546
MFC after:	3 days

LinuxKPI: 802.11: resolve more recursive wiphy locks

This should likely be merged with the previous locking change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Apr 9 2025, 1:40 PM
bz retitled this revision from LinuxKPI: 802.11: adjust locking and work on chanctx This is a series of changes I am putting out as a combined review for people to test. ``` LinuxKPI: 802.11: reduce code duplication introducing lkpi_remove_chanctx() to LinuxKPI: 802.11: adjust locking and work on chanctx.Apr 9 2025, 1:41 PM
bz edited the summary of this revision. (Show Details)
bz removed a subscriber: linuxkpi.