Implement Airtime-based Queue Limit (AQL)
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/mac.c | 7 ++- drivers/net/wireless/ath/ath10k/txrx.c | 12 +++- include/net/cfg80211.h | 7 +++ include/net/mac80211.h | 34 +++++++++++ net/mac80211/debugfs.c | 79 ++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 43 ++++++++++---- net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 7 ++- net/mac80211/sta_info.c | 23 ++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 60 +++++++++++++++---- 11 files changed, 253 insertions(+), 27 deletions(-)
PATCH 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 released to firmware due to the deep queue in the lower layer. In this case, the sojourn time measured by CoDel in the mac80211 layer is always lower than the CoDel latency target hence it 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 can not 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 1 Gbps.
This patch implemented an Airtime-based Queue Limit (AQL) to make CoDel works effectively with wireless drivers that utilized firmware/hardware offloading. It only allows each txq to release just enough packets to form 1-2 large aggregations to keep hardware fully utilized and keep the rest of frames in mac80211 layer to be controlled by CoDel.
--- include/net/cfg80211.h | 7 ++++ include/net/mac80211.h | 34 ++++++++++++++++ net/mac80211/debugfs.c | 79 ++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 43 +++++++++++++++------ net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 7 +++- net/mac80211/sta_info.c | 23 +++++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 60 ++++++++++++++++++++++++----- 9 files changed, 239 insertions(+), 22 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 firmware's transmit queue size limit in airtime */ +#define IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT 24000 +/** * struct cfg80211_pmksa - PMK Security Association *
include/net/mac80211.h +34 -0
@@ -5543,6 +5543,40 @@ 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_register_pending_airtime - register the estimated airtime for +* the frames pending in lower layer (firmware/hardware) txq. +* +* Update the total pending airtime of the frames released to firmware. The +* pending airtime is used by AQL to control queue size in the lower layer. +* +* 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) +* @tx_commpleted: true if called from the tx completion event. +*/ +void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed); + +/** +* ieee80211_txq_aritme_check - check if the airtime limit of AQL (Airtime based +* queue limit) has been reached. +* @hw: pointer obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* Retrun true if the queue limit has not been reached and txq can continue to +* release packets to the lower layer. +* Return false if the queue limit has been reached and the txq should not +* release more frames to the lower layer. +*/ +bool +ieee80211_txq_airtime_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 +79 -0
91 lines not on this page · raw message
net/mac80211/debugfs_sta.c +32 -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_interface_limit; +s32 aql_total_pending_airtime;const struct ieee80211_ops *ops;
net/mac80211/main.c +6 -1
@@ -666,8 +666,13 @@ 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_interface_limit =IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT ;INIT_LIST_HEAD (&local->chanctx_list);mutex_init (&local->chanctx_mtx);
net/mac80211/sta_info.c +23 -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,26 @@ void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, }EXPORT_SYMBOL (ieee80211_sta_register_airtime); +void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed) +{ +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]); +if (tx_completed) { + sta->airtime[ac].aql_tx_pending -= tx_airtime; + local->aql_total_pending_airtime -= tx_airtime; + }else { + sta->airtime[ac].aql_tx_pending += tx_airtime; + local->aql_total_pending_airtime += tx_airtime; + } +spin_unlock_bh (&local->active_txq_lock[ac]); +} +EXPORT_SYMBOL (ieee80211_sta_register_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 +50 -10
105 lines not on this page · raw message
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
PATCH 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/mac.c | 7 +++++-- drivers/net/wireless/ath/ath10k/txrx.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +5 -2
@@ -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_airtime_check (hw, txq)) +return false; +if (ar->htt.tx_q_state.mode ==HTT_TX_MODE_SWITCH_PUSH )return true;
@@ -4014,8 +4017,6 @@ static u16 ath10k_mac_update_airtime(struct ath10k *ar,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,8 @@ static u16 ath10k_mac_update_airtime(struct ath10k *ar, }spin_unlock_bh (&ar->data_lock); +ieee80211_sta_register_pending_airtime (txq->sta, txq->tid, airtime, + false);return airtime; }
drivers/net/wireless/ath/ath10k/txrx.c +9 -3
@@ -84,9 +84,15 @@ 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) { +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_register_pending_airtime (txq->sta, txq->tid, + skb_cb->airtime_est, + true); + }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
Johannes Berg
maintainerRe: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Kan YanJust took a very brief look so I can think about it while offline ;-)
But some (editorial) comments:
Quoted 3 lines
+/**
+ *ieee80211_sta_register_pending_airtime- register the estimated airtime for
+ * the frames pending in lower layer (firmware/hardware) txq.
That doesn't work - the short description must be on a single line.
Quoted 2 lines
+ * Update the total pending airtime of the frames released to firmware. The
+ * pending airtime is used by AQL to control queue size in the lower layer.
What does "released to firmware" mean? I guess it should either be something like "transmitted by the device" or "sitting on the hardware queues" - I'm guessing the latter?
include/net/mac80211.h void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); · line 5565
Quoted 13 lines
+ * 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)
+ * @tx_commpleted: true if called from the tx completion event.
+ */include/net/mac80211.h +3
-0+void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed);
The "bool tx_completed" is a bit confusing IMHO.
Probably better to do something like this:
void ieee80211_sta_update_pending_airtime(sta, tid, *s32* airtime);
static inline void ieee80211_sta_register_pending_airtime(...)
{
ieee80211_sta_update_pending_airtime(..., airtime);
}static inline void ieee80211_sta_release_pending_airtime(...)
{
ieee80211_sta_update_pending_airtime(..., -airtime);
}
or something like that?
Quoted 3 lines
+/**
+ *ieee80211_txq_aritme_check- check if the airtime limit of AQL (Airtime based
+ * queue limit) has been reached.
same comment as above - and there's a typo
Quoted 3 lines
+ * @hw: pointer obtained from
ieee80211_alloc_hw()
+ * @txq: pointer obtained from station or virtual interface
+ * Retrun
typo
include/net/mac80211.h void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); · line 5578
Quoted 7 lines
true if the queue limit has not been reached and txq can continue to
+ * release packets to the lower layer.
+ * Return false if the queue limit has been reached and the txq should not
+ * release more frames to the lower layer.
+ */include/net/mac80211.h +2
-0+bool +ieee80211_txq_airtime_check (struct ieee80211_hw *hw,struct ieee80211_txq *txq);
Why is it necessary to call this, vs. just returning NULL when an SKB is requested?
Quoted 15 lines
net/mac80211/debugfs.c +15
-0+static ssize_t aql_txq_limit_read (struct file *file, +char __user *user_buf, +size_t count, +loff_t *ppos) +{ +struct ieee80211_local *local = file->private_data; +char buf[400 ]; +int len =0 ; + +rcu_read_lock (); + len =scnprintf (buf,sizeof (buf), +"AC AQL limit low AQL limit high\n" +"0 %u %u\n" +"1 %u %u\n" + "2 %u %u\n"
net/mac80211/debugfs.c static const struct file_operations aqm_ops = { · line 175
Quoted 10 lines
net/mac80211/debugfs.c +10
-0+"3 %u %u\n" , + local->aql_txq_limit_low[0 ], + local->aql_txq_limit_high[0 ], + local->aql_txq_limit_low[1 ], + local->aql_txq_limit_high[1 ], + local->aql_txq_limit_low[2 ], + local->aql_txq_limit_high[2 ], + local->aql_txq_limit_low[3 ], + local->aql_txq_limit_high[3]); +rcu_read_unlock ();
I don't understand the RCI critical section here, you do nothing that would require it.
Quoted 18 lines
net/mac80211/debugfs.c +18
-0+return simple_read_from_buffer (user_buf, count, ppos, + buf, len); +} + +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; +struct sta_info *sta; + +if (count >sizeof (buf)) +return -EINVAL ; +
net/mac80211/debugfs.c static const struct file_operations aqm_ops = { · line 203
Quoted 10 lines
net/mac80211/debugfs.c +10
-0+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 ; + +if (sscanf (buf,"%u %u %u" , &ac, &q_limit_low, &q_limit_high) ==3 ) { +if (ac <IEEE80211_NUM_ACS ) {
The double indentation is a bit odd here - why not return -EINVAL immediately if any of the checks doesn't work?
if (sscanf(...) != 3)
return -EINVAL;
if (ac >= NUM_ACS)
return -EINVAL;
[...]
net/mac80211/debugfs_sta.c static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, · line 256
Quoted 4 lines
net/mac80211/debugfs_sta.c +4
-0+ buf[sizeof (_buf) -1 ] ='\0' ; +if (sscanf (buf,"queue limit %u %u %u" , &ac, &q_limit_l, &q_limit_h) + ==3 ) { +if (ac <IEEE80211_NUM_ACS ) {
same here
net/mac80211/debugfs_sta.c static ssize_t sta_airtime_write(struct file *file, const char __user *userbuf, · line 271
Quoted 8 lines
net/mac80211/debugfs_sta.c +1
-1@@ -245,8 +266,8 @@ 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; + }
spurious change
net/mac80211/sta_info.c void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, · line 1911
Quoted 12 lines
net/mac80211/sta_info.c +12
-0+void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed) +{ +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]); +if (tx_completed) { + sta->airtime[ac].aql_tx_pending -= tx_airtime; + local->aql_total_pending_airtime -= tx_airtime;
maybe this should check for underflow, just in case the driver has some symmetry bug?
net/mac80211/tx.c void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3754
Quoted 7 lines
net/mac80211/tx.c +7
-0+bool ieee80211_txq_airtime_check (struct ieee80211_hw *hw, +struct ieee80211_txq *txq) +{ +struct sta_info *sta; +struct ieee80211_local *local =hw_to_local (hw); + +
please remove one blank line
Quoted 21 lines
bool ieee80211_txq_may_transmit(struct
ieee80211_hw*hw,net/mac80211/tx.c +6
-3struct ieee80211_txq *txq) {@@ -3748,10 +3784,13 @@ bool ieee80211_txq_may_transmit(struct ieee80211_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; + +if (!(local->airtime_flags &AIRTIME_USE_TX )) +return true; + +spin_lock_bh (&local->active_txq_lock[ac]);if (list_empty (&txqi->schedule_order)) goto out;
net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3816
Quoted 6 lines
net/mac80211/tx.c +1
-1@@ -3773,10 +3812,11 @@ bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, } sta = container_of(txqi->txq.sta, struct sta_info, sta); -if (sta->airtime[ac].deficit >=0 ) +if (ieee80211_txq_airtime_check (hw, &txqi->txq)) goto out;
OK, so you *do* call it here, but then why are you exporting it too?
net/mac80211/tx.c bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3819
Quoted 3 lines
net/mac80211/tx.c +2
-1- sta->airtime[ac].deficit += sta->airtime_weight; +if (sta->airtime[ac].deficit <0 ) + sta->airtime[ac].deficit += sta->airtime_weight;
something seems wrong with indentation here (spaces instead of tabs?)
Anyway, like I said - very cursory and mostly editorial view.
Thanks,
johannes
Johannes Berg
maintainerRe: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Kan Yaninclude/net/cfg80211.h enum wiphy_params_flags { · line 2507
Quoted 3 lines · Kan Yan
include/net/cfg80211.h +2
-0+/* The firmware's transmit queue size limit in airtime */ +#define IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT 24000
I'm not sure I understand this completely, but IMHO rewording it to be like a "NIC limit" would be better.
However, I'm not sure it *shouldn't* actually be per interface (i.e. moving from
local->aql_total_pending_airtime to sdata->aql_total_pending_airtime
because you could have multiple channels etc. involved and then using a single airtime limit across two interfaces that are actually on two different channels (e.g. 2.4 and 5 GHz) doesn't make that much sense.
Actually, it does make some sense as long as the NIC is actually channel-hopping ... but that's in the process of changing now, there's going to be hardware really soon (or perhaps already exists) that has real dual-band capabilities...
Maybe we can live with this now, but we'd probably expect to change this really soon.
johannes
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Kan YanQuoted 92 lines · Kan Yan
In order for the
Fq_CoDelintegrated 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 released to firmware due to the deep queue in the lower layer. In this case, the sojourn time measured by CoDel in the mac80211 layer is always lower than the CoDel latency target hence it 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 can not 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 1 Gbps.
This patch implemented an Airtime-based Queue Limit (AQL) to make CoDel works effectively with wireless drivers that utilized
firmware/hardwareoffloading. It only allows each txq to release just enough packets to form 1-2 large aggregations to keep hardware fully utilized and keep the rest of frames in mac80211 layer to be controlled by CoDel.Change-Id I1427db2c4c7fcb4162b087514dcb06d5613fa5d2Signed-off-by Kan Yan <[email protected]>--- include/net/cfg80211.h | 7 ++++ include/net/mac80211.h | 34 ++++++++++++++++ net/mac80211/debugfs.c | 79 ++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 43 +++++++++++++++------ net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 7 +++- net/mac80211/sta_info.c | 23 +++++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 60 ++++++++++++++++++++++++----- 9 files changed, 239 insertions(+), 22 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 firmware's transmit queue size limit in airtime */ +#define IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT 24000 +/** * struct cfg80211_pmksa - PMK Security Association * include/net/mac80211.h +24
-0@@ -5543,6 +5543,40 @@ 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_register_pending_airtime - register the estimated airtime for +* the frames pending in lower layer (firmware/hardware) txq. +* +* Update the total pending airtime of the frames released to firmware. The +* pending airtime is used by AQL to control queue size in the lower layer. +* +* 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) +* @tx_commpleted: true if called from the tx completion event. +*/ +void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed); + +/** +* ieee80211_txq_aritme_check - check if the airtime limit of AQL (Airtime based +* queue limit) has been reached.
include/net/mac80211.h void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); · line 5579
Quoted 10 lines
include/net/mac80211.h +10
-0+* @hw: pointer obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* Retrun true if the queue limit has not been reached and txq can continue to +* release packets to the lower layer. +* Return false if the queue limit has been reached and the txq should not +* release more frames to the lower layer. +*/ +bool +ieee80211_txq_airtime_check (struct ieee80211_hw *hw,struct ieee80211_txq *txq); +
So I think it'll be better to pass up the last_rate and have mac80211 calculate the airtime (like I did in my patch set). But we can keep the rest of your logic and just switch the calculation, I guess?
I'd like to use the new rate calculation code that Felix added to mt76. Is the arsta->txrate info in ath10k suitable to be passed up to mac80211 and used in that, do you think? Because then that would probably be the easiest way to go about it...
[...]
include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3736
Quoted 8 lines
include/net/mac80211.h +1
-3@@ -3726,9 +3733,7 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,* get immediately moved to the back of the list on the next * call to ieee80211_next_txq(). */ -if (txqi->txq.sta && -wiphy_ext_feature_isset (local->hw.wiphy, -NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +if (txqi->txq.sta && local->airtime_flags &AIRTIME_USE_TX )
This is wrong. The USE_TX/USE_RX flags just set which types of airtime will be subtracted from the deficit. We should still be running the scheduler if *either* of them is set...
Quoted 5 lines
include/net/mac80211.h +0
-0list_add (&txqi->schedule_order, &local->active_txqs[txq->ac]); else@@ -3740,6 +3745,37 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw, }
include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3755
Quoted 10 lines
include/net/mac80211.h +8
-0EXPORT_SYMBOL (__ieee80211_schedule_txq); +bool ieee80211_txq_airtime_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_TX ))
Ditto.
Quoted 27 lines
include/net/mac80211.h +23
-0+return true; + +if (!txq->sta) +return true; + + sta = container_of(txq->sta, struct sta_info, sta); +if (sta->airtime[txq->ac].deficit <0 ) +return false; + +if (!(local->airtime_flags &AIRTIME_USE_AQL )) +return true; + +if ((sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_low) || + (local->aql_total_pending_airtime < local->aql_interface_limit && + sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_high)) +return true; +else +return false; +} +EXPORT_SYMBOL (ieee80211_txq_airtime_check); +bool ieee80211_txq_may_transmit (struct ieee80211_hw *hw,struct ieee80211_txq *txq) {
include/net/mac80211.h bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3790
Quoted 10 lines
include/net/mac80211.h +3
-3@@ -3748,10 +3784,13 @@ bool ieee80211_txq_may_transmit(struct ieee80211_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; + +if (!(local->airtime_flags &AIRTIME_USE_TX ))
Ditto.
-Toke
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Hi Johannes,
Thanks for help review this patch. I will fix all style errors.
Quoted 3 lines
Quoted 1 line
+ieee80211_txq_airtime_check(struct
ieee80211_hw*hw, structieee80211_txq*txq);Why is it necessary to call this, vs. just returning NULL when an SKB is requested?
This function is also called by ath10k, from ath10k_mac_tx_can_push(), which returns a boolean.
Quoted 7 lines
However, I'm not sure it *shouldn't* actually be per interface (i.e. moving from
local->aql_total_pending_airtimeto
sdata->aql_total_pending_airtime
Quoted 8 lines
because you could have multiple channels etc. involved and then using a single airtime limit across two interfaces that are actually on two different channels (e.g. 2.4 and 5 GHz) doesn't make that much sense.
Actually, it does make some sense as long as the NIC is actually channel-hopping ... but that's in the process of changing now, there's going to be hardware really soon (or perhaps already exists) that has real dual-band capabilities...
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
I am ok with moving the "aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?
Kan
Quoted 191 lines · Toke Høiland-Jørgensen
Quoted 92 lines · Kan Yan
In order for the
Fq_CoDelintegrated 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 released to firmware due to the deep queue in the lower layer. In this case, the sojourn time measured by CoDel in the mac80211 layer is always lower than the CoDel latency target hence it 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 can not 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 1 Gbps.
This patch implemented an Airtime-based Queue Limit (AQL) to make CoDel works effectively with wireless drivers that utilized
firmware/hardwareoffloading. It only allows each txq to release just enough packets to form 1-2 large aggregations to keep hardware fully utilized and keep the rest of frames in mac80211 layer to be controlled by CoDel.Change-Id I1427db2c4c7fcb4162b087514dcb06d5613fa5d2Signed-off-by Kan Yan <[email protected]>--- include/net/cfg80211.h | 7 ++++ include/net/mac80211.h | 34 ++++++++++++++++ net/mac80211/debugfs.c | 79 ++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 43 +++++++++++++++------ net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 7 +++- net/mac80211/sta_info.c | 23 +++++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 60 ++++++++++++++++++++++++----- 9 files changed, 239 insertions(+), 22 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 firmware's transmit queue size limit in airtime */ +#define IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT 24000 +/** * struct cfg80211_pmksa - PMK Security Association * include/net/mac80211.h +24
-0@@ -5543,6 +5543,40 @@ 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_register_pending_airtime - register the estimated airtime for +* the frames pending in lower layer (firmware/hardware) txq. +* +* Update the total pending airtime of the frames released to firmware. The +* pending airtime is used by AQL to control queue size in the lower layer. +* +* 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) +* @tx_commpleted: true if called from the tx completion event. +*/ +void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed); + +/** +* ieee80211_txq_aritme_check - check if the airtime limit of AQL (Airtime based +* queue limit) has been reached. include/net/mac80211.h void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); · line 5579
Quoted 10 lines
include/net/mac80211.h +10
-0+* @hw: pointer obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* Retrun true if the queue limit has not been reached and txq can continue to +* release packets to the lower layer. +* Return false if the queue limit has been reached and the txq should not +* release more frames to the lower layer. +*/ +bool +ieee80211_txq_airtime_check (struct ieee80211_hw *hw,struct ieee80211_txq *txq); +So I think it'll be better to pass up the
last_rateand have mac80211 calculate the airtime (like I did in my patch set). But we can keep the rest of your logic and just switch the calculation, I guess?I'd like to use the new rate calculation code that Felix added to mt76. Is the
arsta->txrateinfo in ath10k suitable to be passed up to mac80211 and used in that, do you think? Because then that would probably be the easiest way to go about it...[...]
include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3736
Quoted 8 lines
include/net/mac80211.h +1
-3@@ -3726,9 +3733,7 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,* get immediately moved to the back of the list on the next * call to ieee80211_next_txq(). */ -if (txqi->txq.sta && -wiphy_ext_feature_isset (local->hw.wiphy, -NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +if (txqi->txq.sta && local->airtime_flags &AIRTIME_USE_TX )This is wrong. The USE_TX/USE_RX flags just set which types of airtime will be subtracted from the deficit. We should still be running the scheduler if *either* of them is set...
Quoted 5 lines
include/net/mac80211.h +0
-0list_add (&txqi->schedule_order, &local->active_txqs[txq->ac]); else@@ -3740,6 +3745,37 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw, }include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3755
Quoted 10 lines
include/net/mac80211.h +8
-0EXPORT_SYMBOL (__ieee80211_schedule_txq); +bool ieee80211_txq_airtime_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_TX ))Ditto.
Quoted 27 lines
include/net/mac80211.h +23
-0+return true; + +if (!txq->sta) +return true; + + sta = container_of(txq->sta, struct sta_info, sta); +if (sta->airtime[txq->ac].deficit <0 ) +return false; + +if (!(local->airtime_flags &AIRTIME_USE_AQL )) +return true; + +if ((sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_low) || + (local->aql_total_pending_airtime < local->aql_interface_limit && + sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_high)) +return true; +else +return false; +} +EXPORT_SYMBOL (ieee80211_txq_airtime_check); +bool ieee80211_txq_may_transmit (struct ieee80211_hw *hw,struct ieee80211_txq *txq) {include/net/mac80211.h bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3790
Quoted 10 lines
include/net/mac80211.h +3
-3@@ -3748,10 +3784,13 @@ bool ieee80211_txq_may_transmit(struct ieee80211_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; + +if (!(local->airtime_flags &AIRTIME_USE_TX ))Ditto.
-Toke
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Hi Toke,
Quoted 3 lines
So I think it'll be better to pass up the
last_rateand have mac80211 calculate the airtime (like I did in my patch set). But we can keep the rest of your logic and just switch the calculation, I guess?
Sounds like a good plan to me. Moving the airtime calculation do makes it easier to support multiple drivers. The only benefit of keep that part in driver is we can avoid extending ieee80211_tx_info with a new field "tx_time_est".
I will fix the "AIRTIME_USE_TX" part and prepare a new patch.
Thanks,
Kan
Quoted 233 lines · Kan Yan
Hi Johannes,
Thanks for help review this patch. I will fix all style errors.
Quoted 3 lines
Quoted 1 line
+ieee80211_txq_airtime_check(struct
ieee80211_hw*hw, structieee80211_txq*txq);Why is it necessary to call this, vs. just returning NULL when an SKB is requested?
This function is also called by ath10k, from
ath10k_mac_tx_can_push(), which returns a boolean.Quoted 7 lines
However, I'm not sure it *shouldn't* actually be per interface (i.e. moving from
local->aql_total_pending_airtimeto
sdata->aql_total_pending_airtimeQuoted 8 lines
because you could have multiple channels etc. involved and then using a single airtime limit across two interfaces that are actually on two different channels (e.g. 2.4 and 5 GHz) doesn't make that much sense.
Actually, it does make some sense as long as the NIC is actually channel-hopping ... but that's in the process of changing now, there's going to be hardware really soon (or perhaps already exists) that has real dual-band capabilities...
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
I am ok with moving the "
aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?Kan
Quoted 191 lines · Toke Høiland-Jørgensen
Quoted 92 lines · Kan Yan
In order for the
Fq_CoDelintegrated 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 released to firmware due to the deep queue in the lower layer. In this case, the sojourn time measured by CoDel in the mac80211 layer is always lower than the CoDel latency target hence it 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 can not 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 1 Gbps.
This patch implemented an Airtime-based Queue Limit (AQL) to make CoDel works effectively with wireless drivers that utilized
firmware/hardwareoffloading. It only allows each txq to release just enough packets to form 1-2 large aggregations to keep hardware fully utilized and keep the rest of frames in mac80211 layer to be controlled by CoDel.Change-Id I1427db2c4c7fcb4162b087514dcb06d5613fa5d2Signed-off-by Kan Yan <[email protected]>--- include/net/cfg80211.h | 7 ++++ include/net/mac80211.h | 34 ++++++++++++++++ net/mac80211/debugfs.c | 79 ++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 43 +++++++++++++++------ net/mac80211/ieee80211_i.h | 4 ++ net/mac80211/main.c | 7 +++- net/mac80211/sta_info.c | 23 +++++++++++ net/mac80211/sta_info.h | 4 ++ net/mac80211/tx.c | 60 ++++++++++++++++++++++++----- 9 files changed, 239 insertions(+), 22 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 firmware's transmit queue size limit in airtime */ +#define IEEE80211_DEFAULT_AQL_INTERFACE_LIMIT 24000 +/** * struct cfg80211_pmksa - PMK Security Association * include/net/mac80211.h +24
-0@@ -5543,6 +5543,40 @@ 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_register_pending_airtime - register the estimated airtime for +* the frames pending in lower layer (firmware/hardware) txq. +* +* Update the total pending airtime of the frames released to firmware. The +* pending airtime is used by AQL to control queue size in the lower layer. +* +* 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) +* @tx_commpleted: true if called from the tx completion event. +*/ +void ieee80211_sta_register_pending_airtime (struct ieee80211_sta *pubsta, +u8 tid,u32 tx_airtime, +bool tx_completed); + +/** +* ieee80211_txq_aritme_check - check if the airtime limit of AQL (Airtime based +* queue limit) has been reached. include/net/mac80211.h void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid); · line 5579
Quoted 10 lines
include/net/mac80211.h +10
-0+* @hw: pointer obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* Retrun true if the queue limit has not been reached and txq can continue to +* release packets to the lower layer. +* Return false if the queue limit has been reached and the txq should not +* release more frames to the lower layer. +*/ +bool +ieee80211_txq_airtime_check (struct ieee80211_hw *hw,struct ieee80211_txq *txq); +So I think it'll be better to pass up the
last_rateand have mac80211 calculate the airtime (like I did in my patch set). But we can keep the rest of your logic and just switch the calculation, I guess?I'd like to use the new rate calculation code that Felix added to mt76. Is the
arsta->txrateinfo in ath10k suitable to be passed up to mac80211 and used in that, do you think? Because then that would probably be the easiest way to go about it...[...]
include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3736
Quoted 8 lines
include/net/mac80211.h +1
-3@@ -3726,9 +3733,7 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,* get immediately moved to the back of the list on the next * call to ieee80211_next_txq(). */ -if (txqi->txq.sta && -wiphy_ext_feature_isset (local->hw.wiphy, -NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +if (txqi->txq.sta && local->airtime_flags &AIRTIME_USE_TX )This is wrong. The USE_TX/USE_RX flags just set which types of airtime will be subtracted from the deficit. We should still be running the scheduler if *either* of them is set...
Quoted 5 lines
include/net/mac80211.h +0
-0list_add (&txqi->schedule_order, &local->active_txqs[txq->ac]); else@@ -3740,6 +3745,37 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw, }include/net/mac80211.h void __ieee80211_schedule_txq(struct ieee80211_hw *hw, · line 3755
Quoted 10 lines
include/net/mac80211.h +8
-0EXPORT_SYMBOL (__ieee80211_schedule_txq); +bool ieee80211_txq_airtime_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_TX ))Ditto.
Quoted 27 lines
include/net/mac80211.h +23
-0+return true; + +if (!txq->sta) +return true; + + sta = container_of(txq->sta, struct sta_info, sta); +if (sta->airtime[txq->ac].deficit <0 ) +return false; + +if (!(local->airtime_flags &AIRTIME_USE_AQL )) +return true; + +if ((sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_low) || + (local->aql_total_pending_airtime < local->aql_interface_limit && + sta->airtime[txq->ac].aql_tx_pending < + sta->airtime[txq->ac].aql_limit_high)) +return true; +else +return false; +} +EXPORT_SYMBOL (ieee80211_txq_airtime_check); +bool ieee80211_txq_may_transmit (struct ieee80211_hw *hw,struct ieee80211_txq *txq) {include/net/mac80211.h bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, · line 3790
Quoted 10 lines
include/net/mac80211.h +3
-3@@ -3748,10 +3784,13 @@ bool ieee80211_txq_may_transmit(struct ieee80211_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; + +if (!(local->airtime_flags &AIRTIME_USE_TX ))Ditto.
-Toke
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Kan YanQuoted 33 lines · Kan Yan
Hi Johannes,
Thanks for help review this patch. I will fix all style errors.
Quoted 3 lines
Quoted 1 line
+ieee80211_txq_airtime_check(struct
ieee80211_hw*hw, structieee80211_txq*txq);Why is it necessary to call this, vs. just returning NULL when an SKB is requested?
This function is also called by ath10k, from
ath10k_mac_tx_can_push(), which returns a boolean.Quoted 7 lines
However, I'm not sure it *shouldn't* actually be per interface (i.e. moving from
local->aql_total_pending_airtimeto
sdata->aql_total_pending_airtimeQuoted 8 lines
because you could have multiple channels etc. involved and then using a single airtime limit across two interfaces that are actually on two different channels (e.g. 2.4 and 5 GHz) doesn't make that much sense.
Actually, it does make some sense as long as the NIC is actually channel-hopping ... but that's in the process of changing now, there's going to be hardware really soon (or perhaps already exists) that has real dual-band capabilities...
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
Quoted 4 lines
I am ok with moving the "
aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?
I'd lean towards keeping it in 'local' for consistency with all the other airtime stuff. For now, I think having multiple SSIDs on the same radio is more common than the reverse (multiple bands on a single radio).
In particular, the per-group airtime fairness stuff is definitely designed on the assumption that all BSSes share the same band.
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
-Toke
Johannes Berg
maintainerRe: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 12 lines · Toke Høiland-Jørgensen
Quoted 11 lines
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
I am ok with moving the "
aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?
Quoted 7 lines
I'd lean towards keeping it in 'local' for consistency with all the other airtime stuff. For now, I think having multiple SSIDs on the same radio is more common than the reverse (multiple bands on a single radio).
In particular, the per-group airtime fairness stuff is definitely designed on the assumption that all BSSes share the same band.
s/band/channel/, presumably.
Quoted 3 lines
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
I guess I'm OK with that, but I'm pretty sure this will come up sooner rather than later ...
What else is there though?
johannes
Re: [Make-wifi-fast] [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 25 lines · Johannes Berg
Quoted 12 lines · Toke Høiland-Jørgensen
Quoted 11 lines
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
I am ok with moving the "
aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?Quoted 7 lines
I'd lean towards keeping it in 'local' for consistency with all the other airtime stuff. For now, I think having multiple SSIDs on the same radio is more common than the reverse (multiple bands on a single radio).
In particular, the per-group airtime fairness stuff is definitely designed on the assumption that all BSSes share the same band.
s/band/channel/, presumably.
Quoted 8 lines
Quoted 3 lines
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
I guess I'm OK with that, but I'm pretty sure this will come up sooner rather than later ...
What else is there though?
World domination!
Quoted 7 lines
johannes
_______________________________________________
Make-wifi-fast mailing list
[email protected]
https://lists.bufferbloat.net/listinfo/make-wifi-fast
Signature · 4 lines
Dave Täht CTO, TekLibre, LLC http://www.teklibre.com Tel: 1-831-205-9740
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
In reply to Johannes BergQuoted 19 lines · Johannes Berg
Quoted 17 lines · Toke Høiland-Jørgensen
Quoted 11 lines
That's a good point. I haven't thought about real simultaneous dual band chipset and such chipset do exists now. Is RSDB support coming to mac80211 soon? Just curious if it will be just virtual interfaces or something else. I chose "local" instead of "sdata" thinking about the case of several virtual interfaces (AP, STA, MESH) operates in the same channel, then the interface total could be a better choice.
I am ok with moving the "
aql_total_pending_airtime" into sdata, but afraid that's not the most optimal choice for the case of multiple virtual interfaces operates in the same channel.
Maybe we could leave it in "local" for now. What do you think?I'd lean towards keeping it in 'local' for consistency with all the other airtime stuff. For now, I think having multiple SSIDs on the same radio is more common than the reverse (multiple bands on a single radio).
Quoted 4 lines
Quoted 2 lines
In particular, the per-group airtime fairness stuff is definitely designed on the assumption that all BSSes share the same band.
s/band/channel/, presumably.
Indeed :)
Quoted 8 lines
Quoted 3 lines
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
I guess I'm OK with that, but I'm pretty sure this will come up sooner rather than later ...
What else is there though?
By "it all" I meant "all the airtime fairness stuff". Other than that, I didn't have anything in particular in mind. I just kinda assumed there would be lots of places that had an implicit assumption that all devices on the same phy shares a channel...
-Toke
Johannes Berg
maintainerRe: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 7 lines · Toke Høiland-Jørgensen
Quoted 7 lines
Quoted 3 lines
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
I guess I'm OK with that, but I'm pretty sure this will come up sooner rather than later ...
Quoted 6 lines
Quoted 1 line
What else is there though?
By "it all" I meant "all the airtime fairness stuff". Other than that, I didn't have anything in particular in mind. I just kinda assumed there would be lots of places that had an implicit assumption that all devices on the same phy shares a channel...
Not _that_ much - we do have the channel contexts after all. But except for hwsim (*cough cough* I was lazy) nothing actually implements real concurrent multi-channel yet, obviously, but uses a single radio with channel hopping...
johannes
Re: [PATCH 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Quoted 4 lines
I'd like to use the new rate calculation code that Felix added to mt76. Is the
arsta->txrateinfo in ath10k suitable to be passed up to mac80211 and used in that, do you think? Because then that would probably be the easiest way to go about it...
Do you mean the mt76 patch that using the EWMA to smooth estimate data rate? It would be great if you can move that to mac80211.
Yes, arsta->txrate info in ath10k is a good place to extract latest date rate.
Quoted 24 lines · Johannes Berg
Quoted 7 lines · Toke Høiland-Jørgensen
Quoted 7 lines
Quoted 3 lines
So if and when we start supporting true multi-band devices we'll have to change these things anyway. So might as well keep everything together so it all gets fixed :)
I guess I'm OK with that, but I'm pretty sure this will come up sooner rather than later ...
Quoted 6 lines
Quoted 1 line
What else is there though?
By "it all" I meant "all the airtime fairness stuff". Other than that, I didn't have anything in particular in mind. I just kinda assumed there would be lots of places that had an implicit assumption that all devices on the same phy shares a channel...
Not _that_ much - we do have the channel contexts after all. But except for hwsim (*cough cough* I was lazy) nothing actually implements real concurrent multi-channel yet, obviously, but uses a single radio with channel hopping...
johannes