Implement Airtime-based Queue Limit (AQL)
v2 cover Implement Airtime-based Queue Limit (AQL)
This patch series implements Airtime-based Queue Limit (AQL) in the mac80211 and Ath10k driver. It is based on an earlier version from the ChromiumOS tree[0].
This version has been tested with QCA9884 platform with 4.14 kernel. Tests show AQL is able to reduce latency by an order of magnitude in a congested environment without negative impact on the throughput.
[0] https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1703105/7
Kan Yan (2):
mac80211: Implement Airtime-based Queue Limit (AQL)
ath10k: Enable Airtime-based Queue Limit (AQL)
drivers/net/wireless/ath/ath10k/htt_rx.c | 1 + drivers/net/wireless/ath/ath10k/mac.c | 8 ++- drivers/net/wireless/ath/ath10k/txrx.c | 13 +++- include/net/cfg80211.h | 7 +++ include/net/mac80211.h | 29 +++++++++ net/mac80211/debugfs.c | 78 ++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 44 +++++++++---- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 8 ++- net/mac80211/sta_info.c | 20 ++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 58 +++++++++++++++--- 12 files changed, 247 insertions(+), 27 deletions(-)
Signature · 4 lines
Changes from v1: - Fix checkpatch error. - Keep iterate the list of active_txq until an eligible txq's deficit become non-negative in ieee80211_next_txq(), instead of break the loop after one iteration. - Enforce the AQL limit in ath10k's pulling mode in ath10k_htt_rx_tx_fetch_ind()
PATCH v2 1/2 mac80211: Implement Airtime-based Queue Limit (AQL)
In order for the Fq_CoDel integrated in mac80211 layer operates effectively to control excessive queueing latency, the CoDel algorithm requires an accurate measure of how long the packets stays in the queue, aka sojourn time. The sojourn time measured at mac80211 layer doesn't include queueing latency in lower layer (firmware/hardware) and CoDel expects lower layer to have a short queue. However, most 802.11ac chipsets offload tasks such TX aggregation to firmware or hardware, thus have a deep lower layer queue. Without a mechanism to control the lower layer queue size, packets only stays in mac80211 layer transiently before being sent to firmware queue. As a result, the sojourn time measured by CoDel in the mac80211 layer is almost always lower than the CoDel latency target, hence CoDel does little to control the latency, even when the lower layer queue causes excessive latency.
Byte Queue limits (BQL) is commonly used to address the similar issue with wired network interface. However, this method cannot be applied directly to the wireless network interface. Byte is not a suitable measure of queue depth in the wireless network, as the data rate can vary dramatically from station to station in the same network, from a few Mbps to over Gbps.
This patch implemented an Airtime-based Queue Limit (AQL) to make CoDel works effectively with wireless drivers that utilized firmware/hardware offloading. AQL only allows each txq to release just enough packets to the lower layer to form 1-2 large aggregations to keep hardware fully utilized and keep the rest of frames in mac80211 layer to be controlled by the CoDel algorithm.
--- include/net/cfg80211.h | 7 ++++ include/net/mac80211.h | 29 ++++++++++++++ net/mac80211/debugfs.c | 78 ++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 44 +++++++++++++++------ net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 8 +++- net/mac80211/sta_info.c | 20 ++++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 58 +++++++++++++++++++++++----- 9 files changed, 231 insertions(+), 21 deletions(-)
include/net/cfg80211.h +7 -0
@@ -2499,6 +2499,13 @@ enum wiphy_params_flags {#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 +/* The per TXQ firmware queue limit in airtime */ +#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 4000 +#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 8000 + +/* The per interface airtime threshold to switch to lower queue limit */ +#define IEEE80211_AQL_THRESHOLD 24000 +/** * struct cfg80211_pmksa - PMK Security Association *
include/net/mac80211.h +29 -0
@@ -5543,6 +5543,35 @@ void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);void ieee80211_sta_register_airtime (struct ieee80211_sta *pubsta,u8 tid,u32 tx_airtime,u32 rx_airtime); +/** +* ieee80211_sta_update_pending_airtime - update txq's estimated airtime +* +* Update the estimated total airtime of frames queued in the lower layer queue. +* +* The airtime is estimated using frame length and the last reported data +* rate. The pending airtime for a txq is increased by the estimated +* airtime when the frame is relased to the lower layer, and decreased by the +* same amount at the tx completion event. +* +* @pubsta: the station +* @tid: the TID to register airtime for +* @tx_airtime: the estimated airtime (in usec) +*/ +void ieee80211_sta_update_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,s32 tx_airtime); + +/** +* ieee80211_txq_aql_check - check if a txq can send more frames to firmware +* +* @hw: pointer obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* +* Return true if the AQL's airtime limit has not been reached and the txq can +* continue to send more packets to the lower layer. Otherwise return false. +*/ +bool +ieee80211_txq_aql_check (struct ieee80211_hw *hw,struct ieee80211_txq *txq); +/** * ieee80211_iter_keys - iterate keys programmed into the device * @hw: pointer obtained from ieee80211_alloc_hw()
net/mac80211/debugfs.c +78 -0
90 lines not on this page · raw message
net/mac80211/debugfs_sta.c +33 -11
76 lines not on this page · raw message
net/mac80211/ieee80211_i.h +4 -0
@@ -1142,6 +1142,10 @@ struct ieee80211_local {u16 schedule_round[IEEE80211_NUM_ACS ];u16 airtime_flags; +u32 aql_txq_limit_low[IEEE80211_NUM_ACS ]; +u32 aql_txq_limit_high[IEEE80211_NUM_ACS ]; +u32 aql_threshold; +s32 aql_total_pending_airtime;const struct ieee80211_ops *ops;
net/mac80211/main.c +7 -1
@@ -666,8 +666,14 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,for (i =0 ; i <IEEE80211_NUM_ACS ; i++) {INIT_LIST_HEAD (&local->active_txqs[i]);spin_lock_init (&local->active_txq_lock[i]); + local->aql_txq_limit_low[i] =IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L ; + local->aql_txq_limit_high[i] = +IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H ; } - local->airtime_flags =AIRTIME_USE_TX |AIRTIME_USE_RX ; + + local->airtime_flags = +AIRTIME_USE_TX |AIRTIME_USE_RX |AIRTIME_USE_AQL ; + local->aql_threshold =IEEE80211_AQL_THRESHOLD ;INIT_LIST_HEAD (&local->chanctx_list);mutex_init (&local->chanctx_mtx);
net/mac80211/sta_info.c +20 -0
@@ -396,6 +396,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,skb_queue_head_init (&sta->ps_tx_buf[i]);skb_queue_head_init (&sta->tx_filtered[i]); sta->airtime[i].deficit = sta->airtime_weight; + sta->airtime[i].aql_tx_pending =0 ; + sta->airtime[i].aql_limit_low = local->aql_txq_limit_low[i]; + sta->airtime[i].aql_limit_high = local->aql_txq_limit_high[i]; }for (i =0 ; i <IEEE80211_NUM_TIDS ; i++)
@@ -1894,6 +1897,23 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, }EXPORT_SYMBOL (ieee80211_sta_register_airtime); +void ieee80211_sta_update_pending_airtime (struct ieee80211_sta *pubsta,u8 tid, +s32 tx_airtime) +{ +u8 ac =ieee80211_ac_from_tid (tid); + struct sta_info *sta = container_of(pubsta, struct sta_info, sta); +struct ieee80211_local *local = sta->local; + +spin_lock_bh (&local->active_txq_lock[ac]); + sta->airtime[ac].aql_tx_pending += tx_airtime; + local->aql_total_pending_airtime += tx_airtime; +WARN_ONCE (sta->airtime[ac].aql_tx_pending <0 ,"STA pending airtime < 0" ); +WARN_ONCE (local->aql_total_pending_airtime <0 , +"Total pending airtime < 0" ); +spin_unlock_bh (&local->active_txq_lock[ac]); +} +EXPORT_SYMBOL (ieee80211_sta_update_pending_airtime); +int sta_info_move_state (struct sta_info *sta,enum ieee80211_sta_state new_state) {
net/mac80211/sta_info.h +4 -0
@@ -127,11 +127,15 @@ 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_USE_AQL BIT(2)struct airtime_info {u64 rx_airtime;u64 tx_airtime;s64 deficit; +s32 aql_tx_pending;/* Estimated airtime for frames pending in queue */ +u32 aql_limit_low; +u32 aql_limit_high; };struct sta_info ;
net/mac80211/tx.c +49 -9
102 lines not on this page · raw message
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Johannes Berg
maintainerRe: [PATCH v2 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 8 lines · Kan Yan
+/**
+ *ieee80211_sta_update_pending_airtime- update txq's estimated airtime
+ *
+ * Update the estimated total airtime of frames queued in the lower layer queue.
+ *
+ * The airtime is estimated using frame length and the last reported data
+ * rate. The pending airtime for a txq is increased by the estimated
+ * airtime when the frame is relased to the lower layer, and decreased by the
typo - released.
Quoted 1 line
+ * same amount at the tx completion event.
I think this isn't really all that clear, "The airtime is [...] decreased by the same amount at the tx completion event." makes it sound like that is implicit? But that's not true, this needs to be called at that point, afaict?
I'm not sure why you decided to not add the inlines I suggested, but I still think it'd be clearer to have them to indicate that both need to be called.
Some note should probably also be there that we really want to decrease later again with the same value that it was increased with, not with the actual airtime that's now known due to the TX completion, right?
Quoted 3 lines
+ *
+ * @pubsta: the station
+ * @tid: the TID to register airtime for
s/register/update/ now, I guess
Quoted 2 lines
+/**
+ *ieee80211_txq_aql_check- check if a txq can send more frames to firmware
s/firmware/device/ IMHO
net/mac80211/debugfs.c static const struct file_operations aqm_ops = { · line 186
Quoted 9 lines
net/mac80211/debugfs.c +9
-0+static ssize_t aql_txq_limit_write (struct file *file, +const char __user *user_buf, +size_t count, +loff_t *ppos) +{ +struct ieee80211_local *local = file->private_data; +char buf[100 ]; +size_t len; +u32 ac, q_limit_low, q_limit_high;
use a space here please, not a tab
net/mac80211/debugfs.c static const struct file_operations aqm_ops = { · line 198
Quoted 12 lines
net/mac80211/debugfs.c +12
-0+struct sta_info *sta; + +if (count >sizeof (buf)) +return -EINVAL ; + +if (copy_from_user (buf, user_buf, count)) +return -EFAULT ; + + buf[sizeof (buf) -1 ] ='\0' ; + len =strlen (buf); +if (len >0 && buf[len -1 ] =='\n' ) + buf[len -1 ] =0 ;
You could use "0" and "'\0'" consistently - I'd prefer just plain 0, but here you have two spellings within 4 lines ;-)
net/mac80211/debugfs_sta.c static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, · line 271
Quoted 6 lines
net/mac80211/debugfs_sta.c +0
-1@@ -245,7 +268,6 @@ static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, sta->airtime[ac].deficit = sta->airtime_weight;spin_unlock_bh (&local->active_txq_lock[ac]); } -return count;
better leave that
net/mac80211/sta_info.c void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, · line 1912
Quoted 13 lines
net/mac80211/sta_info.c +13
-0+void ieee80211_sta_update_pending_airtime (struct ieee80211_sta *pubsta,u8 tid, +s32 tx_airtime) +{ +u8 ac =ieee80211_ac_from_tid (tid); + struct sta_info *sta = container_of(pubsta, struct sta_info, sta); +struct ieee80211_local *local = sta->local; + +spin_lock_bh (&local->active_txq_lock[ac]); + sta->airtime[ac].aql_tx_pending += tx_airtime; + local->aql_total_pending_airtime += tx_airtime; +WARN_ONCE (sta->airtime[ac].aql_tx_pending <0 ,"STA pending airtime < 0" ); +WARN_ONCE (local->aql_total_pending_airtime <0 , +"Total pending airtime < 0" );
I think you should reset them if the warning happens?
net/mac80211/sta_info.h enum ieee80211_agg_stop_reason { · line 136
Quoted 12 lines
+++
b/net/mac80211/sta_info.hnet/mac80211/sta_info.h +2
-0@@ -127,11 +127,15 @@ 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_USE_AQL BIT(2)struct airtime_info {u64 rx_airtime;u64 tx_airtime;s64 deficit; +s32 aql_tx_pending;/* Estimated airtime for frames pending in queue */
This doesn't make sense as an s32. I realize you need it above for the warning, but you can check for underflow before doing the calculation and keep the storage unsigned.
Quoted 11 lines
net/mac80211/tx.c +11
-0+bool ieee80211_txq_aql_check (struct ieee80211_hw *hw, +struct ieee80211_txq *txq) +{ +struct sta_info *sta; +struct ieee80211_local *local =hw_to_local (hw); + +if (!(local->airtime_flags &AIRTIME_USE_AQL )) +return true; + +if (!txq->sta) +return true;
net/mac80211/tx.c void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3776
Quoted 10 lines
net/mac80211/tx.c +10
-0+ + sta = container_of(txq->sta, struct sta_info, sta); +if (sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_low || + (local->aql_total_pending_airtime < local->aql_threshold && + sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_high)) +return true; +else +return false;
This is a massive expression ... IMHO it'd be clearer as either splitting it up into pieces ("if (first) return true; if (second) return true; return false;") or just returning the value of the expression?
if (x) return true; else return false;
is just
return x;
after all.
johannes
Re: [PATCH v2 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Kan YanQuoted 16 lines
net/mac80211/tx.c +2
-1@@ -3669,7 +3669,8 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) {struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_txq *ret =NULL ; -struct txq_info *txqi =NULL ; +struct txq_info *txqi =NULL , *head =NULL ; +bool found_eligible_txq = false;spin_lock_bh (&local->active_txq_lock[ac]);
net/mac80211/tx.c struct ieee80211_txq · line 3686
Quoted 6 lines
net/mac80211/tx.c +2
-0@@ -3680,20 +3681,32 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)if (!txqi) goto out; +if (txqi == head && !found_eligible_txq) + goto out;
I assume here the only txq in the list that does not meet AQL check will not be dequeued. Right? Will it affect peak throughput once there is only one station.
How about dequeuing it anyway regardless AQL because it is the only one active now so it is fine to occupy the rest bandwidth. Otherwise, I am afraid next_txq() will return NULL in the test only one station is present.
net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct · line 3790
Quoted 10 lines
net/mac80211/tx.c +1
-3@@ -3748,10 +3785,10 @@ bool ieee80211_txq_may_transmit(structieee80211_hw *hw, struct sta_info *sta;u8 ac = txq->ac; -spin_lock_bh (&local->active_txq_lock[ac]); -if (!txqi->txq.sta) - goto out; +return true;
why return here? I think even a txq without sta info should get removed from list and added it back later in return_txq() if needed. No?
Quoted 5 lines
net/mac80211/tx.c +2
-0+ +spin_lock_bh (&local->active_txq_lock[ac]);if (list_empty (&txqi->schedule_order))goto out;
Signature · 1 line
Yibo
Re: [PATCH v2 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Hi Johannes,
Thanks for the review and will address all issues you pointed out in the next version.
Hi Yibo,
Quoted 4 lines
I assume here the only txq in the list that does not meet AQL check will not be dequeued. Right? Will it affect peak throughput once there is only one station.
Yes, the txq won't be picked for transmitting even if it is the only active txq if the AQL check failed. However, this won't affect peak throughput. The reason why there are two queue limits is address this kind of situation. The higher queue limit ensures the hardware get enough frames.
Quoted 6 lines
Quoted 6 lines
net/mac80211/tx.c +0
-0@@ -3748,10 +3785,10 @@ bool ieee80211_txq_may_transmit(structieee80211_hw *hw, struct sta_info *sta;u8 ac = txq->ac;
Quoted 8 lines
net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3789
Quoted 5 lines
net/mac80211/tx.c +1
-3-spin_lock_bh (&local->active_txq_lock[ac]); -if (!txqi->txq.sta) - goto out; +return true;why return here? I think even a txq without sta info should get removed from list and added it back later in
return_txq()if needed. No?
Yes, it should be removed from the active list. I will fix that.
Thanks,
Kan
Quoted 56 lines · Yibo Zhao
Quoted 17 lines
net/mac80211/tx.c +2
-1@@ -3669,7 +3669,8 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) {struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_txq *ret =NULL ; -struct txq_info *txqi =NULL ; +struct txq_info *txqi =NULL , *head =NULL ; +bool found_eligible_txq = false;spin_lock_bh (&local->active_txq_lock[ac]);net/mac80211/tx.c struct ieee80211_txq · line 3686
Quoted 6 lines
net/mac80211/tx.c +2
-0@@ -3680,20 +3681,32 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)if (!txqi) goto out; +if (txqi == head && !found_eligible_txq) + goto out;I assume here the only txq in the list that does not meet AQL check will not be dequeued. Right? Will it affect peak throughput once there is only one station.
How about dequeuing it anyway regardless AQL because it is the only one active now so it is fine to occupy the rest bandwidth. Otherwise, I am afraid
next_txq()will return NULL in the test only one station is present.net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct · line 3790
Quoted 10 lines
net/mac80211/tx.c +1
-3@@ -3748,10 +3785,10 @@ bool ieee80211_txq_may_transmit(structieee80211_hw *hw, struct sta_info *sta;u8 ac = txq->ac; -spin_lock_bh (&local->active_txq_lock[ac]); -if (!txqi->txq.sta) - goto out; +return true;why return here? I think even a txq without sta info should get removed from list and added it back later in
return_txq()if needed. No?Quoted 5 lines
net/mac80211/tx.c +2
-0+ +spin_lock_bh (&local->active_txq_lock[ac]);if (list_empty (&txqi->schedule_order))goto out;--
Yibo
Re: [PATCH v2 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 11 lines · Kan Yan
Hi Johannes,
Thanks for the review and will address all issues you pointed out in the next version.
Hi Yibo,
Quoted 4 lines
I assume here the only txq in the list that does not meet AQL check will not be dequeued. Right? Will it affect peak throughput once there is only one station.
Quoted 5 lines
Yes, the txq won't be picked for transmitting even if it is the only active txq if the AQL check failed. However, this won't affect peak throughput. The reason why there are two queue limits is address this kind of situation. The higher queue limit ensures the hardware get enough frames.
I see, higher queue limit keeps hardware from starvation.
Quoted 77 lines
Quoted 6 lines
Quoted 6 lines
net/mac80211/tx.c +0
-0@@ -3748,10 +3785,10 @@ bool ieee80211_txq_may_transmit(structieee80211_hw *hw, struct sta_info *sta;u8 ac = txq->ac;Quoted 8 lines
net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3789
Quoted 5 lines
net/mac80211/tx.c +1
-3-spin_lock_bh (&local->active_txq_lock[ac]); -if (!txqi->txq.sta) - goto out; +return true;why return here? I think even a txq without sta info should get removed from list and added it back later in
return_txq()if needed. No?Yes, it should be removed from the active list. I will fix that.
Thanks,
KanQuoted 56 lines · Yibo Zhao
Quoted 17 lines
net/mac80211/tx.c +2
-1@@ -3669,7 +3669,8 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) {struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_txq *ret =NULL ; -struct txq_info *txqi =NULL ; +struct txq_info *txqi =NULL , *head =NULL ; +bool found_eligible_txq = false;spin_lock_bh (&local->active_txq_lock[ac]);net/mac80211/tx.c struct ieee80211_txq · line 3686
Quoted 6 lines
net/mac80211/tx.c +2
-0@@ -3680,20 +3681,32 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)if (!txqi) goto out; +if (txqi == head && !found_eligible_txq) + goto out;I assume here the only txq in the list that does not meet AQL check will not be dequeued. Right? Will it affect peak throughput once there is only one station.
How about dequeuing it anyway regardless AQL because it is the only one active now so it is fine to occupy the rest bandwidth. Otherwise, I am afraid
next_txq()will return NULL in the test only one station is present.net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct · line 3790
Quoted 10 lines
net/mac80211/tx.c +1
-3@@ -3748,10 +3785,10 @@ bool ieee80211_txq_may_transmit(structieee80211_hw *hw, struct sta_info *sta;u8 ac = txq->ac; -spin_lock_bh (&local->active_txq_lock[ac]); -if (!txqi->txq.sta) - goto out; +return true;why return here? I think even a txq without sta info should get removed from list and added it back later in
return_txq()if needed. No?Quoted 5 lines
net/mac80211/tx.c +2
-0+ +spin_lock_bh (&local->active_txq_lock[ac]);if (list_empty (&txqi->schedule_order))goto out;--
Yibo
Signature · 1 line
Yibo
PATCH v2 2/2 ath10k: Enable Airtime-based Queue Limit (AQL)
In reply to Kan YanCalculate the estimated airtime pending in the txqs and apply AQL to prevent excessive amounts of packets being queued in the firmware queue.
--- drivers/net/wireless/ath/ath10k/htt_rx.c | 1 + drivers/net/wireless/ath/ath10k/mac.c | 8 +++++--- drivers/net/wireless/ath/ath10k/txrx.c | 13 ++++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath10k/htt_rx.c +1 -0
@@ -3053,6 +3053,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) num_msdus++; num_bytes += ret; + may_tx =ieee80211_txq_aql_check (hw, txq); }ieee80211_return_txq (hw, txq, false);ieee80211_txq_schedule_end (hw, txq->ac);
drivers/net/wireless/ath/ath10k/mac.c +5 -3
@@ -3983,6 +3983,9 @@ static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw,struct ath10k_txq *artxq = (void *)txq->drv_priv;/* No need to get locks */ +if (!ieee80211_txq_aql_check (hw, txq)) +return false; +if (ar->htt.tx_q_state.mode ==HTT_TX_MODE_SWITCH_PUSH )return true;
@@ -4009,13 +4012,11 @@ static u16 ath10k_mac_update_airtime(struct ath10k *ar, {struct ath10k_sta *arsta;u32 pktlen; -u16 airtime =0 ; +s32 airtime =0 ;if (!txq || !txq->sta)return airtime; -if (test_bit (WMI_SERVICE_REPORT_AIRTIME , ar->wmi.svc_map)) -return airtime;spin_lock_bh (&ar->data_lock); arsta = (struct ath10k_sta *)txq->sta->drv_priv;
@@ -4038,6 +4039,7 @@ static u16 ath10k_mac_update_airtime(struct ath10k *ar, }spin_unlock_bh (&ar->data_lock); +ieee80211_sta_update_pending_airtime (txq->sta, txq->tid, airtime);return airtime; }
drivers/net/wireless/ath/ath10k/txrx.c +10 -3
@@ -84,9 +84,16 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,wake_up (&htt->empty_tx_wq);spin_unlock_bh (&htt->tx_lock); -if (txq && txq->sta && skb_cb->airtime_est) -ieee80211_sta_register_airtime (txq->sta, txq->tid, - skb_cb->airtime_est,0 ); +if (txq && txq->sta && skb_cb->airtime_est) { +s32 airtime = -skb_cb->airtime_est; + +if (!test_bit (WMI_SERVICE_REPORT_AIRTIME , ar->wmi.svc_map)) +ieee80211_sta_register_airtime (txq->sta, txq->tid, + skb_cb->airtime_est,0 ); + +ieee80211_sta_update_pending_airtime (txq->sta, txq->tid, + airtime); + }if (ar->bus_param.dev_type !=ATH10K_DEV_TYPE_HL )dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE );
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Re: [PATCH v2 2/2] ath10k: Enable Airtime-based Queue Limit (AQL)
Quoted 4 lines · Kan Yan
Calculate the estimated airtime pending in the txqs and apply AQL to prevent excessive amounts of packets being queued in the firmware queue.
Signed-off-by Kan Yan <[email protected]>
Please CC ath10k patches to ath10k list, I doubt all ath10k developers follow linux-wireless.
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches