All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows
@ 2017-07-07  9:56 Emmanuel Grumbach
  2017-07-07 10:00 ` [PATCH] cfg80211: honor NL80211_RRF_NO_HT40{MINUS,PLUS} Emmanuel Grumbach
  2017-07-07 10:04 ` [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach
  0 siblings, 2 replies; 3+ messages in thread
From: Emmanuel Grumbach @ 2017-07-07  9:56 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Emmanuel Grumbach, [4.0+]

When the regulatory is handled by the driver, don't
interact with the flags it sets.
iwlwifi doesn't want to use channel 40 HT40+ for example.

Cc: <stable@vger.kernel.org> [4.0+]
Fixes: b0d7aa59592b ("cfg80211: allow wiphy specific regdomain management")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/wireless/reg.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5fae296a6a58..29879440626e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -4,6 +4,7 @@
  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2008-2011	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright      2017  Intel Deutschland GmbH
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -1483,7 +1484,9 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 {
 	struct ieee80211_supported_band *sband = wiphy->bands[channel->band];
 	struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
+	const struct ieee80211_regdomain *regd;
 	unsigned int i;
+	u32 flags;
 
 	if (!is_ht40_allowed(channel)) {
 		channel->flags |= IEEE80211_CHAN_NO_HT40;
@@ -1503,17 +1506,30 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 			channel_after = c;
 	}
 
+	regd = get_wiphy_regdom(wiphy);
+	if (regd) {
+		const struct ieee80211_reg_rule *reg_rule =
+			freq_reg_info_regd(MHZ_TO_KHZ(channel->center_freq),
+					   regd, MHZ_TO_KHZ(20));
+
+		flags = reg_rule->flags;
+	} else {
+		flags = 0;
+	}
+
 	/*
 	 * Please note that this assumes target bandwidth is 20 MHz,
 	 * if that ever changes we also need to change the below logic
 	 * to include that as well.
 	 */
-	if (!is_ht40_allowed(channel_before))
+	if (!is_ht40_allowed(channel_before) ||
+	    flags & NL80211_RRF_NO_HT40MINUS)
 		channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
 	else
 		channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
 
-	if (!is_ht40_allowed(channel_after))
+	if (!is_ht40_allowed(channel_after) ||
+	    flags & NL80211_RRF_NO_HT40PLUS)
 		channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
 	else
 		channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
-- 
2.9.3

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

* [PATCH] cfg80211: honor NL80211_RRF_NO_HT40{MINUS,PLUS}
  2017-07-07  9:56 [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach
@ 2017-07-07 10:00 ` Emmanuel Grumbach
  2017-07-07 10:04 ` [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach
  1 sibling, 0 replies; 3+ messages in thread
From: Emmanuel Grumbach @ 2017-07-07 10:00 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Emmanuel Grumbach

Honor the NL80211_RRF_NO_HT40{MINUS,PLUS} flags in
reg_process_ht_flags_channel. Not doing so leads can lead
to a firmware assert in iwlwifi for example.

Fixes: b0d7aa59592b ("cfg80211: allow wiphy specific regdomain management")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 net/wireless/reg.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5fae296a6a58..29879440626e 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -4,6 +4,7 @@
  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2008-2011	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright      2017  Intel Deutschland GmbH
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -1483,7 +1484,9 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 {
 	struct ieee80211_supported_band *sband = wiphy->bands[channel->band];
 	struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
+	const struct ieee80211_regdomain *regd;
 	unsigned int i;
+	u32 flags;
 
 	if (!is_ht40_allowed(channel)) {
 		channel->flags |= IEEE80211_CHAN_NO_HT40;
@@ -1503,17 +1506,30 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 			channel_after = c;
 	}
 
+	regd = get_wiphy_regdom(wiphy);
+	if (regd) {
+		const struct ieee80211_reg_rule *reg_rule =
+			freq_reg_info_regd(MHZ_TO_KHZ(channel->center_freq),
+					   regd, MHZ_TO_KHZ(20));
+
+		flags = reg_rule->flags;
+	} else {
+		flags = 0;
+	}
+
 	/*
 	 * Please note that this assumes target bandwidth is 20 MHz,
 	 * if that ever changes we also need to change the below logic
 	 * to include that as well.
 	 */
-	if (!is_ht40_allowed(channel_before))
+	if (!is_ht40_allowed(channel_before) ||
+	    flags & NL80211_RRF_NO_HT40MINUS)
 		channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
 	else
 		channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
 
-	if (!is_ht40_allowed(channel_after))
+	if (!is_ht40_allowed(channel_after) ||
+	    flags & NL80211_RRF_NO_HT40PLUS)
 		channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
 	else
 		channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
-- 
2.9.3

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

* Re: [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows
  2017-07-07  9:56 [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach
  2017-07-07 10:00 ` [PATCH] cfg80211: honor NL80211_RRF_NO_HT40{MINUS,PLUS} Emmanuel Grumbach
@ 2017-07-07 10:04 ` Emmanuel Grumbach
  1 sibling, 0 replies; 3+ messages in thread
From: Emmanuel Grumbach @ 2017-07-07 10:04 UTC (permalink / raw)
  To: Emmanuel Grumbach; +Cc: Johannes Berg, linux-wireless, [4.0+]

On Fri, Jul 7, 2017 at 12:56 PM, Emmanuel Grumbach
<emmanuel.grumbach@intel.com> wrote:
> When the regulatory is handled by the driver, don't
> interact with the flags it sets.
> iwlwifi doesn't want to use channel 40 HT40+ for example.
>
> Cc: <stable@vger.kernel.org> [4.0+]
> Fixes: b0d7aa59592b ("cfg80211: allow wiphy specific regdomain management")
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

I sent a v2 for this, but forgot to change the subject to PATCH v2...
Sorry for the mess.
In the v2, I just changed the commit log.

> ---
>  net/wireless/reg.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 5fae296a6a58..29879440626e 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -4,6 +4,7 @@
>   * Copyright 2007      Johannes Berg <johannes@sipsolutions.net>
>   * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
>   * Copyright 2013-2014  Intel Mobile Communications GmbH
> + * Copyright      2017  Intel Deutschland GmbH
>   *
>   * Permission to use, copy, modify, and/or distribute this software for any
>   * purpose with or without fee is hereby granted, provided that the above
> @@ -1483,7 +1484,9 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
>  {
>         struct ieee80211_supported_band *sband = wiphy->bands[channel->band];
>         struct ieee80211_channel *channel_before = NULL, *channel_after = NULL;
> +       const struct ieee80211_regdomain *regd;
>         unsigned int i;
> +       u32 flags;
>
>         if (!is_ht40_allowed(channel)) {
>                 channel->flags |= IEEE80211_CHAN_NO_HT40;
> @@ -1503,17 +1506,30 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
>                         channel_after = c;
>         }
>
> +       regd = get_wiphy_regdom(wiphy);
> +       if (regd) {
> +               const struct ieee80211_reg_rule *reg_rule =
> +                       freq_reg_info_regd(MHZ_TO_KHZ(channel->center_freq),
> +                                          regd, MHZ_TO_KHZ(20));
> +
> +               flags = reg_rule->flags;
> +       } else {
> +               flags = 0;
> +       }
> +
>         /*
>          * Please note that this assumes target bandwidth is 20 MHz,
>          * if that ever changes we also need to change the below logic
>          * to include that as well.
>          */
> -       if (!is_ht40_allowed(channel_before))
> +       if (!is_ht40_allowed(channel_before) ||
> +           flags & NL80211_RRF_NO_HT40MINUS)
>                 channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
>         else
>                 channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
>
> -       if (!is_ht40_allowed(channel_after))
> +       if (!is_ht40_allowed(channel_after) ||
> +           flags & NL80211_RRF_NO_HT40PLUS)
>                 channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
>         else
>                 channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
> --
> 2.9.3
>

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

end of thread, other threads:[~2017-07-07 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07  9:56 [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach
2017-07-07 10:00 ` [PATCH] cfg80211: honor NL80211_RRF_NO_HT40{MINUS,PLUS} Emmanuel Grumbach
2017-07-07 10:04 ` [PATCH] cfg80211: don't change the regulatory HT flags in custom regulatory flows Emmanuel Grumbach

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.