From patchwork Mon Aug 13 23:13:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 10564947 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 F17A0139A for ; Mon, 13 Aug 2018 23:13:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E119429338 for ; Mon, 13 Aug 2018 23:13:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D37FB29342; Mon, 13 Aug 2018 23:13:48 +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 6802829338 for ; Mon, 13 Aug 2018 23:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732368AbeHNB6J (ORCPT ); Mon, 13 Aug 2018 21:58:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51600 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730203AbeHNB6J (ORCPT ); Mon, 13 Aug 2018 21:58:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0692160213; Mon, 13 Aug 2018 23:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534202027; bh=k4LKDQ6CJz0oVOrfx6pIdIUiQ6sOctYKtMfbNAQ79QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGoWcDoaD2sFJPbDvevVR2WXGHsTTQWMd4Y8BMVJ6zlIg7GUBuszqwWcVPsjMzyEy BDmsxZnovl06NvSN7cVVI/qzzQJv7l998AFUvjItbDAKtThLes/Lw4potyQaLfnU26 gEjn7GqRnwQD7v5JJqrhf/TsYLjIWTULjh/JoJqE= 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 19E14604BE; Mon, 13 Aug 2018 23:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534202026; bh=k4LKDQ6CJz0oVOrfx6pIdIUiQ6sOctYKtMfbNAQ79QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=osVYuRLbgIEAEXl49WHDPYj9wxSE8lKZbYolM6g55mkD+7PvJmz74dpddTDyNxKUZ ziD+yKUbZgGkGsN7AIK/s4fzkJN6yEE8UN+EGUslxjo8+jlJ7xqEHHNhQaU+YWuFmT 5UiavRyzoKUFz0R6XTggiL887xX5ngOgV98/AAHE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 19E14604BE 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:44 -0700 From: Rajkumar Manoharan To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [RFC 1/3] mac80211: make airtime txq list per ac Date: Mon, 13 Aug 2018 16:13:29 -0700 Message-Id: <1534202011-13101-2-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 txqs of all access categories are maintained in single list and in uneven order. To fetch a specific AC's txq from the list, lookup might have to traverse the entire list in worst case. To speedup txq lookup, txq list are maintained per each AC. Signed-off-by: Rajkumar Manoharan --- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/main.c | 3 ++- net/mac80211/tx.c | 33 +++++++++++++++++++++++---------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index bd7f074ccf16..5825824cfe5b 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1129,7 +1129,7 @@ struct ieee80211_local { /* protects active_txqs and txqi->schedule_order */ spinlock_t active_txq_lock; - struct list_head active_txqs; + struct list_head active_txqs[IEEE80211_NUM_ACS]; u16 airtime_flags; diff --git a/net/mac80211/main.c b/net/mac80211/main.c index fbb0bd6183d2..771366464f18 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -634,7 +634,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, spin_lock_init(&local->rx_path_lock); spin_lock_init(&local->queue_stop_reason_lock); - INIT_LIST_HEAD(&local->active_txqs); + for (i = 0; i < IEEE80211_NUM_ACS; i++) + INIT_LIST_HEAD(&local->active_txqs[i]); spin_lock_init(&local->active_txq_lock); local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8acab75a0700..6a76852ba1f3 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3597,9 +3597,11 @@ bool ieee80211_schedule_txq(struct ieee80211_hw *hw, * call to ieee80211_next_txq(). */ if ((local->airtime_flags & AIRTIME_ACTIVE) && txqi->txq.sta) - list_add(&txqi->schedule_order, &local->active_txqs); + list_add(&txqi->schedule_order, + &local->active_txqs[txq->ac]); else - list_add_tail(&txqi->schedule_order, &local->active_txqs); + list_add_tail(&txqi->schedule_order, + &local->active_txqs[txq->ac]); ret = true; } @@ -3609,15 +3611,26 @@ bool ieee80211_schedule_txq(struct ieee80211_hw *hw, } EXPORT_SYMBOL(ieee80211_schedule_txq); -static inline struct txq_info *find_txqi(struct list_head *head, s8 ac) +static inline struct txq_info *find_txqi(struct ieee80211_local *local, s8 ac) { - struct txq_info *txqi; + struct txq_info *txqi = NULL; + int i; - list_for_each_entry(txqi, head, schedule_order) { - if (ac < 0 || txqi->txq.ac == ac) - return txqi; + if (ac >= 0 && ac < IEEE80211_NUM_ACS) { + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, + schedule_order); + } else { + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + if (list_empty(&local->active_txqs[i])) + continue; + txqi = list_first_entry(&local->active_txqs[i], + struct txq_info, + schedule_order); + } } - return NULL; + + return txqi; } struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) @@ -3628,7 +3641,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) spin_lock_bh(&local->active_txq_lock); begin: - txqi = find_txqi(&local->active_txqs, ac); + txqi = find_txqi(local, ac); if (!txqi) goto out; @@ -3639,7 +3652,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, s8 ac) 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); + &local->active_txqs[txqi->txq.ac]); goto begin; } }