From patchwork Mon Aug 13 23:13:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 10564951 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 57F23139A for ; Mon, 13 Aug 2018 23:13:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49F7629338 for ; Mon, 13 Aug 2018 23:13:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E13E29342; Mon, 13 Aug 2018 23:13:53 +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 C5B4B29338 for ; Mon, 13 Aug 2018 23:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732491AbeHNB6N (ORCPT ); Mon, 13 Aug 2018 21:58:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51690 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730203AbeHNB6N (ORCPT ); Mon, 13 Aug 2018 21:58:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C5F6C607F7; Mon, 13 Aug 2018 23:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534202030; bh=i0+HzWh5gOxF/54yA9eki77hrYJQ4jq8L5xReSNihik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRimr/U/hjvMK7xRFyGOS6wb4oCSImY3WgWkIywJis8sBM7MH7jT68jCno+/DXTJP TAbezl7DwOQD1yqFxSQAd0R0uxw6kJ5u57bvhErF+PpXslHYYs9nyMThA6fOgNqj34 dbuKksPzKGTFxMV8jeuSrWyRGJPUeGA+3K9G7a4M= 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 2D19860769; 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=1534202030; bh=i0+HzWh5gOxF/54yA9eki77hrYJQ4jq8L5xReSNihik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fRimr/U/hjvMK7xRFyGOS6wb4oCSImY3WgWkIywJis8sBM7MH7jT68jCno+/DXTJP TAbezl7DwOQD1yqFxSQAd0R0uxw6kJ5u57bvhErF+PpXslHYYs9nyMThA6fOgNqj34 dbuKksPzKGTFxMV8jeuSrWyRGJPUeGA+3K9G7a4M= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2D19860769 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:48 -0700 From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [RFC 3/3] mac80211: add ieee80211_reorder_txq Date: Mon, 13 Aug 2018 16:13:31 -0700 Message-Id: <1534202011-13101-4-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 This allows the driver to refill airtime fairness deficit where the driver will not access txqs by ieee80211_next_txq. In tx push mode data path, high priority txqs will be scheduled for data transmission by ieee80211_next_txq and driver will not prioritize txqs whereas in push-pull mode, the drivers can prioritize txqs and access them directly. In such mode, airtime deficit can not filled by ieee80211_next_txq. Signed-off-by: Rajkumar Manoharan --- include/net/mac80211.h | 15 +++++++++++++ net/mac80211/tx.c | 59 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index cc16847bd52d..a2f0b6800100 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -6033,6 +6033,21 @@ bool ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac); /** + * ieee80211_reorder_txq - change txq position in scheduling loop + * + * This function is used to reorder txq's position in scheduling loop. + * The txq fairness deficit will be refilled. The drivers calling this + * function should ensure the txq won't be accessed by ieee80211_next_txq + * in the same path. + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @txq: pointer obtained from station or virtual interface + * + */ +void ieee80211_reorder_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq); + +/** * ieee80211_txq_get_depth - get pending frame/byte count of given txq * * The values are not guaranteed to be coherent with regard to each other, i.e. diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 0af35c08e0d9..b7b2f93152f8 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3634,10 +3634,38 @@ static inline struct txq_info *find_txqi(struct ieee80211_local *local, s8 ac) return txqi; } +static bool ieee80211_txq_refill_deficit(struct ieee80211_local *local, + struct txq_info *txqi) +{ + struct fq *fq = &local->fq; + struct sta_info *sta; + + lockdep_assert_held(&local->active_txq_lock); + + if (!txqi->txq.sta) + return false; + + sta = container_of(txqi->txq.sta, struct sta_info, sta); + + if (sta->airtime.deficit[txqi->txq.ac] > 0) + return false; + + 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); + } + return true; +} + 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); @@ -3647,22 +3675,8 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) if (!txqi) goto out; - if (txqi->txq.sta) { - struct sta_info *sta = container_of(txqi->txq.sta, - struct sta_info, sta); - - if (sta->airtime.deficit[txqi->txq.ac] < 0) { - 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; - } - } + if (ieee80211_txq_refill_deficit(local, txqi)) + goto begin; list_del_init(&txqi->schedule_order); @@ -3676,6 +3690,17 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) } EXPORT_SYMBOL(ieee80211_next_txq); +void ieee80211_reorder_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) +{ + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); + + spin_lock_bh(&local->active_txq_lock); + ieee80211_txq_refill_deficit(local, txqi); + spin_unlock_bh(&local->active_txq_lock); +} +EXPORT_SYMBOL(ieee80211_reorder_txq); + void __ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev, u32 info_flags)