diff mbox series

[v2] wifi: mac80211: fix puncturing bitmap handling in CSA

Message ID 20230816101108.9a2a011e3670.I062e026efafb59b026ab72fc7f7fce54f43dd29b@changeid
State Superseded
Headers show
Series [v2] wifi: mac80211: fix puncturing bitmap handling in CSA | expand

Commit Message

Johannes Berg Aug. 16, 2023, 8:11 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Code inspection reveals that we switch the puncturing bitmap
before the real channel switch, since that happens only in
the second round of the worker after the channel context is
switched by ieee80211_link_use_reserved_context().

While at it, switch the code to using the link access to the
data instead of the default bss_conf, even if not all of it
is multi-link capable yet.

Fixes: 2cc25e4b2a04 ("wifi: mac80211: configure puncturing bitmap")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/cfg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

kernel test robot Aug. 16, 2023, 9:49 a.m. UTC | #1
Hi Johannes,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on wireless/main linus/master v6.5-rc6 next-20230816]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/wifi-mac80211-fix-puncturing-bitmap-handling-in-CSA/20230816-161302
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20230816101108.9a2a011e3670.I062e026efafb59b026ab72fc7f7fce54f43dd29b%40changeid
patch subject: [PATCH v2] wifi: mac80211: fix puncturing bitmap handling in CSA
config: riscv-randconfig-r012-20230816 (https://download.01.org/0day-ci/archive/20230816/202308161727.hK0qYLAL-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230816/202308161727.hK0qYLAL-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308161727.hK0qYLAL-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/mac80211/cfg.c:3680:6: error: use of undeclared identifier 'link_data'
    3680 |         if (link_data->conf->eht_puncturing != link_data->conf->csa_punct_bitmap) {
         |             ^
   net/mac80211/cfg.c:3680:41: error: use of undeclared identifier 'link_data'
    3680 |         if (link_data->conf->eht_puncturing != link_data->conf->csa_punct_bitmap) {
         |                                                ^
   net/mac80211/cfg.c:3681:3: error: use of undeclared identifier 'link_data'
    3681 |                 link_data->conf->eht_puncturing =
         |                 ^
   net/mac80211/cfg.c:3682:6: error: use of undeclared identifier 'link_data'
    3682 |                                         link_data->conf->csa_punct_bitmap;
         |                                         ^
   4 errors generated.


vim +/link_data +3680 net/mac80211/cfg.c

  3640	
  3641	static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
  3642	{
  3643		struct ieee80211_local *local = sdata->local;
  3644		u64 changed = 0;
  3645		int err;
  3646	
  3647		sdata_assert_lock(sdata);
  3648		lockdep_assert_held(&local->mtx);
  3649		lockdep_assert_held(&local->chanctx_mtx);
  3650	
  3651		/*
  3652		 * using reservation isn't immediate as it may be deferred until later
  3653		 * with multi-vif. once reservation is complete it will re-schedule the
  3654		 * work with no reserved_chanctx so verify chandef to check if it
  3655		 * completed successfully
  3656		 */
  3657	
  3658		if (sdata->deflink.reserved_chanctx) {
  3659			/*
  3660			 * with multi-vif csa driver may call ieee80211_csa_finish()
  3661			 * many times while waiting for other interfaces to use their
  3662			 * reservations
  3663			 */
  3664			if (sdata->deflink.reserved_ready)
  3665				return 0;
  3666	
  3667			return ieee80211_link_use_reserved_context(&sdata->deflink);
  3668		}
  3669	
  3670		if (!cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef,
  3671						&sdata->deflink.csa_chandef))
  3672			return -EINVAL;
  3673	
  3674		sdata->vif.bss_conf.csa_active = false;
  3675	
  3676		err = ieee80211_set_after_csa_beacon(sdata, &changed);
  3677		if (err)
  3678			return err;
  3679	
> 3680		if (link_data->conf->eht_puncturing != link_data->conf->csa_punct_bitmap) {
  3681			link_data->conf->eht_puncturing =
  3682						link_data->conf->csa_punct_bitmap;
  3683			changed |= BSS_CHANGED_EHT_PUNCTURING;
  3684		}
  3685	
  3686		ieee80211_link_info_change_notify(sdata, &sdata->deflink, changed);
  3687	
  3688		if (sdata->deflink.csa_block_tx) {
  3689			ieee80211_wake_vif_queues(local, sdata,
  3690						  IEEE80211_QUEUE_STOP_REASON_CSA);
  3691			sdata->deflink.csa_block_tx = false;
  3692		}
  3693	
  3694		err = drv_post_channel_switch(sdata);
  3695		if (err)
  3696			return err;
  3697	
  3698		cfg80211_ch_switch_notify(sdata->dev, &sdata->deflink.csa_chandef, 0,
  3699					  sdata->vif.bss_conf.eht_puncturing);
  3700	
  3701		return 0;
  3702	}
  3703
diff mbox series

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e7ac24603892..1657ff09a83a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3648,12 +3648,6 @@  static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
 	lockdep_assert_held(&local->mtx);
 	lockdep_assert_held(&local->chanctx_mtx);
 
-	if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
-		sdata->vif.bss_conf.eht_puncturing =
-					sdata->vif.bss_conf.csa_punct_bitmap;
-		changed |= BSS_CHANGED_EHT_PUNCTURING;
-	}
-
 	/*
 	 * using reservation isn't immediate as it may be deferred until later
 	 * with multi-vif. once reservation is complete it will re-schedule the
@@ -3683,6 +3677,12 @@  static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
 	if (err)
 		return err;
 
+	if (link_data->conf->eht_puncturing != link_data->conf->csa_punct_bitmap) {
+		link_data->conf->eht_puncturing =
+					link_data->conf->csa_punct_bitmap;
+		changed |= BSS_CHANGED_EHT_PUNCTURING;
+	}
+
 	ieee80211_link_info_change_notify(sdata, &sdata->deflink, changed);
 
 	if (sdata->deflink.csa_block_tx) {