All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] wireless: use channel bandwidth
@ 2009-03-10  2:04 Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 1/4] cfg80211: check allowed channel max bandwidth before setting HT40 Luis R. Rodriguez
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  2:04 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

Few patches which actually make use of the channel bandwidth, lets
also send this to userspace as it useful to tell which channels you'll
be able to use HT40 or not on as a client.

Luis R. Rodriguez (4):
  cfg80211: check allowed channel max bandwidth before setting HT40
  mac80211: move early error branch check on ieee80211_set_freq()
  mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  cfg80211: send channel max bandwidth to userspace

 include/linux/nl80211.h |    3 +++
 net/mac80211/util.c     |   30 +++++++++++++++++-------------
 net/wireless/nl80211.c  |    9 ++++++++-
 3 files changed, 28 insertions(+), 14 deletions(-)


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

* [PATCH 1/4] cfg80211: check allowed channel max bandwidth before setting HT40
  2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
@ 2009-03-10  2:04 ` Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 2/4] mac80211: move early error branch check on ieee80211_set_freq() Luis R. Rodriguez
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  2:04 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/nl80211.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 531bb67..08d4f55 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -398,6 +398,12 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 		/* Primary channel not allowed */
 		if (!chan || chan->flags & IEEE80211_CHAN_DISABLED)
 			goto bad_res;
+		/* You need 40 MHz for an HT40 channel */
+		if (channel_type == NL80211_CHAN_HT40PLUS ||
+		    channel_type == NL80211_CHAN_HT40MINUS) {
+			if (chan->max_bandwidth < 40)
+				goto bad_res;
+		}
 
 		if (channel_type == NL80211_CHAN_HT40MINUS)
 			sec_freq = freq - 20;
-- 
1.6.0.6


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

* [PATCH 2/4] mac80211: move early error branch check on ieee80211_set_freq()
  2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 1/4] cfg80211: check allowed channel max bandwidth before setting HT40 Luis R. Rodriguez
@ 2009-03-10  2:04 ` Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz Luis R. Rodriguez
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  2:04 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

This has no functional change, we just move the bad case error check
early as we will soon add some more and this will make this easier to
read.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/mac80211/util.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e0431a1..32610a0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -793,19 +793,20 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
 
 	chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
 
-	if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
-		if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-		    chan->flags & IEEE80211_CHAN_NO_IBSS)
-			return ret;
-		local->oper_channel = chan;
-		local->oper_channel_type = NL80211_CHAN_NO_HT;
-
-		if (local->sw_scanning || local->hw_scanning)
-			ret = 0;
-		else
-			ret = ieee80211_hw_config(
-				local, IEEE80211_CONF_CHANGE_CHANNEL);
-	}
+	if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED))
+		return ret;
+
+	if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
+	    chan->flags & IEEE80211_CHAN_NO_IBSS)
+		return ret;
+	local->oper_channel = chan;
+	local->oper_channel_type = NL80211_CHAN_NO_HT;
+
+	if (local->sw_scanning || local->hw_scanning)
+		ret = 0;
+	else
+		ret = ieee80211_hw_config(
+			local, IEEE80211_CONF_CHANGE_CHANNEL);
 
 	return ret;
 }
-- 
1.6.0.6


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

* [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 1/4] cfg80211: check allowed channel max bandwidth before setting HT40 Luis R. Rodriguez
  2009-03-10  2:04 ` [PATCH 2/4] mac80211: move early error branch check on ieee80211_set_freq() Luis R. Rodriguez
@ 2009-03-10  2:04 ` Luis R. Rodriguez
  2009-03-10  7:15   ` Johannes Berg
  2009-03-10  2:04 ` [PATCH 4/4] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
  2009-03-10  7:16 ` [PATCH 0/4] wireless: use channel bandwidth Johannes Berg
  4 siblings, 1 reply; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  2:04 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/mac80211/util.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 32610a0..a891d7e 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -796,6 +796,9 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
 	if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED))
 		return ret;
 
+	if (conf_is_ht40(&local->hw.conf) && chan->max_bandwidth < 40)
+		return ret;
+
 	if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
 	    chan->flags & IEEE80211_CHAN_NO_IBSS)
 		return ret;
-- 
1.6.0.6


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

* [PATCH 4/4] cfg80211: send channel max bandwidth to userspace
  2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2009-03-10  2:04 ` [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz Luis R. Rodriguez
@ 2009-03-10  2:04 ` Luis R. Rodriguez
  2009-03-10  7:16 ` [PATCH 0/4] wireless: use channel bandwidth Johannes Berg
  4 siblings, 0 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  2:04 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/linux/nl80211.h |    3 +++
 net/wireless/nl80211.c  |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index f6e5637..55565a4 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -639,6 +639,7 @@ enum nl80211_band_attr {
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
  *	(100 * dBm).
+ * @NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH: max bandwidth allowed, given in MHz
  */
 enum nl80211_frequency_attr {
 	__NL80211_FREQUENCY_ATTR_INVALID,
@@ -648,6 +649,7 @@ enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_NO_IBSS,
 	NL80211_FREQUENCY_ATTR_RADAR,
 	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+	NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -655,6 +657,7 @@ enum nl80211_frequency_attr {
 };
 
 #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+#define NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH
 
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 08d4f55..4827020 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -207,9 +207,10 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS);
 			if (chan->flags & IEEE80211_CHAN_RADAR)
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR);
-
 			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 				    DBM_TO_MBM(chan->max_power));
+			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
+				    chan->max_bandwidth);
 
 			nla_nest_end(msg, nl_freq);
 		}
-- 
1.6.0.6


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

* Re: [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  2009-03-10  2:04 ` [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz Luis R. Rodriguez
@ 2009-03-10  7:15   ` Johannes Berg
  2009-03-10  8:43     ` Luis R. Rodriguez
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2009-03-10  7:15 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 719 bytes --]

On Mon, 2009-03-09 at 22:04 -0400, Luis R. Rodriguez wrote:
> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
> ---
>  net/mac80211/util.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> index 32610a0..a891d7e 100644
> --- a/net/mac80211/util.c
> +++ b/net/mac80211/util.c
> @@ -796,6 +796,9 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
>  	if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED))
>  		return ret;
>  
> +	if (conf_is_ht40(&local->hw.conf) && chan->max_bandwidth < 40)
> +		return ret;
> +

You just made nl80211 check this, why bother adding it here too?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 0/4] wireless: use channel bandwidth
  2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  2009-03-10  2:04 ` [PATCH 4/4] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
@ 2009-03-10  7:16 ` Johannes Berg
  2009-03-10  8:43   ` Luis R. Rodriguez
  4 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2009-03-10  7:16 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

On Mon, 2009-03-09 at 22:04 -0400, Luis R. Rodriguez wrote:
> Few patches which actually make use of the channel bandwidth, lets
> also send this to userspace as it useful to tell which channels you'll
> be able to use HT40 or not on as a client.

Can you remind me why we have that max_bandwidth at all? It seems we
would be able to see whether ht40 fits by checking the above/below
sideband channel for use permission.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 0/4] wireless: use channel bandwidth
  2009-03-10  7:16 ` [PATCH 0/4] wireless: use channel bandwidth Johannes Berg
@ 2009-03-10  8:43   ` Luis R. Rodriguez
  0 siblings, 0 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  8:43 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Tue, Mar 10, 2009 at 12:16 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2009-03-09 at 22:04 -0400, Luis R. Rodriguez wrote:
>> Few patches which actually make use of the channel bandwidth, lets
>> also send this to userspace as it useful to tell which channels you'll
>> be able to use HT40 or not on as a client.
>
> Can you remind me why we have that max_bandwidth at all? It seems we
> would be able to see whether ht40 fits by checking the above/below
> sideband channel for use permission.

To allow you to create bands for your regulatory domain and give easy
access to the allowed bandwidth. A good example is the world
regulatory domain right now with no HT40 for channels 12, 13 and 14.
cfg80211 does the checks for us only once upon regulatory domain
changes and that work gives us easy access to the allowed possible
channel width. The alternative is to call something like
freq_reg_info() on this call path and do the check in the places we
need.

Originally we had the NO-HT20 and NO-HT40 flags but as it turns out
HT20 is now allowed everywhere and we determine we can just use the
channel bandwidth to figure out whether or not you can use HT40.

  Luis

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

* Re: [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  2009-03-10  7:15   ` Johannes Berg
@ 2009-03-10  8:43     ` Luis R. Rodriguez
  2009-03-10  8:46       ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  8:43 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Tue, Mar 10, 2009 at 12:15 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2009-03-09 at 22:04 -0400, Luis R. Rodriguez wrote:
>> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
>> ---
>> =C2=A0net/mac80211/util.c | =C2=A0 =C2=A03 +++
>> =C2=A01 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/net/mac80211/util.c b/net/mac80211/util.c
>> index 32610a0..a891d7e 100644
>> --- a/net/mac80211/util.c
>> +++ b/net/mac80211/util.c
>> @@ -796,6 +796,9 @@ int ieee80211_set_freq(struct ieee80211_sub_if_d=
ata *sdata, int freqMHz)
>> =C2=A0 =C2=A0 =C2=A0 if (!chan || (chan->flags & IEEE80211_CHAN_DISA=
BLED))
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return ret;
>>
>> + =C2=A0 =C2=A0 if (conf_is_ht40(&local->hw.conf) && chan->max_bandw=
idth < 40)
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return ret;
>> +
>
> You just made nl80211 check this, why bother adding it here too?

Wext crap.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  2009-03-10  8:43     ` Luis R. Rodriguez
@ 2009-03-10  8:46       ` Johannes Berg
  2009-03-10  8:51         ` Luis R. Rodriguez
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2009-03-10  8:46 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

On Tue, 2009-03-10 at 01:43 -0700, Luis R. Rodriguez wrote:

> >> +     if (conf_is_ht40(&local->hw.conf) && chan->max_bandwidth < 40)
> >> +             return ret;
> >> +
> >
> > You just made nl80211 check this, why bother adding it here too?
> 
> Wext crap.

Wext can't set ht40, it'll always reset back to 20mhz when you set
channel with wext.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz
  2009-03-10  8:46       ` Johannes Berg
@ 2009-03-10  8:51         ` Luis R. Rodriguez
  0 siblings, 0 replies; 11+ messages in thread
From: Luis R. Rodriguez @ 2009-03-10  8:51 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Tue, Mar 10, 2009 at 1:46 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2009-03-10 at 01:43 -0700, Luis R. Rodriguez wrote:
>
>> >> + =C2=A0 =C2=A0 if (conf_is_ht40(&local->hw.conf) && chan->max_ba=
ndwidth < 40)
>> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return ret;
>> >> +
>> >
>> > You just made nl80211 check this, why bother adding it here too?
>>
>> Wext crap.
>
> Wext can't set ht40, it'll always reset back to 20mhz when you set
> channel with wext.

Ah, but we can eventually get there with setting the ssid, guess I'll
have to review that path.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-03-10  8:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10  2:04 [PATCH 0/4] wireless: use channel bandwidth Luis R. Rodriguez
2009-03-10  2:04 ` [PATCH 1/4] cfg80211: check allowed channel max bandwidth before setting HT40 Luis R. Rodriguez
2009-03-10  2:04 ` [PATCH 2/4] mac80211: move early error branch check on ieee80211_set_freq() Luis R. Rodriguez
2009-03-10  2:04 ` [PATCH 3/4] mac80211: disallow HT40 if max channel bandwidth is less than 40 MHz Luis R. Rodriguez
2009-03-10  7:15   ` Johannes Berg
2009-03-10  8:43     ` Luis R. Rodriguez
2009-03-10  8:46       ` Johannes Berg
2009-03-10  8:51         ` Luis R. Rodriguez
2009-03-10  2:04 ` [PATCH 4/4] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
2009-03-10  7:16 ` [PATCH 0/4] wireless: use channel bandwidth Johannes Berg
2009-03-10  8:43   ` Luis R. Rodriguez

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.