linux-wireless.vger.kernel.org archive mirror
 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 7/7] mac80211: only accumulate airtime deficit for active clients
Date: Sat, 25 Jun 2022 23:24:11 +0200	[thread overview]
Message-ID: <20220625212411.36675-7-nbd@nbd.name> (raw)
In-Reply-To: <20220625212411.36675-1-nbd@nbd.name>

When a client does not generate any local tx activity, accumulating airtime
deficit for the round-robin scheduler can be harmful. If this goes on for too
long, the deficit could grow quite large, which might cause unreasonable
initial latency once the client becomes active

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/sta_info.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 28ab55a072c6..c9852f71e8e1 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2046,6 +2046,7 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
 	struct ieee80211_local *local = sta->sdata->local;
 	u8 ac = ieee80211_ac_from_tid(tid);
 	u32 airtime = 0;
+	u32 diff;
 
 	if (sta->local->airtime_flags & AIRTIME_USE_TX)
 		airtime += tx_airtime;
@@ -2055,7 +2056,11 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
 	spin_lock_bh(&local->active_txq_lock[ac]);
 	sta->airtime[ac].tx_airtime += tx_airtime;
 	sta->airtime[ac].rx_airtime += rx_airtime;
-	sta->airtime[ac].deficit -= airtime;
+
+	diff = (u32)jiffies - sta->airtime[ac].last_active;
+	if (diff <= AIRTIME_ACTIVE_DURATION)
+		sta->airtime[ac].deficit -= airtime;
+
 	spin_unlock_bh(&local->active_txq_lock[ac]);
 }
 EXPORT_SYMBOL(ieee80211_sta_register_airtime);
-- 
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 ` [PATCH 3/7] mac80211: consider aql_tx_pending when checking airtime deficit Felix Fietkau
2022-06-27 15:02   ` 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 ` Felix Fietkau [this message]
2022-06-27 15:04   ` [PATCH 7/7] mac80211: only accumulate airtime deficit for active clients 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-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).