From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 09/14] wifi: mac80211: use wiphy work for SMPS
Date: Tue, 6 Jun 2023 14:49:28 +0200 [thread overview]
Message-ID: <20230606144753.a5c9bd2f7f56.I9c81a0493229804096a1b0dce03e61c56e8104a3@changeid> (raw)
In-Reply-To: <20230606124933.181107-1-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
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>
---
net/mac80211/ht.c | 5 +++--
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/mlme.c | 10 ++++++----
net/mac80211/tdls.c | 4 ++--
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 5315ab750280..33729870ad8a 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -9,7 +9,7 @@
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
* Copyright 2007-2010, Intel Corporation
* Copyright 2017 Intel Deutschland GmbH
- * Copyright(c) 2020-2022 Intel Corporation
+ * Copyright(c) 2020-2023 Intel Corporation
*/
#include <linux/ieee80211.h>
@@ -602,7 +602,8 @@ void ieee80211_request_smps(struct ieee80211_vif *vif, unsigned int link_id,
goto out;
link->u.mgd.driver_smps_mode = smps_mode;
- ieee80211_queue_work(&sdata->local->hw, &link->u.mgd.request_smps_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &link->u.mgd.request_smps_work);
out:
rcu_read_unlock();
}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 91bc4982d6b9..4a51ec8b6cee 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -921,7 +921,7 @@ struct ieee80211_link_data_managed {
struct timer_list chswitch_timer;
struct work_struct chswitch_work;
- struct work_struct request_smps_work;
+ struct wiphy_work request_smps_work;
bool beacon_crc_valid;
u32 beacon_crc;
struct ewma_beacon_signal ave_beacon_signal;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6c659609abee..a24f6f417248 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -6532,7 +6532,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
sdata_unlock(sdata);
}
-static void ieee80211_request_smps_mgd_work(struct work_struct *work)
+static void ieee80211_request_smps_mgd_work(struct wiphy *wiphy,
+ struct wiphy_work *work)
{
struct ieee80211_link_data *link =
container_of(work, struct ieee80211_link_data,
@@ -6582,8 +6583,8 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link)
link->u.mgd.conn_flags = 0;
link->conf->bssid = link->u.mgd.bssid;
- INIT_WORK(&link->u.mgd.request_smps_work,
- ieee80211_request_smps_mgd_work);
+ wiphy_work_init(&link->u.mgd.request_smps_work,
+ ieee80211_request_smps_mgd_work);
if (local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS)
link->u.mgd.req_smps = IEEE80211_SMPS_AUTOMATIC;
else
@@ -7546,7 +7547,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
void ieee80211_mgd_stop_link(struct ieee80211_link_data *link)
{
- cancel_work_sync(&link->u.mgd.request_smps_work);
+ wiphy_work_cancel(link->sdata->local->hw.wiphy,
+ &link->u.mgd.request_smps_work);
cancel_work_sync(&link->u.mgd.chswitch_work);
}
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index b255f3b5bf01..52c47674a554 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1431,8 +1431,8 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
}
if (ret == 0)
- ieee80211_queue_work(&sdata->local->hw,
- &sdata->deflink.u.mgd.request_smps_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &sdata->deflink.u.mgd.request_smps_work);
mutex_unlock(&local->mtx);
sdata_unlock(sdata);
--
2.40.1
next prev parent reply other threads:[~2023-06-06 12:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 12:49 [PATCH 00/14] wifi: work cleanups part 1 Johannes Berg
2023-06-06 12:49 ` [PATCH 01/14] wifi: cfg80211: hold wiphy lock in auto-disconnect Johannes Berg
2023-06-06 12:49 ` [PATCH 02/14] wifi: cfg80211: hold wiphy lock in pmsr work Johannes Berg
2023-06-06 12:49 ` [PATCH 03/14] wifi: cfg80211: move wowlan disable under locks Johannes Berg
2023-06-06 12:49 ` [PATCH 04/14] wifi: cfg80211: wext: hold wiphy lock in siwgenie Johannes Berg
2023-06-06 12:49 ` [PATCH 05/14] wifi: cfg80211: hold wiphy lock when sending wiphy Johannes Berg
2023-06-06 12:49 ` [PATCH 06/14] wifi: cfg80211: add a work abstraction with special semantics Johannes Berg
2023-06-06 12:49 ` [PATCH 07/14] wifi: mac80211: use wiphy work for sdata->work Johannes Berg
2023-06-06 12:49 ` [PATCH 08/14] wifi: mac80211: unregister netdevs through cfg80211 Johannes Berg
2023-06-06 12:49 ` Johannes Berg [this message]
2023-06-06 12:49 ` [PATCH 10/14] wifi: mac80211: use wiphy work for channel switch Johannes Berg
2023-06-06 12:49 ` [PATCH 11/14] wifi: mac80211: ibss: move disconnect to wiphy work Johannes Berg
2023-06-06 12:49 ` [PATCH 12/14] wifi: mac80211: mlme: move disconnects " Johannes Berg
2023-06-06 12:49 ` [PATCH 13/14] wifi: cfg80211: move sched scan stop " Johannes Berg
2023-06-06 13:08 ` Johannes Berg
2023-06-06 12:49 ` [PATCH 14/14] wifi: cfg80211: move scan done work " Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230606144753.a5c9bd2f7f56.I9c81a0493229804096a1b0dce03e61c56e8104a3@changeid \
--to=johannes@sipsolutions.net \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).