]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: mac80211: move radar detect work to wiphy work
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:38 +0000 (13:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:56:45 +0000 (11:56 +0100)
[ Upstream commit 228e4f931b0e630dacca8dd867ddd863aea53913 ]

Move the radar detect work to wiphy work in order
to lock the wiphy for it without doing it manually.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Stable-dep-of: eadfb54756ae ("wifi: mac80211: move sched-scan stop work to wiphy work")
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mac80211/ieee80211_i.h
net/mac80211/main.c
net/mac80211/util.c

index 2cce9eba6a1207539f182e837126c27366cb4c37..90eda427e9ab800a3f25219ac41846617a4ddcb2 100644 (file)
@@ -1406,7 +1406,7 @@ struct ieee80211_local {
        /* wowlan is enabled -- don't reconfig on resume */
        bool wowlan;
 
-       struct work_struct radar_detected_work;
+       struct wiphy_work radar_detected_work;
 
        /* number of RX chains the hardware has */
        u8 rx_chains;
@@ -2568,7 +2568,8 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local);
 void ieee80211_dfs_cac_timer(unsigned long data);
 void ieee80211_dfs_cac_timer_work(struct work_struct *work);
 void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
-void ieee80211_dfs_radar_detected_work(struct work_struct *work);
+void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
+                                      struct wiphy_work *work);
 int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
                              struct cfg80211_csa_settings *csa_settings);
 
index 24315d7b31263e8bc281b9d7d06d5790a3126a6e..3bbd66e5a0df0d46f7f44615a7afac491a8b69b0 100644 (file)
@@ -338,7 +338,6 @@ static void ieee80211_restart_work(struct work_struct *work)
        /* wait for scan work complete */
        flush_workqueue(local->workqueue);
        flush_work(&local->sched_scan_stopped_work);
-       flush_work(&local->radar_detected_work);
 
        rtnl_lock();
        /* we might do interface manipulations, so need both */
@@ -813,8 +812,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
 
        INIT_WORK(&local->restart_work, ieee80211_restart_work);
 
-       INIT_WORK(&local->radar_detected_work,
-                 ieee80211_dfs_radar_detected_work);
+       wiphy_work_init(&local->radar_detected_work,
+                       ieee80211_dfs_radar_detected_work);
 
        INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
        local->smps_mode = IEEE80211_SMPS_OFF;
@@ -1482,13 +1481,15 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
         */
        ieee80211_remove_interfaces(local);
 
+       wiphy_lock(local->hw.wiphy);
+       wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work);
+       wiphy_unlock(local->hw.wiphy);
        rtnl_unlock();
 
        cancel_delayed_work_sync(&local->roc_work);
        cancel_work_sync(&local->restart_work);
        cancel_work_sync(&local->reconfig_filter);
        flush_work(&local->sched_scan_stopped_work);
-       flush_work(&local->radar_detected_work);
 
        ieee80211_clear_tx_pending(local);
        rate_control_deinitialize(local);
index 8a6917cf63cf9d6d4b0c05cda0b0a6ae7c83a8bf..e878b6a27651af5d286cfd5796ac439a011cf397 100644 (file)
@@ -4356,7 +4356,8 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
        mutex_unlock(&local->mtx);
 }
 
-void ieee80211_dfs_radar_detected_work(struct work_struct *work)
+void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
+                                      struct wiphy_work *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local, radar_detected_work);
@@ -4374,9 +4375,7 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
        }
        mutex_unlock(&local->chanctx_mtx);
 
-       wiphy_lock(local->hw.wiphy);
        ieee80211_dfs_cac_cancel(local);
-       wiphy_unlock(local->hw.wiphy);
 
        if (num_chanctx > 1)
                /* XXX: multi-channel is not supported yet */
@@ -4391,7 +4390,7 @@ void ieee80211_radar_detected(struct ieee80211_hw *hw)
 
        trace_api_radar_detected(local);
 
-       schedule_work(&local->radar_detected_work);
+       wiphy_work_queue(hw->wiphy, &local->radar_detected_work);
 }
 EXPORT_SYMBOL(ieee80211_radar_detected);