linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: check for carrier state only when offchanel CAC supported
@ 2014-12-24 12:47 Avinash Patil
  2014-12-24 23:18 ` Arend van Spriel
  2015-01-05  9:21 ` Johannes Berg
  0 siblings, 2 replies; 9+ messages in thread
From: Avinash Patil @ 2014-12-24 12:47 UTC (permalink / raw)
  To: linux-wireless; +Cc: akarwar, cluo, janusz.dziedzic, johannes, Avinash Patil

Checking for carrier state during start_radar_detection is needed
only for devices which support offchannel CAC.
This patch provides this additional check of extended feature offchannel
CAC support while checking for carrier state.

Signed-off-by: Avinash Patil <patila@marvell.com>
---
 include/uapi/linux/nl80211.h | 3 +++
 net/wireless/nl80211.c       | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 735ab43..9ac9008 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4205,11 +4205,14 @@ enum nl80211_feature_flags {
 /**
  * enum nl80211_ext_feature_index - bit index of extended features.
  *
+ * @NL80211_EXT_FEATURE_OFFCHAN_CAC: This device/driver supports
+ * offchannel Channel Availibility Check(CAC).
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
 enum nl80211_ext_feature_index {
 
+	NL80211_EXT_FEATURE_OFFCHAN_CAC,
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
 	MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 39753de..b2abb37 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6138,7 +6138,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
 	if (err)
 		return err;
 
-	if (netif_carrier_ok(dev))
+	if (wiphy_ext_feature_isset(&rdev->wiphy,
+				    NL80211_EXT_FEATURE_OFFCHAN_CAC) &&
+	    netif_carrier_ok(dev))
 		return -EBUSY;
 
 	if (wdev->cac_started)
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] cfg80211: check for carrier state only when offchanel CAC supported
@ 2014-12-23 20:05 Avinash Patil
  2014-12-23 14:53 ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Avinash Patil @ 2014-12-23 20:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: akarwar, cluo, janusz.dziedzic, johannes, Avinash Patil

Checking for carrier state during start_radar_detection is needed
only for devices which support offchannel CAC.
This patch adds one more condition while checking for carrier state
to see if offchanel CAC is supported, else we need not check carrier
state.

Signed-off-by: Avinash Patil <patila@marvell.com>
---
 include/net/cfg80211.h | 2 ++
 net/wireless/nl80211.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 4ebb816..1b80302 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2740,6 +2740,7 @@ struct cfg80211_ops {
  * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
  * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
  *	beaconing mode (AP, IBSS, Mesh, ...).
+ * @WIPHY_FLAG_OFFCHAN_CAC: Device supports offchannel CAC.
  */
 enum wiphy_flags {
 	/* use hole at 0 */
@@ -2765,6 +2766,7 @@ enum wiphy_flags {
 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
 	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
 	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
+	WIPHY_FLAG_OFFCHAN_CAC			= BIT(24),
 };
 
 /**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a17d6bc..40290a5 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6133,7 +6133,8 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
 	if (err)
 		return err;
 
-	if (netif_carrier_ok(dev))
+	if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_CAC) &&
+	    netif_carrier_ok(dev))
 		return -EBUSY;
 
 	if (wdev->cac_started)
-- 
1.8.1.4


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

end of thread, other threads:[~2015-01-05 10:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24 12:47 [PATCH] cfg80211: check for carrier state only when offchanel CAC supported Avinash Patil
2014-12-24 23:18 ` Arend van Spriel
2015-01-05  9:21 ` Johannes Berg
2015-01-05 10:58   ` Avinash Patil
  -- strict thread matches above, loose matches on Subject: below --
2014-12-23 20:05 Avinash Patil
2014-12-23 14:53 ` Johannes Berg
2014-12-23 15:34   ` Arend van Spriel
2014-12-23 15:38     ` Johannes Berg
2014-12-23 15:40       ` Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).