wifi: mac80211: move radar detect work to sdata
authorJohannes Berg <johannes.berg@intel.com>
Mon, 6 May 2024 19:13:12 +0000 (21:13 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 09:28:44 +0000 (11:28 +0200)
At some point we thought perhaps this could be per link, but
really that didn't happen, and it's confusing. Radar detection
still uses the deflink to allocate the channel, but the work
need not be there. Move it back.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240506211311.43bd82c6da04.Ib39bec3aa198d137385f081e7e1910dcbde3aa1b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/link.c
net/mac80211/mlme.c
net/mac80211/util.c

index 3673c7f6b21a3213a4758f1f51742a8d368c5361..0ed7e8bbf5c081b66aa19e79b2ee53bc7afed6c4 100644 (file)
@@ -1666,7 +1666,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
 
        if (sdata->wdev.cac_started) {
                chandef = link_conf->chanreq.oper;
-               wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work);
+               wiphy_delayed_work_cancel(wiphy, &sdata->dfs_cac_timer_work);
                cfg80211_cac_event(sdata->dev, &chandef,
                                   NL80211_RADAR_CAC_ABORTED,
                                   GFP_KERNEL);
@@ -3466,7 +3466,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
        if (err)
                goto out_unlock;
 
-       wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work,
+       wiphy_delayed_work_queue(wiphy, &sdata->dfs_cac_timer_work,
                                 msecs_to_jiffies(cac_time_ms));
 
  out_unlock:
@@ -3483,7 +3483,7 @@ static void ieee80211_end_cac(struct wiphy *wiphy,
 
        list_for_each_entry(sdata, &local->interfaces, list) {
                wiphy_delayed_work_cancel(wiphy,
-                                         &sdata->deflink.dfs_cac_timer_work);
+                                         &sdata->dfs_cac_timer_work);
 
                if (sdata->wdev.cac_started) {
                        ieee80211_link_release_channel(&sdata->deflink);
index 7d541a2355f69d40c1c8d87cb3e45b590de7bd16..4f4ef6710e8d9b981bddc4727956e454185785b7 100644 (file)
@@ -1060,7 +1060,6 @@ struct ieee80211_link_data {
        int ap_power_level; /* in dBm */
 
        bool radar_required;
-       struct wiphy_delayed_work dfs_cac_timer_work;
 
        union {
                struct ieee80211_link_data_managed mgd;
@@ -1159,6 +1158,8 @@ struct ieee80211_sub_if_data {
        struct ieee80211_link_data deflink;
        struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
 
+       struct wiphy_delayed_work dfs_cac_timer_work;
+
        /* for ieee80211_set_active_links_async() */
        struct wiphy_work activate_links_work;
        u16 desired_active_links;
index dc42902e269359a1a7d95ee85b2f4817df47a0d4..1ef4b6dc373084e1a22ef30a3779d415edae7592 100644 (file)
@@ -554,7 +554,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
        wiphy_work_cancel(local->hw.wiphy,
                          &sdata->deflink.color_change_finalize_work);
        wiphy_delayed_work_cancel(local->hw.wiphy,
-                                 &sdata->deflink.dfs_cac_timer_work);
+                                 &sdata->dfs_cac_timer_work);
 
        if (sdata->wdev.cac_started) {
                chandef = sdata->vif.bss_conf.chanreq.oper;
@@ -1746,6 +1746,8 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
        wiphy_work_init(&sdata->work, ieee80211_iface_work);
        wiphy_work_init(&sdata->activate_links_work,
                        ieee80211_activate_links_work);
+       wiphy_delayed_work_init(&sdata->dfs_cac_timer_work,
+                               ieee80211_dfs_cac_timer_work);
 
        switch (type) {
        case NL80211_IFTYPE_P2P_GO:
index af0321408a97af1bf1dccd5eccc4bfb502d599d7..f57282488222fad6e96c8ad93ede4b278ffb6960 100644 (file)
@@ -45,8 +45,6 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
                          ieee80211_color_collision_detection_work);
        INIT_LIST_HEAD(&link->assigned_chanctx_list);
        INIT_LIST_HEAD(&link->reserved_chanctx_list);
-       wiphy_delayed_work_init(&link->dfs_cac_timer_work,
-                               ieee80211_dfs_cac_timer_work);
 
        if (!deflink) {
                switch (sdata->vif.type) {
index 08c0999746fb5569586b6abada250ccd23f23bb0..a2b8bfc1fe0e49db2a498bb55949f455f1931e5f 100644 (file)
@@ -2797,16 +2797,15 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t)
 
 void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
-       struct ieee80211_link_data *link =
-               container_of(work, struct ieee80211_link_data,
+       struct ieee80211_sub_if_data *sdata =
+               container_of(work, struct ieee80211_sub_if_data,
                             dfs_cac_timer_work.work);
-       struct cfg80211_chan_def chandef = link->conf->chanreq.oper;
-       struct ieee80211_sub_if_data *sdata = link->sdata;
+       struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chanreq.oper;
 
        lockdep_assert_wiphy(sdata->local->hw.wiphy);
 
        if (sdata->wdev.cac_started) {
-               ieee80211_link_release_channel(link);
+               ieee80211_link_release_channel(&sdata->deflink);
                cfg80211_cac_event(sdata->dev, &chandef,
                                   NL80211_RADAR_CAC_FINISHED,
                                   GFP_KERNEL);
index 183de2075fb99ecb1c69306a91e40757cca0df56..43625ca87d5e8a4d1e9ee801e13619fa6a99c611 100644 (file)
@@ -3457,7 +3457,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
 
        list_for_each_entry(sdata, &local->interfaces, list) {
                wiphy_delayed_work_cancel(local->hw.wiphy,
-                                         &sdata->deflink.dfs_cac_timer_work);
+                                         &sdata->dfs_cac_timer_work);
 
                if (sdata->wdev.cac_started) {
                        chandef = sdata->vif.bss_conf.chanreq.oper;