Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: cfg80211: move DFS related members to links[] in wireless_dev

A few members related to DFS handling are currently under per wireless
device data structure. However, in order to support DFS with MLO, there is
a need to have them on a per-link manner.

Hence, as a preliminary step, move members cac_started, cac_start_time
and cac_time_ms to be on a per-link basis.

Since currently, link ID is not known at all places, use default value of
0 for now.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://patch.msgid.link/20240906064426.2101315-5-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Aditya Kumar Singh and committed by
Johannes Berg
62c16f21 f4bb650c

+38 -36
+2 -2
drivers/net/wireless/marvell/mwifiex/11h.c
··· 117 117 dfs_cac_work); 118 118 119 119 chandef = priv->dfs_chandef; 120 - if (priv->wdev.cac_started) { 120 + if (priv->wdev.links[0].cac_started) { 121 121 mwifiex_dbg(priv->adapter, MSG, 122 122 "CAC timer finished; No radar detected\n"); 123 123 cfg80211_cac_event(priv->netdev, &chandef, ··· 174 174 */ 175 175 void mwifiex_abort_cac(struct mwifiex_private *priv) 176 176 { 177 - if (priv->wdev.cac_started) { 177 + if (priv->wdev.links[0].cac_started) { 178 178 if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef)) 179 179 mwifiex_dbg(priv->adapter, ERROR, 180 180 "failed to stop CAC in FW\n");
+2 -2
drivers/net/wireless/marvell/mwifiex/cfg80211.c
··· 1906 1906 struct mwifiex_sta_node *sta_node; 1907 1907 u8 deauth_mac[ETH_ALEN]; 1908 1908 1909 - if (!priv->bss_started && priv->wdev.cac_started) { 1909 + if (!priv->bss_started && priv->wdev.links[0].cac_started) { 1910 1910 mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); 1911 1911 mwifiex_abort_cac(priv); 1912 1912 } ··· 4038 4038 return -EBUSY; 4039 4039 } 4040 4040 4041 - if (priv->wdev.cac_started) 4041 + if (priv->wdev.links[0].cac_started) 4042 4042 return -EBUSY; 4043 4043 4044 4044 if (cfg80211_chandef_identical(&params->chandef,
+3 -3
drivers/net/wireless/quantenna/qtnfmac/event.c
··· 520 520 cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); 521 521 break; 522 522 case QLINK_RADAR_CAC_FINISHED: 523 - if (!vif->wdev.cac_started) 523 + if (!vif->wdev.links[0].cac_started) 524 524 break; 525 525 526 526 cfg80211_cac_event(vif->netdev, &chandef, 527 527 NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); 528 528 break; 529 529 case QLINK_RADAR_CAC_ABORTED: 530 - if (!vif->wdev.cac_started) 530 + if (!vif->wdev.links[0].cac_started) 531 531 break; 532 532 533 533 cfg80211_cac_event(vif->netdev, &chandef, 534 534 NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); 535 535 break; 536 536 case QLINK_RADAR_CAC_STARTED: 537 - if (vif->wdev.cac_started) 537 + if (vif->wdev.links[0].cac_started) 538 538 break; 539 539 540 540 if (!wiphy_ext_feature_isset(wiphy,
+9 -8
include/net/cfg80211.h
··· 6194 6194 * @address: The address for this device, valid only if @netdev is %NULL 6195 6195 * @is_running: true if this is a non-netdev device that has been started, e.g. 6196 6196 * the P2P Device. 6197 - * @cac_started: true if DFS channel availability check has been started 6198 - * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 6199 - * @cac_time_ms: CAC time in ms 6200 6197 * @ps: powersave mode is enabled 6201 6198 * @ps_timeout: dynamic powersave timeout 6202 6199 * @ap_unexpected_nlportid: (private) netlink port ID of application ··· 6217 6220 * unprotected beacon report 6218 6221 * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr 6219 6222 * @ap and @client for each link 6223 + * @links[].cac_started: true if DFS channel availability check has been 6224 + * started 6225 + * @links[].cac_start_time: timestamp (jiffies) when the dfs state was 6226 + * entered. 6227 + * @links[].cac_time_ms: CAC time in ms 6220 6228 * @valid_links: bitmap describing what elements of @links are valid 6221 6229 */ 6222 6230 struct wireless_dev { ··· 6262 6260 6263 6261 u32 owner_nlportid; 6264 6262 bool nl_owner_dead; 6265 - 6266 - /* FIXME: need to rework radar detection for MLO */ 6267 - bool cac_started; 6268 - unsigned long cac_start_time; 6269 - unsigned int cac_time_ms; 6270 6263 6271 6264 #ifdef CONFIG_CFG80211_WEXT 6272 6265 /* wext data */ ··· 6329 6332 struct cfg80211_internal_bss *current_bss; 6330 6333 } client; 6331 6334 }; 6335 + 6336 + bool cac_started; 6337 + unsigned long cac_start_time; 6338 + unsigned int cac_time_ms; 6332 6339 } links[IEEE80211_MLD_MAX_NUM_LINKS]; 6333 6340 u16 valid_links; 6334 6341 };
+4 -4
net/mac80211/cfg.c
··· 1662 1662 ieee80211_link_info_change_notify(sdata, link, 1663 1663 BSS_CHANGED_BEACON_ENABLED); 1664 1664 1665 - if (sdata->wdev.cac_started) { 1665 + if (sdata->wdev.links[0].cac_started) { 1666 1666 chandef = link_conf->chanreq.oper; 1667 1667 wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); 1668 1668 cfg80211_cac_event(sdata->dev, &chandef, ··· 3501 3501 wiphy_delayed_work_cancel(wiphy, 3502 3502 &sdata->deflink.dfs_cac_timer_work); 3503 3503 3504 - if (sdata->wdev.cac_started) { 3504 + if (sdata->wdev.links[0].cac_started) { 3505 3505 ieee80211_link_release_channel(&sdata->deflink); 3506 - sdata->wdev.cac_started = false; 3506 + sdata->wdev.links[0].cac_started = false; 3507 3507 } 3508 3508 } 3509 3509 } ··· 3958 3958 if (!list_empty(&local->roc_list) || local->scanning) 3959 3959 return -EBUSY; 3960 3960 3961 - if (sdata->wdev.cac_started) 3961 + if (sdata->wdev.links[0].cac_started) 3962 3962 return -EBUSY; 3963 3963 3964 3964 if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS))
+1 -1
net/mac80211/iface.c
··· 552 552 wiphy_delayed_work_cancel(local->hw.wiphy, 553 553 &sdata->deflink.dfs_cac_timer_work); 554 554 555 - if (sdata->wdev.cac_started) { 555 + if (sdata->wdev.links[0].cac_started) { 556 556 chandef = sdata->vif.bss_conf.chanreq.oper; 557 557 WARN_ON(local->suspended); 558 558 ieee80211_link_release_channel(&sdata->deflink);
+1 -1
net/mac80211/mlme.c
··· 3039 3039 3040 3040 lockdep_assert_wiphy(sdata->local->hw.wiphy); 3041 3041 3042 - if (sdata->wdev.cac_started) { 3042 + if (sdata->wdev.links[0].cac_started) { 3043 3043 ieee80211_link_release_channel(link); 3044 3044 cfg80211_cac_event(sdata->dev, &chandef, 3045 3045 NL80211_RADAR_CAC_FINISHED,
+1 -1
net/mac80211/scan.c
··· 585 585 return false; 586 586 587 587 list_for_each_entry(sdata_iter, &local->interfaces, list) { 588 - if (sdata_iter->wdev.cac_started) 588 + if (sdata_iter->wdev.links[0].cac_started) 589 589 return false; 590 590 } 591 591
+1 -1
net/mac80211/util.c
··· 3478 3478 wiphy_delayed_work_cancel(local->hw.wiphy, 3479 3479 &sdata->deflink.dfs_cac_timer_work); 3480 3480 3481 - if (sdata->wdev.cac_started) { 3481 + if (sdata->wdev.links[0].cac_started) { 3482 3482 chandef = sdata->vif.bss_conf.chanreq.oper; 3483 3483 ieee80211_link_release_channel(&sdata->deflink); 3484 3484 cfg80211_cac_event(sdata->dev,
+1 -1
net/wireless/ibss.c
··· 94 94 95 95 lockdep_assert_held(&rdev->wiphy.mtx); 96 96 97 - if (wdev->cac_started) 97 + if (wdev->links[0].cac_started) 98 98 return -EBUSY; 99 99 100 100 if (wdev->u.ibss.ssid_len)
+1 -1
net/wireless/mesh.c
··· 127 127 if (!rdev->ops->join_mesh) 128 128 return -EOPNOTSUPP; 129 129 130 - if (wdev->cac_started) 130 + if (wdev->links[0].cac_started) 131 131 return -EBUSY; 132 132 133 133 if (!setup->chandef.chan) {
+6 -5
net/wireless/mlme.c
··· 1123 1123 1124 1124 trace_cfg80211_cac_event(netdev, event); 1125 1125 1126 - if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED)) 1126 + if (WARN_ON(!wdev->links[0].cac_started && 1127 + event != NL80211_RADAR_CAC_STARTED)) 1127 1128 return; 1128 1129 1129 1130 switch (event) { 1130 1131 case NL80211_RADAR_CAC_FINISHED: 1131 - timeout = wdev->cac_start_time + 1132 - msecs_to_jiffies(wdev->cac_time_ms); 1132 + timeout = wdev->links[0].cac_start_time + 1133 + msecs_to_jiffies(wdev->links[0].cac_time_ms); 1133 1134 WARN_ON(!time_after_eq(jiffies, timeout)); 1134 1135 cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); 1135 1136 memcpy(&rdev->cac_done_chandef, chandef, ··· 1139 1138 cfg80211_sched_dfs_chan_update(rdev); 1140 1139 fallthrough; 1141 1140 case NL80211_RADAR_CAC_ABORTED: 1142 - wdev->cac_started = false; 1141 + wdev->links[0].cac_started = false; 1143 1142 break; 1144 1143 case NL80211_RADAR_CAC_STARTED: 1145 - wdev->cac_started = true; 1144 + wdev->links[0].cac_started = true; 1146 1145 break; 1147 1146 default: 1148 1147 WARN_ON(1);
+5 -5
net/wireless/nl80211.c
··· 6066 6066 if (!rdev->ops->start_ap) 6067 6067 return -EOPNOTSUPP; 6068 6068 6069 - if (wdev->cac_started) 6069 + if (wdev->links[0].cac_started) 6070 6070 return -EBUSY; 6071 6071 6072 6072 if (wdev->links[link_id].ap.beacon_interval) ··· 10121 10121 goto unlock; 10122 10122 } 10123 10123 10124 - if (cfg80211_beaconing_iface_active(wdev) || wdev->cac_started) { 10124 + if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) { 10125 10125 err = -EBUSY; 10126 10126 goto unlock; 10127 10127 } ··· 10157 10157 default: 10158 10158 break; 10159 10159 } 10160 - wdev->cac_started = true; 10161 - wdev->cac_start_time = jiffies; 10162 - wdev->cac_time_ms = cac_time_ms; 10160 + wdev->links[0].cac_started = true; 10161 + wdev->links[0].cac_start_time = jiffies; 10162 + wdev->links[0].cac_time_ms = cac_time_ms; 10163 10163 } 10164 10164 unlock: 10165 10165 wiphy_unlock(wiphy);
+1 -1
net/wireless/reg.c
··· 4241 4241 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { 4242 4242 struct cfg80211_chan_def *chandef; 4243 4243 4244 - if (!wdev->cac_started) 4244 + if (!wdev->links[0].cac_started) 4245 4245 continue; 4246 4246 4247 4247 /* FIXME: radar detection is tied to link 0 for now */