mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
wifi: cfg80211/mac80211: use proper link ID for DFS
Now that all APIs have support to handle DFS per link, use proper link ID instead of 0. Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> Link: https://patch.msgid.link/20240906064426.2101315-8-quic_adisi@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
d74380ee99
commit
0b7798232e
5 changed files with 22 additions and 19 deletions
|
@ -1662,12 +1662,12 @@ 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.links[0].cac_started) {
|
if (sdata->wdev.links[link_id].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,
|
||||||
NL80211_RADAR_CAC_ABORTED,
|
NL80211_RADAR_CAC_ABORTED,
|
||||||
GFP_KERNEL, 0);
|
GFP_KERNEL, link_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
drv_stop_ap(sdata->local, sdata, link_conf);
|
drv_stop_ap(sdata->local, sdata, link_conf);
|
||||||
|
@ -3968,7 +3968,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.links[0].cac_started)
|
if (sdata->wdev.links[link_id].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))
|
||||||
|
|
|
@ -3039,11 +3039,11 @@ 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.links[0].cac_started) {
|
if (sdata->wdev.links[link->link_id].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,
|
||||||
GFP_KERNEL, 0);
|
GFP_KERNEL, link->link_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -575,6 +575,7 @@ static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata)
|
||||||
{
|
{
|
||||||
struct ieee80211_local *local = sdata->local;
|
struct ieee80211_local *local = sdata->local;
|
||||||
struct ieee80211_sub_if_data *sdata_iter;
|
struct ieee80211_sub_if_data *sdata_iter;
|
||||||
|
unsigned int link_id;
|
||||||
|
|
||||||
lockdep_assert_wiphy(local->hw.wiphy);
|
lockdep_assert_wiphy(local->hw.wiphy);
|
||||||
|
|
||||||
|
@ -585,7 +586,8 @@ 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.links[0].cac_started)
|
for_each_valid_link(&sdata_iter->wdev, link_id)
|
||||||
|
if (sdata_iter->wdev.links[link_id].cac_started)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1124,14 +1124,14 @@ void cfg80211_cac_event(struct net_device *netdev,
|
||||||
|
|
||||||
trace_cfg80211_cac_event(netdev, event, link_id);
|
trace_cfg80211_cac_event(netdev, event, link_id);
|
||||||
|
|
||||||
if (WARN_ON(!wdev->links[0].cac_started &&
|
if (WARN_ON(!wdev->links[link_id].cac_started &&
|
||||||
event != NL80211_RADAR_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->links[0].cac_start_time +
|
timeout = wdev->links[link_id].cac_start_time +
|
||||||
msecs_to_jiffies(wdev->links[0].cac_time_ms);
|
msecs_to_jiffies(wdev->links[link_id].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,
|
||||||
|
@ -1140,10 +1140,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->links[0].cac_started = false;
|
wdev->links[link_id].cac_started = false;
|
||||||
break;
|
break;
|
||||||
case NL80211_RADAR_CAC_STARTED:
|
case NL80211_RADAR_CAC_STARTED:
|
||||||
wdev->links[0].cac_started = true;
|
wdev->links[link_id].cac_started = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
|
|
|
@ -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->links[0].cac_started)
|
if (wdev->links[link_id].cac_started)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
if (wdev->links[link_id].ap.beacon_interval)
|
if (wdev->links[link_id].ap.beacon_interval)
|
||||||
|
@ -10072,6 +10072,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
|
||||||
struct cfg80211_registered_device *rdev = info->user_ptr[0];
|
struct cfg80211_registered_device *rdev = info->user_ptr[0];
|
||||||
struct net_device *dev = info->user_ptr[1];
|
struct net_device *dev = info->user_ptr[1];
|
||||||
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
||||||
|
int link_id = nl80211_link_id(info->attrs);
|
||||||
struct wiphy *wiphy = wdev->wiphy;
|
struct wiphy *wiphy = wdev->wiphy;
|
||||||
struct cfg80211_chan_def chandef;
|
struct cfg80211_chan_def chandef;
|
||||||
enum nl80211_dfs_regions dfs_region;
|
enum nl80211_dfs_regions dfs_region;
|
||||||
|
@ -10126,7 +10127,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
|
||||||
* can not already beacon
|
* can not already beacon
|
||||||
*/
|
*/
|
||||||
if (wdev->valid_links &&
|
if (wdev->valid_links &&
|
||||||
!wdev->links[0].ap.beacon_interval) {
|
!wdev->links[link_id].ap.beacon_interval) {
|
||||||
/* nothing */
|
/* nothing */
|
||||||
} else {
|
} else {
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
|
@ -10134,7 +10135,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wdev->links[0].cac_started) {
|
if (wdev->links[link_id].cac_started) {
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
@ -10155,7 +10156,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
|
||||||
cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS;
|
cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS;
|
||||||
|
|
||||||
err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms,
|
err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms,
|
||||||
0);
|
link_id);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
switch (wdev->iftype) {
|
switch (wdev->iftype) {
|
||||||
case NL80211_IFTYPE_AP:
|
case NL80211_IFTYPE_AP:
|
||||||
|
@ -10171,9 +10172,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wdev->links[0].cac_started = true;
|
wdev->links[link_id].cac_started = true;
|
||||||
wdev->links[0].cac_start_time = jiffies;
|
wdev->links[link_id].cac_start_time = jiffies;
|
||||||
wdev->links[0].cac_time_ms = cac_time_ms;
|
wdev->links[link_id].cac_time_ms = cac_time_ms;
|
||||||
}
|
}
|
||||||
unlock:
|
unlock:
|
||||||
wiphy_unlock(wiphy);
|
wiphy_unlock(wiphy);
|
||||||
|
|
Loading…
Add table
Reference in a new issue