diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2019-10-01 23:28:36 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2019-10-19 12:35:55 +0200 |
commit | e6cadb215cba051464eaeba8040d8c82d524b088 (patch) | |
tree | af1d20d6c2168dda699b1a4de622acb848fe21fc /package/kernel/mac80211/patches/brcm | |
parent | 67dc023f87699e56457a3ba4a97da60605042bd7 (diff) | |
download | upstream-e6cadb215cba051464eaeba8040d8c82d524b088.tar.gz upstream-e6cadb215cba051464eaeba8040d8c82d524b088.tar.bz2 upstream-e6cadb215cba051464eaeba8040d8c82d524b088.zip |
mac80211: Update to version 5.4-rc2
This updates mac80211 to backports based on kernel 5.4-rc2
ath10k-ct was updated to match the API changes and iw now uses the new
nl80211.h header file.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'package/kernel/mac80211/patches/brcm')
21 files changed, 0 insertions, 1390 deletions
diff --git a/package/kernel/mac80211/patches/brcm/103-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch b/package/kernel/mac80211/patches/brcm/103-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch deleted file mode 100644 index 0d38084e90..0000000000 --- a/package/kernel/mac80211/patches/brcm/103-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f491645f039420fb7e14283e21b90772571c807c Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 10:45:30 +0200 -Subject: [PATCH] brcmfmac: add 160MHz in chandef_to_chanspec() - -The function chandef_to_chanspec() was not handling 160MHz bandwidth -resulting in wrong encoding of the channel. That resulting in firmware -rejecting the provided channel specification. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 21 ++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -276,8 +276,26 @@ static u16 chandef_to_chanspec(struct br - else - ch_inf.sb = BRCMU_CHAN_SB_UU; - break; -- case NL80211_CHAN_WIDTH_80P80: - case NL80211_CHAN_WIDTH_160: -+ ch_inf.bw = BRCMU_CHAN_BW_160; -+ if (primary_offset == -70) -+ ch_inf.sb = BRCMU_CHAN_SB_LLL; -+ else if (primary_offset == -50) -+ ch_inf.sb = BRCMU_CHAN_SB_LLU; -+ else if (primary_offset == -30) -+ ch_inf.sb = BRCMU_CHAN_SB_LUL; -+ else if (primary_offset == -10) -+ ch_inf.sb = BRCMU_CHAN_SB_LUU; -+ else if (primary_offset == 10) -+ ch_inf.sb = BRCMU_CHAN_SB_ULL; -+ else if (primary_offset == 30) -+ ch_inf.sb = BRCMU_CHAN_SB_ULU; -+ else if (primary_offset == 50) -+ ch_inf.sb = BRCMU_CHAN_SB_UUL; -+ else -+ ch_inf.sb = BRCMU_CHAN_SB_UUU; -+ break; -+ case NL80211_CHAN_WIDTH_80P80: - case NL80211_CHAN_WIDTH_5: - case NL80211_CHAN_WIDTH_10: - default: -@@ -296,6 +314,7 @@ static u16 chandef_to_chanspec(struct br - } - d11inf->encchspec(&ch_inf); - -+ brcmf_dbg(TRACE, "chanspec: 0x%x\n", ch_inf.chspec); - return ch_inf.chspec; - } - diff --git a/package/kernel/mac80211/patches/brcm/103-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch b/package/kernel/mac80211/patches/brcm/103-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch deleted file mode 100644 index 6d0756ca78..0000000000 --- a/package/kernel/mac80211/patches/brcm/103-v5.4-0002-brcmfmac-enable-DFS_OFFLOAD-extended-feature-if-supp.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 011a56a3336a5de9c3152c169cd52ff79b8c3f89 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 10:45:31 +0200 -Subject: [PATCH] brcmfmac: enable DFS_OFFLOAD extended feature if supported - -If the firmware supports 802.11h and the device can operate in 5GHz -band we can enable DFS_OFFLOAD extended feature. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++ - drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- - 3 files changed, 9 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6733,6 +6733,11 @@ static int brcmf_setup_wiphy(struct wiph - } - } - -+ if (wiphy->bands[NL80211_BAND_5GHZ] && -+ brcmf_feat_is_enabled(ifp, BRCMF_FEAT_DOT11H)) -+ wiphy_ext_feature_set(wiphy, -+ NL80211_EXT_FEATURE_DFS_OFFLOAD); -+ - wiphy_read_of_freq_limits(wiphy); - - return 0; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c -@@ -39,6 +39,7 @@ static const struct brcmf_feat_fwcap brc - { BRCMF_FEAT_P2P, "p2p" }, - { BRCMF_FEAT_MONITOR, "monitor" }, - { BRCMF_FEAT_MONITOR_FMT_RADIOTAP, "rtap" }, -+ { BRCMF_FEAT_DOT11H, "802.11h" } - }; - - #ifdef DEBUG ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h -@@ -25,6 +25,7 @@ - * MONITOR: firmware can pass monitor packets to host. - * MONITOR_FMT_RADIOTAP: firmware provides monitor packets with radiotap header - * MONITOR_FMT_HW_RX_HDR: firmware provides monitor packets with hw/ucode header -+ * DOT11H: firmware supports 802.11h - */ - #define BRCMF_FEAT_LIST \ - BRCMF_FEAT_DEF(MBSS) \ -@@ -43,7 +44,8 @@ - BRCMF_FEAT_DEF(FWSUP) \ - BRCMF_FEAT_DEF(MONITOR) \ - BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ -- BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) -+ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) \ -+ BRCMF_FEAT_DEF(DOT11H) - - /* - * Quirks: diff --git a/package/kernel/mac80211/patches/brcm/103-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch b/package/kernel/mac80211/patches/brcm/103-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch deleted file mode 100644 index 3df8057ced..0000000000 --- a/package/kernel/mac80211/patches/brcm/103-v5.4-0003-brcmfmac-allow-160MHz-in-custom-regulatory-rules.patch +++ /dev/null @@ -1,34 +0,0 @@ -From fa9050927fa885410055ee03c948c2252693d296 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 10:45:32 +0200 -Subject: [PATCH] brcmfmac: allow 160MHz in custom regulatory rules - -The driver has custom regulatory rules which had maximum bandwidth -for 5GHz channels set to 80MHz. As a consequence the driver can -not use 160MHz in AP mode even when the device supports it. So -relax the rules allowing 160MHz. After wiphy_register() the channel -flags are updated according what the device actually supports. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -189,9 +189,9 @@ static const struct ieee80211_regdomain - */ - REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), - /* IEEE 802.11a, channel 36..64 */ -- REG_RULE(5150-10, 5350+10, 80, 6, 20, 0), -+ REG_RULE(5150-10, 5350+10, 160, 6, 20, 0), - /* IEEE 802.11a, channel 100..165 */ -- REG_RULE(5470-10, 5850+10, 80, 6, 20, 0), } -+ REG_RULE(5470-10, 5850+10, 160, 6, 20, 0), } - }; - - /* Note: brcmf_cipher_suites is an array of int defining which cipher suites diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch deleted file mode 100644 index 45a9a339fa..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0001-Revert-brcmfmac-fix-NULL-pointer-derefence-during-US.patch +++ /dev/null @@ -1,168 +0,0 @@ -From a84a60ccdd65278485fb495f468a5ab91a75c649 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:06 +0200 -Subject: [PATCH] Revert "brcmfmac: fix NULL pointer derefence during USB - disconnect" - -This reverts commit 5cdb0ef6144f47440850553579aa923c20a63f23. Subsequent -changes make rework the driver code fixing the issue differently. - -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 11 ++--------- - .../wireless/broadcom/brcm80211/brcmfmac/bcdc.h | 6 ++---- - .../wireless/broadcom/brcm80211/brcmfmac/core.c | 4 +--- - .../broadcom/brcm80211/brcmfmac/fwsignal.c | 16 ++++------------ - .../broadcom/brcm80211/brcmfmac/fwsignal.h | 3 +-- - .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 10 ++-------- - .../wireless/broadcom/brcm80211/brcmfmac/proto.h | 3 +-- - 7 files changed, 13 insertions(+), 40 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c -@@ -479,18 +479,11 @@ fail: - return -ENOMEM; - } - --void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) --{ -- struct brcmf_bcdc *bcdc = drvr->proto->pd; -- -- brcmf_fws_detach_pre_delif(bcdc->fws); --} -- --void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) -+void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) - { - struct brcmf_bcdc *bcdc = drvr->proto->pd; - - drvr->proto->pd = NULL; -- brcmf_fws_detach_post_delif(bcdc->fws); -+ brcmf_fws_detach(bcdc->fws); - kfree(bcdc); - } ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.h -@@ -7,16 +7,14 @@ - - #ifdef CPTCFG_BRCMFMAC_PROTO_BCDC - int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); --void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr); --void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr); -+void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); - void brcmf_proto_bcdc_txflowblock(struct device *dev, bool state); - void brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, - bool success); - struct brcmf_fws_info *drvr_to_fws(struct brcmf_pub *drvr); - #else - static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } --static void brcmf_proto_bcdc_detach_pre_delif(struct brcmf_pub *drvr) {}; --static inline void brcmf_proto_bcdc_detach_post_delif(struct brcmf_pub *drvr) {} -+static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} - #endif - - #endif /* BRCMFMAC_BCDC_H */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1335,8 +1335,6 @@ void brcmf_detach(struct device *dev) - - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); - -- brcmf_proto_detach_pre_delif(drvr); -- - /* make sure primary interface removed last */ - for (i = BRCMF_MAX_IFS-1; i > -1; i--) - brcmf_remove_interface(drvr->iflist[i], false); -@@ -1346,7 +1344,7 @@ void brcmf_detach(struct device *dev) - - brcmf_bus_stop(drvr->bus_if); - -- brcmf_proto_detach_post_delif(drvr); -+ brcmf_proto_detach(drvr); - - bus_if->drvr = NULL; - wiphy_free(drvr->wiphy); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c -@@ -2432,25 +2432,17 @@ struct brcmf_fws_info *brcmf_fws_attach( - return fws; - - fail: -- brcmf_fws_detach_pre_delif(fws); -- brcmf_fws_detach_post_delif(fws); -+ brcmf_fws_detach(fws); - return ERR_PTR(rc); - } - --void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws) -+void brcmf_fws_detach(struct brcmf_fws_info *fws) - { - if (!fws) - return; -- if (fws->fws_wq) { -- destroy_workqueue(fws->fws_wq); -- fws->fws_wq = NULL; -- } --} - --void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws) --{ -- if (!fws) -- return; -+ if (fws->fws_wq) -+ destroy_workqueue(fws->fws_wq); - - /* cleanup */ - brcmf_fws_lock(fws); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h -@@ -7,8 +7,7 @@ - #define FWSIGNAL_H_ - - struct brcmf_fws_info *brcmf_fws_attach(struct brcmf_pub *drvr); --void brcmf_fws_detach_pre_delif(struct brcmf_fws_info *fws); --void brcmf_fws_detach_post_delif(struct brcmf_fws_info *fws); -+void brcmf_fws_detach(struct brcmf_fws_info *fws); - void brcmf_fws_debugfs_create(struct brcmf_pub *drvr); - bool brcmf_fws_queue_skbs(struct brcmf_fws_info *fws); - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c -@@ -56,22 +56,16 @@ fail: - return -ENOMEM; - } - --void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr) -+void brcmf_proto_detach(struct brcmf_pub *drvr) - { - brcmf_dbg(TRACE, "Enter\n"); - - if (drvr->proto) { - if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) -- brcmf_proto_bcdc_detach_post_delif(drvr); -+ brcmf_proto_bcdc_detach(drvr); - else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF) - brcmf_proto_msgbuf_detach(drvr); - kfree(drvr->proto); - drvr->proto = NULL; - } - } -- --void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr) --{ -- if (drvr->proto && drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) -- brcmf_proto_bcdc_detach_pre_delif(drvr); --} ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h -@@ -43,8 +43,7 @@ struct brcmf_proto { - - - int brcmf_proto_attach(struct brcmf_pub *drvr); --void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr); --void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr); -+void brcmf_proto_detach(struct brcmf_pub *drvr); - - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, - struct sk_buff *skb, diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch deleted file mode 100644 index d40bf031b8..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0002-brcmfmac-change-the-order-of-things-in-brcmf_detach.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 14fcfd1cc0c05ea58f47dd693fdd13f25dfe995e Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:07 +0200 -Subject: [PATCH] brcmfmac: change the order of things in brcmf_detach() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When brcmf_detach() from the bus layer upon rmmod we can no longer -communicate. Hence we will set the bus state to DOWN and cleanup -the event and protocol layer. The network interfaces need to be -deleted before brcmf_cfg80211_detach() because the latter does the -wiphy_unregister() which issues a warning if there are still network -devices linked to the wiphy instance. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Tested-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/core.c | 27 ++++++++++--------- - 1 file changed, 14 insertions(+), 13 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1328,25 +1328,26 @@ void brcmf_detach(struct device *dev) - unregister_inet6addr_notifier(&drvr->inet6addr_notifier); - #endif - -- /* stop firmware event handling */ -- brcmf_fweh_detach(drvr); -- if (drvr->config) -- brcmf_p2p_detach(&drvr->config->p2p); -- - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); -- -- /* make sure primary interface removed last */ -- for (i = BRCMF_MAX_IFS-1; i > -1; i--) -- brcmf_remove_interface(drvr->iflist[i], false); -- -- brcmf_cfg80211_detach(drvr->config); -- drvr->config = NULL; -- - brcmf_bus_stop(drvr->bus_if); - -+ brcmf_fweh_detach(drvr); - brcmf_proto_detach(drvr); - -+ /* make sure primary interface removed last */ -+ for (i = BRCMF_MAX_IFS - 1; i > -1; i--) { -+ if (drvr->iflist[i]) -+ brcmf_del_if(drvr, drvr->iflist[i]->bsscfgidx, false); -+ } -+ -+ if (drvr->config) { -+ brcmf_p2p_detach(&drvr->config->p2p); -+ brcmf_cfg80211_detach(drvr->config); -+ drvr->config = NULL; -+ } -+ - bus_if->drvr = NULL; -+ - wiphy_free(drvr->wiphy); - } - diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch deleted file mode 100644 index 4c42b2b0c9..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0003-brcmfmac-avoid-firmware-command-in-brcmf_netdev_open.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c613085b74941024194e41b200601b9aa6ee388f Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:08 +0200 -Subject: [PATCH] brcmfmac: avoid firmware command in brcmf_netdev_open() when - bus is down - -No point in sending a firmware command when bus is down so make it -conditional checking the state. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -579,7 +579,8 @@ static int brcmf_netdev_stop(struct net_ - - brcmf_cfg80211_down(ndev); - -- brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", NULL, 0); -+ if (ifp->drvr->bus_if->state == BRCMF_BUS_UP) -+ brcmf_fil_iovar_data_set(ifp, "arp_hostip_clear", NULL, 0); - - brcmf_net_setcarrier(ifp, false); - diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch deleted file mode 100644 index d796faa79f..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0004-brcmfmac-clear-events-in-brcmf_fweh_detach-will-alwa.patch +++ /dev/null @@ -1,38 +0,0 @@ -From c33330ac06fe863289643e7a13ecdb6a2502dad7 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:09 +0200 -Subject: [PATCH] brcmfmac: clear events in brcmf_fweh_detach() will always - fail - -Clearing firmware events in brcmf_fweh_detach() is always failing -because it is called only upon driver remove and communication -with firmware is no longer possible. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 9 --------- - 1 file changed, 9 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c -@@ -303,16 +303,7 @@ void brcmf_fweh_attach(struct brcmf_pub - void brcmf_fweh_detach(struct brcmf_pub *drvr) - { - struct brcmf_fweh_info *fweh = &drvr->fweh; -- struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); -- s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - -- if (ifp) { -- /* clear all events */ -- memset(eventmask, 0, BRCMF_EVENTING_MASK_LEN); -- (void)brcmf_fil_iovar_data_set(ifp, "event_msgs", -- eventmask, -- BRCMF_EVENTING_MASK_LEN); -- } - /* cancel the worker */ - cancel_work_sync(&fweh->event_work); - WARN_ON(!list_empty(&fweh->event_q)); diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch deleted file mode 100644 index 747cf58b7b..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0005-brcmfmac-avoid-firmware-commands-when-bus-is-down.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 1ac11ae949dd883854f4523ef8e3a32aabfd6256 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:10 +0200 -Subject: [PATCH] brcmfmac: avoid firmware commands when bus is down - -Upon rmmod a few attempts are made to inform firmware, but there is -no point as the bus is down and these will fail. Avoid them to keep -the logs clean. - -Reported-by: Stefan Wahren <stefan.wahren@i2se.com> -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 23 +++++++++++-------- - 1 file changed, 13 insertions(+), 10 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -1286,17 +1286,21 @@ static void brcmf_link_down(struct brcmf - { - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); - struct brcmf_pub *drvr = cfg->pub; -+ bool bus_up = drvr->bus_if->state == BRCMF_BUS_UP; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { -- brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n"); -- err = brcmf_fil_cmd_data_set(vif->ifp, -- BRCMF_C_DISASSOC, NULL, 0); -- if (err) { -- bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", err); -+ if (bus_up) { -+ brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n"); -+ err = brcmf_fil_cmd_data_set(vif->ifp, -+ BRCMF_C_DISASSOC, NULL, 0); -+ if (err) -+ bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", -+ err); - } -+ - if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || - (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) - cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0, -@@ -1306,7 +1310,8 @@ static void brcmf_link_down(struct brcmf - clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); - brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0); - if (vif->profile.use_fwsup != BRCMF_PROFILE_FWSUP_NONE) { -- brcmf_set_pmk(vif->ifp, NULL, 0); -+ if (bus_up) -+ brcmf_set_pmk(vif->ifp, NULL, 0); - vif->profile.use_fwsup = BRCMF_PROFILE_FWSUP_NONE; - } - brcmf_dbg(TRACE, "Exit\n"); -@@ -5004,18 +5009,16 @@ static int brcmf_cfg80211_get_channel(st - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = wdev->netdev; - struct brcmf_pub *drvr = cfg->pub; -- struct brcmf_if *ifp; - struct brcmu_chan ch; - enum nl80211_band band = 0; - enum nl80211_chan_width width = 0; - u32 chanspec; - int freq, err; - -- if (!ndev) -+ if (!ndev || drvr->bus_if->state != BRCMF_BUS_UP) - return -ENODEV; -- ifp = netdev_priv(ndev); - -- err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); -+ err = brcmf_fil_iovar_int_get(netdev_priv(ndev), "chanspec", &chanspec); - if (err) { - bphy_err(drvr, "chanspec failed (%d)\n", err); - return err; diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch deleted file mode 100644 index 040ab16a6c..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0006-brcmfmac-simply-remove-flowring-if-bus-is-down.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e0bfb9601d4812719167cc4124a0d6db1e2f55e4 Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:11 +0200 -Subject: [PATCH] brcmfmac: simply remove flowring if bus is down - -When the bus is down, eg. due to rmmod, there is no need to -attempt to inform firmware about it. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 7 +++++++ - 1 file changed, 7 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -@@ -1398,6 +1398,13 @@ void brcmf_msgbuf_delete_flowring(struct - u8 ifidx; - int err; - -+ /* no need to submit if firmware can not be reached */ -+ if (drvr->bus_if->state != BRCMF_BUS_UP) { -+ brcmf_dbg(MSGBUF, "bus down, flowring will be removed\n"); -+ brcmf_msgbuf_remove_flowring(msgbuf, flowid); -+ return; -+ } -+ - commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT]; - brcmf_commonring_lock(commonring); - ret_ptr = brcmf_commonring_reserve_for_write(commonring); diff --git a/package/kernel/mac80211/patches/brcm/104-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch b/package/kernel/mac80211/patches/brcm/104-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch deleted file mode 100644 index 444546aaf7..0000000000 --- a/package/kernel/mac80211/patches/brcm/104-v5.4-0007-brcmfmac-remove-unnecessary-strlcpy-upon-obtaining-v.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4b11c915f00caeef3292ed0429acc579b9da762a Mon Sep 17 00:00:00 2001 -From: Arend van Spriel <arend.vanspriel@broadcom.com> -Date: Thu, 11 Jul 2019 11:05:12 +0200 -Subject: [PATCH] brcmfmac: remove unnecessary strlcpy() upon obtaining "ver" - iovar - -Recently a strcpy() was replaced by strlcpy(). However, the strcpy() -was not needed in the first place. So removing that line of code. - -Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> -Reviewed-by: Franky Lin <franky.lin@broadcom.com> -Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -258,7 +258,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i - - /* query for 'ver' to get version info from firmware */ - memset(buf, 0, sizeof(buf)); -- strlcpy(buf, "ver", sizeof(buf)); - err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); - if (err < 0) { - bphy_err(drvr, "Retrieving version information failed, %d\n", diff --git a/package/kernel/mac80211/patches/brcm/105-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch b/package/kernel/mac80211/patches/brcm/105-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch deleted file mode 100644 index 60f6e49210..0000000000 --- a/package/kernel/mac80211/patches/brcm/105-v5.4-brcmfmac-don-t-net_ratelimit-CONSOLE-messages-on-fir.patch +++ /dev/null @@ -1,38 +0,0 @@ -From e3b1d879ccda9ffd5332777bb1beeb2cc913faa8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Sun, 21 Jul 2019 21:52:17 +0200 -Subject: [PATCH] brcmfmac: don't net_ratelimit() CONSOLE messages on firmware - crash -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Firmware crash is a pretty rare event and can't happen too frequently as -it has to be followed by a hardware reinitialization and config reload. -It should be safe to don't use net_ratelimit() when it happens. - -For reporting & debugging purposes it's important to provide a complete -log as the last lines are actually the most important. This change -modifies brcmfmac to print all messages in an unlimited way in that -specific case. With this change there should be finally a backtrace of -firmware finally visible after a crash. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -794,7 +794,8 @@ static void brcmf_pcie_bus_console_read( - if (ch == '\n') { - console->log_str[console->log_idx] = 0; - if (error) -- brcmf_err(bus, "CONSOLE: %s", console->log_str); -+ __brcmf_err(bus, __func__, "CONSOLE: %s", -+ console->log_str); - else - pr_debug("CONSOLE: %s", console->log_str); - console->log_idx = 0; diff --git a/package/kernel/mac80211/patches/brcm/106-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch b/package/kernel/mac80211/patches/brcm/106-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch deleted file mode 100644 index da0d8d5894..0000000000 --- a/package/kernel/mac80211/patches/brcm/106-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch +++ /dev/null @@ -1,54 +0,0 @@ -From cddecd92d1ec2fd05ed1123455e7c6cf6906b5a5 Mon Sep 17 00:00:00 2001 -From: YueHaibing <yuehaibing@huawei.com> -Date: Wed, 24 Jul 2019 22:12:01 +0800 -Subject: [PATCH] brcmfmac: remove set but not used variable 'dtim_period' - -Fixes gcc '-Wunused-but-set-variable' warning: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2962:5: warning: variable dtim_period set but not used [-Wunused-but-set-variable] -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info: -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2961:6: warning: variable beacon_interval set but not used [-Wunused-but-set-variable] - -They are never used so can be removed. - -Reported-by: Hulk Robot <hulkci@huawei.com> -Signed-off-by: YueHaibing <yuehaibing@huawei.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2982,8 +2982,6 @@ static s32 brcmf_update_bss_info(struct - struct brcmf_pub *drvr = cfg->pub; - struct brcmf_bss_info_le *bi; - const struct brcmf_tlv *tim; -- u16 beacon_interval; -- u8 dtim_period; - size_t ie_len; - u8 *ie; - s32 err = 0; -@@ -3007,12 +3005,9 @@ static s32 brcmf_update_bss_info(struct - - ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); - ie_len = le32_to_cpu(bi->ie_length); -- beacon_interval = le16_to_cpu(bi->beacon_period); - - tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM); -- if (tim) -- dtim_period = tim->data[1]; -- else { -+ if (!tim) { - /* - * active scan was done so we could not get dtim - * information out of probe response. -@@ -3024,7 +3019,6 @@ static s32 brcmf_update_bss_info(struct - bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err); - goto update_bss_info_out; - } -- dtim_period = (u8)var; - } - - update_bss_info_out: diff --git a/package/kernel/mac80211/patches/brcm/107-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch b/package/kernel/mac80211/patches/brcm/107-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch deleted file mode 100644 index 84573af23e..0000000000 --- a/package/kernel/mac80211/patches/brcm/107-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 73c742bb9c9ba30871fdd5c730d5ca8b6712833a Mon Sep 17 00:00:00 2001 -From: Colin Ian King <colin.king@canonical.com> -Date: Fri, 9 Aug 2019 18:22:17 +0100 -Subject: [PATCH] brcmfmac: remove redundant assignment to pointer hash - -The pointer hash is being initialized with a value that is never read -and is being re-assigned a little later on. The assignment is -redundant and hence can be removed. - -Addresses-Coverity: ("Unused value") -Signed-off-by: Colin Ian King <colin.king@canonical.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 - - 1 file changed, 1 deletion(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c -@@ -1468,7 +1468,6 @@ static int brcmf_msgbuf_stats_read(struc - seq_printf(seq, "\nh2d_flowrings: depth %u\n", - BRCMF_H2D_TXFLOWRING_MAX_ITEM); - seq_puts(seq, "Active flowrings:\n"); -- hash = msgbuf->flow->hash; - for (i = 0; i < msgbuf->flow->nrofrings; i++) { - if (!msgbuf->flow->rings[i]) - continue; diff --git a/package/kernel/mac80211/patches/brcm/108-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch b/package/kernel/mac80211/patches/brcm/108-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch deleted file mode 100644 index 5efe6a8f14..0000000000 --- a/package/kernel/mac80211/patches/brcm/108-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5f42b382ead278c1f6c3854765c97eb20491aa2a Mon Sep 17 00:00:00 2001 -From: Xulin Sun <xulin.sun@windriver.com> -Date: Fri, 23 Aug 2019 15:47:08 +0800 -Subject: [PATCH] brcmfmac: replace strncpy() by strscpy() - -The strncpy() may truncate the copied string, -replace it by the safer strscpy(). - -To avoid below compile warning with gcc 8.2: - -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:In function 'brcmf_vndr_ie': -drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:4227:2: -warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] - strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Signed-off-by: Xulin Sun <xulin.sun@windriver.com> -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -4244,9 +4244,7 @@ next: - static u32 - brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) - { -- -- strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); -- iebuf[VNDR_IE_CMD_LEN - 1] = '\0'; -+ strscpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN); - - put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]); - diff --git a/package/kernel/mac80211/patches/brcm/109-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch b/package/kernel/mac80211/patches/brcm/109-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch deleted file mode 100644 index b04e78c70e..0000000000 --- a/package/kernel/mac80211/patches/brcm/109-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 82f93cf46d6007ffa003b2d4a2834563b6b84d21 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Thu, 29 Aug 2019 10:27:01 +0200 -Subject: [PATCH] brcmfmac: get chip's default RAM info during PCIe setup -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Getting RAM info just once per driver's lifetime (during chip -recognition) is not enough as it may get adjusted later (depending on -the used firmware). Subsequent inits may load different firmwares so a -full RAM recognition is required on every PCIe setup. This is especially -important since implementing hardware reset on a firmware crash. - -Moreover calling brcmf_chip_get_raminfo() makes sure that RAM core is -up. It's important as having BCMA_CORE_SYS_MEM down on BCM4366 was -resulting in firmware failing to initialize and following error: -[ 65.657546] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: Invalid shared RAM address 0x04000001 - -This change makes brcmf_chip_get_raminfo() call during chip recognition -redundant for PCIe devices but SDIO and USB still need it and it's a -very small overhead anyway. - -Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash") -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 ++++-- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 ++++++ - 3 files changed, 11 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c -@@ -696,8 +696,10 @@ static u32 brcmf_chip_tcm_rambase(struct - return 0; - } - --static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) -+int brcmf_chip_get_raminfo(struct brcmf_chip *pub) - { -+ struct brcmf_chip_priv *ci = container_of(pub, struct brcmf_chip_priv, -+ pub); - struct brcmf_core_priv *mem_core; - struct brcmf_core *mem; - -@@ -979,7 +981,7 @@ static int brcmf_chip_recognition(struct - brcmf_chip_set_passive(&ci->pub); - } - -- return brcmf_chip_get_raminfo(ci); -+ return brcmf_chip_get_raminfo(&ci->pub); - } - - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id) ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h -@@ -69,6 +69,7 @@ struct brcmf_buscore_ops { - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec); - }; - -+int brcmf_chip_get_raminfo(struct brcmf_chip *pub); - struct brcmf_chip *brcmf_chip_attach(void *ctx, - const struct brcmf_buscore_ops *ops); - void brcmf_chip_detach(struct brcmf_chip *chip); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1770,6 +1770,12 @@ static void brcmf_pcie_setup(struct devi - nvram_len = fwreq->items[BRCMF_PCIE_FW_NVRAM].nv_data.len; - kfree(fwreq); - -+ ret = brcmf_chip_get_raminfo(devinfo->ci); -+ if (ret) { -+ brcmf_err(bus, "Failed to get RAM info\n"); -+ goto fail; -+ } -+ - /* Some of the firmwares have the size of the memory of the device - * defined inside the firmware. This is because part of the memory in - * the device is shared and the devision is determined by FW. Parse diff --git a/package/kernel/mac80211/patches/brcm/110-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch b/package/kernel/mac80211/patches/brcm/110-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch deleted file mode 100644 index 3fbf0dedd9..0000000000 --- a/package/kernel/mac80211/patches/brcm/110-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cb34212b1c25f7656a315f956d72696777e88340 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Sun, 1 Sep 2019 13:34:35 +0200 -Subject: [PATCH] brcmfmac: add stub version of brcmf_debugfs_get_devdir() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -In case of compiling driver without DEBUG expose a stub function to make -writing debug code much simpler (no extra conditions). This will allow -e.g. using debugfs_create_file() without any magic if or #ifdef. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h -@@ -121,6 +121,10 @@ int brcmf_debugfs_add_entry(struct brcmf - int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, - size_t len); - #else -+static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) -+{ -+ return ERR_PTR(-ENOENT); -+} - static inline - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, - int (*read_fn)(struct seq_file *seq, void *data)) diff --git a/package/kernel/mac80211/patches/brcm/110-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch b/package/kernel/mac80211/patches/brcm/110-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch deleted file mode 100644 index b3d01477a6..0000000000 --- a/package/kernel/mac80211/patches/brcm/110-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 2f8c8e62cd50d72ac68de884a09c6f5a969a269c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Sun, 1 Sep 2019 13:34:36 +0200 -Subject: [PATCH] brcmfmac: add "reset" debugfs entry for testing reset -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is a trivial debugfs entry for triggering reset just like in case -of firmware crash. It works by writing 1 to it: -echo 1 > reset - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/core.c | 25 +++++++++++++++++++ - 1 file changed, 25 insertions(+) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1107,6 +1107,29 @@ static void brcmf_core_bus_reset(struct - brcmf_bus_reset(drvr->bus_if); - } - -+static ssize_t bus_reset_write(struct file *file, const char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct brcmf_pub *drvr = file->private_data; -+ u8 value; -+ -+ if (kstrtou8_from_user(user_buf, count, 0, &value)) -+ return -EINVAL; -+ -+ if (value != 1) -+ return -EINVAL; -+ -+ schedule_work(&drvr->bus_reset); -+ -+ return count; -+} -+ -+static const struct file_operations bus_reset_fops = { -+ .open = simple_open, -+ .llseek = no_llseek, -+ .write = bus_reset_write, -+}; -+ - static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops) - { - int ret = -1; -@@ -1182,6 +1205,8 @@ static int brcmf_bus_started(struct brcm - - /* populate debugfs */ - brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read); -+ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr, -+ &bus_reset_fops); - brcmf_feat_debugfs_create(drvr); - brcmf_proto_debugfs_create(drvr); - brcmf_bus_debugfs_create(bus_if); diff --git a/package/kernel/mac80211/patches/brcm/111-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch b/package/kernel/mac80211/patches/brcm/111-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch deleted file mode 100644 index 9576b2b5b2..0000000000 --- a/package/kernel/mac80211/patches/brcm/111-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0e48b86d9a8f5c695bb02c9c02f6dc7d2ec8f2e2 Mon Sep 17 00:00:00 2001 -From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> -Date: Wed, 4 Sep 2019 20:50:52 +0300 -Subject: [PATCH] brcmfmac: use %*ph to print small buffer - -Use %*ph format to print small buffer as hex string. - -Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/cfg80211.c | 18 ++++++------------ - 1 file changed, 6 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -4222,10 +4222,8 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_b - - vndr_ies->count++; - -- brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n", -- parsed_info->vndrie.oui[0], -- parsed_info->vndrie.oui[1], -- parsed_info->vndrie.oui[2], -+ brcmf_dbg(TRACE, "** OUI %3ph, type 0x%02x\n", -+ parsed_info->vndrie.oui, - parsed_info->vndrie.oui_type); - - if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) -@@ -4349,12 +4347,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c - for (i = 0; i < old_vndr_ies.count; i++) { - vndrie_info = &old_vndr_ies.ie_info[i]; - -- brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", -+ brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%3ph\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, -- vndrie_info->vndrie.oui[0], -- vndrie_info->vndrie.oui[1], -- vndrie_info->vndrie.oui[2]); -+ vndrie_info->vndrie.oui); - - del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, - vndrie_info->ie_ptr, -@@ -4386,12 +4382,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c - remained_buf_len -= (vndrie_info->ie_len + - VNDR_IE_VSIE_OFFSET); - -- brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", -+ brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%3ph\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, -- vndrie_info->vndrie.oui[0], -- vndrie_info->vndrie.oui[1], -- vndrie_info->vndrie.oui[2]); -+ vndrie_info->vndrie.oui); - - del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, - vndrie_info->ie_ptr, diff --git a/package/kernel/mac80211/patches/brcm/112-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch b/package/kernel/mac80211/patches/brcm/112-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch deleted file mode 100644 index 653251feff..0000000000 --- a/package/kernel/mac80211/patches/brcm/112-v5.4-0001-brcmfmac-move-cfg80211_ops-pointer-to-another-struct.patch +++ /dev/null @@ -1,95 +0,0 @@ -From ba76ff25ee64d5cfc86209d1fbb3c294b2c04412 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 3 Sep 2019 06:29:26 +0200 -Subject: [PATCH 1/3] brcmfmac: move "cfg80211_ops" pointer to another struct -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This moves "ops" pointer from "struct brcmf_cfg80211_info" to the -"struct brcmf_pub". This movement makes it possible to allocate wiphy -without attaching cfg80211 (brcmf_cfg80211_attach()). It's required for -later separation of wiphy allocation and driver initialization. - -While at it fix also an unlikely memory leak in the brcmf_attach(). - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 - - .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | 1 - - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 9 ++++++--- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + - 4 files changed, 7 insertions(+), 5 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -7202,7 +7202,6 @@ void brcmf_cfg80211_detach(struct brcmf_ - brcmf_pno_detach(cfg); - brcmf_btcoex_detach(cfg); - wiphy_unregister(cfg->wiphy); -- kfree(cfg->ops); - wl_deinit_priv(cfg); - brcmf_free_wiphy(cfg->wiphy); - kfree(cfg); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h -@@ -292,7 +292,6 @@ struct brcmf_cfg80211_wowl { - */ - struct brcmf_cfg80211_info { - struct wiphy *wiphy; -- struct cfg80211_ops *ops; - struct brcmf_cfg80211_conf *conf; - struct brcmf_p2p_info p2p; - struct brcmf_btcoex_info *btcoex; ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1245,12 +1245,15 @@ int brcmf_attach(struct device *dev, str - return -ENOMEM; - - wiphy = wiphy_new(ops, sizeof(*drvr)); -- if (!wiphy) -+ if (!wiphy) { -+ kfree(ops); - return -ENOMEM; -+ } - - set_wiphy_dev(wiphy, dev); - drvr = wiphy_priv(wiphy); - drvr->wiphy = wiphy; -+ drvr->ops = ops; - - for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) - drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; -@@ -1283,12 +1286,10 @@ int brcmf_attach(struct device *dev, str - goto fail; - } - -- drvr->config->ops = ops; - return 0; - - fail: - brcmf_detach(dev); -- kfree(ops); - - return ret; - } -@@ -1374,6 +1375,8 @@ void brcmf_detach(struct device *dev) - - bus_if->drvr = NULL; - -+ kfree(drvr->ops); -+ - wiphy_free(drvr->wiphy); - } - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h -@@ -97,6 +97,7 @@ struct brcmf_pub { - struct brcmf_bus *bus_if; - struct brcmf_proto *proto; - struct wiphy *wiphy; -+ struct cfg80211_ops *ops; - struct brcmf_cfg80211_info *config; - - /* Internal brcmf items */ diff --git a/package/kernel/mac80211/patches/brcm/112-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch b/package/kernel/mac80211/patches/brcm/112-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch deleted file mode 100644 index e0b2c7dd21..0000000000 --- a/package/kernel/mac80211/patches/brcm/112-v5.4-0002-brcmfmac-split-brcmf_attach-and-brcmf_detach-functio.patch +++ /dev/null @@ -1,266 +0,0 @@ -From 450914c39f88d1adada26256360dea7050ff4e83 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 3 Sep 2019 06:29:27 +0200 -Subject: [PATCH 2/3] brcmfmac: split brcmf_attach() and brcmf_detach() - functions -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Move code allocating/freeing wiphy out of above functions. This will -allow reinitializing the driver (e.g. on some error) without allocating -a new wiphy. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - .../broadcom/brcm80211/brcmfmac/bus.h | 4 ++- - .../broadcom/brcm80211/brcmfmac/core.c | 33 ++++++++++++++---- - .../broadcom/brcm80211/brcmfmac/pcie.c | 13 +++++-- - .../broadcom/brcm80211/brcmfmac/sdio.c | 15 ++++++-- - .../broadcom/brcm80211/brcmfmac/usb.c | 34 +++++++++++++++---- - 5 files changed, 80 insertions(+), 19 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h -@@ -254,10 +254,12 @@ void brcmf_rx_frame(struct device *dev, - /* Receive async event packet from firmware. Callee disposes of rxp. */ - void brcmf_rx_event(struct device *dev, struct sk_buff *rxp); - -+int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings); - /* Indication from bus module regarding presence/insertion of dongle. */ --int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings); -+int brcmf_attach(struct device *dev); - /* Indication from bus module regarding removal/absence of dongle */ - void brcmf_detach(struct device *dev); -+void brcmf_free(struct device *dev); - /* Indication from bus module that dongle should be reset */ - void brcmf_dev_reset(struct device *dev); - /* Request from bus module to initiate a coredump */ ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1230,13 +1230,11 @@ fail: - return ret; - } - --int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) -+int brcmf_alloc(struct device *dev, struct brcmf_mp_device *settings) - { - struct wiphy *wiphy; - struct cfg80211_ops *ops; - struct brcmf_pub *drvr = NULL; -- int ret = 0; -- int i; - - brcmf_dbg(TRACE, "Enter\n"); - -@@ -1254,6 +1252,21 @@ int brcmf_attach(struct device *dev, str - drvr = wiphy_priv(wiphy); - drvr->wiphy = wiphy; - drvr->ops = ops; -+ drvr->bus_if = dev_get_drvdata(dev); -+ drvr->bus_if->drvr = drvr; -+ drvr->settings = settings; -+ -+ return 0; -+} -+ -+int brcmf_attach(struct device *dev) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ struct brcmf_pub *drvr = bus_if->drvr; -+ int ret = 0; -+ int i; -+ -+ brcmf_dbg(TRACE, "Enter\n"); - - for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++) - drvr->if2bss[i] = BRCMF_BSSIDX_INVALID; -@@ -1262,9 +1275,6 @@ int brcmf_attach(struct device *dev, str - - /* Link to bus module */ - drvr->hdrlen = 0; -- drvr->bus_if = dev_get_drvdata(dev); -- drvr->bus_if->drvr = drvr; -- drvr->settings = settings; - - /* Attach and link in the protocol */ - ret = brcmf_proto_attach(drvr); -@@ -1280,7 +1290,7 @@ int brcmf_attach(struct device *dev, str - /* attach firmware event handler */ - brcmf_fweh_attach(drvr); - -- ret = brcmf_bus_started(drvr, ops); -+ ret = brcmf_bus_started(drvr, drvr->ops); - if (ret != 0) { - bphy_err(drvr, "dongle is not responding: err=%d\n", ret); - goto fail; -@@ -1372,6 +1382,15 @@ void brcmf_detach(struct device *dev) - brcmf_cfg80211_detach(drvr->config); - drvr->config = NULL; - } -+} -+ -+void brcmf_free(struct device *dev) -+{ -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev); -+ struct brcmf_pub *drvr = bus_if->drvr; -+ -+ if (!drvr) -+ return; - - bus_if->drvr = NULL; - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1430,6 +1430,7 @@ static int brcmf_pcie_reset(struct devic - brcmf_pcie_bus_console_read(devinfo, true); - - brcmf_detach(dev); -+ brcmf_free(dev); - - brcmf_pcie_release_irq(devinfo); - brcmf_pcie_release_scratchbuffers(devinfo); -@@ -1824,11 +1825,18 @@ static void brcmf_pcie_setup(struct devi - - brcmf_pcie_intr_enable(devinfo); - brcmf_pcie_hostready(devinfo); -- if (brcmf_attach(&devinfo->pdev->dev, devinfo->settings) == 0) -- return; -+ -+ ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); -+ if (ret) -+ goto fail; -+ ret = brcmf_attach(&devinfo->pdev->dev); -+ if (ret) -+ goto fail; - - brcmf_pcie_bus_console_read(devinfo, false); - -+ return; -+ - fail: - device_release_driver(dev); - } -@@ -1971,6 +1979,7 @@ brcmf_pcie_remove(struct pci_dev *pdev) - brcmf_pcie_intr_disable(devinfo); - - brcmf_detach(&pdev->dev); -+ brcmf_free(&pdev->dev); - - kfree(bus->bus_priv.pcie); - kfree(bus->msgbuf->flowrings); ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4247,17 +4247,26 @@ static void brcmf_sdio_firmware_callback - sdiod->bus_if->chip = bus->ci->chip; - sdiod->bus_if->chiprev = bus->ci->chiprev; - -+ err = brcmf_alloc(sdiod->dev, sdiod->settings); -+ if (err) { -+ brcmf_err("brcmf_alloc failed\n"); -+ goto claim; -+ } -+ - /* Attach to the common layer, reserve hdr space */ -- err = brcmf_attach(sdiod->dev, sdiod->settings); -+ err = brcmf_attach(sdiod->dev); - if (err != 0) { - brcmf_err("brcmf_attach failed\n"); -- sdio_claim_host(sdiod->func1); -- goto checkdied; -+ goto free; - } - - /* ready */ - return; - -+free: -+ brcmf_free(sdiod->dev); -+claim: -+ sdio_claim_host(sdiod->func1); - checkdied: - brcmf_sdio_checkdied(bus); - release: ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c -@@ -1178,8 +1178,12 @@ static void brcmf_usb_probe_phase2(struc - if (ret) - goto error; - -+ ret = brcmf_alloc(devinfo->dev, devinfo->settings); -+ if (ret) -+ goto error; -+ - /* Attach to the common driver interface */ -- ret = brcmf_attach(devinfo->dev, devinfo->settings); -+ ret = brcmf_attach(devinfo->dev); - if (ret) - goto error; - -@@ -1251,7 +1255,10 @@ static int brcmf_usb_probe_cb(struct brc - } - - if (!brcmf_usb_dlneeded(devinfo)) { -- ret = brcmf_attach(devinfo->dev, devinfo->settings); -+ ret = brcmf_alloc(devinfo->dev, devinfo->settings); -+ if (ret) -+ goto fail; -+ ret = brcmf_attach(devinfo->dev); - if (ret) - goto fail; - /* we are done */ -@@ -1279,6 +1286,7 @@ static int brcmf_usb_probe_cb(struct brc - - fail: - /* Release resources in reverse order */ -+ brcmf_free(devinfo->dev); - kfree(bus); - brcmf_usb_detach(devinfo); - return ret; -@@ -1292,6 +1300,7 @@ brcmf_usb_disconnect_cb(struct brcmf_usb - brcmf_dbg(USB, "Enter, bus_pub %p\n", devinfo); - - brcmf_detach(devinfo->dev); -+ brcmf_free(devinfo->dev); - kfree(devinfo->bus_pub.bus); - brcmf_usb_detach(devinfo); - } -@@ -1435,10 +1444,12 @@ static int brcmf_usb_suspend(struct usb_ - - brcmf_dbg(USB, "Enter\n"); - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP; -- if (devinfo->wowl_enabled) -+ if (devinfo->wowl_enabled) { - brcmf_cancel_all_urbs(devinfo); -- else -+ } else { - brcmf_detach(&usb->dev); -+ brcmf_free(&usb->dev); -+ } - return 0; - } - -@@ -1451,8 +1462,19 @@ static int brcmf_usb_resume(struct usb_i - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); - - brcmf_dbg(USB, "Enter\n"); -- if (!devinfo->wowl_enabled) -- return brcmf_attach(devinfo->dev, devinfo->settings); -+ if (!devinfo->wowl_enabled) { -+ int err; -+ -+ err = brcmf_alloc(&usb->dev, devinfo->settings); -+ if (err) -+ return err; -+ -+ err = brcmf_attach(devinfo->dev); -+ if (err) { -+ brcmf_free(devinfo->dev); -+ return err; -+ } -+ } - - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_UP; - brcmf_usb_rx_fill_all(devinfo); diff --git a/package/kernel/mac80211/patches/brcm/112-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch b/package/kernel/mac80211/patches/brcm/112-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch deleted file mode 100644 index 511f24dd72..0000000000 --- a/package/kernel/mac80211/patches/brcm/112-v5.4-0003-brcmfmac-don-t-realloc-wiphy-during-PCIe-reset.patch +++ /dev/null @@ -1,51 +0,0 @@ -From a1f5aac1765afbeace9581afa27da34085f68e1d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> -Date: Tue, 3 Sep 2019 06:29:28 +0200 -Subject: [PATCH 3/3] brcmfmac: don't realloc wiphy during PCIe reset -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Providing a new wiphy on every PCIe reset was confusing and was causing -configuration problems for some users (supplicant and authenticators). -Sticking to the existing wiphy should make error recovery much simpler -and more reliable. - -Signed-off-by: Rafał Miłecki <rafal@milecki.pl> -Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> ---- - drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1430,7 +1430,6 @@ static int brcmf_pcie_reset(struct devic - brcmf_pcie_bus_console_read(devinfo, true); - - brcmf_detach(dev); -- brcmf_free(dev); - - brcmf_pcie_release_irq(devinfo); - brcmf_pcie_release_scratchbuffers(devinfo); -@@ -1826,9 +1825,6 @@ static void brcmf_pcie_setup(struct devi - brcmf_pcie_intr_enable(devinfo); - brcmf_pcie_hostready(devinfo); - -- ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); -- if (ret) -- goto fail; - ret = brcmf_attach(&devinfo->pdev->dev); - if (ret) - goto fail; -@@ -1931,6 +1927,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c - bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot); - dev_set_drvdata(&pdev->dev, bus); - -+ ret = brcmf_alloc(&devinfo->pdev->dev, devinfo->settings); -+ if (ret) -+ goto fail_bus; -+ - fwreq = brcmf_pcie_prepare_fw_request(devinfo); - if (!fwreq) { - ret = -ENOMEM; |