wifi: mac80211: move CSA finalize to wiphy work
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:50 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 09:27:21 +0000 (11:27 +0200)
This work should be made per link as well, and then
will have cancellation issues. Moving it to a wiphy
work already fixes those beforehand.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c
net/mac80211/chan.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/link.c

index 36e3515bf8d91065013b289bbd7d4b6d61293de4..75fa3c90b1b4bff2a7de1d86febbd24ca584da83 100644 (file)
@@ -3584,11 +3584,11 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif)
                        if (iter == sdata || iter->vif.mbssid_tx_vif != vif)
                                continue;
 
-                       ieee80211_queue_work(&iter->local->hw,
-                                            &iter->deflink.csa_finalize_work);
+                       wiphy_work_queue(iter->local->hw.wiphy,
+                                        &iter->deflink.csa_finalize_work);
                }
        }
-       ieee80211_queue_work(&local->hw, &sdata->deflink.csa_finalize_work);
+       wiphy_work_queue(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
 
        rcu_read_unlock();
 }
@@ -3716,7 +3716,7 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
        }
 }
 
-void ieee80211_csa_finalize_work(struct work_struct *work)
+void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct ieee80211_sub_if_data *sdata =
                container_of(work, struct ieee80211_sub_if_data,
index 68952752b5990f917f0257a241a0a650ca2e1463..f967ed9d2a3adc228c2c93941f984edb5628b885 100644 (file)
@@ -1206,8 +1206,8 @@ ieee80211_link_chanctx_reservation_complete(struct ieee80211_link_data *link)
        case NL80211_IFTYPE_AP:
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_OCB:
-               ieee80211_queue_work(&sdata->local->hw,
-                                    &link->csa_finalize_work);
+               wiphy_work_queue(sdata->local->hw.wiphy,
+                                &link->csa_finalize_work);
                break;
        case NL80211_IFTYPE_STATION:
                wiphy_delayed_work_queue(sdata->local->hw.wiphy,
index a5569f9bb83f9479a44c9e428436fbdebe8c8e32..8d9ced5180870d0d609795298301f89e9b05c0b4 100644 (file)
@@ -990,7 +990,7 @@ struct ieee80211_link_data {
        struct ieee80211_key __rcu *default_mgmt_key;
        struct ieee80211_key __rcu *default_beacon_key;
 
-       struct work_struct csa_finalize_work;
+       struct wiphy_work csa_finalize_work;
        bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
 
        bool operating_11g_mode;
@@ -1989,7 +1989,7 @@ int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
                                  struct wireless_dev *wdev, u64 cookie);
 
 /* channel switch handling */
-void ieee80211_csa_finalize_work(struct work_struct *work);
+void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work);
 int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
                             struct cfg80211_csa_settings *params);
 
index 82bb340ef4be9cccedad72ac17f960058090af1a..3b419af7720cac0f211941946dc21cbaa2390c99 100644 (file)
@@ -535,9 +535,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
        mutex_unlock(&local->mtx);
        sdata_unlock(sdata);
 
-       cancel_work_sync(&sdata->deflink.csa_finalize_work);
        cancel_work_sync(&sdata->deflink.color_change_finalize_work);
 
+       wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
        wiphy_delayed_work_cancel(local->hw.wiphy,
                                  &sdata->deflink.dfs_cac_timer_work);
 
index bcff8a90940574822ecbb0076bc7071b35303197..2f7e2fc60be35045a712fca7cf6e8ca5eed40056 100644 (file)
@@ -37,8 +37,8 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
        link_conf->link_id = link_id;
        link_conf->vif = &sdata->vif;
 
-       INIT_WORK(&link->csa_finalize_work,
-                 ieee80211_csa_finalize_work);
+       wiphy_work_init(&link->csa_finalize_work,
+                       ieee80211_csa_finalize_work);
        INIT_WORK(&link->color_change_finalize_work,
                  ieee80211_color_change_finalize_work);
        INIT_DELAYED_WORK(&link->color_collision_detect_work,