From patchwork Mon Aug 13 23:13:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 10564949 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 951AE139A for ; Mon, 13 Aug 2018 23:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 864A829338 for ; Mon, 13 Aug 2018 23:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A62129342; Mon, 13 Aug 2018 23:13:51 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09D5429338 for ; Mon, 13 Aug 2018 23:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732488AbeHNB6M (ORCPT ); Mon, 13 Aug 2018 21:58:12 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51656 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730203AbeHNB6M (ORCPT ); Mon, 13 Aug 2018 21:58:12 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 183F860B6B; Mon, 13 Aug 2018 23:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534202029; bh=x1pF04e5hwGiP89pG5KDyDDtcpaLsnhrkezQe64Wc2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPh/VGzpj7r43uHEcYBFVo//XS3PfVVkA6QQDLtm6SHZ8z+MLMDiHwbZJKOKjMkfH RlCqzTEH3iCRYKcyPcbrsZn+WVgcKK+rbonhqcIrqk+4nDbI3LDCznYum5oxBUnp8W Cwa6D2Vv18/Ee5RImnzC8qBH9rNTRGeKj/5M1Pbs= Received: from smtp.codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1DEC460791; Mon, 13 Aug 2018 23:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534202028; bh=x1pF04e5hwGiP89pG5KDyDDtcpaLsnhrkezQe64Wc2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZqrMlqFZWxuIGylRFDz5czrHbJFUT/Tjwic7ZRw8KINwCM8HVfuqB1JyerL/H++S WzYr737Zbh7SRgR4qKDN9na4KcUKmYFcBMWnjUQu1M9sZYH4ujPiZZUladsCmX+xe/ bbjdC4lWsbZ/lA8ExGiJ8ZiBWtuGPi7HzB6Y8jTY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1DEC460791 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org Received: by smtp.codeaurora.org (sSMTP sendmail emulation); Mon, 13 Aug 2018 16:13:46 -0700 From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [RFC 2/3] mac80211: pause txq transmission on negative airtime deficit Date: Mon, 13 Aug 2018 16:13:30 -0700 Message-Id: <1534202011-13101-3-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1534202011-13101-1-git-send-email-rmanohar@codeaurora.org> References: <1534202011-13101-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Airtime fairness prioritizes txqs and picks high priority txq. Once a txq is selected for transmission by next_txq(), dequeue routine is not preventing over downloading packets. i.e the driver is still allowed to dequeue frames from txq even when its fairness deficit goes negative. This is also causing inefficient fq-codel of mac80211 when the driver/firmware is maintaining another set of data queues. To address this problem, pause txq transmission when given txq's was already served for the assigned quantum and resume the transmission upon prioritization. Signed-off-by: Rajkumar Manoharan --- net/mac80211/debugfs_sta.c | 7 ++++--- net/mac80211/ieee80211_i.h | 1 + net/mac80211/sta_info.c | 9 +++++++++ net/mac80211/tx.c | 9 ++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index bae0fa7ff95a..5c38994cd95c 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c @@ -178,9 +178,10 @@ static ssize_t sta_aqm_read(struct file *file, char __user *userbuf, txqi->tin.tx_bytes, txqi->tin.tx_packets, txqi->flags, - txqi->flags & (1<flags & (1<flags & (1<flags & (1 << IEEE80211_TXQ_STOP) ? "STOP" : + txqi->flags & (1 << IEEE80211_TXQ_PAUSE) ? "PAUSE": "RUN", + txqi->flags & (1 << IEEE80211_TXQ_AMPDU) ? " AMPDU" : "", + txqi->flags & (1 << IEEE80211_TXQ_NO_AMSDU) ? " NO-AMSDU" : ""); } rcu_read_unlock(); diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 5825824cfe5b..3ef287075cb1 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -818,6 +818,7 @@ enum txq_info_flags { IEEE80211_TXQ_STOP, IEEE80211_TXQ_AMPDU, IEEE80211_TXQ_NO_AMSDU, + IEEE80211_TXQ_PAUSE, }; /** diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 8af9e5c05ce4..215ae3a690aa 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1830,6 +1830,8 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, { struct sta_info *sta = container_of(pubsta, struct sta_info, sta); struct ieee80211_local *local = sta->sdata->local; + struct fq *fq = &local->fq; + struct txq_info *txqi; u8 ac = ieee80211_ac_from_tid(tid); u32 airtime = 0; @@ -1844,6 +1846,13 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, sta->airtime.deficit[ac] -= airtime; if (airtime) sta->local->airtime_flags |= AIRTIME_ACTIVE; + + if (sta->airtime.deficit[ac] < 0) { + txqi = to_txq_info(pubsta->txq[tid]); + spin_lock_bh(&fq->lock); + set_bit(IEEE80211_TXQ_PAUSE, &txqi->flags); + spin_unlock_bh(&fq->lock); + } spin_unlock_bh(&local->active_txq_lock); } EXPORT_SYMBOL(ieee80211_sta_register_airtime); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 6a76852ba1f3..0af35c08e0d9 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3475,7 +3475,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, spin_lock_bh(&fq->lock); - if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags)) + if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) || + test_bit(IEEE80211_TXQ_PAUSE, &txqi->flags)) goto out; /* Make sure fragments stay together. */ @@ -3636,6 +3637,7 @@ static inline struct txq_info *find_txqi(struct ieee80211_local *local, s8 ac) struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) { struct ieee80211_local *local = hw_to_local(hw); + struct fq *fq = &local->fq; struct txq_info *txqi = NULL; spin_lock_bh(&local->active_txq_lock); @@ -3653,6 +3655,11 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) sta->airtime.deficit[txqi->txq.ac] += IEEE80211_AIRTIME_QUANTUM * sta->airtime.weight; list_move_tail(&txqi->schedule_order, &local->active_txqs[txqi->txq.ac]); + if (sta->airtime.deficit[txqi->txq.ac] > 0) { + spin_lock_bh(&fq->lock); + clear_bit(IEEE80211_TXQ_PAUSE, &txqi->flags); + spin_unlock_bh(&fq->lock); + } goto begin; } }