mac80211: replace revert for 11s compatiblity with upstream fix
authorMatthias Schiffer <mschiffer@universe-factory.net>
Wed, 31 Jan 2018 12:42:23 +0000 (13:42 +0100)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Wed, 31 Jan 2018 12:42:23 +0000 (13:42 +0100)
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
package/kernel/mac80211/patches/324-Revert-wireless-set-correct-mandatory-rate-flags.patch [deleted file]
package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch [new file with mode: 0644]

diff --git a/package/kernel/mac80211/patches/324-Revert-wireless-set-correct-mandatory-rate-flags.patch b/package/kernel/mac80211/patches/324-Revert-wireless-set-correct-mandatory-rate-flags.patch
deleted file mode 100644 (file)
index 2ae9b7d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-From: Matthias Schiffer <mschiffer@universe-factory.net>
-Date: Fri, 26 Jan 2018 23:23:37 +0100
-Subject: [PATCH] Revert "wireless: set correct mandatory rate flags"
-
-This reverts commit 1bd773c077deeeb2d9ced1fdb6d846169b8e7e4a.
----
- net/wireless/util.c | 30 ++++++++++++++++--------------
- 1 file changed, 16 insertions(+), 14 deletions(-)
-
-diff --git a/net/wireless/util.c b/net/wireless/util.c
-index c69160694b6c..2bb37231c8fe 100644
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -157,30 +157,32 @@ static void set_mandatory_flags_band(str
-       case NL80211_BAND_2GHZ:
-               want = 7;
-               for (i = 0; i < sband->n_bitrates; i++) {
--                      switch (sband->bitrates[i].bitrate) {
--                      case 10:
--                      case 20:
--                      case 55:
--                      case 110:
-+                      if (sband->bitrates[i].bitrate == 10) {
-                               sband->bitrates[i].flags |=
-                                       IEEE80211_RATE_MANDATORY_B |
-                                       IEEE80211_RATE_MANDATORY_G;
-                               want--;
--                              break;
--                      case 60:
--                      case 120:
--                      case 240:
-+                      }
-+
-+                      if (sband->bitrates[i].bitrate == 20 ||
-+                          sband->bitrates[i].bitrate == 55 ||
-+                          sband->bitrates[i].bitrate == 110 ||
-+                          sband->bitrates[i].bitrate == 60 ||
-+                          sband->bitrates[i].bitrate == 120 ||
-+                          sband->bitrates[i].bitrate == 240) {
-                               sband->bitrates[i].flags |=
-                                       IEEE80211_RATE_MANDATORY_G;
-                               want--;
--                              /* fall through */
--                      default:
-+                      }
-+
-+                      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;
--                              break;
--                      }
-               }
--              WARN_ON(want != 0 && want != 3);
-+              WARN_ON(want != 0 && want != 3 && want != 6);
-               break;
-       case NL80211_BAND_60GHZ:
-               /* check for mandatory HT MCS 1..4 */
diff --git a/package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch b/package/kernel/mac80211/patches/324-cfg80211-use-only-1Mbps-for-basic-rates-in-mesh.patch
new file mode 100644 (file)
index 0000000..bc4174e
--- /dev/null
@@ -0,0 +1,55 @@
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Tue, 30 Jan 2018 13:17:38 +0100
+Subject: [PATCH] cfg80211: use only 1Mbps for basic rates in mesh
+
+Mesh used to use the mandatory rates as basic rates, but we got
+the calculation of mandatory rates wrong until some time ago.
+Fix this this broke interoperability with older versions since
+now more basic rates are required, and thus the MBSS isn't the
+same and the network stops working.
+
+Fix this by simply using only 1Mbps as the basic rate in 2.4GHz.
+Since the changed mandatory rates only affected 2.4GHz, this is
+all we need to make it work again.
+
+Reported-and-tested-by: Matthias Schiffer <mschiffer@universe-factory.net>
+Fixes: 1bd773c077de ("wireless: set correct mandatory rate flags")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+ net/wireless/mesh.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+--- a/net/wireless/mesh.c
++++ b/net/wireless/mesh.c
+@@ -169,9 +169,28 @@ int __cfg80211_join_mesh(struct cfg80211
+               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,