nl/cfg/mac80211: add DFS master ability
Subsystems (2)
v3 cover nl/cfg/mac80211: add DFS master ability
v3:
Rebased to "wireless-testing".
nl80211/cfg80211: add radar detection command/event
Added units documentation to "radar_detect_timeout".
Added "cac_type" - which indicates that CAC is started for this channel type. Added NL80211_ATTR_WIPHY_CHANNEL_TYPE.
Fixed merge problem.
Removed "!!" in nl80211_start_radar_detection.
Return -EBUSY in start_radar_detection if detection already started for this specific channel.
mac80211: add radar detection command/event
Added tracer to ieee80211_radar_detected().
Changed freq argument in ieee80211_radar_detected() to "struct ieee80211_channel *chan" Reset CAC during interface down.
nl80211/cfg80211: add ability to enable TX on op-channel
Removed "!!" in nl80211_dfs_en_tx().
Typo fix in the documentation.
Added additional check to validate that we're on NL80211_CHAN_HT20 channel, otherwise return -EPERM.
nl80211/cfg80211: add ap channel switch command/event
Moved struct ieee80211_ap_ch_switch from mac to cfg + pass it as argument in ap_channel_switch() Add "if (ch_type != NL80211_CHAN_NO_HT) return -EOPNOTSUPP"
Changed freq argument in ap_ch_switch_complete_notify() to "struct ieee80211_channel *chan"
mac80211: add ap channel switch command/event
Renamed ieee80211_ap_ch_switch_complete_notify to ieee80211_ap_ch_switch_done. Removed the freq argument in ieee80211_ap_ch_switch_done(). Save the target channel in new "local->next_ap_channel" and update the operational channel in ieee80211_ap_ch_switch_done. Add tracer to ieee80211_ap_ch_switch_done(). Updated commit log message. Added sanity checks in ap_channel_switch() + ieee80211_ap_ch_switch_complete
mac80211: add DFS support to monitor interface
Removed "!!" in ieee80211_monitor_start_xmit().
Victor Goldenshtein (7):
nl80211/cfg80211: add radar detection command/event
mac80211: add radar detection command/event nl80211/cfg80211: add ability to enable TX on op-channel
mac80211: add ability to enable TX on op-channel nl80211/cfg80211: add ap channel switch command
mac80211: add ap channel switch command/event
mac80211: add DFS support to monitor interface
include/linux/nl80211.h | 42 +++++++++++ include/net/cfg80211.h | 63 +++++++++++++++++ include/net/mac80211.h | 37 ++++++++++ net/mac80211/cfg.c | 50 +++++++++++++ net/mac80211/driver-ops.h | 38 ++++++++++ net/mac80211/iface.c | 7 ++ net/mac80211/main.c | 3 + net/mac80211/mlme.c | 32 +++++++++ net/mac80211/trace.h | 87 +++++++++++++++++++++++ net/mac80211/tx.c | 13 ++-- net/wireless/core.h | 4 + net/wireless/mlme.c | 38 ++++++++++ net/wireless/nl80211.c | 171 +++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 6 ++ 14 files changed, 585 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v3 1/7 nl80211/cfg80211: add radar detection command/event
Add new NL80211_CMD_RADAR_DETECT, which triggers radar detection in the driver/FW, this command will also notify usermode with 'radar detected' event.
Once radar detection has started it should continuously monitor for radars as long as the channel is active.
Add new NL80211_FEATURE_DFS attribute which indicates that driver/HW supports radar detection.
--- include/linux/nl80211.h | 7 ++++ include/net/cfg80211.h | 24 ++++++++++++++ net/wireless/core.h | 4 ++ net/wireless/mlme.c | 38 ++++++++++++++++++++++ net/wireless/nl80211.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 6 +++ 6 files changed, 159 insertions(+), 0 deletions(-)
include/linux/nl80211.h +7 -0
@@ -565,6 +565,9 @@* %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. * +* @NL80211_CMD_RADAR_DETECT: Start radar detection in the driver/HW. Once +* radar detected usermode notified with this event. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -708,6 +711,8 @@ enum nl80211_commands {NL80211_CMD_CH_SWITCH_NOTIFY , + NL80211_CMD_RADAR_DETECT, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -2994,12 +2999,14 @@ enum nl80211_ap_sme_features {* @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested * to work properly to suppport receiving regulatory hints from * cellular base stations. +* @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver. */ enum nl80211_feature_flags {NL80211_FEATURE_SK_TX_STATUS =1 <<0 ,NL80211_FEATURE_HT_IBSS =1 <<1 ,NL80211_FEATURE_INACTIVITY_TIMER =1 <<2 ,NL80211_FEATURE_CELL_BASE_REG_HINTS =1 <<3 , +NL80211_FEATURE_DFS =1 <<4 , };/**
include/net/cfg80211.h +24 -0
@@ -131,6 +131,11 @@ enum ieee80211_channel_flags {* to enable this, this is useful only on 5 GHz band. * @orig_mag: internal use * @orig_mpwr: internal use +* @radar_detect_timeout: this timeout indicates the end of the channel +* availability check for radar channels (in jiffies), only after this +* period the user may initiate the tx on the channel. +* @cac_type: indicates that channel availability check is started for this +* channel type. */ struct ieee80211_channel {enum ieee80211_band band;
@@ -143,6 +148,8 @@ struct ieee80211_channel {bool beacon_found;u32 orig_flags;int orig_mag, orig_mpwr; +unsigned long radar_detect_timeout; +enum nl80211_channel_type cac_type; };/**
@@ -1618,6 +1625,8 @@ struct cfg80211_gtk_rekey_data {* @get_channel: Get the current operating channel for the virtual interface. * For monitor interfaces, it should return %NULL unless there's a single * current monitoring channel. +* +* @start_radar_detection: Start radar detection in the driver. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -1834,6 +1843,10 @@ struct cfg80211_ops { (*get_channel)(struct wiphy *wiphy, struct wireless_dev *wdev, enum nl80211_channel_type *type); + +int (*start_radar_detection)(struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_channel *chan); };/*
@@ -3392,6 +3405,17 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, gfp_t gfp);/** +* cfg80211_radar_detected - radar detection event +* @dev: network device +* @chan: radar detected on this channel. +* @gfp: context flags +* +* This function is called when a radar is detected on the current channel. +*/ +void cfg80211_radar_detected (struct net_device *dev, +struct ieee80211_channel *chan,gfp_t gfp); + +/** * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer * @dev: network device * @peer: peer's MAC address
net/wireless/core.h +4 -0
@@ -471,6 +471,10 @@ rdev_freq_to_chan(struct cfg80211_registered_device *rdev,int cfg80211_set_monitor_channel (struct cfg80211_registered_device *rdev,int freq,enum nl80211_channel_type chantype); +int cfg80211_start_radar_detection (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct ieee80211_channel *chan); +int ieee80211_get_ratemask (struct ieee80211_supported_band *sband,const u8 *rates,unsigned int n_rates,u32 *mask);
net/wireless/mlme.c +38 -0
@@ -16,6 +16,8 @@#include "core.h" #include "nl80211.h" +#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 +void cfg80211_send_rx_auth (struct net_device *dev,const u8 *buf,size_t len) {struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -1006,3 +1008,39 @@ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,return nl80211_unexpected_4addr_frame (dev, addr, gfp); }EXPORT_SYMBOL (cfg80211_rx_unexpected_4addr_frame); + +int cfg80211_start_radar_detection (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct ieee80211_channel *chan) +{ +int err; + +if (!rdev->ops->start_radar_detection) +return -EOPNOTSUPP ; + + err = rdev->ops->start_radar_detection (&rdev->wiphy, dev, chan); +if (!err) + chan->radar_detect_timeout = jiffies + +msecs_to_jiffies (IEEE80211_DFS_MIN_CAC_TIME_MS ); +else { + chan->radar_detect_timeout =0 ; + chan->cac_type =0 ; + } + +return err; +} + +void cfg80211_radar_detected (struct net_device *dev, +struct ieee80211_channel *chan,gfp_t gfp) +{ +struct wireless_dev *wdev = dev->ieee80211_ptr; +struct wiphy *wiphy = wdev->wiphy; +struct cfg80211_registered_device *rdev =wiphy_to_dev (wiphy); + + + chan->radar_detect_timeout =0 ; + chan->cac_type =0 ; + +nl80211_radar_detected_notify (rdev, chan, dev, gfp); +} +EXPORT_SYMBOL (cfg80211_radar_detected);
net/wireless/nl80211.c +80 -0
98 lines not on this page · raw message
net/wireless/nl80211.h +6 -0
@@ -105,6 +105,12 @@ nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev,struct net_device *netdev, enum nl80211_cqm_rssi_threshold_event rssi_event, gfp_t gfp); + +void +nl80211_radar_detected_notify (struct cfg80211_registered_device *rdev, +struct ieee80211_channel *chan, +struct net_device *netdev,gfp_t gfp); + void nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, struct net_device *netdev, const u8 *peer,
Signature · 1 line
1.7.5.4
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4603
Quoted 3 lines · Victor Goldenshtein
net/wireless/nl80211.c +3
-0+ cac_type =nla_get_u32 (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE ]); +if (cac_type !=NL80211_CHAN_HT20 ) +return -EOPNOTSUPP ;
Since only HT20 is supported, what for we have this variable?
Stanislaw
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Quoted 6 lines · Stanislaw Gruszka
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4603
Quoted 3 lines · Victor Goldenshtein
net/wireless/nl80211.c +3
-0+ cac_type =nla_get_u32 (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE ]); +if (cac_type !=NL80211_CHAN_HT20 ) +return -EOPNOTSUPP ;Since only HT20 is supported, what for we have this variable?
Security measures and preparation for future HT40.
Signature · 2 lines
Thanks, Victor.
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Quoted 9 lines · Victor
Quoted 6 lines · Stanislaw Gruszka
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4603
Quoted 3 lines · Victor Goldenshtein
net/wireless/nl80211.c +3
-0+ cac_type =nla_get_u32 (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE ]); +if (cac_type !=NL80211_CHAN_HT20 ) +return -EOPNOTSUPP ;Since only HT20 is supported, what for we have this variable?
Security measures and preparation for future HT40.
I dislike "preparation for future" thing. We have lot of stuff like that in kernel, which never get implemented, and only mess up the code.
How near future is that?
Also what about pure, non HT, channels?
Stanislaw
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Quoted 2 lines
Also what about pure, non HT, channels?
Can't think on any reason why we can't support the non HT channels, the whole point here is the bandwidth.
So, will add them too.
Signature · 2 lines
Thanks, Victor.
Johannes Berg
maintainerRe: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
In reply to Stanislaw GruszkaQuoted 9 lines · Stanislaw Gruszka
Quoted 8 lines · Victor
Quoted 6 lines · Stanislaw Gruszka
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4603
Quoted 3 lines · Victor Goldenshtein
net/wireless/nl80211.c +3
-0+ cac_type =nla_get_u32 (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE ]); +if (cac_type !=NL80211_CHAN_HT20 ) +return -EOPNOTSUPP ;Since only HT20 is supported, what for we have this variable?
Quoted 6 lines
Quoted 1 line
Security measures and preparation for future HT40.
I dislike "preparation for future" thing. We have lot of stuff like that in kernel, which never get implemented, and only mess up the code.
How near future is that?
Well, it doesn't really matter -- if you allow specifying the channel type then you have to validate it in some way, otherwise one could assume it works with 40 MHz, right?
johannes
Johannes Berg
maintainerRe: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
In reply to Victor GoldenshteinQuoted 1 line · Victor Goldenshtein
+ * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
How will you know what kind of radar detection is supported? That is, HT 20, HT 40, in the future VHT80/160/80+80?
include/net/cfg80211.h struct cfg80211_ops { · line 1849
Quoted 3 lines
include/net/cfg80211.h +3
-0+int (*start_radar_detection)(struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_channel *chan);
Channel type/bandwidth might be needed?
include/net/cfg80211.h void cfg80211_cqm_rssi_notify(struct net_device *dev, · line 3416
Quoted 2 lines
include/net/cfg80211.h +2
-0+void cfg80211_radar_detected (struct net_device *dev, +struct ieee80211_channel *chan,gfp_t gfp);
Is the channel parameter useful? Only one detection can be triggered at any given time.
Quoted 15 lines
void
cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len){net/wireless/mlme.c +8
-0struct wireless_dev *wdev = dev->ieee80211_ptr;@@ -1006,3 +1008,39 @@ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,return nl80211_unexpected_4addr_frame (dev, addr, gfp); }EXPORT_SYMBOL (cfg80211_rx_unexpected_4addr_frame); + +int cfg80211_start_radar_detection (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct ieee80211_channel *chan) +{ +int err; + +if (!rdev->ops->start_radar_detection)
net/wireless/mlme.c bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, · line 1028
Quoted 10 lines
net/wireless/mlme.c +10
-0+return -EOPNOTSUPP ; + + err = rdev->ops->start_radar_detection (&rdev->wiphy, dev, chan); +if (!err) + chan->radar_detect_timeout = jiffies + +msecs_to_jiffies (IEEE80211_DFS_MIN_CAC_TIME_MS ); +else { + chan->radar_detect_timeout =0 ; + chan->cac_type =0 ; + }
You're not setting cac_type in the good case, and also radar_detect_timeout can actually be 0 in the good case due to jiffies wrap. How is that handled?
Review bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, · line 1029
Quoted 1 line
(quoted diff) +1
-0+ chan->cac_type = 0;
Also here and above you should use channel type enums. In fact, 0 is "NOHT". Oops. Need a boolean I guess that indicates validity.
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4589
Quoted 1 line
net/wireless/nl80211.c +1
-0+bool dfs_supported = (rdev->wiphy.features &NL80211_FEATURE_DFS );
why bother with the variable?
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4614
Quoted 7 lines
net/wireless/nl80211.c +7
-0+if (!chan || !(chan->flags &IEEE80211_CHAN_RADAR )) +return -EINVAL ; + +if (chan->cac_type) +return -EBUSY ; + + chan->cac_type = cac_type;
Aha. But these things probably should be in the function:
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4616
Quoted 1 line
net/wireless/nl80211.c +1
-0+return cfg80211_start_radar_detection (rdev, dev, chan);
so it's actually a potentially useful function for other places. Otherwise you could just manually inline it here, I see no issues with that either.
johannes
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Thanks for the review and sorry for the delayed response.
Quoted 7 lines · Johannes Berg
Quoted 1 line · Victor Goldenshtein
+ * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
How will you know what kind of radar detection is supported? That is, HT 20, HT 40, in the future VHT80/160/80+80?
only 20 Mhz is supported at first stage, do you prefer to rename it to something like: NL80211_FEATURE_20MHZ_DFS
Quoted 6 lines
include/net/cfg80211.h struct cfg80211_ops { · line 1849
Quoted 3 lines
include/net/cfg80211.h +3
-0+int (*start_radar_detection)(struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_channel *chan);Channel type/bandwidth might be needed?
np, will add also the channel type here.
Quoted 5 lines
include/net/cfg80211.h void cfg80211_cqm_rssi_notify(struct net_device *dev, · line 3416
Quoted 2 lines
include/net/cfg80211.h +2
-0+void cfg80211_radar_detected (struct net_device *dev, +struct ieee80211_channel *chan,gfp_t gfp);Is the channel parameter useful? Only one detection can be triggered at any given time.
yes, for MC platforms and for sanity checks.
Quoted 22 lines
Quoted 22 lines
void
cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len){ struct wireless_dev *wdev = dev->ieee80211_ptr;net/wireless/mlme.c +14
-0@@ -1006,3 +1008,39 @@ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,return nl80211_unexpected_4addr_frame (dev, addr, gfp); }EXPORT_SYMBOL (cfg80211_rx_unexpected_4addr_frame); + +int cfg80211_start_radar_detection (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct ieee80211_channel *chan) +{ +int err; + +if (!rdev->ops->start_radar_detection) +return -EOPNOTSUPP ; + + err = rdev->ops->start_radar_detection (&rdev->wiphy, dev, chan); +if (!err) + chan->radar_detect_timeout = jiffies + +msecs_to_jiffies (IEEE80211_DFS_MIN_CAC_TIME_MS );
Quoted 9 lines
net/wireless/mlme.c bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, · line 1028
Quoted 4 lines
net/wireless/mlme.c +4
-0+else { + chan->radar_detect_timeout =0 ; + chan->cac_type =0 ; + }You're not setting
cac_typein the good case, and alsoradar_detect_timeoutcan actually be 0 in the good case due to jiffies wrap. How is that handled?
I'm using time_is_after_jiffies() in nl80211_dfs_en_tx() which AFAIK can handle jiffies wrap.
Quoted 5 lines
Review bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, · line 1029
Quoted 1 line
(quoted diff) +1
-0+ chan->cac_type = 0;Also here and above you should use channel type enums. In fact, 0 is "NOHT". Oops. Need a boolean I guess that indicates validity.
right, since NOHT is 0 we probably need additional flag something like "chan->cac_started"
alternatively we can add "__NL80211_CHAN_INVALID" at index 0 to the enum nl80211_channel_type.
Quoted 4 lines
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4589
Quoted 1 line
net/wireless/nl80211.c +1
-0+bool dfs_supported = (rdev->wiphy.features &NL80211_FEATURE_DFS );why bother with the variable?
IMHO in that way the if expression is shorter and more readable.
Quoted 10 lines
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4614
Quoted 7 lines
net/wireless/nl80211.c +7
-0+if (!chan || !(chan->flags &IEEE80211_CHAN_RADAR )) +return -EINVAL ; + +if (chan->cac_type) +return -EBUSY ; + + chan->cac_type = cac_type;Aha. But these things probably should be in the function:
Quoted 6 lines
net/wireless/nl80211.c static int nl80211_stop_sched_scan(struct sk_buff *skb, · line 4616
Quoted 1 line
net/wireless/nl80211.c +1
-0+return cfg80211_start_radar_detection (rdev, dev, chan);so it's actually a potentially useful function for other places. Otherwise you could just manually inline it here, I see no issues with that either.
will manually inline cfg80211_start_radar_detection() into nl80211_start_radar_detection().
Signature · 2 lines
Thanks, Victor.
Johannes Berg
maintainerRe: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Quoted 8 lines · Victor
Quoted 5 lines
Quoted 1 line
+ * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
How will you know what kind of radar detection is supported? That is, HT 20, HT 40, in the future VHT80/160/80+80?
only 20 Mhz is supported at first stage, do you prefer to rename it to something like:
NL80211_FEATURE_20MHZ_DFS
no idea, maybe that, or maybe have some other field that lists the channel widths that are supported?
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
net/wireless/mlme.c +13
-0+int cfg80211_start_radar_detection (struct cfg80211_registered_device *rdev, +struct net_device *dev, +struct ieee80211_channel *chan) +{ +int err; + +if (!rdev->ops->start_radar_detection) +return -EOPNOTSUPP ; + + err = rdev->ops->start_radar_detection (&rdev->wiphy, dev, chan); +if (!err) + chan->radar_detect_timeout = jiffies + +msecs_to_jiffies (IEEE80211_DFS_MIN_CAC_TIME_MS );Quoted 9 lines
net/wireless/mlme.c bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, · line 1028
Quoted 4 lines
net/wireless/mlme.c +4
-0+else { + chan->radar_detect_timeout =0 ; + chan->cac_type =0 ; + }You're not setting
cac_typein the good case, and alsoradar_detect_timeoutcan actually be 0 in the good case due to jiffies wrap. How is that handled?
Quoted 2 lines
I'm using
time_is_after_jiffies()innl80211_dfs_en_tx()which AFAIK can handle jiffies wrap.
yeah but if you need to set radar_detect_timeout=0 here, then it looks like you're also using the 0 value as a special value to indicate "nothing in progress"?
Quoted 2 lines
right, since NOHT is 0 we probably need additional flag something like "
chan->cac_started"
yes
Quoted 2 lines
alternatively we can add "
__NL80211_CHAN_INVALID" at index 0 to the enumnl80211_channel_type.
no
nl80211 is abi :)
johannes
Re: [PATCH v3 1/7] nl80211/cfg80211: add radar detection command/event
Quoted 4 lines · Johannes Berg
yeah but if you need to set radar_detect_timeout=0 here, then it looks like you're also using the 0 value as a special value to indicate "nothing in progress"?
We agreed to use "chan->cac_started" flag for that purpose, so there is no need to reset "radar_detect_timeout" I will remove it.
Signature · 2 lines
Thanks, Victor.
PATCH v3 2/7 mac80211: add radar detection command/event
In reply to Victor GoldenshteinAdd command to trigger radar detection in the driver/FW. Once radar detection is started it should continuously monitor for radars as long as the channel active. If radar is detected usermode notified with 'radar detected' event.
--- include/net/mac80211.h | 19 +++++++++++++++++++ net/mac80211/cfg.c | 16 ++++++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/iface.c | 7 +++++++ net/mac80211/mlme.c | 11 +++++++++++ net/mac80211/trace.h | 28 ++++++++++++++++++++++++++++ 6 files changed, 95 insertions(+), 0 deletions(-)
include/net/mac80211.h +19 -0
@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);
@@ -2404,6 +2408,10 @@ struct ieee80211_ops {void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan); };/**
@@ -3576,6 +3584,17 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, gfp_t gfp);/** +* ieee80211_radar_detected - inform a configured connection that +* radar was detected on the current channel +* +* @vif: &struct ieee80211_vif pointer from the add_interface callback. +* @chan: radar detected on this channel. +* @gfp: context flags. +*/ +void ieee80211_radar_detected (struct ieee80211_vif *vif, +struct ieee80211_channel *chan,gfp_t gfp); + +/** * ieee80211_chswitch_done - Complete channel switch process * @vif: &struct ieee80211_vif pointer from the add_interface callback. * @success: make the channel switch successful or not
net/mac80211/cfg.c +16 -0
@@ -2403,6 +2403,21 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,return ieee80211_cancel_roc (local, cookie, false); } +static int ieee80211_start_radar_detection (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_channel *chan) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; +int ret; + +if (!local->ops->start_radar_detection) +return -EOPNOTSUPP ; + + ret =drv_start_radar_detection (local, sdata, chan); +return ret; +} + static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct ieee80211_channel *chan, bool offchan, enum nl80211_channel_type channel_type,
@@ -3075,4 +3090,5 @@ struct cfg80211_ops mac80211_config_ops = { .get_et_stats = ieee80211_get_et_stats, .get_et_strings = ieee80211_get_et_strings, .get_channel = ieee80211_cfg_get_channel, + .start_radar_detection = ieee80211_start_radar_detection, };
net/mac80211/driver-ops.h +14 -0
@@ -321,6 +321,20 @@ static inline void drv_cancel_hw_scan(struct ieee80211_local *local,trace_drv_return_void (local); } +static inline int drv_start_radar_detection (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct ieee80211_channel *chan) +{ +int ret; + +might_sleep (); + +trace_drv_start_radar_detection (local, sdata); + ret = local->ops->start_radar_detection (&local->hw, &sdata->vif, chan); +trace_drv_return_int (local, ret); +return ret; +} + static inline int drv_sched_scan_start(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata,
net/mac80211/iface.c +7 -0
@@ -731,6 +731,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,/* free all potentially still buffered bcast frames */ local->total_ps_buffered -=skb_queue_len (&sdata->u.ap.ps_bc_buf);skb_queue_purge (&sdata->u.ap.ps_bc_buf); + +/* reset DFS channel availability check */ +if (local->oper_channel && sdata->wdev.preset_chan) { + local->oper_channel->cac_type =0 ; +/* in case AP hasn't started yet */ + sdata->wdev.preset_chan->cac_type =0 ; + } }else if (sdata->vif.type ==NL80211_IFTYPE_STATION ) {ieee80211_mgd_stop (sdata); }
net/mac80211/mlme.c +11 -0
@@ -3549,3 +3549,14 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,cfg80211_cqm_rssi_notify (sdata->dev, rssi_event, gfp); }EXPORT_SYMBOL (ieee80211_cqm_rssi_notify); + +void ieee80211_radar_detected (struct ieee80211_vif *vif, +struct ieee80211_channel *chan,gfp_t gfp) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); + +trace_api_radar_detected (sdata, chan->center_freq); + +cfg80211_radar_detected (sdata->dev, chan, gfp); +} +EXPORT_SYMBOL (ieee80211_radar_detected);
net/mac80211/trace.h +28 -0
@@ -486,6 +486,12 @@ DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan,TP_ARGS (local, sdata) ); +DEFINE_EVENT (local_sdata_evt, drv_start_radar_detection, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +); + DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata),
@@ -1410,6 +1416,28 @@ TRACE_EVENT(api_cqm_rssi_notify, ) ); +TRACE_EVENT (api_radar_detected, + TP_PROTO(struct ieee80211_sub_if_data *sdata, + u16 center_freq), + +TP_ARGS (sdata, center_freq), + +TP_STRUCT__entry ( + VIF_ENTRY +__field (u16, center_freq) + ), + +TP_fast_assign ( + VIF_ASSIGN; + __entry->center_freq = center_freq; + ), + +TP_printk ( +VIF_PR_FMT " radar on freq:%d" , +VIF_PR_ARG , __entry->center_freq + ) +) + TRACE_EVENT(api_scan_completed, TP_PROTO(struct ieee80211_local *local, bool aborted),
Signature · 1 line
1.7.5.4
Re: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 14 lines · Victor Goldenshtein
include/net/mac80211.h +4
-0@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);
include/net/mac80211.h struct ieee80211_ops { · line 2414
Quoted 7 lines
include/net/mac80211.h +4
-0@@ -2404,6 +2408,10 @@ struct ieee80211_ops {void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan);
Why we need new callback? I.e. why this can be done by ->config ?
Stanislaw
Re: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 16 lines · Stanislaw Gruszka
Quoted 15 lines · Victor Goldenshtein
include/net/mac80211.h +4
-0@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);@@ -2404,6 +2408,10 @@ struct ieee80211_ops {
Quoted 9 lines
include/net/mac80211.h struct ieee80211_ops { · line 2414
Quoted 6 lines
include/net/mac80211.h +4
-0void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan);Why we need new callback? I.e. why this can be done by ->config ?
See proposed RFC and previous threads.
Signature · 2 lines
Thanks, Victor.
Re: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 27 lines · Victor
Quoted 16 lines · Stanislaw Gruszka
Quoted 15 lines · Victor Goldenshtein
include/net/mac80211.h +4
-0@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);@@ -2404,6 +2408,10 @@ struct ieee80211_ops {Quoted 9 lines
include/net/mac80211.h struct ieee80211_ops { · line 2414
Quoted 6 lines
include/net/mac80211.h +4
-0void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan);Why we need new callback? I.e. why this can be done by ->config ?
Quoted 1 line
See proposed RFC and previous threads.
I can not find mail where this is explained, could you please provide link.
Stanislaw
Re: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 28 lines · Stanislaw Gruszka
Quoted 27 lines · Victor
Quoted 25 lines · Stanislaw Gruszka
Quoted 14 lines · Victor Goldenshtein
include/net/mac80211.h +4
-0@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);include/net/mac80211.h struct ieee80211_ops { · line 2414
Quoted 7 lines
include/net/mac80211.h +4
-0@@ -2404,6 +2408,10 @@ struct ieee80211_ops {void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan);Why we need new callback? I.e. why this can be done by ->config ?
Quoted 5 lines
Quoted 1 line
See proposed RFC and previous threads.
I can not find mail where this is explained, could you please provide link.
http://article.gmane.org/gmane.linux.kernel.wireless.general/83760/match=
Signature · 1 line
Victor.
Johannes Berg
maintainerRe: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 29 lines · Victor
Quoted 28 lines · Stanislaw Gruszka
Quoted 27 lines · Victor
Quoted 25 lines · Stanislaw Gruszka
Quoted 14 lines · Victor Goldenshtein
include/net/mac80211.h +4
-0@@ -2262,6 +2262,10 @@ enum ieee80211_rate_control_changed {* The callback will be called before each transmission and upon return * mac80211 will transmit the frame right away. * The callback is optional and can (should!) sleep. +* +* @start_radar_detection: Start radar detection on current operational +* channel, once started it will continuously monitor for radars as long +* as the channel active. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);include/net/mac80211.h struct ieee80211_ops { · line 2414
Quoted 7 lines
include/net/mac80211.h +4
-0@@ -2404,6 +2408,10 @@ struct ieee80211_ops {void (*mgd_prepare_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif); + +int (*start_radar_detection)(struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_channel *chan);Why we need new callback? I.e. why this can be done by ->config ?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
See proposed RFC and previous threads.
I can not find mail where this is explained, could you please provide link.
http://article.gmane.org/gmane.linux.kernel.wireless.general/83760/match=
Well, that doesn't really explain it, but I do think that it's easier for drivers to implement as a separate callback and we can then also tell whether it's supported or not.
johannes
Johannes Berg
maintainerRe: [PATCH v3 2/7] mac80211: add radar detection command/event
In reply to Victor Goldenshteinnet/mac80211/cfg.c static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, · line 2418
Quoted 11 lines · Victor Goldenshtein
Add command to trigger radar detection in the driver/FW. Once radar detection is started it should continuously monitor for radars as long as the channel active. If radar is detected usermode notified with 'radar detected' event.
net/mac80211/cfg.c +5
-0+if (!local->ops->start_radar_detection) +return -EOPNOTSUPP ; + + ret =drv_start_radar_detection (local, sdata, chan); +return ret;
Remove the ret variable please.
net/mac80211/iface.c static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, · line 740
Quoted 12 lines
+++
b/net/mac80211/iface.cnet/mac80211/iface.c +7
-0@@ -731,6 +731,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,/* free all potentially still buffered bcast frames */ local->total_ps_buffered -=skb_queue_len (&sdata->u.ap.ps_bc_buf);skb_queue_purge (&sdata->u.ap.ps_bc_buf); + +/* reset DFS channel availability check */ +if (local->oper_channel && sdata->wdev.preset_chan) { + local->oper_channel->cac_type =0 ; +/* in case AP hasn't started yet */ + sdata->wdev.preset_chan->cac_type =0 ; + }
Why is mac80211 modifying cfg80211 fields? cfg80211 also uses this, no? This seems strange to me.
net/mac80211/trace.h DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan, · line 493
Quoted 5 lines
net/mac80211/trace.h +5
-0+DEFINE_EVENT (local_sdata_evt, drv_start_radar_detection, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +);
Umm, parameters?
johannes
Re: [PATCH v3 2/7] mac80211: add radar detection command/event
Quoted 7 lines · Johannes Berg
Quoted 5 lines · Victor Goldenshtein
Add command to trigger radar detection in the driver/FW. Once radar detection is started it should continuously monitor for radars as long as the channel active. If radar is detected usermode notified with 'radar detected' event.
Quoted 8 lines
net/mac80211/cfg.c static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, · line 2418
Quoted 5 lines
net/mac80211/cfg.c +5
-0+if (!local->ops->start_radar_detection) +return -EOPNOTSUPP ; + + ret =drv_start_radar_detection (local, sdata, chan); +return ret;Remove the ret variable please.
ok.
Quoted 7 lines
Quoted 7 lines
+++
b/net/mac80211/iface.cnet/mac80211/iface.c +2
-0@@ -731,6 +731,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,/* free all potentially still buffered bcast frames */ local->total_ps_buffered -=skb_queue_len (&sdata->u.ap.ps_bc_buf);skb_queue_purge (&sdata->u.ap.ps_bc_buf); + +/* reset DFS channel availability check */
Quoted 9 lines
net/mac80211/iface.c static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, · line 740
Quoted 5 lines
net/mac80211/iface.c +5
-0+if (local->oper_channel && sdata->wdev.preset_chan) { + local->oper_channel->cac_type =0 ; +/* in case AP hasn't started yet */ + sdata->wdev.preset_chan->cac_type =0 ; + }Why is mac80211 modifying cfg80211 fields? cfg80211 also uses this, no? This seems strange to me.
I will remove the "...preset_chan->cac_type = 0;" line.
We can reset the "preset_chan->cac_type" (or the new cac_started flag) in __nl80211_set_channel().
Quoted 8 lines
net/mac80211/trace.h DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan, · line 493
Quoted 5 lines
net/mac80211/trace.h +5
-0+DEFINE_EVENT (local_sdata_evt, drv_start_radar_detection, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +);Umm, parameters?
will add here also the channel frequency.
Signature · 2 lines
Thanks, Victor.
PATCH v3 3/7 nl80211/cfg80211: add ability to enable TX on op-channel
In reply to Victor GoldenshteinThe dfs master device should monitor radar channels for potential radar interference for a minimum of CAC (channel availability check) time, during this period no tx can occur. If no radar interference is detected the dfs master may initiate the tx with new NL80211_CMD_DFS_ENABLE_TX command.
If this command is invoked prior performing a CAC or the time passed since the beginning of the CAC is less than min CAC time (60 sec), -EPERM is returned.
--- include/linux/nl80211.h | 11 +++++++++++ include/net/cfg80211.h | 5 +++++ net/wireless/nl80211.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 0 deletions(-)
include/linux/nl80211.h +11 -0
@@ -568,6 +568,15 @@* @NL80211_CMD_RADAR_DETECT: Start radar detection in the driver/HW. Once * radar detected usermode notified with this event. * +* @NL80211_CMD_DFS_ENABLE_TX: Initiate tx after verifying radar clearness on +* dfs channel. The dfs master device should monitor radar channels +* for potential radar interference for a minimum of CAC (channel +* availability check) time, during this period no tx can occur. If no +* radar interference is detected during this period the dfs master may +* initiate the tx. If this command is invoked prior performing a CAC or +* the time passed since the beginning of the CAC is less than +* NL80211_DFS_MIN_CAC_TIME_MS, -EPERM is returned. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -713,6 +722,8 @@ enum nl80211_commands {NL80211_CMD_RADAR_DETECT , + NL80211_CMD_DFS_ENABLE_TX, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
include/net/cfg80211.h +5 -0
@@ -1627,6 +1627,8 @@ struct cfg80211_gtk_rekey_data {* current monitoring channel. * * @start_radar_detection: Start radar detection in the driver. +* +* @dfs_en_tx: Enable tx after radar interference check. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -1847,6 +1849,9 @@ struct cfg80211_ops {int (*start_radar_detection)(struct wiphy *wiphy,struct net_device *dev,struct ieee80211_channel *chan); + +int (*dfs_en_tx)(struct wiphy *wiphy,struct net_device *dev, +struct ieee80211_channel *chan); };/*
net/wireless/nl80211.c +36 -0
@@ -4616,6 +4616,34 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,return cfg80211_start_radar_detection (rdev, dev, chan); } +static int nl80211_dfs_en_tx (struct sk_buff *skb,struct genl_info *info) +{ +struct cfg80211_registered_device *rdev = info->user_ptr[0 ]; +struct net_device *dev = info->user_ptr[1 ]; +bool dfs_supported = (rdev->wiphy.features &NL80211_FEATURE_DFS ); +struct ieee80211_channel *chan; +int freq; + +if (!rdev->ops->dfs_en_tx || !dfs_supported) +return -EOPNOTSUPP ; + +if (info->attrs[NL80211_ATTR_WIPHY_FREQ ]) + freq =nla_get_u32 (info->attrs[NL80211_ATTR_WIPHY_FREQ ]); +else +return -EINVAL ; + + chan =ieee80211_get_channel (&rdev->wiphy, freq); +if (!chan) +return -EINVAL ; + +if (((chan->cac_type !=NL80211_CHAN_HT20 ) || +time_is_after_jiffies (chan->radar_detect_timeout)) && + (chan->flags &IEEE80211_CHAN_RADAR )) +return -EPERM ; + +return rdev->ops->dfs_en_tx (&rdev->wiphy, dev, chan); +} + static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, u32 seq, int flags, struct cfg80211_registered_device *rdev,
@@ -7482,6 +7510,14 @@ static struct genl_ops nl80211_ops[] = { .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_NEED_RTNL, }, + { + .cmd = NL80211_CMD_DFS_ENABLE_TX, + .doit = nl80211_dfs_en_tx, + .policy = nl80211_policy, + .flags = GENL_ADMIN_PERM, + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | + NL80211_FLAG_NEED_RTNL, + }, };
Signature · 1 line
1.7.5.4
PATCH v3 4/7 mac80211: add ability to enable TX on op-channel
In reply to Victor GoldenshteinPrior starting tx on DFS channels, the DFS master device shall perform a Channel Availability Check to ensure that there is no radar interference on those channels. Once CAC done, the tx can be enabled with ieee80211_dfs_en_tx().
--- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 15 +++++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/trace.h | 6 ++++++ 4 files changed, 39 insertions(+), 0 deletions(-)
include/net/mac80211.h +4 -0
@@ -2266,6 +2266,8 @@ enum ieee80211_rate_control_changed {* @start_radar_detection: Start radar detection on current operational * channel, once started it will continuously monitor for radars as long * as the channel active. +* @dfs_en_tx: Once channel pass the DFS initial channel availability check, +* initiate the tx on the channel with this command. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);
@@ -2412,6 +2414,8 @@ struct ieee80211_ops {int (*start_radar_detection)(struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_channel *chan); +int (*dfs_en_tx)(struct ieee80211_hw *hw,struct ieee80211_vif *vif, +struct ieee80211_channel *chan); };/**
net/mac80211/cfg.c +15 -0
@@ -2418,6 +2418,20 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,return ret; } +static int ieee80211_dfs_en_tx (struct wiphy *wiphy,struct net_device *dev, +struct ieee80211_channel *chan) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; +int ret = -ENOENT ; + +if (!local->ops->dfs_en_tx) +return -EOPNOTSUPP ; + + ret =drv_dfs_en_tx (local, sdata, chan); +return ret; +} + static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct ieee80211_channel *chan, bool offchan, enum nl80211_channel_type channel_type,
@@ -3091,4 +3105,5 @@ struct cfg80211_ops mac80211_config_ops = { .get_et_strings = ieee80211_get_et_strings, .get_channel = ieee80211_cfg_get_channel, .start_radar_detection = ieee80211_start_radar_detection, + .dfs_en_tx = ieee80211_dfs_en_tx, };
net/mac80211/driver-ops.h +14 -0
@@ -335,6 +335,20 @@ static inline int drv_start_radar_detection(struct ieee80211_local *local,return ret; } +static inline int drv_dfs_en_tx (struct ieee80211_local *local, +struct ieee80211_sub_if_data *sdata, +struct ieee80211_channel *chan) +{ +int ret; + +might_sleep (); + +trace_drv_dfs_en_tx (local, sdata); + ret = local->ops->dfs_en_tx (&local->hw, &sdata->vif, chan); +trace_drv_return_int (local, ret); +return ret; +} + static inline int drv_sched_scan_start(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata,
net/mac80211/trace.h +6 -0
@@ -492,6 +492,12 @@ DEFINE_EVENT(local_sdata_evt, drv_start_radar_detection,TP_ARGS (local, sdata) ); +DEFINE_EVENT (local_sdata_evt, drv_dfs_en_tx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +); + DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start, TP_PROTO(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata),
Signature · 1 line
1.7.5.4
Johannes Berg
maintainerRe: [PATCH v3 4/7] mac80211: add ability to enable TX on op-channel
Quoted 19 lines · Victor Goldenshtein
Prior starting tx on DFS channels, the DFS master device shall perform a Channel Availability Check to ensure that there is no radar interference on those channels. Once CAC done, the tx can be enabled with
ieee80211_dfs_en_tx().Signed-off-by Victor Goldenshtein <[email protected]>--- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 15 +++++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/trace.h | 6 ++++++ 4 files changed, 39 insertions(+), 0 deletions(-)include/net/mac80211.h +0
-0
include/net/mac80211.h enum ieee80211_rate_control_changed { · line 2270
Quoted 5 lines
include/net/mac80211.h +2
-0@@ -2266,6 +2266,8 @@ enum ieee80211_rate_control_changed {* @start_radar_detection: Start radar detection on current operational * channel, once started it will continuously monitor for radars as long * as the channel active. +* @dfs_en_tx: Once channel pass the DFS initial channel availability check, +* initiate the tx on the channel with this command.
Please also document (for both!) the fact that they can sleep.
include/net/mac80211.h enum ieee80211_rate_control_changed {
Quoted 5 lines
include/net/mac80211.h +5
-0+DEFINE_EVENT (local_sdata_evt, drv_dfs_en_tx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +);
Again, parameters.
johannes
Re: [PATCH v3 4/7] mac80211: add ability to enable TX on op-channel
Quoted 15 lines · Johannes Berg
Quoted 14 lines · Victor Goldenshtein
Prior starting tx on DFS channels, the DFS master device shall perform a Channel Availability Check to ensure that there is no radar interference on those channels. Once CAC done, the tx can be enabled with
ieee80211_dfs_en_tx().Signed-off-by Victor Goldenshtein <[email protected]>--- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 15 +++++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/trace.h | 6 ++++++ 4 files changed, 39 insertions(+), 0 deletions(-)
Quoted 13 lines
include/net/mac80211.h enum ieee80211_rate_control_changed { · line 2270
Quoted 10 lines
include/net/mac80211.h +2
-0@@ -2266,6 +2266,8 @@ enum ieee80211_rate_control_changed {* @start_radar_detection: Start radar detection on current operational * channel, once started it will continuously monitor for radars as long * as the channel active. +* @dfs_en_tx: Once channel pass the DFS initial channel availability check, +* initiate the tx on the channel with this command. Please also document (for both!) the fact that they can sleep.
ok.
Quoted 9 lines
include/net/mac80211.h enum ieee80211_rate_control_changed {
Quoted 6 lines
include/net/mac80211.h +5
-0+DEFINE_EVENT (local_sdata_evt, drv_dfs_en_tx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata), +TP_ARGS (local, sdata) +);Again, parameters.
will add channel frequency.
Signature · 2 lines
Thanks, Victor.
PATCH v3 5/7 nl80211/cfg80211: add ap channel switch command
In reply to Victor GoldenshteinAdd NL80211_CMD_AP_CH_SWITCH command which triggers an AP channel switch process.
Usermode notified about channel switch complete event with NL80211_CMD_CH_SWITCH_NOTIFY.
Usermode (hostapd) is responsible to update the channel switch announcement IE in the beacon prior and after the channel switch operation.
--- include/linux/nl80211.h | 24 ++++++++++++++++++++ include/net/cfg80211.h | 34 +++++++++++++++++++++++++++++ net/wireless/nl80211.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 0 deletions(-)
include/linux/nl80211.h +24 -0
@@ -565,6 +565,14 @@* %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. * +* @NL80211_CMD_AP_CH_SWITCH: Perform a channel switch in the driver (for +* AP/GO). +* %NL80211_ATTR_WIPHY_FREQ: new channel frequency. +* %NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel. +* %NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel. +* %NL80211_FREQ_ATTR_CH_SWITCH_COUNT: number of TBTT's until the channel +* switch event. +* * @NL80211_CMD_RADAR_DETECT: Start radar detection in the driver/HW. Once * radar detected usermode notified with this event. *
@@ -720,6 +728,8 @@ enum nl80211_commands {NL80211_CMD_CH_SWITCH_NOTIFY , +NL80211_CMD_AP_CH_SWITCH , +NL80211_CMD_RADAR_DETECT , NL80211_CMD_DFS_ENABLE_TX,
@@ -1267,6 +1277,14 @@ enum nl80211_commands {* was used to provide the hint. For the different types of * allowed user regulatory hints see nl80211_user_reg_hint_type. * +* @NL80211_ATTR_CH_SWITCH_COUNT: the number of TBTT's until the channel +* switch event +* @NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel before the +* channel switch operation. +* @NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel after +* the channel switch operation, should be set if the target channel is +* DFS channel. +* * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */
@@ -1522,6 +1540,10 @@ enum nl80211_attrs {NL80211_ATTR_USER_REG_HINT_TYPE , +NL80211_ATTR_CH_SWITCH_COUNT , +NL80211_ATTR_CH_SWITCH_BLOCK_TX , +NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -3011,6 +3033,7 @@ enum nl80211_ap_sme_features {* to work properly to suppport receiving regulatory hints from * cellular base stations. * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver. +* @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch. */ enum nl80211_feature_flags {NL80211_FEATURE_SK_TX_STATUS =1 <<0 ,
@@ -3018,6 +3041,7 @@ enum nl80211_feature_flags {NL80211_FEATURE_INACTIVITY_TIMER =1 <<2 ,NL80211_FEATURE_CELL_BASE_REG_HINTS =1 <<3 ,NL80211_FEATURE_DFS =1 <<4 , + NL80211_FEATURE_AP_CH_SWITCH = 1 << 5, };/**
include/net/cfg80211.h +34 -0
@@ -153,6 +153,34 @@ struct ieee80211_channel { };/** +* struct ieee80211_ap_ch_switch - holds the ap channel switch data +* +* The information provided in this structure is required for the ap channel +* switch operation. +* +* @timestamp: value in microseconds of the 64-bit Time Synchronization +* Function (TSF) timer when the frame containing the channel switch +* announcement was received. This is simply the rx.mactime parameter +* the driver passed into mac80211. +* @block_tx: Indicates whether transmission must be blocked before the +* scheduled channel switch, as indicated by the AP. +* @post_switch_block_tx: Indicates whether transmission must be blocked after +* the scheduled channel switch, this should be set if the target channel +* is DFS channel. +* @channel: the new channel to switch to +* @channel_type: the type of the new channel +* @count: the number of TBTT's until the channel switch event +*/ +struct ieee80211_ap_ch_switch { +u64 timestamp; +bool block_tx; +bool post_switch_block_tx; +struct ieee80211_channel *channel; +enum nl80211_channel_type channel_type; +u8 count; +}; + +/** * enum ieee80211_rate_flags - rate flags * * Hardware/specification flags for rates. These are structured
@@ -1629,6 +1657,8 @@ struct cfg80211_gtk_rekey_data {* @start_radar_detection: Start radar detection in the driver. * * @dfs_en_tx: Enable tx after radar interference check. +* +* @ap_channel_switch: Perform AP channel switch. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -1852,6 +1882,10 @@ struct cfg80211_ops {int (*dfs_en_tx)(struct wiphy *wiphy,struct net_device *dev,struct ieee80211_channel *chan); + +int (*ap_channel_switch)(struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_sw); };/*
net/wireless/nl80211.c +55 -0
73 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Johannes Berg
maintainerRe: [PATCH v3 5/7] nl80211/cfg80211: add ap channel switch command
Quoted 8 lines
+ * @NL80211_CMD_AP_CH_SWITCH: Perform a channel switch in the driver (for
+ * AP/GO).
+ * %NL80211_ATTR_WIPHY_FREQ: new channel frequency.
+ * %NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel.
+ * %NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel.
+ * %NL80211_FREQ_ATTR_CH_SWITCH_COUNT: number of TBTT's until the channel
+ * switch event.
Needs more documentation.
include/linux/nl80211.h enum nl80211_commands { · line 735
Quoted 9 lines
include/linux/nl80211.h +2
-0@@ -720,6 +728,8 @@ enum nl80211_commands {NL80211_CMD_CH_SWITCH_NOTIFY , +NL80211_CMD_AP_CH_SWITCH , +NL80211_CMD_RADAR_DETECT , NL80211_CMD_DFS_ENABLE_TX,
Ahem.
include/linux/nl80211.h enum nl80211_commands { · line 1286
Quoted 11 lines
include/linux/nl80211.h +7
-0@@ -1267,6 +1277,14 @@ enum nl80211_commands {* was used to provide the hint. For the different types of * allowed user regulatory hints see nl80211_user_reg_hint_type. * +* @NL80211_ATTR_CH_SWITCH_COUNT: the number of TBTT's until the channel +* switch event +* @NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel before the +* channel switch operation. +* @NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel after +* the channel switch operation, should be set if the target channel is +* DFS channel.
Need to document the types.
include/linux/nl80211.h enum nl80211_ap_sme_features { · line 3036
Quoted 2 lines
include/linux/nl80211.h +1
-0* @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver. +* @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.
I have a nagging feeling I keep asking this, but what's the point of radar detection without channel switch? Or is it the other way around that's interesting? Maybe should verify that if you have DFS you also have chanswitch?
Quoted 9 lines
include/net/cfg80211.h +8
-0/** +* struct ieee80211_ap_ch_switch - holds the ap channel switch data +* +* The information provided in this structure is required for the ap channel +* switch operation. +* +* @timestamp: value in microseconds of the 64-bit Time Synchronization +* Function (TSF) timer when the frame containing the channel switch +* announcement was received. This is simply the rx.mactime parameter
include/net/cfg80211.h struct ieee80211_channel { · line 173
Quoted 10 lines
include/net/cfg80211.h +10
-0+* the driver passed into mac80211. +* @block_tx: Indicates whether transmission must be blocked before the +* scheduled channel switch, as indicated by the AP. +* @post_switch_block_tx: Indicates whether transmission must be blocked after +* the scheduled channel switch, this should be set if the target channel +* is DFS channel. +* @channel: the new channel to switch to +* @channel_type: the type of the new channel +* @count: the number of TBTT's until the channel switch event +*/
Bogus documentation.
johannes
Re: [PATCH v3 5/7] nl80211/cfg80211: add ap channel switch command
Quoted 10 lines · Johannes Berg
Quoted 8 lines
+ * @NL80211_CMD_AP_CH_SWITCH: Perform a channel switch in the driver (for
+ * AP/GO). + * %NL80211_ATTR_WIPHY_FREQ: new channel frequency. + * %NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel. + * %NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel. + * %NL80211_FREQ_ATTR_CH_SWITCH_COUNT: number of TBTT's until the channel + * switch event.Needs more documentation.
I'll elaborate a bit..
Quoted 5 lines
Quoted 5 lines
include/linux/nl80211.h +0
-0@@ -720,6 +728,8 @@ enum nl80211_commands { NL80211_CMD_CH_SWITCH_NOTIFY,
Quoted 8 lines
include/linux/nl80211.h enum nl80211_commands { · line 735
Quoted 5 lines
include/linux/nl80211.h +2
-0+NL80211_CMD_AP_CH_SWITCH , +NL80211_CMD_RADAR_DETECT , NL80211_CMD_DFS_ENABLE_TX,Ahem.
just thought to put the channel switch stuff together. don't might to move it down.
Quoted 5 lines
Quoted 5 lines
include/linux/nl80211.h +1
-0@@ -1267,6 +1277,14 @@ enum nl80211_commands {* was used to provide the hint. For the different types of * allowed user regulatory hints see nl80211_user_reg_hint_type. * +* @NL80211_ATTR_CH_SWITCH_COUNT: the number of TBTT's until the channel
Quoted 8 lines
include/linux/nl80211.h enum nl80211_commands { · line 1286
Quoted 6 lines
include/linux/nl80211.h +6
-0+* switch event +* @NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel before the +* channel switch operation. +* @NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel after +* the channel switch operation, should be set if the target channel is +* DFS channel. Need to document the types.
np.
Quoted 8 lines
include/linux/nl80211.h enum nl80211_ap_sme_features { · line 3036
Quoted 3 lines
include/linux/nl80211.h +1
-0* @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver. +* @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch. I have a nagging feeling I keep asking this, but what's the point of radar detection without channel switch? Or is it the other way around that's interesting? Maybe should verify that if you have DFS you also have chanswitch?
one might support a channel switch without DFS, but the one who sets the "NL80211_FEATURE_DFS" must support channel switch.
I don't might to check both these flags, but then I think it would be cleaner (more readable) to leave the "dfs_supported" flag. something like:
bool dfs_supported = ((local->hw.wiphy->features & NL80211_FEATURE_DFS) && (local->hw.wiphy->features & NL80211_FEATURE_AP_CH_SWITCH));
Quoted 21 lines
Quoted 10 lines
include/net/cfg80211.h +8
-0/** +* struct ieee80211_ap_ch_switch - holds the ap channel switch data +* +* The information provided in this structure is required for the ap channel +* switch operation. +* +* @timestamp: value in microseconds of the 64-bit Time Synchronization +* Function (TSF) timer when the frame containing the channel switch +* announcement was received. This is simply the rx.mactime parameter include/net/cfg80211.h struct ieee80211_channel { · line 173
Quoted 10 lines
include/net/cfg80211.h +10
-0+* the driver passed into mac80211. +* @block_tx: Indicates whether transmission must be blocked before the +* scheduled channel switch, as indicated by the AP. +* @post_switch_block_tx: Indicates whether transmission must be blocked after +* the scheduled channel switch, this should be set if the target channel +* is DFS channel. +* @channel: the new channel to switch to +* @channel_type: the type of the new channel +* @count: the number of TBTT's until the channel switch event +*/
Quoted 1 line
Bogus documentation.
can you please elaborate on this one.
note that it's almost identical to "ieee80211_channel_switch" struct, the two new parameters here are "post_switch_block_tx" and "channel_type".
Signature · 2 lines
Thanks, Victor.
Johannes Berg
maintainerRe: [PATCH v3 5/7] nl80211/cfg80211: add ap channel switch command
Quoted 8 lines · Victor
Quoted 8 lines
Quoted 8 lines
include/linux/nl80211.h +2
-0@@ -720,6 +728,8 @@ enum nl80211_commands {NL80211_CMD_CH_SWITCH_NOTIFY , +NL80211_CMD_AP_CH_SWITCH , + NL80211_CMD_RADAR_DETECT,
Quoted 7 lines
Quoted 4 lines
include/linux/nl80211.h enum nl80211_commands { · line 735
Quoted 1 line
include/linux/nl80211.h +0
-0NL80211_CMD_DFS_ENABLE_TX,Ahem.
just thought to put the channel switch stuff together. don't might to move it down.
Yeah but you can *never* insert anything in the middle.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
* @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
+ * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.I have a nagging feeling I keep asking this, but what's the point of radar detection without channel switch? Or is it the other way around that's interesting? Maybe should verify that if you have DFS you also have chanswitch?
Quoted 7 lines
one might support a channel switch without DFS, but the one who sets the "
NL80211_FEATURE_DFS" must support channel switch.
I don't might to check both these flags, but then I think it would be cleaner (more readable) to leave the "dfs_supported" flag. something like:
booldfs_supported= ((local->hw.wiphy->features&NL80211_FEATURE_DFS) && (local->hw.wiphy->features&NL80211_FEATURE_AP_CH_SWITCH));
fair enough. makes sense for p2p I guess
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
+ * @block_tx: Indicates whether transmission must be blocked before the
+ * scheduled channel switch, as indicated by the AP.Bogus documentation.
can you please elaborate on this one.
for example the only thing I quoted above now ... clearly can't be right
Quoted 1 line
note that it's almost identical to "
ieee80211_channel_switch" struct,
and that's the problem
johannes
Re: [PATCH v3 5/7] nl80211/cfg80211: add ap channel switch command
Quoted 5 lines · Johannes Berg
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
+ * @block_tx: Indicates whether transmission must be blocked before the
+ * scheduled channel switch, as indicated by the AP.Bogus documentation.
Quoted 7 lines
Quoted 1 line
can you please elaborate on this one.
for example the only thing I quoted above now ... clearly can't be right
Quoted 1 line
note that it's almost identical to "
ieee80211_channel_switch" struct,and that's the problem
now I see ;)
will fix the documentation in next v4 series.
Signature · 2 lines
Thanks, Victor.
PATCH v3 6/7 mac80211: add ap channel switch command/event
In reply to Victor GoldenshteinAdd ieee80211_ap_process_chanswitch(), to handle a channel switch request for AP.
Add ieee80211_ap_ch_switch_done() which updates oper_channel and notifies upper layers about channel switch complete event.
--- include/net/mac80211.h | 14 ++++++++++++ net/mac80211/cfg.c | 19 ++++++++++++++++ net/mac80211/driver-ops.h | 10 ++++++++ net/mac80211/main.c | 3 ++ net/mac80211/mlme.c | 21 +++++++++++++++++ net/mac80211/trace.h | 53 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 0 deletions(-)
include/net/mac80211.h +14 -0
@@ -2368,6 +2368,8 @@ struct ieee80211_ops {void (*flush)(struct ieee80211_hw *hw,bool drop);void (*channel_switch)(struct ieee80211_hw *hw,struct ieee80211_channel_switch *ch_switch); +void (*ap_channel_switch)(struct ieee80211_hw *hw, +struct ieee80211_ap_ch_switch *ap_ch_switch);int (*napi_poll)(struct ieee80211_hw *hw,int budget);int (*set_antenna)(struct ieee80211_hw *hw,u32 tx_ant,u32 rx_ant);int (*get_antenna)(struct ieee80211_hw *hw,u32 *tx_ant,u32 *rx_ant);
@@ -3599,6 +3601,18 @@ void ieee80211_radar_detected(struct ieee80211_vif *vif, struct ieee80211_channel *chan, gfp_t gfp);/** +* ieee80211_ap_ch_switch_done - inform and update a configured connection +* that channel switch is complete. +* +* @vif: &struct ieee80211_vif pointer from the add_interface callback. +* @new_channel: the new channel. +* @type: new channe ltype. +*/ +void ieee80211_ap_ch_switch_done (struct ieee80211_vif *vif, +struct ieee80211_channel *new_channel, +enum nl80211_channel_type type); + +/** * ieee80211_chswitch_done - Complete channel switch process * @vif: &struct ieee80211_vif pointer from the add_interface callback. * @success: make the channel switch successful or not
net/mac80211/cfg.c +19 -0
@@ -2432,6 +2432,24 @@ static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev,return ret; } +static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ; + +if (!ap_ch_switch || !ap_ch_switch->channel) +return -EINVAL ; + +drv_ap_channel_switch (local, ap_ch_switch); +return 0 ; +} + static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct ieee80211_channel *chan, bool offchan, enum nl80211_channel_type channel_type,
@@ -3106,4 +3124,5 @@ struct cfg80211_ops mac80211_config_ops = { .get_channel = ieee80211_cfg_get_channel, .start_radar_detection = ieee80211_start_radar_detection, .dfs_en_tx = ieee80211_dfs_en_tx, + .ap_channel_switch = ieee80211_ap_process_chanswitch, };
net/mac80211/driver-ops.h +10 -0
@@ -703,6 +703,16 @@ static inline void drv_channel_switch(struct ieee80211_local *local,trace_drv_return_void (local); } +static inline void +drv_ap_channel_switch (struct ieee80211_local *local, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +might_sleep (); + +trace_drv_ap_channel_switch (local, ap_ch_switch); + local->ops->ap_channel_switch (&local->hw, ap_ch_switch); +trace_drv_return_void (local); +}static inline int drv_set_antenna (struct ieee80211_local *local,u32 tx_ant,u32 rx_ant)
net/mac80211/main.c +3 -0
@@ -577,6 +577,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, wiphy->features =NL80211_FEATURE_SK_TX_STATUS |NL80211_FEATURE_HT_IBSS ; +if (ops->ap_channel_switch) + wiphy->features |=NL80211_FEATURE_AP_CH_SWITCH ; +if (!ops->set_key) wiphy->flags |=WIPHY_FLAG_IBSS_RSN ;
net/mac80211/mlme.c +21 -0
@@ -3560,3 +3560,24 @@ void ieee80211_radar_detected(struct ieee80211_vif *vif,cfg80211_radar_detected (sdata->dev, chan, gfp); }EXPORT_SYMBOL (ieee80211_radar_detected); + +void ieee80211_ap_ch_switch_done (struct ieee80211_vif *vif, +struct ieee80211_channel *new_channel, +enum nl80211_channel_type type) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); +struct ieee80211_local *local = sdata->local; + +if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_AP )) +return ; + +/* update the device channel directly */ +mutex_lock (&local->mtx); + local->oper_channel = local->hw.conf.channel = new_channel; + local->_oper_channel_type = type; +mutex_unlock (&local->mtx); + +cfg80211_ch_switch_notify (sdata->dev, new_channel->center_freq, type); +trace_api_ap_ch_switch_done (sdata, new_channel->center_freq); +} +EXPORT_SYMBOL (ieee80211_ap_ch_switch_done);
net/mac80211/trace.h +53 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [PATCH v3 6/7] mac80211: add ap channel switch command/event
include/net/mac80211.h struct ieee80211_ops { · line 2372
Quoted 4 lines · Victor Goldenshtein
include/net/mac80211.h +2
-0void (*channel_switch)(struct ieee80211_hw *hw,struct ieee80211_channel_switch *ch_switch); +void (*ap_channel_switch)(struct ieee80211_hw *hw, +struct ieee80211_ap_ch_switch *ap_ch_switch);
Why we can not use ->channel_switch calback for this purpose (merge ieee80211_channel_switch and ieee80211_ap_ch_switch)?
net/mac80211/cfg.c static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev, · line 2444
Quoted 10 lines
net/mac80211/cfg.c +10
-0+static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ;
Probably you want to check local->ops->ap_channel_switch.
Stanislaw
Re: [PATCH v3 6/7] mac80211: add ap channel switch command/event
Quoted 3 lines
Why we can not use ->channel_switch calback for this purpose (merge
ieee80211_channel_switchandieee80211_ap_ch_switch)?
Well at first (see previous threads) it was a single channel switch for both AP/STA, but later after community reviews it was decided to split these two.
Quoted 4 lines
Quoted 4 lines
net/mac80211/cfg.c +4
-0+static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch)
Quoted 9 lines
net/mac80211/cfg.c static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev, · line 2444
Quoted 6 lines
net/mac80211/cfg.c +6
-0+{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ;Probably you want to check
local->ops->ap_channel_switch.
This is the evidence ;).
Good catch and thanks for reviewing.
Signature · 1 line
Victor.
Re: [PATCH v3 6/7] mac80211: add ap channel switch command/event
Quoted 7 lines · Victor
Quoted 3 lines
Why we can not use ->channel_switch calback for this purpose (merge
ieee80211_channel_switchandieee80211_ap_ch_switch)?Well at first (see previous threads) it was a single channel switch for both AP/STA, but later after community reviews it was decided to split these two.
Ah, ok. Although I do not see the point of creating almost two identical structures and two identical callbacks, this is up to Johannes.
Stanislaw
Johannes Berg
maintainerRe: [PATCH v3 6/7] mac80211: add ap channel switch command/event
Quoted 11 lines · Stanislaw Gruszka
Quoted 7 lines · Victor
Quoted 3 lines
Why we can not use ->channel_switch calback for this purpose (merge
ieee80211_channel_switchandieee80211_ap_ch_switch)?Well at first (see previous threads) it was a single channel switch for both AP/STA, but later after community reviews it was decided to split these two.
Ah, ok. Although I do not see the point of creating almost two identical structures and two identical callbacks, this is up to Johannes.
Mostly the point is that the behaviour is really different in terms of who control it and how. E.g. the timing is not synchronised, etc. In fact I'm not even sure the timing here is done by the device? Although it really should be I guess.
johannes
Johannes Berg
maintainerRe: [PATCH v3 6/7] mac80211: add ap channel switch command/event
In reply to Victor GoldenshteinQuoted 7 lines
net/mac80211/cfg.c +6
-0+static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);
net/mac80211/cfg.c static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev, · line 2450
Quoted 10 lines
net/mac80211/cfg.c +10
-0+struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ; + +if (!ap_ch_switch || !ap_ch_switch->channel) +return -EINVAL ; + +drv_ap_channel_switch (local, ap_ch_switch); +return 0 ;
errors are not possible?
Quoted 8 lines
net/mac80211/mlme.c +8
-0+void ieee80211_ap_ch_switch_done (struct ieee80211_vif *vif, +struct ieee80211_channel *new_channel, +enum nl80211_channel_type type) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); +struct ieee80211_local *local = sdata->local; + +if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_AP ))
net/mac80211/mlme.c void ieee80211_radar_detected(struct ieee80211_vif *vif, · line 3581
Quoted 10 lines
net/mac80211/mlme.c +10
-0+return ; + +/* update the device channel directly */ +mutex_lock (&local->mtx); + local->oper_channel = local->hw.conf.channel = new_channel; + local->_oper_channel_type = type; +mutex_unlock (&local->mtx); + +cfg80211_ch_switch_notify (sdata->dev, new_channel->center_freq, type); +trace_api_ap_ch_switch_done (sdata, new_channel->center_freq);
tracing last seems very strange
johannes
Re: [PATCH v3 6/7] mac80211: add ap channel switch command/event
Quoted 11 lines · Johannes Berg
Quoted 11 lines
net/mac80211/cfg.c +10
-0+static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ;
Quoted 9 lines
net/mac80211/cfg.c static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev, · line 2450
Quoted 6 lines
net/mac80211/cfg.c +6
-0+ +if (!ap_ch_switch || !ap_ch_switch->channel) +return -EINVAL ; + +drv_ap_channel_switch (local, ap_ch_switch); +return 0 ;errors are not possible?
driver is not allowed to fail here.
Quoted 12 lines
Quoted 12 lines
net/mac80211/mlme.c +12
-0+void ieee80211_ap_ch_switch_done (struct ieee80211_vif *vif, +struct ieee80211_channel *new_channel, +enum nl80211_channel_type type) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); +struct ieee80211_local *local = sdata->local; + +if (WARN_ON (sdata->vif.type !=NL80211_IFTYPE_AP )) +return ; + +/* update the device channel directly */ +mutex_lock (&local->mtx);
Quoted 9 lines
net/mac80211/mlme.c void ieee80211_radar_detected(struct ieee80211_vif *vif, · line 3581
Quoted 6 lines
net/mac80211/mlme.c +6
-0+ local->oper_channel = local->hw.conf.channel = new_channel; + local->_oper_channel_type = type; +mutex_unlock (&local->mtx); + +cfg80211_ch_switch_notify (sdata->dev, new_channel->center_freq, type); +trace_api_ap_ch_switch_done (sdata, new_channel->center_freq);tracing last seems very strange
will reorder.
Signature · 2 lines
Thanks, Victor.
Re: [PATCH v3 6/7] mac80211: add ap channel switch command/event
Quoted 23 lines · Victor
Quoted 11 lines · Johannes Berg
Quoted 11 lines
net/mac80211/cfg.c +10
-0+static int +ieee80211_ap_process_chanswitch (struct wiphy *wiphy, +struct net_device *dev, +struct ieee80211_ap_ch_switch *ap_ch_switch) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +if (!local->ops->channel_switch) +return -EOPNOTSUPP ;Quoted 9 lines
net/mac80211/cfg.c static int ieee80211_dfs_en_tx(struct wiphy *wiphy, struct net_device *dev, · line 2450
Quoted 6 lines
net/mac80211/cfg.c +6
-0+ +if (!ap_ch_switch || !ap_ch_switch->channel) +return -EINVAL ; + +drv_ap_channel_switch (local, ap_ch_switch); +return 0 ;errors are not possible?
Quoted 2 lines
driver is not allowed to fail here.
on second thought ;) can't see why we can't propagate driver's return value to userspace, which will deal with the error code.
Signature · 2 lines
Thanks, Victor.
PATCH v3 7/7 mac80211: add DFS support to monitor interface
In reply to Victor GoldenshteinAP mode uses monitor interfaces to transmit
management frames which were blocked for "radar
channels" until now.
Stop dropping packets if we are on 'radar channel' and the DFS is enabled.
--- net/mac80211/tx.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
net/mac80211/tx.c +7 -6
@@ -1583,6 +1583,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,struct ieee80211_sub_if_data *tmp_sdata, *sdata;u16 len_rthdr;int hdrlen; +bool dfs_supported = (local->hw.wiphy->features &NL80211_FEATURE_DFS );/* * Frame injection is not allowed if beaconing is not allowed
@@ -1595,13 +1596,13 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,* flag. * * Since AP mode uses monitor interfaces to inject/TX management -* frames we can make AP mode the exception to this rule once it -* supports radar detection as its implementation can deal with -* radar detection by itself. We can do that later by adding a -* monitor flag interfaces used for AP support. +* frames we can make AP mode the exception to this rule, in the +* case the driver supports radar detection, allow usage of radar +* channels. */ -if ((chan->flags & (IEEE80211_CHAN_NO_IBSS |IEEE80211_CHAN_RADAR | -IEEE80211_CHAN_PASSIVE_SCAN ))) +if ((!(chan->flags &IEEE80211_CHAN_RADAR ) || !dfs_supported) && + ((chan->flags & (IEEE80211_CHAN_NO_IBSS |IEEE80211_CHAN_RADAR | +IEEE80211_CHAN_PASSIVE_SCAN )))) goto fail;/* check for not even having the fixed radiotap header part */
Signature · 1 line
1.7.5.4
Johannes Berg
maintainerRe: [PATCH v3 7/7] mac80211: add DFS support to monitor interface
Quoted 6 lines · Victor Goldenshtein
AP mode uses monitor interfaces to transmit
management frames which were blocked for "radar
channels" until now.Stop dropping packets if we are on 'radar channel' and the DFS is enabled.
Umm, no? Check for dfs_en_tx().
johannes
Re: [PATCH v3 7/7] mac80211: add DFS support to monitor interface
Quoted 10 lines · Johannes Berg
Quoted 6 lines · Victor Goldenshtein
AP mode uses monitor interfaces to transmit
management frames which were blocked for "radar
channels" until now.Stop dropping packets if we are on 'radar channel' and the DFS is enabled.
Umm, no? Check for
dfs_en_tx().
no need, the AP is started only after the dfs_en_tx().
Signature · 2 lines
Thanks, Victor.
Johannes Berg
maintainerRe: [PATCH v3 7/7] mac80211: add DFS support to monitor interface
Quoted 7 lines · Victor
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Victor Goldenshtein
AP mode uses monitor interfaces to transmit
management frames which were blocked for "radar
channels" until now.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Stop dropping packets if we are on 'radar channel' and the DFS is enabled.
Umm, no? Check for
dfs_en_tx().no need, the AP is started only after the
dfs_en_tx().
but this is on monitor mode, no? and monitor mode isn't used just for AP. In fact, AP no longer even uses monitor mode, so you don't need this at all since you should be working with a new hostapd version that will get the DFS feature ... and then you're working on a current version that already no longer uses monitor mode for DFS. Both kernel & hostapd have to be new enough, so monitor mode won't be used...
johannes
Re: [PATCH v3 7/7] mac80211: add DFS support to monitor interface
Quoted 14 lines · Johannes Berg
Quoted 13 lines · Victor
Quoted 10 lines · Johannes Berg
Quoted 6 lines · Victor Goldenshtein
AP mode uses monitor interfaces to transmit
management frames which were blocked for "radar
channels" until now.Stop dropping packets if we are on 'radar channel' and the DFS is enabled.
Umm, no? Check for
dfs_en_tx().
Quoted 9 lines
Quoted 1 line
no need, the AP is started only after the
dfs_en_tx().but this is on monitor mode, no? and monitor mode isn't used just for AP. In fact, AP no longer even uses monitor mode, so you don't need this at all since you should be working with a new hostapd version that will get the DFS feature ... and then you're working on a current version that already no longer uses monitor mode for DFS. Both kernel & hostapd have to be new enough, so monitor mode won't be used...
right, this patch here from the days AP used monitor mode. I"ll remove it.
Signature · 2 lines
Thanks, Victor.
Hello,
what is the status of this patchset? There have not been any major change requests, nor promises to send a revised patchset. On the other hand it hast not yet been merged into wireless testing.
Can anyone give us a status update? Maybe I'm missing something ... :)
Thanks,
Simon
Quoted 73 lines · Victor Goldenshtein
v3:
Rebased to "wireless-testing".
nl80211/cfg80211: add radar detection command/event
Added units documentation to "radar_detect_timeout".
Added "cac_type" - which indicates that CAC is started for this channel type. AddedNL80211_ATTR_WIPHY_CHANNEL_TYPE.
Fixed merge problem.
Removed "!!" innl80211_start_radar_detection.
Return-EBUSYinstart_radar_detectionif detection already started for this specific channel.mac80211: add radar detection command/event
Added tracer toieee80211_radar_detected().
Changed freq argument inieee80211_radar_detected()to "structieee80211_channel*chan" Reset CAC during interface down.nl80211/cfg80211: add ability to enable TX on op-channel
Removed "!!" innl80211_dfs_en_tx().
Typo fix in the documentation.
Added additional check to validate that we're onNL80211_CHAN_HT20channel, otherwise return-EPERM.nl80211/cfg80211: add ap channel switch command/event
Moved structieee80211_ap_ch_switchfrom mac to cfg + pass it as argument inap_channel_switch()Add "if (ch_type!=NL80211_CHAN_NO_HT) return-EOPNOTSUPP"
Changed freq argument inap_ch_switch_complete_notify()to "structieee80211_channel*chan"mac80211: add ap channel switch command/event
Renamed ieee80211_ap_ch_switch_complete_notify to ieee80211_ap_ch_switch_done. Removed the freq argument in ieee80211_ap_ch_switch_done(). Save the target channel in new "local->next_ap_channel" and update the operational channel in ieee80211_ap_ch_switch_done. Add tracer to ieee80211_ap_ch_switch_done(). Updated commit log message. Added sanity checks in ap_channel_switch() + ieee80211_ap_ch_switch_completemac80211: add DFS support to monitor interface
Removed "!!" in ieee80211_monitor_start_xmit().Victor Goldenshtein (7):
nl80211/cfg80211: add radar detection command/event
mac80211: add radar detection command/event nl80211/cfg80211: add ability to enable TX on op-channel
mac80211: add ability to enable TX on op-channel nl80211/cfg80211: add ap channel switch command
mac80211: add ap channel switch command/event
mac80211: add DFS support to monitor interfaceinclude/linux/nl80211.h | 42 +++++++++++ include/net/cfg80211.h | 63 +++++++++++++++++ include/net/mac80211.h | 37 ++++++++++ net/mac80211/cfg.c | 50 +++++++++++++ net/mac80211/driver-ops.h | 38 ++++++++++ net/mac80211/iface.c | 7 ++ net/mac80211/main.c | 3 + net/mac80211/mlme.c | 32 +++++++++ net/mac80211/trace.h | 87 +++++++++++++++++++++++ net/mac80211/tx.c | 13 ++-- net/wireless/core.h | 4 + net/wireless/mlme.c | 38 ++++++++++ net/wireless/nl80211.c | 171 +++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 6 ++ 14 files changed, 585 insertions(+), 6 deletions(-)Signature · 1 line
1.7.5.4
Johannes Berg
maintainerQuoted 7 lines · Simon Wunderlich
Hello,
what is the status of this patchset? There have not been any major change requests, nor promises to send a revised patchset. On the other hand it hast not yet been merged into wireless testing.
Can anyone give us a status update? Maybe I'm missing something ... :)
I promised a review but then forgot, it seems. Sorry about that.
johannes