git: becb074fdefc - stable/14 - LinuxKPI: 802.11: adjust vif->bss_conf.chanctx_conf to rcu accessors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Apr 2025 14:37:17 UTC
The branch stable/14 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=becb074fdefc40cff3365746a1036843e16c09d6
commit becb074fdefc40cff3365746a1036843e16c09d6
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-04-08 19:25:03 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-18 14:36:01 +0000
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
Tested by: Oleksandr Kryvulia (shuriku shurik.kiev.ua)
Tested by: Oleg Nauman (oleg.nauman gmail.com) [rtw88]
Differential Revision: https://reviews.freebsd.org/D49734
(cherry picked from commit 560708cbb0468bf1fd1834f4894a1326e88ff10e)
---
sys/compat/linuxkpi/common/src/linux_80211.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 1eff90a1d93e..bd1e60928144 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1844,8 +1844,9 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
LKPI_80211_LHW_LOCK(lhw);
/* Add chanctx (or if exists, change it). */
- if (vif->bss_conf.chanctx_conf != NULL) {
- chanctx_conf = vif->bss_conf.chanctx_conf;
+ chanctx_conf = rcu_dereference_protected(vif->bss_conf.chanctx_conf,
+ lockdep_is_held(&hw->wiphy->mtx));
+ if (chanctx_conf != NULL) {
lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
IMPROVE("diff changes for changed, working on live copy, rcu");
} else {
@@ -1920,7 +1921,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__);
error = 0;
- if (vif->bss_conf.chanctx_conf != NULL) {
+ if (vif->bss_conf.chanctx_conf == chanctx_conf) {
changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH;
changed |= IEEE80211_CHANCTX_CHANGE_RADAR;
changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS;
@@ -1941,7 +1942,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
goto out;
}
- vif->bss_conf.chanctx_conf = chanctx_conf;
+ rcu_assign_pointer(vif->bss_conf.chanctx_conf, chanctx_conf);
/* Assign vif chanctx. */
if (error == 0)
@@ -1953,7 +1954,7 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int
ic_printf(vap->iv_ic, "%s:%d: mo_assign_vif_chanctx "
"failed: %d\n", __func__, __LINE__, error);
lkpi_80211_mo_remove_chanctx(hw, chanctx_conf);
- vif->bss_conf.chanctx_conf = NULL;
+ rcu_assign_pointer(vif->bss_conf.chanctx_conf, NULL);
lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
free(lchanctx, M_LKPI80211);
goto out;
@@ -3480,7 +3481,7 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
/* XXX-BZ hardcoded for now! */
#if 1
- vif->bss_conf.chanctx_conf = NULL;
+ RCU_INIT_POINTER(vif->bss_conf.chanctx_conf, NULL);
vif->bss_conf.vif = vif;
/* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */
IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac);
@@ -5981,7 +5982,7 @@ linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *hw,
TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) {
vif = LVIF_TO_VIF(lvif);
- if (vif->bss_conf.chanctx_conf == NULL)
+ if (vif->bss_conf.chanctx_conf == NULL) /* XXX-BZ; FIXME see IMPROVE above. */
continue;
lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->bss_conf.chanctx_conf);