2008-02-02 22:53:38

by Ivo Van Doorn

[permalink] [raw]
Subject: [PATCH] wireless: Fix WARN_ON() with ieee802.11b

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates
are registered "want" will be 3 (since 4 rates are being registered,
and each of those 4 rates will decrease "want").
Since this is a correct situation, there is no need to trigger
a WARN_ON() for this.

Signed-off-by: Ivo van Doorn <[email protected]>

---
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 0dcccbf..5304c62 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
sband->bitrates[i].flags |=
IEEE80211_RATE_ERP_G;
}
- WARN_ON(want != 0 && want != 6);
+ WARN_ON(want != 0 && want != 3 && want != 6);
break;
case IEEE80211_NUM_BANDS:
WARN_ON(1);


2008-02-03 10:21:28

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wireless: Fix WARN_ON() with ieee802.11b


> When the driver registers a IEEE80211_BAND_2GHZ band,
> it can either be 802.11b or 802.11g. But when 802.11b rates
> are registered "want" will be 3 (since 4 rates are being registered,
> and each of those 4 rates will decrease "want").

Huh, yeah, you're right, this is a thinko.

> - WARN_ON(want != 0 && want != 6);
> + WARN_ON(want != 0 && want != 3 && want != 6);

However, I think it should just be

WARN_ON(want != 0 && want != 3);

6 just doesn't make sense, does it?

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2008-02-03 01:39:58

by Nick Kossifidis

[permalink] [raw]
Subject: Re: [PATCH] wireless: Fix WARN_ON() with ieee802.11b

2008/2/3, Ivo van Doorn <[email protected]>:
> When the driver registers a IEEE80211_BAND_2GHZ band,
> it can either be 802.11b or 802.11g. But when 802.11b rates
> are registered "want" will be 3 (since 4 rates are being registered,
> and each of those 4 rates will decrease "want").
> Since this is a correct situation, there is no need to trigger
> a WARN_ON() for this.
>
> Signed-off-by: Ivo van Doorn <[email protected]>
>
> ---
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 0dcccbf..5304c62 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
> sband->bitrates[i].flags |=
> IEEE80211_RATE_ERP_G;
> }
> - WARN_ON(want != 0 && want != 6);
> + WARN_ON(want != 0 && want != 3 && want != 6);
> break;
> case IEEE80211_NUM_BANDS:
> WARN_ON(1);

Had the same problem when registering an AR5211 card (a/b only), this
patch fixes it ;-)

Acked-by: Nick Kossifidis <[email protected]>

--
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

2008-02-03 12:42:38

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wireless: Fix WARN_ON() with ieee802.11b


On Sat, 2008-02-02 at 23:53 +0100, Ivo van Doorn wrote:
> When the driver registers a IEEE80211_BAND_2GHZ band,
> it can either be 802.11b or 802.11g. But when 802.11b rates
> are registered "want" will be 3 (since 4 rates are being registered,
> and each of those 4 rates will decrease "want").
> Since this is a correct situation, there is no need to trigger
> a WARN_ON() for this.
>
> Signed-off-by: Ivo van Doorn <[email protected]>

Acked-by: Johannes Berg <[email protected]>

> ---
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 0dcccbf..5304c62 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
> sband->bitrates[i].flags |=
> IEEE80211_RATE_ERP_G;
> }
> - WARN_ON(want != 0 && want != 6);
> + WARN_ON(want != 0 && want != 3 && want != 6);
> break;
> case IEEE80211_NUM_BANDS:
> WARN_ON(1);
>


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part

2008-02-03 11:22:01

by Ivo Van Doorn

[permalink] [raw]
Subject: Re: [PATCH] wireless: Fix WARN_ON() with ieee802.11b

On Sunday 03 February 2008, Johannes Berg wrote:
>
> > When the driver registers a IEEE80211_BAND_2GHZ band,
> > it can either be 802.11b or 802.11g. But when 802.11b rates
> > are registered "want" will be 3 (since 4 rates are being registered,
> > and each of those 4 rates will decrease "want").
>
> Huh, yeah, you're right, this is a thinko.
>
> > - WARN_ON(want != 0 && want != 6);
> > + WARN_ON(want != 0 && want != 3 && want != 6);
>
> However, I think it should just be
>
> WARN_ON(want != 0 && want != 3);
>
> 6 just doesn't make sense, does it?

Well from your code it seemed that you only made 1Mbit mandatory for
802.11b. So if you want to make all b rates mandatory then the 6 check should
indeed be removed.
But shouldn't the 2Mbit, 5.5Mbit and 11Mbit set as IEEE80211_RATE_MANDATORY_B
as well?

Ivo

2008-02-03 12:38:36

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] wireless: Fix WARN_ON() with ieee802.11b


> Well from your code it seemed that you only made 1Mbit mandatory for
> 802.11b. So if you want to make all b rates mandatory then the 6 check should
> indeed be removed.
> But shouldn't the 2Mbit, 5.5Mbit and 11Mbit set as IEEE80211_RATE_MANDATORY_B
> as well?

Ah, right, no, those aren't mandatory afaict so your patch is correct.
This is only a fairly lax sanity check anyway.

johannes


Attachments:
signature.asc (828.00 B)
This is a digitally signed message part