diff mbox

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

Message ID 1517298191.2189.33.camel@sipsolutions.net (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show

Commit Message

Johannes Berg Jan. 30, 2018, 7:43 a.m. UTC
On Fri, 2018-01-26 at 23:17 +0100, Matthias Schiffer wrote:
> 
> 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).

I really don't think we should revert this, it fixes a real bug.

We can easily switch the default though, would something like this
help?


johannes

Comments

Matthias Schiffer Jan. 30, 2018, 10:47 a.m. UTC | #1
On 01/30/2018 08:43 AM, Johannes Berg wrote:
> On Fri, 2018-01-26 at 23:17 +0100, Matthias Schiffer wrote:
>>
>> 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).
> 
> I really don't think we should revert this, it fixes a real bug.
> 
> We can easily switch the default though, would something like this
> help?

Working perfectly.

Tested-by: Matthias Schiffer <mschiffer@universe-factory.net>


> 
> diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
> index 51aa55618ef7..b12da6ef3c12 100644
> --- a/net/wireless/mesh.c
> +++ b/net/wireless/mesh.c
> @@ -170,9 +170,28 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
>  		enum nl80211_bss_scan_width scan_width;
>  		struct ieee80211_supported_band *sband =
>  				rdev->wiphy.bands[setup->chandef.chan->band];
> -		scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
> -		setup->basic_rates = ieee80211_mandatory_rates(sband,
> -							       scan_width);
> +
> +		if (setup->chandef.chan->band == NL80211_BAND_2GHZ) {
> +			int i;
> +
> +			/*
> +			 * Older versions selected the mandatory rates for
> +			 * 2.4 GHz as well, but were broken in that only
> +			 * 1 Mbps was regarded as a mandatory rate. Keep
> +			 * using just 1 Mbps as the default basic rate for
> +			 * mesh to be interoperable with older versions.
> +			 */
> +			for (i = 0; i < sband->n_bitrates; i++) {
> +				if (sband->bitrates[i].bitrate == 10) {
> +					setup->basic_rates = BIT(i);
> +					break;
> +				}
> +			}
> +		} else {
> +			scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
> +			setup->basic_rates = ieee80211_mandatory_rates(sband,
> +								       scan_width);
> +		}
>  	}
>  
>  	err = cfg80211_chandef_dfs_required(&rdev->wiphy,
> 
> johannes
>
diff mbox

Patch

diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 51aa55618ef7..b12da6ef3c12 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -170,9 +170,28 @@  int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
 		enum nl80211_bss_scan_width scan_width;
 		struct ieee80211_supported_band *sband =
 				rdev->wiphy.bands[setup->chandef.chan->band];
-		scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
-		setup->basic_rates = ieee80211_mandatory_rates(sband,
-							       scan_width);
+
+		if (setup->chandef.chan->band == NL80211_BAND_2GHZ) {
+			int i;
+
+			/*
+			 * Older versions selected the mandatory rates for
+			 * 2.4 GHz as well, but were broken in that only
+			 * 1 Mbps was regarded as a mandatory rate. Keep
+			 * using just 1 Mbps as the default basic rate for
+			 * mesh to be interoperable with older versions.
+			 */
+			for (i = 0; i < sband->n_bitrates; i++) {
+				if (sband->bitrates[i].bitrate == 10) {
+					setup->basic_rates = BIT(i);
+					break;
+				}
+			}
+		} else {
+			scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);
+			setup->basic_rates = ieee80211_mandatory_rates(sband,
+								       scan_width);
+		}
 	}
 
 	err = cfg80211_chandef_dfs_required(&rdev->wiphy,