wifi: mac80211: move dynamic PS to wiphy work
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:44 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 09:27:20 +0000 (11:27 +0200)
Along with everything else, move the dynamic PS work
to be a wiphy work, to simplify locking later.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/main.c
net/mac80211/mlme.c
net/mac80211/offchannel.c
net/mac80211/pm.c
net/mac80211/tx.c

index 3db1accb0903c08455f0e32e2873d7b31fd59aae..96cecc3d71f0252652165f41f1976dd79a998194 100644 (file)
@@ -1560,8 +1560,8 @@ struct ieee80211_local {
         * interface (and monitors) in PS, this then points there.
         */
        struct ieee80211_sub_if_data *ps_sdata;
-       struct work_struct dynamic_ps_enable_work;
-       struct work_struct dynamic_ps_disable_work;
+       struct wiphy_work dynamic_ps_enable_work;
+       struct wiphy_work dynamic_ps_disable_work;
        struct timer_list dynamic_ps_timer;
        struct notifier_block ifa_notifier;
        struct notifier_block ifa6_notifier;
@@ -2348,8 +2348,10 @@ static inline int ieee80211_ac_from_tid(int tid)
        return ieee802_1d_to_ac[tid & 7];
 }
 
-void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
-void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
+void ieee80211_dynamic_ps_enable_work(struct wiphy *wiphy,
+                                     struct wiphy_work *work);
+void ieee80211_dynamic_ps_disable_work(struct wiphy *wiphy,
+                                      struct wiphy_work *work);
 void ieee80211_dynamic_ps_timer(struct timer_list *t);
 void ieee80211_send_nullfunc(struct ieee80211_local *local,
                             struct ieee80211_sub_if_data *sdata,
index fa4514642d7469c1f4cf7bfafeb99c78b53623cf..6dc6cdc1cd37859b73060b1b77dbf4d6373d4641 100644 (file)
@@ -516,7 +516,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
        }
 
        del_timer_sync(&local->dynamic_ps_timer);
-       cancel_work_sync(&local->dynamic_ps_enable_work);
+       wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work);
 
        sdata_lock(sdata);
        WARN(ieee80211_vif_is_mld(&sdata->vif),
index e686b0cc2cd85669e8b3bafe15285dd847beb060..7c165e78115c9ca4404696b45621275c732d8e7a 100644 (file)
@@ -837,10 +837,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
        INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
        local->smps_mode = IEEE80211_SMPS_OFF;
 
-       INIT_WORK(&local->dynamic_ps_enable_work,
-                 ieee80211_dynamic_ps_enable_work);
-       INIT_WORK(&local->dynamic_ps_disable_work,
-                 ieee80211_dynamic_ps_disable_work);
+       wiphy_work_init(&local->dynamic_ps_enable_work,
+                       ieee80211_dynamic_ps_enable_work);
+       wiphy_work_init(&local->dynamic_ps_disable_work,
+                       ieee80211_dynamic_ps_disable_work);
        timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
 
        INIT_WORK(&local->sched_scan_stopped_work,
index ab0be5c3086079d1f02cd344afbe42fcaef60a92..f36279e8792e6d7344a589ec096734668eefa121 100644 (file)
@@ -2211,7 +2211,8 @@ static void ieee80211_change_ps(struct ieee80211_local *local)
                conf->flags &= ~IEEE80211_CONF_PS;
                ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
                del_timer_sync(&local->dynamic_ps_timer);
-               cancel_work_sync(&local->dynamic_ps_enable_work);
+               wiphy_work_cancel(local->hw.wiphy,
+                                 &local->dynamic_ps_enable_work);
        }
 }
 
@@ -2308,7 +2309,8 @@ void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata)
        }
 }
 
-void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
+void ieee80211_dynamic_ps_disable_work(struct wiphy *wiphy,
+                                      struct wiphy_work *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local,
@@ -2325,7 +2327,8 @@ void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
                                        false);
 }
 
-void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
+void ieee80211_dynamic_ps_enable_work(struct wiphy *wiphy,
+                                     struct wiphy_work *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local,
@@ -2398,7 +2401,7 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t)
 {
        struct ieee80211_local *local = from_timer(local, t, dynamic_ps_timer);
 
-       ieee80211_queue_work(&local->hw, &local->dynamic_ps_enable_work);
+       wiphy_work_queue(local->hw.wiphy, &local->dynamic_ps_enable_work);
 }
 
 void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work)
@@ -3002,7 +3005,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL;
 
        del_timer_sync(&local->dynamic_ps_timer);
-       cancel_work_sync(&local->dynamic_ps_enable_work);
+       wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work);
 
        /* Disable ARP filtering */
        if (sdata->vif.cfg.arp_addr_cnt)
index 5bedd9cef414d01f44aad1f6312ac9b7dfc5feda..df68d9838f876590d173a4418f77711b1846ec74 100644 (file)
@@ -34,7 +34,7 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
        del_timer_sync(&ifmgd->bcn_mon_timer);
        del_timer_sync(&ifmgd->conn_mon_timer);
 
-       cancel_work_sync(&local->dynamic_ps_enable_work);
+       wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work);
 
        if (local->hw.conf.flags & IEEE80211_CONF_PS) {
                offchannel_ps_enabled = true;
index 0ccb5701c7f398377077d0ab3985f66b9f380837..10eb72b9b994e070a61161e7b143844cf3ff6625 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Portions
- * Copyright (C) 2020-2021 Intel Corporation
+ * Copyright (C) 2020-2021, 2023 Intel Corporation
  */
 #include <net/mac80211.h>
 #include <net/rtnetlink.h>
@@ -76,7 +76,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
         * Note that this particular timer doesn't need to be
         * restarted at resume.
         */
-       cancel_work_sync(&local->dynamic_ps_enable_work);
+       wiphy_work_cancel(local->hw.wiphy, &local->dynamic_ps_enable_work);
        del_timer_sync(&local->dynamic_ps_timer);
 
        local->wowlan = wowlan;
index ae33f727c6a8b2fdc46e74048502db46324cb479..5cff936c6211bf6fe8802e946d42bd420cf07dfd 100644 (file)
@@ -266,8 +266,8 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
                                                IEEE80211_QUEUE_STOP_REASON_PS,
                                                false);
                ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED;
-               ieee80211_queue_work(&local->hw,
-                                    &local->dynamic_ps_disable_work);
+               wiphy_work_queue(local->hw.wiphy,
+                                &local->dynamic_ps_disable_work);
        }
 
        /* Don't restart the timer if we're not disassociated */