From 9485ea721eb091acfa0f076ef12cf3cc3e6d6c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 12 Feb 2019 14:17:46 +0100 Subject: mac80211: brcmfmac: backport early changes queued for the Linux 5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...d-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch | 51 + ...dd-a-check-for-the-status-of-usb_register.patch | 28 + ...x-system-warning-message-during-wowl-susp.patch | 33 + ...dify-__brcmf_err-to-take-bus-as-a-paramet.patch | 104 + ...mac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch | 266 +++ ...add-bphy_err-and-use-it-in-the-cfg80211.c.patch | 2025 ++++++++++++++++++++ .../patches/brcm/347-v5.1-brcmfmac-fix-typos.patch | 62 + ...pport-monitor-frames-with-the-hardware-uc.patch | 143 ++ ...mfmac-register-wiphy-s-during-module_init.patch | 2 +- ...rkaround-bug-with-some-inconsistent-BSSes.patch | 2 +- .../862-brcmfmac-Disable-power-management.patch | 2 +- 11 files changed, 2715 insertions(+), 3 deletions(-) create mode 100644 package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch create mode 100644 package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch create mode 100644 package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch create mode 100644 package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch create mode 100644 package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch create mode 100644 package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch create mode 100644 package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch create mode 100644 package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch (limited to 'package') diff --git a/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch b/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch new file mode 100644 index 0000000000..4cb3a4243a --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/340-v5.1-brcmfmac-Add-DMI-nvram-filename-quirk-for-PoV-TAB-P1.patch @@ -0,0 +1,51 @@ +From 4d95f99c59b8b814bcf09ba86020d937ec7caa86 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Thu, 20 Dec 2018 17:40:58 +0100 +Subject: [PATCH] brcmfmac: Add DMI nvram filename quirk for PoV TAB-P1006W-232 + tablet + +The Point of View TAB-P1006W-232 tablet contains quite generic names in +the sys_vendor and product_name DMI strings, without this patch brcmfmac +will try to load: brcmfmac43340-sdio.Insyde-BayTrail.txt as nvram file +which is a bit too generic. + +Add a DMI quirk so that a unique and clearly identifiable nvram file +name is used on the PoV TAB-P1006W-232 tablet. + +Signed-off-by: Hans de Goede +Signed-off-by: Kalle Valo +--- + .../wireless/broadcom/brcm80211/brcmfmac/dmi.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +@@ -43,6 +43,10 @@ static const struct brcmf_dmi_data meego + BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08" + }; + ++static const struct brcmf_dmi_data pov_tab_p1006w_data = { ++ BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data" ++}; ++ + static const struct dmi_system_id dmi_platform_data[] = { + { + /* Match for the GPDwin which unfortunately uses somewhat +@@ -81,6 +85,17 @@ static const struct dmi_system_id dmi_pl + }, + .driver_data = (void *)&meegopad_t08_data, + }, ++ { ++ /* Point of View TAB-P1006W-232 */ ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"), ++ /* Note 105b is Foxcon's USB/PCI vendor id */ ++ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), ++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), ++ }, ++ .driver_data = (void *)&pov_tab_p1006w_data, ++ }, + {} + }; + diff --git a/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch b/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch new file mode 100644 index 0000000000..3568910678 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/341-v5.1-brcmfmac-add-a-check-for-the-status-of-usb_register.patch @@ -0,0 +1,28 @@ +From 42daad3343be4a4e1ee03e30a5f5cc731dadfef5 Mon Sep 17 00:00:00 2001 +From: Kangjie Lu +Date: Tue, 25 Dec 2018 19:22:24 -0600 +Subject: [PATCH] brcmfmac: add a check for the status of usb_register + +usb_register() may fail, so let's check its status and issue an error +message if it fails. + +Signed-off-by: Kangjie Lu +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1552,6 +1552,10 @@ void brcmf_usb_exit(void) + + void brcmf_usb_register(void) + { ++ int ret; ++ + brcmf_dbg(USB, "Enter\n"); +- usb_register(&brcmf_usbdrvr); ++ ret = usb_register(&brcmf_usbdrvr); ++ if (ret) ++ brcmf_err("usb_register failed %d\n", ret); + } diff --git a/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch b/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch new file mode 100644 index 0000000000..9115373add --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/342-v5.1-brcmfmac-fix-system-warning-message-during-wowl-susp.patch @@ -0,0 +1,33 @@ +From 3a33bd840523aaa06f4429fbfd38922bf0dc2e8d Mon Sep 17 00:00:00 2001 +From: Lo-Hsiang Lo +Date: Mon, 7 Jan 2019 08:46:16 +0000 +Subject: [PATCH] brcmfmac: fix system warning message during wowl suspend + +There is a system warning message, warn_slowpath-fmt, during suspend +while using supplicant join AP and enable wowl feature by IW command. +It's caused by brcmf_pno_remove_request path can't find the reqid. +This fix will not go to remove pno request function if there is no +pno scan. + +Acked-by: Arend van Spriel +Signed-off-by: Lo-Hsiang Lo +Signed-off-by: Chi-Hsien Lin +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +@@ -496,6 +496,11 @@ int brcmf_pno_stop_sched_scan(struct brc + brcmf_dbg(TRACE, "reqid=%llu\n", reqid); + + pi = ifp_to_pno(ifp); ++ ++ /* No PNO request */ ++ if (!pi->n_reqs) ++ return 0; ++ + err = brcmf_pno_remove_request(pi, reqid); + if (err) + return err; diff --git a/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch b/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch new file mode 100644 index 0000000000..f83f38f274 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/344-v5.1-brcmfmac-modify-__brcmf_err-to-take-bus-as-a-paramet.patch @@ -0,0 +1,104 @@ +From 5cc898fbcb352b764f8d51c16e10e2eb0056173d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 6 Feb 2019 12:28:15 +0100 +Subject: [PATCH] brcmfmac: modify __brcmf_err() to take bus as a parameter +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far __brcmf_err() was using pr_err() which didn't allow identifying +device that was affected by an error. It's crucial for systems with more +than 1 device supported by brcmfmac (a common case for home routers). + +This change allows passing struct brcmf_bus to the __brcmf_err(). That +struct has been agreed to be the most common one. It allows accessing +struct device easily & using dev_err() printing helper. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 7 +++++-- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 +++++--- + .../wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 9 +++++++-- + 3 files changed, 17 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -350,7 +350,7 @@ done: + } + + #ifndef CPTCFG_BRCM_TRACING +-void __brcmf_err(const char *func, const char *fmt, ...) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...) + { + struct va_format vaf; + va_list args; +@@ -359,7 +359,10 @@ void __brcmf_err(const char *func, const + + vaf.fmt = fmt; + vaf.va = &args; +- pr_err("%s: %pV", func, &vaf); ++ if (bus) ++ dev_err(bus->dev, "%s: %pV", func, &vaf); ++ else ++ pr_err("%s: %pV", func, &vaf); + + va_end(args); + } +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -45,8 +45,10 @@ + #undef pr_fmt + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +-__printf(2, 3) +-void __brcmf_err(const char *func, const char *fmt, ...); ++struct brcmf_bus; ++ ++__printf(3, 4) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...); + /* Macro for error messages. When debugging / tracing the driver all error + * messages are important to us. + */ +@@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const + if (IS_ENABLED(CPTCFG_BRCMDBG) || \ + IS_ENABLED(CPTCFG_BRCM_TRACING) || \ + net_ratelimit()) \ +- __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ ++ __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ + } while (0) + + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +@@ -14,14 +14,16 @@ + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#include + #include /* bug in tracepoint.h, it should include this */ + + #ifndef __CHECKER__ + #define CREATE_TRACE_POINTS ++#include "bus.h" + #include "tracepoint.h" + #include "debug.h" + +-void __brcmf_err(const char *func, const char *fmt, ...) ++void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...) + { + struct va_format vaf = { + .fmt = fmt, +@@ -30,7 +32,10 @@ void __brcmf_err(const char *func, const + + va_start(args, fmt); + vaf.va = &args; +- pr_err("%s: %pV", func, &vaf); ++ if (bus) ++ dev_err(bus->dev, "%s: %pV", func, &vaf); ++ else ++ pr_err("%s: %pV", func, &vaf); + trace_brcmf_err(func, &vaf); + va_end(args); + } diff --git a/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch b/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch new file mode 100644 index 0000000000..8eceee6859 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/345-v5.1-brcmfmac-pass-bus-to-the-__brcmf_err-in-pcie.c.patch @@ -0,0 +1,266 @@ +From 8602e62441aba276cafd68034b72162fbc5ca0a6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 6 Feb 2019 12:28:16 +0100 +Subject: [PATCH] brcmfmac: pass bus to the __brcmf_err() in pcie.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This enables dev_err() usage (instead of pr_err()) in the __brcmf_err(). +It makes error messages more meaningful and is important for debugging +errors/bugs on systems with multiple brcmfmac supported devices. + +All bus files should follow & get updated similarly (soon). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/debug.h | 2 + + .../broadcom/brcm80211/brcmfmac/pcie.c | 59 +++++++++++-------- + 2 files changed, 38 insertions(+), 23 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -52,6 +52,7 @@ void __brcmf_err(struct brcmf_bus *bus, + /* Macro for error messages. When debugging / tracing the driver all error + * messages are important to us. + */ ++#ifndef brcmf_err + #define brcmf_err(fmt, ...) \ + do { \ + if (IS_ENABLED(CPTCFG_BRCMDBG) || \ +@@ -59,6 +60,7 @@ void __brcmf_err(struct brcmf_bus *bus, + net_ratelimit()) \ + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ + } while (0) ++#endif + + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -30,6 +30,15 @@ + #include + #include + ++/* Custom brcmf_err() that takes bus arg and passes it further */ ++#define brcmf_err(bus, fmt, ...) \ ++ do { \ ++ if (IS_ENABLED(CPTCFG_BRCMDBG) || \ ++ IS_ENABLED(CPTCFG_BRCM_TRACING) || \ ++ net_ratelimit()) \ ++ __brcmf_err(bus, __func__, fmt, ##__VA_ARGS__); \ ++ } while (0) ++ + #include "debug.h" + #include "bus.h" + #include "commonring.h" +@@ -531,6 +540,7 @@ static void + brcmf_pcie_select_core(struct brcmf_pciedev_info *devinfo, u16 coreid) + { + const struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + struct brcmf_core *core; + u32 bar0_win; + +@@ -548,7 +558,7 @@ brcmf_pcie_select_core(struct brcmf_pcie + } + } + } else { +- brcmf_err("Unsupported core selected %x\n", coreid); ++ brcmf_err(bus, "Unsupported core selected %x\n", coreid); + } + } + +@@ -848,9 +858,8 @@ static irqreturn_t brcmf_pcie_isr_thread + + static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; +- +- pdev = devinfo->pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + + brcmf_pcie_intr_disable(devinfo); + +@@ -861,7 +870,7 @@ static int brcmf_pcie_request_irq(struct + brcmf_pcie_isr_thread, IRQF_SHARED, + "brcmf_pcie_intr", devinfo)) { + pci_disable_msi(pdev); +- brcmf_err("Failed to request IRQ %d\n", pdev->irq); ++ brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq); + return -EIO; + } + devinfo->irq_allocated = true; +@@ -871,15 +880,14 @@ static int brcmf_pcie_request_irq(struct + + static void brcmf_pcie_release_irq(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + u32 status; + u32 count; + + if (!devinfo->irq_allocated) + return; + +- pdev = devinfo->pdev; +- + brcmf_pcie_intr_disable(devinfo); + free_irq(pdev->irq, devinfo); + pci_disable_msi(pdev); +@@ -891,7 +899,7 @@ static void brcmf_pcie_release_irq(struc + count++; + } + if (devinfo->in_irq) +- brcmf_err("Still in IRQ (processing) !!!\n"); ++ brcmf_err(bus, "Still in IRQ (processing) !!!\n"); + + status = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT); + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT, status); +@@ -1102,6 +1110,7 @@ static void brcmf_pcie_release_ringbuffe + + static int brcmf_pcie_init_ringbuffers(struct brcmf_pciedev_info *devinfo) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + struct brcmf_pcie_ringbuf *ring; + struct brcmf_pcie_ringbuf *rings; + u32 d2h_w_idx_ptr; +@@ -1254,7 +1263,7 @@ static int brcmf_pcie_init_ringbuffers(s + return 0; + + fail: +- brcmf_err("Allocating ring buffers failed\n"); ++ brcmf_err(bus, "Allocating ring buffers failed\n"); + brcmf_pcie_release_ringbuffers(devinfo); + return -ENOMEM; + } +@@ -1277,6 +1286,7 @@ brcmf_pcie_release_scratchbuffers(struct + + static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + u64 address; + u32 addr; + +@@ -1316,7 +1326,7 @@ static int brcmf_pcie_init_scratchbuffer + return 0; + + fail: +- brcmf_err("Allocating scratch buffers failed\n"); ++ brcmf_err(bus, "Allocating scratch buffers failed\n"); + brcmf_pcie_release_scratchbuffers(devinfo); + return -ENOMEM; + } +@@ -1437,6 +1447,7 @@ static int + brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo, + u32 sharedram_addr) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + struct brcmf_pcie_shared_info *shared; + u32 addr; + +@@ -1448,7 +1459,8 @@ brcmf_pcie_init_share_ram_info(struct br + brcmf_dbg(PCIE, "PCIe protocol version %d\n", shared->version); + if ((shared->version > BRCMF_PCIE_MAX_SHARED_VERSION) || + (shared->version < BRCMF_PCIE_MIN_SHARED_VERSION)) { +- brcmf_err("Unsupported PCIE version %d\n", shared->version); ++ brcmf_err(bus, "Unsupported PCIE version %d\n", ++ shared->version); + return -EINVAL; + } + +@@ -1490,6 +1502,7 @@ static int brcmf_pcie_download_fw_nvram( + const struct firmware *fw, void *nvram, + u32 nvram_len) + { ++ struct brcmf_bus *bus = dev_get_drvdata(&devinfo->pdev->dev); + u32 sharedram_addr; + u32 sharedram_addr_written; + u32 loop_counter; +@@ -1544,7 +1557,7 @@ static int brcmf_pcie_download_fw_nvram( + loop_counter--; + } + if (sharedram_addr == sharedram_addr_written) { +- brcmf_err("FW failed to initialize\n"); ++ brcmf_err(bus, "FW failed to initialize\n"); + return -ENODEV; + } + brcmf_dbg(PCIE, "Shared RAM addr: 0x%08x\n", sharedram_addr); +@@ -1555,16 +1568,15 @@ static int brcmf_pcie_download_fw_nvram( + + static int brcmf_pcie_get_resource(struct brcmf_pciedev_info *devinfo) + { +- struct pci_dev *pdev; ++ struct pci_dev *pdev = devinfo->pdev; ++ struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev); + int err; + phys_addr_t bar0_addr, bar1_addr; + ulong bar1_size; + +- pdev = devinfo->pdev; +- + err = pci_enable_device(pdev); + if (err) { +- brcmf_err("pci_enable_device failed err=%d\n", err); ++ brcmf_err(bus, "pci_enable_device failed err=%d\n", err); + return err; + } + +@@ -1577,7 +1589,7 @@ static int brcmf_pcie_get_resource(struc + /* read Bar-1 mapped memory range */ + bar1_size = pci_resource_len(pdev, 2); + if ((bar1_size == 0) || (bar1_addr == 0)) { +- brcmf_err("BAR1 Not enabled, device size=%ld, addr=%#016llx\n", ++ brcmf_err(bus, "BAR1 Not enabled, device size=%ld, addr=%#016llx\n", + bar1_size, (unsigned long long)bar1_addr); + return -EINVAL; + } +@@ -1586,7 +1598,7 @@ static int brcmf_pcie_get_resource(struc + devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size); + + if (!devinfo->regs || !devinfo->tcm) { +- brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs, ++ brcmf_err(bus, "ioremap() failed (%p,%p)\n", devinfo->regs, + devinfo->tcm); + return -EINVAL; + } +@@ -1873,7 +1885,7 @@ fail_bus: + kfree(bus->msgbuf); + kfree(bus); + fail: +- brcmf_err("failed %x:%x\n", pdev->vendor, pdev->device); ++ brcmf_err(NULL, "failed %x:%x\n", pdev->vendor, pdev->device); + brcmf_pcie_release_resource(devinfo); + if (devinfo->ci) + brcmf_chip_detach(devinfo->ci); +@@ -1947,7 +1959,7 @@ static int brcmf_pcie_pm_enter_D3(struct + wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed, + BRCMF_PCIE_MBDATA_TIMEOUT); + if (!devinfo->mbdata_completed) { +- brcmf_err("Timeout on response for entering D3 substate\n"); ++ brcmf_err(bus, "Timeout on response for entering D3 substate\n"); + brcmf_bus_change_state(bus, BRCMF_BUS_UP); + return -EIO; + } +@@ -1993,7 +2005,7 @@ cleanup: + + err = brcmf_pcie_probe(pdev, NULL); + if (err) +- brcmf_err("probe after resume failed, err=%d\n", err); ++ brcmf_err(bus, "probe after resume failed, err=%d\n", err); + + return err; + } +@@ -2066,7 +2078,8 @@ void brcmf_pcie_register(void) + brcmf_dbg(PCIE, "Enter\n"); + err = pci_register_driver(&brcmf_pciedrvr); + if (err) +- brcmf_err("PCIE driver registration failed, err=%d\n", err); ++ brcmf_err(NULL, "PCIE driver registration failed, err=%d\n", ++ err); + } + + diff --git a/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch b/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch new file mode 100644 index 0000000000..efd77d4c00 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/346-v5.1-brcmfmac-add-bphy_err-and-use-it-in-the-cfg80211.c.patch @@ -0,0 +1,2025 @@ +From 3ef005b82e2ad68107fc5814eaa743d171a6c362 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 16 Jan 2019 07:28:54 +0100 +Subject: [PATCH] brcmfmac: add bphy_err() and use it in the cfg80211.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This new macro uses wiphy_err() which: +1) Should be the best choice with wiphy already created +2) Uses dev_err() which allows identifying error-affected device + +Signed-off-by: Rafał Miłecki +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 497 ++++++++++-------- + .../broadcom/brcm80211/brcmfmac/debug.h | 9 + + 2 files changed, 282 insertions(+), 224 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -457,6 +457,7 @@ static void convert_key_from_CPU(struct + static int + send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + int err; + struct brcmf_wsec_key_le key_le; + +@@ -468,7 +469,7 @@ send_key_to_dongle(struct brcmf_if *ifp, + sizeof(key_le)); + + if (err) +- brcmf_err("wsec_key error (%d)\n", err); ++ bphy_err(wiphy, "wsec_key error (%d)\n", err); + return err; + } + +@@ -508,6 +509,7 @@ static int brcmf_get_first_free_bsscfgid + + static int brcmf_cfg80211_request_ap_if(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_mbss_ssid_le mbss_ssid_le; + int bsscfgidx; + int err; +@@ -524,7 +526,7 @@ static int brcmf_cfg80211_request_ap_if( + err = brcmf_fil_bsscfg_data_set(ifp, "bsscfg:ssid", &mbss_ssid_le, + sizeof(mbss_ssid_le)); + if (err < 0) +- brcmf_err("setting ssid failed %d\n", err); ++ bphy_err(wiphy, "setting ssid failed %d\n", err); + + return err; + } +@@ -567,7 +569,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + BRCMF_VIF_EVENT_TIMEOUT); + brcmf_cfg80211_arm_vif_event(cfg, NULL); + if (!err) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(wiphy, "timeout occurred\n"); + err = -EIO; + goto fail; + } +@@ -575,7 +577,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + /* interface created in firmware */ + ifp = vif->ifp; + if (!ifp) { +- brcmf_err("no if pointer provided\n"); ++ bphy_err(wiphy, "no if pointer provided\n"); + err = -ENOENT; + goto fail; + } +@@ -583,7 +585,7 @@ struct wireless_dev *brcmf_ap_add_vif(st + strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); + err = brcmf_net_attach(ifp, true); + if (err) { +- brcmf_err("Registering netdevice failed\n"); ++ bphy_err(wiphy, "Registering netdevice failed\n"); + free_netdev(ifp->ndev); + goto fail; + } +@@ -620,7 +622,7 @@ static struct wireless_dev *brcmf_cfg802 + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type); + if (err) { +- brcmf_err("iface validation failed: err=%d\n", err); ++ bphy_err(wiphy, "iface validation failed: err=%d\n", err); + return ERR_PTR(err); + } + switch (type) { +@@ -645,8 +647,8 @@ static struct wireless_dev *brcmf_cfg802 + } + + if (IS_ERR(wdev)) +- brcmf_err("add iface %s type %d failed: err=%d\n", +- name, type, (int)PTR_ERR(wdev)); ++ bphy_err(wiphy, "add iface %s type %d failed: err=%d\n", name, ++ type, (int)PTR_ERR(wdev)); + else + brcmf_cfg80211_update_proto_addr_mode(wdev); + +@@ -661,12 +663,13 @@ static void brcmf_scan_config_mpc(struct + + void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + + if (check_vif_up(ifp->vif)) { + err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); + if (err) { +- brcmf_err("fail to set mpc\n"); ++ bphy_err(wiphy, "fail to set mpc\n"); + return; + } + brcmf_dbg(INFO, "MPC : %d\n", mpc); +@@ -677,6 +680,7 @@ s32 brcmf_notify_escan_complete(struct b + struct brcmf_if *ifp, bool aborted, + bool fw_abort) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_scan_params_le params_le; + struct cfg80211_scan_request *scan_request; + u64 reqid; +@@ -711,7 +715,7 @@ s32 brcmf_notify_escan_complete(struct b + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, + ¶ms_le, sizeof(params_le)); + if (err) +- brcmf_err("Scan abort failed\n"); ++ bphy_err(wiphy, "Scan abort failed\n"); + } + + brcmf_scan_config_mpc(ifp, 1); +@@ -763,7 +767,7 @@ static int brcmf_cfg80211_del_ap_iface(s + + err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0); + if (err) { +- brcmf_err("interface_remove failed %d\n", err); ++ bphy_err(wiphy, "interface_remove failed %d\n", err); + goto err_unarm; + } + +@@ -771,7 +775,7 @@ static int brcmf_cfg80211_del_ap_iface(s + ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL, + BRCMF_VIF_EVENT_TIMEOUT); + if (!ret) { +- brcmf_err("timeout occurred\n"); ++ bphy_err(wiphy, "timeout occurred\n"); + err = -EIO; + goto err_unarm; + } +@@ -873,14 +877,14 @@ brcmf_cfg80211_change_iface(struct wiphy + } + err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type); + if (err) { +- brcmf_err("iface validation failed: err=%d\n", err); ++ bphy_err(wiphy, "iface validation failed: err=%d\n", err); + return err; + } + switch (type) { + case NL80211_IFTYPE_MONITOR: + case NL80211_IFTYPE_WDS: +- brcmf_err("type (%d) : currently we do not support this type\n", +- type); ++ bphy_err(wiphy, "type (%d) : currently we do not support this type\n", ++ type); + return -EOPNOTSUPP; + case NL80211_IFTYPE_ADHOC: + infra = 0; +@@ -908,7 +912,7 @@ brcmf_cfg80211_change_iface(struct wiphy + } else { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); + if (err) { +- brcmf_err("WLC_SET_INFRA error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_INFRA error (%d)\n", err); + err = -EAGAIN; + goto done; + } +@@ -999,6 +1003,7 @@ static s32 + brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, + struct cfg80211_scan_request *request) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + + offsetof(struct brcmf_escan_params_le, params_le); + struct brcmf_escan_params_le *params; +@@ -1030,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in + if (err == -EBUSY) + brcmf_dbg(INFO, "system busy : escan canceled\n"); + else +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + + kfree(params); +@@ -1076,21 +1081,22 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return -EIO; + + if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); ++ bphy_err(wiphy, "Scanning already: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { +- brcmf_err("Scanning being aborted: status (%lu)\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning being aborted: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- brcmf_err("Scanning suppressed: status (%lu)\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning suppressed: status (%lu)\n", ++ cfg->scan_status); + return -EAGAIN; + } + if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state)) { +- brcmf_err("Connecting: status (%lu)\n", vif->sme_state); ++ bphy_err(wiphy, "Connecting: status (%lu)\n", vif->sme_state); + return -EAGAIN; + } + +@@ -1124,7 +1130,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, + return 0; + + scan_out: +- brcmf_err("scan error (%d)\n", err); ++ bphy_err(wiphy, "scan error (%d)\n", err); + clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); + cfg->scan_request = NULL; + return err; +@@ -1132,36 +1138,41 @@ scan_out: + + static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + +- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", +- rts_threshold); ++ err = brcmf_fil_iovar_int_set(ifp, "rtsthresh", rts_threshold); + if (err) +- brcmf_err("Error (%d)\n", err); ++ bphy_err(wiphy, "Error (%d)\n", err); + + return err; + } + + static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + +- err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", ++ err = brcmf_fil_iovar_int_set(ifp, "fragthresh", + frag_threshold); + if (err) +- brcmf_err("Error (%d)\n", err); ++ bphy_err(wiphy, "Error (%d)\n", err); + + return err; + } + + static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL); + +- err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); ++ err = brcmf_fil_cmd_int_set(ifp, cmd, retry); + if (err) { +- brcmf_err("cmd (%d) , error (%d)\n", cmd, err); ++ bphy_err(wiphy, "cmd (%d) , error (%d)\n", cmd, err); + return err; + } + return err; +@@ -1237,6 +1248,7 @@ static u16 brcmf_map_fw_linkdown_reason( + + static int brcmf_set_pmk(struct brcmf_if *ifp, const u8 *pmk_data, u16 pmk_len) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_wsec_pmk_le pmk; + int i, err; + +@@ -1250,8 +1262,8 @@ static int brcmf_set_pmk(struct brcmf_if + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_WSEC_PMK, + &pmk, sizeof(pmk)); + if (err < 0) +- brcmf_err("failed to change PSK in firmware (len=%u)\n", +- pmk_len); ++ bphy_err(wiphy, "failed to change PSK in firmware (len=%u)\n", ++ pmk_len); + + return err; + } +@@ -1259,6 +1271,7 @@ static int brcmf_set_pmk(struct brcmf_if + static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) + { + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 err = 0; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1268,7 +1281,7 @@ static void brcmf_link_down(struct brcmf + err = brcmf_fil_cmd_data_set(vif->ifp, + BRCMF_C_DISASSOC, NULL, 0); + if (err) { +- brcmf_err("WLC_DISASSOC failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_DISASSOC failed (%d)\n", err); + } + if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || + (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) +@@ -1356,7 +1369,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("wsec failed (%d)\n", err); ++ bphy_err(wiphy, "wsec failed (%d)\n", err); + goto done; + } + +@@ -1368,7 +1381,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); + if (err) { +- brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_BCNPRD failed (%d)\n", err); + goto done; + } + +@@ -1413,7 +1426,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, + target_channel); + if (err) { +- brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_CHANNEL failed (%d)\n", err); + goto done; + } + } else +@@ -1425,7 +1438,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) { +- brcmf_err("WLC_SET_SSID failed (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_SSID failed (%d)\n", err); + goto done; + } + +@@ -1461,6 +1474,8 @@ brcmf_cfg80211_leave_ibss(struct wiphy * + static s32 brcmf_set_wpa_version(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 val = 0; +@@ -1473,9 +1488,9 @@ static s32 brcmf_set_wpa_version(struct + else + val = WPA_AUTH_DISABLED; + brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", val); + if (err) { +- brcmf_err("set wpa_auth failed (%d)\n", err); ++ bphy_err(wiphy, "set wpa_auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1486,6 +1501,8 @@ static s32 brcmf_set_wpa_version(struct + static s32 brcmf_set_auth_type(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 val = 0; +@@ -1506,9 +1523,9 @@ static s32 brcmf_set_auth_type(struct ne + break; + } + +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) { +- brcmf_err("set auth failed (%d)\n", err); ++ bphy_err(wiphy, "set auth failed (%d)\n", err); + return err; + } + sec = &profile->sec; +@@ -1520,6 +1537,8 @@ static s32 + brcmf_set_wsec_mode(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + s32 pval = 0; +@@ -1543,8 +1562,8 @@ brcmf_set_wsec_mode(struct net_device *n + pval = AES_ENABLED; + break; + default: +- brcmf_err("invalid cipher pairwise (%d)\n", +- sme->crypto.ciphers_pairwise[0]); ++ bphy_err(wiphy, "invalid cipher pairwise (%d)\n", ++ sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } + } +@@ -1564,8 +1583,8 @@ brcmf_set_wsec_mode(struct net_device *n + gval = AES_ENABLED; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } +@@ -1578,9 +1597,9 @@ brcmf_set_wsec_mode(struct net_device *n + pval = AES_ENABLED; + + wsec = pval | gval; +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", wsec); ++ err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + return err; + } + +@@ -1595,6 +1614,7 @@ static s32 + brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) + { + struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; + s32 val; + s32 err; +@@ -1613,7 +1633,7 @@ brcmf_set_key_mgmt(struct net_device *nd + + err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), "wpa_auth", &val); + if (err) { +- brcmf_err("could not get wpa_auth (%d)\n", err); ++ bphy_err(wiphy, "could not get wpa_auth (%d)\n", err); + return err; + } + if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { +@@ -1627,8 +1647,8 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA_AUTH_PSK; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { +@@ -1650,8 +1670,8 @@ brcmf_set_key_mgmt(struct net_device *nd + val = WPA2_AUTH_PSK; + break; + default: +- brcmf_err("invalid cipher group (%d)\n", +- sme->crypto.cipher_group); ++ bphy_err(wiphy, "invalid cipher group (%d)\n", ++ sme->crypto.cipher_group); + return -EINVAL; + } + } +@@ -1697,7 +1717,7 @@ skip_mfp_config: + brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); + err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); + if (err) { +- brcmf_err("could not set wpa_auth (%d)\n", err); ++ bphy_err(wiphy, "could not set wpa_auth (%d)\n", err); + return err; + } + +@@ -1708,6 +1728,8 @@ static s32 + brcmf_set_sharedkey(struct net_device *ndev, + struct cfg80211_connect_params *sme) + { ++ struct brcmf_if *ifp = netdev_priv(ndev); ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); + struct brcmf_cfg80211_security *sec; + struct brcmf_wsec_key key; +@@ -1734,7 +1756,7 @@ brcmf_set_sharedkey(struct net_device *n + key.len = (u32) sme->key_len; + key.index = (u32) sme->key_idx; + if (key.len > sizeof(key.data)) { +- brcmf_err("Too long key length (%u)\n", key.len); ++ bphy_err(wiphy, "Too long key length (%u)\n", key.len); + return -EINVAL; + } + memcpy(key.data, sme->key, key.len); +@@ -1747,24 +1769,24 @@ brcmf_set_sharedkey(struct net_device *n + key.algo = CRYPTO_ALGO_WEP128; + break; + default: +- brcmf_err("Invalid algorithm (%d)\n", +- sme->crypto.ciphers_pairwise[0]); ++ bphy_err(wiphy, "Invalid algorithm (%d)\n", ++ sme->crypto.ciphers_pairwise[0]); + return -EINVAL; + } + /* Set the new key/index */ + brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n", + key.len, key.index, key.algo); + brcmf_dbg(CONN, "key \"%s\"\n", key.data); +- err = send_key_to_dongle(netdev_priv(ndev), &key); ++ err = send_key_to_dongle(ifp, &key); + if (err) + return err; + + if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { + brcmf_dbg(CONN, "set auth_type to shared key\n"); + val = WL_AUTH_SHARED_KEY; /* shared key */ +- err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); ++ err = brcmf_fil_bsscfg_int_set(ifp, "auth", val); + if (err) +- brcmf_err("set auth failed (%d)\n", err); ++ bphy_err(wiphy, "set auth failed (%d)\n", err); + } + return err; + } +@@ -1784,6 +1806,7 @@ enum nl80211_auth_type brcmf_war_auth_ty + static void brcmf_set_join_pref(struct brcmf_if *ifp, + struct cfg80211_bss_selection *bss_select) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_join_pref_params join_pref_params[2]; + enum nl80211_band band; + int err, i = 0; +@@ -1822,7 +1845,7 @@ static void brcmf_set_join_pref(struct b + err = brcmf_fil_iovar_data_set(ifp, "join_pref", join_pref_params, + sizeof(join_pref_params)); + if (err) +- brcmf_err("Set join_pref error (%d)\n", err); ++ bphy_err(wiphy, "Set join_pref error (%d)\n", err); + } + + static s32 +@@ -1849,7 +1872,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + return -EIO; + + if (!sme->ssid) { +- brcmf_err("Invalid ssid\n"); ++ bphy_err(wiphy, "Invalid ssid\n"); + return -EOPNOTSUPP; + } + +@@ -1878,7 +1901,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- brcmf_err("Set Assoc REQ IE Failed\n"); ++ bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -1899,32 +1922,32 @@ brcmf_cfg80211_connect(struct wiphy *wip + + err = brcmf_set_wpa_version(ndev, sme); + if (err) { +- brcmf_err("wl_set_wpa_version failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_wpa_version failed (%d)\n", err); + goto done; + } + + sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); + err = brcmf_set_auth_type(ndev, sme); + if (err) { +- brcmf_err("wl_set_auth_type failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_auth_type failed (%d)\n", err); + goto done; + } + + err = brcmf_set_wsec_mode(ndev, sme); + if (err) { +- brcmf_err("wl_set_set_cipher failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_set_cipher failed (%d)\n", err); + goto done; + } + + err = brcmf_set_key_mgmt(ndev, sme); + if (err) { +- brcmf_err("wl_set_key_mgmt failed (%d)\n", err); ++ bphy_err(wiphy, "wl_set_key_mgmt failed (%d)\n", err); + goto done; + } + + err = brcmf_set_sharedkey(ndev, sme); + if (err) { +- brcmf_err("brcmf_set_sharedkey failed (%d)\n", err); ++ bphy_err(wiphy, "brcmf_set_sharedkey failed (%d)\n", err); + goto done; + } + +@@ -1941,7 +1964,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + /* enable firmware supplicant for this interface */ + err = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1); + if (err < 0) { +- brcmf_err("failed to enable fw supplicant\n"); ++ bphy_err(wiphy, "failed to enable fw supplicant\n"); + goto done; + } + } +@@ -2036,7 +2059,7 @@ brcmf_cfg80211_connect(struct wiphy *wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, join_params_size); + if (err) +- brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_SET_SSID failed (%d)\n", err); + + done: + if (err) +@@ -2067,7 +2090,7 @@ brcmf_cfg80211_disconnect(struct wiphy * + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, + &scbval, sizeof(scbval)); + if (err) +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + + brcmf_dbg(TRACE, "Exit\n"); + return err; +@@ -2094,7 +2117,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + case NL80211_TX_POWER_LIMITED: + case NL80211_TX_POWER_FIXED: + if (mbm < 0) { +- brcmf_err("TX_POWER_FIXED - dbm is negative\n"); ++ bphy_err(wiphy, "TX_POWER_FIXED - dbm is negative\n"); + err = -EINVAL; + goto done; + } +@@ -2104,7 +2127,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy + qdbm |= WL_TXPWR_OVERRIDE; + break; + default: +- brcmf_err("Unsupported type %d\n", type); ++ bphy_err(wiphy, "Unsupported type %d\n", type); + err = -EINVAL; + goto done; + } +@@ -2112,11 +2135,11 @@ brcmf_cfg80211_set_tx_power(struct wiphy + disable = WL_RADIO_SW_DISABLE << 16; + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); + if (err) +- brcmf_err("WLC_SET_RADIO error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_RADIO error (%d)\n", err); + + err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm); + if (err) +- brcmf_err("qtxpower error (%d)\n", err); ++ bphy_err(wiphy, "qtxpower error (%d)\n", err); + + done: + brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE); +@@ -2137,7 +2160,7 @@ brcmf_cfg80211_get_tx_power(struct wiphy + + err = brcmf_fil_iovar_int_get(vif->ifp, "qtxpower", &qdbm); + if (err) { +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + goto done; + } + *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4; +@@ -2163,7 +2186,7 @@ brcmf_cfg80211_config_default_key(struct + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); + goto done; + } + +@@ -2173,7 +2196,7 @@ brcmf_cfg80211_config_default_key(struct + err = brcmf_fil_cmd_int_set(ifp, + BRCMF_C_SET_KEY_PRIMARY, index); + if (err) +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2237,7 +2260,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + if (key_idx >= BRCMF_MAX_DEFAULT_KEYS) { + /* we ignore this key index in this case */ +- brcmf_err("invalid key index (%d)\n", key_idx); ++ bphy_err(wiphy, "invalid key index (%d)\n", key_idx); + return -EINVAL; + } + +@@ -2246,7 +2269,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + mac_addr); + + if (params->key_len > sizeof(key->data)) { +- brcmf_err("Too long key length (%u)\n", params->key_len); ++ bphy_err(wiphy, "Too long key length (%u)\n", params->key_len); + return -EINVAL; + } + +@@ -2300,7 +2323,7 @@ brcmf_cfg80211_add_key(struct wiphy *wip + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); + break; + default: +- brcmf_err("Invalid cipher (0x%x)\n", params->cipher); ++ bphy_err(wiphy, "Invalid cipher (0x%x)\n", params->cipher); + err = -EINVAL; + goto done; + } +@@ -2311,13 +2334,13 @@ brcmf_cfg80211_add_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("get wsec error (%d)\n", err); ++ bphy_err(wiphy, "get wsec error (%d)\n", err); + goto done; + } + wsec |= val; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) { +- brcmf_err("set wsec error (%d)\n", err); ++ bphy_err(wiphy, "set wsec error (%d)\n", err); + goto done; + } + +@@ -2348,7 +2371,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("WLC_GET_WSEC error (%d)\n", err); ++ bphy_err(wiphy, "WLC_GET_WSEC error (%d)\n", err); + /* Ignore this error, may happen during DISASSOC */ + err = -EAGAIN; + goto done; +@@ -2369,7 +2392,7 @@ brcmf_cfg80211_get_key(struct wiphy *wip + params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; + brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); + } else { +- brcmf_err("Invalid algo (0x%x)\n", wsec); ++ bphy_err(wiphy, "Invalid algo (0x%x)\n", wsec); + err = -EINVAL; + goto done; + } +@@ -2399,6 +2422,7 @@ brcmf_cfg80211_config_default_mgmt_key(s + static void + brcmf_cfg80211_reconfigure_wep(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + u8 key_idx; + struct brcmf_wsec_key *key; +@@ -2415,18 +2439,18 @@ brcmf_cfg80211_reconfigure_wep(struct br + + err = send_key_to_dongle(ifp, key); + if (err) { +- brcmf_err("Setting WEP key failed (%d)\n", err); ++ bphy_err(wiphy, "Setting WEP key failed (%d)\n", err); + return; + } + err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); + if (err) { +- brcmf_err("get wsec error (%d)\n", err); ++ bphy_err(wiphy, "get wsec error (%d)\n", err); + return; + } + wsec |= WEP_ENABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err) +- brcmf_err("set wsec error (%d)\n", err); ++ bphy_err(wiphy, "set wsec error (%d)\n", err); + } + + static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si) +@@ -2452,6 +2476,7 @@ static void brcmf_convert_sta_flags(u32 + + static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct { + __le32 len; + struct brcmf_bss_info_le bss_le; +@@ -2467,7 +2492,7 @@ static void brcmf_fill_bss_param(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf, + WL_BSS_INFO_MAX); + if (err) { +- brcmf_err("Failed to get bss info (%d)\n", err); ++ bphy_err(wiphy, "Failed to get bss info (%d)\n", err); + goto out_kfree; + } + si->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM); +@@ -2489,6 +2514,7 @@ static s32 + brcmf_cfg80211_get_station_ibss(struct brcmf_if *ifp, + struct station_info *sinfo) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + struct brcmf_scb_val_le scbval; + struct brcmf_pktcnt_le pktcnt; + s32 err; +@@ -2498,7 +2524,7 @@ brcmf_cfg80211_get_station_ibss(struct b + /* Get the current tx rate */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); + if (err < 0) { +- brcmf_err("BRCMF_C_GET_RATE error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_RATE error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); +@@ -2508,7 +2534,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, &scbval, + sizeof(scbval)); + if (err) { +- brcmf_err("BRCMF_C_GET_RSSI error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_RSSI error (%d)\n", err); + return err; + } + rssi = le32_to_cpu(scbval.val); +@@ -2518,7 +2544,7 @@ brcmf_cfg80211_get_station_ibss(struct b + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_GET_PKTCNTS, &pktcnt, + sizeof(pktcnt)); + if (err) { +- brcmf_err("BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_GET_GET_PKTCNTS error (%d)\n", err); + return err; + } + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS) | +@@ -2566,7 +2592,7 @@ brcmf_cfg80211_get_station(struct wiphy + &sta_info_le, + sizeof(sta_info_le)); + if (err < 0) { +- brcmf_err("GET STA INFO failed, %d\n", err); ++ bphy_err(wiphy, "GET STA INFO failed, %d\n", err); + goto done; + } + } +@@ -2635,7 +2661,8 @@ brcmf_cfg80211_get_station(struct wiphy + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, + &scb_val, sizeof(scb_val)); + if (err) { +- brcmf_err("Could not get rssi (%d)\n", err); ++ bphy_err(wiphy, "Could not get rssi (%d)\n", ++ err); + goto done; + } else { + rssi = le32_to_cpu(scb_val.val); +@@ -2666,8 +2693,8 @@ brcmf_cfg80211_dump_station(struct wiphy + &cfg->assoclist, + sizeof(cfg->assoclist)); + if (err) { +- brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", +- err); ++ bphy_err(wiphy, "BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n", ++ err); + cfg->assoclist.count = 0; + return -EOPNOTSUPP; + } +@@ -2715,9 +2742,9 @@ brcmf_cfg80211_set_power_mgmt(struct wip + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); + if (err) { + if (err == -ENODEV) +- brcmf_err("net_device is not ready yet\n"); ++ bphy_err(wiphy, "net_device is not ready yet\n"); + else +- brcmf_err("error (%d)\n", err); ++ bphy_err(wiphy, "error (%d)\n", err); + } + done: + brcmf_dbg(TRACE, "Exit\n"); +@@ -2740,7 +2767,7 @@ static s32 brcmf_inform_single_bss(struc + struct cfg80211_inform_bss bss_data = {}; + + if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { +- brcmf_err("Bss info is larger than buffer. Discarding\n"); ++ bphy_err(wiphy, "Bss info is larger than buffer. Discarding\n"); + return 0; + } + +@@ -2799,6 +2826,7 @@ next_bss_le(struct brcmf_scan_results *l + + static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_scan_results *bss_list; + struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ + s32 err = 0; +@@ -2807,8 +2835,8 @@ static s32 brcmf_inform_bss(struct brcmf + bss_list = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; + if (bss_list->count != 0 && + bss_list->version != BRCMF_BSS_INFO_VERSION) { +- brcmf_err("Version %d != WL_BSS_INFO_VERSION\n", +- bss_list->version); ++ bphy_err(wiphy, "Version %d != WL_BSS_INFO_VERSION\n", ++ bss_list->version); + return -EOPNOTSUPP; + } + brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); +@@ -2852,7 +2880,7 @@ static s32 brcmf_inform_ibss(struct brcm + err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, + buf, WL_BSS_INFO_MAX); + if (err) { +- brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err); ++ bphy_err(wiphy, "WLC_GET_BSS_INFO failed: %d\n", err); + goto CleanUp; + } + +@@ -2906,6 +2934,7 @@ CleanUp: + static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_bss_info_le *bi; + const struct brcmf_tlv *tim; + u16 beacon_interval; +@@ -2922,7 +2951,7 @@ static s32 brcmf_update_bss_info(struct + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, + cfg->extra_buf, WL_EXTRA_BUF_MAX); + if (err) { +- brcmf_err("Could not get bss info %d\n", err); ++ bphy_err(wiphy, "Could not get bss info %d\n", err); + goto update_bss_info_out; + } + +@@ -2947,7 +2976,7 @@ static s32 brcmf_update_bss_info(struct + u32 var; + err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); + if (err) { +- brcmf_err("wl dtim_assoc failed (%d)\n", err); ++ bphy_err(wiphy, "wl dtim_assoc failed (%d)\n", err); + goto update_bss_info_out; + } + dtim_period = (u8)var; +@@ -2985,9 +3014,10 @@ static void brcmf_escan_timeout(struct t + { + struct brcmf_cfg80211_info *cfg = + from_timer(cfg, t, escan_timeout); ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + + if (cfg->int_escan_map || cfg->scan_request) { +- brcmf_err("timer expired\n"); ++ bphy_err(wiphy, "timer expired\n"); + schedule_work(&cfg->escan_timeout_work); + } + } +@@ -3036,6 +3066,7 @@ brcmf_cfg80211_escan_handler(struct brcm + const struct brcmf_event_msg *e, void *data) + { + struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + s32 status; + struct brcmf_escan_result_le *escan_result_le; + u32 escan_buflen; +@@ -3052,32 +3083,33 @@ brcmf_cfg80211_escan_handler(struct brcm + goto exit; + + if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { +- brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx); ++ bphy_err(wiphy, "scan not ready, bsscfgidx=%d\n", ++ ifp->bsscfgidx); + return -EPERM; + } + + if (status == BRCMF_E_STATUS_PARTIAL) { + brcmf_dbg(SCAN, "ESCAN Partial result\n"); + if (e->datalen < sizeof(*escan_result_le)) { +- brcmf_err("invalid event data length\n"); ++ bphy_err(wiphy, "invalid event data length\n"); + goto exit; + } + escan_result_le = (struct brcmf_escan_result_le *) data; + if (!escan_result_le) { +- brcmf_err("Invalid escan result (NULL pointer)\n"); ++ bphy_err(wiphy, "Invalid escan result (NULL pointer)\n"); + goto exit; + } + escan_buflen = le32_to_cpu(escan_result_le->buflen); + if (escan_buflen > BRCMF_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen < sizeof(*escan_result_le)) { +- brcmf_err("Invalid escan buffer length: %d\n", +- escan_buflen); ++ bphy_err(wiphy, "Invalid escan buffer length: %d\n", ++ escan_buflen); + goto exit; + } + if (le16_to_cpu(escan_result_le->bss_count) != 1) { +- brcmf_err("Invalid bss_count %d: ignoring\n", +- escan_result_le->bss_count); ++ bphy_err(wiphy, "Invalid bss_count %d: ignoring\n", ++ escan_result_le->bss_count); + goto exit; + } + bss_info_le = &escan_result_le->bss_info_le; +@@ -3092,8 +3124,8 @@ brcmf_cfg80211_escan_handler(struct brcm + + bi_length = le32_to_cpu(bss_info_le->length); + if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) { +- brcmf_err("Ignoring invalid bss_info length: %d\n", +- bi_length); ++ bphy_err(wiphy, "Ignoring invalid bss_info length: %d\n", ++ bi_length); + goto exit; + } + +@@ -3101,7 +3133,7 @@ brcmf_cfg80211_escan_handler(struct brcm + BIT(NL80211_IFTYPE_ADHOC))) { + if (le16_to_cpu(bss_info_le->capability) & + WLAN_CAPABILITY_IBSS) { +- brcmf_err("Ignoring IBSS result\n"); ++ bphy_err(wiphy, "Ignoring IBSS result\n"); + goto exit; + } + } +@@ -3109,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcm + list = (struct brcmf_scan_results *) + cfg->escan_info.escan_buf; + if (bi_length > BRCMF_ESCAN_BUF_SIZE - list->buflen) { +- brcmf_err("Buffer is too small: ignoring\n"); ++ bphy_err(wiphy, "Buffer is too small: ignoring\n"); + goto exit; + } + +@@ -3301,14 +3333,14 @@ brcmf_notify_sched_scan_results(struct b + WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); + brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); + if (!result_count) { +- brcmf_err("FALSE PNO Event. (pfn_count == 0)\n"); ++ bphy_err(wiphy, "FALSE PNO Event. (pfn_count == 0)\n"); + goto out_err; + } + + netinfo_start = brcmf_get_netinfo_array(pfn_result); + datalen = e->datalen - ((void *)netinfo_start - (void *)pfn_result); + if (datalen < result_count * sizeof(*netinfo)) { +- brcmf_err("insufficient event data\n"); ++ bphy_err(wiphy, "insufficient event data\n"); + goto out_err; + } + +@@ -3362,8 +3394,8 @@ brcmf_cfg80211_sched_scan_start(struct w + req->n_match_sets, req->n_ssids); + + if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { +- brcmf_err("Scanning suppressed: status=%lu\n", +- cfg->scan_status); ++ bphy_err(wiphy, "Scanning suppressed: status=%lu\n", ++ cfg->scan_status); + return -EAGAIN; + } + +@@ -3442,6 +3474,7 @@ brcmf_wowl_nd_results(struct brcmf_if *i + void *data) + { + struct brcmf_cfg80211_info *cfg = ifp->drvr->config; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_pno_scanresults_le *pfn_result; + struct brcmf_pno_net_info_le *netinfo; + +@@ -3460,8 +3493,8 @@ brcmf_wowl_nd_results(struct brcmf_if *i + } + + if (le32_to_cpu(pfn_result->count) < 1) { +- brcmf_err("Invalid result count, expected 1 (%d)\n", +- le32_to_cpu(pfn_result->count)); ++ bphy_err(wiphy, "Invalid result count, expected 1 (%d)\n", ++ le32_to_cpu(pfn_result->count)); + return -EINVAL; + } + +@@ -3498,7 +3531,7 @@ static void brcmf_report_wowl_wakeind(st + err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le, + sizeof(wake_ind_le)); + if (err) { +- brcmf_err("Get wowl_wakeind failed, err = %d\n", err); ++ bphy_err(wiphy, "Get wowl_wakeind failed, err = %d\n", err); + return; + } + +@@ -3539,7 +3572,7 @@ static void brcmf_report_wowl_wakeind(st + cfg->wowl.nd_data_completed, + BRCMF_ND_INFO_TIMEOUT); + if (!timeout) +- brcmf_err("No result for wowl net detect\n"); ++ bphy_err(wiphy, "No result for wowl net detect\n"); + else + wakeup_data.net_detect = cfg->wowl.nd_info; + } +@@ -3747,7 +3780,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *w + cfg->pmk_list.npmk = cpu_to_le32(npmk); + } + } else { +- brcmf_err("Too many PMKSA entries cached %d\n", npmk); ++ bphy_err(wiphy, "Too many PMKSA entries cached %d\n", npmk); + return -EINVAL; + } + +@@ -3793,7 +3826,7 @@ brcmf_cfg80211_del_pmksa(struct wiphy *w + memset(&pmk[i], 0, sizeof(*pmk)); + cfg->pmk_list.npmk = cpu_to_le32(npmk - 1); + } else { +- brcmf_err("Cache entry not found\n"); ++ bphy_err(wiphy, "Cache entry not found\n"); + return -EINVAL; + } + +@@ -3825,19 +3858,20 @@ brcmf_cfg80211_flush_pmksa(struct wiphy + + static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + s32 wpa_val; + + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); + if (err < 0) { +- brcmf_err("auth error %d\n", err); ++ bphy_err(wiphy, "auth error %d\n", err); + return err; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); + if (err < 0) { +- brcmf_err("wsec error %d\n", err); ++ bphy_err(wiphy, "wsec error %d\n", err); + return err; + } + /* set upper-layer auth */ +@@ -3847,7 +3881,7 @@ static s32 brcmf_configure_opensecurity( + wpa_val = WPA_AUTH_DISABLED; + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_val); + if (err < 0) { +- brcmf_err("wpa_auth error %d\n", err); ++ bphy_err(wiphy, "wpa_auth error %d\n", err); + return err; + } + +@@ -3867,6 +3901,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + const struct brcmf_vs_tlv *wpa_ie, + bool is_rsn_ie) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + u32 auth = 0; /* d11 open authentication */ + u16 count; + s32 err = 0; +@@ -3897,13 +3932,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* check for multicast cipher suite */ + if (offset + WPA_IE_MIN_OUI_LEN > len) { + err = -EINVAL; +- brcmf_err("no multicast cipher suite\n"); ++ bphy_err(wiphy, "no multicast cipher suite\n"); + goto exit; + } + + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3925,7 +3960,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + break; + default: + err = -EINVAL; +- brcmf_err("Invalid multi cast cipher info\n"); ++ bphy_err(wiphy, "Invalid multi cast cipher info\n"); + goto exit; + } + +@@ -3936,13 +3971,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for unicast suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- brcmf_err("no unicast cipher suite\n"); ++ bphy_err(wiphy, "no unicast cipher suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -3960,7 +3995,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + pval |= AES_ENABLED; + break; + default: +- brcmf_err("Invalid unicast security info\n"); ++ bphy_err(wiphy, "Invalid unicast security info\n"); + } + offset++; + } +@@ -3970,13 +4005,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* Check for auth key management suite(s) */ + if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { + err = -EINVAL; +- brcmf_err("no auth key mgmt suite\n"); ++ bphy_err(wiphy, "no auth key mgmt suite\n"); + goto exit; + } + for (i = 0; i < count; i++) { + if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { + err = -EINVAL; +- brcmf_err("ivalid OUI\n"); ++ bphy_err(wiphy, "ivalid OUI\n"); + goto exit; + } + offset += TLV_OUI_LEN; +@@ -4004,7 +4039,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + wpa_auth |= WPA2_AUTH_1X_SHA256; + break; + default: +- brcmf_err("Invalid key mgmt info\n"); ++ bphy_err(wiphy, "Invalid key mgmt info\n"); + } + offset++; + } +@@ -4046,7 +4081,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", + wme_bss_disable); + if (err < 0) { +- brcmf_err("wme_bss_disable error %d\n", err); ++ bphy_err(wiphy, "wme_bss_disable error %d\n", err); + goto exit; + } + +@@ -4060,7 +4095,7 @@ brcmf_configure_wpaie(struct brcmf_if *i + &data[offset], + WPA_IE_MIN_OUI_LEN); + if (err < 0) { +- brcmf_err("bip error %d\n", err); ++ bphy_err(wiphy, "bip error %d\n", err); + goto exit; + } + } +@@ -4071,13 +4106,13 @@ brcmf_configure_wpaie(struct brcmf_if *i + /* set auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); + if (err < 0) { +- brcmf_err("auth error %d\n", err); ++ bphy_err(wiphy, "auth error %d\n", err); + goto exit; + } + /* set wsec */ + err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); + if (err < 0) { +- brcmf_err("wsec error %d\n", err); ++ bphy_err(wiphy, "wsec error %d\n", err); + goto exit; + } + /* Configure MFP, this needs to go after wsec otherwise the wsec command +@@ -4086,14 +4121,14 @@ brcmf_configure_wpaie(struct brcmf_if *i + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MFP)) { + err = brcmf_fil_bsscfg_int_set(ifp, "mfp", mfp); + if (err < 0) { +- brcmf_err("mfp error %d\n", err); ++ bphy_err(wiphy, "mfp error %d\n", err); + goto exit; + } + } + /* set upper-layer auth */ + err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); + if (err < 0) { +- brcmf_err("wpa_auth error %d\n", err); ++ bphy_err(wiphy, "wpa_auth error %d\n", err); + goto exit; + } + +@@ -4180,6 +4215,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + const u8 *vndr_ie_buf, u32 vndr_ie_len) + { + struct brcmf_if *ifp; ++ struct wiphy *wiphy; + struct vif_saved_ie *saved_ie; + s32 err = 0; + u8 *iovar_ie_buf; +@@ -4200,6 +4236,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + if (!vif) + return -ENODEV; + ifp = vif->ifp; ++ wiphy = ifp->drvr->wiphy; + saved_ie = &vif->saved_ie; + + brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx, +@@ -4231,13 +4268,13 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + break; + default: + err = -EPERM; +- brcmf_err("not suitable type\n"); ++ bphy_err(wiphy, "not suitable type\n"); + goto exit; + } + + if (vndr_ie_len > mgmt_ie_buf_len) { + err = -ENOMEM; +- brcmf_err("extra IE size too big\n"); ++ bphy_err(wiphy, "extra IE size too big\n"); + goto exit; + } + +@@ -4298,8 +4335,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + /* verify remained buf size before copy data */ + if (remained_buf_len < (vndrie_info->vndrie.len + + VNDR_IE_VSIE_OFFSET)) { +- brcmf_err("no space in mgmt_ie_buf: len left %d", +- remained_buf_len); ++ bphy_err(wiphy, "no space in mgmt_ie_buf: len left %d", ++ remained_buf_len); + break; + } + remained_buf_len -= (vndrie_info->ie_len + +@@ -4330,7 +4367,7 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c + err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, + total_ie_buf_len); + if (err) +- brcmf_err("vndr ie set error : %d\n", err); ++ bphy_err(wiphy, "vndr ie set error : %d\n", err); + } + + exit: +@@ -4358,13 +4395,14 @@ static s32 + brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, + struct cfg80211_beacon_data *beacon) + { ++ struct wiphy *wiphy = vif->ifp->drvr->wiphy; + s32 err; + + /* Set Beacon IEs to FW */ + err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG, + beacon->tail, beacon->tail_len); + if (err) { +- brcmf_err("Set Beacon IE Failed\n"); ++ bphy_err(wiphy, "Set Beacon IE Failed\n"); + return err; + } + brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); +@@ -4374,7 +4412,7 @@ brcmf_config_ap_mgmt_ie(struct brcmf_cfg + beacon->proberesp_ies, + beacon->proberesp_ies_len); + if (err) +- brcmf_err("Set Probe Resp IE Failed\n"); ++ bphy_err(wiphy, "Set Probe Resp IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); + +@@ -4483,7 +4521,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, + is_11d); + if (err < 0) { +- brcmf_err("Regulatory Set Error, %d\n", err); ++ bphy_err(wiphy, "Regulatory Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4491,8 +4530,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, + settings->beacon_interval); + if (err < 0) { +- brcmf_err("Beacon Interval Set Error, %d\n", +- err); ++ bphy_err(wiphy, "Beacon Interval Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4500,7 +4539,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, + settings->dtim_period); + if (err < 0) { +- brcmf_err("DTIM Interval Set Error, %d\n", err); ++ bphy_err(wiphy, "DTIM Interval Set Error, %d\n", ++ err); + goto exit; + } + } +@@ -4510,7 +4550,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) { +- brcmf_err("BRCMF_C_DOWN error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", ++ err); + goto exit; + } + brcmf_fil_iovar_int_set(ifp, "apsta", 0); +@@ -4518,7 +4559,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); + if (err < 0) { +- brcmf_err("SET INFRA error %d\n", err); ++ bphy_err(wiphy, "SET INFRA error %d\n", err); + goto exit; + } + } else if (WARN_ON(supports_11d && (is_11d != ifp->vif->is_11d))) { +@@ -4534,7 +4575,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); + if (err < 0) { +- brcmf_err("setting AP mode failed %d\n", err); ++ bphy_err(wiphy, "setting AP mode failed %d\n", ++ err); + goto exit; + } + if (!mbss) { +@@ -4543,14 +4585,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + */ + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- brcmf_err("Set Channel failed: chspec=%d, %d\n", +- chanspec, err); ++ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ chanspec, err); + goto exit; + } + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) { +- brcmf_err("BRCMF_C_UP error (%d)\n", err); ++ bphy_err(wiphy, "BRCMF_C_UP error (%d)\n", err); + goto exit; + } + /* On DOWN the firmware removes the WEP keys, reconfigure +@@ -4565,14 +4607,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) { +- brcmf_err("SET SSID error (%d)\n", err); ++ bphy_err(wiphy, "SET SSID error (%d)\n", err); + goto exit; + } + + if (settings->hidden_ssid) { + err = brcmf_fil_iovar_int_set(ifp, "closednet", 1); + if (err) { +- brcmf_err("closednet error (%d)\n", err); ++ bphy_err(wiphy, "closednet error (%d)\n", err); + goto exit; + } + } +@@ -4581,14 +4623,14 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + } else if (dev_role == NL80211_IFTYPE_P2P_GO) { + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); + if (err < 0) { +- brcmf_err("Set Channel failed: chspec=%d, %d\n", +- chanspec, err); ++ bphy_err(wiphy, "Set Channel failed: chspec=%d, %d\n", ++ chanspec, err); + goto exit; + } + err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, + sizeof(ssid_le)); + if (err < 0) { +- brcmf_err("setting ssid failed %d\n", err); ++ bphy_err(wiphy, "setting ssid failed %d\n", err); + goto exit; + } + bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); +@@ -4596,7 +4638,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) { +- brcmf_err("bss_enable config failed %d\n", err); ++ bphy_err(wiphy, "bss_enable config failed %d\n", err); + goto exit; + } + +@@ -4644,13 +4686,13 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, + &join_params, sizeof(join_params)); + if (err < 0) +- brcmf_err("SET SSID error (%d)\n", err); ++ bphy_err(wiphy, "SET SSID error (%d)\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); + if (err < 0) +- brcmf_err("BRCMF_C_DOWN error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_DOWN error %d\n", err); + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); + if (err < 0) +- brcmf_err("setting AP mode failed %d\n", err); ++ bphy_err(wiphy, "setting AP mode failed %d\n", err); + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) + brcmf_fil_iovar_int_set(ifp, "mbss", 0); + brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, +@@ -4658,7 +4700,7 @@ static int brcmf_cfg80211_stop_ap(struct + /* Bring device back up so it can be used again */ + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); + if (err < 0) +- brcmf_err("BRCMF_C_UP error %d\n", err); ++ bphy_err(wiphy, "BRCMF_C_UP error %d\n", err); + + brcmf_vif_clear_mgmt_ies(ifp->vif); + } else { +@@ -4667,7 +4709,7 @@ static int brcmf_cfg80211_stop_ap(struct + err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, + sizeof(bss_enable)); + if (err < 0) +- brcmf_err("bss_enable config failed %d\n", err); ++ bphy_err(wiphy, "bss_enable config failed %d\n", err); + } + brcmf_set_mpc(ifp, 1); + brcmf_configure_arp_nd_offload(ifp, true); +@@ -4715,7 +4757,8 @@ brcmf_cfg80211_del_station(struct wiphy + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, + &scbval, sizeof(scbval)); + if (err) +- brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); ++ bphy_err(wiphy, "SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", ++ err); + + brcmf_dbg(TRACE, "Exit\n"); + return err; +@@ -4745,7 +4788,7 @@ brcmf_cfg80211_change_station(struct wip + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SCB_DEAUTHORIZE, + (void *)mac, ETH_ALEN); + if (err < 0) +- brcmf_err("Setting SCB (de-)authorize failed, %d\n", err); ++ bphy_err(wiphy, "Setting SCB (de-)authorize failed, %d\n", err); + + return err; + } +@@ -4795,7 +4838,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + mgmt = (const struct ieee80211_mgmt *)buf; + + if (!ieee80211_is_mgmt(mgmt->frame_control)) { +- brcmf_err("Driver only allows MGMT packet type\n"); ++ bphy_err(wiphy, "Driver only allows MGMT packet type\n"); + return -EPERM; + } + +@@ -4826,13 +4869,13 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wip + GFP_KERNEL); + } else if (ieee80211_is_action(mgmt->frame_control)) { + if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) { +- brcmf_err("invalid action frame length\n"); ++ bphy_err(wiphy, "invalid action frame length\n"); + err = -EINVAL; + goto exit; + } + af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); + if (af_params == NULL) { +- brcmf_err("unable to allocate frame\n"); ++ bphy_err(wiphy, "unable to allocate frame\n"); + err = -ENOMEM; + goto exit; + } +@@ -4890,7 +4933,7 @@ brcmf_cfg80211_cancel_remain_on_channel( + + vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; + if (vif == NULL) { +- brcmf_err("No p2p device available for probe response\n"); ++ bphy_err(wiphy, "No p2p device available for probe response\n"); + err = -ENODEV; + goto exit; + } +@@ -4918,7 +4961,7 @@ static int brcmf_cfg80211_get_channel(st + + err = brcmf_fil_iovar_int_get(ifp, "chanspec", &chanspec); + if (err) { +- brcmf_err("chanspec failed (%d)\n", err); ++ bphy_err(wiphy, "chanspec failed (%d)\n", err); + return err; + } + +@@ -5057,7 +5100,7 @@ static int brcmf_cfg80211_tdls_oper(stru + ret = brcmf_fil_iovar_data_set(ifp, "tdls_endpoint", + &info, sizeof(info)); + if (ret < 0) +- brcmf_err("tdls_endpoint iovar failed: ret=%d\n", ret); ++ bphy_err(wiphy, "tdls_endpoint iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5078,7 +5121,7 @@ brcmf_cfg80211_update_conn_params(struct + err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, + sme->ie, sme->ie_len); + if (err) +- brcmf_err("Set Assoc REQ IE Failed\n"); ++ bphy_err(wiphy, "Set Assoc REQ IE Failed\n"); + else + brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); + +@@ -5104,7 +5147,7 @@ brcmf_cfg80211_set_rekey_data(struct wip + ret = brcmf_fil_iovar_data_set(ifp, "gtk_key_info", >k_le, + sizeof(gtk_le)); + if (ret < 0) +- brcmf_err("gtk_key_info iovar failed: ret=%d\n", ret); ++ bphy_err(wiphy, "gtk_key_info iovar failed: ret=%d\n", ret); + + return ret; + } +@@ -5336,6 +5379,7 @@ static void brcmf_clear_assoc_ies(struct + static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, + struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_cfg80211_assoc_ielen_le *assoc_info; + struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); + u32 req_len; +@@ -5347,7 +5391,7 @@ static s32 brcmf_get_assoc_ies(struct br + err = brcmf_fil_iovar_data_get(ifp, "assoc_info", + cfg->extra_buf, WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc info (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc info (%d)\n", err); + return err; + } + assoc_info = +@@ -5359,7 +5403,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc req (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc req (%d)\n", err); + return err; + } + conn_info->req_ie_len = req_len; +@@ -5375,7 +5419,7 @@ static s32 brcmf_get_assoc_ies(struct br + cfg->extra_buf, + WL_ASSOC_INFO_MAX); + if (err) { +- brcmf_err("could not get assoc resp (%d)\n", err); ++ bphy_err(wiphy, "could not get assoc resp (%d)\n", err); + return err; + } + conn_info->resp_ie_len = resp_len; +@@ -5502,6 +5546,7 @@ brcmf_notify_connect_status_ap(struct br + struct net_device *ndev, + const struct brcmf_event_msg *e, void *data) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + static int generation; + u32 event = e->event_code; + u32 reason = e->reason; +@@ -5519,7 +5564,7 @@ brcmf_notify_connect_status_ap(struct br + if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && + (reason == BRCMF_E_STATUS_SUCCESS)) { + if (!data) { +- brcmf_err("No IEs present in ASSOC/REASSOC_IND"); ++ bphy_err(wiphy, "No IEs present in ASSOC/REASSOC_IND\n"); + return -EINVAL; + } + +@@ -5811,6 +5856,7 @@ static void init_vif_event(struct brcmf_ + + static s32 brcmf_dongle_roam(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err; + u32 bcn_timeout; + __le32 roamtrigger[2]; +@@ -5823,7 +5869,7 @@ static s32 brcmf_dongle_roam(struct brcm + bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON; + err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); + if (err) { +- brcmf_err("bcn_timeout error (%d)\n", err); ++ bphy_err(wiphy, "bcn_timeout error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5835,7 +5881,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_iovar_int_set(ifp, "roam_off", + ifp->drvr->settings->roamoff); + if (err) { +- brcmf_err("roam_off error (%d)\n", err); ++ bphy_err(wiphy, "roam_off error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5844,7 +5890,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, + (void *)roamtrigger, sizeof(roamtrigger)); + if (err) { +- brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_ROAM_TRIGGER error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5853,7 +5899,7 @@ static s32 brcmf_dongle_roam(struct brcm + err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, + (void *)roam_delta, sizeof(roam_delta)); + if (err) { +- brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err); ++ bphy_err(wiphy, "WLC_SET_ROAM_DELTA error (%d)\n", err); + goto roam_setup_done; + } + +@@ -5864,25 +5910,26 @@ roam_setup_done: + static s32 + brcmf_dongle_scantime(struct brcmf_if *ifp) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + s32 err = 0; + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, + BRCMF_SCAN_CHANNEL_TIME); + if (err) { +- brcmf_err("Scan assoc time error (%d)\n", err); ++ bphy_err(wiphy, "Scan assoc time error (%d)\n", err); + goto dongle_scantime_out; + } + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, + BRCMF_SCAN_UNASSOC_TIME); + if (err) { +- brcmf_err("Scan unassoc time error (%d)\n", err); ++ bphy_err(wiphy, "Scan unassoc time error (%d)\n", err); + goto dongle_scantime_out; + } + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME, + BRCMF_SCAN_PASSIVE_TIME); + if (err) { +- brcmf_err("Scan passive time error (%d)\n", err); ++ bphy_err(wiphy, "Scan passive time error (%d)\n", err); + goto dongle_scantime_out; + } + +@@ -5914,10 +5961,10 @@ static void brcmf_update_bw40_channel_fl + static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg, + u32 bw_cap[]) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct ieee80211_channel *channel; +- struct wiphy *wiphy; + struct brcmf_chanspec_list *list; + struct brcmu_chan ch; + int err; +@@ -5936,11 +5983,10 @@ static int brcmf_construct_chaninfo(stru + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- brcmf_err("get chanspecs error (%d)\n", err); ++ bphy_err(wiphy, "get chanspecs error (%d)\n", err); + goto fail_pbuf; + } + +- wiphy = cfg_to_wiphy(cfg); + band = wiphy->bands[NL80211_BAND_2GHZ]; + if (band) + for (i = 0; i < band->n_channels; i++) +@@ -5960,7 +6006,8 @@ static int brcmf_construct_chaninfo(stru + } else if (ch.band == BRCMU_CHAN_BAND_5G) { + band = wiphy->bands[NL80211_BAND_5GHZ]; + } else { +- brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec); ++ bphy_err(wiphy, "Invalid channel Spec. 0x%x.\n", ++ ch.chspec); + continue; + } + if (!band) +@@ -5983,8 +6030,8 @@ static int brcmf_construct_chaninfo(stru + /* It seems firmware supports some channel we never + * considered. Something new in IEEE standard? + */ +- brcmf_err("Ignoring unexpected firmware channel %d\n", +- ch.control_ch_num); ++ bphy_err(wiphy, "Ignoring unexpected firmware channel %d\n", ++ ch.control_ch_num); + continue; + } + +@@ -6030,6 +6077,7 @@ fail_pbuf: + + static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); + struct ieee80211_supported_band *band; + struct brcmf_fil_bwcap_le band_bwcap; +@@ -6076,7 +6124,7 @@ static int brcmf_enable_bw40_2g(struct b + err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, + BRCMF_DCMD_MEDLEN); + if (err) { +- brcmf_err("get chanspecs error (%d)\n", err); ++ bphy_err(wiphy, "get chanspecs error (%d)\n", err); + kfree(pbuf); + return err; + } +@@ -6107,6 +6155,7 @@ static int brcmf_enable_bw40_2g(struct b + + static void brcmf_get_bwcap(struct brcmf_if *ifp, u32 bw_cap[]) + { ++ struct wiphy *wiphy = ifp->drvr->wiphy; + u32 band, mimo_bwcap; + int err; + +@@ -6142,7 +6191,7 @@ static void brcmf_get_bwcap(struct brcmf + bw_cap[NL80211_BAND_5GHZ] |= WLC_BW_20MHZ_BIT; + break; + default: +- brcmf_err("invalid mimo_bw_cap value\n"); ++ bphy_err(wiphy, "invalid mimo_bw_cap value\n"); + } + } + +@@ -6218,7 +6267,7 @@ static void brcmf_update_vht_cap(struct + static int brcmf_setup_wiphybands(struct brcmf_cfg80211_info *cfg) + { + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); +- struct wiphy *wiphy; ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + u32 nmode = 0; + u32 vhtmode = 0; + u32 bw_cap[2] = { WLC_BW_20MHZ_BIT, WLC_BW_20MHZ_BIT }; +@@ -6234,7 +6283,7 @@ static int brcmf_setup_wiphybands(struct + (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode); + err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); + if (err) { +- brcmf_err("nmode error (%d)\n", err); ++ bphy_err(wiphy, "nmode error (%d)\n", err); + } else { + brcmf_get_bwcap(ifp, bw_cap); + } +@@ -6244,7 +6293,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_fil_iovar_int_get(ifp, "rxchain", &rxchain); + if (err) { +- brcmf_err("rxchain error (%d)\n", err); ++ bphy_err(wiphy, "rxchain error (%d)\n", err); + nchain = 1; + } else { + for (nchain = 0; rxchain; nchain++) +@@ -6254,7 +6303,7 @@ static int brcmf_setup_wiphybands(struct + + err = brcmf_construct_chaninfo(cfg, bw_cap); + if (err) { +- brcmf_err("brcmf_construct_chaninfo failed (%d)\n", err); ++ bphy_err(wiphy, "brcmf_construct_chaninfo failed (%d)\n", err); + return err; + } + +@@ -6266,7 +6315,6 @@ static int brcmf_setup_wiphybands(struct + &txbf_bfr_cap); + } + +- wiphy = cfg_to_wiphy(cfg); + for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) { + band = wiphy->bands[i]; + if (band == NULL) +@@ -6467,7 +6515,7 @@ static void brcmf_wiphy_wowl_params(stru + wowl = kmemdup(&brcmf_wowlan_support, sizeof(brcmf_wowlan_support), + GFP_KERNEL); + if (!wowl) { +- brcmf_err("only support basic wowlan features\n"); ++ bphy_err(wiphy, "only support basic wowlan features\n"); + wiphy->wowlan = &brcmf_wowlan_support; + return; + } +@@ -6564,7 +6612,7 @@ static int brcmf_setup_wiphy(struct wiph + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist, + sizeof(bandlist)); + if (err) { +- brcmf_err("could not obtain band info: err=%d\n", err); ++ bphy_err(wiphy, "could not obtain band info: err=%d\n", err); + return err; + } + /* first entry in bandlist is number of bands */ +@@ -6613,6 +6661,7 @@ static int brcmf_setup_wiphy(struct wiph + + static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) + { ++ struct wiphy *wiphy = cfg_to_wiphy(cfg); + struct net_device *ndev; + struct wireless_dev *wdev; + struct brcmf_if *ifp; +@@ -6650,7 +6699,7 @@ static s32 brcmf_config_dongle(struct br + + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); + if (err) { +- brcmf_err("failed to set frameburst mode\n"); ++ bphy_err(wiphy, "failed to set frameburst mode\n"); + goto default_conf_out; + } + +@@ -6842,8 +6891,8 @@ static void brcmf_cfg80211_reg_notifier( + /* ignore non-ISO3166 country codes */ + for (i = 0; i < 2; i++) + if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { +- brcmf_err("not an ISO3166 code (0x%02x 0x%02x)\n", +- req->alpha2[0], req->alpha2[1]); ++ bphy_err(wiphy, "not an ISO3166 code (0x%02x 0x%02x)\n", ++ req->alpha2[0], req->alpha2[1]); + return; + } + +@@ -6852,7 +6901,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_get(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- brcmf_err("Country code iovar returned err = %d\n", err); ++ bphy_err(wiphy, "Country code iovar returned err = %d\n", err); + return; + } + +@@ -6862,7 +6911,7 @@ static void brcmf_cfg80211_reg_notifier( + + err = brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq)); + if (err) { +- brcmf_err("Firmware rejected country setting\n"); ++ bphy_err(wiphy, "Firmware rejected country setting\n"); + return; + } + brcmf_setup_wiphybands(cfg); +@@ -6908,13 +6957,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + u16 *cap = NULL; + + if (!ndev) { +- brcmf_err("ndev is invalid\n"); ++ bphy_err(wiphy, "ndev is invalid\n"); + return NULL; + } + + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); + if (!cfg) { +- brcmf_err("Could not allocate wiphy device\n"); ++ bphy_err(wiphy, "Could not allocate wiphy device\n"); + return NULL; + } + +@@ -6935,7 +6984,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = wl_init_priv(cfg); + if (err) { +- brcmf_err("Failed to init iwm_priv (%d)\n", err); ++ bphy_err(wiphy, "Failed to init iwm_priv (%d)\n", err); + brcmf_free_vif(vif); + goto wiphy_out; + } +@@ -6944,7 +6993,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* determine d11 io type before wiphy setup */ + err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, &io_type); + if (err) { +- brcmf_err("Failed to get D11 version (%d)\n", err); ++ bphy_err(wiphy, "Failed to get D11 version (%d)\n", err); + goto priv_out; + } + cfg->d11inf.io_type = (u8)io_type; +@@ -6978,13 +7027,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + #endif + err = wiphy_register(wiphy); + if (err < 0) { +- brcmf_err("Could not register wiphy device (%d)\n", err); ++ bphy_err(wiphy, "Could not register wiphy device (%d)\n", err); + goto priv_out; + } + + err = brcmf_setup_wiphybands(cfg); + if (err) { +- brcmf_err("Setting wiphy bands failed (%d)\n", err); ++ bphy_err(wiphy, "Setting wiphy bands failed (%d)\n", err); + goto wiphy_unreg_out; + } + +@@ -7002,24 +7051,24 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + + err = brcmf_fweh_activate_events(ifp); + if (err) { +- brcmf_err("FWEH activation failed (%d)\n", err); ++ bphy_err(wiphy, "FWEH activation failed (%d)\n", err); + goto wiphy_unreg_out; + } + + err = brcmf_p2p_attach(cfg, p2pdev_forced); + if (err) { +- brcmf_err("P2P initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "P2P initialisation failed (%d)\n", err); + goto wiphy_unreg_out; + } + err = brcmf_btcoex_attach(cfg); + if (err) { +- brcmf_err("BT-coex initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "BT-coex initialisation failed (%d)\n", err); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; + } + err = brcmf_pno_attach(cfg); + if (err) { +- brcmf_err("PNO initialisation failed (%d)\n", err); ++ bphy_err(wiphy, "PNO initialisation failed (%d)\n", err); + brcmf_btcoex_detach(cfg); + brcmf_p2p_detach(&cfg->p2p); + goto wiphy_unreg_out; +@@ -7039,7 +7088,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802 + /* (re-) activate FWEH event handling */ + err = brcmf_fweh_activate_events(ifp); + if (err) { +- brcmf_err("FWEH activation failed (%d)\n", err); ++ bphy_err(wiphy, "FWEH activation failed (%d)\n", err); + goto detach; + } + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +@@ -62,6 +62,15 @@ void __brcmf_err(struct brcmf_bus *bus, + } while (0) + #endif + ++#define bphy_err(wiphy, fmt, ...) \ ++ do { \ ++ if (IS_ENABLED(CPTCFG_BRCMDBG) || \ ++ IS_ENABLED(CPTCFG_BRCM_TRACING) || \ ++ net_ratelimit()) \ ++ wiphy_err(wiphy, "%s: " fmt, __func__, \ ++ ##__VA_ARGS__); \ ++ } while (0) ++ + #if defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) + + /* For debug/tracing purposes treat info messages as errors */ diff --git a/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch b/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch new file mode 100644 index 0000000000..e21c1ee60a --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/347-v5.1-brcmfmac-fix-typos.patch @@ -0,0 +1,62 @@ +From 2359dd09f9819c7d57d81e05173541f0f9f820c7 Mon Sep 17 00:00:00 2001 +From: Matteo Croce +Date: Tue, 29 Jan 2019 18:47:17 +0100 +Subject: [PATCH] brcmfmac: fix typos + +Fix spelling mistakes in brcmfmac: "lenght" -> "length". +The typos are also in the special comment blocks which +translates to documentation. + +Signed-off-by: Matteo Croce +Signed-off-by: Kalle Valo +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h | 2 +- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -36,7 +36,7 @@ + #define BRCMF_DCMD_MEDLEN 1536 + #define BRCMF_DCMD_MAXLEN 8192 + +-/* IOCTL from host to device are limited in lenght. A device can only handle ++/* IOCTL from host to device are limited in length. A device can only handle + * ethernet frame size. This limitation is to be applied by protocol layer. + */ + #define BRCMF_TX_IOCTL_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +@@ -47,7 +47,7 @@ enum nvram_parser_state { + * @state: current parser state. + * @data: input buffer being parsed. + * @nvram: output buffer with parse result. +- * @nvram_len: lenght of parse result. ++ * @nvram_len: length of parse result. + * @line: current line. + * @column: current column in line. + * @pos: byte offset in input buffer. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h +@@ -266,7 +266,7 @@ struct brcmf_event { + * @status: status information. + * @reason: reason code. + * @auth_type: authentication type. +- * @datalen: lenght of event data buffer. ++ * @datalen: length of event data buffer. + * @addr: ether address. + * @ifname: interface name. + * @ifidx: interface index. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -508,7 +508,7 @@ static void brcmf_usb_rx_complete(struct + skb = req->skb; + req->skb = NULL; + +- /* zero lenght packets indicate usb "failure". Do not refill */ ++ /* zero length packets indicate usb "failure". Do not refill */ + if (urb->status != 0 || !urb->actual_length) { + brcmu_pkt_buf_free_skb(skb); + brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); diff --git a/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch b/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch new file mode 100644 index 0000000000..c93bcf0ce9 --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/348-v5.1-brcmfmac-support-monitor-frames-with-the-hardware-uc.patch @@ -0,0 +1,143 @@ +From e665988be29ccea3584528967b432a5cfd801ca4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 8 Feb 2019 07:42:30 +0100 +Subject: [PATCH] brcmfmac: support monitor frames with the hardware/ucode + header +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far there were two monitor frame formats: +1) 802.11 frames (with frame (sub)type & all addresses) +2) 802.11 frames with the radiotap header + +Testing the latest FullMAC firmwares for 4366b1/4366c0 resulted in +discovering a new format being used. It seems (almost?) identical to the +one known from ucode used in SoftMAC devices which is most likely the +same codebase anyway. + +While new firmwares will /announce/ radiotap header support using the +"rtap" fw capability string it seems no string was added for the new +ucode header format. + +All above means that: +1) We need new format support when dealing with a received frame +2) A new feature bit & mapping quirks have to be added manually + +As for now only an empty radiotap is being created. Adding support for +extracting some info (band, channel, signal, etc.) is planned for the +future. + +Signed-off-by: Rafał Miłecki +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +--- + .../broadcom/brcm80211/brcmfmac/core.c | 55 +++++++++++++++++++ + .../broadcom/brcm80211/brcmfmac/feature.c | 4 ++ + .../broadcom/brcm80211/brcmfmac/feature.h | 4 +- + 3 files changed, 62 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -43,6 +43,36 @@ + + #define BRCMF_BSSIDX_INVALID -1 + ++#define RXS_PBPRES BIT(2) ++ ++#define D11_PHY_HDR_LEN 6 ++ ++struct d11rxhdr_le { ++ __le16 RxFrameSize; ++ u16 PAD; ++ __le16 PhyRxStatus_0; ++ __le16 PhyRxStatus_1; ++ __le16 PhyRxStatus_2; ++ __le16 PhyRxStatus_3; ++ __le16 PhyRxStatus_4; ++ __le16 PhyRxStatus_5; ++ __le16 RxStatus1; ++ __le16 RxStatus2; ++ __le16 RxTSFTime; ++ __le16 RxChan; ++ u8 unknown[12]; ++} __packed; ++ ++struct wlc_d11rxhdr { ++ struct d11rxhdr_le rxhdr; ++ __le32 tsf_l; ++ s8 rssi; ++ s8 rxpwr0; ++ s8 rxpwr1; ++ s8 do_rssi_ma; ++ s8 rxpwr[4]; ++} __packed; ++ + char *brcmf_ifname(struct brcmf_if *ifp) + { + if (!ifp) +@@ -409,6 +439,31 @@ void brcmf_netif_mon_rx(struct brcmf_if + { + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_RADIOTAP)) { + /* Do nothing */ ++ } else if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR)) { ++ struct wlc_d11rxhdr *wlc_rxhdr = (struct wlc_d11rxhdr *)skb->data; ++ struct ieee80211_radiotap_header *radiotap; ++ unsigned int offset; ++ u16 RxStatus1; ++ ++ RxStatus1 = le16_to_cpu(wlc_rxhdr->rxhdr.RxStatus1); ++ ++ offset = sizeof(struct wlc_d11rxhdr); ++ /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU ++ * subframes ++ */ ++ if (RxStatus1 & RXS_PBPRES) ++ offset += 2; ++ offset += D11_PHY_HDR_LEN; ++ ++ skb_pull(skb, offset); ++ ++ /* TODO: use RX header to fill some radiotap data */ ++ radiotap = skb_push(skb, sizeof(*radiotap)); ++ memset(radiotap, 0, sizeof(*radiotap)); ++ radiotap->it_len = cpu_to_le16(sizeof(*radiotap)); ++ ++ /* TODO: 4 bytes with receive status? */ ++ skb->len -= 4; + } else { + struct ieee80211_radiotap_header *radiotap; + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +@@ -103,6 +103,10 @@ static const struct brcmf_feat_fwfeat br + { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, + /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ + { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, ++ /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 211de1679a68 */ ++ { "01-801fb449", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) }, ++ /* brcmfmac4366c-pcie.bin from linux-firmware.git commit 211de1679a68 */ ++ { "01-d2cbb8fd", BIT(BRCMF_FEAT_MONITOR_FMT_HW_RX_HDR) }, + }; + + static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +@@ -35,6 +35,7 @@ + * FWSUP: Firmware supplicant. + * 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 + */ + #define BRCMF_FEAT_LIST \ + BRCMF_FEAT_DEF(MBSS) \ +@@ -52,7 +53,8 @@ + BRCMF_FEAT_DEF(GSCAN) \ + BRCMF_FEAT_DEF(FWSUP) \ + BRCMF_FEAT_DEF(MONITOR) \ +- BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) ++ BRCMF_FEAT_DEF(MONITOR_FMT_RADIOTAP) \ ++ BRCMF_FEAT_DEF(MONITOR_FMT_HW_RX_HDR) + + /* + * Quirks: diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch index aa0110c22d..05c1bf7b7e 100644 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1347,6 +1347,7 @@ int __init brcmf_core_init(void) +@@ -1402,6 +1402,7 @@ int __init brcmf_core_init(void) { if (!schedule_work(&brcmf_driver_work)) return -EBUSY; diff --git a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch index 1345e85f6d..7ddb894780 100644 --- a/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch +++ b/package/kernel/mac80211/patches/brcm/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -614,9 +614,37 @@ static struct wireless_dev *brcmf_cfg802 +@@ -616,9 +616,37 @@ static struct wireless_dev *brcmf_cfg802 enum nl80211_iftype type, struct vif_params *params) { diff --git a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch index 9b36059079..9be21bbe11 100644 --- a/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch +++ b/package/kernel/mac80211/patches/brcm/862-brcmfmac-Disable-power-management.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2725,6 +2725,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip +@@ -2752,6 +2752,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip * preference in cfg struct to apply this to * FW later while initializing the dongle */ -- cgit v1.2.3