cfg80211/nl80211: prepare DFS offload
v3 cover cfg80211/nl80211: prepare DFS offload
Hello Johannes and all,
Here is a patch set preparing DFS offload feature. The final purpose is to enable DFS offload when hardware/driver does all the DFS activities on its own without any support from user-space tools, e.g. hostapd. In this case user-space will be only informed about results, e.g. when CAC started/stopped, radar detected, etc...
User-space functionality is already available in hostapd in the form of vendor-specific (QCA) OUI advertising DFS offload support. The idea is to add missing pieces to kernel and then to convert relevant hostapd functionality into a vendor neutral form.
Thanks,
Sergey
Changes v2 -> v3
- add patch with CAC_STARTED event
Dmitrii Lebed (2):
cfg80211/nl80211: add DFS offload flag
cfg80211/nl80211: add CAC_STARTED event
include/uapi/linux/nl80211.h | 10 ++++++++++ net/wireless/mlme.c | 7 +++++-- net/wireless/nl80211.c | 12 ++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-)
PATCH v3 1/2 cfg80211/nl80211: add DFS offload flag
From: Dmitry Lebed <[email protected]>
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 deivces 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.
--- include/uapi/linux/nl80211.h | 7 +++++++ net/wireless/nl80211.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-)
include/uapi/linux/nl80211.h +7 -0
@@ -4948,6 +4948,12 @@ enum nl80211_feature_flags {* probe request tx deferral and suppression * @NL80211_EXT_FEATURE_MFP_OPTIONAL: Driver supports the %NL80211_MFP_OPTIONAL * value in %NL80211_ATTR_USE_MFP. +* @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. * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4975,6 +4981,7 @@ enum nl80211_ext_feature_index {NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE ,NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION ,NL80211_EXT_FEATURE_MFP_OPTIONAL , +NL80211_EXT_FEATURE_DFS_OFFLOAD ,/* add new features before the definition below */ NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +8 -4
@@ -7786,12 +7786,13 @@ 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; +struct wiphy *wiphy = wdev->wiphy;struct cfg80211_chan_def chandef;enum nl80211_dfs_regions dfs_region;unsigned int cac_time_ms;int err; - dfs_region =reg_get_dfs_region (wdev->wiphy); + dfs_region =reg_get_dfs_region (wiphy);if (dfs_region ==NL80211_DFS_UNSET )return -EINVAL ;
@@ -7805,17 +7806,20 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,if (wdev->cac_started)return -EBUSY ; - err =cfg80211_chandef_dfs_required (wdev->wiphy, &chandef, - wdev->iftype); + err =cfg80211_chandef_dfs_required (wiphy, &chandef, wdev->iftype);if (err <0 )return err;if (err ==0 )return -EINVAL ; -if (!cfg80211_chandef_dfs_usable (wdev->wiphy, &chandef)) +if (!cfg80211_chandef_dfs_usable (wiphy, &chandef))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)return -EOPNOTSUPP ;
Signature · 1 line
2.11.0
PATCH v3 2/2 cfg80211/nl80211: add CAC_STARTED event
In reply to Sergey MatyukevichFrom: Dmitry Lebed <[email protected]>
CAC_STARTED event is needed for DFS offload feature and should be generated by driver/HW if DFS_OFFLOAD is enabled.
--- include/uapi/linux/nl80211.h | 3 +++ net/wireless/mlme.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/uapi/linux/nl80211.h +3 -0
@@ -5137,6 +5137,8 @@ enum nl80211_smps_mode {* non-operating channel is expired and no longer valid. New CAC must * be done on this channel before starting the operation. This is not * applicable for ETSI dfs domain where pre-CAC is valid for ever. +* @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started, +* should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled. */ enum nl80211_radar_event {NL80211_RADAR_DETECTED ,
@@ -5144,6 +5146,7 @@ enum nl80211_radar_event {NL80211_RADAR_CAC_ABORTED ,NL80211_RADAR_NOP_FINISHED ,NL80211_RADAR_PRE_CAC_EXPIRED , + NL80211_RADAR_CAC_STARTED, };/**
net/wireless/mlme.c +5 -2
@@ -914,14 +914,17 @@ void cfg80211_cac_event(struct net_device *netdev, sizeof(struct cfg80211_chan_def));queue_work (cfg80211_wq, &rdev->propagate_cac_done_wk);cfg80211_sched_dfs_chan_update (rdev); -break ; +/* fall through */ case NL80211_RADAR_CAC_ABORTED : + wdev->cac_started = false; +break ; +case NL80211_RADAR_CAC_STARTED : + wdev->cac_started = true;break ;default :WARN_ON (1 );return ; } - wdev->cac_started = false;nl80211_radar_notify (rdev, chandef, event, netdev, gfp); }
Signature · 1 line
2.11.0