Skip to contentSkip to conversation

mac80211: Turn AQL into a proper NL80211_EXT_FEATURE flag

PATCH Superseded Toke Høiland-Jørgensen 3 participants 7 messages Dec 11, 2019 – Dec 12, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#6 lore raw

PATCH 2/2 ath10k: Enable Airtime Queue Limits feature

In reply to Toke Høiland-Jørgensen

Since AQL is now a feature flag drivers have to set for the feature to be enabled, set this for ath10k.

---
 drivers/net/wireless/ath/ath10k/mac.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/mac.c +1 -0
index 83cc8778ca1e..978f0037ed52 100644
@@ -8958,6 +8958,7 @@ int ath10k_mac_register(struct ath10k *ar)
 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
 	wiphy_ext_feature_set(ar->hw->wiphy,
 			      NL80211_EXT_FEATURE_SET_SCAN_DWELL);
+	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL);
 
 	if (test_bit(WMI_SERVICE_TX_DATA_ACK_RSSI, ar->wmi.svc_map) ||
 	    test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, ar->wmi.svc_map))
Signature · 1 line
2.24.0
#0 lore raw

cover mac80211: Turn AQL into a proper NL80211_EXT_FEATURE flag

It turns out that there are some issues with just enabling AQL for all drivers; so instead, this series turns it into an NL80211_EXT_FEATURE flag, and only enables it for ath10k.

Some coordination to make sure the mac80211 and the driver patch goes into the same -rc would be good.

Toke Høiland-Jørgensen (2):
mac80211: Turn AQL into an NL80211_EXT_FEATURE
ath10k: Enable Airtime Queue Limits feature

 drivers/net/wireless/ath/ath10k/mac.c |  1 +
 include/uapi/linux/nl80211.h          |  1 +
 net/mac80211/debugfs_sta.c            | 76 ++++++++++++++++++++-------
 net/mac80211/main.c                   |  4 +-
 net/mac80211/sta_info.c               |  3 ++
 net/mac80211/sta_info.h               |  1 -
 net/mac80211/tx.c                     |  4 +-
 7 files changed, 66 insertions(+), 24 deletions(-)
Signature · 1 line
2.24.0
#1 lore raw

PATCH 1/2 mac80211: Turn AQL into an NL80211_EXT_FEATURE

Instead of just having an airtime flag in debugfs, turn AQL into a proper NL80211_EXT_FEATURE, so drivers can turn it on when they are ready, and so we also expose the presence of the feature to userspace.

This also has the effect of flipping the default, so drivers have to opt in to using AQL instead of getting it by default with TXQs. A follow-up patch sets the feature for ath10k.

While we're at it, split out the debugfs interface so AQL gets its own per-station debugfs file instead of using the 'airtime' file.

---
 include/uapi/linux/nl80211.h |  1 +
 net/mac80211/debugfs_sta.c   | 76 +++++++++++++++++++++++++++---------
 net/mac80211/main.c          |  4 +-
 net/mac80211/sta_info.c      |  3 ++
 net/mac80211/sta_info.h      |  1 -
 net/mac80211/tx.c            |  4 +-
 6 files changed, 65 insertions(+), 24 deletions(-)
include/uapi/linux/nl80211.h +1 -0
index 341e0e8cae46..1e6f435c709c 100644
@@ -5563,6 +5563,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_STA_TX_PWR,
 	NL80211_EXT_FEATURE_SAE_OFFLOAD,
 	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
+	NL80211_EXT_FEATURE_AQL,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
net/mac80211/debugfs_sta.c +58 -18

125 lines not on this page · raw message

net/mac80211/main.c +1 -3
index 6cca0853f183..4c2b5ba3ac09 100644
@@ -672,9 +672,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
 			IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H;
 	}
 
-	local->airtime_flags = AIRTIME_USE_TX |
-			       AIRTIME_USE_RX |
-			       AIRTIME_USE_AQL;
+	local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
 	local->aql_threshold = IEEE80211_AQL_THRESHOLD;
 	atomic_set(&local->aql_total_pending_airtime, 0);
 
net/mac80211/sta_info.c +3 -0
index 8eafd81e97b4..0f5f40678885 100644
@@ -1916,6 +1916,9 @@ void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local,
 {
 	int tx_pending;
 
+	if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL))
+		return;
+
 	if (!tx_completed) {
 		if (sta)
 			atomic_add(tx_airtime,
net/mac80211/sta_info.h +0 -1
index ad5d8a4ae56d..c00e28585f9d 100644
@@ -127,7 +127,6 @@ 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;
net/mac80211/tx.c +2 -2
index b696b9136f4c..259989a81108 100644
@@ -3668,7 +3668,7 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
 
 	IEEE80211_SKB_CB(skb)->control.vif = vif;
 
-	if (local->airtime_flags & AIRTIME_USE_AQL) {
+	if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) {
 		u32 airtime;
 
 		airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta,
@@ -3790,7 +3790,7 @@ bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw,
 	struct sta_info *sta;
 	struct ieee80211_local *local = hw_to_local(hw);
 
-	if (!(local->airtime_flags & AIRTIME_USE_AQL))
+	if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL))
 		return true;
 
 	if (!txq->sta)
Signature · 1 line
2.24.0
maintainer
#2 lore raw

Re: [PATCH 1/2] mac80211: Turn AQL into an NL80211_EXT_FEATURE

include/uapi/linux/nl80211.h enum nl80211_ext_feature_index { · line 5566

Quoted 10 lines · Toke Høiland-Jørgensen
include/uapi/linux/nl80211.h +1 -0
index 341e0e8cae46..1e6f435c709c 100644
@@ -5563,6 +5563,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_STA_TX_PWR,
 	NL80211_EXT_FEATURE_SAE_OFFLOAD,
 	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
+	NL80211_EXT_FEATURE_AQL,

This is missing kernel-doc.

johannes

#3 lore raw

Re: [PATCH 1/2] mac80211: Turn AQL into an NL80211_EXT_FEATURE

Disclaimer: I'm new, so don't assume my questions are rhetorical...

sta = container_of(txq->sta, struct sta_info, sta); // Is this correct?

I see the use of IEEE80211_NUM_ACS seems to be standard, is that AC specific? I learned today that different devs have different numbers of queues...

What are the units of the THRESHOLD, iirc there was some bit shifting/masking?

Is there supposed to be a queue per station, or just per interface? It seemed like the threshold was meant to pick a higher or lower queue, this seems to maybe just reject if not within the bounds?

Sorry for all the questions, I'm still on the gradual side of the learning curve

Quoted 17 lines · Johannes Berg

include/uapi/linux/nl80211.h enum nl80211_ext_feature_index { · line 5566

Quoted 10 lines · Toke Høiland-Jørgensen
include/uapi/linux/nl80211.h +1 -0
index 341e0e8cae46..1e6f435c709c 100644
@@ -5563,6 +5563,7 @@ enum nl80211_ext_feature_index {
      NL80211_EXT_FEATURE_STA_TX_PWR,
      NL80211_EXT_FEATURE_SAE_OFFLOAD,
      NL80211_EXT_FEATURE_VLAN_OFFLOAD,
+     NL80211_EXT_FEATURE_AQL,

This is missing kernel-doc.

johannes

#5 lore raw

Re: [PATCH 1/2] mac80211: Turn AQL into an NL80211_EXT_FEATURE

In reply to Johannes Berg
Quoted 13 lines · Johannes Berg

include/uapi/linux/nl80211.h enum nl80211_ext_feature_index { · line 5566

Quoted 10 lines · Toke Høiland-Jørgensen
include/uapi/linux/nl80211.h +1 -0
index 341e0e8cae46..1e6f435c709c 100644
@@ -5563,6 +5563,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_STA_TX_PWR,
 	NL80211_EXT_FEATURE_SAE_OFFLOAD,
 	NL80211_EXT_FEATURE_VLAN_OFFLOAD,
+	NL80211_EXT_FEATURE_AQL,

This is missing kernel-doc.

Pfft; since when are we also supposed to *document* our code? ;)

Will send a v2...

-Toke

#4 lore raw

Re: [PATCH 1/2] mac80211: Turn AQL into an NL80211_EXT_FEATURE

In reply to Justin Capella
Quoted 4 lines · Justin Capella

Disclaimer: I'm new, so don't assume my questions are rhetorical...

sta = container_of(txq->sta, struct sta_info, sta); // Is this correct?

Not sure what you're referring to here; but generally, yes? :)

Quoted 3 lines

I see the use of IEEE80211_NUM_ACS seems to be standard, is that AC specific? I learned today that different devs have different numbers of queues...

AC numbers are defined in the standard, and there are always four of them. Different hardware can have different numbers of queues, which may or may not be related to NUM_ACS.

Quoted 2 lines

What are the units of the THRESHOLD, iirc there was some bit shifting/masking?

Units are logically microseconds, but stored as increments of 4 microseconds because we ran out of bits; this is kept inside the setter/getter function, though, so everywhere else is just microseconds.

Quoted 1 line

Is there supposed to be a queue per station, or just per interface?

There's a TXQ per TID (so 16 per station), and an additional one on the interface for multicast.

Quoted 2 lines

It seemed like the threshold was meant to pick a higher or lower queue, this seems to maybe just reject if not within the bounds?

There are two thresholds; one for the whole interface, and one per station. If either is exceeded transmission will be throttled.

-Toke