Skip to contentSkip to conversation

mwifiex: fix corner case power save issue

PATCH In review Amitkumar Karwar 3 participants 6 messages Oct 21, 2016 – Nov 18, 2016 Marvell mwifiex wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mwifiex: fix corner case power save issue

We may get SLEEP event from firmware even if TXDone for last Tx packet is still pending. In this case, we may end up accessing PCIe memory for handling TXDone after power save handshake is completed. This causes kernel crash with external abort.

We will delay sending SLEEP confirm to firmware in this case to resolve the problem.

---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/cmdevt.c +1 -1
index 5347728..f582f61 100644
@@ -1118,7 +1118,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
 void
 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
 {
-	if (!adapter->cmd_sent &&
+	if (!adapter->cmd_sent && !adapter->data_sent &&
 	    !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter))
 		mwifiex_dnld_sleep_confirm_cmd(adapter);
 	else
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 mwifiex: ignore calibration data failure

Firmware may reject calibration data from host for certain OTP settings. In that case, we should continue initialisation ignoring the failure.

---
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_cmd.c +5 -11
index 2a162c3..638d30a 100644
@@ -2228,19 +2228,13 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
 				adapter->hs_cfg.gpio = data;
 			}
 
-			ret = mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
-						      "marvell,caldata");
-			if (ret)
-				return -1;
+			mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
+						"marvell,caldata");
 		}
 
-		if (adapter->cal_data) {
-			ret = mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA,
-					       HostCmd_ACT_GEN_SET, 0, NULL,
-					       true);
-			if (ret)
-				return -1;
-		}
+		if (adapter->cal_data)
+			mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA,
+					 HostCmd_ACT_GEN_SET, 0, NULL, true);
 
 		/* Read MAC address from HW */
 		ret = mwifiex_send_cmd(priv, HostCmd_CMD_GET_HW_SPEC,
Signature · 1 line
1.9.1
#2 lore raw

Re: [2/2] mwifiex: ignore calibration data failure

Quoted 5 lines · Amitkumar Karwar

Firmware may reject calibration data from host for certain OTP settings. In that case, we should continue initialisation ignoring the failure.

Patch applied to wireless-drivers-next.git, thanks.

14e5e9375926 mwifiex: ignore calibration data failure

Signature · 6 lines
https://patchwork.kernel.org/patch/9389487/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer Tested-by Reviewed-by on v1 1/2
#3 lore raw
In reply to Amitkumar Karwar

Hi,

Quoted 18 lines · Amitkumar Karwar

We may get SLEEP event from firmware even if TXDone for last Tx packet is still pending. In this case, we may end up accessing PCIe memory for handling TXDone after power save handshake is completed. This causes kernel crash with external abort.

We will delay sending SLEEP confirm to firmware in this case to resolve the problem.

---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/cmdevt.c +0 -0
index 5347728..f582f61 100644

drivers/net/wireless/marvell/mwifiex/cmdevt.c mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) · line 1124

Quoted 8 lines
drivers/net/wireless/marvell/mwifiex/cmdevt.c +1 -1
@@ -1118,7 +1118,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
 void
 mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
 {
-	if (!adapter->cmd_sent &&
+	if (!adapter->cmd_sent && !adapter->data_sent &&
 	    !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter))
 		mwifiex_dnld_sleep_confirm_cmd(adapter);
 	else

Looks good to me, and tests out on my systems:

#4 lore raw
In reply to Amitkumar Karwar

Hi Kalle,

Quoted 11 lines

From: Amitkumar Karwar [mailto:[email protected]]
Sent: Friday, October 21, 2016 8:46 PM
To: [email protected]
Cc: Cathy Luo; Nishant Sarmukadam; Amitkumar Karwar
Subject: [PATCH 1/2] mwifiex: fix corner case power save issue

We may get SLEEP event from firmware even if TXDone for last Tx packet is still pending. In this case, we may end up accessing PCIe memory for handling TXDone after power save handshake is completed. This causes kernel crash with external abort.

Quoted 8 lines

We will delay sending SLEEP confirm to firmware in this case to resolve the problem.

---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Please drop this patch.
Xinming Hu has better and complete solution for this issue as discussed at https://patchwork.kernel.org/patch/9405119/

Regards,
Amitkumar

#5 lore raw
In reply to Amitkumar Karwar
Quoted 11 lines · Amitkumar Karwar

We may get SLEEP event from firmware even if TXDone for last Tx packet is still pending. In this case, we may end up accessing PCIe memory for handling TXDone after power save handshake is completed. This causes kernel crash with external abort.

We will delay sending SLEEP confirm to firmware in this case to resolve the problem.

Dropped per request from Amitkumar.

Patch set to Changes Requested.

Signature · 6 lines
https://patchwork.kernel.org/patch/9389485/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches