All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yibo Zhao <yiboz@codeaurora.org>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org,
	"Yibo Zhao" <yiboz@codeaurora.org>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>
Subject: [PATCH 3/4] mac80211: fix low throughput in push pull mode
Date: Mon, 16 Sep 2019 21:09:47 +0800	[thread overview]
Message-ID: <1568639388-27291-3-git-send-email-yiboz@codeaurora.org> (raw)
In-Reply-To: <1568639388-27291-1-git-send-email-yiboz@codeaurora.org>

If station is ineligible for transmission in ieee80211_txq_may_transmit(),
no packet will be delivered to FW. During the tests in push-pull mode with
many clients, after several seconds, not a single station is an eligible
candidate for transmission since global time is smaller than all the
station's virtual airtime. As a consequence, the Tx has been blocked and
throughput is quite low.

To avoid this situation to occur in push-pull mode, the new proposal is:

- Increase the airtime grace period a little more to reduce the
  unexpected sync

- If global virtual time is less than the virtual airtime of any station,
  sync it to the airtime of first station in the red-black tree

- Round the division result since the process of global virtual time
  involves the division calculation

Co-developed-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 net/mac80211/sta_info.c |  3 ++-
 net/mac80211/sta_info.h |  2 +-
 net/mac80211/tx.c       | 16 +++++++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 9d01fdd..feac975 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1852,7 +1852,8 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
 
 	weight_sum = local->airtime_weight_sum[ac] ?: sta->airtime_weight;
 
-	local->airtime_v_t[ac] += airtime / weight_sum;
+	/* Round the calculation of global vt */
+	local->airtime_v_t[ac] += (airtime + (weight_sum >> 1)) / weight_sum;
 	sta->airtime[ac].v_t += airtime / sta->airtime_weight;
 	ieee80211_resort_txq(&local->hw, txq);
 
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 5c1cac9..5055f94 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -130,7 +130,7 @@ enum ieee80211_agg_stop_reason {
 /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */
 #define AIRTIME_USE_TX		BIT(0)
 #define AIRTIME_USE_RX		BIT(1)
-#define AIRTIME_GRACE 500 /* usec of grace period before reset */
+#define AIRTIME_GRACE 2000 /* usec of grace period before reset */
 
 struct airtime_info {
 	u64 rx_airtime;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 42ca010..60cf569 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3867,15 +3867,29 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
 				struct ieee80211_txq *txq)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
-	struct txq_info *txqi = to_txq_info(txq);
+	struct txq_info *first_txqi, *txqi = to_txq_info(txq);
+	struct rb_node *node = NULL;
 	struct sta_info *sta;
 	u8 ac = txq->ac;
+	first_txqi = NULL;
 
 	lockdep_assert_held(&local->active_txq_lock[ac]);
 
 	if (!txqi->txq.sta)
 		return true;
 
+	node = rb_first_cached(&local->active_txqs[ac]);
+	if (node) {
+		first_txqi = container_of(node, struct txq_info,
+					  schedule_order);
+		if (first_txqi->txq.sta) {
+			sta = container_of(first_txqi->txq.sta,
+					   struct sta_info, sta);
+			if (local->airtime_v_t[ac] < sta->airtime[ac].v_t)
+				local->airtime_v_t[ac] = sta->airtime[ac].v_t;
+		}
+	}
+
 	sta = container_of(txqi->txq.sta, struct sta_info, sta);
 	return (sta->airtime[ac].v_t <= local->airtime_v_t[ac]);
 }
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Yibo Zhao <yiboz@codeaurora.org>
To: ath10k@lists.infradead.org
Cc: "Yibo Zhao" <yiboz@codeaurora.org>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	linux-wireless@vger.kernel.org
Subject: [PATCH 3/4] mac80211: fix low throughput in push pull mode
Date: Mon, 16 Sep 2019 21:09:47 +0800	[thread overview]
Message-ID: <1568639388-27291-3-git-send-email-yiboz@codeaurora.org> (raw)
In-Reply-To: <1568639388-27291-1-git-send-email-yiboz@codeaurora.org>

If station is ineligible for transmission in ieee80211_txq_may_transmit(),
no packet will be delivered to FW. During the tests in push-pull mode with
many clients, after several seconds, not a single station is an eligible
candidate for transmission since global time is smaller than all the
station's virtual airtime. As a consequence, the Tx has been blocked and
throughput is quite low.

To avoid this situation to occur in push-pull mode, the new proposal is:

- Increase the airtime grace period a little more to reduce the
  unexpected sync

- If global virtual time is less than the virtual airtime of any station,
  sync it to the airtime of first station in the red-black tree

- Round the division result since the process of global virtual time
  involves the division calculation

Co-developed-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 net/mac80211/sta_info.c |  3 ++-
 net/mac80211/sta_info.h |  2 +-
 net/mac80211/tx.c       | 16 +++++++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 9d01fdd..feac975 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1852,7 +1852,8 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
 
 	weight_sum = local->airtime_weight_sum[ac] ?: sta->airtime_weight;
 
-	local->airtime_v_t[ac] += airtime / weight_sum;
+	/* Round the calculation of global vt */
+	local->airtime_v_t[ac] += (airtime + (weight_sum >> 1)) / weight_sum;
 	sta->airtime[ac].v_t += airtime / sta->airtime_weight;
 	ieee80211_resort_txq(&local->hw, txq);
 
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 5c1cac9..5055f94 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -130,7 +130,7 @@ enum ieee80211_agg_stop_reason {
 /* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */
 #define AIRTIME_USE_TX		BIT(0)
 #define AIRTIME_USE_RX		BIT(1)
-#define AIRTIME_GRACE 500 /* usec of grace period before reset */
+#define AIRTIME_GRACE 2000 /* usec of grace period before reset */
 
 struct airtime_info {
 	u64 rx_airtime;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 42ca010..60cf569 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3867,15 +3867,29 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
 				struct ieee80211_txq *txq)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
-	struct txq_info *txqi = to_txq_info(txq);
+	struct txq_info *first_txqi, *txqi = to_txq_info(txq);
+	struct rb_node *node = NULL;
 	struct sta_info *sta;
 	u8 ac = txq->ac;
+	first_txqi = NULL;
 
 	lockdep_assert_held(&local->active_txq_lock[ac]);
 
 	if (!txqi->txq.sta)
 		return true;
 
+	node = rb_first_cached(&local->active_txqs[ac]);
+	if (node) {
+		first_txqi = container_of(node, struct txq_info,
+					  schedule_order);
+		if (first_txqi->txq.sta) {
+			sta = container_of(first_txqi->txq.sta,
+					   struct sta_info, sta);
+			if (local->airtime_v_t[ac] < sta->airtime[ac].v_t)
+				local->airtime_v_t[ac] = sta->airtime[ac].v_t;
+		}
+	}
+
 	sta = container_of(txqi->txq.sta, struct sta_info, sta);
 	return (sta->airtime[ac].v_t <= local->airtime_v_t[ac]);
 }
-- 
1.9.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  parent reply	other threads:[~2019-09-16 13:10 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 13:09 [PATCH 1/4] mac80211: Switch to a virtual time-based airtime scheduler Yibo Zhao
2019-09-16 13:09 ` Yibo Zhao
2019-09-16 13:09 ` [PATCH 2/4] mac80211: defer txqs removal from rbtree Yibo Zhao
2019-09-16 13:09   ` Yibo Zhao
2019-09-17 21:10   ` Toke Høiland-Jørgensen
2019-09-17 21:10     ` Toke Høiland-Jørgensen
2019-09-18 10:27     ` Yibo Zhao
2019-09-18 10:27       ` Yibo Zhao
2019-09-18 11:23       ` Toke Høiland-Jørgensen
2019-09-18 11:23         ` Toke Høiland-Jørgensen
2019-09-19  9:56         ` Yibo Zhao
2019-09-19  9:56           ` Yibo Zhao
2019-09-19 10:37           ` Toke Høiland-Jørgensen
2019-09-19 10:37             ` Toke Høiland-Jørgensen
2019-09-20  8:29             ` Yibo Zhao
2019-09-20  8:29               ` Yibo Zhao
2019-09-20  9:15               ` Toke Høiland-Jørgensen
2019-09-20  9:15                 ` Toke Høiland-Jørgensen
2019-09-21 10:49                 ` Yibo Zhao
2019-09-21 10:49                   ` Yibo Zhao
2019-09-21 11:27                   ` Toke Høiland-Jørgensen
2019-09-21 11:27                     ` Toke Høiland-Jørgensen
2019-09-21 11:53                     ` Yibo Zhao
2019-09-21 11:53                       ` Yibo Zhao
2019-09-21 12:22                     ` Yibo Zhao
2019-09-21 12:22                       ` Yibo Zhao
2019-09-21 13:02                       ` Toke Høiland-Jørgensen
2019-09-21 13:02                         ` Toke Høiland-Jørgensen
2019-09-21 13:24                         ` Yibo Zhao
2019-09-21 13:24                           ` Yibo Zhao
2019-09-21 14:00                           ` Toke Høiland-Jørgensen
2019-09-21 14:00                             ` Toke Høiland-Jørgensen
2019-09-22  5:19                             ` Yibo Zhao
2019-09-22  5:19                               ` Yibo Zhao
2019-09-23 10:47                               ` Toke Høiland-Jørgensen
2019-09-23 10:47                                 ` Toke Høiland-Jørgensen
2019-09-23 11:42                                 ` Kalle Valo
2019-09-23 11:42                                   ` Kalle Valo
2019-09-23 16:39                                   ` Toke Høiland-Jørgensen
2019-09-23 16:39                                     ` Toke Høiland-Jørgensen
2019-09-24  5:27                                     ` Kalle Valo
2019-09-24  5:27                                       ` Kalle Valo
2019-09-24  7:23                                       ` Toke Høiland-Jørgensen
2019-09-24  7:23                                         ` Toke Høiland-Jørgensen
2019-09-24  2:45                                 ` Yibo Zhao
2019-09-24  2:45                                   ` Yibo Zhao
2019-09-24  7:26                                   ` Toke Høiland-Jørgensen
2019-09-24  7:26                                     ` Toke Høiland-Jørgensen
2019-09-24  8:31                                     ` Yibo Zhao
2019-09-24  8:31                                       ` Yibo Zhao
2019-09-24  8:44                                       ` Toke Høiland-Jørgensen
2019-09-24  8:44                                         ` Toke Høiland-Jørgensen
2019-09-16 13:09 ` Yibo Zhao [this message]
2019-09-16 13:09   ` [PATCH 3/4] mac80211: fix low throughput in push pull mode Yibo Zhao
2019-09-16 15:27   ` Johannes Berg
2019-09-16 15:27     ` Johannes Berg
2019-09-17  6:36     ` Yibo Zhao
2019-09-17  6:36       ` Yibo Zhao
2019-09-17  6:55       ` Johannes Berg
2019-09-17  6:55         ` Johannes Berg
2019-09-17 21:12       ` Toke Høiland-Jørgensen
2019-09-17 21:12         ` Toke Høiland-Jørgensen
2019-09-18 10:02         ` Yibo Zhao
2019-09-18 10:02           ` Yibo Zhao
2019-09-18 10:16           ` Toke Høiland-Jørgensen
2019-09-18 10:16             ` Toke Høiland-Jørgensen
2019-09-18 10:18             ` Yibo Zhao
2019-09-18 10:18               ` Yibo Zhao
2019-09-16 13:09 ` [PATCH 4/4] mac80211: Sync airtime weight sum with per AC synced sta airtime weight together Yibo Zhao
2019-09-16 13:09   ` Yibo Zhao
2019-09-17 21:24   ` Toke Høiland-Jørgensen
2019-09-17 21:24     ` Toke Høiland-Jørgensen
2019-09-18 10:16     ` Yibo Zhao
2019-09-18 10:16       ` Yibo Zhao
2019-09-16 14:51 ` [PATCH 1/4] mac80211: Switch to a virtual time-based airtime scheduler Toke Høiland-Jørgensen
2019-09-16 14:51   ` Toke Høiland-Jørgensen
2019-09-17 21:31 ` Toke Høiland-Jørgensen
2019-09-17 21:31   ` Toke Høiland-Jørgensen
2019-09-20  8:37   ` Yibo Zhao
2019-09-20  8:37     ` Yibo Zhao

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

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

  git send-email \
    --in-reply-to=1568639388-27291-3-git-send-email-yiboz@codeaurora.org \
    --to=yiboz@codeaurora.org \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=toke@toke.dk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.