aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2019-09-09 09:37:53 +0200
committerRafał Miłecki <rafal@milecki.pl>2019-09-09 13:42:31 +0200
commit21cc21e9ec22bba944dba1404cb43876b3e277a0 (patch)
tree0134639e2ba8d8b195b504dd8ea86e5ace96e8e1
parent128366e1a881b5a9dab4f454a7cf1c45e72a34f1 (diff)
downloadupstream-21cc21e9ec22bba944dba1404cb43876b3e277a0.tar.gz
upstream-21cc21e9ec22bba944dba1404cb43876b3e277a0.tar.bz2
upstream-21cc21e9ec22bba944dba1404cb43876b3e277a0.zip
mac80211: brcmfmac: backport more kernel 5.4 changes
Patch getting RAM info got upstreamed. A debugging fs entry for testing reset feature was added. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 681acdcc54d2e59135bb706c38bed942f74ccf74)
-rw-r--r--package/kernel/mac80211/patches/353-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch54
-rw-r--r--package/kernel/mac80211/patches/354-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch26
-rw-r--r--package/kernel/mac80211/patches/355-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch36
-rw-r--r--package/kernel/mac80211/patches/356-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch (renamed from package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch)28
-rw-r--r--package/kernel/mac80211/patches/357-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch31
-rw-r--r--package/kernel/mac80211/patches/357-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch59
-rw-r--r--package/kernel/mac80211/patches/358-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch58
-rw-r--r--package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch2
8 files changed, 284 insertions, 10 deletions
diff --git a/package/kernel/mac80211/patches/353-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch b/package/kernel/mac80211/patches/353-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch
new file mode 100644
index 0000000000..517210ff50
--- /dev/null
+++ b/package/kernel/mac80211/patches/353-v5.4-brcmfmac-remove-set-but-not-used-variable-dtim_perio.patch
@@ -0,0 +1,54 @@
+From cddecd92d1ec2fd05ed1123455e7c6cf6906b5a5 Mon Sep 17 00:00:00 2001
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Wed, 24 Jul 2019 22:12:01 +0800
+Subject: [PATCH] brcmfmac: remove set but not used variable 'dtim_period'
+
+Fixes gcc '-Wunused-but-set-variable' warning:
+
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info:
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2962:5: warning: variable dtim_period set but not used [-Wunused-but-set-variable]
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In function brcmf_update_bss_info:
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2961:6: warning: variable beacon_interval set but not used [-Wunused-but-set-variable]
+
+They are never used so can be removed.
+
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -3033,8 +3033,6 @@ static s32 brcmf_update_bss_info(struct
+ struct brcmf_pub *drvr = cfg->pub;
+ struct brcmf_bss_info_le *bi;
+ const struct brcmf_tlv *tim;
+- u16 beacon_interval;
+- u8 dtim_period;
+ size_t ie_len;
+ u8 *ie;
+ s32 err = 0;
+@@ -3058,12 +3056,9 @@ static s32 brcmf_update_bss_info(struct
+
+ ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset);
+ ie_len = le32_to_cpu(bi->ie_length);
+- beacon_interval = le16_to_cpu(bi->beacon_period);
+
+ tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM);
+- if (tim)
+- dtim_period = tim->data[1];
+- else {
++ if (!tim) {
+ /*
+ * active scan was done so we could not get dtim
+ * information out of probe response.
+@@ -3075,7 +3070,6 @@ static s32 brcmf_update_bss_info(struct
+ bphy_err(drvr, "wl dtim_assoc failed (%d)\n", err);
+ goto update_bss_info_out;
+ }
+- dtim_period = (u8)var;
+ }
+
+ update_bss_info_out:
diff --git a/package/kernel/mac80211/patches/354-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch b/package/kernel/mac80211/patches/354-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch
new file mode 100644
index 0000000000..3b1942d945
--- /dev/null
+++ b/package/kernel/mac80211/patches/354-v5.4-brcmfmac-remove-redundant-assignment-to-pointer-hash.patch
@@ -0,0 +1,26 @@
+From 73c742bb9c9ba30871fdd5c730d5ca8b6712833a Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Fri, 9 Aug 2019 18:22:17 +0100
+Subject: [PATCH] brcmfmac: remove redundant assignment to pointer hash
+
+The pointer hash is being initialized with a value that is never read
+and is being re-assigned a little later on. The assignment is
+redundant and hence can be removed.
+
+Addresses-Coverity: ("Unused value")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
+@@ -1476,7 +1476,6 @@ static int brcmf_msgbuf_stats_read(struc
+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
+ seq_puts(seq, "Active flowrings:\n");
+- hash = msgbuf->flow->hash;
+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
+ if (!msgbuf->flow->rings[i])
+ continue;
diff --git a/package/kernel/mac80211/patches/355-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch b/package/kernel/mac80211/patches/355-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch
new file mode 100644
index 0000000000..c8ebedf700
--- /dev/null
+++ b/package/kernel/mac80211/patches/355-v5.4-brcmfmac-replace-strncpy-by-strscpy.patch
@@ -0,0 +1,36 @@
+From 5f42b382ead278c1f6c3854765c97eb20491aa2a Mon Sep 17 00:00:00 2001
+From: Xulin Sun <xulin.sun@windriver.com>
+Date: Fri, 23 Aug 2019 15:47:08 +0800
+Subject: [PATCH] brcmfmac: replace strncpy() by strscpy()
+
+The strncpy() may truncate the copied string,
+replace it by the safer strscpy().
+
+To avoid below compile warning with gcc 8.2:
+
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:In function 'brcmf_vndr_ie':
+drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:4227:2:
+warning: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
+ strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
+Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -4280,9 +4280,7 @@ next:
+ static u32
+ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
+ {
+-
+- strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1);
+- iebuf[VNDR_IE_CMD_LEN - 1] = '\0';
++ strscpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN);
+
+ put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]);
+
diff --git a/package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch b/package/kernel/mac80211/patches/356-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch
index d16ad66f48..b299cd2d84 100644
--- a/package/kernel/mac80211/patches/865-brcmfmac-get-RAM-info-right-before-downloading-PCIe-.patch
+++ b/package/kernel/mac80211/patches/356-v5.4-brcmfmac-get-chip-s-default-RAM-info-during-PCIe-set.patch
@@ -1,19 +1,29 @@
+From 82f93cf46d6007ffa003b2d4a2834563b6b84d21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Subject: [PATCH] brcmfmac: get RAM info right before downloading PCIe firmware
+Date: Thu, 29 Aug 2019 10:27:01 +0200
+Subject: [PATCH] brcmfmac: get chip's default RAM info during PCIe setup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
-It's important as brcmf_chip_get_raminfo() also makes sure that memory
-is properly setup. Without it the firmware could report invalid RAM
-address like 0x04000001.
+Getting RAM info just once per driver's lifetime (during chip
+recognition) is not enough as it may get adjusted later (depending on
+the used firmware). Subsequent inits may load different firmwares so a
+full RAM recognition is required on every PCIe setup. This is especially
+important since implementing hardware reset on a firmware crash.
-During a normal brcmfmac lifetime brcmf_chip_get_raminfo() is called on
-probe by the brcmf_chip_recognition(). This change allows implementing
-further improvements like handling errors by resetting a device with
-the brcmf_pcie_reset_device() and redownloading a firmware afterwards.
+Moreover calling brcmf_chip_get_raminfo() makes sure that RAM core is
+up. It's important as having BCMA_CORE_SYS_MEM down on BCM4366 was
+resulting in firmware failing to initialize and following error:
+[ 65.657546] brcmfmac 0000:01:00.0: brcmf_pcie_download_fw_nvram: Invalid shared RAM address 0x04000001
+This change makes brcmf_chip_get_raminfo() call during chip recognition
+redundant for PCIe devices but SDIO and USB still need it and it's a
+very small overhead anyway.
+
+Fixes: 4684997d9eea ("brcmfmac: reset PCIe bus on a firmware crash")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 6 ++++--
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h | 1 +
@@ -55,7 +65,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
void brcmf_chip_detach(struct brcmf_chip *chip);
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -1762,6 +1762,12 @@ static void brcmf_pcie_setup(struct devi
+@@ -1761,6 +1761,12 @@ static void brcmf_pcie_setup(struct devi
brcmf_pcie_attach(devinfo);
diff --git a/package/kernel/mac80211/patches/357-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch b/package/kernel/mac80211/patches/357-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch
new file mode 100644
index 0000000000..aafc5e5800
--- /dev/null
+++ b/package/kernel/mac80211/patches/357-v5.4-0001-brcmfmac-add-stub-version-of-brcmf_debugfs_get_devdi.patch
@@ -0,0 +1,31 @@
+From cb34212b1c25f7656a315f956d72696777e88340 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 1 Sep 2019 13:34:35 +0200
+Subject: [PATCH] brcmfmac: add stub version of brcmf_debugfs_get_devdir()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In case of compiling driver without DEBUG expose a stub function to make
+writing debug code much simpler (no extra conditions). This will allow
+e.g. using debugfs_create_file() without any magic if or #ifdef.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+@@ -147,6 +147,10 @@ static inline int brcmf_debug_attach(str
+ static inline void brcmf_debug_detach(struct brcmf_pub *drvr)
+ {
+ }
++static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
++{
++ return ERR_PTR(-ENOENT);
++}
+ static inline
+ int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
+ int (*read_fn)(struct seq_file *seq, void *data))
diff --git a/package/kernel/mac80211/patches/357-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch b/package/kernel/mac80211/patches/357-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch
new file mode 100644
index 0000000000..b5a957b9b1
--- /dev/null
+++ b/package/kernel/mac80211/patches/357-v5.4-0002-brcmfmac-add-reset-debugfs-entry-for-testing-reset.patch
@@ -0,0 +1,59 @@
+From 2f8c8e62cd50d72ac68de884a09c6f5a969a269c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 1 Sep 2019 13:34:36 +0200
+Subject: [PATCH] brcmfmac: add "reset" debugfs entry for testing reset
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a trivial debugfs entry for triggering reset just like in case
+of firmware crash. It works by writing 1 to it:
+echo 1 > reset
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/core.c | 25 +++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1065,6 +1065,29 @@ static void brcmf_core_bus_reset(struct
+ brcmf_bus_reset(drvr->bus_if);
+ }
+
++static ssize_t bus_reset_write(struct file *file, const char __user *user_buf,
++ size_t count, loff_t *ppos)
++{
++ struct brcmf_pub *drvr = file->private_data;
++ u8 value;
++
++ if (kstrtou8_from_user(user_buf, count, 0, &value))
++ return -EINVAL;
++
++ if (value != 1)
++ return -EINVAL;
++
++ schedule_work(&drvr->bus_reset);
++
++ return count;
++}
++
++static const struct file_operations bus_reset_fops = {
++ .open = simple_open,
++ .llseek = no_llseek,
++ .write = bus_reset_write,
++};
++
+ int brcmf_bus_started(struct device *dev)
+ {
+ int ret = -1;
+@@ -1096,6 +1119,8 @@ int brcmf_bus_started(struct device *dev
+ goto fail;
+
+ brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
++ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr,
++ &bus_reset_fops);
+
+ /* assure we have chipid before feature attach */
+ if (!bus_if->chip) {
diff --git a/package/kernel/mac80211/patches/358-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch b/package/kernel/mac80211/patches/358-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch
new file mode 100644
index 0000000000..88f7a61d81
--- /dev/null
+++ b/package/kernel/mac80211/patches/358-v5.4-brcmfmac-use-ph-to-print-small-buffer.patch
@@ -0,0 +1,58 @@
+From 0e48b86d9a8f5c695bb02c9c02f6dc7d2ec8f2e2 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Wed, 4 Sep 2019 20:50:52 +0300
+Subject: [PATCH] brcmfmac: use %*ph to print small buffer
+
+Use %*ph format to print small buffer as hex string.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../broadcom/brcm80211/brcmfmac/cfg80211.c | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -4258,10 +4258,8 @@ brcmf_parse_vndr_ies(const u8 *vndr_ie_b
+
+ vndr_ies->count++;
+
+- brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n",
+- parsed_info->vndrie.oui[0],
+- parsed_info->vndrie.oui[1],
+- parsed_info->vndrie.oui[2],
++ brcmf_dbg(TRACE, "** OUI %3ph, type 0x%02x\n",
++ parsed_info->vndrie.oui,
+ parsed_info->vndrie.oui_type);
+
+ if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT)
+@@ -4385,12 +4383,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ for (i = 0; i < old_vndr_ies.count; i++) {
+ vndrie_info = &old_vndr_ies.ie_info[i];
+
+- brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n",
++ brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%3ph\n",
+ vndrie_info->vndrie.id,
+ vndrie_info->vndrie.len,
+- vndrie_info->vndrie.oui[0],
+- vndrie_info->vndrie.oui[1],
+- vndrie_info->vndrie.oui[2]);
++ vndrie_info->vndrie.oui);
+
+ del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
+ vndrie_info->ie_ptr,
+@@ -4422,12 +4418,10 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
+ remained_buf_len -= (vndrie_info->ie_len +
+ VNDR_IE_VSIE_OFFSET);
+
+- brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n",
++ brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%3ph\n",
+ vndrie_info->vndrie.id,
+ vndrie_info->vndrie.len,
+- vndrie_info->vndrie.oui[0],
+- vndrie_info->vndrie.oui[1],
+- vndrie_info->vndrie.oui[2]);
++ vndrie_info->vndrie.oui);
+
+ del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
+ vndrie_info->ie_ptr,
diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
index beb81d89c0..4f31ae86b4 100644
--- a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
+++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1379,6 +1379,7 @@ int __init brcmf_core_init(void)
+@@ -1404,6 +1404,7 @@ int __init brcmf_core_init(void)
{
if (!schedule_work(&brcmf_driver_work))
return -EBUSY;