From patchwork Mon Feb 10 11:47:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eliad Peller X-Patchwork-Id: 3618231 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8B77B9F2D6 for ; Mon, 10 Feb 2014 11:47:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA2802017D for ; Mon, 10 Feb 2014 11:47:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5A852018E for ; Mon, 10 Feb 2014 11:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752523AbaBJLrr (ORCPT ); Mon, 10 Feb 2014 06:47:47 -0500 Received: from mail-we0-f169.google.com ([74.125.82.169]:63878 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752354AbaBJLrp (ORCPT ); Mon, 10 Feb 2014 06:47:45 -0500 Received: by mail-we0-f169.google.com with SMTP id t61so4185799wes.14 for ; Mon, 10 Feb 2014 03:47:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZqpDf3kK5st/hDOxC9R0tNNaqEOEE+q35IigvrfNbLk=; b=Wy7mDH/V0sjtSfPnvjY8krjJJorsyKhzVxhTrDd58Ge5tHFz4CgpxMvRAxI/R55vWv Pf1Yh3ads+RIset8TDB9Uxg/vKdEepwlU4/BjzKL+13TV7ptcdfTfz9sKRhpOJzGW2jK oA+U5VIbUiBL4CYY5HlZA9MlS3MIpd9KG2SSqbF/AbVHXkG3winVgp1xRNXJrdr+V8oI VWsaZB/GMvn/dNV0ut5i1QdKR38oVVP94ajsq3Cga9/N5EYQ/QzoTAQlRAOjNTKyue9P 4637FDmjUeQ5mBlDGm7PiX7K3XuzxJhzy+Zaej4FjQLp/ysdRWKA4qKaAI2SKwUTF/Gn 1PWQ== X-Gm-Message-State: ALoCoQlq329GlfMdp53iJqyE2g3YAnoF6nhY8ysa96rUDrQQqdR4i4+xB5TEy+wO5lejkYPPLVga X-Received: by 10.180.211.239 with SMTP id nf15mr10148826wic.9.1392032864428; Mon, 10 Feb 2014 03:47:44 -0800 (PST) Received: from muse.amr.corp.intel.com (93-173-177-113.bb.netvision.net.il. [93.173.177.113]) by mx.google.com with ESMTPSA id ju6sm34687484wjc.1.2014.02.10.03.47.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 03:47:43 -0800 (PST) From: Eliad Peller To: "John W. Linville" Cc: Subject: [PATCH 02/18] wlcore: cancel Tx watchdog on suspend and rearm on first Tx after Date: Mon, 10 Feb 2014 13:47:18 +0200 Message-Id: <1392032854-28126-3-git-send-email-eliad@wizery.com> X-Mailer: git-send-email 1.8.5.2.229.g4448466.dirty In-Reply-To: <1392032854-28126-1-git-send-email-eliad@wizery.com> References: <1392032854-28126-1-git-send-email-eliad@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arik Nemtsov Sometimes a tx_flush during suspend fails, but the FW manages to flush out the packets during the time when the host is supsended. Cancel the Tx-watchdog on suspend to not cause a spurious recovery on resume for that case. Set a flag to reinit the watchdog on the first Tx after resume, so we'll still recover if the FW is not empty and there's indeed a problem. Signed-off-by: Arik Nemtsov Signed-off-by: Eliad Peller --- drivers/net/wireless/ti/wlcore/main.c | 13 +++++++++++++ drivers/net/wireless/ti/wlcore/tx.c | 9 +++++++-- drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index da268e8..1e19196 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -1767,6 +1767,12 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, flush_work(&wl->tx_work); flush_delayed_work(&wl->elp_work); + /* + * Cancel the watchdog even if above tx_flush failed. We will detect + * it on resume anyway. + */ + cancel_delayed_work(&wl->tx_watchdog_work); + return 0; } @@ -1824,6 +1830,13 @@ static int wl1271_op_resume(struct ieee80211_hw *hw) out: wl->wow_enabled = false; + + /* + * Set a flag to re-init the watchdog on the first Tx after resume. + * That way we avoid possible conditions where Tx-complete interrupts + * fail to arrive and we perform a spurious recovery. + */ + set_bit(WL1271_FLAG_REINIT_TX_WDOG, &wl->flags); mutex_unlock(&wl->mutex); return 0; diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c index 87cd707..ca886ef 100644 --- a/drivers/net/wireless/ti/wlcore/tx.c +++ b/drivers/net/wireless/ti/wlcore/tx.c @@ -234,8 +234,13 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif, wl->tx_blocks_available -= total_blocks; wl->tx_allocated_blocks += total_blocks; - /* If the FW was empty before, arm the Tx watchdog */ - if (wl->tx_allocated_blocks == total_blocks) + /* + * If the FW was empty before, arm the Tx watchdog. Also do + * this on the first Tx after resume, as we always cancel the + * watchdog on suspend. + */ + if (wl->tx_allocated_blocks == total_blocks || + test_and_clear_bit(WL1271_FLAG_REINIT_TX_WDOG, &wl->flags)) wl12xx_rearm_tx_watchdog_locked(wl); ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h index ce7261c..3815332 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h @@ -240,6 +240,7 @@ enum wl12xx_flags { WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, WL1271_FLAG_INTENDED_FW_RECOVERY, WL1271_FLAG_IO_FAILED, + WL1271_FLAG_REINIT_TX_WDOG, }; enum wl12xx_vif_flags {