All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
@ 2012-06-19 13:10 Victor Goldenshtein
  2012-06-19 13:10 ` [PATCH v2 2/7] mac80211: " Victor Goldenshtein
                   ` (6 more replies)
  0 siblings, 7 replies; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:10 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

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.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---

v2:

1. Fixed bad indentation in:
	nl80211/cfg80211: add ability to enable TX on op-channel
	mac80211: add ap channel switch command/event
	mac80211: add DFS support to monitor interface

2. Updated commit message in:
	mac80211: add DFS support to monitor interface
	mac80211: add ap channel switch command/event     

 include/linux/nl80211.h |    7 +++++
 include/net/cfg80211.h  |   20 +++++++++++++
 net/wireless/core.h     |    6 ++++
 net/wireless/mlme.c     |   36 ++++++++++++++++++++++++
 net/wireless/nl80211.c  |   69 +++++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/nl80211.h  |    5 +++
 6 files changed, 143 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index a6959f7..ea6ce93 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -553,6 +553,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
  */
@@ -696,6 +699,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 */
@@ -2867,11 +2872,13 @@ enum nl80211_ap_sme_features {
  * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
  * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
  *	the connected inactive stations in AP mode.
+ * @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_DFS		= 1 << 3,
 };
 
 /**
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0289d4c..523d953 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -127,6 +127,9 @@ 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, only after this period the
+ *	user may initiate the tx on the channel.
  */
 struct ieee80211_channel {
 	enum ieee80211_band band;
@@ -139,6 +142,7 @@ struct ieee80211_channel {
 	bool beacon_found;
 	u32 orig_flags;
 	int orig_mag, orig_mpwr;
+	unsigned long radar_detect_timeout;
 };
 
 /**
@@ -1525,6 +1529,8 @@ struct cfg80211_gtk_rekey_data {
  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
  *	and perhaps other supported types of ethtool data-sets.
  *	See @ethtool_ops.get_strings
+ *
+ * @start_radar_detection: Start radar detection in the driver.
  */
 struct cfg80211_ops {
 	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1730,6 +1736,10 @@ struct cfg80211_ops {
 				struct ethtool_stats *stats, u64 *data);
 	void	(*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
 				  u32 sset, u8 *data);
+
+	int	(*start_radar_detection)(struct wiphy *wiphy,
+					 struct net_device *dev,
+					 struct ieee80211_channel *chan);
 };
 
 /*
@@ -3268,6 +3278,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 			      gfp_t gfp);
 
 /**
+ * cfg80211_radar_detected - radar detection event
+ * @dev: network device
+ * @freq: radar detected on this channel frequency (in MHz)
+ * @gfp: context flags
+ *
+ * This function is called when a radar is detected on the current channel.
+ */
+void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp);
+
+/**
  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
  * @dev: network device
  * @peer: peer's MAC address
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 8523f38..03e9744 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -445,6 +445,12 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
 		      struct wireless_dev *wdev, int freq,
 		      enum nl80211_channel_type channel_type);
 
+int cfg80211_start_radar_detection(struct cfg80211_registered_device *rdev,
+				   struct net_device *dev,
+				   struct ieee80211_channel *chan);
+
+u16 cfg80211_calculate_bitrate(struct rate_info *rate);
+
 int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
 			   const u8 *rates, unsigned int n_rates,
 			   u32 *mask);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index eb90988..a641db6 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -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;
@@ -982,3 +984,37 @@ 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;
+
+	return err;
+}
+
+void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct wiphy *wiphy = wdev->wiphy;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+	struct ieee80211_channel *chan;
+
+	chan = ieee80211_get_channel(&rdev->wiphy, freq);
+	if (chan)
+		chan->radar_detect_timeout = 0;
+
+	nl80211_radar_detected_notify(rdev, freq, dev, gfp);
+}
+EXPORT_SYMBOL(cfg80211_radar_detected);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 206465d..573c966 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4248,6 +4248,31 @@ static int nl80211_stop_sched_scan(struct sk_buff *skb,
 	return err;
 }
 
+static int nl80211_start_radar_detection(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);
+	int freq;
+	struct ieee80211_channel *chan;
+
+	if (!dfs_supported)
+		return -EOPNOTSUPP;
+
+	if (!info->attrs[NL80211_ATTR_WIPHY_FREQ])
+		return -EINVAL;
+
+	freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
+
+	chan = ieee80211_get_channel(&rdev->wiphy, freq);
+
+	if (!chan || !(chan->flags & IEEE80211_CHAN_RADAR))
+		return -EINVAL;
+
+	return cfg80211_start_radar_detection(rdev, dev, chan);
+}
+
 static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
 			    u32 seq, int flags,
 			    struct cfg80211_registered_device *rdev,
@@ -6997,6 +7022,14 @@ static struct genl_ops nl80211_ops[] = {
 		.internal_flags = NL80211_FLAG_NEED_NETDEV |
 				  NL80211_FLAG_NEED_RTNL,
 	},
+	{
+		.cmd = NL80211_CMD_RADAR_DETECT,
+		.doit = nl80211_start_radar_detection,
+		.policy = nl80211_policy,
+		.flags = GENL_ADMIN_PERM,
+		.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+				  NL80211_FLAG_NEED_RTNL,
+	},
 
 };
 
@@ -8101,6 +8134,42 @@ void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
 }
 
 void
+nl80211_radar_detected_notify(struct cfg80211_registered_device *rdev,
+			      u16 freq, struct net_device *netdev, gfp_t gfp)
+{
+	struct sk_buff *msg;
+	void *hdr;
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
+	if (!msg)
+		return;
+
+	hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_RADAR_DETECT);
+	if (!hdr) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+	    nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
+	    nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq))
+		goto nla_put_failure;
+
+	if (genlmsg_end(msg, hdr) < 0) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+				nl80211_mlme_mcgrp.id, gfp);
+	return;
+
+ nla_put_failure:
+	genlmsg_cancel(msg, hdr);
+	nlmsg_free(msg);
+}
+
+void
 nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev,
 				struct net_device *netdev, const u8 *peer,
 				u32 num_packets, gfp_t gfp)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 01a1122..a333261 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -105,6 +105,11 @@ 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,
+			      u16 freq, 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,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 2/7] mac80211: add radar detection command/event
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
@ 2012-06-19 13:10 ` Victor Goldenshtein
  2012-06-20  8:40   ` Johannes Berg
  2012-06-19 13:10 ` [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel Victor Goldenshtein
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:10 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

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.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 include/net/mac80211.h      |   17 +++++++++++++++++
 net/mac80211/cfg.c          |   16 ++++++++++++++++
 net/mac80211/driver-ops.h   |   14 ++++++++++++++
 net/mac80211/driver-trace.h |    6 ++++++
 net/mac80211/mlme.c         |    8 ++++++++
 5 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 95e39b6..a2222cf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2246,6 +2246,10 @@ enum ieee80211_rate_control_changed {
  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
  *	and perhaps other supported types of ethtool data-sets.
  *
+ * @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);
@@ -2385,6 +2389,9 @@ struct ieee80211_ops {
 	void	(*get_et_strings)(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif,
 				  u32 sset, u8 *data);
+	int (*start_radar_detection)(struct ieee80211_hw *hw,
+				     struct ieee80211_vif *vif,
+				     struct ieee80211_channel *chan);
 };
 
 /**
@@ -3557,6 +3564,16 @@ 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.
+ * @freq: frequency of the 'radar detected' channel.
+ * @gfp: context flags.
+ */
+void ieee80211_radar_detected(struct ieee80211_vif *vif, u16 freq, gfp_t gfp);
+
+/**
  * ieee80211_get_operstate - get the operstate of the vif
  *
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7d5108a..541b274 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2211,6 +2211,21 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
 	return ieee80211_wk_cancel_remain_on_channel(sdata, cookie);
 }
 
+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 enum work_done_result
 ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
 {
@@ -2979,4 +2994,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_et_sset_count = ieee80211_get_et_sset_count,
 	.get_et_stats = ieee80211_get_et_stats,
 	.get_et_strings = ieee80211_get_et_strings,
+	.start_radar_detection = ieee80211_start_radar_detection,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 6d33a0c..57185df 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -329,6 +329,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,
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 6de00b2..4112aa3 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -484,6 +484,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),
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 66e4fcd..37ed827 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3562,6 +3562,14 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL(ieee80211_cqm_rssi_notify);
 
+void ieee80211_radar_detected(struct ieee80211_vif *vif, u16 freq, gfp_t gfp)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+	cfg80211_radar_detected(sdata->dev, freq, gfp);
+}
+EXPORT_SYMBOL(ieee80211_radar_detected);
+
 unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif)
 {
 	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
  2012-06-19 13:10 ` [PATCH v2 2/7] mac80211: " Victor Goldenshtein
@ 2012-06-19 13:10 ` Victor Goldenshtein
  2012-06-20  8:44   ` Johannes Berg
  2012-06-19 13:11 ` [PATCH v2 4/7] mac80211: " Victor Goldenshtein
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:10 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

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 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 sines the beginning of the CAC is
less than min CAC time (60 sec), -EPERM is returned.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 include/linux/nl80211.h |   11 +++++++++++
 include/net/cfg80211.h  |    5 +++++
 net/wireless/nl80211.c  |   36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index ea6ce93..2f869a4 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -556,6 +556,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 sines 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
  */
@@ -701,6 +710,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 */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 523d953..f7fe44e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1531,6 +1531,8 @@ struct cfg80211_gtk_rekey_data {
  *	See @ethtool_ops.get_strings
  *
  * @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);
@@ -1740,6 +1742,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);
 };
 
 /*
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 573c966..966f7cc 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4273,6 +4273,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->radar_detect_timeout ||
+	     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,
@@ -7030,6 +7058,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,
+	},
 
 };
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 4/7] mac80211: add ability to enable TX on op-channel
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
  2012-06-19 13:10 ` [PATCH v2 2/7] mac80211: " Victor Goldenshtein
  2012-06-19 13:10 ` [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel Victor Goldenshtein
@ 2012-06-19 13:11 ` Victor Goldenshtein
  2012-06-19 13:11 ` [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event Victor Goldenshtein
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:11 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

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 <victorg@ti.com>
---
 include/net/mac80211.h      |    4 ++++
 net/mac80211/cfg.c          |   15 +++++++++++++++
 net/mac80211/driver-ops.h   |   14 ++++++++++++++
 net/mac80211/driver-trace.h |    6 ++++++
 4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a2222cf..82e5ee7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2249,6 +2249,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 {
@@ -2392,6 +2394,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);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 541b274..a48d055 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2226,6 +2226,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 enum work_done_result
 ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
 {
@@ -2995,4 +3009,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_et_stats = ieee80211_get_et_stats,
 	.get_et_strings = ieee80211_get_et_strings,
 	.start_radar_detection = ieee80211_start_radar_detection,
+	.dfs_en_tx = ieee80211_dfs_en_tx,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 57185df..f49b76b 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -343,6 +343,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,
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 4112aa3..6df02c4 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -490,6 +490,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),
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
                   ` (2 preceding siblings ...)
  2012-06-19 13:11 ` [PATCH v2 4/7] mac80211: " Victor Goldenshtein
@ 2012-06-19 13:11 ` Victor Goldenshtein
  2012-06-20  8:47   ` Johannes Berg
  2012-06-19 13:11 ` [PATCH v2 6/7] mac80211: " Victor Goldenshtein
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:11 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

Add NL80211_CMD_AP_CHANNEL_SWITCH command/event
which triggers an AP channel switch process and
notifies usermode about channel switch complete
event, once it completed.

Usermode (hostapd) is responsible to update the
channel switch announcement IE in the beacon
prior and after the channel switch operation.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 include/linux/nl80211.h |   25 ++++++++++++++
 include/net/cfg80211.h  |   17 +++++++++
 net/wireless/mlme.c     |   11 ++++++
 net/wireless/nl80211.c  |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 net/wireless/nl80211.h  |    5 +++
 5 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2f869a4..4279507 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -565,6 +565,15 @@
  *	the time passed sines the beginning of the CAC is less than
  *	NL80211_DFS_MIN_CAC_TIME_MS, -EPERM is returned.
  *
+ * @NL80211_CMD_AP_CHANNEL_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.
+ *	This command will also notify about channel switch complete event.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -712,6 +721,8 @@ enum nl80211_commands {
 
 	NL80211_CMD_DFS_ENABLE_TX,
 
+	NL80211_CMD_AP_CHANNEL_SWITCH,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1238,6 +1249,14 @@ enum nl80211_commands {
  * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
  *      or 0 to disable background scan.
  *
+ * @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
  */
@@ -1489,6 +1508,10 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_BG_SCAN_PERIOD,
 
+	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,
@@ -2884,12 +2907,14 @@ enum nl80211_ap_sme_features {
  * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
  *	the connected inactive stations in AP mode.
  * @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,
 	NL80211_FEATURE_HT_IBSS		= 1 << 1,
 	NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
 	NL80211_FEATURE_DFS		= 1 << 3,
+	NL80211_FEATURE_AP_CH_SWITCH	= 1 << 4,
 };
 
 /**
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f7fe44e..a4994a3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1533,6 +1533,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);
@@ -1745,6 +1747,11 @@ 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,
+				     u32 count, bool block_tx,
+				     bool post_switch_block_tx,
+				     struct ieee80211_channel *new_ch);
 };
 
 /*
@@ -3293,6 +3300,16 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp);
 
 /**
+ * cfg80211_ap_ch_switch_complete_notify - channel switch complete event
+ * @dev: network device
+ * @gfp: context flags
+ *
+ * Notify userspace about channel switch complete event.
+ */
+void cfg80211_ap_ch_switch_complete_notify(struct net_device *dev,
+					   u16 freq, gfp_t gfp);
+
+/**
  * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
  * @dev: network device
  * @peer: peer's MAC address
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index a641db6..d45c875 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1018,3 +1018,14 @@ void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp)
 	nl80211_radar_detected_notify(rdev, freq, dev, gfp);
 }
 EXPORT_SYMBOL(cfg80211_radar_detected);
+
+void cfg80211_ap_ch_switch_complete_notify(struct net_device *dev,
+					   u16 freq, gfp_t gfp)
+{
+	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	struct wiphy *wiphy = wdev->wiphy;
+	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+
+	nl80211_ap_ch_switch_complete_notify(rdev, freq, dev, gfp);
+}
+EXPORT_SYMBOL(cfg80211_ap_ch_switch_complete_notify);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 966f7cc..c09a9b7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -206,6 +206,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
 	[NL80211_ATTR_NOACK_MAP] = { .type = NLA_U16 },
 	[NL80211_ATTR_INACTIVITY_TIMEOUT] = { .type = NLA_U16 },
 	[NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
+	[NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 },
+	[NL80211_ATTR_CH_SWITCH_BLOCK_TX] = { .type = NLA_FLAG },
+	[NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX] = { .type = NLA_FLAG },
 };
 
 /* policy for the key attributes */
@@ -4301,6 +4304,42 @@ static int nl80211_dfs_en_tx(struct sk_buff *skb, struct genl_info *info)
 	return rdev->ops->dfs_en_tx(&rdev->wiphy, dev, chan);
 }
 
+static int nl80211_ap_channel_switch(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];
+	u32 freq = 0, count = 0, post_switch_block_tx = 0, block_tx = 0;
+	struct ieee80211_channel *new_ch;
+
+	if (!rdev->ops->ap_channel_switch)
+		return -EOPNOTSUPP;
+
+	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
+		return -EOPNOTSUPP;
+
+	if (!info->attrs[NL80211_ATTR_CH_SWITCH_COUNT] ||
+	    !info->attrs[NL80211_ATTR_WIPHY_FREQ])
+		return -EINVAL;
+
+	count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]);
+	freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
+
+	new_ch = ieee80211_get_channel(&rdev->wiphy, freq);
+	if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED)
+		return -EINVAL;
+
+	if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX])
+		block_tx = true;
+
+	if (info->attrs[NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX])
+		post_switch_block_tx = true;
+
+	return rdev->ops->ap_channel_switch(&rdev->wiphy, dev, count, block_tx,
+					    post_switch_block_tx, new_ch);
+}
+
 static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
 			    u32 seq, int flags,
 			    struct cfg80211_registered_device *rdev,
@@ -7066,6 +7105,14 @@ static struct genl_ops nl80211_ops[] = {
 		.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
 				  NL80211_FLAG_NEED_RTNL,
 	},
+	{
+		.cmd = NL80211_CMD_AP_CHANNEL_SWITCH,
+		.doit = nl80211_ap_channel_switch,
+		.policy = nl80211_policy,
+		.flags = GENL_ADMIN_PERM,
+		.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+				  NL80211_FLAG_NEED_RTNL,
+	},
 
 };
 
@@ -8206,6 +8253,43 @@ nl80211_radar_detected_notify(struct cfg80211_registered_device *rdev,
 }
 
 void
+nl80211_ap_ch_switch_complete_notify(struct cfg80211_registered_device *rdev,
+				     u16 freq, struct net_device *netdev,
+				     gfp_t gfp)
+{
+	struct sk_buff *msg;
+	void *hdr;
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
+	if (!msg)
+		return;
+
+	hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_AP_CHANNEL_SWITCH);
+	if (!hdr) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+	    nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
+	    nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq))
+		goto nla_put_failure;
+
+	if (genlmsg_end(msg, hdr) < 0) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
+				nl80211_mlme_mcgrp.id, gfp);
+	return;
+
+ nla_put_failure:
+	genlmsg_cancel(msg, hdr);
+	nlmsg_free(msg);
+}
+
+void
 nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev,
 				struct net_device *netdev, const u8 *peer,
 				u32 num_packets, gfp_t gfp)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index a333261..aca0de3 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -111,6 +111,11 @@ nl80211_radar_detected_notify(struct cfg80211_registered_device *rdev,
 			      u16 freq, struct net_device *netdev, gfp_t gfp);
 
 void
+nl80211_ap_ch_switch_complete_notify(struct cfg80211_registered_device *rdev,
+				     u16 freq, 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,
 				u32 num_packets, gfp_t gfp);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 6/7] mac80211: add ap channel switch command/event
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
                   ` (3 preceding siblings ...)
  2012-06-19 13:11 ` [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event Victor Goldenshtein
@ 2012-06-19 13:11 ` Victor Goldenshtein
  2012-06-20  8:48   ` Johannes Berg
  2012-06-19 13:11 ` [PATCH v2 7/7] mac80211: add DFS support to monitor interface Victor Goldenshtein
  2012-06-20  8:40 ` [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Johannes Berg
  6 siblings, 1 reply; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:11 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

Add ieee80211_ap_process_chanswitch(), to handle a channel switch
request for AP.

Add ieee80211_ap_ch_switch_complete_notify() which notifies upper
layers about channel switch complete event.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 include/net/mac80211.h      |   39 +++++++++++++++++++++++++++++++++++++++
 net/mac80211/cfg.c          |   26 ++++++++++++++++++++++++++
 net/mac80211/driver-ops.h   |   10 ++++++++++
 net/mac80211/driver-trace.h |   31 +++++++++++++++++++++++++++++++
 net/mac80211/main.c         |    3 +++
 net/mac80211/mlme.c         |    9 +++++++++
 6 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 82e5ee7..79239a0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -865,6 +865,32 @@ struct ieee80211_channel_switch {
 };
 
 /**
+ * struct ieee80211_ap_channel_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
+ * @count: the number of TBTT's until the channel switch event
+ */
+struct ieee80211_ap_channel_switch {
+	u64 timestamp;
+	bool block_tx;
+	bool post_switch_block_tx;
+	struct ieee80211_channel *channel;
+	u8 count;
+};
+
+/**
  * enum ieee80211_vif_flags - virtual interface flags
  *
  * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
@@ -2354,6 +2380,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_channel_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);
@@ -3578,6 +3606,17 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
 void ieee80211_radar_detected(struct ieee80211_vif *vif, u16 freq, gfp_t gfp);
 
 /**
+ * ieee80211_ap_ch_switch_complete_notify - inform a configured connection that
+ * channel switch is complete
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @gfp: context flags
+ *
+ */
+void ieee80211_ap_ch_switch_complete_notify(struct ieee80211_vif *vif,
+					    u16 freq, gfp_t gfp);
+
+/**
  * ieee80211_get_operstate - get the operstate of the vif
  *
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a48d055..d017972 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2240,6 +2240,31 @@ 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,
+					   u32 count, bool block_tx,
+					   bool post_switch_block_tx,
+					   struct ieee80211_channel *new_ch)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_ap_channel_switch ap_ch_switch;
+
+	if (!local->ops->channel_switch)
+		return -EOPNOTSUPP;
+
+	memset(&ap_ch_switch, 0, sizeof(ap_ch_switch));
+	ap_ch_switch.channel = new_ch;
+	ap_ch_switch.count = count;
+	ap_ch_switch.block_tx = block_tx;
+	ap_ch_switch.post_switch_block_tx = post_switch_block_tx;
+
+	mutex_lock(&local->mtx);
+	drv_ap_channel_switch(local, &ap_ch_switch);
+	mutex_unlock(&local->mtx);
+	return 0;
+}
+
 static enum work_done_result
 ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
 {
@@ -3010,4 +3035,5 @@ struct cfg80211_ops mac80211_config_ops = {
 	.get_et_strings = ieee80211_get_et_strings,
 	.start_radar_detection = ieee80211_start_radar_detection,
 	.dfs_en_tx = ieee80211_dfs_en_tx,
+	.ap_channel_switch = ieee80211_ap_process_chanswitch,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index f49b76b..7f7e6d0 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -711,6 +711,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_channel_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)
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 6df02c4..972be66 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -927,6 +927,37 @@ TRACE_EVENT(drv_channel_switch,
 	)
 );
 
+TRACE_EVENT(drv_ap_channel_switch,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_ap_channel_switch *ap_ch_switch),
+
+	TP_ARGS(local, ap_ch_switch),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(u64, timestamp)
+		__field(bool, block_tx)
+		__field(bool, post_switch_block_tx)
+		__field(u16, freq)
+		__field(u8, count)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->timestamp = ap_ch_switch->timestamp;
+		__entry->block_tx = ap_ch_switch->block_tx;
+		__entry->post_switch_block_tx =
+			ap_ch_switch->post_switch_block_tx;
+		__entry->freq = ap_ch_switch->channel->center_freq;
+		__entry->count = ap_ch_switch->count;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " new freq:%u count:%d",
+		LOCAL_PR_ARG, __entry->freq, __entry->count
+	)
+);
+
 TRACE_EVENT(drv_set_antenna,
 	TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret),
 
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index f5548e9..18094cc 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -567,6 +567,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;
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 37ed827..ab7e430 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3570,6 +3570,15 @@ void ieee80211_radar_detected(struct ieee80211_vif *vif, u16 freq, gfp_t gfp)
 }
 EXPORT_SYMBOL(ieee80211_radar_detected);
 
+void ieee80211_ap_ch_switch_complete_notify(struct ieee80211_vif *vif,
+					    u16 freq, gfp_t gfp)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+
+	cfg80211_ap_ch_switch_complete_notify(sdata->dev, freq, gfp);
+}
+EXPORT_SYMBOL(ieee80211_ap_ch_switch_complete_notify);
+
 unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif)
 {
 	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [PATCH v2 7/7] mac80211: add DFS support to monitor interface
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
                   ` (4 preceding siblings ...)
  2012-06-19 13:11 ` [PATCH v2 6/7] mac80211: " Victor Goldenshtein
@ 2012-06-19 13:11 ` Victor Goldenshtein
  2012-06-20  8:49   ` Johannes Berg
  2012-06-20  8:40 ` [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Johannes Berg
  6 siblings, 1 reply; 33+ messages in thread
From: Victor Goldenshtein @ 2012-06-19 13:11 UTC (permalink / raw)
  To: linux-wireless
  Cc: kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j, johannes, coelho,
	assaf, yoni.divinsky, igalc, adrian, nbd, simon.wunderlich

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.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
---
 net/mac80211/tx.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e453212..8c7f365 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1595,6 +1595,8 @@ 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
@@ -1607,13 +1609,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 */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
  2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
                   ` (5 preceding siblings ...)
  2012-06-19 13:11 ` [PATCH v2 7/7] mac80211: add DFS support to monitor interface Victor Goldenshtein
@ 2012-06-20  8:40 ` Johannes Berg
  2012-06-20 12:22   ` Zefir Kurtisi
  2012-06-20 16:42   ` Goldenshtein, Victor
  6 siblings, 2 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:40 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Tue, 2012-06-19 at 16:10 +0300, Victor Goldenshtein wrote:

> +	NL80211_CMD_RADAR_DETECT,

Is there no need to ever stop radar detection?

> + * @radar_detect_timeout: this timeout indicates the end of the channel
> + *	availability check for radar channels, only after this period the
> + *	user may initiate the tx on the channel.

units? internal use, or for use by drivers? should it really be stored
in the global channel struct that could be shared for multiple devices?

>  /**
> + * cfg80211_radar_detected - radar detection event
> + * @dev: network device
> + * @freq: radar detected on this channel frequency (in MHz)
> + * @gfp: context flags
> + *
> + * This function is called when a radar is detected on the current channel.
> + */
> +void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp);

Better to pass the channel pointer?

> +u16 cfg80211_calculate_bitrate(struct rate_info *rate);

??

> +void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp)
> +{
> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> +	struct wiphy *wiphy = wdev->wiphy;
> +	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
> +	struct ieee80211_channel *chan;
> +
> +	chan = ieee80211_get_channel(&rdev->wiphy, freq);
> +	if (chan)
> +		chan->radar_detect_timeout = 0;

So how do you distinguish between having ever done radar detection and
never even having started it? Also, jiffies + ... can return 0.


How do you intend to handle HT40?

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 2/7] mac80211: add radar detection command/event
  2012-06-19 13:10 ` [PATCH v2 2/7] mac80211: " Victor Goldenshtein
@ 2012-06-20  8:40   ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:40 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Tue, 2012-06-19 at 16:10 +0300, Victor Goldenshtein wrote:

> +void ieee80211_radar_detected(struct ieee80211_vif *vif, u16 freq, gfp_t gfp)
> +{
> +	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);

add tracing please, also maybe pass channel instead of freq

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-19 13:10 ` [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel Victor Goldenshtein
@ 2012-06-20  8:44   ` Johannes Berg
  2012-06-20  8:46     ` Johannes Berg
  2012-06-20 14:34     ` Goldenshtein, Victor
  0 siblings, 2 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:44 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich


> +	if ((!chan->radar_detect_timeout ||
> +	     time_is_after_jiffies(chan->radar_detect_timeout)) &&
> +	    (chan->flags & IEEE80211_CHAN_RADAR))
> +		return -EPERM;

Ok so you reject it if it's 0, but the jiffies calculation could return
0 too.. in fact, since jiffies start at -5 minutes on boot, you might
even hit it if you start radar detection 4 minutes after boot.

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20  8:44   ` Johannes Berg
@ 2012-06-20  8:46     ` Johannes Berg
  2012-06-20 11:53       ` Zefir Kurtisi
  2012-06-20 15:06       ` Goldenshtein, Victor
  2012-06-20 14:34     ` Goldenshtein, Victor
  1 sibling, 2 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:46 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, 2012-06-20 at 10:44 +0200, Johannes Berg wrote:
> > +	if ((!chan->radar_detect_timeout ||
> > +	     time_is_after_jiffies(chan->radar_detect_timeout)) &&
> > +	    (chan->flags & IEEE80211_CHAN_RADAR))
> > +		return -EPERM;
> 
> Ok so you reject it if it's 0, but the jiffies calculation could return
> 0 too.. in fact, since jiffies start at -5 minutes on boot, you might
> even hit it if you start radar detection 4 minutes after boot.

Also, it seems that the value should be reset eventually ... at least on
interface down or so. Otherwise you can start CAC, then bring the
interface down to stop the device, and then bring it back up (CAC check
is no longer running) and then you can use the channel after some time
even though you never really checked for radar...

And if you start CAC on two different devices on the same channel, but
they happen to share channel structs in the driver then this will all
conflict quite badly.


This needs a lot of more thinking it seems.

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-19 13:11 ` [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event Victor Goldenshtein
@ 2012-06-20  8:47   ` Johannes Berg
  2012-06-20 17:17     ` Goldenshtein, Victor
  0 siblings, 1 reply; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:47 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Tue, 2012-06-19 at 16:11 +0300, Victor Goldenshtein wrote:

> @@ -565,6 +565,15 @@
>   *	the time passed sines the beginning of the CAC is less than

interestingly now I see a typo in the previous patch: "sines"?


>   * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
> + * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.

what point is there in separating these flags?


> +	int	(*ap_channel_switch)(struct wiphy *wiphy, struct net_device *dev,
> +				     u32 count, bool block_tx,
> +				     bool post_switch_block_tx,
> +				     struct ieee80211_channel *new_ch);

If mac80211 needs a struct, why not have one here already rather than
all the parameters?

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 6/7] mac80211: add ap channel switch command/event
  2012-06-19 13:11 ` [PATCH v2 6/7] mac80211: " Victor Goldenshtein
@ 2012-06-20  8:48   ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:48 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Tue, 2012-06-19 at 16:11 +0300, Victor Goldenshtein wrote:

> +void ieee80211_ap_ch_switch_complete_notify(struct ieee80211_vif *vif,
> +					    u16 freq, gfp_t gfp)
> +{
> +	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
> +

tracing please

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 7/7] mac80211: add DFS support to monitor interface
  2012-06-19 13:11 ` [PATCH v2 7/7] mac80211: add DFS support to monitor interface Victor Goldenshtein
@ 2012-06-20  8:49   ` Johannes Berg
  2012-06-20 16:50     ` Goldenshtein, Victor
  0 siblings, 1 reply; 33+ messages in thread
From: Johannes Berg @ 2012-06-20  8:49 UTC (permalink / raw)
  To: Victor Goldenshtein
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Tue, 2012-06-19 at 16:11 +0300, Victor Goldenshtein wrote:

> +	bool dfs_supported = !!(local->hw.wiphy->features &
> +				NL80211_FEATURE_DFS);

No need for !!, also why not inline that into the condition?

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20  8:46     ` Johannes Berg
@ 2012-06-20 11:53       ` Zefir Kurtisi
  2012-06-20 11:57         ` Johannes Berg
  2012-06-20 15:06       ` Goldenshtein, Victor
  1 sibling, 1 reply; 33+ messages in thread
From: Zefir Kurtisi @ 2012-06-20 11:53 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On 06/20/2012 10:46 AM, Johannes Berg wrote:
> On Wed, 2012-06-20 at 10:44 +0200, Johannes Berg wrote:
>>> +	if ((!chan->radar_detect_timeout ||
>>> +	     time_is_after_jiffies(chan->radar_detect_timeout)) &&
>>> +	    (chan->flags & IEEE80211_CHAN_RADAR))
>>> +		return -EPERM;
>>
>> Ok so you reject it if it's 0, but the jiffies calculation could return
>> 0 too.. in fact, since jiffies start at -5 minutes on boot, you might
>> even hit it if you start radar detection 4 minutes after boot.
> 
> Also, it seems that the value should be reset eventually ... at least on
> interface down or so. Otherwise you can start CAC, then bring the
> interface down to stop the device, and then bring it back up (CAC check
> is no longer running) and then you can use the channel after some time
> even though you never really checked for radar...
> 
No, if you bring it back up on the same DFS channel,
radar_detection_timeout will be set back to +60s by
start_radar_detection(). Looks safe to me.

> And if you start CAC on two different devices on the same channel, but
> they happen to share channel structs in the driver then this will all
> conflict quite badly.
> 
Details ;) In fact, if you start device A at a DFS channel and device B
at the same channel 50secs later and device A did not detect radars
after 60secs, ideally both should get TX enabled at the same time with
B's CAC being aborted after 10secs.

For that radar_detect_timeout had to be per wiphy.

With the proposal here you have to wait for the last device to pass the
CAC and if you alternatively put devices A and B up and down every
30secs you can effectively prevent them from TXing forever.
> 
> This needs a lot of more thinking it seems.
> 
> johannes
> 



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 11:53       ` Zefir Kurtisi
@ 2012-06-20 11:57         ` Johannes Berg
  2012-06-20 12:58           ` Zefir Kurtisi
  0 siblings, 1 reply; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 11:57 UTC (permalink / raw)
  To: Zefir Kurtisi
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On Wed, 2012-06-20 at 13:53 +0200, Zefir Kurtisi wrote:
> On 06/20/2012 10:46 AM, Johannes Berg wrote:
> > On Wed, 2012-06-20 at 10:44 +0200, Johannes Berg wrote:
> >>> +	if ((!chan->radar_detect_timeout ||
> >>> +	     time_is_after_jiffies(chan->radar_detect_timeout)) &&
> >>> +	    (chan->flags & IEEE80211_CHAN_RADAR))
> >>> +		return -EPERM;
> >>
> >> Ok so you reject it if it's 0, but the jiffies calculation could return
> >> 0 too.. in fact, since jiffies start at -5 minutes on boot, you might
> >> even hit it if you start radar detection 4 minutes after boot.
> > 
> > Also, it seems that the value should be reset eventually ... at least on
> > interface down or so. Otherwise you can start CAC, then bring the
> > interface down to stop the device, and then bring it back up (CAC check
> > is no longer running) and then you can use the channel after some time
> > even though you never really checked for radar...
> > 
> No, if you bring it back up on the same DFS channel,
> radar_detection_timeout will be set back to +60s by
> start_radar_detection(). Looks safe to me.

You need to think a bit more outside the regular code flows ... What if
I'm not calling start_radar_detection()?

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
  2012-06-20  8:40 ` [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Johannes Berg
@ 2012-06-20 12:22   ` Zefir Kurtisi
  2012-06-20 12:29     ` Johannes Berg
  2012-06-20 16:42   ` Goldenshtein, Victor
  1 sibling, 1 reply; 33+ messages in thread
From: Zefir Kurtisi @ 2012-06-20 12:22 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On 06/20/2012 10:40 AM, Johannes Berg wrote:
> [...]
> 
> How do you intend to handle HT40?
> 
> johannes
> 

Not to mention VHT ante portas...

We should start with HT20 support only to have something to start
testing with and add HT40 gradually (assuming it will require a lot more
locations to be patched to be available initially).



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
  2012-06-20 12:22   ` Zefir Kurtisi
@ 2012-06-20 12:29     ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 12:29 UTC (permalink / raw)
  To: Zefir Kurtisi
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On Wed, 2012-06-20 at 14:22 +0200, Zefir Kurtisi wrote:
> On 06/20/2012 10:40 AM, Johannes Berg wrote:
> > [...]
> > 
> > How do you intend to handle HT40?
> > 
> > johannes
> > 
> 
> Not to mention VHT ante portas...
> 
> We should start with HT20 support only to have something to start
> testing with and add HT40 gradually (assuming it will require a lot more
> locations to be patched to be available initially).

Ok, fin with me. However, then somewhere in this code there should be a
channel type check ... otherwise you can do the CAC on 20 MHz and then
use 40 anyway, no? I see no channel type handling anywhere. Or just add
the code to check if all affected channels had CAC to start with, that
will refuse HT40 then

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 11:57         ` Johannes Berg
@ 2012-06-20 12:58           ` Zefir Kurtisi
  2012-06-20 13:12             ` Johannes Berg
  0 siblings, 1 reply; 33+ messages in thread
From: Zefir Kurtisi @ 2012-06-20 12:58 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On 06/20/2012 01:57 PM, Johannes Berg wrote:
> On Wed, 2012-06-20 at 13:53 +0200, Zefir Kurtisi wrote:
>> On 06/20/2012 10:46 AM, Johannes Berg wrote:
>>> On Wed, 2012-06-20 at 10:44 +0200, Johannes Berg wrote:
>>>>> +	if ((!chan->radar_detect_timeout ||
>>>>> +	     time_is_after_jiffies(chan->radar_detect_timeout)) &&
>>>>> +	    (chan->flags & IEEE80211_CHAN_RADAR))
>>>>> +		return -EPERM;
>>>>
>>>> Ok so you reject it if it's 0, but the jiffies calculation could return
>>>> 0 too.. in fact, since jiffies start at -5 minutes on boot, you might
>>>> even hit it if you start radar detection 4 minutes after boot.
>>>
>>> Also, it seems that the value should be reset eventually ... at least on
>>> interface down or so. Otherwise you can start CAC, then bring the
>>> interface down to stop the device, and then bring it back up (CAC check
>>> is no longer running) and then you can use the channel after some time
>>> even though you never really checked for radar...
>>>
>> No, if you bring it back up on the same DFS channel,
>> radar_detection_timeout will be set back to +60s by
>> start_radar_detection(). Looks safe to me.
> 
> You need to think a bit more outside the regular code flows ... What if
> I'm not calling start_radar_detection()?
> 
> johannes
> 
If you are not calling start_radar_detection() you are not using
hostapd. With the design approach we agreed on (when we initially
discussed DFS years ago) to have all the logic located in hostapd, it is
inevitable that those who intentionally want to bypass DFS regulatory
restrictions actually can. You can always replace hostapd by some
component that handles DFS control without caring the wait times.

I don't see a reliable and fail-safe method to prevent users doing that.
Other than maybe moving the logic part up to mac80211 or create some
additional barrier like is done with crda (which is exactly that:
additional barriers, but no prevention).


tl;dr: if the DFS regulatory compliance is provided by hostapd, it is
mandatory for master mode - which ensures that start_radar_detection()
is called whenever operating a DFS channel.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 12:58           ` Zefir Kurtisi
@ 2012-06-20 13:12             ` Johannes Berg
  2012-06-20 13:32               ` Goldenshtein, Victor
  2012-06-20 13:38               ` Zefir Kurtisi
  0 siblings, 2 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 13:12 UTC (permalink / raw)
  To: Zefir Kurtisi
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On Wed, 2012-06-20 at 14:58 +0200, Zefir Kurtisi wrote:

> >> No, if you bring it back up on the same DFS channel,
> >> radar_detection_timeout will be set back to +60s by
> >> start_radar_detection(). Looks safe to me.
> > 
> > You need to think a bit more outside the regular code flows ... What if
> > I'm not calling start_radar_detection()?

> If you are not calling start_radar_detection() you are not using
> hostapd. With the design approach we agreed on (when we initially
> discussed DFS years ago) to have all the logic located in hostapd, it is
> inevitable that those who intentionally want to bypass DFS regulatory
> restrictions actually can. You can always replace hostapd by some
> component that handles DFS control without caring the wait times.

But this kernel patch is attempting to enforce the wait time. Are you
saying it shouldn't even pretend to enforce it?

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 13:12             ` Johannes Berg
@ 2012-06-20 13:32               ` Goldenshtein, Victor
  2012-06-20 14:18                 ` Johannes Berg
  2012-06-20 13:38               ` Zefir Kurtisi
  1 sibling, 1 reply; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 13:32 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Zefir Kurtisi, linux-wireless, kgiori, mcgrof, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 4:12 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2012-06-20 at 14:58 +0200, Zefir Kurtisi wrote:
>
>> >> No, if you bring it back up on the same DFS channel,
>> >> radar_detection_timeout will be set back to +60s by
>> >> start_radar_detection(). Looks safe to me.
>> >
>> > You need to think a bit more outside the regular code flows ... What if
>> > I'm not calling start_radar_detection()?
>
>> If you are not calling start_radar_detection() you are not using
>> hostapd. With the design approach we agreed on (when we initially
>> discussed DFS years ago) to have all the logic located in hostapd, it is
>> inevitable that those who intentionally want to bypass DFS regulatory
>> restrictions actually can. You can always replace hostapd by some
>> component that handles DFS control without caring the wait times.
>
> But this kernel patch is attempting to enforce the wait time. Are you
> saying it shouldn't even pretend to enforce it?
>

It's not just attempts, it's ensures that no transmission will occur
until we perform a radar detection on the channel.
It's doesn't matter if the usermode use hostapd or some other applications.

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 13:12             ` Johannes Berg
  2012-06-20 13:32               ` Goldenshtein, Victor
@ 2012-06-20 13:38               ` Zefir Kurtisi
  2012-06-20 14:19                 ` Johannes Berg
  1 sibling, 1 reply; 33+ messages in thread
From: Zefir Kurtisi @ 2012-06-20 13:38 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On 06/20/2012 03:12 PM, Johannes Berg wrote:
> On Wed, 2012-06-20 at 14:58 +0200, Zefir Kurtisi wrote:
> 
>>>> No, if you bring it back up on the same DFS channel,
>>>> radar_detection_timeout will be set back to +60s by
>>>> start_radar_detection(). Looks safe to me.
>>>
>>> You need to think a bit more outside the regular code flows ... What if
>>> I'm not calling start_radar_detection()?
> 
>> If you are not calling start_radar_detection() you are not using
>> hostapd. With the design approach we agreed on (when we initially
>> discussed DFS years ago) to have all the logic located in hostapd, it is
>> inevitable that those who intentionally want to bypass DFS regulatory
>> restrictions actually can. You can always replace hostapd by some
>> component that handles DFS control without caring the wait times.
> 
> But this kernel patch is attempting to enforce the wait time. Are you
> saying it shouldn't even pretend to enforce it?
> 
> johannes
> 
No, it serves its purpose to ensure hostapd is not going mad and tries
to enable TX before the CAC is over via redundant checks.

What I'm saying is this: we defined that DFS regulatory compliance is
provided by and distributed over driver, mac80211, and hostapd. We
always must ensure that a working combination of those operates in
compliance. But we have no control over it when a component is exchanged
or modified.

The regulatory statement we all signed does not even ask for that, it
states that 'average users should not accidentally fail to comply...'
which can be denied to be accidental for someone running master mode
without hostapd.


Back to topic: as stated above, radar_detection_timeout should be per
wiphy. That would also resolve your concern, right?


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 13:32               ` Goldenshtein, Victor
@ 2012-06-20 14:18                 ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 14:18 UTC (permalink / raw)
  To: Goldenshtein, Victor
  Cc: Zefir Kurtisi, linux-wireless, kgiori, mcgrof, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, 2012-06-20 at 16:32 +0300, Goldenshtein, Victor wrote:
> On Wed, Jun 20, 2012 at 4:12 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Wed, 2012-06-20 at 14:58 +0200, Zefir Kurtisi wrote:
> >
> >> >> No, if you bring it back up on the same DFS channel,
> >> >> radar_detection_timeout will be set back to +60s by
> >> >> start_radar_detection(). Looks safe to me.
> >> >
> >> > You need to think a bit more outside the regular code flows ... What if
> >> > I'm not calling start_radar_detection()?
> >
> >> If you are not calling start_radar_detection() you are not using
> >> hostapd. With the design approach we agreed on (when we initially
> >> discussed DFS years ago) to have all the logic located in hostapd, it is
> >> inevitable that those who intentionally want to bypass DFS regulatory
> >> restrictions actually can. You can always replace hostapd by some
> >> component that handles DFS control without caring the wait times.
> >
> > But this kernel patch is attempting to enforce the wait time. Are you
> > saying it shouldn't even pretend to enforce it?
> >
> 
> It's not just attempts, it's ensures that no transmission will occur
> until we perform a radar detection on the channel.
> It's doesn't matter if the usermode use hostapd or some other applications.

As written, it doesn't have that effect.

johannes



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20 13:38               ` Zefir Kurtisi
@ 2012-06-20 14:19                 ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 14:19 UTC (permalink / raw)
  To: Zefir Kurtisi
  Cc: Victor Goldenshtein, linux-wireless, kgiori, mcgrof,
	adrian.chadd, j, coelho, assaf, yoni.divinsky, igalc, adrian,
	nbd, simon.wunderlich

On Wed, 2012-06-20 at 15:38 +0200, Zefir Kurtisi wrote:

> No, it serves its purpose to ensure hostapd is not going mad and tries
> to enable TX before the CAC is over via redundant checks.
> 
> What I'm saying is this: we defined that DFS regulatory compliance is
> provided by and distributed over driver, mac80211, and hostapd. We
> always must ensure that a working combination of those operates in
> compliance. But we have no control over it when a component is exchanged
> or modified.

Right, but if hostapd does something unexpected, in the code the kernel
attempts to verify that it did in fact do radar checking for a certain
minimum amount of time. I pointed out how those checks are ineffective,
and how they should be fixed.

> Back to topic: as stated above, radar_detection_timeout should be per
> wiphy. That would also resolve your concern, right?

No.

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20  8:44   ` Johannes Berg
  2012-06-20  8:46     ` Johannes Berg
@ 2012-06-20 14:34     ` Goldenshtein, Victor
  1 sibling, 0 replies; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 14:34 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 11:44 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
>
>> +     if ((!chan->radar_detect_timeout ||
>> +          time_is_after_jiffies(chan->radar_detect_timeout)) &&
>> +         (chan->flags & IEEE80211_CHAN_RADAR))
>> +             return -EPERM;
>
> Ok so you reject it if it's 0, but the jiffies calculation could return
> 0 too.. in fact, since jiffies start at -5 minutes on boot, you might
> even hit it if you start radar detection 4 minutes after boot.
>

good point, I will add additional flag to cover this corner case.

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel
  2012-06-20  8:46     ` Johannes Berg
  2012-06-20 11:53       ` Zefir Kurtisi
@ 2012-06-20 15:06       ` Goldenshtein, Victor
  1 sibling, 0 replies; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 15:06 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 11:46 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Also, it seems that the value should be reset eventually ... at least on
> interface down or so. Otherwise you can start CAC, then bring the
> interface down to stop the device, and then bring it back up (CAC check
> is no longer running) and then you can use the channel after some time
> even though you never really checked for radar...
>

np, will also reset both the timestamp + new flag during interface down.

> And if you start CAC on two different devices on the same channel, but
> they happen to share channel structs in the driver then this will all
> conflict quite badly.
>

We can just return EBUSY if the radar detection has already started on
this specific channel. Btw, this is another argument why the
"radar_detect_timeout" should be per channel.


-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
  2012-06-20  8:40 ` [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Johannes Berg
  2012-06-20 12:22   ` Zefir Kurtisi
@ 2012-06-20 16:42   ` Goldenshtein, Victor
  2012-06-20 17:40     ` Johannes Berg
  1 sibling, 1 reply; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 16:42 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 11:40 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-06-19 at 16:10 +0300, Victor Goldenshtein wrote:
>
>> +     NL80211_CMD_RADAR_DETECT,
>
> Is there no need to ever stop radar detection?
>

no, it should be always enable for DFS channels.

>> + * @radar_detect_timeout: this timeout indicates the end of the channel
>> + *   availability check for radar channels, only after this period the
>> + *   user may initiate the tx on the channel.
>
> units? internal use, or for use by drivers? should it really be stored
> in the global channel struct that could be shared for multiple devices?

will add the units.
Yes, IMHO it should be saved in the channel struct, the radar
detection is per channel so it seems very natural place, also we will
need it here for the MC.

>
>>  /**
>> + * cfg80211_radar_detected - radar detection event
>> + * @dev: network device
>> + * @freq: radar detected on this channel frequency (in MHz)
>> + * @gfp: context flags
>> + *
>> + * This function is called when a radar is detected on the current channel.
>> + */
>> +void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp);
>
> Better to pass the channel pointer?
>
>> +u16 cfg80211_calculate_bitrate(struct rate_info *rate);
>
> ??
>

sorry.. :)


>> +void cfg80211_radar_detected(struct net_device *dev, u16 freq, gfp_t gfp)
>> +{
>> +     struct wireless_dev *wdev = dev->ieee80211_ptr;
>> +     struct wiphy *wiphy = wdev->wiphy;
>> +     struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
>> +     struct ieee80211_channel *chan;
>> +
>> +     chan = ieee80211_get_channel(&rdev->wiphy, freq);
>> +     if (chan)
>> +             chan->radar_detect_timeout = 0;
>
> So how do you distinguish between having ever done radar detection and
> never even having started it? Also, jiffies + ... can return 0.
>

will add additional flag.

>
> How do you intend to handle HT40?
>

At this point we don't have such intention, but as Zefir suggested
lets first implement HT20.
To protect from transmitting on HT40 , while CAC was performed only
for HT20, will add additional check in enable_tx to validate that
we're on NL80211_CHAN_HT20 channel, otherwise will return -EINVAL.
Also, will add NL80211_ATTR_WIPHY_CHANNEL_TYPE to the
ap_channel_switch command.

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 7/7] mac80211: add DFS support to monitor interface
  2012-06-20  8:49   ` Johannes Berg
@ 2012-06-20 16:50     ` Goldenshtein, Victor
  0 siblings, 0 replies; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 16:50 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 11:49 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-06-19 at 16:11 +0300, Victor Goldenshtein wrote:
>
>> +     bool dfs_supported = !!(local->hw.wiphy->features &
>> +                             NL80211_FEATURE_DFS);
>
> No need for !!, also why not inline that into the condition?
>

I will remove the "!!", and if it's ok with you I would prefer to
leave the "dfs_supported" flag, I think it a bit simplifies this big
"if" statement.

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-20  8:47   ` Johannes Berg
@ 2012-06-20 17:17     ` Goldenshtein, Victor
  2012-06-20 17:39       ` Johannes Berg
  0 siblings, 1 reply; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-20 17:17 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 11:47 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2012-06-19 at 16:11 +0300, Victor Goldenshtein wrote:
>
>> @@ -565,6 +565,15 @@
>>   *   the time passed sines the beginning of the CAC is less than
>
> interestingly now I see a typo in the previous patch: "sines"?
>
>
>>   * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
>> + * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.
>
> what point is there in separating these flags?
>

One may support AP channel switch without DFS support, i.e. switching
to non DFS channels.

>
>> +     int     (*ap_channel_switch)(struct wiphy *wiphy, struct net_device *dev,
>> +                                  u32 count, bool block_tx,
>> +                                  bool post_switch_block_tx,
>> +                                  struct ieee80211_channel *new_ch);
>
> If mac80211 needs a struct, why not have one here already rather than
> all the parameters?
>

OK, it I will just require additional mac patch before current one, I
will split the "mac80211: add ap channel switch command/event".

-- 
Thanks,
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-20 17:17     ` Goldenshtein, Victor
@ 2012-06-20 17:39       ` Johannes Berg
  2012-06-21  5:35         ` Goldenshtein, Victor
  0 siblings, 1 reply; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 17:39 UTC (permalink / raw)
  To: Goldenshtein, Victor
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, 2012-06-20 at 20:17 +0300, Goldenshtein, Victor wrote:

> >>   * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
> >> + * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.
> >
> > what point is there in separating these flags?
> >
> 
> One may support AP channel switch without DFS support, i.e. switching
> to non DFS channels.

Oh, right, makes sense, though I'd enforce that DFS must support
chanswitch?

> >
> >> +     int     (*ap_channel_switch)(struct wiphy *wiphy, struct net_device *dev,
> >> +                                  u32 count, bool block_tx,
> >> +                                  bool post_switch_block_tx,
> >> +                                  struct ieee80211_channel *new_ch);
> >
> > If mac80211 needs a struct, why not have one here already rather than
> > all the parameters?
> >
> 
> OK, it I will just require additional mac patch before current one, I
> will split the "mac80211: add ap channel switch command/event".

Well, you'll have to move the struct definition into cfg80211 and into
this patch I think.

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event
  2012-06-20 16:42   ` Goldenshtein, Victor
@ 2012-06-20 17:40     ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-20 17:40 UTC (permalink / raw)
  To: Goldenshtein, Victor
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, 2012-06-20 at 19:42 +0300, Goldenshtein, Victor wrote:

> > How do you intend to handle HT40?
> >
> 
> At this point we don't have such intention, but as Zefir suggested
> lets first implement HT20.
> To protect from transmitting on HT40 , while CAC was performed only
> for HT20, will add additional check in enable_tx to validate that
> we're on NL80211_CHAN_HT20 channel, otherwise will return -EINVAL.
> Also, will add NL80211_ATTR_WIPHY_CHANNEL_TYPE to the
> ap_channel_switch command.

Ok, makes sense, thanks

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-20 17:39       ` Johannes Berg
@ 2012-06-21  5:35         ` Goldenshtein, Victor
  2012-06-21  7:06           ` Johannes Berg
  0 siblings, 1 reply; 33+ messages in thread
From: Goldenshtein, Victor @ 2012-06-21  5:35 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Wed, Jun 20, 2012 at 8:39 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2012-06-20 at 20:17 +0300, Goldenshtein, Victor wrote:
>
>> >>   * @NL80211_FEATURE_DFS: Radar detection is supported in the HW/driver.
>> >> + * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.
>> >
>> > what point is there in separating these flags?
>> >
>>
>> One may support AP channel switch without DFS support, i.e. switching
>> to non DFS channels.
>
> Oh, right, makes sense, though I'd enforce that DFS must support
> chanswitch?
>

we already do that, hostapd can start working on DFS channels only if
both flags are set.

>> >
>> >> +     int     (*ap_channel_switch)(struct wiphy *wiphy, struct net_device *dev,
>> >> +                                  u32 count, bool block_tx,
>> >> +                                  bool post_switch_block_tx,
>> >> +                                  struct ieee80211_channel *new_ch);
>> >
>> > If mac80211 needs a struct, why not have one here already rather than
>> > all the parameters?
>> >
>>
>> OK, it I will just require additional mac patch before current one, I
>> will split the "mac80211: add ap channel switch command/event".
>
> Well, you'll have to move the struct definition into cfg80211 and into
> this patch I think.
>

The STA channel switch struct (struct ieee80211_channel_switch) is
defined in mac80211.h, thus I think the new struct for the ap channel
switch should be also there, I will just split the mac patch into two.


And, almost forgot, thanks for reviewing so many patches in one day ;-)

-- 
Victor.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event
  2012-06-21  5:35         ` Goldenshtein, Victor
@ 2012-06-21  7:06           ` Johannes Berg
  0 siblings, 0 replies; 33+ messages in thread
From: Johannes Berg @ 2012-06-21  7:06 UTC (permalink / raw)
  To: Goldenshtein, Victor
  Cc: linux-wireless, kgiori, mcgrof, zefir.kurtisi, adrian.chadd, j,
	coelho, assaf, yoni.divinsky, igalc, adrian, nbd,
	simon.wunderlich

On Thu, 2012-06-21 at 08:35 +0300, Goldenshtein, Victor wrote:

> > Well, you'll have to move the struct definition into cfg80211 and into
> > this patch I think.
> >
> 
> The STA channel switch struct (struct ieee80211_channel_switch) is
> defined in mac80211.h, thus I think the new struct for the ap channel
> switch should be also there, I will just split the mac patch into two.

You can't use mac80211 structs from cfg80211 though, and for STA channel
switch cfg80211 isn't involved ... you do need to move the struct
definition :)

johannes


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2012-06-21  7:07 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 13:10 [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Victor Goldenshtein
2012-06-19 13:10 ` [PATCH v2 2/7] mac80211: " Victor Goldenshtein
2012-06-20  8:40   ` Johannes Berg
2012-06-19 13:10 ` [PATCH v2 3/7] nl80211/cfg80211: add ability to enable TX on op-channel Victor Goldenshtein
2012-06-20  8:44   ` Johannes Berg
2012-06-20  8:46     ` Johannes Berg
2012-06-20 11:53       ` Zefir Kurtisi
2012-06-20 11:57         ` Johannes Berg
2012-06-20 12:58           ` Zefir Kurtisi
2012-06-20 13:12             ` Johannes Berg
2012-06-20 13:32               ` Goldenshtein, Victor
2012-06-20 14:18                 ` Johannes Berg
2012-06-20 13:38               ` Zefir Kurtisi
2012-06-20 14:19                 ` Johannes Berg
2012-06-20 15:06       ` Goldenshtein, Victor
2012-06-20 14:34     ` Goldenshtein, Victor
2012-06-19 13:11 ` [PATCH v2 4/7] mac80211: " Victor Goldenshtein
2012-06-19 13:11 ` [PATCH v2 5/7] nl80211/cfg80211: add ap channel switch command/event Victor Goldenshtein
2012-06-20  8:47   ` Johannes Berg
2012-06-20 17:17     ` Goldenshtein, Victor
2012-06-20 17:39       ` Johannes Berg
2012-06-21  5:35         ` Goldenshtein, Victor
2012-06-21  7:06           ` Johannes Berg
2012-06-19 13:11 ` [PATCH v2 6/7] mac80211: " Victor Goldenshtein
2012-06-20  8:48   ` Johannes Berg
2012-06-19 13:11 ` [PATCH v2 7/7] mac80211: add DFS support to monitor interface Victor Goldenshtein
2012-06-20  8:49   ` Johannes Berg
2012-06-20 16:50     ` Goldenshtein, Victor
2012-06-20  8:40 ` [PATCH v2 1/7] nl80211/cfg80211: add radar detection command/event Johannes Berg
2012-06-20 12:22   ` Zefir Kurtisi
2012-06-20 12:29     ` Johannes Berg
2012-06-20 16:42   ` Goldenshtein, Victor
2012-06-20 17:40     ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.