Skip to content

Commit 1444f58

Browse files
committed
wifi: mac80211: use wiphy work for SMPS
SMPS requests are per link, and currently there's a potential deadlock with canceling. Use the new wiphy work to handle SMPS instead, so that the cancel cannot deadlock. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a3df43b commit 1444f58

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

net/mac80211/ht.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
1010
* Copyright 2007-2010, Intel Corporation
1111
* Copyright 2017 Intel Deutschland GmbH
12-
* Copyright(c) 2020-2022 Intel Corporation
12+
* Copyright(c) 2020-2023 Intel Corporation
1313
*/
1414

1515
#include <linux/ieee80211.h>
@@ -602,7 +602,8 @@ void ieee80211_request_smps(struct ieee80211_vif *vif, unsigned int link_id,
602602
goto out;
603603

604604
link->u.mgd.driver_smps_mode = smps_mode;
605-
ieee80211_queue_work(&sdata->local->hw, &link->u.mgd.request_smps_work);
605+
wiphy_work_queue(sdata->local->hw.wiphy,
606+
&link->u.mgd.request_smps_work);
606607
out:
607608
rcu_read_unlock();
608609
}

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ struct ieee80211_link_data_managed {
921921
struct timer_list chswitch_timer;
922922
struct work_struct chswitch_work;
923923

924-
struct work_struct request_smps_work;
924+
struct wiphy_work request_smps_work;
925925
bool beacon_crc_valid;
926926
u32 beacon_crc;
927927
struct ewma_beacon_signal ave_beacon_signal;

net/mac80211/mlme.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6538,7 +6538,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
65386538
sdata_unlock(sdata);
65396539
}
65406540

6541-
static void ieee80211_request_smps_mgd_work(struct work_struct *work)
6541+
static void ieee80211_request_smps_mgd_work(struct wiphy *wiphy,
6542+
struct wiphy_work *work)
65426543
{
65436544
struct ieee80211_link_data *link =
65446545
container_of(work, struct ieee80211_link_data,
@@ -6588,8 +6589,8 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link)
65886589
link->u.mgd.conn_flags = 0;
65896590
link->conf->bssid = link->u.mgd.bssid;
65906591

6591-
INIT_WORK(&link->u.mgd.request_smps_work,
6592-
ieee80211_request_smps_mgd_work);
6592+
wiphy_work_init(&link->u.mgd.request_smps_work,
6593+
ieee80211_request_smps_mgd_work);
65936594
if (local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS)
65946595
link->u.mgd.req_smps = IEEE80211_SMPS_AUTOMATIC;
65956596
else
@@ -7552,7 +7553,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
75527553

75537554
void ieee80211_mgd_stop_link(struct ieee80211_link_data *link)
75547555
{
7555-
cancel_work_sync(&link->u.mgd.request_smps_work);
7556+
wiphy_work_cancel(link->sdata->local->hw.wiphy,
7557+
&link->u.mgd.request_smps_work);
75567558
cancel_work_sync(&link->u.mgd.chswitch_work);
75577559
}
75587560

net/mac80211/tdls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
14311431
}
14321432

14331433
if (ret == 0)
1434-
ieee80211_queue_work(&sdata->local->hw,
1435-
&sdata->deflink.u.mgd.request_smps_work);
1434+
wiphy_work_queue(sdata->local->hw.wiphy,
1435+
&sdata->deflink.u.mgd.request_smps_work);
14361436

14371437
mutex_unlock(&local->mtx);
14381438
sdata_unlock(sdata);

0 commit comments

Comments
 (0)