developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From bd62e65e77de5464c1014610d391699e9d8e1bb6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Aditya Kumar Singh <quic_adisi@quicinc.com> |
| 3 | Date: Thu, 11 Jul 2024 09:21:45 +0530 |
| 4 | Subject: [PATCH 14/89] bp: wifi: mac80211: handle DFS per link |
| 5 | |
| 6 | In order to support DFS with MLO, handle the link ID now passed from |
| 7 | cfg80211, adjust the code to do everything per link and call the |
| 8 | notifications to cfg80211 correctly. |
| 9 | |
| 10 | Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> |
| 11 | --- |
| 12 | net/mac80211/cfg.c | 26 ++++++++++++++++++-------- |
| 13 | net/mac80211/link.c | 10 ++++++++++ |
| 14 | net/mac80211/util.c | 29 +++++++++++++++++++++++------ |
| 15 | 3 files changed, 51 insertions(+), 14 deletions(-) |
| 16 | |
| 17 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
| 18 | index cf60420..d5ddbce 100644 |
| 19 | --- a/net/mac80211/cfg.c |
| 20 | +++ b/net/mac80211/cfg.c |
| 21 | @@ -3460,6 +3460,7 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, |
| 22 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 23 | struct ieee80211_chan_req chanreq = { .oper = *chandef }; |
| 24 | struct ieee80211_local *local = sdata->local; |
| 25 | + struct ieee80211_link_data *link_data; |
| 26 | int err; |
| 27 | |
| 28 | lockdep_assert_wiphy(local->hw.wiphy); |
| 29 | @@ -3467,16 +3468,20 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, |
| 30 | if (!list_empty(&local->roc_list) || local->scanning) |
| 31 | return -EBUSY; |
| 32 | |
| 33 | + link_data = sdata_dereference(sdata->link[link_id], sdata); |
| 34 | + if (!link_data) |
| 35 | + return -ENOLINK; |
| 36 | + |
| 37 | /* whatever, but channel contexts should not complain about that one */ |
| 38 | - sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; |
| 39 | - sdata->deflink.needed_rx_chains = local->rx_chains; |
| 40 | + link_data->smps_mode = IEEE80211_SMPS_OFF; |
| 41 | + link_data->needed_rx_chains = local->rx_chains; |
| 42 | |
| 43 | - err = ieee80211_link_use_channel(&sdata->deflink, &chanreq, |
| 44 | + err = ieee80211_link_use_channel(link_data, &chanreq, |
| 45 | IEEE80211_CHANCTX_SHARED); |
| 46 | if (err) |
| 47 | return err; |
| 48 | |
| 49 | - wiphy_delayed_work_queue(wiphy, &sdata->deflink.dfs_cac_timer_work, |
| 50 | + wiphy_delayed_work_queue(wiphy, &link_data->dfs_cac_timer_work, |
| 51 | msecs_to_jiffies(cac_time_ms)); |
| 52 | |
| 53 | return 0; |
| 54 | @@ -3487,16 +3492,21 @@ static void ieee80211_end_cac(struct wiphy *wiphy, |
| 55 | { |
| 56 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 57 | struct ieee80211_local *local = sdata->local; |
| 58 | + struct ieee80211_link_data *link_data; |
| 59 | |
| 60 | lockdep_assert_wiphy(local->hw.wiphy); |
| 61 | |
| 62 | list_for_each_entry(sdata, &local->interfaces, list) { |
| 63 | + link_data = sdata_dereference(sdata->link[link_id], sdata); |
| 64 | + if (!link_data) |
| 65 | + continue; |
| 66 | + |
| 67 | wiphy_delayed_work_cancel(wiphy, |
| 68 | - &sdata->deflink.dfs_cac_timer_work); |
| 69 | + &link_data->dfs_cac_timer_work); |
| 70 | |
| 71 | - if (sdata->wdev.links[0].cac_started) { |
| 72 | - ieee80211_link_release_channel(&sdata->deflink); |
| 73 | - sdata->wdev.links[0].cac_started = false; |
| 74 | + if (sdata->wdev.links[link_id].cac_started) { |
| 75 | + ieee80211_link_release_channel(link_data); |
| 76 | + sdata->wdev.links[link_id].cac_started = false; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | diff --git a/net/mac80211/link.c b/net/mac80211/link.c |
| 81 | index b437896..0bbac64 100644 |
| 82 | --- a/net/mac80211/link.c |
| 83 | +++ b/net/mac80211/link.c |
| 84 | @@ -77,6 +77,16 @@ void ieee80211_link_stop(struct ieee80211_link_data *link) |
| 85 | &link->color_change_finalize_work); |
| 86 | wiphy_work_cancel(link->sdata->local->hw.wiphy, |
| 87 | &link->csa.finalize_work); |
| 88 | + |
| 89 | + if (link->sdata->wdev.links[link->link_id].cac_started) { |
| 90 | + wiphy_delayed_work_cancel(link->sdata->local->hw.wiphy, |
| 91 | + &link->dfs_cac_timer_work); |
| 92 | + cfg80211_cac_event(link->sdata->dev, |
| 93 | + &link->conf->chanreq.oper, |
| 94 | + NL80211_RADAR_CAC_ABORTED, |
| 95 | + GFP_KERNEL, link->link_id); |
| 96 | + } |
| 97 | + |
| 98 | ieee80211_link_release_channel(link); |
| 99 | } |
| 100 | |
| 101 | diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| 102 | index 5996ea7..59dde03 100644 |
| 103 | --- a/net/mac80211/util.c |
| 104 | +++ b/net/mac80211/util.c |
| 105 | @@ -3455,20 +3455,37 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) |
| 106 | { |
| 107 | struct ieee80211_sub_if_data *sdata; |
| 108 | struct cfg80211_chan_def chandef; |
| 109 | + struct ieee80211_link_data *link_data; |
| 110 | + struct ieee80211_bss_conf *link_conf; |
| 111 | + unsigned int link_id; |
| 112 | |
| 113 | lockdep_assert_wiphy(local->hw.wiphy); |
| 114 | |
| 115 | list_for_each_entry(sdata, &local->interfaces, list) { |
| 116 | - wiphy_delayed_work_cancel(local->hw.wiphy, |
| 117 | - &sdata->deflink.dfs_cac_timer_work); |
| 118 | + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; |
| 119 | + link_id++) { |
| 120 | + link_data = sdata_dereference(sdata->link[link_id], |
| 121 | + sdata); |
| 122 | + if (!link_data) |
| 123 | + continue; |
| 124 | + |
| 125 | + wiphy_delayed_work_cancel(local->hw.wiphy, |
| 126 | + &link_data->dfs_cac_timer_work); |
| 127 | + |
| 128 | + if (!sdata->wdev.links[link_id].cac_started) |
| 129 | + continue; |
| 130 | + |
| 131 | + link_conf = |
| 132 | + rcu_dereference(sdata->vif.link_conf[link_id]); |
| 133 | + if (!link_conf) |
| 134 | + continue; |
| 135 | |
| 136 | - if (sdata->wdev.links[0].cac_started) { |
| 137 | - chandef = sdata->vif.bss_conf.chanreq.oper; |
| 138 | - ieee80211_link_release_channel(&sdata->deflink); |
| 139 | + chandef = link_conf->chanreq.oper; |
| 140 | + ieee80211_link_release_channel(link_data); |
| 141 | cfg80211_cac_event(sdata->dev, |
| 142 | &chandef, |
| 143 | NL80211_RADAR_CAC_ABORTED, |
| 144 | - GFP_KERNEL, 0); |
| 145 | + GFP_KERNEL, link_id); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | -- |
| 150 | 2.18.0 |
| 151 | |