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>
This commit is contained in:
Aditya Kumar Singh 2024-09-06 12:14:22 +05:30 committed by Johannes Berg
parent f4bb650cfa
commit 62c16f219a
14 changed files with 38 additions and 36 deletions

View File

@ -117,7 +117,7 @@ void mwifiex_dfs_cac_work_queue(struct work_struct *work)
dfs_cac_work); dfs_cac_work);
chandef = priv->dfs_chandef; chandef = priv->dfs_chandef;
if (priv->wdev.cac_started) { if (priv->wdev.links[0].cac_started) {
mwifiex_dbg(priv->adapter, MSG, mwifiex_dbg(priv->adapter, MSG,
"CAC timer finished; No radar detected\n"); "CAC timer finished; No radar detected\n");
cfg80211_cac_event(priv->netdev, &chandef, cfg80211_cac_event(priv->netdev, &chandef,
@ -174,7 +174,7 @@ int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
*/ */
void mwifiex_abort_cac(struct mwifiex_private *priv) void mwifiex_abort_cac(struct mwifiex_private *priv)
{ {
if (priv->wdev.cac_started) { if (priv->wdev.links[0].cac_started) {
if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef)) if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
mwifiex_dbg(priv->adapter, ERROR, mwifiex_dbg(priv->adapter, ERROR,
"failed to stop CAC in FW\n"); "failed to stop CAC in FW\n");

View File

@ -1906,7 +1906,7 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
struct mwifiex_sta_node *sta_node; struct mwifiex_sta_node *sta_node;
u8 deauth_mac[ETH_ALEN]; u8 deauth_mac[ETH_ALEN];
if (!priv->bss_started && priv->wdev.cac_started) { if (!priv->bss_started && priv->wdev.links[0].cac_started) {
mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__); mwifiex_dbg(priv->adapter, INFO, "%s: abort CAC!\n", __func__);
mwifiex_abort_cac(priv); mwifiex_abort_cac(priv);
} }
@ -4038,7 +4038,7 @@ mwifiex_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
return -EBUSY; return -EBUSY;
} }
if (priv->wdev.cac_started) if (priv->wdev.links[0].cac_started)
return -EBUSY; return -EBUSY;
if (cfg80211_chandef_identical(&params->chandef, if (cfg80211_chandef_identical(&params->chandef,

View File

@ -520,21 +520,21 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif,
cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL); cfg80211_radar_event(wiphy, &chandef, GFP_KERNEL);
break; break;
case QLINK_RADAR_CAC_FINISHED: case QLINK_RADAR_CAC_FINISHED:
if (!vif->wdev.cac_started) if (!vif->wdev.links[0].cac_started)
break; break;
cfg80211_cac_event(vif->netdev, &chandef, cfg80211_cac_event(vif->netdev, &chandef,
NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); NL80211_RADAR_CAC_FINISHED, GFP_KERNEL);
break; break;
case QLINK_RADAR_CAC_ABORTED: case QLINK_RADAR_CAC_ABORTED:
if (!vif->wdev.cac_started) if (!vif->wdev.links[0].cac_started)
break; break;
cfg80211_cac_event(vif->netdev, &chandef, cfg80211_cac_event(vif->netdev, &chandef,
NL80211_RADAR_CAC_ABORTED, GFP_KERNEL); NL80211_RADAR_CAC_ABORTED, GFP_KERNEL);
break; break;
case QLINK_RADAR_CAC_STARTED: case QLINK_RADAR_CAC_STARTED:
if (vif->wdev.cac_started) if (vif->wdev.links[0].cac_started)
break; break;
if (!wiphy_ext_feature_isset(wiphy, if (!wiphy_ext_feature_isset(wiphy,

View File

@ -6194,9 +6194,6 @@ enum ieee80211_ap_reg_power {
* @address: The address for this device, valid only if @netdev is %NULL * @address: The address for this device, valid only if @netdev is %NULL
* @is_running: true if this is a non-netdev device that has been started, e.g. * @is_running: true if this is a non-netdev device that has been started, e.g.
* the P2P Device. * the P2P Device.
* @cac_started: true if DFS channel availability check has been started
* @cac_start_time: timestamp (jiffies) when the dfs state was entered.
* @cac_time_ms: CAC time in ms
* @ps: powersave mode is enabled * @ps: powersave mode is enabled
* @ps_timeout: dynamic powersave timeout * @ps_timeout: dynamic powersave timeout
* @ap_unexpected_nlportid: (private) netlink port ID of application * @ap_unexpected_nlportid: (private) netlink port ID of application
@ -6220,6 +6217,11 @@ enum ieee80211_ap_reg_power {
* unprotected beacon report * unprotected beacon report
* @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
* @ap and @client for each link * @ap and @client for each link
* @links[].cac_started: true if DFS channel availability check has been
* started
* @links[].cac_start_time: timestamp (jiffies) when the dfs state was
* entered.
* @links[].cac_time_ms: CAC time in ms
* @valid_links: bitmap describing what elements of @links are valid * @valid_links: bitmap describing what elements of @links are valid
*/ */
struct wireless_dev { struct wireless_dev {
@ -6261,11 +6263,6 @@ struct wireless_dev {
u32 owner_nlportid; u32 owner_nlportid;
bool nl_owner_dead; bool nl_owner_dead;
/* FIXME: need to rework radar detection for MLO */
bool cac_started;
unsigned long cac_start_time;
unsigned int cac_time_ms;
#ifdef CONFIG_CFG80211_WEXT #ifdef CONFIG_CFG80211_WEXT
/* wext data */ /* wext data */
struct { struct {
@ -6332,6 +6329,10 @@ struct wireless_dev {
struct cfg80211_internal_bss *current_bss; struct cfg80211_internal_bss *current_bss;
} client; } client;
}; };
bool cac_started;
unsigned long cac_start_time;
unsigned int cac_time_ms;
} links[IEEE80211_MLD_MAX_NUM_LINKS]; } links[IEEE80211_MLD_MAX_NUM_LINKS];
u16 valid_links; u16 valid_links;
}; };

View File

@ -1662,7 +1662,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
ieee80211_link_info_change_notify(sdata, link, ieee80211_link_info_change_notify(sdata, link,
BSS_CHANGED_BEACON_ENABLED); BSS_CHANGED_BEACON_ENABLED);
if (sdata->wdev.cac_started) { if (sdata->wdev.links[0].cac_started) {
chandef = link_conf->chanreq.oper; chandef = link_conf->chanreq.oper;
wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work); wiphy_delayed_work_cancel(wiphy, &link->dfs_cac_timer_work);
cfg80211_cac_event(sdata->dev, &chandef, cfg80211_cac_event(sdata->dev, &chandef,
@ -3501,9 +3501,9 @@ static void ieee80211_end_cac(struct wiphy *wiphy,
wiphy_delayed_work_cancel(wiphy, wiphy_delayed_work_cancel(wiphy,
&sdata->deflink.dfs_cac_timer_work); &sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) { if (sdata->wdev.links[0].cac_started) {
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
sdata->wdev.cac_started = false; sdata->wdev.links[0].cac_started = false;
} }
} }
} }
@ -3958,7 +3958,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
if (!list_empty(&local->roc_list) || local->scanning) if (!list_empty(&local->roc_list) || local->scanning)
return -EBUSY; return -EBUSY;
if (sdata->wdev.cac_started) if (sdata->wdev.links[0].cac_started)
return -EBUSY; return -EBUSY;
if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS)) if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS))

View File

@ -552,7 +552,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
wiphy_delayed_work_cancel(local->hw.wiphy, wiphy_delayed_work_cancel(local->hw.wiphy,
&sdata->deflink.dfs_cac_timer_work); &sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) { if (sdata->wdev.links[0].cac_started) {
chandef = sdata->vif.bss_conf.chanreq.oper; chandef = sdata->vif.bss_conf.chanreq.oper;
WARN_ON(local->suspended); WARN_ON(local->suspended);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);

View File

@ -3039,7 +3039,7 @@ void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work)
lockdep_assert_wiphy(sdata->local->hw.wiphy); lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (sdata->wdev.cac_started) { if (sdata->wdev.links[0].cac_started) {
ieee80211_link_release_channel(link); ieee80211_link_release_channel(link);
cfg80211_cac_event(sdata->dev, &chandef, cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_FINISHED, NL80211_RADAR_CAC_FINISHED,

View File

@ -585,7 +585,7 @@ static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata)
return false; return false;
list_for_each_entry(sdata_iter, &local->interfaces, list) { list_for_each_entry(sdata_iter, &local->interfaces, list) {
if (sdata_iter->wdev.cac_started) if (sdata_iter->wdev.links[0].cac_started)
return false; return false;
} }

View File

@ -3478,7 +3478,7 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
wiphy_delayed_work_cancel(local->hw.wiphy, wiphy_delayed_work_cancel(local->hw.wiphy,
&sdata->deflink.dfs_cac_timer_work); &sdata->deflink.dfs_cac_timer_work);
if (sdata->wdev.cac_started) { if (sdata->wdev.links[0].cac_started) {
chandef = sdata->vif.bss_conf.chanreq.oper; chandef = sdata->vif.bss_conf.chanreq.oper;
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
cfg80211_cac_event(sdata->dev, cfg80211_cac_event(sdata->dev,

View File

@ -94,7 +94,7 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
lockdep_assert_held(&rdev->wiphy.mtx); lockdep_assert_held(&rdev->wiphy.mtx);
if (wdev->cac_started) if (wdev->links[0].cac_started)
return -EBUSY; return -EBUSY;
if (wdev->u.ibss.ssid_len) if (wdev->u.ibss.ssid_len)

View File

@ -127,7 +127,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
if (!rdev->ops->join_mesh) if (!rdev->ops->join_mesh)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (wdev->cac_started) if (wdev->links[0].cac_started)
return -EBUSY; return -EBUSY;
if (!setup->chandef.chan) { if (!setup->chandef.chan) {

View File

@ -1123,13 +1123,14 @@ void cfg80211_cac_event(struct net_device *netdev,
trace_cfg80211_cac_event(netdev, event); trace_cfg80211_cac_event(netdev, event);
if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED)) if (WARN_ON(!wdev->links[0].cac_started &&
event != NL80211_RADAR_CAC_STARTED))
return; return;
switch (event) { switch (event) {
case NL80211_RADAR_CAC_FINISHED: case NL80211_RADAR_CAC_FINISHED:
timeout = wdev->cac_start_time + timeout = wdev->links[0].cac_start_time +
msecs_to_jiffies(wdev->cac_time_ms); msecs_to_jiffies(wdev->links[0].cac_time_ms);
WARN_ON(!time_after_eq(jiffies, timeout)); WARN_ON(!time_after_eq(jiffies, timeout));
cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);
memcpy(&rdev->cac_done_chandef, chandef, memcpy(&rdev->cac_done_chandef, chandef,
@ -1138,10 +1139,10 @@ void cfg80211_cac_event(struct net_device *netdev,
cfg80211_sched_dfs_chan_update(rdev); cfg80211_sched_dfs_chan_update(rdev);
fallthrough; fallthrough;
case NL80211_RADAR_CAC_ABORTED: case NL80211_RADAR_CAC_ABORTED:
wdev->cac_started = false; wdev->links[0].cac_started = false;
break; break;
case NL80211_RADAR_CAC_STARTED: case NL80211_RADAR_CAC_STARTED:
wdev->cac_started = true; wdev->links[0].cac_started = true;
break; break;
default: default:
WARN_ON(1); WARN_ON(1);

View File

@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
if (!rdev->ops->start_ap) if (!rdev->ops->start_ap)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (wdev->cac_started) if (wdev->links[0].cac_started)
return -EBUSY; return -EBUSY;
if (wdev->links[link_id].ap.beacon_interval) if (wdev->links[link_id].ap.beacon_interval)
@ -10121,7 +10121,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
goto unlock; goto unlock;
} }
if (cfg80211_beaconing_iface_active(wdev) || wdev->cac_started) { if (cfg80211_beaconing_iface_active(wdev) || wdev->links[0].cac_started) {
err = -EBUSY; err = -EBUSY;
goto unlock; goto unlock;
} }
@ -10157,9 +10157,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
default: default:
break; break;
} }
wdev->cac_started = true; wdev->links[0].cac_started = true;
wdev->cac_start_time = jiffies; wdev->links[0].cac_start_time = jiffies;
wdev->cac_time_ms = cac_time_ms; wdev->links[0].cac_time_ms = cac_time_ms;
} }
unlock: unlock:
wiphy_unlock(wiphy); wiphy_unlock(wiphy);

View File

@ -4241,7 +4241,7 @@ static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev)
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
struct cfg80211_chan_def *chandef; struct cfg80211_chan_def *chandef;
if (!wdev->cac_started) if (!wdev->links[0].cac_started)
continue; continue;
/* FIXME: radar detection is tied to link 0 for now */ /* FIXME: radar detection is tied to link 0 for now */