summaryrefslogtreecommitdiff
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-06-06 14:49:31 +0200
committerJohannes Berg <johannes.berg@intel.com>2023-06-07 19:53:29 +0200
commit4b8d43f1137cb9f6e8bb3b77251ad9429ab7ef34 (patch)
tree8175641a45bd3da5931eedd8daaf23d975fd0906 /net/mac80211/mlme.c
parent87351d09261308472ddb6d700e182c34db4fce7a (diff)
wifi: mac80211: mlme: move disconnects to wiphy work
Move the beacon loss work that might cause a disconnect and the CSA disconnect work to be wiphy work, so we hold the wiphy lock for them. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 0e68ede2a9f3..3827b5dcdb03 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1724,8 +1724,8 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
sdata_info(sdata,
"failed to use reserved channel context, disconnecting (err=%d)\n",
ret);
- ieee80211_queue_work(&sdata->local->hw,
- &ifmgd->csa_connection_drop_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
goto out;
}
@@ -1736,8 +1736,8 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
&link->csa_chandef)) {
sdata_info(sdata,
"failed to finalize channel switch, disconnecting\n");
- ieee80211_queue_work(&sdata->local->hw,
- &ifmgd->csa_connection_drop_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
goto out;
}
@@ -1781,8 +1781,8 @@ static void ieee80211_chswitch_post_beacon(struct ieee80211_link_data *link)
if (ret) {
sdata_info(sdata,
"driver post channel switch failed, disconnecting\n");
- ieee80211_queue_work(&local->hw,
- &ifmgd->csa_connection_drop_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
return;
}
@@ -1801,8 +1801,8 @@ void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success)
if (!success) {
sdata_info(sdata,
"driver channel switch failed, disconnecting\n");
- ieee80211_queue_work(&sdata->local->hw,
- &ifmgd->csa_connection_drop_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
} else {
wiphy_delayed_work_queue(sdata->local->hw.wiphy,
&sdata->deflink.u.mgd.chswitch_work,
@@ -2018,7 +2018,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
link->conf->csa_active = true;
link->csa_block_tx = csa_ie.mode;
- ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
mutex_unlock(&local->chanctx_mtx);
mutex_unlock(&local->mtx);
}
@@ -3415,7 +3416,8 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
sdata_unlock(sdata);
}
-static void ieee80211_beacon_connection_loss_work(struct work_struct *work)
+static void ieee80211_beacon_connection_loss_work(struct wiphy *wiphy,
+ struct wiphy_work *work)
{
struct ieee80211_sub_if_data *sdata =
container_of(work, struct ieee80211_sub_if_data,
@@ -3440,7 +3442,8 @@ static void ieee80211_beacon_connection_loss_work(struct work_struct *work)
}
}
-static void ieee80211_csa_connection_drop_work(struct work_struct *work)
+static void ieee80211_csa_connection_drop_work(struct wiphy *wiphy,
+ struct wiphy_work *work)
{
struct ieee80211_sub_if_data *sdata =
container_of(work, struct ieee80211_sub_if_data,
@@ -3457,7 +3460,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif)
trace_api_beacon_loss(sdata);
sdata->u.mgd.connection_loss = false;
- ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work);
+ wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work);
}
EXPORT_SYMBOL(ieee80211_beacon_loss);
@@ -3469,7 +3472,7 @@ void ieee80211_connection_loss(struct ieee80211_vif *vif)
trace_api_connection_loss(sdata);
sdata->u.mgd.connection_loss = true;
- ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work);
+ wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work);
}
EXPORT_SYMBOL(ieee80211_connection_loss);
@@ -3485,7 +3488,7 @@ void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect)
sdata->u.mgd.driver_disconnect = true;
sdata->u.mgd.reconnect = reconnect;
- ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work);
+ wiphy_work_queue(hw->wiphy, &sdata->u.mgd.beacon_connection_loss_work);
}
EXPORT_SYMBOL(ieee80211_disconnect);
@@ -6374,8 +6377,8 @@ static void ieee80211_sta_bcn_mon_timer(struct timer_list *t)
return;
sdata->u.mgd.connection_loss = false;
- ieee80211_queue_work(&sdata->local->hw,
- &sdata->u.mgd.beacon_connection_loss_work);
+ wiphy_work_queue(sdata->local->hw.wiphy,
+ &sdata->u.mgd.beacon_connection_loss_work);
}
static void ieee80211_sta_conn_mon_timer(struct timer_list *t)
@@ -6550,10 +6553,10 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work);
- INIT_WORK(&ifmgd->beacon_connection_loss_work,
- ieee80211_beacon_connection_loss_work);
- INIT_WORK(&ifmgd->csa_connection_drop_work,
- ieee80211_csa_connection_drop_work);
+ wiphy_work_init(&ifmgd->beacon_connection_loss_work,
+ ieee80211_beacon_connection_loss_work);
+ wiphy_work_init(&ifmgd->csa_connection_drop_work,
+ ieee80211_csa_connection_drop_work);
INIT_DELAYED_WORK(&ifmgd->tdls_peer_del_work,
ieee80211_tdls_peer_del_work);
timer_setup(&ifmgd->timer, ieee80211_sta_timer, 0);
@@ -7562,8 +7565,10 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
* cancelled when disconnecting.
*/
cancel_work_sync(&ifmgd->monitor_work);
- cancel_work_sync(&ifmgd->beacon_connection_loss_work);
- cancel_work_sync(&ifmgd->csa_connection_drop_work);
+ wiphy_work_cancel(sdata->local->hw.wiphy,
+ &ifmgd->beacon_connection_loss_work);
+ wiphy_work_cancel(sdata->local->hw.wiphy,
+ &ifmgd->csa_connection_drop_work);
cancel_delayed_work_sync(&ifmgd->tdls_peer_del_work);
sdata_lock(sdata);