From patchwork Wed Mar 16 10:17:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8597351 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E041C0555 for ; Wed, 16 Mar 2016 10:17:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DA0F20306 for ; Wed, 16 Mar 2016 10:17:30 +0000 (UTC) Received: from bombadil.infradead.org (unknown [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1B09B202F0 for ; Wed, 16 Mar 2016 10:17:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ag8VF-0003MO-Pc; Wed, 16 Mar 2016 10:16:33 +0000 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ag8V9-0002y6-6j for ath10k@lists.infradead.org; Wed, 16 Mar 2016 10:16:29 +0000 Received: by mail-lf0-x233.google.com with SMTP id l83so15475697lfd.3 for ; Wed, 16 Mar 2016 03:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MtKUB8dqNlCxX7zDBpq8FK2z5Zwp3xd04uiI891UtlU=; b=fp+xIPr1NztLfSr5gLOaUmOO64w/kZ40wXLJTBIrYEixxWjAeADDmJulb1w7HTpmOJ 1EuGls1ePJjGWCxFcWECwTdxz+l2jj6sXy7KmtK2oL7IsdfHspLpdrhChSHKlfYQi1Mq //Z4wY0Vq/XCN6bSNIyITo7qkK+xrpqYCaRyY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MtKUB8dqNlCxX7zDBpq8FK2z5Zwp3xd04uiI891UtlU=; b=cPSJs2cnlDzu9dQPEtFH4+JcHuA+MI6dcOrZjs2F/O0K8L/uleLNirCN6qmmOKdja2 EATERlDEY8y4KFOII0fDMO33wDcxgnsLBOXjjfZOpDXCn0pySOBoF/GVk76rLbOYNgjx Hsgt0PSpQHnlUq46aLZs3l4gCN2paPEBs92YWQ4sqX8Aqj9yN2IUZqa3TtRPwT3NfF3u xjRfuQQW/fym1Hzv8Xj6DCQ/xmhwjucyXmFACo1zbKQrlayl/5i2Yau+kAVR0bJLBPe8 jYVyHB9KqVodPym0Y7cJddGGyHuTng9prUETS36ViEo1ymFnXsYVWGDWaFNV5KEn6hL4 ujPA== X-Gm-Message-State: AD7BkJKV8UMfPKcWPIG0vq41UrX4KAHr081InEGw7UO7Hozk078M14ynP+6Z7IikUiTEfkDgui+t2v5h1LgQZTb6hoynLJIkIReto7nmI+FT4mOf9c105krprL26ylykmC2Lv0SH X-Received: by 10.25.143.65 with SMTP id r62mr846071lfd.58.1458123354085; Wed, 16 Mar 2016 03:15:54 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id 95sm399651lfu.15.2016.03.16.03.15.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Mar 2016 03:15:53 -0700 (PDT) From: Michal Kazior To: linux-wireless@vger.kernel.org Subject: [RFCv2 3/3] ath10k: use ieee80211_tx_schedule() Date: Wed, 16 Mar 2016 11:17:58 +0100 Message-Id: <1458123478-1795-4-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458123478-1795-1-git-send-email-michal.kazior@tieto.com> References: <1458123478-1795-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160316_031627_726039_C3B9A98A X-CRM114-Status: GOOD ( 17.07 ) X-Spam-Score: -2.7 (--) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nbd@openwrt.org, emmanuel.grumbach@intel.com, netdev@vger.kernel.org, dave.taht@gmail.com, ath10k@lists.infradead.org, codel@lists.bufferbloat.net, Michal Kazior , make-wifi-fast@lists.bufferbloat.net, johannes@sipsolutions.net, Tim Shepard MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RDNS_NONE,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The wake_tx_queue() scheduling for non-pull-push (or threshold based pull-push) wasn't really smart nor fair. Instead use the new mac80211 Tx scheduling helper which is part of the fq-codel-in-mac80211 proof of concept. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/core.c | 2 - drivers/net/wireless/ath/ath10k/core.h | 3 - drivers/net/wireless/ath/ath10k/mac.c | 100 ++++++++++++++++----------------- 3 files changed, 50 insertions(+), 55 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 2389c0713c13..1848e0b6206a 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -2049,9 +2049,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, mutex_init(&ar->conf_mutex); spin_lock_init(&ar->data_lock); - spin_lock_init(&ar->txqs_lock); - INIT_LIST_HEAD(&ar->txqs); INIT_LIST_HEAD(&ar->peers); init_waitqueue_head(&ar->peer_mapping_wq); init_waitqueue_head(&ar->htt.empty_tx_wq); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 3f76669d44cf..1f94af046f79 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -801,10 +801,7 @@ struct ath10k { /* protects shared structure data */ spinlock_t data_lock; - /* protects: ar->txqs, artxq->list */ - spinlock_t txqs_lock; - struct list_head txqs; struct list_head arvifs; struct list_head peers; struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS]; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index addef9179dbe..5b8becb30b62 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3624,17 +3624,14 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct *work) static void ath10k_mac_txq_init(struct ieee80211_txq *txq) { - struct ath10k_txq *artxq = (void *)txq->drv_priv; - if (!txq) return; - INIT_LIST_HEAD(&artxq->list); + /* It's useful to keep this even though it doesn't do anything now */ } static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) { - struct ath10k_txq *artxq = (void *)txq->drv_priv; struct ath10k_skb_cb *cb; struct sk_buff *msdu; int msdu_id; @@ -3642,11 +3639,6 @@ static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) if (!txq) return; - spin_lock_bh(&ar->txqs_lock); - if (!list_empty(&artxq->list)) - list_del_init(&artxq->list); - spin_unlock_bh(&ar->txqs_lock); - spin_lock_bh(&ar->htt.tx_lock); idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { cb = ATH10K_SKB_CB(msdu); @@ -3725,7 +3717,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw, ath10k_htt_tx_dec_pending(htt, is_mgmt); spin_unlock_bh(&ar->htt.tx_lock); - return -ENOENT; + return 0; } ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb); @@ -3752,44 +3744,59 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw, return skb_len; } +#define MIN_TX_SLOTS 42 + +static int ath10k_mac_tx_wake(struct ieee80211_hw *hw, + struct ieee80211_txq *txq, + int budget) +{ + struct ath10k *ar = hw->priv; + int sent = 0; + int ret; + int slots; + + if (!ath10k_mac_tx_can_push(hw, txq)) + return 0; + + /* This gives more opportunity to form longer bursts when there's a lot + * of stations active + */ + slots = ar->htt.max_num_pending_tx - ar->htt.num_pending_tx; + if (slots < MIN_TX_SLOTS) + return -1; + + while (budget > 0) { + ret = ath10k_mac_tx_push_txq(hw, txq); + if (ret <= 0) + break; + + sent++; + budget -= ret; + } + + if (ret >= 0) + return sent; + else + return -1; +} + void ath10k_mac_tx_push_pending(struct ath10k *ar) { struct ieee80211_hw *hw = ar->hw; - struct ieee80211_txq *txq; - struct ath10k_txq *artxq; - struct ath10k_txq *last; int ret; - int max; - spin_lock_bh(&ar->txqs_lock); - rcu_read_lock(); - - last = list_last_entry(&ar->txqs, struct ath10k_txq, list); - while (!list_empty(&ar->txqs)) { - artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list); - txq = container_of((void *)artxq, struct ieee80211_txq, - drv_priv); - - /* Prevent aggressive sta/tid taking over tx queue */ - max = 16; - while (max--) { - ret = ath10k_mac_tx_push_txq(hw, txq); - if (ret < 0) - break; - } - - list_del_init(&artxq->list); - ath10k_htt_tx_txq_update(hw, txq); - - if (artxq == last || (ret < 0 && ret != -ENOENT)) { - if (ret != -ENOENT) - list_add_tail(&artxq->list, &ar->txqs); - break; - } + ieee80211_recalc_fq_period(hw); + + ret = ieee80211_tx_schedule(hw, ath10k_mac_tx_wake); + switch (ret) { + default: + ath10k_warn(ar, "unexpected tx schedul retval: %d\n", + ret); + /* pass through */ + case -EBUSY: + case -ENOENT: + break; } - - rcu_read_unlock(); - spin_unlock_bh(&ar->txqs_lock); } /************/ @@ -4013,16 +4020,9 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) { struct ath10k *ar = hw->priv; - struct ath10k_txq *artxq = (void *)txq->drv_priv; - - if (ath10k_mac_tx_can_push(hw, txq)) { - spin_lock_bh(&ar->txqs_lock); - if (list_empty(&artxq->list)) - list_add_tail(&artxq->list, &ar->txqs); - spin_unlock_bh(&ar->txqs_lock); + if (ath10k_mac_tx_can_push(hw, txq)) tasklet_schedule(&ar->htt.txrx_compl_task); - } ath10k_htt_tx_txq_update(hw, txq); }