mac80211: fix brcmfmac on brcm2708
authorStijn Tintel <stijn@linux-ipv6.be>
Sat, 10 Nov 2018 11:28:48 +0000 (13:28 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 18 Dec 2018 16:48:22 +0000 (17:48 +0100)
An upstream change broke brcmfmac when loaded with modparam roamoff=1.
As we are carrying a patch that enables roamoff by default on the
brcm2708 target to improve stability, wireless is currently broken
there. Add a patch to fix brcmfmac with roamoff=1.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
(backported from f208f778117d4bdf99da600f281728ce5b61ed3c)
(rebased patches)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/kernel/mac80211/patches/brcm/100-brcmfmac-fix-roamoff-1-modparam.patch [new file with mode: 0644]

diff --git a/package/kernel/mac80211/patches/brcm/100-brcmfmac-fix-roamoff-1-modparam.patch b/package/kernel/mac80211/patches/brcm/100-brcmfmac-fix-roamoff-1-modparam.patch
new file mode 100644 (file)
index 0000000..114a3b3
--- /dev/null
@@ -0,0 +1,67 @@
+From 22d319f2665dd3458d59c934fa0c8cf1b1d7227f Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <stijn@linux-ipv6.be>
+Date: Sat, 10 Nov 2018 13:25:20 +0200
+Subject: [PATCH wireless-drivers] brcmfmac: fix roamoff=1 modparam
+
+When the update_connect_param callback is set, nl80211 expects the flag
+WIPHY_FLAG_SUPPORTS_FW_ROAM to be set as well. However, this flag is
+only set when modparam roamoff=0, while the callback is set
+unconditionally. Since commit 7f9a3e150ec7 this causes a warning in
+wiphy_register, which breaks brcmfmac.
+
+Disable the update_connect_param callback when roamoff=0 to fix this.
+
+Fixes: 7f9a3e150ec7 ("nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS")
+Cc: Stable <stable@vger.kernel.org> # 4.19+
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c   | 11 +++++++++--
+ .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.h   |  2 +-
+ .../net/wireless/broadcom/brcm80211/brcmfmac/core.c   |  2 +-
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -5188,10 +5188,17 @@ static struct cfg80211_ops brcmf_cfg8021
+       .del_pmk = brcmf_cfg80211_del_pmk,
+ };
+-struct cfg80211_ops *brcmf_cfg80211_get_ops(void)
++struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings)
+ {
+-      return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
++      struct cfg80211_ops *ops;
++
++      ops = kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops),
+                      GFP_KERNEL);
++
++      if (ops && settings->roamoff)
++              ops->update_connect_params = NULL;
++
++      return ops;
+ }
+ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+@@ -404,7 +404,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
+ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
+ s32 brcmf_cfg80211_up(struct net_device *ndev);
+ s32 brcmf_cfg80211_down(struct net_device *ndev);
+-struct cfg80211_ops *brcmf_cfg80211_get_ops(void);
++struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings);
+ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
+ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1151,7 +1151,7 @@ int brcmf_attach(struct device *dev, str
+       brcmf_dbg(TRACE, "Enter\n");
+-      ops = brcmf_cfg80211_get_ops();
++      ops = brcmf_cfg80211_get_ops(settings);
+       if (!ops)
+               return -ENOMEM;