summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorAditya Kumar Singh <quic_adisi@quicinc.com>2024-09-06 08:44:25 +0200
committerJohannes Berg <johannes.berg@intel.com>2024-09-06 13:01:05 +0200
commit0b7798232eee010d8c52e1ab5f96a1cce0d4183e (patch)
tree819fbc1abfc83a3567209dc64e1db8a63305ea19 /net/wireless
parentwifi: mac80211: handle DFS per link (diff)
downloadlinux-0b7798232eee010d8c52e1ab5f96a1cce0d4183e.tar.xz
linux-0b7798232eee010d8c52e1ab5f96a1cce0d4183e.zip
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>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/mlme.c10
-rw-r--r--net/wireless/nl80211.c15
2 files changed, 13 insertions, 12 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 115c8cd28aaf..4dac81854721 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1124,14 +1124,14 @@ void cfg80211_cac_event(struct net_device *netdev,
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))
return;
switch (event) {
case NL80211_RADAR_CAC_FINISHED:
- timeout = wdev->links[0].cac_start_time +
- msecs_to_jiffies(wdev->links[0].cac_time_ms);
+ timeout = wdev->links[link_id].cac_start_time +
+ msecs_to_jiffies(wdev->links[link_id].cac_time_ms);
WARN_ON(!time_after_eq(jiffies, timeout));
cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);
memcpy(&rdev->cac_done_chandef, chandef,
@@ -1140,10 +1140,10 @@ void cfg80211_cac_event(struct net_device *netdev,
cfg80211_sched_dfs_chan_update(rdev);
fallthrough;
case NL80211_RADAR_CAC_ABORTED:
- wdev->links[0].cac_started = false;
+ wdev->links[link_id].cac_started = false;
break;
case NL80211_RADAR_CAC_STARTED:
- wdev->links[0].cac_started = true;
+ wdev->links[link_id].cac_started = true;
break;
default:
WARN_ON(1);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 7d9264304a8a..8bad3c6db39d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6066,7 +6066,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
if (!rdev->ops->start_ap)
return -EOPNOTSUPP;
- if (wdev->links[0].cac_started)
+ if (wdev->links[link_id].cac_started)
return -EBUSY;
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 net_device *dev = info->user_ptr[1];
struct wireless_dev *wdev = dev->ieee80211_ptr;
+ int link_id = nl80211_link_id(info->attrs);
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_chan_def chandef;
enum nl80211_dfs_regions dfs_region;
@@ -10126,7 +10127,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
* can not already beacon
*/
if (wdev->valid_links &&
- !wdev->links[0].ap.beacon_interval) {
+ !wdev->links[link_id].ap.beacon_interval) {
/* nothing */
} else {
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;
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;
err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms,
- 0);
+ link_id);
if (!err) {
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
@@ -10171,9 +10172,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
default:
break;
}
- wdev->links[0].cac_started = true;
- wdev->links[0].cac_start_time = jiffies;
- wdev->links[0].cac_time_ms = cac_time_ms;
+ wdev->links[link_id].cac_started = true;
+ wdev->links[link_id].cac_start_time = jiffies;
+ wdev->links[link_id].cac_time_ms = cac_time_ms;
}
unlock:
wiphy_unlock(wiphy);