mwifiex: clear is_suspended flag when interrupt is received early
PATCH 1/1 mwifiex: clear is_suspended flag when interrupt is received early
When the XO-4 with 8787 wireless is woken up due to wake-on-WLAN mwifiex is often flooded with "not allowed while suspended" messages and the interface is unusable.
[ 202.171609] int: sdio_ireg = 0x1
[ 202.180700] info: mwifiex_process_hs_config: auto cancelling host
sleep since there is interrupt from the firmware
[ 202.201880] event: wakeup device...
[ 202.211452] event: hs_deactivated
[ 202.514638] info: --- Rx: Data packet ---
[ 202.514753] data: 4294957544 BSS(0-0): Data <= kernel
[ 202.514825] PREP_CMD: device in suspended state
[ 202.514839] data: dequeuing the packet ec7248c0 ec4869c0
[ 202.514886] mwifiex_write_data_sync: not allowed while suspended
[ 202.514886] host_to_card, write iomem (1) failed: -1
[ 202.514917] mwifiex_write_data_sync: not allowed while suspended
[ 202.514936] host_to_card, write iomem (2) failed: -1
[ 202.514949] mwifiex_write_data_sync: not allowed while suspended
[ 202.514965] host_to_card, write iomem (3) failed: -1
[ 202.514976] mwifiex_write_data_async failed: 0xFFFFFFFFThis can be readily reproduced when putting the XO-4 in a loop where it goes to sleep due to inactivity, but then wakes up due to an incoming ping. The error is hit within an hour or two.
This issue happens when an interrupt comes in early while host sleep is still activated. Driver handles this case by auto cancelling host sleep. However is_suspended flag is still set which prevents any cmd or data from being sent to firmware. Fix it by clearing is_suspended flag in this path.
--- drivers/net/wireless/mwifiex/cmdevt.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/mwifiex/cmdevt.c +1 -0
@@ -1191,6 +1191,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) adapter->if_ops.wakeup (adapter); adapter->hs_activated = false; adapter->is_hs_configured = false; + adapter->is_suspended = false;mwifiex_hs_activated_event (mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY ), false);
Signature · 1 line
1.7.0.2
PATCH 1/1 mwifiex: fix memory leak issue when driver unload
From: Amitkumar Karwar <[email protected]>
After unregister_netdevice() call the request is queued and reg_state is changed to NETREG_UNREGISTERING.
As we check for NETREG_UNREGISTERED state, free_netdev() never gets executed causing memory leak.
Initialize "dev->destructor" to free_netdev() to free device data after unregistration.
--- drivers/net/wireless/mwifiex/cfg80211.c | 3 --- drivers/net/wireless/mwifiex/main.c | 1 + 2 files changed, 1 insertions(+), 3 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +0 -3
@@ -2234,9 +2234,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)if (wdev->netdev->reg_state ==NETREG_REGISTERED )unregister_netdevice (wdev->netdev); -if (wdev->netdev->reg_state ==NETREG_UNREGISTERED ) -free_netdev (wdev->netdev); -/* Clear the priv in adapter */ priv->netdev =NULL ;
drivers/net/wireless/mwifiex/main.c +1 -0
@@ -655,6 +655,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, struct net_device *dev) { dev->netdev_ops = &mwifiex_netdev_ops; + dev->destructor = free_netdev;/* Initialize private structure */ priv->current_key_index =0 ; priv->media_connected = false;
Signature · 1 line
1.7.0.2