mac80211: brcmfmac: backport patch setting WIPHY_FLAG_HAVE_AP_SME
authorRafał Miłecki <rafal@milecki.pl>
Thu, 16 Aug 2018 14:34:21 +0000 (16:34 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 16 Aug 2018 14:52:09 +0000 (16:52 +0200)
It's an important hint for authenticator (e.g. hostapd) about hardware
capabilities.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
13 files changed:
package/kernel/mac80211/Makefile
package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch [deleted file]
package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-support-for-sysfs-initiated-coredump.patch [deleted file]
package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-add-support-for-sysfs-initiated-coredump.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-validate-user-provided-data-for-memdump-bef.patch [deleted file]
package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch [deleted file]
package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-validate-user-provided-data-for-memdump-bef.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch [deleted file]
package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch [new file with mode: 0644]
package/kernel/mac80211/patches/331-v4.18-0009-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch [new file with mode: 0644]
package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch

index e6b0793018bf18c4f1504e6e54bb7a8c556906f0..d65038ccc0e5cb7028f7d10e747adfd3ae33ee08 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=mac80211
 
 PKG_VERSION:=2017-01-31
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
 PKG_BACKPORT_VERSION:=
 PKG_HASH:=75e6d39e34cf156212a2509172a4a62b673b69eb4a1d9aaa565f7fa719fa2317
diff --git a/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch b/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
deleted file mode 100644 (file)
index 71ed067..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Mon, 14 May 2018 08:48:20 +0200
-Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This allows reading all capabilities as reported by a firmware. They are
-printed using native (raw) names, just like developers like it the most.
-It's how firmware reports support for various features, e.g. supported
-modes, supported standards, power saving details, max BSS-es.
-
-Access to all that info is useful for trying new firmwares, comparing
-them and debugging features AKA bugs.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
-@@ -138,6 +138,41 @@ static void brcmf_feat_firmware_capabili
-       }
- }
-+/**
-+ * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs.
-+ *
-+ * @seq: sequence for debugfs entry.
-+ * @data: raw data pointer.
-+ */
-+static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
-+{
-+      struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
-+      struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
-+      char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
-+      char *tmp;
-+      int err;
-+
-+      err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
-+      if (err) {
-+              brcmf_err("could not get firmware cap (%d)\n", err);
-+              return err;
-+      }
-+
-+      /* Put every capability in a new line */
-+      for (tmp = caps; *tmp; tmp++) {
-+              if (*tmp == ' ')
-+                      *tmp = '\n';
-+      }
-+
-+      /* Usually there is a space at the end of capabilities string */
-+      seq_printf(seq, "%s", caps);
-+      /* So make sure we don't print two line breaks */
-+      if (tmp > caps && *(tmp - 1) != '\n')
-+              seq_printf(seq, "\n");
-+
-+      return 0;
-+}
-+
- void brcmf_feat_attach(struct brcmf_pub *drvr)
- {
-       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
-@@ -196,6 +231,7 @@ void brcmf_feat_attach(struct brcmf_pub
-       }
-       brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read);
-+      brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read);
- }
- bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id)
diff --git a/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch b/package/kernel/mac80211/patches/331-v4.18-0004-brcmfmac-set-WIPHY_FLAG_HAVE_AP_SME-flag.patch
new file mode 100644 (file)
index 0000000..7580704
--- /dev/null
@@ -0,0 +1,34 @@
+From 1204aa17f3b4f63e67ac9b7c9afa9496485969c5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 10 May 2018 15:21:39 +0200
+Subject: [PATCH] brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+brcmfmac is a FullMAC driver and it implements/uses cfg80211 interface
+for stations management. At the same time it doesn't receive or pass up
+management frames.
+
+This flag indicates that authenticator doesn't have to subscribe to or
+handle management frames. Some authenticators (e.g. hostapd) were
+working with brcmfmac thanks to some extra assumptions. This commit
+clears up the situation.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -6485,6 +6485,7 @@ static int brcmf_setup_wiphy(struct wiph
+                                   BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST);
+       wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT |
++                      WIPHY_FLAG_HAVE_AP_SME |
+                       WIPHY_FLAG_OFFCHAN_TX |
+                       WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+       if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_TDLS))
diff --git a/package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch b/package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-debugfs-entry-for-reading-firmware-capa.patch
new file mode 100644 (file)
index 0000000..71ed067
--- /dev/null
@@ -0,0 +1,75 @@
+From 88001968245c42c26416476bf0ef960442371605 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 14 May 2018 08:48:20 +0200
+Subject: [PATCH] brcmfmac: add debugfs entry for reading firmware capabilities
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This allows reading all capabilities as reported by a firmware. They are
+printed using native (raw) names, just like developers like it the most.
+It's how firmware reports support for various features, e.g. supported
+modes, supported standards, power saving details, max BSS-es.
+
+Access to all that info is useful for trying new firmwares, comparing
+them and debugging features AKA bugs.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c
+@@ -138,6 +138,41 @@ static void brcmf_feat_firmware_capabili
+       }
+ }
++/**
++ * brcmf_feat_fwcap_debugfs_read() - expose firmware capabilities to debugfs.
++ *
++ * @seq: sequence for debugfs entry.
++ * @data: raw data pointer.
++ */
++static int brcmf_feat_fwcap_debugfs_read(struct seq_file *seq, void *data)
++{
++      struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
++      struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0);
++      char caps[MAX_CAPS_BUFFER_SIZE + 1] = { };
++      char *tmp;
++      int err;
++
++      err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps));
++      if (err) {
++              brcmf_err("could not get firmware cap (%d)\n", err);
++              return err;
++      }
++
++      /* Put every capability in a new line */
++      for (tmp = caps; *tmp; tmp++) {
++              if (*tmp == ' ')
++                      *tmp = '\n';
++      }
++
++      /* Usually there is a space at the end of capabilities string */
++      seq_printf(seq, "%s", caps);
++      /* So make sure we don't print two line breaks */
++      if (tmp > caps && *(tmp - 1) != '\n')
++              seq_printf(seq, "\n");
++
++      return 0;
++}
++
+ void brcmf_feat_attach(struct brcmf_pub *drvr)
+ {
+       struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
+@@ -196,6 +231,7 @@ void brcmf_feat_attach(struct brcmf_pub
+       }
+       brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read);
++      brcmf_debugfs_add_entry(drvr, "fwcap", brcmf_feat_fwcap_debugfs_read);
+ }
+ bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id)
diff --git a/package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-support-for-sysfs-initiated-coredump.patch b/package/kernel/mac80211/patches/331-v4.18-0005-brcmfmac-add-support-for-sysfs-initiated-coredump.patch
deleted file mode 100644 (file)
index 1d1365b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-From 8e072168f75ebce85b96cbcefea2b10ddbd5913f Mon Sep 17 00:00:00 2001
-From: Arend Van Spriel <arend.vanspriel@broadcom.com>
-Date: Wed, 16 May 2018 14:11:59 +0200
-Subject: [PATCH] brcmfmac: add support for sysfs initiated coredump
-
-The driver already supports device coredump initiated by firmware
-event. Since commit 3c47d19ff4dc ("drivers: base: add coredump driver
-ops") it is also possible to initiate it from user-space through
-sysfs. This patch adds support for SDIO and PCIe devices.
-
-Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
-Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
-Reviewed-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h    | 2 ++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c   | 8 ++++++++
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c   | 1 +
- 4 files changed, 12 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
-@@ -1299,6 +1299,9 @@ static struct sdio_driver brcmf_sdmmc_dr
- #ifdef CONFIG_PM_SLEEP
-               .pm = &brcmf_sdio_pm_ops,
- #endif        /* CONFIG_PM_SLEEP */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
-+              .coredump = brcmf_dev_coredump,
-+#endif
-       },
- };
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
-@@ -231,6 +231,8 @@ void brcmf_detach(struct device *dev);
- void brcmf_dev_reset(struct device *dev);
- /* Indication from bus module to change flow-control state */
- void brcmf_txflowblock(struct device *dev, bool state);
-+/* Request from bus module to initiate a coredump */
-+void brcmf_dev_coredump(struct device *dev);
- /* Notify the bus has transferred the tx packet to firmware */
- void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
-@@ -1159,6 +1159,14 @@ void brcmf_dev_reset(struct device *dev)
-               brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1);
- }
-+void brcmf_dev_coredump(struct device *dev)
-+{
-+      struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-+
-+      if (brcmf_debug_create_memdump(bus_if, NULL, 0) < 0)
-+              brcmf_dbg(TRACE, "failed to create coredump\n");
-+}
-+
- void brcmf_detach(struct device *dev)
- {
-       s32 i;
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -1995,6 +1995,9 @@ static struct pci_driver brcmf_pciedrvr
- #ifdef CONFIG_PM
-       .driver.pm = &brcmf_pciedrvr_pm,
- #endif
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
-+      .driver.coredump = brcmf_dev_coredump,
-+#endif
- };
diff --git a/package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-add-support-for-sysfs-initiated-coredump.patch b/package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-add-support-for-sysfs-initiated-coredump.patch
new file mode 100644 (file)
index 0000000..1d1365b
--- /dev/null
@@ -0,0 +1,74 @@
+From 8e072168f75ebce85b96cbcefea2b10ddbd5913f Mon Sep 17 00:00:00 2001
+From: Arend Van Spriel <arend.vanspriel@broadcom.com>
+Date: Wed, 16 May 2018 14:11:59 +0200
+Subject: [PATCH] brcmfmac: add support for sysfs initiated coredump
+
+The driver already supports device coredump initiated by firmware
+event. Since commit 3c47d19ff4dc ("drivers: base: add coredump driver
+ops") it is also possible to initiate it from user-space through
+sysfs. This patch adds support for SDIO and PCIe devices.
+
+Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
+Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
+Reviewed-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h    | 2 ++
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c   | 8 ++++++++
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c   | 1 +
+ 4 files changed, 12 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
+@@ -1299,6 +1299,9 @@ static struct sdio_driver brcmf_sdmmc_dr
+ #ifdef CONFIG_PM_SLEEP
+               .pm = &brcmf_sdio_pm_ops,
+ #endif        /* CONFIG_PM_SLEEP */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
++              .coredump = brcmf_dev_coredump,
++#endif
+       },
+ };
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
+@@ -231,6 +231,8 @@ void brcmf_detach(struct device *dev);
+ void brcmf_dev_reset(struct device *dev);
+ /* Indication from bus module to change flow-control state */
+ void brcmf_txflowblock(struct device *dev, bool state);
++/* Request from bus module to initiate a coredump */
++void brcmf_dev_coredump(struct device *dev);
+ /* Notify the bus has transferred the tx packet to firmware */
+ void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success);
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+@@ -1159,6 +1159,14 @@ void brcmf_dev_reset(struct device *dev)
+               brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1);
+ }
++void brcmf_dev_coredump(struct device *dev)
++{
++      struct brcmf_bus *bus_if = dev_get_drvdata(dev);
++
++      if (brcmf_debug_create_memdump(bus_if, NULL, 0) < 0)
++              brcmf_dbg(TRACE, "failed to create coredump\n");
++}
++
+ void brcmf_detach(struct device *dev)
+ {
+       s32 i;
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+@@ -1995,6 +1995,9 @@ static struct pci_driver brcmf_pciedrvr
+ #ifdef CONFIG_PM
+       .driver.pm = &brcmf_pciedrvr_pm,
+ #endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0)
++      .driver.coredump = brcmf_dev_coredump,
++#endif
+ };
diff --git a/package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-validate-user-provided-data-for-memdump-bef.patch b/package/kernel/mac80211/patches/331-v4.18-0006-brcmfmac-validate-user-provided-data-for-memdump-bef.patch
deleted file mode 100644 (file)
index 7ab6187..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-From d2af9b566554e01f9ad67b330ce569dbc130e5d3 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Wed, 16 May 2018 14:12:01 +0200
-Subject: [PATCH] brcmfmac: validate user provided data for memdump before
- copying
-
-In patch "brcmfmac: add support for sysfs initiated coredump", a new
-scenario of brcmf_debug_create_memdump was added in which the user of
-the function might not necessarily provide prefix data. Hence the
-function should not assume the data is always valid and should perform a
-check before copying.
-
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
-@@ -42,7 +42,8 @@ int brcmf_debug_create_memdump(struct br
-       if (!dump)
-               return -ENOMEM;
--      memcpy(dump, data, len);
-+      if (data && len > 0)
-+              memcpy(dump, data, len);
-       err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
-       if (err) {
-               vfree(dump);
diff --git a/package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch b/package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch
deleted file mode 100644 (file)
index e79cd4c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From 8a3ab2f38f1669e3be6433a1f6b82a077b38c4c7 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Wed, 16 May 2018 14:12:02 +0200
-Subject: [PATCH] brcmfmac: trigger memory dump upon firmware halt signal
-
-PCIe dongle firmware signals a halt/trap through mailbox interrupt.
-Trigger a memory dump upon receiving such signal could help to provide
-useful information for issue debug.
-
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
-@@ -180,6 +180,7 @@ static struct brcmf_firmware_mapping brc
- #define BRCMF_D2H_DEV_D3_ACK                  0x00000001
- #define BRCMF_D2H_DEV_DS_ENTER_REQ            0x00000002
- #define BRCMF_D2H_DEV_DS_EXIT_NOTE            0x00000004
-+#define BRCMF_D2H_DEV_FWHALT                  0x10000000
- #define BRCMF_H2D_HOST_D3_INFORM              0x00000001
- #define BRCMF_H2D_HOST_DS_ACK                 0x00000002
-@@ -715,6 +716,10 @@ static void brcmf_pcie_handle_mb_data(st
-               devinfo->mbdata_completed = true;
-               wake_up(&devinfo->mbdata_resp_wait);
-       }
-+      if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) {
-+              brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n");
-+              brcmf_dev_coredump(&devinfo->pdev->dev);
-+      }
- }
diff --git a/package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-validate-user-provided-data-for-memdump-bef.patch b/package/kernel/mac80211/patches/331-v4.18-0007-brcmfmac-validate-user-provided-data-for-memdump-bef.patch
new file mode 100644 (file)
index 0000000..7ab6187
--- /dev/null
@@ -0,0 +1,32 @@
+From d2af9b566554e01f9ad67b330ce569dbc130e5d3 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+Date: Wed, 16 May 2018 14:12:01 +0200
+Subject: [PATCH] brcmfmac: validate user provided data for memdump before
+ copying
+
+In patch "brcmfmac: add support for sysfs initiated coredump", a new
+scenario of brcmf_debug_create_memdump was added in which the user of
+the function might not necessarily provide prefix data. Hence the
+function should not assume the data is always valid and should perform a
+check before copying.
+
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
+@@ -42,7 +42,8 @@ int brcmf_debug_create_memdump(struct br
+       if (!dump)
+               return -ENOMEM;
+-      memcpy(dump, data, len);
++      if (data && len > 0)
++              memcpy(dump, data, len);
+       err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
+       if (err) {
+               vfree(dump);
diff --git a/package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch b/package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch
deleted file mode 100644 (file)
index 0861deb..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001
-From: Franky Lin <franky.lin@broadcom.com>
-Date: Wed, 16 May 2018 14:12:03 +0200
-Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message
-
-Attempt to dump dongle memory for debug upon receiving firmware halt
-message through dongle to host mail box interrupt.
-
-Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Franky Lin <franky.lin@broadcom.com>
-Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
-Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
----
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
-@@ -1095,8 +1095,10 @@ static u32 brcmf_sdio_hostmail(struct br
-       bus->sdcnt.f1regdata += 2;
-       /* dongle indicates the firmware has halted/crashed */
--      if (hmb_data & HMB_DATA_FWHALT)
-+      if (hmb_data & HMB_DATA_FWHALT) {
-               brcmf_err("mailbox indicates firmware halted\n");
-+              brcmf_dev_coredump(&sdiod->func1->dev);
-+      }
-       /* Dongle recomposed rx frames, accept them again */
-       if (hmb_data & HMB_DATA_NAKHANDLED) {
diff --git a/package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch b/package/kernel/mac80211/patches/331-v4.18-0008-brcmfmac-trigger-memory-dump-upon-firmware-halt-sign.patch
new file mode 100644 (file)
index 0000000..e79cd4c
--- /dev/null
@@ -0,0 +1,38 @@
+From 8a3ab2f38f1669e3be6433a1f6b82a077b38c4c7 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+Date: Wed, 16 May 2018 14:12:02 +0200
+Subject: [PATCH] brcmfmac: trigger memory dump upon firmware halt signal
+
+PCIe dongle firmware signals a halt/trap through mailbox interrupt.
+Trigger a memory dump upon receiving such signal could help to provide
+useful information for issue debug.
+
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+@@ -180,6 +180,7 @@ static struct brcmf_firmware_mapping brc
+ #define BRCMF_D2H_DEV_D3_ACK                  0x00000001
+ #define BRCMF_D2H_DEV_DS_ENTER_REQ            0x00000002
+ #define BRCMF_D2H_DEV_DS_EXIT_NOTE            0x00000004
++#define BRCMF_D2H_DEV_FWHALT                  0x10000000
+ #define BRCMF_H2D_HOST_D3_INFORM              0x00000001
+ #define BRCMF_H2D_HOST_DS_ACK                 0x00000002
+@@ -715,6 +716,10 @@ static void brcmf_pcie_handle_mb_data(st
+               devinfo->mbdata_completed = true;
+               wake_up(&devinfo->mbdata_resp_wait);
+       }
++      if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) {
++              brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n");
++              brcmf_dev_coredump(&devinfo->pdev->dev);
++      }
+ }
diff --git a/package/kernel/mac80211/patches/331-v4.18-0009-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch b/package/kernel/mac80211/patches/331-v4.18-0009-brcmfmac-trigger-memory-dump-on-SDIO-firmware-halt-m.patch
new file mode 100644 (file)
index 0000000..0861deb
--- /dev/null
@@ -0,0 +1,30 @@
+From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001
+From: Franky Lin <franky.lin@broadcom.com>
+Date: Wed, 16 May 2018 14:12:03 +0200
+Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message
+
+Attempt to dump dongle memory for debug upon receiving firmware halt
+message through dongle to host mail box interrupt.
+
+Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Franky Lin <franky.lin@broadcom.com>
+Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -1095,8 +1095,10 @@ static u32 brcmf_sdio_hostmail(struct br
+       bus->sdcnt.f1regdata += 2;
+       /* dongle indicates the firmware has halted/crashed */
+-      if (hmb_data & HMB_DATA_FWHALT)
++      if (hmb_data & HMB_DATA_FWHALT) {
+               brcmf_err("mailbox indicates firmware halted\n");
++              brcmf_dev_coredump(&sdiod->func1->dev);
++      }
+       /* Dongle recomposed rx frames, accept them again */
+       if (hmb_data & HMB_DATA_NAKHANDLED) {
index d86f06ad800649f25d385a5b1d6d85b4518f217f..4f9d154b3f97539c959dbabb07e3ee54f2b31332 100644 (file)
@@ -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
-@@ -1301,6 +1301,7 @@ int __init brcmf_core_init(void)
+@@ -1305,6 +1305,7 @@ int __init brcmf_core_init(void)
  {
        if (!schedule_work(&brcmf_driver_work))
                return -EBUSY;