DFS/radar state/userspace handling
Subsystems (2)
v2 cover DFS/radar state/userspace handling
Hi,
This is second version of state/userspace handling, the main diff to v1 is that state are no global and no per wiphy.
Implemented so far is the complete state machine, handling CAC and NOL as well as starting appropriate action in hostapd. Note, this is based on top of the 'dfs region support' work posted by Luis.
I don't include the hostapd patches this time, because there are no real changes compared to the last series.
If you want to test this code on hardware which has no radar detection support (well, currently there is none with support), skip patch 3/9 and use the ieee80211/radar/bang debugfs file. Writing a frequency there will simulate interference on the channel.
Signature · 8 lines
Best regards, Dipl.-Inf. (FH) Bernhard Schmidt (software development) saxnet GmbH, Willy-Brandt-Ring 1, 08606 Oelsnitz Tel. +49 (0) 3741 300 6. 100 - Fax +49 (0) 3741 300 6. 101 managing director: Steffen Dreise - county court Chemnitz - HRB 23017 http://www.saxnet.de
PATCH v2 2/9 Add 2 new radar channel flags
DFS introduces 2 new flags a channel requiring radar detection might take. The interference flag indicates that interference was detected either during CAC or in-service monitoring and the channel is not to be used for the NOP period. The clear flag indicates that during a full CAC no interference was detected and it is allowed to open a BSS on that channel. The case were both flags are set is used to indicate that interference has been detected and we are in progress of closing on that channel.
--- include/linux/nl80211.h | 6 ++++++ include/net/cfg80211.h | 18 ++++++++++++------ net/mac80211/cfg.c | 6 ++++++ net/mac80211/tx.c | 6 ++++-- net/wireless/nl80211.c | 4 ++++ 5 files changed, 32 insertions(+), 8 deletions(-)
include/linux/nl80211.h +6 -0
@@ -1371,6 +1371,10 @@ enum nl80211_band_attr {* (100 * dBm). * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined +* @NL80211_FREQUENCY_ATTR_RADAR_CLEAR: during a full CAC no interference has +* been detected. +* @NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE: either during a CAC or +* in-service monitoring radar interference was detected. * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use */ enum nl80211_frequency_attr {
@@ -1381,6 +1385,8 @@ enum nl80211_frequency_attr {NL80211_FREQUENCY_ATTR_NO_IBSS ,NL80211_FREQUENCY_ATTR_RADAR ,NL80211_FREQUENCY_ATTR_MAX_TX_POWER , +NL80211_FREQUENCY_ATTR_RADAR_CLEAR , +NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE ,/* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST,
include/net/cfg80211.h +12 -6
@@ -98,14 +98,20 @@ enum ieee80211_band {* is not permitted. * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel * is not permitted. +* @IEEE80211_CHAN_RADAR_CLEAR: during a full CAC no interference has +* been detected. +* @IEEE80211_CHAN_RADAR_INTERFERENCE: either during a CAC or in-service +* monitoring radar interference was detected. */ enum ieee80211_channel_flags { -IEEE80211_CHAN_DISABLED =1 <<0 , -IEEE80211_CHAN_PASSIVE_SCAN =1 <<1 , -IEEE80211_CHAN_NO_IBSS =1 <<2 , -IEEE80211_CHAN_RADAR =1 <<3 , -IEEE80211_CHAN_NO_HT40PLUS =1 <<4 , -IEEE80211_CHAN_NO_HT40MINUS =1 <<5 , +IEEE80211_CHAN_DISABLED =1 <<0 , +IEEE80211_CHAN_PASSIVE_SCAN =1 <<1 , +IEEE80211_CHAN_NO_IBSS =1 <<2 , +IEEE80211_CHAN_RADAR =1 <<3 , +IEEE80211_CHAN_NO_HT40PLUS =1 <<4 , +IEEE80211_CHAN_NO_HT40MINUS =1 <<5 , +IEEE80211_CHAN_RADAR_CLEAR =1 <<6 , +IEEE80211_CHAN_RADAR_INTERFERENCE =1 <<7 , };#define IEEE80211_CHAN_NO_HT40 \
net/mac80211/cfg.c +6 -0
@@ -436,11 +436,17 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, {struct beacon_data *new, *old;int new_head_len, new_tail_len; +u32 flags;int size;int err = -EINVAL ; old = sdata->u.ap.beacon; + flags = sdata->local->hw.conf.channel->flags; +if ((flags &IEEE80211_CHAN_RADAR ) && + !(flags &IEEE80211_CHAN_RADAR_CLEAR )) +return -EINVAL ; +/* head must not be zero-length */ if (params->head && !params->head_len)return -EINVAL ;
net/mac80211/tx.c +4 -2
@@ -1629,8 +1629,10 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,* radar detection by itself. We can do that later by adding a * monitor flag interfaces used for AP support. */ -if ((chan->flags & (IEEE80211_CHAN_NO_IBSS |IEEE80211_CHAN_RADAR | -IEEE80211_CHAN_PASSIVE_SCAN ))) +if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | +IEEE80211_CHAN_PASSIVE_SCAN )) || + ((chan->flags &IEEE80211_CHAN_RADAR ) && + !(chan->flags &IEEE80211_CHAN_RADAR_CLEAR ))) goto fail;/* check for not even having the fixed radiotap header part */
net/wireless/nl80211.c +4 -0
@@ -307,6 +307,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,NLA_PUT_FLAG (msg,NL80211_FREQUENCY_ATTR_NO_IBSS );if (chan->flags &IEEE80211_CHAN_RADAR )NLA_PUT_FLAG (msg,NL80211_FREQUENCY_ATTR_RADAR ); +if (chan->flags &IEEE80211_CHAN_RADAR_CLEAR ) +NLA_PUT_FLAG (msg,NL80211_FREQUENCY_ATTR_RADAR_CLEAR ); +if (chan->flags &IEEE80211_CHAN_RADAR_INTERFERENCE ) +NLA_PUT_FLAG (msg,NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE );NLA_PUT_U32 (msg,NL80211_FREQUENCY_ATTR_MAX_TX_POWER ,DBM_TO_MBM (chan->max_power));
Signature · 1 line
1.7.2.3
PATCH v2 3/9 enable radar detection
In reply to Bernhard SchmidtWhen switching to channels requiring radar detection, enable it if the current mode is one which requires beaconing. In all other cases the radar detection is disabled.
Note, drivers which do not support radar detection are not allowed to switch to those channels.
--- include/net/mac80211.h | 4 ++++ net/mac80211/cfg.c | 15 +++++++++++++++ net/mac80211/driver-ops.h | 14 ++++++++++++++ net/mac80211/driver-trace.h | 21 +++++++++++++++++++++ 4 files changed, 54 insertions(+), 0 deletions(-)
include/net/mac80211.h +4 -0
@@ -1804,6 +1804,8 @@ enum ieee80211_ampdu_mlme_action {* return value is 1, then the @remain_on_channel will be used with a * regular transmission (if supported.) * @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX +* +* @radar_detection: Enable or disable radar detection on current channel. */ struct ieee80211_ops {void (*tx)(struct ieee80211_hw *hw,struct sk_buff *skb);
@@ -1888,6 +1890,8 @@ struct ieee80211_ops {enum nl80211_channel_type channel_type, unsigned int wait);int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw); + +int (*radar_detection)(struct ieee80211_hw *hw,int enable); };/**
net/mac80211/cfg.c +15 -0
@@ -1245,6 +1245,21 @@ static int ieee80211_set_channel(struct wiphy *wiphy, old_vif_oper_type = sdata->vif.bss_conf.channel_type; old_oper_type = local->_oper_channel_type; +if (sdata && (sdata->vif.type ==NL80211_IFTYPE_ADHOC || + sdata->vif.type ==NL80211_IFTYPE_AP || + sdata->vif.type ==NL80211_IFTYPE_AP_VLAN || + sdata->vif.type ==NL80211_IFTYPE_MESH_POINT || + sdata->vif.type ==NL80211_IFTYPE_P2P_GO ) && + (chan->flags &IEEE80211_CHAN_RADAR )) { +/* +* Do not allow switching to channels requiring radar +* detection if hardware doesn't support detection. +*/ +if (drv_radar_detection (local, true)) +return -EINVAL ; + }else +drv_radar_detection (local, false); +if (!ieee80211_set_channel_type (local, sdata, channel_type))return -EBUSY ;
net/mac80211/driver-ops.h +14 -0
@@ -526,4 +526,18 @@ static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local) return ret; } +static inline int drv_radar_detection (struct ieee80211_local *local,int enable) +{ +int ret = -EOPNOTSUPP ; + +might_sleep (); + +trace_drv_radar_detection (local, enable); +if (local->ops->radar_detection) + ret = local->ops->radar_detection (&local->hw, enable); +trace_drv_return_int (local, ret); + +return ret; +} +#endif /* __MAC80211_DRIVER_OPS */
net/mac80211/driver-trace.h +21 -0
@@ -1150,6 +1150,27 @@ DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,TP_ARGS (local) ); +TRACE_EVENT (drv_radar_detection, + TP_PROTO(struct ieee80211_local *local, int enable), + +TP_ARGS (local, enable), + +TP_STRUCT__entry ( + LOCAL_ENTRY +__field (int, enable) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + __entry->enable = enable; + ), + +TP_printk ( +LOCAL_PR_FMT " enable:%d" , +LOCAL_PR_ARG , __entry->enable + ) +); +/* * Tracing for internal functions * (which may also be called in response to driver calls)
Signature · 1 line
1.7.2.3
PATCH v2 5/9 channel availability check (CAC) support
In reply to Bernhard SchmidtThis includes 3 new commands. On to fire of a CAC, one to stop it and a notification which is sent after the CAC period is over. During a CAC we block any channel changes to ensure that the full period is done while on the channel for which it has been started. After the CAC the channel is marked as clear.
Note, I decided to do CACs per wiphy, because it is not possible to ensure that the device doing the radar detection is able to detect all interferences in the range of other devices (sector antennas, ..).
--- include/linux/nl80211.h | 8 ++ net/wireless/chan.c | 10 +++ net/wireless/core.c | 2 + net/wireless/nl80211.c | 75 +++++++++++++++++++++ net/wireless/nl80211.h | 2 + net/wireless/radar.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/radar.h | 10 +++ 7 files changed, 271 insertions(+), 0 deletions(-)
include/linux/nl80211.h +8 -0
@@ -410,6 +410,10 @@* notification. This event is used to indicate that an unprotected * disassociation frame was dropped when MFP is in use. * +* @NL80211_CMD_RADAR_CAC_START: Request a CAC. +* @NL80211_CMD_RADAR_CAC_STOP: Stop a CAC early. +* @NL80211_CMD_RADAR_CAC_DONE: Notification sent if a CAC has completed. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -522,6 +526,10 @@ enum nl80211_commands {NL80211_CMD_UNPROT_DEAUTHENTICATE ,NL80211_CMD_UNPROT_DISASSOCIATE , +NL80211_CMD_RADAR_CAC_START , +NL80211_CMD_RADAR_CAC_STOP , +NL80211_CMD_RADAR_CAC_DONE , +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
net/wireless/chan.c +10 -0
@@ -8,6 +8,7 @@#include <net/cfg80211.h> #include "core.h" +#include "radar.h" struct ieee80211_channel * rdev_freq_to_chan(struct cfg80211_registered_device *rdev,
@@ -122,6 +123,15 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, } } +if (wdev && (wdev->iftype ==NL80211_IFTYPE_ADHOC || + wdev->iftype ==NL80211_IFTYPE_AP || + wdev->iftype ==NL80211_IFTYPE_AP_VLAN || + wdev->iftype ==NL80211_IFTYPE_MESH_POINT || + wdev->iftype ==NL80211_IFTYPE_P2P_GO ) && +radar_cac_in_progress (rdev) && + rdev->ops->get_channel (&rdev->wiphy) != chan) +return -EINVAL ; + result = rdev->ops->set_channel (&rdev->wiphy, wdev ? wdev->netdev :NULL , chan, channel_type);
net/wireless/core.c +2 -0
@@ -554,6 +554,8 @@ void wiphy_unregister(struct wiphy *wiphy) {struct cfg80211_registered_device *rdev =wiphy_to_dev (wiphy); +radar_cac_stop (rdev); +rfkill_unregister (rdev->rfkill);/* protect the device list */
net/wireless/nl80211.c +75 -0
99 lines not on this page · raw message
net/wireless/nl80211.h +2 -0
@@ -98,4 +98,6 @@ nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, struct net_device *netdev, const u8 *peer, u32 num_packets, gfp_t gfp); +void nl80211_radar_cac_done (struct cfg80211_registered_device *rdev); +#endif /* __NET_WIRELESS_NL80211_H */
net/wireless/radar.c +164 -0
206 lines not on this page · raw message
net/wireless/radar.h +10 -0
@@ -27,12 +27,22 @@ struct radar_parameters {int close_time; }; +struct radar_cac_list { +struct cfg80211_registered_device *rdev; +unsigned long timeout; +struct list_head list; +}; +struct radar {struct radar_parameters *params;struct mutex lock;struct timer_list timer; +struct list_head cac_list; }; +bool radar_cac_in_progress (struct cfg80211_registered_device *rdev); +int radar_cac_start (struct cfg80211_registered_device *rdev); +int radar_cac_stop (struct cfg80211_registered_device *rdev);void radar_update_params (u8 dfs_region);void radar_init (void );void radar_deinit (void );
Signature · 1 line
1.7.2.3
PATCH v2 4/9 add preliminary radar processing code
In reply to Bernhard Schmidt--- net/wireless/Makefile | 2 +- net/wireless/core.c | 6 +++ net/wireless/radar.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/radar.h | 48 +++++++++++++++++++++++++++ net/wireless/reg.c | 2 + 5 files changed, 143 insertions(+), 1 deletions(-) create mode 100644 net/wireless/radar.c create mode 100644 net/wireless/radar.h
net/wireless/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-$(CONFIG_WEXT_SPY) += wext-spy.o obj-$(CONFIG_WEXT_PRIV) += wext-priv.o cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o -cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o +cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o radar.o cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
net/wireless/core.c +6 -0
@@ -26,6 +26,7 @@#include "debugfs.h" #include "wext-compat.h" #include "ethtool.h" +#include "radar.h" /* name for sysfs, %d is appended */ #define PHY_NAME "phy"
@@ -912,6 +913,9 @@ static int __init cfg80211_init(void)if (err) goto out_fail_reg; +radar_init (); +radar_debugfs_add (ieee80211_debugfs_dir); + cfg80211_wq =create_singlethread_workqueue ("cfg80211" );if (!cfg80211_wq) goto out_fail_wq;
@@ -935,7 +939,9 @@ subsys_initcall(cfg80211_init); static void __exit cfg80211_exit(void) { +radar_debugfs_remove ();debugfs_remove (ieee80211_debugfs_dir); +radar_deinit ();nl80211_exit ();unregister_netdevice_notifier (&cfg80211_netdev_notifier);wiphy_sysfs_exit ();
net/wireless/radar.c new file +86 -0
86 lines not on this page · raw message
net/wireless/radar.h new file +48 -0
48 lines not on this page · raw message
net/wireless/reg.c +2 -0
@@ -47,6 +47,7 @@#include "reg.h" #include "regdb.h" #include "nl80211.h" +#include "radar.h" #ifdef CONFIG_CFG80211_REG_DEBUG #define REG_DBG_PRINT(format, args...) \
@@ -1140,6 +1141,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy, out:reg_process_beacons (wiphy);reg_process_ht_flags (wiphy); +radar_update_params (last_request->dfs_region);if (wiphy->reg_notifier) wiphy->reg_notifier (wiphy, last_request); }
Signature · 1 line
1.7.2.3
PATCH v2 6/9 no operation list (NOL) support
In reply to Bernhard SchmidtEvery channel on which interference is detected has to be added to a list which indicates that those channels are not to be used. A channel has to stay for at least the no operation period (NOP) on that list before it will again become available channel.
--- net/wireless/radar.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++++- net/wireless/radar.h | 8 +++ 2 files changed, 147 insertions(+), 1 deletions(-)
net/wireless/radar.c +139 -1
@@ -10,6 +10,7 @@#include <linux/ieee80211.h> #include <net/cfg80211.h> +#include "core.h" #include "radar.h" #include "nl80211.h"
@@ -128,6 +129,93 @@ static void radar_cac(struct work_struct *work) } static DECLARE_WORK(cac_work, radar_cac); +static void update_all_interference_flags (u16 freq,bool set) +{ +struct cfg80211_registered_device *rdev; +struct ieee80211_channel *chan; + +list_for_each_entry (rdev, &cfg80211_rdev_list, list) { + chan =ieee80211_get_channel (&rdev->wiphy, freq); +if (chan ==NULL ) +continue ; + chan->flags &= ~IEEE80211_CHAN_RADAR_INTERFERENCE ; +if (set) + chan->flags |=IEEE80211_CHAN_RADAR_INTERFERENCE ; + } +} + +static int nol_add_chan (u16 freq) +{ +struct radar_nol_list *nol; + +printk (KERN_INFO "DFS: add freq %u MHz to the NOL list\n" , freq); + +list_for_each_entry (nol, &radar.nol_list, list) { +if (nol->freq == freq) { +mutex_lock (&radar.lock); + nol->timeout = jiffies +msecs_to_jiffies ( + radar.params->nol_period *1000 ); +mutex_unlock (&radar.lock); +return 0 ; + } + } + + nol =kmalloc (sizeof (struct radar_nol_list ),GFP_KERNEL ); +if (nol ==NULL ) +return -ENOMEM ; + +mutex_lock (&radar.lock); + nol->freq = freq; + nol->timeout = jiffies + +msecs_to_jiffies (radar.params->nol_period *1000 ); +list_add_tail (&nol->list, &radar.nol_list); +update_all_interference_flags (freq, true); +mutex_unlock (&radar.lock); +return 0 ; +} + +static void radar_nol (struct work_struct *work) +{ +struct radar_nol_list *nol, *tmp; + +mutex_lock (&radar.lock); +list_for_each_entry_safe (nol, tmp, &radar.nol_list, list) { +if (!time_is_before_jiffies (nol->timeout)) +continue ; + +printk (KERN_INFO "DFS: remove freq %u from the NOL list\n" , + nol->freq); + +update_all_interference_flags (nol->freq, false); +list_del (&nol->list); +mutex_unlock (&radar.lock); + +kfree (nol); +return ; + } +mutex_unlock (&radar.lock); +} +static DECLARE_WORK(nol_work, radar_nol); + +void radar_set_interference_flag (struct cfg80211_registered_device *rdev) +{ +struct radar_nol_list *nol; + +if (list_empty (&radar.nol_list)) +return ; + +mutex_lock (&radar.lock); +list_for_each_entry (nol, &radar.nol_list, list) { +struct ieee80211_channel *chan; + + chan =ieee80211_get_channel (&rdev->wiphy, nol->freq); +if (chan ==NULL ) +continue ; + chan->flags |=IEEE80211_CHAN_RADAR_INTERFERENCE ; + } +mutex_unlock (&radar.lock); +} +void radar_update_params (u8 dfs_region) {mutex_lock (&radar.lock);
@@ -149,8 +237,11 @@ static void radar_timer(unsigned long data) {if (!list_empty (&radar.cac_list))schedule_work (&cac_work); +if (!list_empty (&radar.nol_list)) +schedule_work (&nol_work); -if (!list_empty (&radar.cac_list)) +if (!list_empty (&radar.cac_list) || + !list_empty (&radar.nol_list))mod_timer (&radar.timer, jiffies +msecs_to_jiffies (100 )); }
@@ -164,12 +255,14 @@ void radar_init(void)mutex_init (&radar.lock);INIT_LIST_HEAD (&radar.cac_list); +INIT_LIST_HEAD (&radar.nol_list);setup_timer (&radar.timer, radar_timer, (unsigned long )0 ); }void radar_deinit (void ) {struct radar_cac_list *cac, *cactmp; +struct radar_nol_list *nol, *noltmp;del_timer_sync (&radar.timer);mutex_lock (&radar.lock);
@@ -177,6 +270,10 @@ void radar_deinit(void)list_del (&cac->list);kfree (cac); } +list_for_each_entry_safe (nol, noltmp, &radar.nol_list, list) { +list_del (&nol->list); +kfree (nol); + }mutex_unlock (&radar.lock);mutex_destroy (&radar.lock); }
@@ -230,6 +327,46 @@ static const struct file_operations cac_ops = { .llseek = default_llseek, }; +static ssize_t radar_debugfs_nol_read (struct file *file, +char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct radar_nol_list *nol; +char *buf; +unsigned int offset =0 , buf_size =PAGE_SIZE , r; + + buf =kzalloc (buf_size,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +if (!list_empty (&radar.nol_list)) { +mutex_lock (&radar.lock); +list_for_each_entry (nol, &radar.nol_list, list) { +int remaining; + + remaining =jiffies_to_msecs (nol->timeout - jiffies); + remaining /=1000 ; + offset +=snprintf (buf + offset, + buf_size - offset, +"%u MHz: %u secs remaining\n" , + nol->freq, remaining); + } +mutex_unlock (&radar.lock); + } + + r =simple_read_from_buffer (user_buf, count, ppos, buf, offset); + +kfree (buf); + +return r; +} + +static const struct file_operations nol_ops = { + .read = radar_debugfs_nol_read, + .open = radar_open_file_generic, + .llseek = default_llseek, +}; +static struct dentry *radar_debugfs_dir;#define DEBUGFS_ADD (name) \
@@ -240,6 +377,7 @@ void radar_debugfs_add(struct dentry *ieee80211_debugfs_dir) { radar_debugfs_dir =debugfs_create_dir ("radar" , ieee80211_debugfs_dir);DEBUGFS_ADD (cac); +DEBUGFS_ADD (nol); }void radar_debugfs_remove ()
net/wireless/radar.h +8 -0
@@ -33,16 +33,24 @@ struct radar_cac_list {struct list_head list; }; +struct radar_nol_list { +u16 freq; +unsigned long timeout; +struct list_head list; +}; +struct radar {struct radar_parameters *params;struct mutex lock;struct timer_list timer;struct list_head cac_list; +struct list_head nol_list; };bool radar_cac_in_progress (struct cfg80211_registered_device *rdev);int radar_cac_start (struct cfg80211_registered_device *rdev);int radar_cac_stop (struct cfg80211_registered_device *rdev); +void radar_set_interference_flag (struct cfg80211_registered_device *rdev);void radar_update_params (u8 dfs_region);void radar_init (void );void radar_deinit (void );
Signature · 1 line
1.7.2.3
PATCH v2 1/9 add method to access oper chan
In reply to Bernhard SchmidtI'm really not sure about this.. is there another/better way to access the current channel last set on a wiphy?
--- include/net/cfg80211.h | 2 ++ net/mac80211/cfg.c | 8 ++++++++ net/wireless/chan.c | 2 +- 3 files changed, 11 insertions(+), 1 deletions(-)
include/net/cfg80211.h +2 -0
@@ -1121,6 +1121,7 @@ struct cfg80211_pmksa {* doesn't verify much. Note, however, that the passed netdev may be * %NULL as well if the user requested changing the channel for the * device itself, or for a monitor interface. +* @get_channel: Get current channel for a given wireless interface. * * @scan: Request to do a scan. If returning zero, the scan request is given * the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1276,6 +1277,7 @@ struct cfg80211_ops {int (*set_channel)(struct wiphy *wiphy,struct net_device *dev,struct ieee80211_channel *chan,enum nl80211_channel_type channel_type); +struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);int (*scan)(struct wiphy *wiphy,struct net_device *dev,struct cfg80211_scan_request *request);
net/mac80211/cfg.c +8 -0
@@ -1257,6 +1257,13 @@ static int ieee80211_set_channel(struct wiphy *wiphy,return 0 ; } +static struct ieee80211_channel *ieee80211_get_oper_channel (struct wiphy *wiphy) +{ +struct ieee80211_local *local =wiphy_priv (wiphy); + +return local->oper_channel; +} +#ifdef CONFIG_PM static int ieee80211_suspend (struct wiphy *wiphy) {
@@ -2027,6 +2034,7 @@ struct cfg80211_ops mac80211_config_ops = { .change_bss = ieee80211_change_bss, .set_txq_params = ieee80211_set_txq_params, .set_channel = ieee80211_set_channel, + .get_channel = ieee80211_get_oper_channel, .suspend = ieee80211_suspend, .resume = ieee80211_resume, .scan = ieee80211_scan,
net/wireless/chan.c +1 -1
@@ -93,7 +93,7 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,return -ENETDOWN ; } -if (!rdev->ops->set_channel) +if (!rdev->ops->set_channel || !rdev->ops->get_channel)return -EOPNOTSUPP ; chan =rdev_freq_to_chan (rdev, freq, channel_type);
Signature · 1 line
1.7.2.3
PATCH v2 8/9 announce flag changes to userspace
In reply to Bernhard Schmidt--- include/linux/nl80211.h | 3 ++ net/wireless/nl80211.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 2 + net/wireless/radar.c | 4 +++ 4 files changed, 60 insertions(+), 0 deletions(-)
include/linux/nl80211.h +3 -0
@@ -413,6 +413,8 @@* @NL80211_CMD_RADAR_CAC_START: Request a CAC. * @NL80211_CMD_RADAR_CAC_STOP: Stop a CAC early. * @NL80211_CMD_RADAR_CAC_DONE: Notification sent if a CAC has completed. +* @NL80211_CMD_RADAR_FLAGS_CHANGED: Notification sent if channel flags +* have changed. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use
@@ -529,6 +531,7 @@ enum nl80211_commands {NL80211_CMD_RADAR_CAC_START ,NL80211_CMD_RADAR_CAC_STOP ,NL80211_CMD_RADAR_CAC_DONE , + NL80211_CMD_RADAR_FLAGS_CHANGED,/* add new commands above here */
net/wireless/nl80211.c +51 -0
57 lines not on this page · raw message
net/wireless/nl80211.h +2 -0
@@ -99,5 +99,7 @@ nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, u32 num_packets, gfp_t gfp);void nl80211_radar_cac_done (struct cfg80211_registered_device *rdev); +void nl80211_radar_flags_changed (struct cfg80211_registered_device *rdev, +struct ieee80211_channel *chan);#endif /* __NET_WIRELESS_NL80211_H */
net/wireless/radar.c +4 -0
@@ -62,6 +62,7 @@ int radar_cac_start(struct cfg80211_registered_device *rdev) } chan->flags &= ~IEEE80211_CHAN_RADAR_CLEAR ;mutex_unlock (&radar.lock); +nl80211_radar_flags_changed (rdev, chan);printk (KERN_INFO "DFS: starting CAC (%p)\n" , rdev);
@@ -121,6 +122,7 @@ static void radar_cac(struct work_struct *work)mutex_unlock (&radar.lock);kfree (cac); +nl80211_radar_flags_changed (rdev, chan);nl80211_radar_cac_done (rdev);return ; }
@@ -168,6 +170,7 @@ static void close_channel(u16 freq)if (chan ==NULL )continue ; chan->flags &= ~IEEE80211_CHAN_RADAR_CLEAR ; +nl80211_radar_flags_changed (rdev, chan); c = rdev->ops->get_channel (&rdev->wiphy);if (c->center_freq != chan->center_freq)
@@ -224,6 +227,7 @@ static void update_all_interference_flags(u16 freq, bool set) chan->flags &= ~IEEE80211_CHAN_RADAR_INTERFERENCE ;if (set) chan->flags |=IEEE80211_CHAN_RADAR_INTERFERENCE ; +nl80211_radar_flags_changed (rdev, chan); } }
Signature · 1 line
1.7.2.3
PATCH v2 9/9 interference reporting
In reply to Bernhard SchmidtEnable drivers to report interference. Same functionality is available through debugfs for testing purposes.
--- include/net/cfg80211.h | 6 +++++ net/wireless/core.c | 2 + net/wireless/radar.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 0 deletions(-)
include/net/cfg80211.h +6 -0
@@ -2723,6 +2723,12 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,void cfg80211_cqm_pktloss_notify (struct net_device *dev,const u8 *peer,u32 num_packets,gfp_t gfp); +/** +* cfg80211_radar_interference - report radar interference. +* @freq: the affected channel frequency +*/ +int cfg80211_radar_interference (u16 freq); +/* Logging, debugging and troubleshooting/diagnostic helpers. */ /* wiphy_printk helpers, similar to dev_printk */
net/wireless/core.c +2 -0
@@ -491,6 +491,8 @@ int wiphy_register(struct wiphy *wiphy)/* set up regulatory info */ wiphy_update_regulatory (wiphy,NL80211_REGDOM_SET_BY_CORE ); +radar_set_interference_flag (rdev); +list_add_rcu (&rdev->list, &cfg80211_rdev_list); cfg80211_rdev_list_generation++;
net/wireless/radar.c +51 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH v2 7/9 abide channel closing time
In reply to Bernhard SchmidtDFS requires that if interference has been detected, transmission on a channel is stopped latest after the channel closing time. During this period it must still be possible to at least send beacons, e.g. for CSAs.
--- net/wireless/radar.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/radar.h | 7 ++++ 2 files changed, 99 insertions(+), 0 deletions(-)
net/wireless/radar.c +92 -0
@@ -129,6 +129,89 @@ static void radar_cac(struct work_struct *work) } static DECLARE_WORK(cac_work, radar_cac); +static int cc_add_chan (u16 freq) +{ +struct radar_cc_list *cc; + +printk (KERN_INFO "DFS: enable CC for freq %u MHz\n" , freq); + +mutex_lock (&radar.lock); +list_for_each_entry (cc, &radar.cc_list, list) { +if (cc->freq == freq) { +mutex_unlock (&radar.lock); +return 0 ; + } + } +mutex_unlock (&radar.lock); + + cc =kmalloc (sizeof (struct radar_cc_list ),GFP_KERNEL ); +if (cc ==NULL ) +return -ENOMEM ; + +mutex_lock (&radar.lock); + cc->freq = freq; + cc->timeout = jiffies +msecs_to_jiffies (radar.params->close_time); +list_add_tail (&cc->list, &radar.cc_list); +mutex_unlock (&radar.lock); +return 0 ; +} + +static void close_channel (u16 freq) +{ +struct cfg80211_registered_device *rdev; + +list_for_each_entry (rdev, &cfg80211_rdev_list, list) { +struct wireless_dev *wdev; +struct ieee80211_channel *chan, *c; + + chan =ieee80211_get_channel (&rdev->wiphy, freq); +if (chan ==NULL ) +continue ; + chan->flags &= ~IEEE80211_CHAN_RADAR_CLEAR ; + + c = rdev->ops->get_channel (&rdev->wiphy); +if (c->center_freq != chan->center_freq) +continue ; + +list_for_each_entry (wdev, &rdev->netdev_list, list) { +if (wdev->iftype ==NL80211_IFTYPE_ADHOC || + wdev->iftype ==NL80211_IFTYPE_AP || + wdev->iftype ==NL80211_IFTYPE_AP_VLAN || + wdev->iftype ==NL80211_IFTYPE_MESH_POINT || + wdev->iftype ==NL80211_IFTYPE_P2P_GO ) + rdev->ops->del_beacon (&rdev->wiphy, + wdev->netdev); + } + } +} + +static void radar_cc (struct work_struct *work) +{ +struct radar_cc_list *cc, *tmp; + +mutex_lock (&radar.lock); +list_for_each_entry_safe (cc, tmp, &radar.cc_list, list) { +unsigned long timeout = cc->timeout; + +/* the next interation might already be to late. */ + cc->timeout -=msecs_to_jiffies (100 ); + +if (time_is_before_jiffies (timeout)) { +printk (KERN_INFO "DFS: transmission close time " +"on freq %u MHz reached\n" , cc->freq); + +close_channel (cc->freq); +list_del (&cc->list); +mutex_unlock (&radar.lock); + +kfree (cc); +return ; + } + } +mutex_unlock (&radar.lock); +} +static DECLARE_WORK(cc_work, radar_cc); +static void update_all_interference_flags (u16 freq,bool set) {struct cfg80211_registered_device *rdev;
@@ -237,10 +320,13 @@ static void radar_timer(unsigned long data) {if (!list_empty (&radar.cac_list))schedule_work (&cac_work); +if (!list_empty (&radar.cc_list)) +schedule_work (&cc_work);if (!list_empty (&radar.nol_list))schedule_work (&nol_work);if (!list_empty (&radar.cac_list) || + !list_empty (&radar.cc_list) || !list_empty (&radar.nol_list))mod_timer (&radar.timer, jiffies +msecs_to_jiffies (100 )); }
@@ -255,6 +341,7 @@ void radar_init(void)mutex_init (&radar.lock);INIT_LIST_HEAD (&radar.cac_list); +INIT_LIST_HEAD (&radar.cc_list);INIT_LIST_HEAD (&radar.nol_list);setup_timer (&radar.timer, radar_timer, (unsigned long )0 ); }
@@ -262,6 +349,7 @@ void radar_init(void)void radar_deinit (void ) {struct radar_cac_list *cac, *cactmp; +struct radar_cc_list *cc, *cctmp;struct radar_nol_list *nol, *noltmp;del_timer_sync (&radar.timer);
@@ -270,6 +358,10 @@ void radar_deinit(void)list_del (&cac->list);kfree (cac); } +list_for_each_entry_safe (cc, cctmp, &radar.cac_list, list) { +list_del (&cc->list); +kfree (cc); + }list_for_each_entry_safe (nol, noltmp, &radar.nol_list, list) {list_del (&nol->list);kfree (nol);
net/wireless/radar.h +7 -0
@@ -33,6 +33,12 @@ struct radar_cac_list {struct list_head list; }; +struct radar_cc_list { +u16 freq; +unsigned long timeout; +struct list_head list; +}; +struct radar_nol_list {u16 freq;unsigned long timeout;
@@ -44,6 +50,7 @@ struct radar {struct mutex lock;struct timer_list timer;struct list_head cac_list; +struct list_head cc_list;struct list_head nol_list; };
Signature · 1 line
1.7.2.3
Johannes Berg
maintainerRe: [PATCH 1/9] [mac80211] add method to access oper chan
In reply to Bernhard SchmidtQuoted 2 lines · Bernhard Schmidt
I'm really not sure about this.. is there another/better way to access the current channel last set on a wiphy?
Very soon, there will not be a single operating channel. So this needs to be per netdev. But for most interface types, cfg80211 already knows the channel.
Also: This isn't a mac80211 patch. Please name patches after the subsystem that gets new API, not after the subsystem that implements it -- a simple implementation is fine in the same patch, a more complex one might warrant a separate patch.
johannes
Johannes Berg
maintainerRe: [PATCH 4/9] [cfg80211] add preliminary radar processing code
In reply to Bernhard SchmidtQuoted 1 line · Bernhard Schmidt
+static struct radar radar;
Didn't you just say you no longer had any global state???
johannes
Johannes Berg
maintainerRe: [PATCH 6/9] [cfg80211] no operation list (NOL) support
In reply to Bernhard Schmidtnet/wireless/radar.c static void radar_cac(struct work_struct *work) · line 143
Quoted 3 lines · Bernhard Schmidt
net/wireless/radar.c +3
-0+ chan->flags &= ~IEEE80211_CHAN_RADAR_INTERFERENCE ; +if (set) + chan->flags |=IEEE80211_CHAN_RADAR_INTERFERENCE ;
else would be better (not racy)
johannes
Johannes Berg
maintainerQuoted 3 lines · Bernhard Schmidt
Implemented so far is the complete state machine, handling CAC and NOL as well as starting appropriate action in hostapd. Note, this is based on top of the 'dfs region support' work posted by Luis.
I'm not quite sure about all of this. First of all, you don't really explain the global state vs. local state but you did say that you no longer had global state, which clearly isn't true.
Also, what's the point in "struct radar" if there's only a single instance of that, which is global? I'd rather have multiple global variables I think -- but that might just be a matter of personal taste or choice.
Finally, I think your code split is a little hard to understand. Is there really any point in adding the code bit by bit into both cfg80211 and mac80211 at the same time? I'd rather see a few patches to make cfg80211 complete and then implement it all in mac80211.
Which brings me to another point -- there's no way to detect from userspace whether or not this is all available.
Finally, such details like not needing a timer -- a delayed work should be sufficient, etc.
johannes
Quoted 9 lines · On Tuesday, March 01, 2011 13:28:06 Johannes Berg wrote:
Quoted 3 lines · Bernhard Schmidt
Implemented so far is the complete state machine, handling CAC and NOL as well as starting appropriate action in hostapd. Note, this is based on top of the 'dfs region support' work posted by Luis.
I'm not quite sure about all of this. First of all, you don't really explain the global state vs. local state but you did say that you no longer had global state, which clearly isn't true.
Sorry about that.. it should have read:
"..that states are *now* global and no per wiphy.."
What I mean with that is that the interference flag/reporting, as well as the NOL is shared between all wiphys contrary to the previous version.
Quoted 4 lines
Also, what's the point in "struct radar" if there's only a single instance of that, which is global? I'd rather have multiple global variables I think -- but that might just be a matter of personal taste or choice.
Yeah, that 'struct radar' can be split up and moved into radar.c as static vars.
Quoted 4 lines
Finally, I think your code split is a little hard to understand. Is there really any point in adding the code bit by bit into both cfg80211 and mac80211 at the same time? I'd rather see a few patches to make cfg80211 complete and then implement it all in mac80211.
I tried to group them by functionality and not by subsystem. But if you prefer that I can make a large blob for cfg80211.
Quoted 2 lines
Which brings me to another point -- there's no way to detect from userspace whether or not this is all available.
True, the only thing available right now is checking the error code for CAC_START. I'll fix that.
Quoted 6 lines
Finally, such details like not needing a timer -- a delayed work should be sufficient, etc.
johannes
Signature · 8 lines
Best regards, Dipl.-Inf. (FH) Bernhard Schmidt (software development) saxnet GmbH, Willy-Brandt-Ring 1, 08606 Oelsnitz Tel. +49 (0) 3741 300 6. 100 - Fax +49 (0) 3741 300 6. 101 managing director: Steffen Dreise - county court Chemnitz - HRB 23017 http://www.saxnet.de
Johannes Berg
maintainerQuoted 6 lines · Bernhard Schmidt
Sorry about that.. it should have read:
"..that states are *now* global and no per wiphy.."What I mean with that is that the interference flag/reporting, as well as the NOL is shared between all wiphys contrary to the previous version.
Oh, ok.
Quoted 7 lines
Quoted 4 lines
Finally, I think your code split is a little hard to understand. Is there really any point in adding the code bit by bit into both cfg80211 and mac80211 at the same time? I'd rather see a few patches to make cfg80211 complete and then implement it all in mac80211.
I tried to group them by functionality and not by subsystem. But if you prefer that I can make a large blob for cfg80211.
No, splitting them up seems alright, I just wouldn't split up the mac80211 bits across. You'll also find that when it comes to advertising capabilities, you need mac80211 to advertise them to cfg80211, and then you only want to advertise it once all functionality is in place.
Now, for applying it might later make sense to just have a single patch adding it, but it doesn't really matter as long as the code isn't really used anyway since no driver advertises the capability.
Quoted 5 lines
Quoted 2 lines
Which brings me to another point -- there's no way to detect from userspace whether or not this is all available.
True, the only thing available right now is checking the error code for
CAC_START. I'll fix that.
One thing to keep in mind: I don't typically trust drivers, that is if they don't advertise something cfg80211 won't allow it even if it might still succeed. For example, if the driver doesn't advertise IBSS, but would still permit adding IBSS, cfg80211 doesn't allow it. This makes things more consistent and makes driver authors realise right away that they need to advertise things.
johannes
Quoted 16 lines · On Tuesday, March 01, 2011 14:15:21 Johannes Berg wrote:
Quoted 6 lines · Bernhard Schmidt
Sorry about that.. it should have read:
"..that states are *now* global and no per wiphy.."What I mean with that is that the interference flag/reporting, as well as the NOL is shared between all wiphys contrary to the previous version.
Oh, ok.
Quoted 5 lines
Quoted 4 lines
Finally, I think your code split is a little hard to understand. Is there really any point in adding the code bit by bit into both cfg80211 and mac80211 at the same time? I'd rather see a few patches to make cfg80211 complete and then implement it all in mac80211.
Quoted 7 lines
Quoted 2 lines
I tried to group them by functionality and not by subsystem. But if you prefer that I can make a large blob for cfg80211.
No, splitting them up seems alright, I just wouldn't split up the mac80211 bits across. You'll also find that when it comes to advertising capabilities, you need mac80211 to advertise them to cfg80211, and then you only want to advertise it once all functionality is in place.
I see, so, basically, given there is an alternative for [PATCH 1/9] (get_channel) the only thing touching mac80211 is [PATCH 3/9], so, am I doing the right thing?
Quoted 10 lines
Now, for applying it might later make sense to just have a single patch adding it, but it doesn't really matter as long as the code isn't really used anyway since no driver advertises the capability.
Quoted 5 lines
Quoted 2 lines
Which brings me to another point -- there's no way to detect from userspace whether or not this is all available.
True, the only thing available right now is checking the error code for
CAC_START. I'll fix that.
Quoted 6 lines
One thing to keep in mind: I don't typically trust drivers, that is if they don't advertise something cfg80211 won't allow it even if it might still succeed. For example, if the driver doesn't advertise IBSS, but would still permit adding IBSS, cfg80211 doesn't allow it. This makes things more consistent and makes driver authors realise right away that they need to advertise things.
Got it, will add some kind of "radar-capability" flag for drivers.
Signature · 8 lines
Best regards, Dipl.-Inf. (FH) Bernhard Schmidt (software development) saxnet GmbH, Willy-Brandt-Ring 1, 08606 Oelsnitz Tel. +49 (0) 3741 300 6. 100 - Fax +49 (0) 3741 300 6. 101 managing director: Steffen Dreise - county court Chemnitz - HRB 23017 http://www.saxnet.de
Re: [PATCH 2/9] [{mac|nl}80211] Add 2 new radar channel flags
In reply to Bernhard SchmidtQuoted 8 lines · Bernhard Schmidt
DFS introduces 2 new flags a channel requiring radar detection might take. The interference flag indicates that interference was detected either during CAC or in-service monitoring and the channel is not to be used for the NOP period. The clear flag indicates that during a full CAC no interference was detected and it is allowed to open a BSS on that channel. The case were both flags are set is used to indicate that interference has been detected and we are in progress of closing on that channel.
What does closing mean?
Quoted 15 lines
Signed-off-by Bernhard Schmidt <[email protected]>--- include/linux/nl80211.h | 6 ++++++ include/net/cfg80211.h | 18 ++++++++++++------ net/mac80211/cfg.c | 6 ++++++ net/mac80211/tx.c | 6 ++++-- net/wireless/nl80211.c | 4 ++++ 5 files changed, 32 insertions(+), 8 deletions(-)include/linux/nl80211.h +0
-0
include/linux/nl80211.h enum nl80211_band_attr { · line 1375
Quoted 5 lines
include/linux/nl80211.h +2
-0@@ -1371,6 +1371,10 @@ enum nl80211_band_attr {* (100 * dBm). * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined +* @NL80211_FREQUENCY_ATTR_RADAR_CLEAR: during a full CAC no interference has +* been detected.
Why do you need a flag for clear, can you simply count on the lack of the flag as the "clear" state?
Luis
Re: [PATCH 3/9] [mac80211] enable radar detection
In reply to Bernhard Schmidtnet/mac80211/cfg.c static int ieee80211_set_channel(struct wiphy *wiphy, · line 1252
Quoted 5 lines · Bernhard Schmidt
net/mac80211/cfg.c +5
-0+ if (sdata && (sdata->vif.type == NL80211_IFTYPE_ADHOC || + sdata->vif.type == NL80211_IFTYPE_AP || + sdata->vif.type == NL80211_IFTYPE_AP_VLAN || + sdata->vif.type == NL80211_IFTYPE_MESH_POINT || + sdata->vif.type == NL80211_IFTYPE_P2P_GO) &&
How about adding a helper as a separate patch that checks this for us and then sprinkling in other areas of code we have that uses the same check?
Some thing like ieee80211_sdata_can_beacon(sdata) or whatever.
Luis
Re: [PATCH 4/9] [cfg80211] add preliminary radar processing code
In reply to Bernhard SchmidtQuoted 12 lines · Bernhard Schmidt
net/wireless/radar.c new file +9
-0@@ -0,0 +1,86 @@ +/* +* Radar handling +* +* Copyright 2011 Bernhard Schmidt <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/
net/wireless/radar.c line 19
Quoted 10 lines
net/wireless/radar.c new file +10
-0+ +#include <linux/ieee80211.h> +#include <net/cfg80211.h> +#include "radar.h" + +static struct radar_parameters regdomain_params[] = { + {60 ,1800 ,1000 },/* FCC, correct? */ + {60 ,1800 ,1000 },/* ETSI */ + {60 ,1800 ,1000 },/* JP, correct? */ +};
If FCC or JP are not supported, I rather code not be present for it, or some sort of flag for now to allow the radar enablement thingy to fail all the time. In fact if FCC / JP regions are not supported you should not even be able to operate in the mode of operation desired if your target channel is a DFS one. If you do enter into an allowed non-DFS channel for that region and you later try to switch to a DFS chanel then we'd hit another failure.
Luis
Re: [PATCH 4/9] [cfg80211] add preliminary radar processing code
Quoted 22 lines · On Tuesday, March 01, 2011 22:58:56 Luis R. Rodriguez wrote:
Quoted 21 lines · Bernhard Schmidt
net/wireless/radar.c new file +18
-0@@ -0,0 +1,86 @@ +/* +* Radar handling +* +* Copyright 2011 Bernhard Schmidt <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/ieee80211.h> +#include <net/cfg80211.h> +#include "radar.h" + +static struct radar_parameters regdomain_params[] = { + {60 ,1800 ,1000 },/* FCC, correct? */ + {60 ,1800 ,1000 },/* ETSI */ + {60 ,1800 ,1000 },/* JP, correct? */
Quoted 8 lines
net/wireless/radar.c line 19
Quoted 1 line
net/wireless/radar.c new file +1
-0+};If FCC or JP are not supported, I rather code not be present for it, or some sort of flag for now to allow the radar enablement thingy to fail all the time. In fact if FCC / JP regions are not supported you should not even be able to operate in the mode of operation desired if your target channel is a DFS one. If you do enter into an allowed non-DFS channel for that region and you later try to switch to a DFS chanel then we'd hit another failure.
That just means that I hadn't yet looked up the correct values, those are not available on the wiki either.
Signature · 8 lines
Best regards, Dipl.-Inf. (FH) Bernhard Schmidt (software development) saxnet GmbH, Willy-Brandt-Ring 1, 08606 Oelsnitz Tel. +49 (0) 3741 300 6. 100 - Fax +49 (0) 3741 300 6. 101 managing director: Steffen Dreise - county court Chemnitz - HRB 23017 http://www.saxnet.de
Johannes Berg
maintainerRe: [PATCH 2/9] [{mac|nl}80211] Add 2 new radar channel flags
In reply to Luis R. RodriguezQuoted 5 lines · Luis R. Rodriguez
Quoted 2 lines
+ * @NL80211_FREQUENCY_ATTR_RADAR_CLEAR: during a full CAC no interference has
+ * been detected.Why do you need a flag for clear, can you simply count on the lack of the flag as the "clear" state?
This really means CAC_DONE_AND_FOUND_CLEAR.
Though now that has me wondering, maybe it should be CAC_DONE and BUSY as separate flags? But then the checks have to be (CAC_DONE && !BUSY), which is more expressive but also more complex and error prone.
johannes
Re: [PATCH 2/9] [{mac|nl}80211] Add 2 new radar channel flags
In reply to Luis R. RodriguezQuoted 11 lines · On Tuesday, March 01, 2011 22:54:12 Luis R. Rodriguez wrote:
Quoted 8 lines · Bernhard Schmidt
DFS introduces 2 new flags a channel requiring radar detection might take. The interference flag indicates that interference was detected either during CAC or in-service monitoring and the channel is not to be used for the NOP period. The clear flag indicates that during a full CAC no interference was detected and it is allowed to open a BSS on that channel. The case were both flags are set is used to indicate that interference has been detected and we are in progress of closing on that channel.
What does closing mean?
Channel closing time is the period between radar interference and the last transmission on a channel. After detected the interferences there must be short time frame where you can notify stations about switching to another channel (CSA).
Quoted 10 lines
Quoted 10 lines
Signed-off-by Bernhard Schmidt <[email protected]>--- include/linux/nl80211.h | 6 ++++++ include/net/cfg80211.h | 18 ++++++++++++------ net/mac80211/cfg.c | 6 ++++++ net/mac80211/tx.c | 6 ++++-- net/wireless/nl80211.c | 4 ++++ 5 files changed, 32 insertions(+), 8 deletions(-)
Quoted 13 lines
include/linux/nl80211.h enum nl80211_band_attr { · line 1375
Quoted 10 lines
include/linux/nl80211.h +2
-0@@ -1371,6 +1371,10 @@ enum nl80211_band_attr {* (100 * dBm). * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined +* @NL80211_FREQUENCY_ATTR_RADAR_CLEAR: during a full CAC no interference has +* been detected. Why do you need a flag for clear, can you simply count on the lack of the flag as the "clear" state?
No. There are 3 states a channel can be in, "usable", "available" and "unavailable" (as definied in ETSI v1.5.1). On initialization all channels are "usable", this is indicated by no flag at all. Only after a full CAC can a channel get "available" (the CLEAR flag) and is now allowed to be used for beaconing. "unavailable" channels are those on which interference has been detected, those are marked with INTERFERENCE, this channel becomes a "usable" (no flag) channel again after the non-occupancy period.
Signature · 8 lines
Best regards, Dipl.-Inf. (FH) Bernhard Schmidt (software development) saxnet GmbH, Willy-Brandt-Ring 1, 08606 Oelsnitz Tel. +49 (0) 3741 300 6. 100 - Fax +49 (0) 3741 300 6. 101 managing director: Steffen Dreise - county court Chemnitz - HRB 23017 http://www.saxnet.de
Re: [PATCH 4/9] [cfg80211] add preliminary radar processing code
In reply to Bernhard SchmidtQuoted 32 lines · Bernhard Schmidt
Quoted 22 lines · On Tuesday, March 01, 2011 22:58:56 Luis R. Rodriguez wrote:
Quoted 21 lines · Bernhard Schmidt
net/wireless/radar.c new file +18
-0@@ -0,0 +1,86 @@ +/* +* Radar handling +* +* Copyright 2011 Bernhard Schmidt <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/ieee80211.h> +#include <net/cfg80211.h> +#include "radar.h" + +static struct radar_parameters regdomain_params[] = { + { 60, 1800, 1000 }, /* FCC, correct? */ + { 60, 1800, 1000 }, /* ETSI */ + { 60, 1800, 1000 }, /* JP, correct? */Quoted 8 lines
net/wireless/radar.c line 19
Quoted 1 line
net/wireless/radar.c new file +1
-0+};If FCC or JP are not supported, I rather code not be present for it, or some sort of flag for now to allow the radar enablement thingy to fail all the time. In fact if FCC / JP regions are not supported you should not even be able to operate in the mode of operation desired if your target channel is a DFS one. If you do enter into an allowed non-DFS channel for that region and you later try to switch to a DFS chanel then we'd hit another failure.
Quoted 2 lines
That just means that I hadn't yet looked up the correct values, those are not available on the wiki either.
Either way, disable them if not supported yet.
Luis