diff mbox

[1/2] wireless: set correct mandatory rate flags

Message ID 20170907154744.28357-1-rschuetz@uni-koblenz.de (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

Richard Schütz Sept. 7, 2017, 3:47 p.m. UTC
According to IEEE Std 802.11-2016 (16.2.3.4 Long PHY SIGNAL field) all of
the following rates are mandatory for a HR/DSSS PHY: 1 Mb/s, 2 Mb/s,
5.5 Mb/s and 11 Mb/s. Set IEEE80211_RATE_MANDATORY_B flag for all of these
instead of just 1 Mb/s to correctly reflect this.

Signed-off-by: Richard Schütz <rschuetz@uni-koblenz.de>
---
 net/wireless/util.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

Comments

Johannes Berg Sept. 8, 2017, 6:54 a.m. UTC | #1
On Thu, 2017-09-07 at 17:47 +0200, Richard Schütz wrote:
> According to IEEE Std 802.11-2016 (16.2.3.4 Long PHY SIGNAL field)
> all of
> the following rates are mandatory for a HR/DSSS PHY: 1 Mb/s, 2 Mb/s,
> 5.5 Mb/s and 11 Mb/s. Set IEEE80211_RATE_MANDATORY_B flag for all of
> these instead of just 1 Mb/s to correctly reflect this.

Hmm, I guess technically you're correct, since 11b added what's now
Clause 16 (was Clause 18 at the time), and that has all of them
mandatory? But perhaps this was actually intended for Clause 15
compatibility?

johannes
Richard Schütz Sept. 8, 2017, 8:43 a.m. UTC | #2
Am 08.09.2017 um 08:54 schrieb Johannes Berg:
> On Thu, 2017-09-07 at 17:47 +0200, Richard Schütz wrote:
>> According to IEEE Std 802.11-2016 (16.2.3.4 Long PHY SIGNAL field)
>> all of
>> the following rates are mandatory for a HR/DSSS PHY: 1 Mb/s, 2 Mb/s,
>> 5.5 Mb/s and 11 Mb/s. Set IEEE80211_RATE_MANDATORY_B flag for all of
>> these instead of just 1 Mb/s to correctly reflect this.
> 
> Hmm, I guess technically you're correct, since 11b added what's now
> Clause 16 (was Clause 18 at the time), and that has all of them
> mandatory? But perhaps this was actually intended for Clause 15
> compatibility?

Compatibility in what way?
Johannes Berg Sept. 8, 2017, 8:57 a.m. UTC | #3
On Fri, 2017-09-08 at 10:43 +0200, Richard Schütz wrote:

> > Hmm, I guess technically you're correct, since 11b added what's now
> > Clause 16 (was Clause 18 at the time), and that has all of them
> > mandatory? But perhaps this was actually intended for Clause 15
> > compatibility?
> 
> Compatibility in what way?

Well, realistically there are only three users of this information:

 * ieee80211_mandatory_rates(), used for supported station rates if we
   don't know anything better in IBSS (and OCB) and for basic rates in
   mesh;
 * basic rates in IBSS (__cfg80211_join_ibss);
 * duration calculation in ieee80211_duration, but that's just a
   fallback

So I guess it's now pretty unlikely that anyone would have a pre-11b
device, so it would make sense to actually make this change.

johannes
Johannes Berg Sept. 21, 2017, 1:49 p.m. UTC | #4
On Thu, 2017-09-07 at 17:47 +0200, Richard Schütz wrote:
> According to IEEE Std 802.11-2016 (16.2.3.4 Long PHY SIGNAL field)
> all of
> the following rates are mandatory for a HR/DSSS PHY: 1 Mb/s, 2 Mb/s,
> 5.5 Mb/s and 11 Mb/s. Set IEEE80211_RATE_MANDATORY_B flag for all of
> these
> instead of just 1 Mb/s to correctly reflect this.

Applied, but I modified it to use a switch statement.

johannes
Matthias Schiffer Jan. 26, 2018, 10:17 p.m. UTC | #5
On 09/07/2017 05:47 PM, Richard Schütz wrote:
> According to IEEE Std 802.11-2016 (16.2.3.4 Long PHY SIGNAL field) all of
> the following rates are mandatory for a HR/DSSS PHY: 1 Mb/s, 2 Mb/s,
> 5.5 Mb/s and 11 Mb/s. Set IEEE80211_RATE_MANDATORY_B flag for all of these
> instead of just 1 Mb/s to correctly reflect this.
> 
> Signed-off-by: Richard Schütz <rschuetz@uni-koblenz.de>

We've noticed that this is breaking interoperability of 11s nodes in
OpenWrt: association is only possible when neither or both peers have this
patch. I have not tested interop with non-Linux 11s peers.

I propose to revert this for now (I assume it's too late for 4.15, but
hopefully the regression can be fixed in 4.15.1).

Regards,
Matthias


> ---
>  net/wireless/util.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index bcb1284c3415..c69b5c31caf8 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -157,32 +157,28 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
>  	case NL80211_BAND_2GHZ:
>  		want = 7;
>  		for (i = 0; i < sband->n_bitrates; i++) {
> -			if (sband->bitrates[i].bitrate == 10) {
> +			if (sband->bitrates[i].bitrate == 10 ||
> +			    sband->bitrates[i].bitrate == 20 ||
> +			    sband->bitrates[i].bitrate == 55 ||
> +			    sband->bitrates[i].bitrate == 110) {
>  				sband->bitrates[i].flags |=
>  					IEEE80211_RATE_MANDATORY_B |
>  					IEEE80211_RATE_MANDATORY_G;
>  				want--;
> +			} else {
> +				sband->bitrates[i].flags |=
> +					IEEE80211_RATE_ERP_G;
>  			}
>  
> -			if (sband->bitrates[i].bitrate == 20 ||
> -			    sband->bitrates[i].bitrate == 55 ||
> -			    sband->bitrates[i].bitrate == 110 ||
> -			    sband->bitrates[i].bitrate == 60 ||
> +			if (sband->bitrates[i].bitrate == 60 ||
>  			    sband->bitrates[i].bitrate == 120 ||
>  			    sband->bitrates[i].bitrate == 240) {
>  				sband->bitrates[i].flags |=
>  					IEEE80211_RATE_MANDATORY_G;
>  				want--;
>  			}
> -
> -			if (sband->bitrates[i].bitrate != 10 &&
> -			    sband->bitrates[i].bitrate != 20 &&
> -			    sband->bitrates[i].bitrate != 55 &&
> -			    sband->bitrates[i].bitrate != 110)
> -				sband->bitrates[i].flags |=
> -					IEEE80211_RATE_ERP_G;
>  		}
> -		WARN_ON(want != 0 && want != 3 && want != 6);
> +		WARN_ON(want != 0 && want != 3);
>  		break;
>  	case NL80211_BAND_60GHZ:
>  		/* check for mandatory HT MCS 1..4 */
>
diff mbox

Patch

diff --git a/net/wireless/util.c b/net/wireless/util.c
index bcb1284c3415..c69b5c31caf8 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -157,32 +157,28 @@  static void set_mandatory_flags_band(struct ieee80211_supported_band *sband)
 	case NL80211_BAND_2GHZ:
 		want = 7;
 		for (i = 0; i < sband->n_bitrates; i++) {
-			if (sband->bitrates[i].bitrate == 10) {
+			if (sband->bitrates[i].bitrate == 10 ||
+			    sband->bitrates[i].bitrate == 20 ||
+			    sband->bitrates[i].bitrate == 55 ||
+			    sband->bitrates[i].bitrate == 110) {
 				sband->bitrates[i].flags |=
 					IEEE80211_RATE_MANDATORY_B |
 					IEEE80211_RATE_MANDATORY_G;
 				want--;
+			} else {
+				sband->bitrates[i].flags |=
+					IEEE80211_RATE_ERP_G;
 			}
 
-			if (sband->bitrates[i].bitrate == 20 ||
-			    sband->bitrates[i].bitrate == 55 ||
-			    sband->bitrates[i].bitrate == 110 ||
-			    sband->bitrates[i].bitrate == 60 ||
+			if (sband->bitrates[i].bitrate == 60 ||
 			    sband->bitrates[i].bitrate == 120 ||
 			    sband->bitrates[i].bitrate == 240) {
 				sband->bitrates[i].flags |=
 					IEEE80211_RATE_MANDATORY_G;
 				want--;
 			}
-
-			if (sband->bitrates[i].bitrate != 10 &&
-			    sband->bitrates[i].bitrate != 20 &&
-			    sband->bitrates[i].bitrate != 55 &&
-			    sband->bitrates[i].bitrate != 110)
-				sband->bitrates[i].flags |=
-					IEEE80211_RATE_ERP_G;
 		}
-		WARN_ON(want != 0 && want != 3 && want != 6);
+		WARN_ON(want != 0 && want != 3);
 		break;
 	case NL80211_BAND_60GHZ:
 		/* check for mandatory HT MCS 1..4 */