wifi: mac80211: convert A-MPDU work to wiphy work
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:35 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 09:27:19 +0000 (11:27 +0200)
Convert the A-MPDU work to wiphy work so it holds the
wiphy mutex and we can later guarantee that to drivers.
It might seem that we could run these concurrently for
different stations, but they're all on the ordered
mac80211 workqueue, so this shouldn't matter for that.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/agg-rx.c
net/mac80211/agg-tx.c
net/mac80211/ht.c
net/mac80211/ieee80211_i.h
net/mac80211/sta_info.c
net/mac80211/sta_info.h

index c6fa53230450095313723453938c4dd11b1fc026..a686f1ce66cb45a689833307e43e788ac45c9236 100644 (file)
@@ -9,7 +9,7 @@
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  * Copyright 2007-2010, Intel Corporation
  * Copyright(c) 2015-2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2022 Intel Corporation
+ * Copyright (C) 2018-2023 Intel Corporation
  */
 
 /**
@@ -140,7 +140,7 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
                if (ba_rx_bitmap & BIT(i))
                        set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested);
 
-       ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work);
        rcu_read_unlock();
 }
 EXPORT_SYMBOL(ieee80211_stop_rx_ba_session);
@@ -166,7 +166,7 @@ static void sta_rx_agg_session_timer_expired(struct timer_list *t)
               sta->sta.addr, tid);
 
        set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
-       ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work);
 }
 
 static void sta_rx_agg_reorder_timer_expired(struct timer_list *t)
@@ -507,7 +507,6 @@ void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif,
                                 const u8 *addr, unsigned int tid)
 {
        struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-       struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
 
        rcu_read_lock();
@@ -516,7 +515,7 @@ void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif,
                goto unlock;
 
        set_bit(tid, sta->ampdu_mlme.tid_rx_manage_offl);
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work);
  unlock:
        rcu_read_unlock();
 }
@@ -526,7 +525,6 @@ void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
                                   const u8 *addr, unsigned int tid)
 {
        struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-       struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
 
        rcu_read_lock();
@@ -535,7 +533,7 @@ void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
                goto unlock;
 
        set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work);
 
  unlock:
        rcu_read_unlock();
index b6b7726858815fdb7a30d37b2832b6c8e186c88a..3da0c55f13e2275b8848332051772ff2651ca806 100644 (file)
@@ -743,7 +743,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
         */
        sta->ampdu_mlme.tid_start_tx[tid] = tid_tx;
 
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(local->hw.wiphy, &sta->ampdu_mlme.work);
 
        /* this flow continues off the work */
  err_unlock_sta:
@@ -862,7 +862,7 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
                goto out;
 
        set_bit(HT_AGG_STATE_START_CB, &tid_tx->state);
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(local->hw.wiphy, &sta->ampdu_mlme.work);
  out:
        rcu_read_unlock();
 }
@@ -916,7 +916,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid)
        }
 
        set_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state);
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(local->hw.wiphy, &sta->ampdu_mlme.work);
 
  unlock:
        spin_unlock_bh(&sta->lock);
@@ -976,7 +976,7 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
                goto out;
 
        set_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state);
-       ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
+       wiphy_work_queue(local->hw.wiphy, &sta->ampdu_mlme.work);
  out:
        rcu_read_unlock();
 }
index 05f98f0a91a85f99abf361e94ea9e589a2d63e5f..e8feed05528aad55c88d163a761ab6bef5b9de29 100644 (file)
@@ -333,7 +333,7 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
         * the BA session, so handle it to properly clean tid_tx data.
         */
        if(reason == AGG_STOP_DESTROY_STA) {
-               cancel_work_sync(&sta->ampdu_mlme.work);
+               wiphy_work_cancel(sta->local->hw.wiphy, &sta->ampdu_mlme.work);
 
                mutex_lock(&sta->ampdu_mlme.mtx);
                for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
@@ -350,7 +350,7 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
        }
 }
 
-void ieee80211_ba_session_work(struct work_struct *work)
+void ieee80211_ba_session_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct sta_info *sta =
                container_of(work, struct sta_info, ampdu_mlme.work);
@@ -416,7 +416,7 @@ void ieee80211_ba_session_work(struct work_struct *work)
 
                                mutex_unlock(&sta->ampdu_mlme.mtx);
 
-                               ieee80211_queue_work(&sdata->local->hw, work);
+                               wiphy_work_queue(sdata->local->hw.wiphy, work);
                                return;
                        }
 
index 338ab9e6e6b1b4577dd666dca212758611273c50..7604e43a441c3bdf21fdb7f3b1a789fb18ad9ca3 100644 (file)
@@ -2134,7 +2134,7 @@ void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
                              struct tid_ampdu_tx *tid_tx);
 void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
                             struct tid_ampdu_tx *tid_tx);
-void ieee80211_ba_session_work(struct work_struct *work);
+void ieee80211_ba_session_work(struct wiphy *wiphy, struct wiphy_work *work);
 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
 
index 7751f8ba960eef87dea81402aa6cd13c8e072d5c..b68bf77b05d03247f03c4e7ccaff631bca3ab9ff 100644 (file)
@@ -556,7 +556,7 @@ __sta_info_alloc(struct ieee80211_sub_if_data *sdata,
        spin_lock_init(&sta->lock);
        spin_lock_init(&sta->ps_lock);
        INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
-       INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
+       wiphy_work_init(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
        mutex_init(&sta->ampdu_mlme.mtx);
 #ifdef CONFIG_MAC80211_MESH
        if (ieee80211_vif_is_mesh(&sdata->vif)) {
index 195b563132d6c5ffc156f61f56351a67a8ba968e..1deab7e33a7ca6b86e7ca4d257df5956f468c37c 100644 (file)
@@ -291,7 +291,7 @@ struct sta_ampdu_mlme {
        unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
        unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
        /* tx */
-       struct work_struct work;
+       struct wiphy_work work;
        struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS];
        struct tid_ampdu_tx *tid_start_tx[IEEE80211_NUM_TIDS];
        unsigned long last_addba_req_time[IEEE80211_NUM_TIDS];