Skip to content

Commit 54f0084

Browse files
Amitkumar KarwarKalle Valo
authored andcommitted
mwifiex: Empty Tx queue during suspend
In cfg80211 suspend handler, stop the netif queue and wait until all the Tx queues become empty. Start the queues in resume handler. Signed-off-by: Amitkumar Karwar <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 107b871 commit 54f0084

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "cfg80211.h"
2121
#include "main.h"
2222
#include "11n.h"
23+
#include "wmm.h"
2324

2425
static char *reg_alpha2;
2526
module_param(reg_alpha2, charp, 0);
@@ -3259,7 +3260,7 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
32593260
{
32603261
struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
32613262
struct mwifiex_ds_hs_cfg hs_cfg;
3262-
int i, ret = 0;
3263+
int i, ret = 0, retry_num = 10;
32633264
struct mwifiex_private *priv;
32643265

32653266
for (i = 0; i < adapter->priv_num; i++) {
@@ -3269,6 +3270,21 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
32693270

32703271
mwifiex_cancel_all_pending_cmd(adapter);
32713272

3273+
for (i = 0; i < adapter->priv_num; i++) {
3274+
priv = adapter->priv[i];
3275+
if (priv && priv->netdev)
3276+
mwifiex_stop_net_dev_queue(priv->netdev, adapter);
3277+
}
3278+
3279+
for (i = 0; i < retry_num; i++) {
3280+
if (!mwifiex_wmm_lists_empty(adapter) ||
3281+
!mwifiex_bypass_txlist_empty(adapter) ||
3282+
!skb_queue_empty(&adapter->tx_data_q))
3283+
usleep_range(10000, 15000);
3284+
else
3285+
break;
3286+
}
3287+
32723288
if (!wowlan) {
32733289
mwifiex_dbg(adapter, ERROR,
32743290
"None of the WOWLAN triggers enabled\n");
@@ -3321,12 +3337,18 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,
33213337
static int mwifiex_cfg80211_resume(struct wiphy *wiphy)
33223338
{
33233339
struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
3324-
struct mwifiex_private *priv =
3325-
mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
3340+
struct mwifiex_private *priv;
33263341
struct mwifiex_ds_wakeup_reason wakeup_reason;
33273342
struct cfg80211_wowlan_wakeup wakeup_report;
33283343
int i;
33293344

3345+
for (i = 0; i < adapter->priv_num; i++) {
3346+
priv = adapter->priv[i];
3347+
if (priv && priv->netdev)
3348+
mwifiex_wake_up_net_dev_queue(priv->netdev, adapter);
3349+
}
3350+
3351+
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
33303352
mwifiex_get_wakeup_reason(priv, HostCmd_ACT_GEN_GET, MWIFIEX_SYNC_CMD,
33313353
&wakeup_reason);
33323354
memset(&wakeup_report, 0, sizeof(struct cfg80211_wowlan_wakeup));

0 commit comments

Comments
 (0)