All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Cc: toke@kernel.org, johannes@sipsolutions.net
Subject: [PATCH 3/7] mac80211: consider aql_tx_pending when checking airtime deficit
Date: Sat, 25 Jun 2022 23:24:07 +0200	[thread overview]
Message-ID: <20220625212411.36675-3-nbd@nbd.name> (raw)
In-Reply-To: <20220625212411.36675-1-nbd@nbd.name>

When queueing packets for a station, deficit only gets added once the packets
have been transmitted, which could be much later. During that time, a lot of
temporary unfairness could happen, which could lead to bursty behavior.
Fix this by subtracting the aql_tx_pending when checking the deficit in tx
scheduling.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/tx.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index a615cadf7728..0509486ac40a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3800,6 +3800,13 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(ieee80211_tx_dequeue);
 
+static inline s32 ieee80211_sta_deficit(struct sta_info *sta, u8 ac)
+{
+	struct airtime_info *air_info = &sta->airtime[ac];
+
+	return air_info->deficit - atomic_read(&air_info->aql_tx_pending);
+}
+
 struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
 {
 	struct ieee80211_local *local = hw_to_local(hw);
@@ -3830,7 +3837,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
 		struct sta_info *sta = container_of(txqi->txq.sta,
 						    struct sta_info, sta);
 		bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq);
-		s32 deficit = sta->airtime[txqi->txq.ac].deficit;
+		s32 deficit = ieee80211_sta_deficit(sta, txqi->txq.ac);
 
 		if (aql_check)
 			found_eligible_txq = true;
@@ -3955,7 +3962,7 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
 			continue;
 		}
 		sta = container_of(iter->txq.sta, struct sta_info, sta);
-		if (sta->airtime[ac].deficit < 0)
+		if (ieee80211_sta_deficit(sta, ac) < 0)
 			sta->airtime[ac].deficit += sta->airtime_weight;
 		list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
 	}
-- 
2.36.1


  parent reply	other threads:[~2022-06-25 21:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 21:24 [PATCH 1/7] mac80211: switch airtime fairness back to deficit round-robin scheduling Felix Fietkau
2022-06-25 21:24 ` [PATCH 2/7] mac80211: make sta airtime deficit field s32 instead of s64 Felix Fietkau
2022-06-27 15:02   ` Toke Høiland-Jørgensen
2022-06-25 21:24 ` Felix Fietkau [this message]
2022-06-27 15:02   ` [PATCH 3/7] mac80211: consider aql_tx_pending when checking airtime deficit Toke Høiland-Jørgensen
2022-06-25 21:24 ` [PATCH 4/7] mac80211: keep recently active tx queues in scheduling list Felix Fietkau
2022-06-27 15:03   ` Toke Høiland-Jørgensen
2022-06-25 21:24 ` [PATCH 5/7] mac80211: add a per-PHY AQL limit to improve fairness Felix Fietkau
2022-06-27 15:04   ` Toke Høiland-Jørgensen
2022-06-25 21:24 ` [PATCH 6/7] mac80211: add debugfs file to display per-phy AQL pending airtime Felix Fietkau
2022-06-27 15:04   ` Toke Høiland-Jørgensen
2022-06-25 21:24 ` [PATCH 7/7] mac80211: only accumulate airtime deficit for active clients Felix Fietkau
2022-06-27 15:04   ` Toke Høiland-Jørgensen
2022-06-27 15:02 ` [PATCH 1/7] mac80211: switch airtime fairness back to deficit round-robin scheduling Toke Høiland-Jørgensen

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=20220625212411.36675-3-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=toke@kernel.org \
    /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.