diff mbox series

[v2,3/4] wifi: mac80211: notify BSS change upon AP power save change

Message ID 20230320164334.3325886-4-quic_mkenna@quicinc.com (mailing list archive)
State Rejected
Delegated to: Johannes Berg
Headers show
Series Add AP power save support | expand

Commit Message

Maharaja Kennadyrajan March 20, 2023, 4:43 p.m. UTC
From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>

Notify BSS change to the drivers upon AP power save
changes through ieee80211_vif_cfg_change_notify().

BSS_CHANGED_PS is reused to notify the AP power save
change, which is currently used only for STA mode.

A new hw flag IEEE80211_HW_SUPPORTS_AP_PS is introduced
for backward compatibility and notify the AP power save
change to the drivers which support AP power save.

Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
---
 include/net/mac80211.h |  7 ++++++-
 net/mac80211/cfg.c     | 23 +++++++++++++++++------
 net/mac80211/debugfs.c |  1 +
 3 files changed, 24 insertions(+), 7 deletions(-)

Comments

kernel test robot March 24, 2023, 2:27 a.m. UTC | #1
Greeting,

FYI, we noticed WARNING:at_net/mac80211/main.c:#ieee80211_vif_cfg_change_notify[mac80211] due to commit (built with gcc-11):

commit: 33c0818ac663229217c2de4b85fe7e1cd3759f4e ("[PATCH v2 3/4] wifi: mac80211: notify BSS change upon AP power save change")
url: https://github.com/intel-lab-lkp/linux/commits/Maharaja-Kennadyrajan/wifi-nl80211-rename-NL80211_CMD_SET_BEACON-to-NL80211_CMD_UDPATE_AP/20230321-005501
base: https://git.kernel.org/cgit/linux/kernel/git/wireless/wireless-next.git main
patch link: https://lore.kernel.org/all/20230320164334.3325886-4-quic_mkenna@quicinc.com/
patch subject: [PATCH v2 3/4] wifi: mac80211: notify BSS change upon AP power save change

in testcase: hwsim
version: hwsim-i386-717e5d7-1_20220926
with following parameters:

	test: group-28



on test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-4790T CPU @ 2.70GHz (Haswell) with 16G memory

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Link: https://lore.kernel.org/oe-lkp/202303241011.e6fb5f16-oliver.sang@intel.com


[   91.021435][ T4322] ------------[ cut here ]------------
[   91.026759][ T4322] WARNING: CPU: 2 PID: 4322 at net/mac80211/main.c:268 ieee80211_vif_cfg_change_notify+0x15c/0x1a8 [mac80211]
[   91.038283][ T4322] Modules linked in: ctr(E) ccm(E) mac80211_hwsim(E) mac80211(E) cfg80211(E) virtio(E) virtio_ring(E) libarc4(E) netconsole(E) intel_rapl_msr(E) intel_rapl_common(E) btrfs(E) x86_pkg_temp_thermal(E) blake2b_generic(E) intel_powerclamp(E) xor(E) coretemp(E) ipmi_devintf(E) kvm_intel(E) ipmi_msghandler(E) raid6_pq(E) kvm(E) irqbypass(E) libcrc32c(E) crc32_pclmul(E) crc32c_generic(E) crc32c_intel(E) aesni_intel(E) crypto_simd(E) sd_mod(E) cryptd(E) t10_pi(E) i915(E) rapl(E) drm_buddy(E) crc64_rocksoft_generic(E) crc64_rocksoft(E) drm_display_helper(E) crc64(E) cec(E) at24(E) intel_cstate(E) regmap_i2c(E) xhci_pci(E) ttm(E) i2c_i801(E) ehci_pci(E) mei_me(E) ahci(E) lpc_ich(E) xhci_hcd(E) libahci(E) ehci_hcd(E) drm_kms_helper(E) intel_uncore(E) evdev(E) mxm_wmi(E) i2c_smbus(E) mfd_core(E) syscopyarea(E) sysfillrect(E) usbcore(E) video(E) mei(E) thermal(E) libata(E) fan(E) usb_common(E) sysimgblt(E) acpi_pad(E) wmi(E) button(E) fuse(E) drm(E) configfs(E) autofs4(E)
[   91.122477][  T244] wlan0: associate with 02:00:00:00:03:00 (try 2/3)
[   91.124715][ T4322] CPU: 2 PID: 4322 Comm: hostapd Tainted: G S          E      6.3.0-rc1-00495-g33c0818ac663 #1
[   91.141343][ T4322] Hardware name: Gigabyte Technology Co., Ltd. Z97X-UD5H/Z97X-UD5H, BIOS F9 04/21/2015
[   91.150817][ T4322] EIP: ieee80211_vif_cfg_change_notify+0x15c/0x1a8 [mac80211]
[   91.158166][ T4322] Code: c0 0f 84 4d ff ff ff 57 8b 45 f0 8d 93 44 0d 00 00 8d 8b 90 0d 00 00 56 8b 7d ec ff d7 58 5a e9 30 ff ff ff 8d b6 00 00 00 00 <0f> 0b e9 d0 fe ff ff 8d b4 26 00 00 00 00 66 90 80 3d df f4 6a f9
[   91.177616][ T4322] EAX: 00000100 EBX: f4a40600 ECX: 00000000 EDX: 00000100
[   91.184600][ T4322] ESI: 00000100 EDI: 00000000 EBP: f4add8cc ESP: f4add8b8
[   91.191574][ T4322] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 EFLAGS: 00210206
[   91.199052][ T4322] CR0: 80050033 CR2: b7e7dc45 CR3: 34ace000 CR4: 001506f0
[   91.206010][ T4322] Call Trace:
[   91.209176][ T4322]  ieee80211_update_ap+0xa6/0x120 [mac80211]
[   91.215070][ T4322]  nl80211_update_ap+0x109/0x22c [cfg80211]
[   91.220879][ T4322]  genl_family_rcv_msg+0x20f/0x35c
[   91.225855][ T4322]  ? poll_schedule_timeout+0x6c/0x6c
[   91.232044][ T4322]  ? __cfg80211_rdev_from_attrs+0x1a8/0x1a8 [cfg80211]
[   91.234481][  T243] wlan0: associate with 02:00:00:00:03:00 (try 3/3)
[   91.238796][ T4322]  ? cfg80211_net_detect_results+0x1ac/0x1ac [cfg80211]
[   91.252650][ T4322]  ? nl80211_add_commands_unsplit+0x720/0x720 [cfg80211]
[   91.259556][ T4322]  genl_rcv_msg+0x3d/0x80
[   91.263739][ T4322]  ? genl_family_rcv_msg+0x35c/0x35c
[   91.268887][ T4322]  netlink_rcv_skb+0x47/0xe0
[   91.273352][ T4322]  genl_rcv+0x21/0x30
[   91.277188][ T4322]  netlink_unicast+0x1f0/0x2f0
[   91.281829][ T4322]  netlink_sendmsg+0x26b/0x474
[   91.286458][ T4322]  sock_sendmsg+0x31/0x70
[   91.290668][ T4322]  ____sys_sendmsg+0x1c2/0x250
[   91.295296][ T4322]  ___sys_sendmsg+0x5e/0x94
[   91.299665][ T4322]  ? folio_mark_dirty+0x26/0x54
[   91.304398][ T4322]  ? unlock_page+0x19/0x1c
[   91.308678][ T4322]  ? simple_write_end+0x76/0xfc
[   91.313393][ T4322]  ? balance_dirty_pages_ratelimited_flags+0x1c/0x37c
[   91.320003][ T4322]  ? balance_dirty_pages_ratelimited+0xf/0x14
[   91.325943][ T4322]  ? generic_perform_write+0x125/0x1c0
[   91.331264][ T4322]  ? __might_sleep+0x33/0x7c
[   91.335734][ T4322]  __sys_sendmsg+0x3e/0x78
[   91.340017][ T4322]  ? netlink_setsockopt+0x1/0x3ac
[   91.344903][ T4322]  __do_sys_socketcall+0x15a/0x2e4
[   91.346483][  T244] wlan0: association with 02:00:00:00:03:00 timed out
[   91.349866][ T4322]  __ia32_sys_socketcall+0x12/0x14
[   91.361460][ T4322]  __do_fast_syscall_32+0x56/0xc0
[   91.366355][ T4322]  do_fast_syscall_32+0x29/0x60
[   91.371068][ T4322]  do_SYSENTER_32+0x15/0x18
[   91.375437][ T4322]  entry_SYSENTER_32+0x98/0xf1
[   91.380065][ T4322] EIP: 0xb7fcf589
[   91.383566][ T4322] Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
[   91.403017][ T4322] EAX: ffffffda EBX: 00000010 ECX: bfb587a0 EDX: 00000000
[   91.409973][ T4322] ESI: 00000000 EDI: 023986d0 EBP: 0239a2f0 ESP: bfb58790
[   91.416950][ T4322] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00200282
[   91.424441][ T4322] ---[ end trace 0000000000000000 ]---



To reproduce:

        git clone https://github.com/intel/lkp-tests.git
        cd lkp-tests
        sudo bin/lkp install job.yaml           # job file is attached in this email
        bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
        sudo bin/lkp run generated-yaml-file

        # if come across any failure that blocks the test,
        # please remove ~/.lkp and /lkp dir to run from a clean state.
diff mbox series

Patch

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f12edca660ba..963607b64226 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -318,7 +318,7 @@  struct ieee80211_vif_chanctx_switch {
  * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
  * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
  * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
- * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
+ * @BSS_CHANGED_PS: PS changed for this BSS (AP and STA mode)
  * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
  * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
  *	changed
@@ -683,6 +683,7 @@  struct ieee80211_fils_discovery {
  *	beamformee
  * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU
  *	beamformer
+ * @ap_ps_enable: enable/disable ap power save.
  */
 struct ieee80211_bss_conf {
 	struct ieee80211_vif *vif;
@@ -776,6 +777,7 @@  struct ieee80211_bss_conf {
 	bool eht_su_beamformer;
 	bool eht_su_beamformee;
 	bool eht_mu_beamformer;
+	bool ap_ps_enable;
 };
 
 /**
@@ -2646,6 +2648,8 @@  struct ieee80211_txq {
  * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
  *	multicast frames on all links, mac80211 should not do that.
  *
+ * @IEEE80211_HW_SUPPORTS_AP_PS: Hardware supports AP power save.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -2703,6 +2707,7 @@  enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
 	IEEE80211_HW_DETECTS_COLOR_COLLISION,
 	IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
+	IEEE80211_HW_SUPPORTS_AP_PS,
 
 	/* keep last, obviously */
 	NUM_IEEE80211_HW_FLAGS
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 657be3d4dfcd..a9aec880721a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1468,6 +1468,7 @@  static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev,
 	struct beacon_data *old;
 	int err;
 	struct ieee80211_bss_conf *link_conf;
+	u32 changed = 0;
 
 	sdata_assert_lock(sdata);
 
@@ -1488,20 +1489,30 @@  static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev,
 	if (!old)
 		return -ENOENT;
 
-	err = ieee80211_assign_beacon(sdata, link, &params->settings.beacon,
-				      NULL, NULL);
-	if (err < 0)
-		return err;
+	if (test_bit(BEACON_VALID, params->valid)) {
+		err = ieee80211_assign_beacon(sdata, link, &params->settings.beacon,
+					      NULL, NULL);
+		if (err < 0)
+			return err;
+
+		changed |= err;
+	}
+
+	if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_AP_PS) &&
+	    test_bit(AP_PS_VALID, params->valid)) {
+		sdata->vif.bss_conf.ap_ps_enable = params->settings.ap_ps_enable;
+		changed |= BSS_CHANGED_PS;
+	}
 
 	if (params->settings.beacon.he_bss_color_valid &&
 	    params->settings.beacon.he_bss_color.enabled !=
 	    link_conf->he_bss_color.enabled) {
 		link_conf->he_bss_color.enabled =
 			params->settings.beacon.he_bss_color.enabled;
-		err |= BSS_CHANGED_HE_BSS_COLOR;
+		changed |= BSS_CHANGED_HE_BSS_COLOR;
 	}
 
-	ieee80211_link_info_change_notify(sdata, link, err);
+	ieee80211_vif_cfg_change_notify(sdata, changed);
 	return 0;
 }
 
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index dfb9f55e2685..9cf744917a5f 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -496,6 +496,7 @@  static const char *hw_flag_names[] = {
 	FLAG(SUPPORTS_CONC_MON_RX_DECAP),
 	FLAG(DETECTS_COLOR_COLLISION),
 	FLAG(MLO_MCAST_MULTI_LINK_TX),
+	FLAG(SUPPORTS_AP_PS),
 #undef FLAG
 };