diff mbox

cfg80211: check for carrier state only when offchanel CAC supported

Message ID 1419425236-17457-1-git-send-email-patila@marvell.com (mailing list archive)
State Rejected
Delegated to: Johannes Berg
Headers show

Commit Message

Avinash Patil Dec. 24, 2014, 12:47 p.m. UTC
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(-)

Comments

Arend van Spriel Dec. 24, 2014, 11:18 p.m. UTC | #1
On 12/24/14 13:47, Avinash Patil wrote:
> 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).

continuation on next line should be indented with a tab.

Regards,
Arend

>    * @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)

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Jan. 5, 2015, 9:21 a.m. UTC | #2
On Wed, 2014-12-24 at 04:47 -0800, Avinash Patil wrote:

> + * @NL80211_EXT_FEATURE_OFFCHAN_CAC: This device/driver supports
> + * offchannel Channel Availibility Check(CAC).

as Arend said, please indent (with a tab)

You're also mis-spelling "availability" :)

>   * @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,

Better add it before rather than after the blank line.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avinash Patil Jan. 5, 2015, 10:58 a.m. UTC | #3

diff mbox

Patch

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)