From patchwork Fri Dec 13 07:19:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yibo Zhao X-Patchwork-Id: 11290067 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A34614BD for ; Fri, 13 Dec 2019 07:24:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 18A5924656 for ; Fri, 13 Dec 2019 07:24:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="G/8KrrKS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725937AbfLMHYb (ORCPT ); Fri, 13 Dec 2019 02:24:31 -0500 Received: from m228-4.mailgun.net ([159.135.228.4]:56813 "EHLO m228-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbfLMHYb (ORCPT ); Fri, 13 Dec 2019 02:24:31 -0500 X-Greylist: delayed 302 seconds by postgrey-1.27 at vger.kernel.org; Fri, 13 Dec 2019 02:24:15 EST DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1576221870; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=XNpN3pNlMo4tSut6/1EubIcb6843QC7lvbIt+YGPNIQ=; b=G/8KrrKSEmKOOFwMjAjkwIG7YhBrwQxYeVSqSf9lo3r+8GO0Lq4Mp590hSKe0OVjbcfZRHkY 7Ld2NRw/tfPywxPXfbT52TaeSiR9p9MKjWSd0vEEiDAr9odon/M7x4RhSjAkfxl2gFy1K4f3 b58YhLAioSCp5y1JnQ8cSKqs00s= X-Mailgun-Sending-Ip: 159.135.228.4 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5df33b7b.7f4e195a9298-smtp-out-n03; Fri, 13 Dec 2019 07:19:23 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 89CA8C433CB; Fri, 13 Dec 2019 07:19:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from ybzhao-HP-Z230-SFF-Workstation.ap.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: yiboz) by smtp.codeaurora.org (Postfix) with ESMTPSA id E3A9AC43383; Fri, 13 Dec 2019 07:19:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E3A9AC43383 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=yiboz@codeaurora.org From: Yibo Zhao To: linux-wireless@vger.kernel.org Cc: ath10k@lists.infradead.org, Yibo Zhao Subject: [PATCH 3/4] mac80211: fix low throughput in multi-clients situation Date: Fri, 13 Dec 2019 15:19:52 +0800 Message-Id: <1576221593-1086-4-git-send-email-yiboz@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1576221593-1086-1-git-send-email-yiboz@codeaurora.org> References: <1576221593-1086-1-git-send-email-yiboz@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Not long after the start of multi-clients test, not a single station is an eligible candidate for transmission since global virtual time(g_vt) is smaller than the virtual airtime(s_vt) of all the stations. As a result, the Tx has been blocked and throughput is quite low. This may mainly due accumulative deviation from the devision calculation of g_vt. For example: Suppose we have 50 clients in first round. Round 1: STA weight Tx_time_round wt_sum s_vt g_vt valid_for_next_Tx 1 256 2048 12800 2048 2000 N 2 256 2048 2048 N . . . . . . . . . . . . . . . 50 256 2048 2048 N After this round, all the stations are not valid for next transmission due to accumulative deviation. The real situation can be more complicate, above is one of the extremely case. To avoid this situation to occur, the new proposal is: - If global virtual time is less than the virtual airtime of any station, sync it to the airtime of first station in the red-black tree - Round the division result Signed-off-by: Yibo Zhao --- net/mac80211/sta_info.c | 3 ++- net/mac80211/tx.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 9d01fdd..feac975 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1852,7 +1852,8 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, weight_sum = local->airtime_weight_sum[ac] ?: sta->airtime_weight; - local->airtime_v_t[ac] += airtime / weight_sum; + /* Round the calculation of global vt */ + local->airtime_v_t[ac] += (airtime + (weight_sum >> 1)) / weight_sum; sta->airtime[ac].v_t += airtime / sta->airtime_weight; ieee80211_resort_txq(&local->hw, txq); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c1444e7..b40cf91 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3822,15 +3822,29 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { struct ieee80211_local *local = hw_to_local(hw); - struct txq_info *txqi = to_txq_info(txq); + struct txq_info *first_txqi, *txqi = to_txq_info(txq); + struct rb_node *node = NULL; struct sta_info *sta; u8 ac = txq->ac; + first_txqi = NULL; lockdep_assert_held(&local->active_txq_lock[ac]); if (!txqi->txq.sta) return true; + node = rb_first_cached(&local->active_txqs[ac]); + if (node) { + first_txqi = container_of(node, struct txq_info, + schedule_order); + if (first_txqi->txq.sta) { + sta = container_of(first_txqi->txq.sta, + struct sta_info, sta); + if (local->airtime_v_t[ac] < sta->airtime[ac].v_t) + local->airtime_v_t[ac] = sta->airtime[ac].v_t; + } + } + sta = container_of(txqi->txq.sta, struct sta_info, sta); return (sta->airtime[ac].v_t <= local->airtime_v_t[ac]); }