git: 11604b2a1659 - main - LinuxKPI: 802.11: move chanctx_conf from vif to vif->bss_conf

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 11 Apr 2025 21:26:18 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=11604b2a1659fd6da9bbfdc6acf9758884cb2b36

commit 11604b2a1659fd6da9bbfdc6acf9758884cb2b36
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-04-08 00:56:36 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-04-11 21:17:55 +0000

    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
    Tested by:      Oleksandr Kryvulia (shuriku shurik.kiev.ua)
    Tested by:      Oleg Nauman (oleg.nauman gmail.com) [rtw88]
    Differential Revision: https://reviews.freebsd.org/D49734
---
 sys/compat/linuxkpi/common/include/net/mac80211.h   |  1 -
 sys/compat/linuxkpi/common/src/linux_80211.c        | 20 ++++++++++----------
 sys/compat/linuxkpi/common/src/linux_80211_macops.c |  2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 95991dd2ac42..016143874564 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -839,7 +839,6 @@ struct ieee80211_vif {
 	bool				probe_req_reg;
 	uint8_t				addr[ETH_ALEN];
 	struct ieee80211_vif_cfg	cfg;
-	struct ieee80211_chanctx_conf	*chanctx_conf;					/* XXX-BZ no longer used anywhere but in linuxkpi 802.11 internally; now in bss_conf per-link? */
 	struct ieee80211_txq		*txq;
 	struct ieee80211_bss_conf	bss_conf;
 	struct ieee80211_bss_conf	*link_conf[IEEE80211_MLD_MAX_NUM_LINKS];	/* rcu? */
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 5c50060e3dc0..28bd2c062427 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -1736,14 +1736,14 @@ static void
 lkpi_remove_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
 	/* Take the chan ctx down. */
-	if (vif->chanctx_conf != NULL) {
+	if (vif->bss_conf.chanctx_conf != NULL) {
 		struct lkpi_chanctx *lchanctx;
 		struct ieee80211_chanctx_conf *chanctx_conf;
 
-		chanctx_conf = vif->chanctx_conf;
+		chanctx_conf = vif->bss_conf.chanctx_conf;
 		/* Remove vif context. */
-		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->chanctx_conf);
-		/* NB: vif->chanctx_conf is NULL now. */
+		lkpi_80211_mo_unassign_vif_chanctx(hw, vif, &vif->bss_conf, &vif->bss_conf.chanctx_conf);
+		/* NB: vif->bss_conf.chanctx_conf is NULL now. */
 
 		lkpi_hw_conf_idle(hw, true);
 
@@ -1840,8 +1840,8 @@ 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->chanctx_conf != NULL) {
-		chanctx_conf = vif->chanctx_conf;
+	if (vif->bss_conf.chanctx_conf != NULL) {
+		chanctx_conf = vif->bss_conf.chanctx_conf;
 		lchanctx = CHANCTX_CONF_TO_LCHANCTX(chanctx_conf);
 		IMPROVE("diff changes for changed, working on live copy, rcu");
 	} else {
@@ -1916,7 +1916,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->chanctx_conf != NULL) {
+	if (vif->bss_conf.chanctx_conf != NULL) {
 		changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH;
 		changed |= IEEE80211_CHANCTX_CHANGE_RADAR;
 		changed |= IEEE80211_CHANCTX_CHANGE_RX_CHAINS;
@@ -3470,7 +3470,7 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 
 	/* XXX-BZ hardcoded for now! */
 #if 1
-	vif->chanctx_conf = NULL;
+	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);
@@ -5970,10 +5970,10 @@ linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *hw,
 	TAILQ_FOREACH(lvif, &lhw->lvif_head, lvif_entry) {
 
 		vif = LVIF_TO_VIF(lvif);
-		if (vif->chanctx_conf == NULL)
+		if (vif->bss_conf.chanctx_conf == NULL)
 			continue;
 
-		lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->chanctx_conf);
+		lchanctx = CHANCTX_CONF_TO_LCHANCTX(vif->bss_conf.chanctx_conf);
 		if (!lchanctx->added_to_drv)
 			continue;
 
diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
index fde23d02af5e..9a7207424b2f 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c
@@ -458,7 +458,7 @@ lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *
 	    hw, vif, conf, chanctx_conf);
 	error = lhw->ops->assign_vif_chanctx(hw, vif, conf, chanctx_conf);
 	if (error == 0)
-		vif->chanctx_conf = chanctx_conf;
+		vif->bss_conf.chanctx_conf = chanctx_conf;
 
 out:
 	return (error);