Commit 9fa659f9 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: move dynamic PS to wiphy work

Along with everything else, move the dynamic PS work
to be a wiphy work, to simplify locking later.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7206a948
...@@ -1560,8 +1560,8 @@ struct ieee80211_local { ...@@ -1560,8 +1560,8 @@ struct ieee80211_local {
* interface (and monitors) in PS, this then points there. * interface (and monitors) in PS, this then points there.
*/ */
struct ieee80211_sub_if_data *ps_sdata; struct ieee80211_sub_if_data *ps_sdata;
struct work_struct dynamic_ps_enable_work; struct wiphy_work dynamic_ps_enable_work;
struct work_struct dynamic_ps_disable_work; struct wiphy_work dynamic_ps_disable_work;
struct timer_list dynamic_ps_timer; struct timer_list dynamic_ps_timer;
struct notifier_block ifa_notifier; struct notifier_block ifa_notifier;
struct notifier_block ifa6_notifier; struct notifier_block ifa6_notifier;
...@@ -2348,8 +2348,10 @@ static inline int ieee80211_ac_from_tid(int tid) ...@@ -2348,8 +2348,10 @@ static inline int ieee80211_ac_from_tid(int tid)
return ieee802_1d_to_ac[tid & 7]; return ieee802_1d_to_ac[tid & 7];
} }
void ieee80211_dynamic_ps_enable_work(struct work_struct *work); void ieee80211_dynamic_ps_enable_work(struct wiphy *wiphy,
void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 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_dynamic_ps_timer(struct timer_list *t);
void ieee80211_send_nullfunc(struct ieee80211_local *local, void ieee80211_send_nullfunc(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata, struct ieee80211_sub_if_data *sdata,
......
...@@ -516,7 +516,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -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); 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); sdata_lock(sdata);
WARN(ieee80211_vif_is_mld(&sdata->vif), WARN(ieee80211_vif_is_mld(&sdata->vif),
......
...@@ -837,10 +837,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, ...@@ -837,10 +837,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter); INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
local->smps_mode = IEEE80211_SMPS_OFF; local->smps_mode = IEEE80211_SMPS_OFF;
INIT_WORK(&local->dynamic_ps_enable_work, wiphy_work_init(&local->dynamic_ps_enable_work,
ieee80211_dynamic_ps_enable_work); ieee80211_dynamic_ps_enable_work);
INIT_WORK(&local->dynamic_ps_disable_work, wiphy_work_init(&local->dynamic_ps_disable_work,
ieee80211_dynamic_ps_disable_work); ieee80211_dynamic_ps_disable_work);
timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0); timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
INIT_WORK(&local->sched_scan_stopped_work, INIT_WORK(&local->sched_scan_stopped_work,
......
...@@ -2211,7 +2211,8 @@ static void ieee80211_change_ps(struct ieee80211_local *local) ...@@ -2211,7 +2211,8 @@ static void ieee80211_change_ps(struct ieee80211_local *local)
conf->flags &= ~IEEE80211_CONF_PS; conf->flags &= ~IEEE80211_CONF_PS;
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
del_timer_sync(&local->dynamic_ps_timer); 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) ...@@ -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 = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, container_of(work, struct ieee80211_local,
...@@ -2325,7 +2327,8 @@ void ieee80211_dynamic_ps_disable_work(struct work_struct *work) ...@@ -2325,7 +2327,8 @@ void ieee80211_dynamic_ps_disable_work(struct work_struct *work)
false); 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 = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, container_of(work, struct ieee80211_local,
...@@ -2398,7 +2401,7 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t) ...@@ -2398,7 +2401,7 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t)
{ {
struct ieee80211_local *local = from_timer(local, t, dynamic_ps_timer); 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) 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, ...@@ -3002,7 +3005,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL; sdata->deflink.ap_power_level = IEEE80211_UNSET_POWER_LEVEL;
del_timer_sync(&local->dynamic_ps_timer); 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 */ /* Disable ARP filtering */
if (sdata->vif.cfg.arp_addr_cnt) if (sdata->vif.cfg.arp_addr_cnt)
......
...@@ -34,7 +34,7 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) ...@@ -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->bcn_mon_timer);
del_timer_sync(&ifmgd->conn_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) { if (local->hw.conf.flags & IEEE80211_CONF_PS) {
offchannel_ps_enabled = true; offchannel_ps_enabled = true;
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Portions * Portions
* Copyright (C) 2020-2021 Intel Corporation * Copyright (C) 2020-2021, 2023 Intel Corporation
*/ */
#include <net/mac80211.h> #include <net/mac80211.h>
#include <net/rtnetlink.h> #include <net/rtnetlink.h>
...@@ -76,7 +76,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) ...@@ -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 * Note that this particular timer doesn't need to be
* restarted at resume. * 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); del_timer_sync(&local->dynamic_ps_timer);
local->wowlan = wowlan; local->wowlan = wowlan;
......
...@@ -266,8 +266,8 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) ...@@ -266,8 +266,8 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
IEEE80211_QUEUE_STOP_REASON_PS, IEEE80211_QUEUE_STOP_REASON_PS,
false); false);
ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED;
ieee80211_queue_work(&local->hw, wiphy_work_queue(local->hw.wiphy,
&local->dynamic_ps_disable_work); &local->dynamic_ps_disable_work);
} }
/* Don't restart the timer if we're not disassociated */ /* Don't restart the timer if we're not disassociated */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment