]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mld: honor BSS_CHANGED_BEACON_ENABLED
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 11 May 2026 17:36:20 +0000 (20:36 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 26 May 2026 12:17:09 +0000 (15:17 +0300)
We should stick to mac80211's flow to start / stop beaconing. This
allows to stop beaconing before we remove the BIGTK.

Note that the start and stop beaconing flows are not exactly symmetric.
When we start beaconing, we just update the beacon template. We assume
that mac80211 won't update the beacons, if we're not supposed to be
sending it.

Also note that we now send the beacon template after the broadcast
station was added to the firmware: the broadcast station is added in
the start_ap() flow, while the beacon template is now added in the
link_changed() flow which happens later. This is not what we did
before this patch, but this sequence is supported by the firmware as
well.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20260511203428.cf10e5754171.I8022517c6c5aedb4b56fba30a5545de8f62dddbe@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/mld/ap.c
drivers/net/wireless/intel/iwlwifi/mld/ap.h
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c

index 5c59acc8c4c5a04053e66c51911bfcd8f8dfc738..c29e4a77be058329253b29ef5e8ed4466e148691 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2024 Intel Corporation
+ * Copyright (C) 2024, 2026 Intel Corporation
  */
 #include <linux/crc32.h>
 
@@ -239,6 +239,25 @@ int iwl_mld_store_ap_early_key(struct iwl_mld *mld,
        return -ENOSPC;
 }
 
+void iwl_mld_stop_beacon(struct iwl_mld *mld, struct ieee80211_vif *vif,
+                        struct ieee80211_bss_conf *link)
+{
+       struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link);
+       struct iwl_mac_beacon_cmd cmd = {};
+       int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, BEACON_TEMPLATE_CMD, 14);
+
+       if (WARN_ON(!mld_link))
+               return;
+
+       if (cmd_ver < 15)
+               return;
+
+       /* leave byte_cnt 0 */
+       cmd.link_id = cpu_to_le32(mld_link->fw_id);
+
+       iwl_mld_send_cmd_pdu(mld, BEACON_TEMPLATE_CMD, &cmd);
+}
+
 static int iwl_mld_send_ap_early_keys(struct iwl_mld *mld,
                                      struct ieee80211_vif *vif,
                                      struct ieee80211_bss_conf *link)
@@ -276,10 +295,6 @@ int iwl_mld_start_ap_ibss(struct ieee80211_hw *hw,
        if (vif->type == NL80211_IFTYPE_AP)
                iwl_mld_send_ap_tx_power_constraint_cmd(mld, vif, link);
 
-       ret = iwl_mld_update_beacon_template(mld, vif, link);
-       if (ret)
-               return ret;
-
        /* the link should be already activated when assigning chan context,
         * and LINK_CONTEXT_MODIFY_EHT_PARAMS is deprecated
         */
index 4a6f52b9552d7734b84525777bf9e44e2430c178..a3b6bed814adfceaeb77c6c5e93c345e94bc0363 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2024 Intel Corporation
+ * Copyright (C) 2024, 2026 Intel Corporation
  */
 #ifndef __iwl_ap_h__
 #define __iwl_ap_h__
@@ -14,6 +14,10 @@ int iwl_mld_update_beacon_template(struct iwl_mld *mld,
                                   struct ieee80211_vif *vif,
                                   struct ieee80211_bss_conf *link_conf);
 
+void iwl_mld_stop_beacon(struct iwl_mld *mld,
+                        struct ieee80211_vif *vif,
+                        struct ieee80211_bss_conf *link_conf);
+
 int iwl_mld_start_ap_ibss(struct ieee80211_hw *hw,
                          struct ieee80211_vif *vif,
                          struct ieee80211_bss_conf *link);
index 1106ad651cfec691c6cf1a2fce7288d34f2b3d8d..403bc38ac2bcd7f754b5dcf149c6a3cb3dd78544 100644 (file)
@@ -1258,8 +1258,14 @@ iwl_mld_link_info_changed_ap_ibss(struct iwl_mld *mld,
        if (link_changes)
                iwl_mld_change_link_in_fw(mld, link, link_changes);
 
-       if (changes & BSS_CHANGED_BEACON)
+       if (changes & BSS_CHANGED_BEACON) {
+               WARN_ON(!link->enable_beacon);
                iwl_mld_update_beacon_template(mld, vif, link);
+       }
+
+       /* Enabling beacons was already covered above */
+       if ((changes & BSS_CHANGED_BEACON_ENABLED) && !link->enable_beacon)
+               iwl_mld_stop_beacon(mld, vif, link);
 }
 
 static