Lets make wifi fast again!
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: linux-wireless@vger.kernel.org
Cc: ath10k@lists.infradead.org, johannes@sipsolutions.net,
	netdev@vger.kernel.org, dave.taht@gmail.com,
	emmanuel.grumbach@intel.com, nbd@openwrt.org,
	Tim Shepard <shep@alum.mit.edu>,
	make-wifi-fast@lists.bufferbloat.net,
	codel@lists.bufferbloat.net,
	Michal Kazior <michal.kazior@tieto.com>
Subject: [Make-wifi-fast] [RFCv2 3/3] ath10k: use ieee80211_tx_schedule()
Date: Wed, 16 Mar 2016 11:17:58 +0100	[thread overview]
Message-ID: <1458123478-1795-4-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1458123478-1795-1-git-send-email-michal.kazior@tieto.com>

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 <michal.kazior@tieto.com>
---
 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);
 }
-- 
2.1.4


  parent reply	other threads:[~2016-03-16 10:15 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 10:17 [Make-wifi-fast] [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 10:17 ` [Make-wifi-fast] [RFCv2 1/3] mac80211: implement fq_codel for software queuing Michal Kazior
2016-03-22  1:35   ` David Lang
2016-03-22  6:51     ` Michal Kazior
2016-03-16 10:17 ` [Make-wifi-fast] [RFCv2 2/3] ath10k: report per-station tx/rate rates to mac80211 Michal Kazior
2016-03-24  7:19   ` Mohammed Shafi Shajakhan
2016-03-24  7:49     ` Michal Kazior
2016-03-24 12:23       ` Mohammed Shafi Shajakhan
2016-03-24 12:31         ` Michal Kazior
2016-03-16 10:17 ` Michal Kazior [this message]
2016-03-16 10:26 ` [Make-wifi-fast] [RFCv2 0/3] mac80211: implement fq codel Michal Kazior
2016-03-16 15:37   ` Dave Taht
2016-03-16 18:36     ` Dave Taht
2016-03-16 18:55       ` Bob Copeland
2016-03-16 19:48         ` Jasmine Strong
2016-03-17  8:55           ` Michal Kazior
2016-03-17 11:12             ` Bob Copeland
2016-03-17 17:00             ` Dave Taht
2016-03-17 17:24               ` [Make-wifi-fast] [Codel] " Rick Jones
2016-03-21 11:57               ` [Make-wifi-fast] " Michal Kazior
2016-03-17  9:43       ` Michal Kazior
2016-03-17  9:03     ` Michal Kazior
2016-03-25  9:27 ` [Make-wifi-fast] [PATCH 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-25  9:27   ` [Make-wifi-fast] [PATCH 1/2] mac80211: implement fair queuing per txq Michal Kazior
     [not found]     ` <CAHqTa-0yEFYAFpSKyko1ET33GsN==_D8TpBeq6AtwLj4XMTW0A@mail.gmail.com>
2016-04-11  7:25       ` Michal Kazior
2016-03-25  9:27   ` [Make-wifi-fast] [PATCH 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-03-31 10:28   ` [Make-wifi-fast] [PATCHv2 0/2] mac80211: implement fq_codel Michal Kazior
2016-03-31 10:28     ` [Make-wifi-fast] [PATCHv2 1/2] mac80211: implement fair queuing per txq Michal Kazior
2016-04-05 13:57       ` Johannes Berg
2016-04-05 14:32         ` Dave Taht
     [not found]           ` <1459927276.17504.6.camel@sipsolutions.net>
2016-04-06 17:39             ` Dave Taht
2016-04-07  8:53               ` Johannes Berg
2016-04-06  5:35         ` Michal Kazior
2016-04-06  6:03           ` Jonathan Morton
2016-04-06  7:16             ` Michal Kazior
2016-04-06 16:46               ` Jonathan Morton
2016-04-06  7:19           ` Johannes Berg
2016-03-31 10:28     ` [Make-wifi-fast] [PATCHv2 2/2] mac80211: expose some txq/fq internals and knobs via debugfs Michal Kazior
2016-04-14 12:18     ` [Make-wifi-fast] [PATCHv3 0/5] mac80211: implement fq_codel Michal Kazior
2016-04-14 12:18       ` [Make-wifi-fast] [PATCHv3 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-04-16 22:21         ` Johannes Berg
2016-04-18  5:39           ` Michal Kazior
2016-04-14 12:18       ` [Make-wifi-fast] [PATCHv3 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-04-16 22:23         ` Johannes Berg
2016-04-16 22:25           ` Johannes Berg
2016-04-18  5:16             ` Michal Kazior
2016-04-18 12:31               ` [Make-wifi-fast] [Codel] " Eric Dumazet
2016-04-18 13:36                 ` Michal Kazior
2016-04-19  9:10                   ` Johannes Berg
2016-04-14 12:18       ` [Make-wifi-fast] [PATCHv3 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-04-14 12:18       ` [Make-wifi-fast] [PATCHv3 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-04-16 22:29         ` Johannes Berg
2016-04-18  5:31           ` Michal Kazior
2016-04-18 12:38             ` Michal Kazior
2016-04-19  9:06               ` Johannes Berg
2016-04-19  9:31                 ` Michal Kazior
2016-04-19  9:57                   ` Johannes Berg
2016-04-14 12:18       ` [Make-wifi-fast] [PATCHv3 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-05-05 11:00       ` [Make-wifi-fast] [PATCHv4 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-05 11:00         ` [Make-wifi-fast] [PATCHv4 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-05-09 12:28           ` Michal Kazior
2016-05-05 11:00         ` [Make-wifi-fast] [PATCHv4 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-05 11:00         ` [Make-wifi-fast] [PATCHv4 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-06-09  9:48           ` Johannes Berg
2016-05-05 11:00         ` [Make-wifi-fast] [PATCHv4 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-05 15:30           ` Dave Taht
2016-05-05 11:00         ` [Make-wifi-fast] [PATCHv4 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-05-05 15:21           ` Dave Taht
2016-05-06  5:27             ` Michal Kazior
2016-05-06  5:51               ` Dave Taht
2016-05-06  6:33                 ` Michal Kazior
2016-05-06  7:23                   ` Dave Taht
2016-05-19  8:37         ` [Make-wifi-fast] [PATCHv5 0/5] mac80211: implement fq_codel Michal Kazior
2016-05-19  8:37           ` [Make-wifi-fast] [PATCHv5 1/5] mac80211: skip netdev queue control with software queuing Michal Kazior
2016-05-19  8:37           ` [Make-wifi-fast] [PATCHv5 2/5] mac80211: implement fair queueing per txq Michal Kazior
2016-05-19  8:37           ` [Make-wifi-fast] [PATCHv5 3/5] mac80211: add debug knobs for fair queuing Michal Kazior
2016-05-19  8:37           ` [Make-wifi-fast] [PATCHv5 4/5] mac80211: implement codel on fair queuing flows Michal Kazior
2016-05-19  8:37           ` [Make-wifi-fast] [PATCHv5 5/5] mac80211: add debug knobs for codel Michal Kazior
2016-06-09  9:47             ` Johannes Berg
2016-05-31 12:12           ` [Make-wifi-fast] [PATCHv5 0/5] mac80211: implement fq_codel Toke Høiland-Jørgensen
2016-05-31 12:31             ` Michal Kazior
2016-06-09  9:49           ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/make-wifi-fast.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458123478-1795-4-git-send-email-michal.kazior@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=ath10k@lists.infradead.org \
    --cc=codel@lists.bufferbloat.net \
    --cc=dave.taht@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=make-wifi-fast@lists.bufferbloat.net \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    --cc=shep@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox