Commit 13cf6dec authored by Dmitry Lebed's avatar Dmitry Lebed Committed by Johannes Berg

cfg80211/nl80211: add DFS offload flag

Add wiphy EXT_FEATURE flag to indicate that HW or driver does
all DFS actions by itself.
User-space functionality already implemented in hostapd using
vendor-specific (QCA) OUI to advertise DFS offload support.
Need to introduce generic flag to inform about DFS offload support.
For devices with DFS_OFFLOAD flag set user-space will no longer
need to issue CAC or do any actions in response to
"radar detected" events. HW will do everything by itself and send
events to user-space to indicate that CAC was started/finished, etc.
Signed-off-by: default avatarDmitrii Lebed <dlebed@quantenna.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2cb021f5
...@@ -4999,6 +4999,12 @@ enum nl80211_feature_flags { ...@@ -4999,6 +4999,12 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan. * @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan.
* @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan. * @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan.
* @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan. * @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan.
* @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions.
* Device or driver will do all DFS-related actions by itself,
* informing user-space about CAC progress, radar detection event,
* channel change triggered by radar detection event.
* No need to start CAC from user-space, no need to react to
* "radar detected" event.
* *
* @NUM_NL80211_EXT_FEATURES: number of extended features. * @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index. * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
...@@ -5029,6 +5035,7 @@ enum nl80211_ext_feature_index { ...@@ -5029,6 +5035,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_LOW_SPAN_SCAN, NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
NL80211_EXT_FEATURE_LOW_POWER_SCAN, NL80211_EXT_FEATURE_LOW_POWER_SCAN,
NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
NL80211_EXT_FEATURE_DFS_OFFLOAD,
/* add new features before the definition below */ /* add new features before the definition below */
NUM_NL80211_EXT_FEATURES, NUM_NL80211_EXT_FEATURES,
......
...@@ -7551,12 +7551,13 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, ...@@ -7551,12 +7551,13 @@ 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;
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;
unsigned int cac_time_ms; unsigned int cac_time_ms;
int err; int err;
dfs_region = reg_get_dfs_region(wdev->wiphy); dfs_region = reg_get_dfs_region(wiphy);
if (dfs_region == NL80211_DFS_UNSET) if (dfs_region == NL80211_DFS_UNSET)
return -EINVAL; return -EINVAL;
...@@ -7570,17 +7571,20 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, ...@@ -7570,17 +7571,20 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
if (wdev->cac_started) if (wdev->cac_started)
return -EBUSY; return -EBUSY;
err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef, err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype);
wdev->iftype);
if (err < 0) if (err < 0)
return err; return err;
if (err == 0) if (err == 0)
return -EINVAL; return -EINVAL;
if (!cfg80211_chandef_dfs_usable(wdev->wiphy, &chandef)) if (!cfg80211_chandef_dfs_usable(wiphy, &chandef))
return -EINVAL; return -EINVAL;
/* CAC start is offloaded to HW and can't be started manually */
if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD))
return -EOPNOTSUPP;
if (!rdev->ops->start_radar_detection) if (!rdev->ops->start_radar_detection)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment