From patchwork Wed May 23 22:15:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 10422455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B3E060327 for ; Wed, 23 May 2018 22:15:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F7172928A for ; Wed, 23 May 2018 22:15:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 222F629290; Wed, 23 May 2018 22:15:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8516C2928A for ; Wed, 23 May 2018 22:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=9zgGCLxJiKPuLHCBmIGnXgF3GuFYGJiRAUCrDdM9KzQ=; b=YZY /sk5chmS+1n+MytiW5OZ7By2f+o+aiTlIB1z/JwqEU+RdB15WWKXdQry3X5t9z6lDODCtUNKLCAp4 YJ/16th0qEYEVFswgXeCDCLOEK+rcQ80hSo64E9vWQe6G0Rx/tHqfpowMNWTsSpyBPO2MbUgmW8YK Mex4xDi+hsOSmrVrodq/QrOGV/87OuJg/PUhSULohwGB5+0m19mJTaV7eX5srXDA/dah0eVp2QiUu oRuzaPMDBJ2KFohtw4SzT88cDg/D0w9i3NwMkFb0OAvMvPwg+G2RV2i6NHoyWAHttbTN8y3rfr7Do OZ/NyCPE5o77GOfur3dgIRw2OjdQaAA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLc2o-0003Mn-H0; Wed, 23 May 2018 22:15:42 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLc2l-0003LG-44 for ath10k@lists.infradead.org; Wed, 23 May 2018 22:15:40 +0000 Received: by mail-wr0-x244.google.com with SMTP id i14-v6so29211508wre.2 for ; Wed, 23 May 2018 15:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=9h0EFRWo8VAjkvQnIbf8nuzTYFUQ3nt1sGIqh05z5r4=; b=CyUg+w1b3cVCIHVVTb3q1c+angWE02VPYNG3+98oK04jLkMo0sEb/YEb2UMhD3v53z fEidMvtyz6QQK4uxkoaLa5vT3uCdBtfUH8bjq6DJe4Zpy8Ruf6J32TecfdLNUHA321QI PQYPAgVWXFvqlsQlWC9rzPqW3NGU4g2jKYats= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9h0EFRWo8VAjkvQnIbf8nuzTYFUQ3nt1sGIqh05z5r4=; b=JcsCslf2rnbMyyBcFkT7+1z3JorCHiOxUrNyksr9UhNSg7bCmes3b9g/p4CdLkepVP 0Y8TSKBhkU/NjzZ5kmiO8dkesipmcCGyBzyttAjgxt1qYcfOE+BIrleQySwmLva56DqQ BJhNHRKGxrkGwwzoJkpbQ5HvLeh2meUHtIeo6mAUebGIQ0bxIA+bj5U2lsPbW/Zp9wMP kzxvFstVcFN48wA52GRZblJWSKllf6R2t1y8hOx0v7tK9Fc8rsJcKFjUdu/yPH1Ifd4R kQgpnedths2yo5qzl+UT/coiM8VANvPA9948Qmle8AVViNoey8NfFhQmsr0WR4KH6m3X 4fZw== X-Gm-Message-State: ALKqPwd8ToDUVGd6w8RUFGAUO3YNgMp6kk8SAXPFh2Xc2tSPxwRihRaS BObG5L5xYERpXgdMu1uPohy14Q== X-Google-Smtp-Source: AB8JxZryQ/eX76JTUh0Fbg4H4Ffqy4thCG+Hv5qH7JAsdZEh7SEP/toucIr82kZS2QRDRvIOtjlfhw== X-Received: by 2002:a19:9f8e:: with SMTP id i136-v6mr2693369lfe.5.1527113726427; Wed, 23 May 2018 15:15:26 -0700 (PDT) Received: from localhost.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id a19-v6sm4705949lfi.86.2018.05.23.15.15.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 15:15:25 -0700 (PDT) From: Niklas Cassel To: Kalle Valo , "David S. Miller" Subject: [PATCH v3] ath10k: transmit queued frames after processing rx packets Date: Thu, 24 May 2018 00:15:08 +0200 Message-Id: <20180523221508.26391-1-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180523_151539_180446_9FFC10F4 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Niklas Cassel , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When running iperf on ath10k SDIO, TX can stop working: iperf -c 192.168.1.1 -i 1 -t 20 -w 10K [ 3] 0.0- 1.0 sec 2.00 MBytes 16.8 Mbits/sec [ 3] 1.0- 2.0 sec 3.12 MBytes 26.2 Mbits/sec [ 3] 2.0- 3.0 sec 3.25 MBytes 27.3 Mbits/sec [ 3] 3.0- 4.0 sec 655 KBytes 5.36 Mbits/sec [ 3] 4.0- 5.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 5.0- 6.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 6.0- 7.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 7.0- 8.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 8.0- 9.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 9.0-10.0 sec 0.00 Bytes 0.00 bits/sec [ 3] 0.0-10.3 sec 9.01 MBytes 7.32 Mbits/sec There are frames in the ieee80211_txq and there are frames that have been removed from from this queue, but haven't yet been sent on the wire (num_pending_tx). When num_pending_tx reaches max_num_pending_tx, we will stop the queues by calling ieee80211_stop_queues(). As frames that have previously been sent for transmission (num_pending_tx) are completed, we will decrease num_pending_tx and wake the queues by calling ieee80211_wake_queue(). ieee80211_wake_queue() does not call wake_tx_queue, so we might still have frames in the queue at this point. While the queues were stopped, the socket buffer might have filled up, and in order for user space to write more, we need to free the frames in the queue, since they are accounted to the socket. In order to free them, we first need to transmit them. This problem cannot be reproduced on low-latency devices, e.g. pci, since they call ath10k_mac_tx_push_pending() from ath10k_htt_txrx_compl_task(). ath10k_htt_txrx_compl_task() is not called on high-latency devices. Fix the problem by calling ath10k_mac_tx_push_pending(), after processing rx packets, just like for low-latency devices, also in the SDIO case. Since we are calling ath10k_mac_tx_push_pending() directly, we also need to export it. Signed-off-by: Niklas Cassel --- Changes since V2: Moved ath10k_mac_tx_push_pending() call to ath10k_sdio_irq_handler(). drivers/net/wireless/ath/ath10k/mac.c | 1 + drivers/net/wireless/ath/ath10k/sdio.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 487a7a7380fd..bfcd9705ed54 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4038,6 +4038,7 @@ void ath10k_mac_tx_push_pending(struct ath10k *ar) rcu_read_unlock(); spin_unlock_bh(&ar->txqs_lock); } +EXPORT_SYMBOL(ath10k_mac_tx_push_pending); /************/ /* Scanning */ diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d612ce8c9cff..2856c75f9011 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -30,6 +30,7 @@ #include "debug.h" #include "hif.h" #include "htc.h" +#include "mac.h" #include "targaddrs.h" #include "trace.h" #include "sdio.h" @@ -1342,6 +1343,8 @@ static void ath10k_sdio_irq_handler(struct sdio_func *func) break; } while (time_before(jiffies, timeout) && !done); + ath10k_mac_tx_push_pending(ar); + sdio_claim_host(ar_sdio->func); if (ret && ret != -ECANCELED)