From patchwork Thu May 17 23:15:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 136216 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp532204lji; Thu, 17 May 2018 16:16:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZojF9pgrUJs93x9EU7SNNiuXDxcVgaFuuHHlcvHwFr4oO8iBbNnICbFgfReOdMiLXlMXgL4 X-Received: by 2002:a17:902:a718:: with SMTP id w24-v6mr7195530plq.45.1526599008243; Thu, 17 May 2018 16:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526599008; cv=none; d=google.com; s=arc-20160816; b=tgR6JUeDrDdnrkCHsh5nmTdDKfCEXY5FZkIAjZ7mB2dwT/6VNV7iGhM1yw0xJohkeI 5ahXH0a97HXmhO87QQwwsh+cXjX44t1Ncx+VT0mbGhysrFkZd44JvlCy99/ugGtBlXoj yu1mTcdL7+xxh7IhInmKIlc574S4x1INZUgqpn3TYqTiZkzeUrTwv376SlqJz7cZb3Qo mtO6LV/SYbxLEnzvGvRt4QUyrBZY7q3eZNmCmJ9s0Y1lFv7Tx/U1KOgfqGYCmv6rJqTT b7gsfhVYdx7wzAeen8KoHfgl294/3USRAJdU67zftb+C7w/B720gCMJWSqlPa2epQT4X kYGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HdvvtESh+yvsSPQ4QveyGIOTUYIWh2882DKh6TLqDLA=; b=V9GNUMFkMWus06XrlWvh/lyke3C4/d4d5etTid8/kilkyn/HoLxN7LFEulwHiTTTDw Bz05+12g8sexF5RlfxY6Sbgnx6Q9OahdJZC0PoQ4n+eDIUwNiug8lhktcacgIX3rMlki I04oBY50WklrujzN0xTHOOKZWBZv//GKe3SY0528IDkP6K6CU1HUnKfSo1j6CILS22Oy YWmW0tC6B4MQmoYOSsORPgNasHA5g74z0ydKvY8oGiWF0ataouh4Wx+Gzuf29Yddo+cc dL/1kiDorVtNI5el+D1wxSSoeq27R4ndcyl5AMnB2tO8KRnXNm6kEMSDl/dPJl/WmuKm miww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zvqc4Znx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b79-v6si6252664pfm.104.2018.05.17.16.16.47; Thu, 17 May 2018 16:16:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zvqc4Znx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752075AbeEQXQn (ORCPT + 29 others); Thu, 17 May 2018 19:16:43 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:45058 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbeEQXQl (ORCPT ); Thu, 17 May 2018 19:16:41 -0400 Received: by mail-lf0-f68.google.com with SMTP id w202-v6so11141108lff.12 for ; Thu, 17 May 2018 16:16:41 -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=HdvvtESh+yvsSPQ4QveyGIOTUYIWh2882DKh6TLqDLA=; b=Zvqc4ZnxH3QJ/VSueKxR7nLxCn2joT8IMZ98a7H13etf2DsX22ohUBknzI/qwLwGe6 EwhpovGcrOrjZ4hjL+zZrifhMOomqfzInIPHbCeTut+jTuVWiAJSz1qXI7gZlPvD7u2L rFobYbxxjZ2ed+/SWItgKeCThKQ2BkvZlcyYc= 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=HdvvtESh+yvsSPQ4QveyGIOTUYIWh2882DKh6TLqDLA=; b=dq3wNF0q+xyJa2NoocRJqtofw1Ts1Ch3c5kAP/9Fuk9OYszw5m4jclu1b1nCkL6Qgn TnY18I0ILIp0PZEN5oPKlIi0VGAiT/ZNHYQLU5e32qrRMrMqIXf339QerbLLUHuL2Z2s FGL4aF1hosuzI1YTNtjQ6XK21wOnoDFkPKjWxBCA41ZLRfqtrBmYYnd+uTw4q6VsgKir s2MBu71HLhkxN7jsupdNwfh7c+PNvS+u2Auv7UGsG7dPiymOywdwxlS4CrgY87v3y5+M SDpKwGZ7/MWMLhoqEBXul0LDd1B0X6jwF2oMgQxJOLtrObCLRSPIBsXA0TULHdGdPVQY lpXA== X-Gm-Message-State: ALKqPwfopy8CqS8DPNzsxsFPhOmK28Mvegr81fe3NbXCwLNUyNq8ipaj L8GUZAHvYyz5XQUKag1ZOvKPqkCcd9o= X-Received: by 2002:a19:7007:: with SMTP id h7-v6mr18388070lfc.123.1526599000273; Thu, 17 May 2018 16:16:40 -0700 (PDT) Received: from localhost.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id t8-v6sm735172lfk.69.2018.05.17.16.16.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 16:16:39 -0700 (PDT) From: Niklas Cassel To: Kalle Valo , "David S. Miller" Cc: Niklas Cassel , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath10k: transmit queued frames after waking queues Date: Fri, 18 May 2018 01:15:12 +0200 Message-Id: <20180517231512.13085-1-niklas.cassel@linaro.org> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/wireless/ath/ath10k/txrx.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.0 diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index cda164f6e9f6..1d3b2d2c3fee 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 (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);