2010-11-26 12:43:07

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH] wl12xx: disable 11a channels when regulatory changes if 11a is not supported

From: Luciano Coelho <[email protected]>

Instead of simply not scanning for the 11a channels when not supported by the
hardware, disable the channels in reg_notify. This centralizes the decision
on whether to scan 5GHz channel in one place and allows userspace to know
exactly which channels are in use.

Based on Juuso Oikarinen's idea.

Cc: Juuso Oikarinen <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/wl12xx/main.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 35cfcf6..97eb186 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -336,7 +336,9 @@ out:
}

static int wl1271_reg_notify(struct wiphy *wiphy,
- struct regulatory_request *request) {
+ struct regulatory_request *request)
+{
+ struct wl1271 *wl = wiphy_to_ieee80211_hw(wiphy)->priv;
struct ieee80211_supported_band *band;
struct ieee80211_channel *ch;
int i;
@@ -347,6 +349,11 @@ static int wl1271_reg_notify(struct wiphy *wiphy,
if (ch->flags & IEEE80211_CHAN_DISABLED)
continue;

+ if (!wl->enable_11a) {
+ ch->flags |= IEEE80211_CHAN_DISABLED;
+ continue;
+ }
+
if (ch->flags & IEEE80211_CHAN_RADAR)
ch->flags |= IEEE80211_CHAN_NO_IBSS |
IEEE80211_CHAN_PASSIVE_SCAN;
--
1.7.0.4



2010-11-26 13:18:43

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH] wl12xx: disable 11a channels when regulatory changes if 11a is not supported

On Fri, 2010-11-26 at 14:14 +0100, ext Johannes Berg wrote:
> On Fri, 2010-11-26 at 14:43 +0200, [email protected] wrote:
> > From: Luciano Coelho <[email protected]>
> >
> > Instead of simply not scanning for the 11a channels when not supported by the
> > hardware, disable the channels in reg_notify. This centralizes the decision
> > on whether to scan 5GHz channel in one place and allows userspace to know
> > exactly which channels are in use.
>
> Why are you advertising them to start with though?

Because the driver support chips with and without 11a (namely wl1273 and
wl1271). When we register the channels with mac80211, we don't know
whether the chip supports 11a or not, so we need to decide at runtime.

--
Cheers,
Luca.


2010-11-26 13:14:19

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wl12xx: disable 11a channels when regulatory changes if 11a is not supported

On Fri, 2010-11-26 at 14:43 +0200, [email protected] wrote:
> From: Luciano Coelho <[email protected]>
>
> Instead of simply not scanning for the 11a channels when not supported by the
> hardware, disable the channels in reg_notify. This centralizes the decision
> on whether to scan 5GHz channel in one place and allows userspace to know
> exactly which channels are in use.

Why are you advertising them to start with though?

johannes


2010-11-26 13:04:08

by Juuso Oikarinen

[permalink] [raw]
Subject: Re: [PATCH] wl12xx: disable 11a channels when regulatory changes if 11a is not supported

On Fri, 2010-11-26 at 14:43 +0200, [email protected] wrote:
> From: Luciano Coelho <[email protected]>
>
> Instead of simply not scanning for the 11a channels when not supported by the
> hardware, disable the channels in reg_notify. This centralizes the decision
> on whether to scan 5GHz channel in one place and allows userspace to know
> exactly which channels are in use.
>
> Based on Juuso Oikarinen's idea.
>
> Cc: Juuso Oikarinen <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>
> ---
> drivers/net/wireless/wl12xx/main.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
> index 35cfcf6..97eb186 100644
> --- a/drivers/net/wireless/wl12xx/main.c
> +++ b/drivers/net/wireless/wl12xx/main.c
> @@ -336,7 +336,9 @@ out:
> }
>
> static int wl1271_reg_notify(struct wiphy *wiphy,
> - struct regulatory_request *request) {
> + struct regulatory_request *request)
> +{
> + struct wl1271 *wl = wiphy_to_ieee80211_hw(wiphy)->priv;
> struct ieee80211_supported_band *band;
> struct ieee80211_channel *ch;
> int i;
> @@ -347,6 +349,11 @@ static int wl1271_reg_notify(struct wiphy *wiphy,
> if (ch->flags & IEEE80211_CHAN_DISABLED)
> continue;
>
> + if (!wl->enable_11a) {
> + ch->flags |= IEEE80211_CHAN_DISABLED;
> + continue;
> + }
> +
> if (ch->flags & IEEE80211_CHAN_RADAR)
> ch->flags |= IEEE80211_CHAN_NO_IBSS |
> IEEE80211_CHAN_PASSIVE_SCAN;

I think this is more verbose towards user-space this way.

Reviewed-by: Juuso Oikarinen <[email protected]>

-Juuso


2010-11-26 13:08:48

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH] wl12xx: disable 11a channels when regulatory changes if 11a is not supported

On Fri, 2010-11-26 at 15:03 +0200, Juuso Oikarinen wrote:
> On Fri, 2010-11-26 at 14:43 +0200, [email protected] wrote:
> > From: Luciano Coelho <[email protected]>
> >
> > Instead of simply not scanning for the 11a channels when not supported by the
> > hardware, disable the channels in reg_notify. This centralizes the decision
> > on whether to scan 5GHz channel in one place and allows userspace to know
> > exactly which channels are in use.
> >
> > Based on Juuso Oikarinen's idea.
> >
> > Cc: Juuso Oikarinen <[email protected]>
> > Signed-off-by: Luciano Coelho <[email protected]>
> > ---

[...]

> I think this is more verbose towards user-space this way.

Yeah, and will help with the sched_scan code too.

> Reviewed-by: Juuso Oikarinen <[email protected]>

Thanks! Applied and pushed to wl12xx.

--
Cheers,
Luca.