Skip to content

Commit 9c1be3c

Browse files
nbd168jmberg-intel
authored andcommitted
wifi: mac80211: consider aql_tx_pending when checking airtime deficit
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 <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 445452d commit 9c1be3c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

net/mac80211/tx.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -3800,6 +3800,13 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
38003800
}
38013801
EXPORT_SYMBOL(ieee80211_tx_dequeue);
38023802

3803+
static inline s32 ieee80211_sta_deficit(struct sta_info *sta, u8 ac)
3804+
{
3805+
struct airtime_info *air_info = &sta->airtime[ac];
3806+
3807+
return air_info->deficit - atomic_read(&air_info->aql_tx_pending);
3808+
}
3809+
38033810
struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
38043811
{
38053812
struct ieee80211_local *local = hw_to_local(hw);
@@ -3830,7 +3837,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
38303837
struct sta_info *sta = container_of(txqi->txq.sta,
38313838
struct sta_info, sta);
38323839
bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq);
3833-
s32 deficit = sta->airtime[txqi->txq.ac].deficit;
3840+
s32 deficit = ieee80211_sta_deficit(sta, txqi->txq.ac);
38343841

38353842
if (aql_check)
38363843
found_eligible_txq = true;
@@ -3955,7 +3962,7 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
39553962
continue;
39563963
}
39573964
sta = container_of(iter->txq.sta, struct sta_info, sta);
3958-
if (sta->airtime[ac].deficit < 0)
3965+
if (ieee80211_sta_deficit(sta, ac) < 0)
39593966
sta->airtime[ac].deficit += sta->airtime_weight;
39603967
list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
39613968
}

0 commit comments

Comments
 (0)