diff mbox series

[35/76] wifi: mac80211: mlme: use ieee80211_get_link_sband()

Message ID 20220713114425.35973aa556f0.I1394dd82298f09c6cb452be538dba8ba13f11b01@changeid (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series wifi: more MLO work | expand

Commit Message

Johannes Berg July 13, 2022, 9:44 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

This requires a few more changes.

While at it, also add a warning to ieee80211_get_sband()
to avoid it being used when there are multiple links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/ieee80211_i.h |  2 ++
 net/mac80211/mlme.c        | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

Comments

Wen Gong Sept. 14, 2022, 10 a.m. UTC | #1
On 7/13/2022 5:44 PM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> This requires a few more changes.
>
> While at it, also add a warning to ieee80211_get_sband()
> to avoid it being used when there are multiple links.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>   net/mac80211/ieee80211_i.h |  2 ++
>   net/mac80211/mlme.c        | 12 ++++++------
>   2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index 3e360bcaa03b..a0743c78d171 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -1539,6 +1539,8 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
>   	struct ieee80211_chanctx_conf *chanctx_conf;
>   	enum nl80211_band band;
>   
> +	WARN_ON(sdata->vif.valid_links);
> +
>   	rcu_read_lock();
>   	chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
>   
Hi Johannes,

Now I hit below warning here in ieee80211_get_sband() in my MLO test for 
station.
Will you have more patch to fix the warning?

[  712.857016] ------------[ cut here ]------------
[  712.857020] ath12k_pci 0000:05:00.0: ext irq:40
[  712.857021] WARNING: CPU: 2 PID: 39 at 
net/mac80211/ieee80211_i.h:1572 
___ieee80211_start_rx_ba_session+0x8fe/0x930 [mac80211]
[  712.857140] Modules linked in: michael_mic ath12k(OE) qmi_helpers 
qrtr_mhi mhi(E) qrtr mac80211(OE) cfg80211(OE) libarc4 rfcomm bnep 
nls_iso8859_1 intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal 
intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul 
ghash_clmulni_intel aesni_intel snd_ctl_led snd_hda_codec_conexant 
crypto_simd cryptd rapl intel_cstate uvcvideo btusb snd_hda_codec_hdmi 
snd_hda_codec_generic btrtl btbcm snd_hda_intel btintel 
videobuf2_vmalloc bluetooth videobuf2_memops snd_intel_dspcfg 
ecdh_generic ecc videobuf2_v4l2 i915 videobuf2_common videodev cec mc 
rc_core drm_buddy ttm snd_hda_codec drm_display_helper snd_hda_core 
drm_kms_helper snd_seq_midi snd_seq_midi_event snd_rawmidi snd_hwdep 
i2c_algo_bit snd_seq snd_pcm thinkpad_acpi fb_sys_fops syscopyarea 
sysfillrect sysimgblt snd_seq_device snd_timer nvram mei_me at24 
ledtrig_audio platform_profile mei joydev input_leds snd soundcore 
serio_raw mac_hid wmi_bmof sch_fq_codel parport_pc ppdev lp parport drm
[  712.857298]  ip_tables x_tables autofs4 firewire_ohci sdhci_pci 
psmouse ahci firewire_core crc32_pclmul libahci i2c_i801 cqhci crc_itu_t 
i2c_smbus e1000e sdhci ptp lpc_ich pps_core wmi video
[  712.857336] CPU: 2 PID: 39 Comm: kworker/u16:1 Kdump: loaded Tainted: 
G        W  OE     5.19.0-rc6+ #4
[  712.857344] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW 
(1.33 ) 07/29/2011
[  712.857348] Workqueue: phy0 ieee80211_iface_work [mac80211]
[  712.857442] RIP: 0010:___ieee80211_start_rx_ba_session+0x8fe/0x930 
[mac80211]
[  712.857526] Code: a1 da 41 be 25 00 00 00 66 44 89 75 88 e9 54 fc ff 
ff b9 08 00 00 00 e9 7e fe ff ff e8 4b 91 a1 da 4c 8b 4d 88 e9 d8 fc ff 
ff <0f> 0b e9 05 fe ff ff 4c 89 5d a8 e8 32 91 a1 da 4c 8b 5d a8 e9 90
[  712.857533] RSP: 0018:ffffbafa401bbce0 EFLAGS: 00010206
[  712.857539] RAX: 0000000000000000 RBX: 0000000000004018 RCX: 
0000000000000000
[  712.857543] RDX: ffff8f48e1489e40 RSI: 0000000000000009 RDI: 
0000000000000103
[  712.857546] RBP: ffffbafa401bbd80 R08: ffffbafa401bbbc8 R09: 
0000000000004000
[  712.857550] R10: ffff8f49c0042a00 R11: ffff8f48f304c300 R12: 
ffff8f49c42f9000
[  712.857554] R13: ffff8f48e2b888e0 R14: 000000000000401b R15: 
ffff8f48c714c9c0
[  712.857558] FS:  0000000000000000(0000) GS:ffff8f49fa280000(0000) 
knlGS:0000000000000000
[  712.857562] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  712.857566] CR2: 000055a204665fe4 CR3: 000000004e00a003 CR4: 
00000000000606e0
[  712.857571] Call Trace:
[  712.857617]  <TASK>
[  712.857639]  ieee80211_process_addba_request+0xb7/0x190 [mac80211]
[  712.857740]  ieee80211_iface_work+0x3d1/0x410 [mac80211]
[  712.857803]  process_one_work+0x227/0x440
[  712.857812]  worker_thread+0x31/0x3e0
[  712.857817]  ? process_one_work+0x440/0x440
[  712.857822]  kthread+0xfe/0x130
[  712.857829]  ? kthread_complete_and_exit+0x20/0x20
[  712.857836]  ret_from_fork+0x22/0x30
[  712.857846]  </TASK>
[  712.857848] ---[ end trace 0000000000000000 ]---
...
>
Johannes Berg Sept. 27, 2022, 8:15 a.m. UTC | #2
On Wed, 2022-09-14 at 18:00 +0800, Wen Gong wrote:
> On 7/13/2022 5:44 PM, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > This requires a few more changes.
> > 
> > While at it, also add a warning to ieee80211_get_sband()
> > to avoid it being used when there are multiple links.
> > 
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> > ---
> >   net/mac80211/ieee80211_i.h |  2 ++
> >   net/mac80211/mlme.c        | 12 ++++++------
> >   2 files changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> > index 3e360bcaa03b..a0743c78d171 100644
> > --- a/net/mac80211/ieee80211_i.h
> > +++ b/net/mac80211/ieee80211_i.h
> > @@ -1539,6 +1539,8 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
> >   	struct ieee80211_chanctx_conf *chanctx_conf;
> >   	enum nl80211_band band;
> >   
> > +	WARN_ON(sdata->vif.valid_links);
> > +
> >   	rcu_read_lock();
> >   	chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
> >   
> Hi Johannes,
> 
> Now I hit below warning here in ieee80211_get_sband() in my MLO test for 
> station.
> Will you have more patch to fix the warning?
> 

Yeah still working on all this, obviously ...

That should be fairly harmless for now, unless you're trying to use 1k
block-ack.

johannes
diff mbox series

Patch

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 3e360bcaa03b..a0743c78d171 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1539,6 +1539,8 @@  ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
 	struct ieee80211_chanctx_conf *chanctx_conf;
 	enum nl80211_band band;
 
+	WARN_ON(sdata->vif.valid_links);
+
 	rcu_read_lock();
 	chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 80a31777922e..edd7f74f1ef3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2264,17 +2264,17 @@  static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
 	mutex_unlock(&sdata->local->mtx);
 }
 
-static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
+static u32 ieee80211_handle_bss_capability(struct ieee80211_link_data *link,
 					   u16 capab, bool erp_valid, u8 erp)
 {
-	struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
+	struct ieee80211_bss_conf *bss_conf = link->conf;
 	struct ieee80211_supported_band *sband;
 	u32 changed = 0;
 	bool use_protection;
 	bool use_short_preamble;
 	bool use_short_slot;
 
-	sband = ieee80211_get_sband(sdata);
+	sband = ieee80211_get_link_sband(link);
 	if (!sband)
 		return changed;
 
@@ -2320,7 +2320,7 @@  static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg;
 
 	bss_info_changed |= BSS_CHANGED_ASSOC;
-	bss_info_changed |= ieee80211_handle_bss_capability(sdata,
+	bss_info_changed |= ieee80211_handle_bss_capability(link,
 		bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value);
 
 	sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec(
@@ -3621,7 +3621,7 @@  static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 		goto out;
 	}
 
-	sband = ieee80211_get_sband(sdata);
+	sband = ieee80211_get_link_sband(link);
 	if (!sband) {
 		mutex_unlock(&sdata->local->sta_mtx);
 		ret = false;
@@ -4429,7 +4429,7 @@  static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
 	}
 
 	if (!ieee80211_is_s1g_beacon(hdr->frame_control))
-		changed |= ieee80211_handle_bss_capability(sdata,
+		changed |= ieee80211_handle_bss_capability(link,
 				le16_to_cpu(mgmt->u.beacon.capab_info),
 				erp_valid, erp_value);