|
@@ -1,4 +1,4 @@
|
|
-From 1488bfbdd03dc5f3903c71b91719d27e24a6c0f2 Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From f46be9ffd2914cec4593067da550ffc426ba828c Mon Sep 17 00:00:00 2001
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
Date: Mon, 28 Sep 2020 17:46:49 +0900
|
|
Date: Mon, 28 Sep 2020 17:46:49 +0900
|
|
Subject: [PATCH] mwifiex: pcie: add DMI-based quirk impl for Surface devices
|
|
Subject: [PATCH] mwifiex: pcie: add DMI-based quirk impl for Surface devices
|
|
@@ -204,9 +204,9 @@ index 000000000000..5326ae7e5671
|
|
+
|
|
+
|
|
+void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
+void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|
|
-From 4871ed416a4bcbab7907167c9eaebdcd93e04cae Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From 7f9280d5497d4dfec2c494f0797ad0ed10e64a10 Mon Sep 17 00:00:00 2001
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
Date: Tue, 29 Sep 2020 17:25:22 +0900
|
|
Date: Tue, 29 Sep 2020 17:25:22 +0900
|
|
Subject: [PATCH] mwifiex: pcie: add reset_d3cold quirk for Surface gen4+
|
|
Subject: [PATCH] mwifiex: pcie: add reset_d3cold quirk for Surface gen4+
|
|
@@ -405,9 +405,9 @@ index 5326ae7e5671..8b9dcb5070d8 100644
|
|
void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
+int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
+int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|
|
-From 0cb80deaf51fc408ab60c7b65508a40c7b167508 Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From 3f5a82f5a39d98e51f747415ae7746766b3c6971 Mon Sep 17 00:00:00 2001
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
Date: Tue, 29 Sep 2020 17:32:22 +0900
|
|
Date: Tue, 29 Sep 2020 17:32:22 +0900
|
|
Subject: [PATCH] mwifiex: pcie: add reset_wsid quirk for Surface 3
|
|
Subject: [PATCH] mwifiex: pcie: add reset_wsid quirk for Surface 3
|
|
@@ -584,9 +584,9 @@ index 8b9dcb5070d8..3ef7440418e3 100644
|
|
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
+int mwifiex_pcie_reset_wsid_quirk(struct pci_dev *pdev);
|
|
+int mwifiex_pcie_reset_wsid_quirk(struct pci_dev *pdev);
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|
|
-From 8751a784f243553c65ba7d215d26cefc9571d2fe Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From dbd310b9c656233985765614aeeebb9533957482 Mon Sep 17 00:00:00 2001
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
Date: Wed, 30 Sep 2020 18:08:24 +0900
|
|
Date: Wed, 30 Sep 2020 18:08:24 +0900
|
|
Subject: [PATCH] mwifiex: pcie: (OEMB) add quirk for Surface 3 with broken DMI
|
|
Subject: [PATCH] mwifiex: pcie: (OEMB) add quirk for Surface 3 with broken DMI
|
|
@@ -646,177 +646,9 @@ index f0a6fa0a7ae5..34dcd84f02a6 100644
|
|
.ident = "Surface Pro 3",
|
|
.ident = "Surface Pro 3",
|
|
.matches = {
|
|
.matches = {
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|
|
-From 30b13373c61b8f7544f4ec661cb0a0e01842e525 Mon Sep 17 00:00:00 2001
|
|
|
|
-From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Date: Thu, 24 Sep 2020 01:56:34 +0900
|
|
|
|
-Subject: [PATCH] mwifiex: pcie: use shutdown_sw()/reinit_sw() on
|
|
|
|
- suspend()/resume()
|
|
|
|
-
|
|
|
|
-There are issues with S0ix achievement and AP scanning after suspend
|
|
|
|
-with the current Host Sleep method.
|
|
|
|
-
|
|
|
|
-When using the Host Sleep method, it prevents the platform to reach S0ix
|
|
|
|
-during suspend. Also, after suspend, sometimes AP scanning won't work,
|
|
|
|
-resulting in non-working wifi.
|
|
|
|
-
|
|
|
|
-To fix such issues, perform shutdown_sw()/reinit_sw() instead of Host
|
|
|
|
-Sleep.
|
|
|
|
-
|
|
|
|
-As a side effect, this patch disables wakeups (means that Wake-On-WLAN
|
|
|
|
-can't be used anymore, if it was working before), and might also reset
|
|
|
|
-some internal states.
|
|
|
|
-
|
|
|
|
-Note that suspend() no longer checks if it's already suspended.
|
|
|
|
-
|
|
|
|
-With the previous Host Sleep method, the check was done by looking at
|
|
|
|
-adapter->hs_activated in mwifiex_enable_hs() [sta_ioctl.c], but not
|
|
|
|
-MWIFIEX_IS_SUSPENDED. So, what the previous method checked was instead
|
|
|
|
-Host Sleep state, not suspend itself. Therefore, there is no need to check
|
|
|
|
-the suspend state now.
|
|
|
|
-
|
|
|
|
-Also removed comment for suspend state check at top of suspend()
|
|
|
|
-accordingly.
|
|
|
|
-
|
|
|
|
-Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Patchset: wifi
|
|
|
|
----
|
|
|
|
- drivers/net/wireless/marvell/mwifiex/pcie.c | 29 +++++++--------------
|
|
|
|
- 1 file changed, 10 insertions(+), 19 deletions(-)
|
|
|
|
-
|
|
|
|
-diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-index bf9ef4ede3f1..30a602a18f9d 100644
|
|
|
|
---- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-@@ -294,8 +294,7 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
|
|
|
|
- * registered functions must have drivers with suspend and resume
|
|
|
|
- * methods. Failing that the kernel simply removes the whole card.
|
|
|
|
- *
|
|
|
|
-- * If already not suspended, this function allocates and sends a host
|
|
|
|
-- * sleep activate request to the firmware and turns off the traffic.
|
|
|
|
-+ * This function shuts down the adapter.
|
|
|
|
- */
|
|
|
|
- static int mwifiex_pcie_suspend(struct device *dev)
|
|
|
|
- {
|
|
|
|
-@@ -303,31 +302,21 @@ static int mwifiex_pcie_suspend(struct device *dev)
|
|
|
|
- struct pcie_service_card *card = dev_get_drvdata(dev);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-- /* Might still be loading firmware */
|
|
|
|
-- wait_for_completion(&card->fw_done);
|
|
|
|
--
|
|
|
|
- adapter = card->adapter;
|
|
|
|
- if (!adapter) {
|
|
|
|
- dev_err(dev, "adapter is not valid\n");
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-- mwifiex_enable_wake(adapter);
|
|
|
|
--
|
|
|
|
-- /* Enable the Host Sleep */
|
|
|
|
-- if (!mwifiex_enable_hs(adapter)) {
|
|
|
|
-+ /* Shut down SW */
|
|
|
|
-+ if (mwifiex_shutdown_sw(adapter)) {
|
|
|
|
- mwifiex_dbg(adapter, ERROR,
|
|
|
|
- "cmd: failed to suspend\n");
|
|
|
|
-- clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
|
|
|
|
-- mwifiex_disable_wake(adapter);
|
|
|
|
- return -EFAULT;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-- flush_workqueue(adapter->workqueue);
|
|
|
|
--
|
|
|
|
- /* Indicate device suspended */
|
|
|
|
- set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
|
|
|
|
-- clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
-@@ -337,13 +326,13 @@ static int mwifiex_pcie_suspend(struct device *dev)
|
|
|
|
- * registered functions must have drivers with suspend and resume
|
|
|
|
- * methods. Failing that the kernel simply removes the whole card.
|
|
|
|
- *
|
|
|
|
-- * If already not resumed, this function turns on the traffic and
|
|
|
|
-- * sends a host sleep cancel request to the firmware.
|
|
|
|
-+ * If already not resumed, this function reinits the adapter.
|
|
|
|
- */
|
|
|
|
- static int mwifiex_pcie_resume(struct device *dev)
|
|
|
|
- {
|
|
|
|
- struct mwifiex_adapter *adapter;
|
|
|
|
- struct pcie_service_card *card = dev_get_drvdata(dev);
|
|
|
|
-+ int ret;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (!card->adapter) {
|
|
|
|
-@@ -361,9 +350,11 @@ static int mwifiex_pcie_resume(struct device *dev)
|
|
|
|
-
|
|
|
|
- clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
|
|
|
|
-
|
|
|
|
-- mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
|
|
|
|
-- MWIFIEX_ASYNC_CMD);
|
|
|
|
-- mwifiex_disable_wake(adapter);
|
|
|
|
-+ ret = mwifiex_reinit_sw(adapter);
|
|
|
|
-+ if (ret)
|
|
|
|
-+ dev_err(dev, "reinit failed: %d\n", ret);
|
|
|
|
-+ else
|
|
|
|
-+ mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__);
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
---
|
|
|
|
-2.30.2
|
|
|
|
-
|
|
|
|
-From 0be2e8316621230bb7529c8e9067d6117c051603 Mon Sep 17 00:00:00 2001
|
|
|
|
-From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Date: Mon, 24 Aug 2020 17:11:35 +0900
|
|
|
|
-Subject: [PATCH] mwifiex: pcie: add enable_device_dump module parameter
|
|
|
|
-
|
|
|
|
-The devicve_dump may take a little bit long time and users may want to
|
|
|
|
-disable the dump for daily usage.
|
|
|
|
-
|
|
|
|
-This commit adds a new module parameter and disables device_dump by
|
|
|
|
-default.
|
|
|
|
-
|
|
|
|
-Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Patchset: wifi
|
|
|
|
----
|
|
|
|
- drivers/net/wireless/marvell/mwifiex/pcie.c | 11 +++++++++++
|
|
|
|
- 1 file changed, 11 insertions(+)
|
|
|
|
-
|
|
|
|
-diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-index 30a602a18f9d..113636355dec 100644
|
|
|
|
---- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
-@@ -183,6 +183,11 @@ static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
|
|
|
|
- .can_ext_scan = true,
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
-+static bool enable_device_dump;
|
|
|
|
-+module_param(enable_device_dump, bool, 0644);
|
|
|
|
-+MODULE_PARM_DESC(enable_device_dump,
|
|
|
|
-+ "enable device_dump (default: disabled)");
|
|
|
|
-+
|
|
|
|
- static const struct of_device_id mwifiex_pcie_of_match_table[] = {
|
|
|
|
- { .compatible = "pci11ab,2b42" },
|
|
|
|
- { .compatible = "pci1b4b,2b42" },
|
|
|
|
-@@ -2943,6 +2948,12 @@ static void mwifiex_pcie_fw_dump(struct mwifiex_adapter *adapter)
|
|
|
|
-
|
|
|
|
- static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter)
|
|
|
|
- {
|
|
|
|
-+ if (!enable_device_dump) {
|
|
|
|
-+ mwifiex_dbg(adapter, MSG,
|
|
|
|
-+ "device_dump is disabled by module parameter\n");
|
|
|
|
-+ return;
|
|
|
|
-+ }
|
|
|
|
-+
|
|
|
|
- adapter->devdump_data = vzalloc(MWIFIEX_FW_DUMP_SIZE);
|
|
|
|
- if (!adapter->devdump_data) {
|
|
|
|
- mwifiex_dbg(adapter, ERROR,
|
|
|
|
---
|
|
|
|
-2.30.2
|
|
|
|
-
|
|
|
|
-From 264838e5b5383b14e40f4cc196abefa690d1d859 Mon Sep 17 00:00:00 2001
|
|
|
|
|
|
+From a59d938fac929cc34a0cb0bcb2489fde92af12d2 Mon Sep 17 00:00:00 2001
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
Date: Sun, 4 Oct 2020 00:11:49 +0900
|
|
Date: Sun, 4 Oct 2020 00:11:49 +0900
|
|
Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
|
|
Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
|
|
@@ -838,10 +670,10 @@ Patchset: wifi
|
|
3 files changed, 27 insertions(+), 8 deletions(-)
|
|
3 files changed, 27 insertions(+), 8 deletions(-)
|
|
|
|
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
-index 113636355dec..1a44ca3e66f3 100644
|
|
|
|
|
|
+index bf9ef4ede3f1..ba6296885b82 100644
|
|
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
-@@ -375,6 +375,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
|
|
|
|
|
|
+@@ -379,6 +379,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
|
|
const struct pci_device_id *ent)
|
|
const struct pci_device_id *ent)
|
|
{
|
|
{
|
|
struct pcie_service_card *card;
|
|
struct pcie_service_card *card;
|
|
@@ -849,7 +681,7 @@ index 113636355dec..1a44ca3e66f3 100644
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
|
|
pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
|
|
-@@ -416,6 +417,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
|
|
|
|
|
|
+@@ -420,6 +421,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -969,150 +801,1280 @@ index 3ef7440418e3..a95ebac06e13 100644
|
|
void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|
|
-From e70c8a87dd34dcde524bd13ad6bbcdd62617a08e Mon Sep 17 00:00:00 2001
|
|
|
|
-From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Date: Sun, 4 Oct 2020 00:25:48 +0900
|
|
|
|
-Subject: [PATCH] mwifiex: add allow_ps_mode module parameter
|
|
|
|
|
|
+From e77c4bb867183feb91cb25e1315fc90191454b5f Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Tue, 3 Nov 2020 13:28:04 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface
|
|
|
|
+ devices
|
|
|
|
+
|
|
|
|
+The most recent firmware of the 88W8897 card reports a hardcoded LTR
|
|
|
|
+value to the system during initialization, probably as an (unsuccessful)
|
|
|
|
+attempt of the developers to fix firmware crashes. This LTR value
|
|
|
|
+prevents most of the Microsoft Surface devices from entering deep
|
|
|
|
+powersaving states (either platform C-State 10 or S0ix state), because
|
|
|
|
+the exit latency of that state would be higher than what the card can
|
|
|
|
+tolerate.
|
|
|
|
+
|
|
|
|
+Turns out the card works just the same (including the firmware crashes)
|
|
|
|
+no matter if that hardcoded LTR value is reported or not, so it's kind
|
|
|
|
+of useless and only prevents us from saving power.
|
|
|
|
+
|
|
|
|
+To get rid of those hardcoded LTR reports, it's possible to reset the
|
|
|
|
+PCI bridge device after initializing the cards firmware. I'm not exactly
|
|
|
|
+sure why that works, maybe the power management subsystem of the PCH
|
|
|
|
+resets its stored LTR values when doing a function level reset of the
|
|
|
|
+bridge device. Doing the reset once after starting the wifi firmware
|
|
|
|
+works very well, probably because the firmware only reports that LTR
|
|
|
|
+value a single time during firmware startup.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/pcie.c | 12 +++++++++
|
|
|
|
+ .../wireless/marvell/mwifiex/pcie_quirks.c | 26 +++++++++++++------
|
|
|
|
+ .../wireless/marvell/mwifiex/pcie_quirks.h | 1 +
|
|
|
|
+ 3 files changed, 31 insertions(+), 8 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+index ba6296885b82..9ac12ff4a5c1 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+@@ -1757,9 +1757,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
|
|
|
|
+ static int mwifiex_pcie_init_fw_port(struct mwifiex_adapter *adapter)
|
|
|
|
+ {
|
|
|
|
+ struct pcie_service_card *card = adapter->card;
|
|
|
|
++ struct pci_dev *pdev = card->dev;
|
|
|
|
++ struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
|
|
|
|
+ const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
|
|
|
|
+ int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask;
|
|
|
|
+
|
|
|
|
++ /* Trigger a function level reset of the PCI bridge device, this makes
|
|
|
|
++ * the firmware of PCIe 88W8897 cards stop reporting a fixed LTR value
|
|
|
|
++ * that prevents the system from entering package C10 and S0ix powersaving
|
|
|
|
++ * states.
|
|
|
|
++ * We need to do it here because it must happen after firmware
|
|
|
|
++ * initialization and this function is called after that is done.
|
|
|
|
++ */
|
|
|
|
++ if (card->quirks & QUIRK_DO_FLR_ON_BRIDGE)
|
|
|
|
++ pci_reset_function(parent_pdev);
|
|
|
|
++
|
|
|
|
+ /* Write the RX ring read pointer in to reg->rx_rdptr */
|
|
|
|
+ if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr |
|
|
|
|
+ tx_wrap)) {
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
|
|
|
|
+index a2aeb2af907e..6885575826a6 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
|
|
|
|
+@@ -33,7 +33,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 4"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Pro 5",
|
|
|
|
+@@ -43,7 +44,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1796"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Pro 5 (LTE)",
|
|
|
|
+@@ -53,7 +55,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1807"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Pro 6",
|
|
|
|
+@@ -62,7 +65,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 6"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Book 1",
|
|
|
|
+@@ -71,7 +75,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Book 2",
|
|
|
|
+@@ -80,7 +85,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book 2"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Laptop 1",
|
|
|
|
+@@ -89,7 +95,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface Laptop 2",
|
|
|
|
+@@ -98,7 +105,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
|
|
|
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop 2"),
|
|
|
|
+ },
|
|
|
|
+ .driver_data = (void *)(QUIRK_FW_RST_D3COLD |
|
|
|
|
+- QUIRK_NO_BRIDGE_D3),
|
|
|
|
++ QUIRK_NO_BRIDGE_D3 |
|
|
|
|
++ QUIRK_DO_FLR_ON_BRIDGE),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .ident = "Surface 3",
|
|
|
|
+@@ -147,6 +155,8 @@ void mwifiex_initialize_quirks(struct pcie_service_card *card)
|
|
|
|
+ if (card->quirks & QUIRK_NO_BRIDGE_D3)
|
|
|
|
+ dev_info(&pdev->dev,
|
|
|
|
+ "quirk no_brigde_d3 enabled\n");
|
|
|
|
++ if (card->quirks & QUIRK_DO_FLR_ON_BRIDGE)
|
|
|
|
++ dev_info(&pdev->dev, "quirk do_flr_on_bridge enabled\n");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ static void mwifiex_pcie_set_power_d3cold(struct pci_dev *pdev)
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h
|
|
|
|
+index a95ebac06e13..4ec2ae72f632 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h
|
|
|
|
+@@ -12,6 +12,7 @@
|
|
|
|
+ */
|
|
|
|
+ #define QUIRK_FW_RST_WSID_S3 BIT(1)
|
|
|
|
+ #define QUIRK_NO_BRIDGE_D3 BIT(2)
|
|
|
|
++#define QUIRK_DO_FLR_ON_BRIDGE BIT(3)
|
|
|
|
+
|
|
|
|
+ void mwifiex_initialize_quirks(struct pcie_service_card *card);
|
|
|
|
+ int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From ef2eea8b78ab6c4aceff7d7a7be5a82193425c51 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Thu, 25 Mar 2021 11:33:02 +0100
|
|
|
|
+Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell
|
|
|
|
+ 88W8897
|
|
|
|
+
|
|
|
|
+The Marvell 88W8897 combined wifi and bluetooth card (pcie+usb version)
|
|
|
|
+is used in a lot of Microsoft Surface devices, and all those devices
|
|
|
|
+suffer from very low 2.4GHz wifi connection speeds while bluetooth is
|
|
|
|
+enabled. The reason for that is that the default passive scanning
|
|
|
|
+interval for Bluetooth Low Energy devices is quite high in Linux
|
|
|
|
+(interval of 60 msec and scan window of 30 msec, see hci_core.c), and
|
|
|
|
+the Marvell chip is known for its bad bt+wifi coexisting performance.
|
|
|
|
+
|
|
|
|
+So decrease that passive scan interval and make the scan window shorter
|
|
|
|
+on this particular device to allow for spending more time transmitting
|
|
|
|
+wifi signals: The new scan interval is 250 msec (0x190 * 0.625 msec) and
|
|
|
|
+the new scan window is 6.25 msec (0xa * 0,625 msec).
|
|
|
|
+
|
|
|
|
+This change has a very large impact on the 2.4GHz wifi speeds and gets
|
|
|
|
+it up to performance comparable with the Windows driver, which seems to
|
|
|
|
+apply a similar quirk.
|
|
|
|
+
|
|
|
|
+The interval and window length were tested and found to work very well
|
|
|
|
+with a lot of Bluetooth Low Energy devices, including the Surface Pen, a
|
|
|
|
+Bluetooth Speaker and two modern Bluetooth headphones. All devices were
|
|
|
|
+discovered immediately after turning them on. Even lower values were
|
|
|
|
+also tested, but they introduced longer delays until devices get
|
|
|
|
+discovered.
|
|
|
|
|
|
-This commit adds the allow_ps_mode module parameter and set it false
|
|
|
|
-(disallowed) by default, to make ps_mode (power_save) control easier.
|
|
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/bluetooth/btusb.c | 15 +++++++++++++++
|
|
|
|
+ 1 file changed, 15 insertions(+)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
|
|
|
|
+index a4f834a50a98..e276f84a41bd 100644
|
|
|
|
+--- a/drivers/bluetooth/btusb.c
|
|
|
|
++++ b/drivers/bluetooth/btusb.c
|
|
|
|
+@@ -61,6 +61,7 @@ static struct usb_driver btusb_driver;
|
|
|
|
+ #define BTUSB_VALID_LE_STATES 0x800000
|
|
|
|
+ #define BTUSB_QCA_WCN6855 0x1000000
|
|
|
|
+ #define BTUSB_INTEL_NEWGEN 0x2000000
|
|
|
|
++#define BTUSB_LOWER_LESCAN_INTERVAL BIT(26)
|
|
|
|
+
|
|
|
|
+ static const struct usb_device_id btusb_table[] = {
|
|
|
|
+ /* Generic Bluetooth USB device */
|
|
|
|
+@@ -357,6 +358,7 @@ static const struct usb_device_id blacklist_table[] = {
|
|
|
|
+ { USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
|
|
|
|
+ { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
|
|
|
|
+ { USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL },
|
|
|
|
++ { USB_DEVICE(0x1286, 0x204c), .driver_info = BTUSB_LOWER_LESCAN_INTERVAL },
|
|
|
|
+
|
|
|
|
+ /* Intel Bluetooth devices */
|
|
|
|
+ { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_NEW |
|
|
|
|
+@@ -4491,6 +4493,19 @@ static int btusb_probe(struct usb_interface *intf,
|
|
|
|
+ if (id->driver_info & BTUSB_MARVELL)
|
|
|
|
+ hdev->set_bdaddr = btusb_set_bdaddr_marvell;
|
|
|
|
+
|
|
|
|
++ /* The Marvell 88W8897 combined wifi and bluetooth card is known for
|
|
|
|
++ * very bad bt+wifi coexisting performance.
|
|
|
|
++ *
|
|
|
|
++ * Decrease the passive BT Low Energy scan interval a bit
|
|
|
|
++ * (0x0190 * 0.625 msec = 250 msec) and make the scan window shorter
|
|
|
|
++ * (0x000a * 0,625 msec = 6.25 msec). This allows for significantly
|
|
|
|
++ * higher wifi throughput while passively scanning for BT LE devices.
|
|
|
|
++ */
|
|
|
|
++ if (id->driver_info & BTUSB_LOWER_LESCAN_INTERVAL) {
|
|
|
|
++ hdev->le_scan_interval = 0x0190;
|
|
|
|
++ hdev->le_scan_window = 0x000a;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ if (IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK) &&
|
|
|
|
+ (id->driver_info & BTUSB_MEDIATEK)) {
|
|
|
|
+ hdev->setup = btusb_mtk_setup;
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
|
|
-On some setups (e.g., with 5GHz AP), power_save causes connection
|
|
|
|
-completely unstable. So, we need to disable it. However, userspace tools
|
|
|
|
-may try to enable it. For this reason, we need to tell userspace that
|
|
|
|
-power_save is disallowed by default.
|
|
|
|
|
|
+From a9fcadb8c659155a884f4560c19bbbad38c51db0 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Wed, 11 Nov 2020 12:31:26 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Small cleanup for handling virtual interface type
|
|
|
|
+ changes
|
|
|
|
|
|
-When this parameter is set to false, changing the power_save mode will
|
|
|
|
-be disallowed like the following:
|
|
|
|
|
|
+Handle the obvious invalid virtual interface type changes with a general
|
|
|
|
+check instead of looking at the individual change.
|
|
|
|
|
|
- $ sudo iw dev mlan0 set power_save on
|
|
|
|
- command failed: Operation not permitted (-1)
|
|
|
|
|
|
+For type changes from P2P_CLIENT to P2P_GO and the other way round, this
|
|
|
|
+changes the behavior slightly: We now still do nothing, but return
|
|
|
|
+-EOPNOTSUPP instead of 0. Now that behavior was incorrect before and
|
|
|
|
+still is, because type changes between these two types are actually
|
|
|
|
+possible and supported, which we'll fix in a following commit.
|
|
|
|
|
|
-Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
Patchset: wifi
|
|
Patchset: wifi
|
|
---
|
|
---
|
|
- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 16 ++++++++++++++++
|
|
|
|
- 1 file changed, 16 insertions(+)
|
|
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 39 +++++++------------
|
|
|
|
+ 1 file changed, 14 insertions(+), 25 deletions(-)
|
|
|
|
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
-index a6b9dc6700b1..943bc1e8ceae 100644
|
|
|
|
|
|
+index a6b9dc6700b1..d50fd8570475 100644
|
|
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
-@@ -25,6 +25,11 @@
|
|
|
|
- static char *reg_alpha2;
|
|
|
|
- module_param(reg_alpha2, charp, 0);
|
|
|
|
|
|
+@@ -1141,6 +1141,20 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return -EBUSY;
|
|
|
|
+ }
|
|
|
|
|
|
-+static bool allow_ps_mode;
|
|
|
|
-+module_param(allow_ps_mode, bool, 0644);
|
|
|
|
-+MODULE_PARM_DESC(allow_ps_mode,
|
|
|
|
-+ "allow WiFi power management to be enabled. (default: disallowed)");
|
|
|
|
|
|
++ if (type == NL80211_IFTYPE_UNSPECIFIED) {
|
|
|
|
++ mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
++ "%s: no new type specified, keeping old type %d\n",
|
|
|
|
++ dev->name, curr_iftype);
|
|
|
|
++ return 0;
|
|
|
|
++ }
|
|
+
|
|
+
|
|
- static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
|
|
|
|
- {
|
|
|
|
- .max = MWIFIEX_MAX_BSS_NUM,
|
|
|
|
-@@ -435,6 +440,17 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
|
|
|
|
-
|
|
|
|
- ps_mode = enabled;
|
|
|
|
|
|
++ if (curr_iftype == type) {
|
|
|
|
++ mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
++ "%s: interface already is of type %d\n",
|
|
|
|
++ dev->name, curr_iftype);
|
|
|
|
++ return 0;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ switch (curr_iftype) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+ switch (type) {
|
|
|
|
+@@ -1160,12 +1174,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
+- "%s: kept type as IBSS\n", dev->name);
|
|
|
|
+- fallthrough;
|
|
|
|
+- case NL80211_IFTYPE_ADHOC: /* This shouldn't happen */
|
|
|
|
+- return 0;
|
|
|
|
+ default:
|
|
|
|
+ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+ "%s: changing to %d not supported\n",
|
|
|
|
+@@ -1191,12 +1199,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
+- "%s: kept type as STA\n", dev->name);
|
|
|
|
+- fallthrough;
|
|
|
|
+- case NL80211_IFTYPE_STATION: /* This shouldn't happen */
|
|
|
|
+- return 0;
|
|
|
|
+ default:
|
|
|
|
+ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+ "%s: changing to %d not supported\n",
|
|
|
|
+@@ -1214,12 +1216,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+ return mwifiex_change_vif_to_p2p(dev, curr_iftype,
|
|
|
|
+ type, params);
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
+- "%s: kept type as AP\n", dev->name);
|
|
|
|
+- fallthrough;
|
|
|
|
+- case NL80211_IFTYPE_AP: /* This shouldn't happen */
|
|
|
|
+- return 0;
|
|
|
|
+ default:
|
|
|
|
+ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+ "%s: changing to %d not supported\n",
|
|
|
|
+@@ -1254,13 +1250,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return -EFAULT;
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- mwifiex_dbg(priv->adapter, INFO,
|
|
|
|
+- "%s: kept type as P2P\n", dev->name);
|
|
|
|
+- fallthrough;
|
|
|
|
+- case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+- return 0;
|
|
|
|
+ default:
|
|
|
|
+ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+ "%s: changing to %d not supported\n",
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From 7a0a5f2c57d7ee8734717fddc809fc841af24996 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Wed, 11 Nov 2020 12:44:39 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Use function to check whether interface type change
|
|
|
|
+ is allowed
|
|
|
|
+
|
|
|
|
+Instead of bailing out in the function which is supposed to do the type
|
|
|
|
+change, detect invalid changes beforehand using a generic function and
|
|
|
|
+return an error if the change is not allowed.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 139 ++++++++++++------
|
|
|
|
+ 1 file changed, 92 insertions(+), 47 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index d50fd8570475..3a79a55bbfd2 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -939,6 +939,76 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
|
|
-+ /* Allow ps_mode to be enabled only when allow_ps_mode is true */
|
|
|
|
-+ if (ps_mode && !allow_ps_mode) {
|
|
|
|
-+ mwifiex_dbg(priv->adapter, MSG,
|
|
|
|
-+ "Enabling ps_mode disallowed by modparam\n");
|
|
|
|
|
|
++static bool
|
|
|
|
++is_vif_type_change_allowed(struct mwifiex_adapter *adapter,
|
|
|
|
++ enum nl80211_iftype old_iftype,
|
|
|
|
++ enum nl80211_iftype new_iftype)
|
|
|
|
++{
|
|
|
|
++ switch (old_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ switch (new_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ return true;
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ return adapter->curr_iface_comb.p2p_intf !=
|
|
|
|
++ adapter->iface_limit.p2p_intf;
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ return adapter->curr_iface_comb.uap_intf !=
|
|
|
|
++ adapter->iface_limit.uap_intf;
|
|
|
|
++ default:
|
|
|
|
++ return false;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ switch (new_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ return true;
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ return adapter->curr_iface_comb.p2p_intf !=
|
|
|
|
++ adapter->iface_limit.p2p_intf;
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ return adapter->curr_iface_comb.uap_intf !=
|
|
|
|
++ adapter->iface_limit.uap_intf;
|
|
|
|
++ default:
|
|
|
|
++ return false;
|
|
|
|
++ }
|
|
+
|
|
+
|
|
-+ /* Return -EPERM to inform userspace tools that setting
|
|
|
|
-+ * power_save to be enabled is not permitted.
|
|
|
|
-+ */
|
|
|
|
-+ return -EPERM;
|
|
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ switch (new_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ return adapter->curr_iface_comb.sta_intf !=
|
|
|
|
++ adapter->iface_limit.sta_intf;
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ return adapter->curr_iface_comb.p2p_intf !=
|
|
|
|
++ adapter->iface_limit.p2p_intf;
|
|
|
|
++ default:
|
|
|
|
++ return false;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ switch (new_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ return true;
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ return adapter->curr_iface_comb.uap_intf !=
|
|
|
|
++ adapter->iface_limit.uap_intf;
|
|
|
|
++ default:
|
|
|
|
++ return false;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ default:
|
|
|
|
++ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+
|
|
- return mwifiex_drv_set_power(priv, &ps_mode);
|
|
|
|
|
|
++ return false;
|
|
|
|
++}
|
|
|
|
++
|
|
|
|
+ static int
|
|
|
|
+ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+ enum nl80211_iftype curr_iftype,
|
|
|
|
+@@ -955,13 +1025,6 @@ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+
|
|
|
|
+ adapter = priv->adapter;
|
|
|
|
+
|
|
|
|
+- if (adapter->curr_iface_comb.p2p_intf ==
|
|
|
|
+- adapter->iface_limit.p2p_intf) {
|
|
|
|
+- mwifiex_dbg(adapter, ERROR,
|
|
|
|
+- "cannot create multiple P2P ifaces\n");
|
|
|
|
+- return -1;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+ mwifiex_dbg(adapter, INFO,
|
|
|
|
+ "%s: changing role to p2p\n", dev->name);
|
|
|
|
+
|
|
|
|
+@@ -1027,15 +1090,6 @@ mwifiex_change_vif_to_sta_adhoc(struct net_device *dev,
|
|
|
|
+
|
|
|
|
+ adapter = priv->adapter;
|
|
|
|
+
|
|
|
|
+- if ((curr_iftype != NL80211_IFTYPE_P2P_CLIENT &&
|
|
|
|
+- curr_iftype != NL80211_IFTYPE_P2P_GO) &&
|
|
|
|
+- (adapter->curr_iface_comb.sta_intf ==
|
|
|
|
+- adapter->iface_limit.sta_intf)) {
|
|
|
|
+- mwifiex_dbg(adapter, ERROR,
|
|
|
|
+- "cannot create multiple station/adhoc ifaces\n");
|
|
|
|
+- return -1;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+ if (type == NL80211_IFTYPE_STATION)
|
|
|
|
+ mwifiex_dbg(adapter, INFO,
|
|
|
|
+ "%s: changing role to station\n", dev->name);
|
|
|
|
+@@ -1086,13 +1140,6 @@ mwifiex_change_vif_to_ap(struct net_device *dev,
|
|
|
|
+
|
|
|
|
+ adapter = priv->adapter;
|
|
|
|
+
|
|
|
|
+- if (adapter->curr_iface_comb.uap_intf ==
|
|
|
|
+- adapter->iface_limit.uap_intf) {
|
|
|
|
+- mwifiex_dbg(adapter, ERROR,
|
|
|
|
+- "cannot create multiple AP ifaces\n");
|
|
|
|
+- return -1;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+ mwifiex_dbg(adapter, INFO,
|
|
|
|
+ "%s: changing role to AP\n", dev->name);
|
|
|
|
+
|
|
|
|
+@@ -1155,6 +1202,13 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
++ if (!is_vif_type_change_allowed(priv->adapter, curr_iftype, type)) {
|
|
|
|
++ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
++ "%s: change from type %d to %d is not allowed\n",
|
|
|
|
++ dev->name, curr_iftype, type);
|
|
|
|
++ return -EOPNOTSUPP;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ switch (curr_iftype) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+ switch (type) {
|
|
|
|
+@@ -1175,12 +1229,9 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+ default:
|
|
|
|
+- mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+- "%s: changing to %d not supported\n",
|
|
|
|
+- dev->name, type);
|
|
|
|
+- return -EOPNOTSUPP;
|
|
|
|
++ goto errnotsupp;
|
|
|
|
+ }
|
|
|
|
+- break;
|
|
|
|
++
|
|
|
|
+ case NL80211_IFTYPE_STATION:
|
|
|
|
+ switch (type) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+@@ -1200,12 +1251,9 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+ default:
|
|
|
|
+- mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+- "%s: changing to %d not supported\n",
|
|
|
|
+- dev->name, type);
|
|
|
|
+- return -EOPNOTSUPP;
|
|
|
|
++ goto errnotsupp;
|
|
|
|
+ }
|
|
|
|
+- break;
|
|
|
|
++
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ switch (type) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+@@ -1217,12 +1265,9 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return mwifiex_change_vif_to_p2p(dev, curr_iftype,
|
|
|
|
+ type, params);
|
|
|
|
+ default:
|
|
|
|
+- mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+- "%s: changing to %d not supported\n",
|
|
|
|
+- dev->name, type);
|
|
|
|
+- return -EOPNOTSUPP;
|
|
|
|
++ goto errnotsupp;
|
|
|
|
+ }
|
|
|
|
+- break;
|
|
|
|
++
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+ switch (type) {
|
|
|
|
+@@ -1251,21 +1296,21 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+ default:
|
|
|
|
+- mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+- "%s: changing to %d not supported\n",
|
|
|
|
+- dev->name, type);
|
|
|
|
+- return -EOPNOTSUPP;
|
|
|
|
++ goto errnotsupp;
|
|
|
|
+ }
|
|
|
|
+- break;
|
|
|
|
++
|
|
|
|
+ default:
|
|
|
|
+- mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
+- "%s: unknown iftype: %d\n",
|
|
|
|
+- dev->name, dev->ieee80211_ptr->iftype);
|
|
|
|
+- return -EOPNOTSUPP;
|
|
|
|
++ goto errnotsupp;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
++
|
|
|
|
++errnotsupp:
|
|
|
|
++ mwifiex_dbg(priv->adapter, ERROR,
|
|
|
|
++ "unsupported interface type transition: %d to %d\n",
|
|
|
|
++ curr_iftype, type);
|
|
|
|
++ return -EOPNOTSUPP;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ static void
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From 66684e715db286f46230c5f9f157ee4b7203575a Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Wed, 11 Nov 2020 13:33:04 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Run SET_BSS_MODE when changing from P2P to STATION
|
|
|
|
+ vif-type
|
|
|
|
+
|
|
|
|
+We currently handle changing from the P2P to the STATION virtual
|
|
|
|
+interface type slightly different than changing from P2P to ADHOC: When
|
|
|
|
+changing to STATION, we don't send the SET_BSS_MODE command. We do send
|
|
|
|
+that command on all other type-changes though, and it probably makes
|
|
|
|
+sense to send the command since after all we just changed our BSS_MODE.
|
|
|
|
+Looking at prior changes to this part of the code, it seems that this is
|
|
|
|
+simply a leftover from old refactorings.
|
|
|
|
+
|
|
|
|
+Since sending the SET_BSS_MODE command is the only difference between
|
|
|
|
+mwifiex_change_vif_to_sta_adhoc() and the current code, we can now use
|
|
|
|
+mwifiex_change_vif_to_sta_adhoc() for both switching to ADHOC and
|
|
|
|
+STATION interface type.
|
|
|
|
+
|
|
|
|
+This does not fix any particular bug and just "looked right", so there's
|
|
|
|
+a small chance it might be a regression.
|
|
|
|
|
|
-From 9d7468b0241457b8cff8798224f649ef61374a85 Mon Sep 17 00:00:00 2001
|
|
|
|
-From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Date: Sun, 4 Oct 2020 00:38:48 +0900
|
|
|
|
-Subject: [PATCH] mwifiex: print message when changing ps_mode
|
|
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++---------------
|
|
|
|
+ 1 file changed, 4 insertions(+), 18 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index 3a79a55bbfd2..66e978088061 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -1270,29 +1270,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
++ return -EFAULT;
|
|
|
|
++
|
|
|
|
+ switch (type) {
|
|
|
|
+- case NL80211_IFTYPE_STATION:
|
|
|
|
+- if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
+- return -EFAULT;
|
|
|
|
+- priv->adapter->curr_iface_comb.p2p_intf--;
|
|
|
|
+- priv->adapter->curr_iface_comb.sta_intf++;
|
|
|
|
+- dev->ieee80211_ptr->iftype = type;
|
|
|
|
+- if (mwifiex_deinit_priv_params(priv))
|
|
|
|
+- return -1;
|
|
|
|
+- if (mwifiex_init_new_priv_params(priv, dev, type))
|
|
|
|
+- return -1;
|
|
|
|
+- if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+- return -1;
|
|
|
|
+- break;
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
+- return -EFAULT;
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
+ return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
|
|
|
|
+ type, params);
|
|
|
|
+- break;
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+- if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
+- return -EFAULT;
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+ default:
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
|
|
-Users may want to know the ps_mode state change (e.g., diagnosing
|
|
|
|
-connection issues). This commit adds the print when changing ps_mode.
|
|
|
|
|
|
+From 8a9fd20406edff99502a114fc630cd35556e0421 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Wed, 11 Nov 2020 14:42:54 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Use helper function for counting interface types
|
|
|
|
+
|
|
|
|
+Use a small helper function to increment and decrement the counter of
|
|
|
|
+the interface types we currently manage. This makes the code that
|
|
|
|
+actually changes and sets up the interface type a bit less messy and
|
|
|
|
+also helps avoiding mistakes in case someone increments/decrements a
|
|
|
|
+counter wrongly.
|
|
|
|
|
|
-Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
Patchset: wifi
|
|
Patchset: wifi
|
|
---
|
|
---
|
|
- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++++++
|
|
|
|
- 1 file changed, 7 insertions(+)
|
|
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 110 ++++++------------
|
|
|
|
+ 1 file changed, 35 insertions(+), 75 deletions(-)
|
|
|
|
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
-index 943bc1e8ceae..a2eb8df8d385 100644
|
|
|
|
|
|
+index 66e978088061..db30f595e9f9 100644
|
|
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
-@@ -451,6 +451,13 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
|
|
|
|
- return -EPERM;
|
|
|
|
- }
|
|
|
|
|
|
+@@ -1009,6 +1009,32 @@ is_vif_type_change_allowed(struct mwifiex_adapter *adapter,
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
|
|
-+ if (ps_mode)
|
|
|
|
-+ mwifiex_dbg(priv->adapter, MSG,
|
|
|
|
-+ "Enabling ps_mode, disable if unstable.\n");
|
|
|
|
-+ else
|
|
|
|
-+ mwifiex_dbg(priv->adapter, MSG,
|
|
|
|
-+ "Disabling ps_mode.\n");
|
|
|
|
|
|
++static void
|
|
|
|
++update_vif_type_counter(struct mwifiex_adapter *adapter,
|
|
|
|
++ enum nl80211_iftype iftype,
|
|
|
|
++ int change)
|
|
|
|
++{
|
|
|
|
++ switch (iftype) {
|
|
|
|
++ case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ adapter->curr_iface_comb.sta_intf += change;
|
|
|
|
++ break;
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ adapter->curr_iface_comb.uap_intf += change;
|
|
|
|
++ break;
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ adapter->curr_iface_comb.p2p_intf += change;
|
|
|
|
++ break;
|
|
|
|
++ default:
|
|
|
|
++ mwifiex_dbg(adapter, ERROR,
|
|
|
|
++ "%s: Unsupported iftype passed: %d\n",
|
|
|
|
++ __func__, iftype);
|
|
|
|
++ break;
|
|
|
|
++ }
|
|
|
|
++}
|
|
+
|
|
+
|
|
- return mwifiex_drv_set_power(priv, &ps_mode);
|
|
|
|
|
|
+ static int
|
|
|
|
+ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+ enum nl80211_iftype curr_iftype,
|
|
|
|
+@@ -1056,19 +1082,8 @@ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- switch (curr_iftype) {
|
|
|
|
+- case NL80211_IFTYPE_STATION:
|
|
|
|
+- case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- adapter->curr_iface_comb.sta_intf--;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_AP:
|
|
|
|
+- adapter->curr_iface_comb.uap_intf--;
|
|
|
|
+- break;
|
|
|
|
+- default:
|
|
|
|
+- break;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+- adapter->curr_iface_comb.p2p_intf++;
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
+ dev->ieee80211_ptr->iftype = type;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+@@ -1107,20 +1122,10 @@ mwifiex_change_vif_to_sta_adhoc(struct net_device *dev,
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- switch (curr_iftype) {
|
|
|
|
+- case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+- adapter->curr_iface_comb.p2p_intf--;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_AP:
|
|
|
|
+- adapter->curr_iface_comb.uap_intf--;
|
|
|
|
+- break;
|
|
|
|
+- default:
|
|
|
|
+- break;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+- adapter->curr_iface_comb.sta_intf++;
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
+ dev->ieee80211_ptr->iftype = type;
|
|
|
|
++
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+@@ -1153,20 +1158,8 @@ mwifiex_change_vif_to_ap(struct net_device *dev,
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- switch (curr_iftype) {
|
|
|
|
+- case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+- adapter->curr_iface_comb.p2p_intf--;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_STATION:
|
|
|
|
+- case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- adapter->curr_iface_comb.sta_intf--;
|
|
|
|
+- break;
|
|
|
|
+- default:
|
|
|
|
+- break;
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+- adapter->curr_iface_comb.uap_intf++;
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
+ dev->ieee80211_ptr->iftype = type;
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
+@@ -3114,23 +3107,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ mwifiex_dev_debugfs_init(priv);
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+- switch (type) {
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- case NL80211_IFTYPE_STATION:
|
|
|
|
+- case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- adapter->curr_iface_comb.sta_intf++;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_AP:
|
|
|
|
+- adapter->curr_iface_comb.uap_intf++;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- adapter->curr_iface_comb.p2p_intf++;
|
|
|
|
+- break;
|
|
|
|
+- default:
|
|
|
|
+- /* This should be dead code; checked above */
|
|
|
|
+- mwifiex_dbg(adapter, ERROR, "type not supported\n");
|
|
|
|
+- return ERR_PTR(-EINVAL);
|
|
|
|
+- }
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
+
|
|
|
|
+ return &priv->wdev;
|
|
|
|
+
|
|
|
|
+@@ -3196,24 +3173,7 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
|
|
|
|
+ /* Clear the priv in adapter */
|
|
|
|
+ priv->netdev = NULL;
|
|
|
|
+
|
|
|
|
+- switch (priv->bss_mode) {
|
|
|
|
+- case NL80211_IFTYPE_UNSPECIFIED:
|
|
|
|
+- case NL80211_IFTYPE_STATION:
|
|
|
|
+- case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- adapter->curr_iface_comb.sta_intf--;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_AP:
|
|
|
|
+- adapter->curr_iface_comb.uap_intf--;
|
|
|
|
+- break;
|
|
|
|
+- case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+- adapter->curr_iface_comb.p2p_intf--;
|
|
|
|
+- break;
|
|
|
|
+- default:
|
|
|
|
+- mwifiex_dbg(adapter, ERROR,
|
|
|
|
+- "del_virtual_intf: type not supported\n");
|
|
|
|
+- break;
|
|
|
|
+- }
|
|
|
|
++ update_vif_type_counter(adapter, priv->bss_mode, -1);
|
|
|
|
+
|
|
|
|
+ priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
|
|
|
|
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From 8c4ed414d5dfc88289cb79a772d952276fe9abd5 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Fri, 26 Mar 2021 15:56:58 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Update virtual interface counters right after
|
|
|
|
+ setting bss_type
|
|
|
|
+
|
|
|
|
+In mwifiex_init_new_priv_params() we update our private driver state to
|
|
|
|
+reflect the currently selected virtual interface type. Most notably we
|
|
|
|
+set the bss_mode to the mode we're going to put the firmware in.
|
|
|
|
+
|
|
|
|
+Now after we updated the driver state we actually start talking to the
|
|
|
|
+firmware and instruct it to set up the new mode. Those commands can and
|
|
|
|
+will sometimes fail, in which case we return with an error from
|
|
|
|
+mwifiex_change_vif_to_*. We currently update our virtual interface type
|
|
|
|
+counters after this return, which means the code is never reached when a
|
|
|
|
+firmware error happens and we never update the counters. Since we have
|
|
|
|
+updated our bss_mode earlier though, the counters now no longer reflect
|
|
|
|
+the actual state of the driver.
|
|
|
|
+
|
|
|
|
+This will break things on the next virtual interface change, because the
|
|
|
|
+virtual interface type we're switching away from didn't get its counter
|
|
|
|
+incremented, and we end up decrementing a 0-counter.
|
|
|
|
+
|
|
|
|
+To fix this, simply update the virtual interface type counters right
|
|
|
|
+after updating our driver structures, so that they are always in sync.
|
|
|
|
|
|
-From 5fa74c3c58172e900c5963470349522907e17aa6 Mon Sep 17 00:00:00 2001
|
|
|
|
-From: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
-Date: Sun, 4 Oct 2020 00:59:37 +0900
|
|
|
|
-Subject: [PATCH] mwifiex: disable ps_mode explicitly by default instead
|
|
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 25 +++++++++++--------
|
|
|
|
+ 1 file changed, 14 insertions(+), 11 deletions(-)
|
|
|
|
|
|
-At least on Surface devices, the ps_mode causes connection unstable,
|
|
|
|
-especially with 5GHz APs. Then, it eventually causes fw crashing.
|
|
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index db30f595e9f9..60de1cec77c7 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -1059,6 +1059,10 @@ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+ if (mwifiex_init_new_priv_params(priv, dev, type))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
++ dev->ieee80211_ptr->iftype = type;
|
|
|
|
++
|
|
|
|
+ switch (type) {
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+ if (mwifiex_cfg80211_init_p2p_client(priv))
|
|
|
|
+@@ -1082,10 +1086,6 @@ mwifiex_change_vif_to_p2p(struct net_device *dev,
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
+- update_vif_type_counter(adapter, type, +1);
|
|
|
|
+- dev->ieee80211_ptr->iftype = type;
|
|
|
|
+-
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+@@ -1116,16 +1116,17 @@ mwifiex_change_vif_to_sta_adhoc(struct net_device *dev,
|
|
|
|
+ return -1;
|
|
|
|
+ if (mwifiex_init_new_priv_params(priv, dev, type))
|
|
|
|
+ return -1;
|
|
|
|
++
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
++ dev->ieee80211_ptr->iftype = type;
|
|
|
|
++
|
|
|
|
+ if (mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
|
|
|
|
+ HostCmd_ACT_GEN_SET, 0, NULL, true))
|
|
|
|
+ return -1;
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
+- update_vif_type_counter(adapter, type, +1);
|
|
|
|
+- dev->ieee80211_ptr->iftype = type;
|
|
|
|
+-
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+@@ -1152,15 +1153,17 @@ mwifiex_change_vif_to_ap(struct net_device *dev,
|
|
|
|
+ return -1;
|
|
|
|
+ if (mwifiex_init_new_priv_params(priv, dev, type))
|
|
|
|
+ return -1;
|
|
|
|
++
|
|
|
|
++ update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
++ update_vif_type_counter(adapter, type, +1);
|
|
|
|
++ dev->ieee80211_ptr->iftype = type;
|
|
|
|
++
|
|
|
|
+ if (mwifiex_send_cmd(priv, HostCmd_CMD_SET_BSS_MODE,
|
|
|
|
+ HostCmd_ACT_GEN_SET, 0, NULL, true))
|
|
|
|
+ return -1;
|
|
|
|
+ if (mwifiex_sta_init_cmd(priv, false, false))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+- update_vif_type_counter(adapter, curr_iftype, -1);
|
|
|
|
+- update_vif_type_counter(adapter, type, +1);
|
|
|
|
+- dev->ieee80211_ptr->iftype = type;
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
|
|
-This commit disables ps_mode by default instead of enabling it.
|
|
|
|
|
|
+From 30db63046507c9c2f8b4c761366b5341a86809ff Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Wed, 11 Nov 2020 13:42:40 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Allow switching interface type from P2P_CLIENT to
|
|
|
|
+ P2P_GO
|
|
|
|
|
|
-Required code is extracted from mwifiex_drv_set_power().
|
|
|
|
|
|
+It's possible to change virtual interface type between P2P_CLIENT and
|
|
|
|
+P2P_GO, the card supports that just fine, and it happens for example
|
|
|
|
+when using miracast with the miraclecast software.
|
|
|
|
+
|
|
|
|
+So allow type changes between P2P_CLIENT and P2P_GO and simply call into
|
|
|
|
+mwifiex_change_vif_to_p2p(), which handles this just fine. We have to
|
|
|
|
+call mwifiex_cfg80211_deinit_p2p() before though to make sure the old
|
|
|
|
+p2p mode is properly uninitialized.
|
|
|
|
|
|
-Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
|
|
|
|
Patchset: wifi
|
|
Patchset: wifi
|
|
---
|
|
---
|
|
- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 11 ++++++++---
|
|
|
|
- 1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
-
|
|
|
|
-diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
|
|
|
-index d3a968ef21ef..9b7b52fbc9c4 100644
|
|
|
|
---- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
|
|
|
-+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
|
|
|
-@@ -2333,14 +2333,19 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
|
|
|
|
-- /* Enable IEEE PS by default */
|
|
|
|
-- priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
|
|
|
|
-+ /* Disable IEEE PS by default */
|
|
|
|
-+ priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
|
|
|
|
- ret = mwifiex_send_cmd(priv,
|
|
|
|
- HostCmd_CMD_802_11_PS_MODE_ENH,
|
|
|
|
-- EN_AUTO_PS, BITMAP_STA_PS, NULL,
|
|
|
|
-+ DIS_AUTO_PS, BITMAP_STA_PS, NULL,
|
|
|
|
- true);
|
|
|
|
- if (ret)
|
|
|
|
- return -1;
|
|
|
|
-+ ret = mwifiex_send_cmd(priv,
|
|
|
|
-+ HostCmd_CMD_802_11_PS_MODE_ENH,
|
|
|
|
-+ GET_PS, 0, NULL, false);
|
|
|
|
-+ if (ret)
|
|
|
|
-+ return -1;
|
|
|
|
|
|
+ .../net/wireless/marvell/mwifiex/cfg80211.c | 36 +++++++++++++++++++
|
|
|
|
+ 1 file changed, 36 insertions(+)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index 60de1cec77c7..a37b504bd084 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -990,11 +990,26 @@ is_vif_type_change_allowed(struct mwifiex_adapter *adapter,
|
|
}
|
|
}
|
|
|
|
|
|
- if (drcs) {
|
|
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ switch (new_iftype) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ return true;
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ return true;
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ return adapter->curr_iface_comb.uap_intf !=
|
|
|
|
++ adapter->iface_limit.uap_intf;
|
|
|
|
++ default:
|
|
|
|
++ return false;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+ switch (new_iftype) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+ case NL80211_IFTYPE_STATION:
|
|
|
|
+ return true;
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ return true;
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ return adapter->curr_iface_comb.uap_intf !=
|
|
|
|
+ adapter->iface_limit.uap_intf;
|
|
|
|
+@@ -1265,6 +1280,24 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
++ return -EFAULT;
|
|
|
|
++
|
|
|
|
++ switch (type) {
|
|
|
|
++ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
++ return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
|
|
|
|
++ type, params);
|
|
|
|
++ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
++ return mwifiex_change_vif_to_p2p(dev, curr_iftype,
|
|
|
|
++ type, params);
|
|
|
|
++ case NL80211_IFTYPE_AP:
|
|
|
|
++ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
++ params);
|
|
|
|
++ default:
|
|
|
|
++ goto errnotsupp;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+ if (mwifiex_cfg80211_deinit_p2p(priv))
|
|
|
|
+ return -EFAULT;
|
|
|
|
+@@ -1274,6 +1307,9 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ case NL80211_IFTYPE_STATION:
|
|
|
|
+ return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
|
|
|
|
+ type, params);
|
|
|
|
++ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
++ return mwifiex_change_vif_to_p2p(dev, curr_iftype,
|
|
|
|
++ type, params);
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ return mwifiex_change_vif_to_ap(dev, curr_iftype, type,
|
|
|
|
+ params);
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From dd92b70177a8b7b457d9eddcc373aeaa8073ecc0 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Fri, 26 Mar 2021 15:31:08 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Handle interface type changes from AP to STATION
|
|
|
|
+
|
|
|
|
+Looks like this case was simply overseen, so handle it, too.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/cfg80211.c | 1 +
|
|
|
|
+ 1 file changed, 1 insertion(+)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index a37b504bd084..e65f285e3efe 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -1268,6 +1268,7 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ switch (type) {
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
++ case NL80211_IFTYPE_STATION:
|
|
|
|
+ return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
|
|
|
|
+ type, params);
|
|
|
|
+ break;
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From abedd26878159cf75b6f303164eb678803e8d591 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Fri, 26 Mar 2021 15:32:16 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Properly initialize private structure on interface
|
|
|
|
+ type changes
|
|
|
|
+
|
|
|
|
+When creating a new virtual interface in mwifiex_add_virtual_intf(), we
|
|
|
|
+update our internal driver states like bss_type, bss_priority, bss_role
|
|
|
|
+and bss_mode to reflect the mode the firmware will be set to.
|
|
|
|
+
|
|
|
|
+When switching virtual interface mode using
|
|
|
|
+mwifiex_init_new_priv_params() though, we currently only update bss_mode
|
|
|
|
+and bss_role. In order for the interface mode switch to actually work,
|
|
|
|
+we also need to update bss_type to its proper value, so do that.
|
|
|
|
+
|
|
|
|
+This fixes a crash of the firmware (because the driver tries to execute
|
|
|
|
+commands that are invalid in AP mode) when switching from station mode
|
|
|
|
+to AP mode.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++---
|
|
|
|
+ 1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index e65f285e3efe..a290312313f3 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -908,16 +908,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
|
|
|
|
+ switch (type) {
|
|
|
|
+ case NL80211_IFTYPE_STATION:
|
|
|
|
+ case NL80211_IFTYPE_ADHOC:
|
|
|
|
+- priv->bss_role = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
++ priv->bss_role = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
++ priv->bss_type = MWIFIEX_BSS_TYPE_STA;
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_IFTYPE_P2P_CLIENT:
|
|
|
|
+- priv->bss_role = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
++ priv->bss_role = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
++ priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_IFTYPE_P2P_GO:
|
|
|
|
+- priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
|
|
|
|
++ priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
|
|
|
|
++ priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
|
|
|
|
+ break;
|
|
|
|
+ case NL80211_IFTYPE_AP:
|
|
|
|
+ priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
|
|
|
|
++ priv->bss_type = MWIFIEX_BSS_TYPE_UAP;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ mwifiex_dbg(adapter, ERROR,
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From 3ecb0807a4af4e8bf90aa27e984dbecd3dd6f357 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Sat, 27 Mar 2021 12:19:14 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Fix copy-paste mistake when creating virtual
|
|
|
|
+ interface
|
|
|
|
+
|
|
|
|
+The BSS priority here for a new P2P_CLIENT device was accidentally set
|
|
|
|
+to an enum that's certainly not meant for this. Since
|
|
|
|
+MWIFIEX_BSS_ROLE_STA is 0 anyway, we can just set the bss_priority to 0
|
|
|
|
+instead here.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
|
|
|
|
+ 1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+index a290312313f3..1e1cf523e228 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
|
|
|
|
+@@ -3040,7 +3040,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
|
|
|
|
+ priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
|
|
|
|
+
|
|
|
|
+ priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II;
|
|
|
|
+- priv->bss_priority = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
++ priv->bss_priority = 0;
|
|
|
|
+ priv->bss_role = MWIFIEX_BSS_ROLE_STA;
|
|
|
|
+ priv->bss_started = 0;
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From c8308fa6952959f216d22802e42d162a2db66858 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Tue, 10 Nov 2020 12:49:56 +0100
|
|
|
|
+Subject: [PATCH] mwifiex: Use non-posted PCI register writes
|
|
|
|
+
|
|
|
|
+On the 88W8897 card it's very important the TX ring write pointer is
|
|
|
|
+updated correctly to its new value before setting the TX ready
|
|
|
|
+interrupt, otherwise the firmware appears to crash (probably because
|
|
|
|
+it's trying to DMA-read from the wrong place).
|
|
|
|
+
|
|
|
|
+Since PCI uses "posted writes" when writing to a register, it's not
|
|
|
|
+guaranteed that a write will happen immediately. That means the pointer
|
|
|
|
+might be outdated when setting the TX ready interrupt, leading to
|
|
|
|
+firmware crashes especially when ASPM L1 and L1 substates are enabled
|
|
|
|
+(because of the higher link latency, the write will probably take
|
|
|
|
+longer).
|
|
|
|
+
|
|
|
|
+So fix those firmware crashes by always forcing non-posted writes. We do
|
|
|
|
+that by simply reading back the register after writing it, just as a lot
|
|
|
|
+of other drivers do.
|
|
|
|
+
|
|
|
|
+There are two reproducers that are fixed with this patch:
|
|
|
|
+
|
|
|
|
+1) During rx/tx traffic and with ASPM L1 substates enabled (the enabled
|
|
|
|
+substates are platform dependent), the firmware crashes and eventually a
|
|
|
|
+command timeout appears in the logs. That crash is fixed by using a
|
|
|
|
+non-posted write in mwifiex_pcie_send_data().
|
|
|
|
+
|
|
|
|
+2) When sending lots of commands to the card, waking it up from sleep in
|
|
|
|
+very quick intervals, the firmware eventually crashes. That crash
|
|
|
|
+appears to be fixed by some other non-posted write included here.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/pcie.c | 6 ++++++
|
|
|
|
+ 1 file changed, 6 insertions(+)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+index 9ac12ff4a5c1..4123c8bb6b6f 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+@@ -237,6 +237,12 @@ static int mwifiex_write_reg(struct mwifiex_adapter *adapter, int reg, u32 data)
|
|
|
|
+
|
|
|
|
+ iowrite32(data, card->pci_mmap1 + reg);
|
|
|
|
+
|
|
|
|
++ /* Do a read-back, which makes the write non-posted, ensuring the
|
|
|
|
++ * completion before returning.
|
|
|
|
++ * The firmware of the 88W8897 card is buggy and this avoids crashes.
|
|
|
|
++ */
|
|
|
|
++ ioread32(card->pci_mmap1 + reg);
|
|
|
|
++
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+--
|
|
|
|
+2.31.0
|
|
|
|
+
|
|
|
|
+From 27ff118a76d7319446a6a88c6333b64b4521d563 Mon Sep 17 00:00:00 2001
|
|
|
|
+From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
|
|
|
|
+Date: Sun, 28 Mar 2021 21:10:06 +0200
|
|
|
|
+Subject: [PATCH] mwifiex: Try waking the firmware until we get an interrupt
|
|
|
|
+
|
|
|
|
+It seems that the firmware of the 88W8897 card sometimes ignores or
|
|
|
|
+misses when we try to wake it up by reading the firmware status
|
|
|
|
+register. This leads to the firmware wakeup timeout expiring and the
|
|
|
|
+driver resetting the card because we assume the firmware has hung up or
|
|
|
|
+crashed (unfortunately that's not unlikely with this card).
|
|
|
|
+
|
|
|
|
+Turns out that most of the time the firmware actually didn't hang up,
|
|
|
|
+but simply "missed" our wakeup request and doesn't send us an AWAKE
|
|
|
|
+event.
|
|
|
|
+
|
|
|
|
+Trying again to read the firmware status register after a short timeout
|
|
|
|
+usually makes the firmware wake we up as expected, so add a small retry
|
|
|
|
+loop to mwifiex_pm_wakeup_card() that looks at the interrupt status to
|
|
|
|
+check whether the card woke up.
|
|
|
|
+
|
|
|
|
+The number of tries and timeout lengths for this were determined
|
|
|
|
+experimentally: The firmware usually takes about 500 us to wake up
|
|
|
|
+after we attempt to read the status register. In some cases where the
|
|
|
|
+firmware is very busy (for example while doing a bluetooth scan) it
|
|
|
|
+might even miss our requests for multiple milliseconds, which is why
|
|
|
|
+after 15 tries the waiting time gets increased to 10 ms. The maximum
|
|
|
|
+number of tries it took to wake the firmware when testing this was
|
|
|
|
+around 20, so a maximum number of 50 tries should give us plenty of
|
|
|
|
+safety margin.
|
|
|
|
+
|
|
|
|
+A good reproducer for this issue is letting the firmware sleep and wake
|
|
|
|
+up in very short intervals, for example by pinging an device on the
|
|
|
|
+network every 0.1 seconds.
|
|
|
|
+
|
|
|
|
+Patchset: wifi
|
|
|
|
+---
|
|
|
|
+ drivers/net/wireless/marvell/mwifiex/pcie.c | 29 ++++++++++++++++-----
|
|
|
|
+ 1 file changed, 23 insertions(+), 6 deletions(-)
|
|
|
|
+
|
|
|
|
+diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+index 4123c8bb6b6f..b5491509d6a2 100644
|
|
|
|
+--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
|
|
|
+@@ -665,6 +665,7 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
|
|
|
|
+ {
|
|
|
|
+ struct pcie_service_card *card = adapter->card;
|
|
|
|
+ const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
|
|
|
|
++ int n_tries = 0;
|
|
|
|
+
|
|
|
|
+ mwifiex_dbg(adapter, EVENT,
|
|
|
|
+ "event: Wakeup device...\n");
|
|
|
|
+@@ -672,12 +673,28 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
|
|
|
|
+ if (reg->sleep_cookie)
|
|
|
|
+ mwifiex_pcie_dev_wakeup_delay(adapter);
|
|
|
|
+
|
|
|
|
+- /* Accessing fw_status register will wakeup device */
|
|
|
|
+- if (mwifiex_write_reg(adapter, reg->fw_status, FIRMWARE_READY_PCIE)) {
|
|
|
|
+- mwifiex_dbg(adapter, ERROR,
|
|
|
|
+- "Writing fw_status register failed\n");
|
|
|
|
+- return -1;
|
|
|
|
+- }
|
|
|
|
++ /* Access the fw_status register to wake up the device.
|
|
|
|
++ * Since the 88W8897 firmware sometimes appears to ignore or miss
|
|
|
|
++ * that wakeup request, we continue trying until we receive an
|
|
|
|
++ * interrupt from the card.
|
|
|
|
++ */
|
|
|
|
++ do {
|
|
|
|
++ if (mwifiex_write_reg(adapter, reg->fw_status, FIRMWARE_READY_PCIE)) {
|
|
|
|
++ mwifiex_dbg(adapter, ERROR,
|
|
|
|
++ "Writing fw_status register failed\n");
|
|
|
|
++ return -1;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ n_tries++;
|
|
|
|
++
|
|
|
|
++ if (n_tries <= 15)
|
|
|
|
++ usleep_range(400, 700);
|
|
|
|
++ else
|
|
|
|
++ msleep(10);
|
|
|
|
++ } while (n_tries <= 50 && READ_ONCE(adapter->int_status) == 0);
|
|
|
|
++
|
|
|
|
++ mwifiex_dbg(adapter, EVENT,
|
|
|
|
++ "event: Tried %d times until firmware woke up\n", n_tries);
|
|
|
|
+
|
|
|
|
+ if (reg->sleep_cookie) {
|
|
|
|
+ mwifiex_pcie_dev_wakeup_delay(adapter);
|
|
--
|
|
--
|
|
-2.30.2
|
|
|
|
|
|
+2.31.0
|
|
|
|
|