1 From: Aditya Kumar Singh <quic_adisi@quicinc.com>
2 Date: Fri, 6 Sep 2024 12:14:19 +0530
3 Subject: [PATCH] Revert "wifi: mac80211: move radar detect work to sdata"
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
8 This reverts commit ce9e660ef32e ("wifi: mac80211: move radar detect work to sdata").
10 To enable radar detection with MLO, it’s essential to handle it on a
11 per-link basis. This is because when using MLO, multiple links may already
12 be active and beaconing. In this scenario, another link should be able to
13 initiate a radar detection. Also, if underlying links are associated with
14 different hardware devices but grouped together for MLO, they could
15 potentially start radar detection simultaneously. Therefore, it makes
16 sense to manage radar detection settings separately for each link by moving
17 them back to a per-link data structure.
19 Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
20 Link: https://patch.msgid.link/20240906064426.2101315-2-quic_adisi@quicinc.com
21 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
24 --- a/net/mac80211/cfg.c
25 +++ b/net/mac80211/cfg.c
26 @@ -1658,7 +1658,7 @@ static int ieee80211_stop_ap(struct wiph
28 if (sdata->wdev.cac_started) {
29 chandef = link_conf->chanreq.oper;
30 - wiphy_delayed_work_cancel(wiphy, &sdata->dfs_cac_timer_work);
31 + wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work);
32 cfg80211_cac_event(sdata->dev, &chandef,
33 NL80211_RADAR_CAC_ABORTED,
35 @@ -3482,7 +3482,7 @@ static int ieee80211_start_radar_detecti
39 - wiphy_delayed_work_queue(wiphy, &sdata->dfs_cac_timer_work,
40 + wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work,
41 msecs_to_jiffies(cac_time_ms));
44 @@ -3499,7 +3499,7 @@ static void ieee80211_end_cac(struct wip
46 list_for_each_entry(sdata, &local->interfaces, list) {
47 wiphy_delayed_work_cancel(wiphy,
48 - &sdata->dfs_cac_timer_work);
49 + &sdata->deflink.dfs_cac_timer_work);
51 if (sdata->wdev.cac_started) {
52 ieee80211_link_release_channel(&sdata->deflink);
53 --- a/net/mac80211/ieee80211_i.h
54 +++ b/net/mac80211/ieee80211_i.h
55 @@ -1069,6 +1069,7 @@ struct ieee80211_link_data {
56 int ap_power_level; /* in dBm */
59 + struct wiphy_delayed_work dfs_cac_timer_work;
62 struct ieee80211_link_data_managed mgd;
63 @@ -1167,8 +1168,6 @@ struct ieee80211_sub_if_data {
64 struct ieee80211_link_data deflink;
65 struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
67 - struct wiphy_delayed_work dfs_cac_timer_work;
69 /* for ieee80211_set_active_links_async() */
70 struct wiphy_work activate_links_work;
71 u16 desired_active_links;
72 --- a/net/mac80211/iface.c
73 +++ b/net/mac80211/iface.c
74 @@ -551,7 +551,7 @@ static void ieee80211_do_stop(struct iee
75 wiphy_work_cancel(local->hw.wiphy,
76 &sdata->deflink.color_change_finalize_work);
77 wiphy_delayed_work_cancel(local->hw.wiphy,
78 - &sdata->dfs_cac_timer_work);
79 + &sdata->deflink.dfs_cac_timer_work);
81 if (sdata->wdev.cac_started) {
82 chandef = sdata->vif.bss_conf.chanreq.oper;
83 @@ -1744,8 +1744,6 @@ static void ieee80211_setup_sdata(struct
84 wiphy_work_init(&sdata->work, ieee80211_iface_work);
85 wiphy_work_init(&sdata->activate_links_work,
86 ieee80211_activate_links_work);
87 - wiphy_delayed_work_init(&sdata->dfs_cac_timer_work,
88 - ieee80211_dfs_cac_timer_work);
91 case NL80211_IFTYPE_P2P_GO:
92 --- a/net/mac80211/link.c
93 +++ b/net/mac80211/link.c
94 @@ -45,6 +45,8 @@ void ieee80211_link_init(struct ieee8021
95 ieee80211_color_collision_detection_work);
96 INIT_LIST_HEAD(&link->assigned_chanctx_list);
97 INIT_LIST_HEAD(&link->reserved_chanctx_list);
98 + wiphy_delayed_work_init(&link->dfs_cac_timer_work,
99 + ieee80211_dfs_cac_timer_work);
102 switch (sdata->vif.type) {
103 --- a/net/mac80211/mlme.c
104 +++ b/net/mac80211/mlme.c
105 @@ -3031,15 +3031,16 @@ void ieee80211_dynamic_ps_timer(struct t
107 void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work)
109 - struct ieee80211_sub_if_data *sdata =
110 - container_of(work, struct ieee80211_sub_if_data,
111 + struct ieee80211_link_data *link =
112 + container_of(work, struct ieee80211_link_data,
113 dfs_cac_timer_work.work);
114 - struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chanreq.oper;
115 + struct cfg80211_chan_def chandef = link->conf->chanreq.oper;
116 + struct ieee80211_sub_if_data *sdata = link->sdata;
118 lockdep_assert_wiphy(sdata->local->hw.wiphy);
120 if (sdata->wdev.cac_started) {
121 - ieee80211_link_release_channel(&sdata->deflink);
122 + ieee80211_link_release_channel(link);
123 cfg80211_cac_event(sdata->dev, &chandef,
124 NL80211_RADAR_CAC_FINISHED,
126 --- a/net/mac80211/util.c
127 +++ b/net/mac80211/util.c
128 @@ -3460,7 +3460,7 @@ void ieee80211_dfs_cac_cancel(struct iee
130 list_for_each_entry(sdata, &local->interfaces, list) {
131 wiphy_delayed_work_cancel(local->hw.wiphy,
132 - &sdata->dfs_cac_timer_work);
133 + &sdata->deflink.dfs_cac_timer_work);
135 if (sdata->wdev.cac_started) {
136 chandef = sdata->vif.bss_conf.chanreq.oper;