From patchwork Mon May 21 20:43:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 10416323 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 41EE56053B for ; Mon, 21 May 2018 20:44:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31BD328A44 for ; Mon, 21 May 2018 20:44:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2645828A4A; Mon, 21 May 2018 20:44:31 +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=ham 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 A845928A44 for ; Mon, 21 May 2018 20:44:30 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=mrAZ8HNo7FUFa5CiTiRhplnom5h0YBgw/P7Bvle3Q1Y=; b=rnNqjuZnqouaTC S4BqGPSYJ6EQDo0Khus8ldI9KmrGJcWCvekU8DH7tFiaFo7gLCmG7gx17sLzntgJ6Qvwswhwg8sxJ MiFW1mp65HUNjNaeapXkZ3XN9P5Qy7LkPsd+udJ8WPWnnxA0LpTKiQjbzsSC79/n5wH7Cc58zl+KN KlR7Kxr5PHWqzjQL/iIxfteyk9kp0IkRe2NruyPXU8MdJoD8+b01S2duWND5M2aIcvSgtdnUAiftX Ar7114HG7b1X8/JNGZMqRKHY9vHKcUtO1eqOyDlEpzVl2tHA3gAEYC9Abbz0kUeY1GWz6PPf92ppQ rrDvIGH153GFaZUcuaPw==; 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 1fKrfN-0001fo-6t; Mon, 21 May 2018 20:44:25 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fKrfK-0001cy-63 for ath10k@lists.infradead.org; Mon, 21 May 2018 20:44:23 +0000 Received: by mail-lf0-x244.google.com with SMTP id u9-v6so8673371lfc.0 for ; Mon, 21 May 2018 13:44:09 -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:mime-version :content-transfer-encoding; bh=bHVcNdmFIIAIu2uug9YIcw/g+DLQaXmXVrR7NA4ECEI=; b=K5ZlMja1d4ix1f9Ms5TP+C75Fv6VRcATpSJn9+g+NdV2PjgMJIPOiZ0PwfIi43e/kb feju90siko7rtrS/qd3ovMAFrT5mzXhbY8FOHu/rHPHsuTs0cRYcH3qQ+ZH9Wy5Ovzs4 WK5h5dJFAOsiFycOdSNFv+2xQQ3QPq47BnOfU= 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:mime-version :content-transfer-encoding; bh=bHVcNdmFIIAIu2uug9YIcw/g+DLQaXmXVrR7NA4ECEI=; b=G7gUD1rlLmAKQsmixiiMbkJZm2vf0gCAeLPZ+rH5epKUI2WyM7z6gFPGmtwTWAL7c7 76xitElW1cwsqAFwdqFdnP20Ljj7utoVnCbYHKe7Bjgk1ANVvGv9FGSY+SLxHJ0GwYzR rniYGqtWkebe7+EWeT2dAL+fS/G1m2rpz35c0VfFhhGJrCOeyNyeh5doM5AH9o9Fbwwb Z/7qsrsX1YoQ269ZBRmNUBfkpT0Q+JftETDIYrHTXce8DuoE4keUM6tDVowMnhoFOQe4 FwtZAoa01SseaeL8AZPGjFuuNCB3nCoaVhn+ZRenAwiV1ld958o9br3fbqnvF+x70+Cx mRsA== X-Gm-Message-State: ALKqPweJIMNBbEeqywILiwIHvCjz/c4QVs1vt08WegH/pyb4ZSIAqxiI +c+1rAK6lvpYF/5aE13baMDOQA== X-Google-Smtp-Source: AB8JxZqqtIUz1ea8la+a6XJ6k6ZjmKv17rE6Qa3FKmV3lCntypPctNzIgFOhewC8SW4jr6Xx6x65hg== X-Received: by 2002:a2e:8993:: with SMTP id c19-v6mr13549272lji.123.1526935448310; Mon, 21 May 2018 13:44:08 -0700 (PDT) Received: from localhost.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id a21-v6sm3630660lfl.84.2018.05.21.13.44.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 May 2018 13:44:07 -0700 (PDT) From: Niklas Cassel To: Kalle Valo , "David S. Miller" Subject: [PATCH v2] ath10k: transmit queued frames after waking queues Date: Mon, 21 May 2018 22:43:59 +0200 Message-Id: <20180521204359.23884-1-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180521_134422_224203_1BB328B5 X-CRM114-Status: GOOD ( 10.76 ) 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 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The following problem was observed when running iperf: [ 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. In order to avoid trying to flush the queue every time we free a frame, only do this when there are 3 or less frames pending, and while we actually have frames in the queue. This logic was copied from mt76_txq_schedule (mt76), one of few other drivers that are actually using wake_tx_queue. Suggested-by: Toke Høiland-Jørgensen Signed-off-by: Niklas Cassel --- Changes since V1: use READ_ONCE() to disallow the compiler optimizing things in undesirable ways. drivers/net/wireless/ath/ath10k/txrx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index cda164f6e9f6..264cf0bd5c00 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -95,6 +95,9 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); + if (READ_ONCE(htt->num_pending_tx) <= 3 && !list_empty(&ar->txqs)) + ath10k_mac_tx_push_pending(ar); + dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); ath10k_report_offchan_tx(htt->ar, msdu);