wifi: cfg80211: Schedule regulatory check on BSS STA channel change
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Wed, 20 Dec 2023 11:41:35 +0000 (13:41 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 21 Dec 2023 19:35:14 +0000 (20:35 +0100)
Due to different relaxation policies it may be needed to re-check
channels after a BSS station interface is disconnected or performed a
channel switch.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231220133549.1f2f8475bcf1.I1879d259d8d756159c8060f61f4bce172e6d323e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/nl80211.c
net/wireless/reg.c
net/wireless/reg.h
net/wireless/sme.c

index 501d4421514f04bdbaa5a2a7eed950477a4db7a8..745974d45ea463fd5a5026d9b4c5881ba0a6ff85 100644 (file)
@@ -9391,6 +9391,16 @@ bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
  */
 void cfg80211_links_removed(struct net_device *dev, u16 link_mask);
 
+/**
+ * cfg80211_schedule_channels_check - schedule regulatory check if needed
+ * @wdev: the wireless device to check
+ *
+ * In case the device supports NO_IR or DFS relaxations, schedule regulatory
+ * channels check, as previous concurrent operation conditions may not
+ * hold anymore.
+ */
+void cfg80211_schedule_channels_check(struct wireless_dev *wdev);
+
 #ifdef CONFIG_CFG80211_DEBUGFS
 /**
  * wiphy_locked_debugfs_read - do a locked read in debugfs
index bd65c3ccc5e7157b25a8ba6d62251744a01cd2b9..534ef3fe0696a46868b5521066d9aab88723dc14 100644 (file)
@@ -19474,6 +19474,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
                break;
        }
 
+       cfg80211_schedule_channels_check(wdev);
        cfg80211_sched_dfs_chan_update(rdev);
 
        nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
@@ -20231,6 +20232,20 @@ nla_put_failure:
 }
 EXPORT_SYMBOL(cfg80211_update_owe_info_event);
 
+void cfg80211_schedule_channels_check(struct wireless_dev *wdev)
+{
+       struct wiphy *wiphy = wdev->wiphy;
+
+       /* Schedule channels check if NO_IR or DFS relaxations are supported */
+       if (wdev->iftype == NL80211_IFTYPE_STATION &&
+           (wiphy_ext_feature_isset(wiphy,
+                                    NL80211_EXT_FEATURE_DFS_CONCURRENT) ||
+           (IS_ENABLED(CONFIG_CFG80211_REG_RELAX_NO_IR) &&
+            wiphy->regulatory_flags & REGULATORY_ENABLE_RELAX_NO_IR)))
+               reg_check_channels();
+}
+EXPORT_SYMBOL(cfg80211_schedule_channels_check);
+
 /* initialisation/exit functions */
 
 int __init nl80211_init(void)
index 9a61b3322fd2c128e2e47f994ac204f7eb6b635c..44684df6473435db87d1a110bfada54749417dd8 100644 (file)
@@ -2480,7 +2480,7 @@ static void reg_check_chans_work(struct work_struct *work)
        rtnl_unlock();
 }
 
-static void reg_check_channels(void)
+void reg_check_channels(void)
 {
        /*
         * Give usermode a chance to do something nicer (move to another
index a703e53c23ee3ea7d6dd5e69494c39f61624c557..a02ef5609f52dc590bcc3b0e6581069b59029c2c 100644 (file)
@@ -181,6 +181,11 @@ bool reg_dfs_domain_same(struct wiphy *wiphy1, struct wiphy *wiphy2);
  */
 int reg_reload_regdb(void);
 
+/**
+ * reg_check_channels - schedule regulatory enforcement
+ */
+void reg_check_channels(void);
+
 extern const u8 shipped_regdb_certs[];
 extern unsigned int shipped_regdb_certs_len;
 extern const u8 extra_regdb_certs[];
index acfe66da7109b7655589acacd21d497050a4f320..195c8532734bdb1bd8068dda831a5b942b2c0ac9 100644 (file)
@@ -1394,6 +1394,8 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
 #endif
 
        schedule_work(&cfg80211_disconnect_work);
+
+       cfg80211_schedule_channels_check(wdev);
 }
 
 void cfg80211_disconnected(struct net_device *dev, u16 reason,