From patchwork Thu Apr 28 10:01:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 739081 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3SA29mW019294 for ; Thu, 28 Apr 2011 10:02:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758625Ab1D1KCG (ORCPT ); Thu, 28 Apr 2011 06:02:06 -0400 Received: from mail.atheros.com ([12.19.149.2]:61082 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758147Ab1D1KCE (ORCPT ); Thu, 28 Apr 2011 06:02:04 -0400 Received: from mail.atheros.com ([10.10.20.108]) by sidewinder.atheros.com for ; Thu, 28 Apr 2011 03:01:37 -0700 Received: from mail.atheros.com (10.12.4.12) by SC1EXHC-02.global.atheros.com (10.10.20.106) with Microsoft SMTP Server (TLS) id 8.2.213.0; Thu, 28 Apr 2011 03:02:01 -0700 Received: by mail.atheros.com (sSMTP sendmail emulation); Thu, 28 Apr 2011 15:31:58 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan , , Vasanthakumar Thiagarajan Subject: [PATCH] ath9k: Fix drain txq failure in flush Date: Thu, 28 Apr 2011 15:31:57 +0530 Message-ID: <1303984917-12340-1-git-send-email-rmanoharan@atheros.com> X-Mailer: git-send-email 1.7.5 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 28 Apr 2011 10:02:09 +0000 (UTC) While draining the txq in flush, the buffers can be added into the tx queue by tx_tasklet which leads to unneccesary chip reset. This issue was originially found with AR9382 and running heavy uplink udp traffic with higher bandwidth and doing frequent bgscan. Cc: stable@kernel.org Signed-off-by: Vasanthakumar Thiagarajan Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath9k/main.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index c3dbf26..efdafd2 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -2261,6 +2261,7 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop) struct ath_softc *sc = hw->priv; int timeout = 200; /* ms */ int i, j; + bool drain_txq; mutex_lock(&sc->mutex); cancel_delayed_work_sync(&sc->tx_complete_work); @@ -2286,7 +2287,10 @@ static void ath9k_flush(struct ieee80211_hw *hw, bool drop) } ath9k_ps_wakeup(sc); - if (!ath_drain_all_txq(sc, false)) + spin_lock_bh(&sc->sc_pcu_lock); + drain_txq = ath_drain_all_txq(sc, false); + spin_unlock_bh(&sc->sc_pcu_lock); + if (!drain_txq) ath_reset(sc, false); ath9k_ps_restore(sc); ieee80211_wake_queues(hw);