mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 02:29:01 +00:00
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 681acdcc54
)
This commit is contained in:
parent
6d2044d62f
commit
c7f710e474
@ -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
|
||||
@@ -2974,8 +2974,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;
|
||||
@@ -2999,12 +2997,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.
|
||||
@@ -3016,7 +3011,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:
|
@ -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
|
||||
@@ -1468,7 +1468,6 @@ static int brcmf_msgbuf_stats_read(struc
|
||||
seq_printf(seq, "\nh2d_flowrings: depth %u\n",
|
||||
BRCMF_H2D_TXFLOWRING_MAX_ITEM);
|
||||
seq_puts(seq, "Active flowrings:\n");
|
||||
- hash = msgbuf->flow->hash;
|
||||
for (i = 0; i < msgbuf->flow->nrofrings; i++) {
|
||||
if (!msgbuf->flow->rings[i])
|
||||
continue;
|
@ -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
|
||||
@@ -4236,9 +4236,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]);
|
||||
|
@ -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 +
|
@ -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
|
||||
@@ -121,6 +121,10 @@ int brcmf_debugfs_add_entry(struct brcmf
|
||||
int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
|
||||
size_t len);
|
||||
#else
|
||||
+static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
|
||||
+{
|
||||
+ return ERR_PTR(-ENOENT);
|
||||
+}
|
||||
static inline
|
||||
int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
|
||||
int (*read_fn)(struct seq_file *seq, void *data))
|
@ -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
|
||||
@@ -1107,6 +1107,29 @@ static void brcmf_core_bus_reset(struct
|
||||
brcmf_bus_reset(drvr->bus_if);
|
||||
}
|
||||
|
||||
+static ssize_t bus_reset_write(struct file *file, const char __user *user_buf,
|
||||
+ size_t count, loff_t *ppos)
|
||||
+{
|
||||
+ struct brcmf_pub *drvr = file->private_data;
|
||||
+ u8 value;
|
||||
+
|
||||
+ if (kstrtou8_from_user(user_buf, count, 0, &value))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (value != 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ schedule_work(&drvr->bus_reset);
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static const struct file_operations bus_reset_fops = {
|
||||
+ .open = simple_open,
|
||||
+ .llseek = no_llseek,
|
||||
+ .write = bus_reset_write,
|
||||
+};
|
||||
+
|
||||
static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *ops)
|
||||
{
|
||||
int ret = -1;
|
||||
@@ -1182,6 +1205,8 @@ static int brcmf_bus_started(struct brcm
|
||||
|
||||
/* populate debugfs */
|
||||
brcmf_debugfs_add_entry(drvr, "revinfo", brcmf_revinfo_read);
|
||||
+ debugfs_create_file("reset", 0600, brcmf_debugfs_get_devdir(drvr), drvr,
|
||||
+ &bus_reset_fops);
|
||||
brcmf_feat_debugfs_create(drvr);
|
||||
brcmf_proto_debugfs_create(drvr);
|
||||
brcmf_bus_debugfs_create(bus_if);
|
@ -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
|
||||
@@ -4214,10 +4214,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)
|
||||
@@ -4341,12 +4339,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,
|
||||
@@ -4378,12 +4374,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,
|
@ -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
|
||||
@@ -1425,6 +1425,7 @@ int __init brcmf_core_init(void)
|
||||
@@ -1450,6 +1450,7 @@ int __init brcmf_core_init(void)
|
||||
{
|
||||
if (!schedule_work(&brcmf_driver_work))
|
||||
return -EBUSY;
|
||||
|
Loading…
Reference in New Issue
Block a user