From 4e05e65580d6a7c8790684dfa6c5bffcb759e065 Mon Sep 17 00:00:00 2001 From: Maya Erez Date: Mon, 29 May 2017 10:26:13 +0300 Subject: [PATCH] wil6210: stop TX queues when suspending Stop TX queues before suspending in order to prevent TX packets drops. Change-Id: Ieda3eef72e20005041c132765c28c8071621844f Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/pm.c | 13 +++++++++++-- drivers/net/wireless/ath/wil6210/txrx.c | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/pm.c b/drivers/net/wireless/ath/wil6210/pm.c index b4faf8212348..ce1f384e7f8e 100644 --- a/drivers/net/wireless/ath/wil6210/pm.c +++ b/drivers/net/wireless/ath/wil6210/pm.c @@ -98,6 +98,10 @@ static int wil_resume_keep_radio_on(struct wil6210_priv *wil) } } + /* Wake all queues */ + if (test_bit(wil_status_fwconnected, wil->status)) + wil_update_net_queues_bh(wil, NULL, false); + out: if (rc) set_bit(wil_status_suspended, wil->status); @@ -113,6 +117,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil) /* Prevent handling of new tx and wmi commands */ set_bit(wil_status_suspending, wil->status); + wil_update_net_queues_bh(wil, NULL, true); if (!wil_is_tx_idle(wil)) { wil_dbg_pm(wil, "Pending TX data, reject suspend\n"); @@ -201,13 +206,17 @@ resume_after_fail: clear_bit(wil_status_suspending, wil->status); rc = wmi_resume(wil); /* if resume succeeded, reject the suspend */ - if (!rc) + if (!rc) { rc = -EBUSY; - + if (test_bit(wil_status_fwconnected, wil->status)) + wil_update_net_queues_bh(wil, NULL, false); + } return rc; reject_suspend: clear_bit(wil_status_suspending, wil->status); + if (test_bit(wil_status_fwconnected, wil->status)) + wil_update_net_queues_bh(wil, NULL, false); return -EBUSY; } diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 439fe30936b6..8f1e79b425cf 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -1930,6 +1930,11 @@ static inline void __wil_update_net_queues(struct wil6210_priv *wil, return; } + /* Do not wake the queues in suspend flow */ + if (test_bit(wil_status_suspending, wil->status) || + test_bit(wil_status_suspended, wil->status)) + return; + /* check wake */ for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) { struct vring *cur_vring = &wil->vring_tx[i];