Move TXQ scheduling and airtime fairness into mac80211
Subsystems (4)
cover Move TXQ scheduling and airtime fairness into mac80211
Toke,
It is been a while since mac80211 TXQ discussion started. Here is the consolidated series of mac80211, ath9k and ath10k changes to move TXQ scheduling and airtime fairness into mac80211. The major changes w.r.t 5th RFC version are in may_transmit() API. Whenever the driver checks deficit for given TXQ, the list will be reordered so that driver/firmware RR quickly becomes in sync with mac80211 list. Also airtime tasklet approach cumbersome and causing regression in multi client performance.
- Removed airtime kickout tasklet
- Reworked on ieee80211_txq_may_transmit() API
- Provided option to configure driver specific default airtime.
- Bundled ath10k changes along with this series.
-Rajkumar
Rajkumar Manoharan (2):
ath10k: migrate to mac80211 txq scheduling
ath10k: reporting estimated tx airtime for fairness
Toke Høiland-Jørgensen (4):
mac80211: Add TXQ scheduling API
cfg80211: Add airtime statistics and settings
mac80211: Add airtime accounting and scheduling to TXQs
ath9k: Switch to mac80211 TXQ scheduling and airtime APIs
drivers/net/wireless/ath/ath10k/core.c | 2 - drivers/net/wireless/ath/ath10k/core.h | 8 +- drivers/net/wireless/ath/ath10k/htc.h | 1 - drivers/net/wireless/ath/ath10k/htt_rx.c | 9 ++ drivers/net/wireless/ath/ath10k/mac.c | 155 +++++++++++------- drivers/net/wireless/ath/ath10k/txrx.c | 4 + drivers/net/wireless/ath/ath9k/ath9k.h | 14 -- drivers/net/wireless/ath/ath9k/debug.c | 3 - drivers/net/wireless/ath/ath9k/debug.h | 8 - drivers/net/wireless/ath/ath9k/debug_sta.c | 70 --------- drivers/net/wireless/ath/ath9k/init.c | 3 +- drivers/net/wireless/ath/ath9k/recv.c | 9 +- drivers/net/wireless/ath/ath9k/xmit.c | 244 +++++++++-------------------- include/net/cfg80211.h | 10 +- include/net/mac80211.h | 118 +++++++++++++- include/uapi/linux/nl80211.h | 15 ++ net/mac80211/agg-tx.c | 2 +- net/mac80211/cfg.c | 3 + net/mac80211/debugfs.c | 3 + net/mac80211/debugfs_sta.c | 50 +++++- net/mac80211/driver-ops.h | 9 ++ net/mac80211/ieee80211_i.h | 12 ++ net/mac80211/main.c | 9 ++ net/mac80211/sta_info.c | 54 ++++++- net/mac80211/sta_info.h | 13 ++ net/mac80211/status.c | 6 + net/mac80211/tx.c | 140 ++++++++++++++++- net/wireless/nl80211.c | 28 ++++ 28 files changed, 646 insertions(+), 356 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/6 mac80211: Add TXQ scheduling API
From: Toke Høiland-Jørgensen <[email protected]>
This adds an API to mac80211 to handle scheduling of TXQs. The interface between driver and mac80211 for TXQ handling is changed by adding two new
functions: ieee80211_next_txq(), which will return the next TXQ to schedule in the current round-robin rotation, and ieee80211_return_txq(), which the driver uses to indicate that it has finished scheduling a TXQ (which will then be put back in the scheduling rotation if it isn't empty).
The driver must call ieee80211_txq_schedule_start() at the start of each scheduling session, and ieee80211_txq_schedule_end() at the end. The API then guarantees that the same TXQ is not returned twice in the same session (so a driver can loop on ieee80211_next_txq() without worrying about breaking the loop.
Usage of the new API is optional, so drivers can be ported one at a time. In this patch, the actual scheduling performed by mac80211 is simple round-robin, but a subsequent commit adds airtime fairness awareness to the scheduler.
--- include/net/mac80211.h | 62 +++++++++++++++++++++++++++++++++++++++++++--- net/mac80211/agg-tx.c | 2 +- net/mac80211/driver-ops.h | 9 +++++++ net/mac80211/ieee80211_i.h | 9 +++++++ net/mac80211/main.c | 5 ++++ net/mac80211/sta_info.c | 2 +- net/mac80211/tx.c | 58 ++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 140 insertions(+), 7 deletions(-)
include/net/mac80211.h +58 -4
@@ -108,9 +108,15 @@* The driver is expected to initialize its private per-queue data for stations * and interfaces in the .add_interface and .sta_add ops. * -* The driver can't access the queue directly. To dequeue a frame, it calls -* ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it -* calls the .wake_tx_queue driver op. +* The driver can't access the queue directly. To dequeue a frame from a +* txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a +* queue, it calls the .wake_tx_queue driver op. +* +* Drivers can optionally delegate responsibility for scheduling queues to +* mac80211, to take advantage of airtime fairness accounting. In this case, to +* obtain the next queue to pull frames from, the driver calls +* ieee80211_next_txq(). The driver is then expected to return the txq using +* ieee80211_return_txq(). * * For AP powersave TIM handling, the driver only needs to indicate if it has * buffered packets in the driver specific data structures by calling
@@ -6045,7 +6051,8 @@ void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,* ieee80211_tx_dequeue - dequeue a packet from a software tx queue * * @hw: pointer as obtained from ieee80211_alloc_hw() -* @txq: pointer obtained from station or virtual interface +* @txq: pointer obtained from station or virtual interface, or from +* ieee80211_next_txq() * * Returns the skb if successful, %NULL if no frame was available. */
@@ -6053,6 +6060,53 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq);/** +* ieee80211_next_txq - get next tx queue to pull packets from +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @ac: AC number to return packets from. +* +* Should only be called between calls to ieee80211_txq_schedule_start() +* and ieee80211_txq_schedule_end(). +* Returns the next txq if successful, %NULL if no queue is eligible. If a txq +* is returned, it should be returned with ieee80211_return_txq() after the +* driver has finished scheduling it. +*/ +struct ieee80211_txq *ieee80211_next_txq (struct ieee80211_hw *hw,u8 ac); + +/** +* ieee80211_return_txq - return a TXQ previously acquired by +* ieee80211_next_txq() +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +* +* Should only be called between calls to ieee80211_txq_schedule_start() +* and ieee80211_txq_schedule_end(). +*/ +void ieee80211_return_txq (struct ieee80211_hw *hw,struct ieee80211_txq *txq); + +/** +* ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @ac: AC number to acquire locks for +* +* Acquire locks needed to schedule TXQs from the given AC. Should be called +* before ieee80211_next_txq() or ieee80211_return_txq(). +*/ +void ieee80211_txq_schedule_start (struct ieee80211_hw *hw,u8 ac); + +/** +* ieee80211_txq_schedule_end - release locks for safe scheduling of an AC +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @ac: AC number to acquire locks for +* +* Release locks previously acquired by ieee80211_txq_schedule_end(). +*/ +void ieee80211_txq_schedule_end (struct ieee80211_hw *hw,u8 ac); + +/** * ieee80211_txq_get_depth - get pending frame/byte count of given txq * * The values are not guaranteed to be coherent with regard to each other, i.e.
net/mac80211/agg-tx.c +1 -1
@@ -229,7 +229,7 @@ static void __releases(agg_queue)clear_bit (IEEE80211_TXQ_STOP , &txqi->flags);local_bh_disable ();rcu_read_lock (); -drv_wake_tx_queue (sta->sdata->local, txqi); +schedule_and_wake_txq (sta->sdata->local, txqi);rcu_read_unlock ();local_bh_enable (); }
net/mac80211/driver-ops.h +9 -0
@@ -1173,6 +1173,15 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, local->ops->wake_tx_queue (&local->hw, &txq->txq); } +static inline void schedule_and_wake_txq (struct ieee80211_local *local, +struct txq_info *txqi) +{ +spin_lock_bh (&local->active_txq_lock[txqi->txq.ac]); +ieee80211_return_txq (&local->hw, &txqi->txq); +spin_unlock_bh (&local->active_txq_lock[txqi->txq.ac]); +drv_wake_tx_queue (local, txqi); +} +static inline int drv_can_aggregate_in_amsdu (struct ieee80211_local *local,struct sk_buff *head,struct sk_buff *skb)
net/mac80211/ieee80211_i.h +9 -0
@@ -829,6 +829,8 @@ enum txq_info_flags {* a fq_flow which is already owned by a different tin * @def_cvars: codel vars for @def_flow * @frags: used to keep fragments created after dequeue +* @schedule_order: used with ieee80211_local->active_txqs +* @schedule_round: counter to prevent infinite loops on TXQ scheduling */ struct txq_info {struct fq_tin tin;
@@ -836,6 +838,8 @@ struct txq_info {struct codel_vars def_cvars;struct codel_stats cstats;struct sk_buff_head frags; +struct list_head schedule_order; +u16 schedule_round;unsigned long flags;/* keep last! */
@@ -1127,6 +1131,11 @@ struct ieee80211_local {struct codel_vars *cvars;struct codel_params cparams; +/* protects active_txqs and txqi->schedule_order */ +spinlock_t active_txq_lock[IEEE80211_NUM_ACS ]; +struct list_head active_txqs[IEEE80211_NUM_ACS ]; +u16 schedule_round[IEEE80211_NUM_ACS ]; +const struct ieee80211_ops *ops;/*
net/mac80211/main.c +5 -0
@@ -663,6 +663,11 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,spin_lock_init (&local->rx_path_lock);spin_lock_init (&local->queue_stop_reason_lock); +for (i =0 ; i <IEEE80211_NUM_ACS ; i++) { +INIT_LIST_HEAD (&local->active_txqs[i]); +spin_lock_init (&local->active_txq_lock[i]); + } +INIT_LIST_HEAD (&local->chanctx_list);mutex_init (&local->chanctx_mtx);
net/mac80211/sta_info.c +1 -1
@@ -1249,7 +1249,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)if (!sta->sta.txq[i] || !txq_has_queue (sta->sta.txq[i]))continue ; -drv_wake_tx_queue (local,to_txq_info (sta->sta.txq[i])); +schedule_and_wake_txq (local,to_txq_info (sta->sta.txq[i])); }skb_queue_head_init (&pending);
net/mac80211/tx.c +57 -1
82 lines not on this page · raw message
Signature · 1 line
1.9.1
Johannes Berg
maintainerRe: [PATCH 1/6] mac80211: Add TXQ scheduling API
Quoted 3 lines · Rajkumar Manoharan
+ * @txq: pointer obtained from station or virtual interface, or from
+ *ieee80211_next_txq()
nit: please just indent by a single tab for continuation, trying to line it all up doesn't really make it more readable
I see you're still discussing all this, so I'm going to assume you'll resend this series eventually :-)
johannes
Toke Høiland-Jørgensen
maintainerRe: [PATCH 1/6] mac80211: Add TXQ scheduling API
Quoted 8 lines · Johannes Berg
Quoted 3 lines · Rajkumar Manoharan
+ * @txq: pointer obtained from station or virtual interface, or from
+ *ieee80211_next_txq()nit: please just indent by a single tab for continuation, trying to line
it all up doesn't really make it more readable
Not sure I agree about the "not more readable" part, but OK.
Quoted 2 lines
I see you're still discussing all this, so I'm going to assume you'll resend this series eventually :-)
Yup. Think we're getting close to something that might be mergeable. Will send another version then :)
-Toke
PATCH 2/6 cfg80211: Add airtime statistics and settings
In reply to Rajkumar ManoharanFrom: Toke Høiland-Jørgensen <[email protected]>
This adds TX airtime statistics to the cfg80211 station dump (to go along with the RX info already present), and adds a new parameter to set the airtime weight of each station. The latter allows userspace to implement policies for different stations by varying their weights.
--- include/net/cfg80211.h | 10 +++++++++- include/uapi/linux/nl80211.h | 15 +++++++++++++++ net/wireless/nl80211.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-)
include/net/cfg80211.h +9 -1
@@ -1001,6 +1001,7 @@ enum station_parameters_apply_mask {* @support_p2p_ps: information if station supports P2P PS mechanism * @he_capa: HE capabilities of station * @he_capa_len: the length of the HE capabilities +* @airtime_weight: airtime scheduler weight for this station */ struct station_parameters {const u8 *supported_rates;
@@ -1030,6 +1031,7 @@ struct station_parameters {int support_p2p_ps;const struct ieee80211_he_cap_elem *he_capa;u8 he_capa_len; +u16 airtime_weight; };/**
@@ -1297,6 +1299,8 @@ struct cfg80211_tid_stats {* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received * from this peer * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer +* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer +* @airtime_weight: current airtime scheduling weight * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. * Note that this doesn't use the @filled bit, but is used if non-NULL.
@@ -1343,10 +1347,12 @@ struct station_info {u32 expected_throughput; -u64 rx_beacon; +u64 tx_duration;u64 rx_duration; +u64 rx_beacon;u8 rx_beacon_signal_avg;struct cfg80211_tid_stats *pertid; +u16 airtime_weight;s8 ack_signal;s8 avg_ack_signal; };
@@ -2374,6 +2380,8 @@ enum wiphy_params_flags { WIPHY_PARAM_TXQ_QUANTUM = 1 << 8, }; +#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256 +/** * struct cfg80211_pmksa - PMK Security Association *
include/uapi/linux/nl80211.h +15 -0
@@ -2254,6 +2254,9 @@ enum nl80211_commands {* @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder * statistics, see &enum nl80211_ftm_responder_stats. * +* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime +* scheduler. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2699,6 +2702,8 @@ enum nl80211_attrs {NL80211_ATTR_FTM_RESPONDER_STATS , +NL80211_ATTR_AIRTIME_WEIGHT , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -3068,6 +3073,9 @@ enum nl80211_sta_bss_param {* @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm) +* @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames +* sent to the station (u64, usec) +* @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16) * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */
@@ -3108,6 +3116,8 @@ enum nl80211_sta_info {NL80211_STA_INFO_PAD ,NL80211_STA_INFO_ACK_SIGNAL ,NL80211_STA_INFO_ACK_SIGNAL_AVG , +NL80211_STA_INFO_TX_DURATION , +NL80211_STA_INFO_AIRTIME_WEIGHT ,/* keep last */ __NL80211_STA_INFO_AFTER_LAST,
@@ -5250,6 +5260,10 @@ enum nl80211_feature_flags {* if this flag is not set. Ignoring this can leak clear text packets and/or * freeze the connection. * +* @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime +* fairness for transmitted packets and has enabled airtime fairness +* scheduling. +* * @NUM_NL80211_EXT_FEATURES: number of extended features. * @MAX_NL80211_EXT_FEATURES: highest extended feature index. */
@@ -5289,6 +5303,7 @@ enum nl80211_ext_feature_index {NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT ,NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 ,NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER , +NL80211_EXT_FEATURE_AIRTIME_FAIRNESS ,/* add new features before the definition below */ NUM_NL80211_EXT_FEATURES,
net/wireless/nl80211.c +28 -0
@@ -444,6 +444,7 @@ enum nl80211_multicast_groups { .type = NLA_NESTED, .validation_data = nl80211_ftm_responder_policy, }, + [NL80211_ATTR_AIRTIME_WEIGHT] = { .type = NLA_U16 }, };/* policy for the key attributes */
@@ -4702,6 +4703,11 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,PUT_SINFO (PLID , plid, u16);PUT_SINFO (PLINK_STATE , plink_state, u8);PUT_SINFO_U64 (RX_DURATION , rx_duration); +PUT_SINFO_U64 (TX_DURATION , tx_duration); + +if (wiphy_ext_feature_isset (&rdev->wiphy, +NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +PUT_SINFO (AIRTIME_WEIGHT , airtime_weight, u16);switch (rdev->wiphy.signal_type) {case CFG80211_SIGNAL_TYPE_MBM :
@@ -5339,6 +5345,17 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)nla_get_u8 (info->attrs[NL80211_ATTR_OPMODE_NOTIF ]); } +if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT ]) { +if (!wiphy_ext_feature_isset (&rdev->wiphy, +NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +return -EOPNOTSUPP ; + + params.airtime_weight = +nla_get_u16 (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT ]); +if (!params.airtime_weight) +return -EINVAL ; + } +/* Include parameters for TDLS peer (will check later) */ err =nl80211_set_station_tdls (info, ¶ms);if (err)
@@ -5477,6 +5494,17 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)return -EINVAL ; } +if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT ]) { +if (!wiphy_ext_feature_isset (&rdev->wiphy, +NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +return -EOPNOTSUPP ; + + params.airtime_weight = +nla_get_u16 (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT ]); +if (!params.airtime_weight) +return -EINVAL ; + } + err =nl80211_parse_sta_channel_info (info, ¶ms);if (err)return err;
Signature · 1 line
1.9.1
PATCH 3/6 mac80211: Add airtime accounting and scheduling to TXQs
In reply to Rajkumar ManoharanFrom: Toke Høiland-Jørgensen <[email protected]>
This adds airtime accounting and scheduling to the mac80211 TXQ scheduler. A new callback, ieee80211_sta_register_airtime(), is added that drivers can call to report airtime usage for stations.
When airtime information is present, mac80211 will schedule TXQs (through ieee80211_next_txq()) in a way that enforces airtime fairness between active stations. This scheduling works the same way as the ath9k in-driver airtime fairness scheduling. If no airtime usage is reported by the driver, the scheduler will default to round-robin scheduling.
For drivers that don't control TXQ scheduling in software, a new API function, ieee80211_txq_may_transmit(), is added which the driver can use to check if the TXQ is eligible for transmission, or should be throttled to enforce fairness. Calls to this function must also be enclosed in ieee80211_txq_schedule_{start,end}() calls to ensure proper locking.
The API ieee80211_txq_may_transmit() also ensures that TXQ list will be aligned aginst driver's own round-robin scheduler list. i.e it rotates the TXQ list till it makes the requested node becomes the first entry in TXQ list. Thus both the TXQ list and driver's list are in sync.
--- include/net/mac80211.h | 58 ++++++++++++++++++++++++++++++ net/mac80211/cfg.c | 3 ++ net/mac80211/debugfs.c | 3 ++ net/mac80211/debugfs_sta.c | 50 ++++++++++++++++++++++++-- net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/main.c | 4 +++ net/mac80211/sta_info.c | 45 +++++++++++++++++++++-- net/mac80211/sta_info.h | 13 +++++++ net/mac80211/status.c | 6 ++++ net/mac80211/tx.c | 90 +++++++++++++++++++++++++++++++++++++++++++--- 10 files changed, 264 insertions(+), 10 deletions(-)
include/net/mac80211.h +58 -0
@@ -2334,6 +2334,8 @@ enum ieee80211_hw_flags {* @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from * them are encountered. The default should typically not be changed, * unless the driver has good reasons for needing more buffers. +* +* @airtime_weight: Default airtime weight preferred by driver. */ struct ieee80211_hw {struct ieee80211_conf conf;
@@ -2370,6 +2372,7 @@ struct ieee80211_hw {const struct ieee80211_cipher_scheme *cipher_schemes;u8 max_nan_de_entries;u8 tx_sk_pacing_shift; +u32 airtime_weight; }; static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
@@ -5350,6 +5353,34 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,void ieee80211_send_eosp_nullfunc (struct ieee80211_sta *pubsta,int tid);/** +* ieee80211_sta_register_airtime - register airtime usage for a sta/tid +* +* Register airtime usage for a given sta on a given tid. The driver can call +* this function to notify mac80211 that a station used a certain amount of +* airtime. This information will be used by the TXQ scheduler to schedule +* stations in a way that ensures airtime fairness. +* +* The reported airtime should as a minimum include all time that is spent +* transmitting to the remote station, including overhead and padding, but not +* including time spent waiting for a TXOP. If the time is not reported by the +* hardware it can in some cases be calculated from the rate and known frame +* composition. When possible, the time should include any failed transmission +* attempts. +* +* The driver can either call this function synchronously for every packet or +* aggregate, or asynchronously as airtime usage information becomes available. +* TX and RX airtime can be reported together, or separately by setting one of +* them to 0. +* +* @pubsta: the station +* @tid: the TID to register airtime for +* @tx_airtime: airtime used during TX (in usec) +* @rx_airtime: airtime used during RX (in usec) +*/ +void ieee80211_sta_register_airtime (struct ieee80211_sta *pubsta,u8 tid, +u32 tx_airtime,u32 rx_airtime); + +/** * ieee80211_iter_keys - iterate keys programmed into the device * @hw: pointer obtained from ieee80211_alloc_hw() * @vif: virtual interface to iterate, may be %NULL for all
@@ -6107,6 +6138,33 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,void ieee80211_txq_schedule_end (struct ieee80211_hw *hw,u8 ac);/** +* ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit +* +* This function is used to check whether given txq is allowed to transmit by +* the airtime scheduler, and can be used by drivers to access the airtime +* fairness accounting without going using the scheduling order enfored by +* next_txq(). +* +* Returns %true if the airtime scheduler thinks the TXQ should be allowed to +* transmit, and %false if it should be throttled. This function can also have +* the side effect of rotating the TXQ in the scheduler rotation, which will +* eventually bring the deficit to positive and allow the station to transmit +* again. +* +* The API ieee80211_txq_may_transmit() also ensures that TXQ list will be +* aligned aginst driver's own round-robin scheduler list. i.e it rotates +* the TXQ list till it makes the requested node becomes the first entry +* in TXQ list. Thus both the TXQ list and driver's list are in sync. If this +* function returns %true, the driver is expected to schedule packets +* for transmission, and then return the TXQ through ieee80211_return_txq(). +* +* @hw: pointer as obtained from ieee80211_alloc_hw() +* @txq: pointer obtained from station or virtual interface +*/ +bool ieee80211_txq_may_transmit (struct ieee80211_hw *hw, +struct ieee80211_txq *txq); + +/** * ieee80211_txq_get_depth - get pending frame/byte count of given txq * * The values are not guaranteed to be coherent with regard to each other, i.e.
net/mac80211/cfg.c +3 -0
@@ -1388,6 +1388,9 @@ static int sta_apply_parameters(struct ieee80211_local *local,if (ieee80211_vif_is_mesh (&sdata->vif))sta_apply_mesh_params (local, sta, params); +if (params->airtime_weight) + sta->airtime_weight = params->airtime_weight; +/* set the STA state after all sta info from usermode has been set */ if (test_sta_flag (sta,WLAN_STA_TDLS_PEER ) || set &BIT (NL80211_STA_FLAG_ASSOCIATED )) {
net/mac80211/debugfs.c +3 -0
@@ -383,6 +383,9 @@ void debugfs_hw_add(struct ieee80211_local *local)if (local->ops->wake_tx_queue)DEBUGFS_ADD_MODE (aqm,0600 ); +debugfs_create_u16 ("airtime_flags" ,0600 , + phyd, &local->airtime_flags); + statsd =debugfs_create_dir ("statistics" , phyd);/* if the dir failed, don't put all the other things into the root! */
net/mac80211/debugfs_sta.c +47 -3
68 lines not on this page · raw message
net/mac80211/ieee80211_i.h +2 -0
@@ -1136,6 +1136,8 @@ struct ieee80211_local {struct list_head active_txqs[IEEE80211_NUM_ACS ];u16 schedule_round[IEEE80211_NUM_ACS ]; +u16 airtime_flags; +const struct ieee80211_ops *ops;/*
net/mac80211/main.c +4 -0
@@ -667,6 +667,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,INIT_LIST_HEAD (&local->active_txqs[i]);spin_lock_init (&local->active_txq_lock[i]); } + local->airtime_flags =AIRTIME_USE_TX |AIRTIME_USE_RX ;INIT_LIST_HEAD (&local->chanctx_list);mutex_init (&local->chanctx_mtx);
@@ -1153,6 +1154,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)if (!local->hw.max_nan_de_entries) local->hw.max_nan_de_entries =IEEE80211_MAX_NAN_INSTANCE_ID ; +if (!local->hw.airtime_weight) + local->hw.airtime_weight =IEEE80211_DEFAULT_AIRTIME_WEIGHT ; + result =ieee80211_wep_init (local);if (result <0 ) wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
net/mac80211/sta_info.c +42 -3
79 lines not on this page · raw message
net/mac80211/sta_info.h +13 -0
@@ -127,6 +127,16 @@ enum ieee80211_agg_stop_reason { AGG_STOP_DESTROY_STA, }; +/* Debugfs flags to enable/disable use of RX/TX airtime in scheduler */ +#define AIRTIME_USE_TX BIT(0) +#define AIRTIME_USE_RX BIT(1) + +struct airtime_info { +u64 rx_airtime; +u64 tx_airtime; +s64 deficit; +}; +struct sta_info ;/**
@@ -563,6 +573,9 @@ struct sta_info { } tx_stats;u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK +1 ]; +struct airtime_info airtime[IEEE80211_NUM_ACS ]; +u16 airtime_weight; +/* * Aggregation information, locked with lock. */
net/mac80211/status.c +6 -0
@@ -818,6 +818,12 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,ieee80211_sta_tx_notify (sta->sdata, (void *) skb->data, acked, info->status.tx_time); +if (info->status.tx_time && +wiphy_ext_feature_isset (local->hw.wiphy, +NL80211_EXT_FEATURE_AIRTIME_FAIRNESS )) +ieee80211_sta_register_airtime (&sta->sta, tid, + info->status.tx_time,0 ); +if (ieee80211_hw_check (&local->hw,REPORTS_TX_ACK_STATUS )) {if (info->flags &IEEE80211_TX_STAT_ACK ) {if (sta->status_stats.lost_packets)
net/mac80211/tx.c +86 -4
117 lines not on this page · raw message
Signature · 1 line
1.9.1
Toke Høiland-Jørgensen
maintainerRe: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 52 lines · Rajkumar Manoharan
From: Toke Høiland-Jørgensen <[email protected]>
This adds airtime accounting and scheduling to the mac80211 TXQ scheduler. A new callback,
ieee80211_sta_register_airtime(), is added that drivers can call to report airtime usage for stations.When airtime information is present, mac80211 will schedule TXQs (through
ieee80211_next_txq()) in a way that enforces airtime fairness between active stations. This scheduling works the same way as the ath9k in-driver airtime fairness scheduling. If no airtime usage is reported by the driver, the scheduler will default to round-robin scheduling.For drivers that don't control TXQ scheduling in software, a new API function,
ieee80211_txq_may_transmit(), is added which the driver can use to check if the TXQ is eligible for transmission, or should be throttled to enforce fairness. Calls to this function must also be enclosed in ieee80211_txq_schedule_{start,end}() calls to ensure proper locking.The API
ieee80211_txq_may_transmit()also ensures that TXQ list will be aligned aginst driver's own round-robin scheduler list. i.e it rotates the TXQ list till it makes the requested node becomes the first entry in TXQ list. Thus both the TXQ list and driver's list are in sync.Signed-off-by Toke Høiland-Jørgensen <[email protected]>Signed-off-by Rajkumar Manoharan <[email protected]>--- include/net/mac80211.h | 58 ++++++++++++++++++++++++++++++ net/mac80211/cfg.c | 3 ++ net/mac80211/debugfs.c | 3 ++ net/mac80211/debugfs_sta.c | 50 ++++++++++++++++++++++++-- net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/main.c | 4 +++ net/mac80211/sta_info.c | 45 +++++++++++++++++++++-- net/mac80211/sta_info.h | 13 +++++++ net/mac80211/status.c | 6 ++++ net/mac80211/tx.c | 90 +++++++++++++++++++++++++++++++++++++++++++--- 10 files changed, 264 insertions(+), 10 deletions(-)include/net/mac80211.h +2
-0@@ -2334,6 +2334,8 @@ enum ieee80211_hw_flags {* @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from * them are encountered. The default should typically not be changed, * unless the driver has good reasons for needing more buffers. +* +* @airtime_weight: Default airtime weight preferred by driver. */ struct ieee80211_hw {struct ieee80211_conf conf;
include/net/mac80211.h struct ieee80211_hw { · line 2376
Quoted 5 lines
include/net/mac80211.h +1
-0@@ -2370,6 +2372,7 @@ struct ieee80211_hw {const struct ieee80211_cipher_scheme *cipher_schemes;u8 max_nan_de_entries;u8 tx_sk_pacing_shift; +u32 airtime_weight; };
This doesn't make sense. Airtime weights can be set by userspace, so even if a driver sets another default it is not guaranteed to be honoured. So what's the point?
Quoted 21 lines
include/net/mac80211.h +21
-0+bool ieee80211_txq_may_transmit (struct ieee80211_hw *hw, +struct ieee80211_txq *txq) +{ +struct ieee80211_local *local =hw_to_local (hw); +struct txq_info *iter, *tmp, *txqi =to_txq_info (txq); +struct sta_info *sta; +u8 ac = txq->ac; + +lockdep_assert_held (&local->active_txq_lock[ac]); + +if (!txqi->txq.sta) + goto out; + +if (list_empty (&txqi->schedule_order)) + goto out; + +list_for_each_entry_safe (iter, tmp, &local->active_txqs[ac], + schedule_order) { +if (iter == txqi) +break ; +
include/net/mac80211.h struct ieee80211_hw {
Quoted 10 lines
include/net/mac80211.h +10
-0+if (!iter->txq.sta) { +list_move_tail (&iter->schedule_order, + &local->active_txqs[ac]); +continue ; + } + sta = container_of(iter->txq.sta, struct sta_info, sta); +if (sta->airtime[ac].deficit <0 ) + sta->airtime[ac].deficit += sta->airtime_weight; +list_move_tail (&iter->schedule_order, &local->active_txqs[ac]); + }
So since we're rotating the queue on every call to the function, I'm wondering if this actually succeeds in throttling the slow station's airtime usage enough to achieve fairness? So I'll ask again: Did you test the fairness performance, and how?
Also, taking a step back:
With this, we're doing lots of work to make sure that the hardware's round-robin scheduling queue lines up with mac80211; so if we do this anyway, why can't we just control the order directly from mac80211 (which is what we do with the other next_txq() API)?
-Toke
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 3 lines · Toke Høiland-Jørgensen
Quoted 1 line · Rajkumar Manoharan
From: Toke Høiland-Jørgensen <[email protected]>
[...]
Quoted 9 lines
include/net/mac80211.h struct ieee80211_hw { · line 2376
Quoted 4 lines
include/net/mac80211.h +1
-0u8 max_nan_de_entries;u8 tx_sk_pacing_shift; +u32 airtime_weight; };This doesn't make sense. Airtime weights can be set by userspace, so even if a driver sets another default it is not guaranteed to be honoured. So what's the point?
The reason for driver specific default is to avoid performance impact in ath10k when the user is using vanilla ath10k with default airtime. As I mentioned earlier, mac80211 default (256us) is too low for 11ac devices especially with driver is bursting aggregation.
Yes. I do understand the user can change airtime at anytime but It must be noted that different airtime weight will result in different throughput. IMHO the defaults should not impact current benchmark. Otherwise it will be alarmed as regression later. isn't it?
Quoted 5 lines
So since we're rotating the queue on every call to the function, I'm wondering if this actually succeeds in throttling the slow station's airtime usage enough to achieve fairness? So I'll ask again: Did you test the fairness performance, and how?
We are collecting data of mixed clients (11ac, 11n and legacy) keeping them at same distance and different distance. So that lower rate clients will interfere higher MCS rate station. Also configuring different airtime weight for each stations so that throttling low rate clients more should help higher performing(better MCS) clients.
By allowing different airtime for each stations, the user can control guest network over primary network. Also It helped to improve performance of preferred station and algo. to control station is given to cloud or user application.
As of now, We are testing with 4 11ac clients of same distance. And collecting the performance data in multiple iteration. Below are current data of station's performance (Mbps) against airtime weight.
airtime station1(%airtime) station2 station3 station4 (Mbps)
No ATF 182 168 166 169
4ms 170 (100%) 164 (100%) 185 (100%) 175 (100%)
4ms 277 (70%) 115 (10%) 103 (10%) 105 (10%)
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
STA1(11ac) STA2 (11n) STA3(11a)
========== ========== =========No ATF 225 166 3.5
ATF (4ms) 234 151 3.5
Quoted 8 lines
Also, taking a step back:
With this, we're doing lots of work to make sure that the hardware's round-robin scheduling queue lines up with mac80211; so if we do this anyway, why can't we just control the order directly from mac80211 (which is what we do with the other
next_txq()API)?
The only way to enforce mac80211 ordering in ath10k is to disable pull mode in firmware and always operates in push mode similar to ath9k.
-Rajkumar
Toke Høiland-Jørgensen
maintainerRe: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 19 lines · Rajkumar Manoharan
Quoted 3 lines · Toke Høiland-Jørgensen
Quoted 1 line · Rajkumar Manoharan
From: Toke Høiland-Jørgensen <[email protected]>
[...]
Quoted 9 lines
include/net/mac80211.h struct ieee80211_hw { · line 2376
Quoted 4 lines
include/net/mac80211.h +1
-0u8 max_nan_de_entries;u8 tx_sk_pacing_shift; +u32 airtime_weight; };This doesn't make sense. Airtime weights can be set by userspace, so even if a driver sets another default it is not guaranteed to be honoured. So what's the point?
The reason for driver specific default is to avoid performance impact in ath10k when the user is using vanilla ath10k with default airtime. As I mentioned earlier, mac80211 default (256us) is too low for 11ac devices especially with driver is bursting aggregation.
Quoted 4 lines
Yes. I do understand the user can change airtime at anytime but It must be noted that different airtime weight will result in different throughput. IMHO the defaults should not impact current benchmark. Otherwise it will be alarmed as regression later. isn't it?
My point is that if the user has to know the implementation-specific limitations of each driver before setting a weight, then it's not a particularly friendly API. I think we should be able to do better than that...
Quoted 25 lines
Quoted 5 lines
So since we're rotating the queue on every call to the function, I'm wondering if this actually succeeds in throttling the slow station's airtime usage enough to achieve fairness? So I'll ask again: Did you test the fairness performance, and how?
We are collecting data of mixed clients (11ac, 11n and legacy) keeping them at same distance and different distance. So that lower rate clients will interfere higher MCS rate station. Also configuring different airtime weight for each stations so that throttling low rate clients more should help higher performing(better MCS) clients.
By allowing different airtime for each stations, the user can control guest network over primary network. Also It helped to improve performance of preferred station and algo. to control station is given to cloud or user application.
As of now, We are testing with 4 11ac clients of same distance. And collecting the performance data in multiple iteration. Below are current data of station's performance (Mbps) against airtime weight.
airtime station1(%airtime) station2 station3 station4
(Mbps)No ATF 182 168 166 169
Quoted 7 lines
4ms 170 (100%) 164 (100%) 185 (100%) 175 (100%)
4ms 277 (70%) 115 (10%) 103 (10%) 105 (10%)
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?
Quoted 7 lines
STA1(11ac) STA2 (11n) STA3(11a) ========== ========== =========No ATF 225 166 3.5
ATF (4ms) 234 151 3.5
This also shows like ATF has no effect?
Quoted 9 lines
Quoted 7 lines
Also, taking a step back:
With this, we're doing lots of work to make sure that the hardware's round-robin scheduling queue lines up with mac80211; so if we do this anyway, why can't we just control the order directly from mac80211 (which is what we do with the other
next_txq()API)?The only way to enforce mac80211 ordering in ath10k is to disable pull mode in firmware and always operates in push mode similar to ath9k.
And I assume that is not too likely to happen, or? What is the benefit of pull mode at the firmware level?
-Toke
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 7 lines · Toke Høiland-Jørgensen
Quoted 4 lines · Rajkumar Manoharan
Yes. I do understand the user can change airtime at anytime but It must be noted that different airtime weight will result in different throughput. IMHO the defaults should not impact current benchmark. Otherwise it will be alarmed as regression later. isn't it?
Quoted 5 lines
My point is that if the user has to know the implementation-specific limitations of each driver before setting a weight, then it's not a particularly friendly API. I think we should be able to do better than that...
Hmm.. I was trying to balance throughput vs CPU usage. Keeping lower threshold is causing more lock contention and impacting throughput. I thought of configuring default airtime_weight from hostapd for legacy, 11n and 11ac stations.
Quoted 9 lines
Quoted 9 lines
airtime station1(%airtime) station2 station3 station4
(Mbps)No ATF 182 168 166 169
4ms 170 (100%) 164 (100%) 185 (100%) 175 (100%)
4ms 277 (70%) 115 (10%) 103 (10%) 105 (10%)
Quoted 8 lines
Quoted 3 lines
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?
No. Will check that.
Quoted 6 lines
Quoted 2 lines
The only way to enforce mac80211 ordering in ath10k is to disable pull mode in firmware and always operates in push mode similar to ath9k.
And I assume that is not too likely to happen, or? What is the benefit of pull mode at the firmware level?
Pull mode mainly required to support MU-MIMO. IMHO both MUMIMO & ATF can not co-exist unless both are implemented at host driver. Fixing tx mode in ath10k needs firmware reload. By introducing modparam, pull-mode can be disabled.
-Rajkumar
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 6 lines · Rajkumar Manoharan
Quoted 5 lines · Toke Høiland-Jørgensen
Quoted 3 lines · Rajkumar Manoharan
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?
No. Will check that.
Toke,
From above results, different airtime for each station is reflecting on output performance. Unfortunately I don't see such tput difference, when the tx mode is fixed in push-only. Even low weight station is giving same performance. Are you also seeing the same behavior in your setup? Could you please share your results?
Not sure why low weight station (26us) is consuming more airtime than higher airtime station. Below result is taken in push-only mode that means only next_txq() ordering is followed.
cat /sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations/*/airtime
RX: 0 us
TX: 980443 us
Weight: 176
Deficit: VO: 256 us VI: 256 us BE: -91 us BK: 256 us
RX: 0 us
TX: 2008512 us
Weight: 26
Deficit: VO: 238 us VI: 256 us BE: 24 us BK: 256 us
RX: 0 us
TX: 513287 us
Weight: 26
Deficit: VO: 256 us VI: 256 us BE: 1 us BK: 256 us
RX: 0 us
TX: 576746 us
Weight: 26
Deficit: VO: 256 us VI: 256 us BE: 10 us BK: 256 us
-Rajkumar
Toke Høiland-Jørgensen
maintainerRe: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 16 lines · Rajkumar Manoharan
Quoted 6 lines · Rajkumar Manoharan
Quoted 5 lines · Toke Høiland-Jørgensen
Quoted 3 lines · Rajkumar Manoharan
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding
in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?No. Will check that.
Quoted 8 lines
Toke,
From above results, different airtime for each station is reflecting on
output performance. Unfortunately I don't see such tput difference, when the tx mode is fixed in push-only. Even low weight station is giving same
performance. Are you also seeing the same behavior in your setup? Could you please share your results?
Sorry, I've been travelling this week; I'll be back in the office next week and can run some tests then. I may also have an idea for a different algorithm that will work better in pull mode, but need to see if it works at all first :)
How do I force ath10k into push mode?
-Toke
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 28 lines · Toke Høiland-Jørgensen
Quoted 18 lines · Rajkumar Manoharan
Quoted 6 lines · Rajkumar Manoharan
Quoted 5 lines · Toke Høiland-Jørgensen
Quoted 3 lines · Rajkumar Manoharan
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding
in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?No. Will check that.
Toke,
Quoted 7 lines
From above results, different airtime for each station is reflecting
on
output performance. Unfortunately I don't see such tput difference, when the tx mode is fixed in push-only. Even low weight station is giving same
performance. Are you also seeing the same behavior in your setup? Could you please share your results?
Quoted 5 lines
Sorry, I've been travelling this week; I'll be back in the office next week and can run some tests then. I may also have an idea for a different algorithm that will work better in pull mode, but need to see if it works at all first :)
Wow... :)
Meanwhile we did some more experiments with both modes. The experiment was done in open environment and fixed rate and UDP traffic ran for 60 seconds.
Seems like push mode not honoring the configured weight. Always the airtime was almost same whereas in pull-mode airtime is changing based on configured weight. Hence I would like to know your results.
sta1 sta2 sta3 sta4 pull-mode 8s(205us) 18s(3.2ms) 8s(205us) 14s(410us) 12s(256us) 12s(256us) 13s(256us) 12s(256us) 14s(4ms) 13s(4ms) 14s(4ms) 13s(4ms)
push-mode 15s(205us) 12s(3.2ms) 16s(205us) 12s(410us)
15s(256us) 12s(256us) 16s(256us) 12s(256us) 14s(4ms) 13s(4ms) 16s(4ms) 12s(4ms)
Quoted 2 lines
How do I force ath10k into push mode?
Attaching the change to fix push mode.
-Rajkumar
drivers/net/wireless/ath/ath10k/core.c +2 -0
@@ -41,6 +41,7 @@static bool uart_print;static bool skip_otp;static bool rawmode; +bool peer_flow_ctl = false;unsigned long ath10k_coredump_mask =BIT (ATH10K_FW_CRASH_DUMP_REGISTERS ) |BIT (ATH10K_FW_CRASH_DUMP_CE_DATA );
@@ -52,6 +53,7 @@module_param (skip_otp, bool,0644 );module_param (rawmode, bool,0644 );module_param_named (coredump_mask, ath10k_coredump_mask, ulong,0444 ); +module_param (peer_flow_ctl, bool,0644 );MODULE_PARM_DESC (debug_mask,"Debugging mask" );MODULE_PARM_DESC (uart_print,"Uart target debugging" );
drivers/net/wireless/ath/ath10k/core.h +1 -0
@@ -1201,6 +1201,7 @@ static inline bool ath10k_peer_stats_enabled(struct ath10k *ar) }extern unsigned long ath10k_coredump_mask; +extern bool peer_flow_ctl; struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, enum ath10k_bus bus,
drivers/net/wireless/ath/ath10k/mac.c +3 -0
@@ -216,6 +216,9 @@ int ath10k_mac_ext_resource_config(struct ath10k *ar, u32 val)else platform_type =WMI_HOST_PLATFORM_HIGH_PERF ; +if (!peer_flow_ctl) + platform_type =WMI_HOST_PLATFORM_LOW_PERF_NO_FETCH ; + ret =ath10k_wmi_ext_resource_config (ar, platform_type, val);if (ret && ret != -EOPNOTSUPP ) {
drivers/net/wireless/ath/ath10k/wmi.h +1 -0
@@ -7128,6 +7128,7 @@ struct wmi_pno_scan_req {enum wmi_host_platform_type {WMI_HOST_PLATFORM_HIGH_PERF ,WMI_HOST_PLATFORM_LOW_PERF , +WMI_HOST_PLATFORM_LOW_PERF_NO_FETCH , };enum wmi_bss_survey_req_type {
Toke Høiland-Jørgensen
maintainerRe: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 39 lines · Rajkumar Manoharan
Quoted 31 lines · Toke Høiland-Jørgensen
Quoted 19 lines · Rajkumar Manoharan
Quoted 8 lines · Rajkumar Manoharan
Quoted 7 lines · Toke Høiland-Jørgensen
Quoted 4 lines · Rajkumar Manoharan
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
Quoted 8 lines
Quoted 6 lines
So this looks like it's doing *something*, but not like it's succeeding
in achieving the set percentages. Did you check if the actual airtime
values (in debugfs) corresponds to the configured weights?No. Will check that.
Toke,
Quoted 9 lines
From above results, different airtime for each station is reflecting
on
output performance. Unfortunately I don't see such tput difference, when
the tx mode is fixed in push-only. Even low weight station is giving same
performance. Are you also seeing the same behavior in your setup? Could
you please share your results?Quoted 5 lines
Sorry, I've been travelling this week; I'll be back in the office next week and can run some tests then. I may also have an idea for a different algorithm that will work better in pull mode, but need to see if it works at all first :)
Wow... :)
Quoted 7 lines
Meanwhile we did some more experiments with both modes. The experiment was done in open environment and fixed rate and UDP traffic ran for 60 seconds.
Seems like push mode not honoring the configured weight. Always the airtime was almost same whereas in pull-mode airtime is changing based on configured weight. Hence I would like to know your results.
Right, so I verified that the current version of the patch set still works with ath9k. However, the ath10k card I have doesn't seem to support peer stats, so I can't test ath10k.
$ lspci | grep Qualcomm 03:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter
$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/chip_id 0x043202ff
$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/wmi_services | grep PEER WMI_SERVICE_PEER_CACHING - WMI_SERVICE_PEER_STATS -
Is there a way to force-enable airtime support, is this a hardware issue?
Quoted 8 lines
sta1 sta2 sta3 sta4 pull-mode 8s(205us) 18s(3.2ms) 8s(205us) 14s(410us) 12s(256us) 12s(256us) 13s(256us) 12s(256us) 14s(4ms) 13s(4ms) 14s(4ms) 13s(4ms)push-mode 15s(205us) 12s(3.2ms) 16s(205us) 12s(410us)
15s(256us) 12s(256us) 16s(256us) 12s(256us) 14s(4ms) 13s(4ms) 16s(4ms) 12s(4ms)
Right, so the pull-mode results are encouraging! *Something* is happening, at least, even though the aggregate airtime doesn't quite match the ratios of the configured weights.
Are you running the UDP generator on the AP itself, or on a separate device, BTW? If it's on the AP, the userspace socket can get throttled, which will interfere with results, so it's better to have it on a separate device (connected via ethernet).
As for push-mode, could this be because of bad buffer management? I.e., because there's a lag between the time airtime is registered, and the time that airtime usage is reported, the driver just pushes a whole bunch of packets to the firmware when it gets the chance, which prevents the scheduler from throttling properly. This could also explain the better, but not quite perfect, results in pull mode, assuming that pull mode results in better firmware buffer management which reduces, but doesn't quite remove, the lag.
If this is indeed the reason, the queue limit patches should hopefully be a solution. So guess we need to get those working as well :)
-Toke
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 18 lines · Toke Høiland-Jørgensen
Quoted 7 lines · Rajkumar Manoharan
Meanwhile we did some more experiments with both modes. The experiment was done in open environment and fixed rate and UDP traffic ran for 60 seconds.
Seems like push mode not honoring the configured weight. Always the airtime was almost same whereas in pull-mode airtime is changing based on configured weight. Hence I would like to know your results.
Right, so I verified that the current version of the patch set still works with ath9k. However, the ath10k card I have doesn't seem to support peer stats, so I can't test ath10k.
$ lspci | grep Qualcomm 03:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter
Quoted 7 lines
$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/chip_id 0x043202ff$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/wmi_services | grep PEER WMI_SERVICE_PEER_CACHING - WMI_SERVICE_PEER_STATS -
Oops... Yeah 988x firmware (10.2.4) does not have peer stats support.
Quoted 3 lines
Is there a way to force-enable airtime support, is this a hardware issue?
Unfortunately not. There is one more pending change that handles airtime report from HTT tx-compl. Again it depends firmware support. These experiments are taken with this f/w interface. Will post the change.
Quoted 9 lines
Quoted 8 lines
sta1 sta2 sta3 sta4 pull-mode 8s(205us) 18s(3.2ms) 8s(205us) 14s(410us) 12s(256us) 12s(256us) 13s(256us) 12s(256us) 14s(4ms) 13s(4ms) 14s(4ms) 13s(4ms)push-mode 15s(205us) 12s(3.2ms) 16s(205us) 12s(410us)
15s(256us) 12s(256us) 16s(256us) 12s(256us) 14s(4ms) 13s(4ms) 16s(4ms) 12s(4ms)
Quoted 9 lines
Right, so the pull-mode results are encouraging! *Something* is happening, at least, even though the aggregate airtime doesn't quite match the ratios of the configured weights.
Are you running the UDP generator on the AP itself, or on a separate device, BTW? If it's on the AP, the userspace socket can get throttled, which will interfere with results, so it's better to have it on a separate device (connected via ethernet).
Traffic b/w wired client (via ethernet) and wireless clients.
Quoted 9 lines
As for push-mode, could this be because of bad buffer management? I.e., because there's a lag between the time airtime is registered, and the time that airtime usage is reported, the driver just pushes a whole bunch of packets to the firmware when it gets the chance, which prevents the scheduler from throttling properly. This could also explain the better, but not quite perfect, results in pull mode, assuming that pull mode results in better firmware buffer management which reduces, but doesn't quite remove, the lag.
Hmm... I agree that lag in reporting airtime may cause more data push to hw. Right now both tx and tx-compl are serialized by active_txq_lock. So once lock acquired by tx path, it will download all frames. i.e it is even true for ath9k driver. Hence I am wondering how it is working only with ath9k.
In ath10k, The airtime always be reported in tx-completion. I dont see much lag from my experiments.
Quoted 3 lines
If this is indeed the reason, the queue limit patches should hopefully be a solution. So guess we need to get those working as well :)
I would prefer to baseline the basic infra into upstream first and do enhancement on top of that. I request you to revisit maintaining per driver default. Otherwise there would be performance impact with 256us. :(
-Rajkumar
Toke Høiland-Jørgensen
maintainerRe: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
Quoted 30 lines · Rajkumar Manoharan
Quoted 18 lines · Toke Høiland-Jørgensen
Quoted 7 lines · Rajkumar Manoharan
Meanwhile we did some more experiments with both modes. The experiment was done in open environment and fixed rate and UDP traffic ran for 60 seconds.
Seems like push mode not honoring the configured weight. Always the airtime was almost same whereas in pull-mode airtime is changing based on configured weight. Hence I would like to know your results.
Right, so I verified that the current version of the patch set still works with ath9k. However, the ath10k card I have doesn't seem to support peer stats, so I can't test ath10k.
$ lspci | grep Qualcomm 03:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network AdapterQuoted 7 lines
$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/chip_id 0x043202ff$ cat /sys/kernel/debug/ieee80211/phy1/ath10k/wmi_services | grep PEER WMI_SERVICE_PEER_CACHING - WMI_SERVICE_PEER_STATS -Oops... Yeah 988x firmware (10.2.4) does not have peer stats support.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Is there a way to force-enable airtime support, is this a hardware issue?
Unfortunately not. There is one more pending change that handles airtime report from HTT tx-compl. Again it depends firmware support. These experiments are taken with this f/w interface. Will post the change.
Right, thought so. Too bad. Guess you are doing all the ath10k testing, then ;)
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
sta1 sta2 sta3 sta4 pull-mode 8s(205us) 18s(3.2ms) 8s(205us) 14s(410us) 12s(256us) 12s(256us) 13s(256us) 12s(256us) 14s(4ms) 13s(4ms) 14s(4ms) 13s(4ms)push-mode 15s(205us) 12s(3.2ms) 16s(205us) 12s(410us)
15s(256us) 12s(256us) 16s(256us) 12s(256us) 14s(4ms) 13s(4ms) 16s(4ms) 12s(4ms)Right, so the pull-mode results are encouraging! *Something* is happening, at least, even though the aggregate airtime doesn't quite match the ratios of the configured weights.
Quoted 6 lines
Quoted 5 lines
Are you running the UDP generator on the AP itself, or on a separate device, BTW? If it's on the AP, the userspace socket can get throttled, which will interfere with results, so it's better to have it on a separate device (connected via ethernet).
Traffic b/w wired client (via ethernet) and wireless clients.
Cool.
Quoted 10 lines
Quoted 10 lines
As for push-mode, could this be because of bad buffer management? I.e., because there's a lag between the time airtime is registered, and the time that airtime usage is reported, the driver just pushes a whole bunch of packets to the firmware when it gets the chance, which prevents
the scheduler from throttling properly. This could also explain the better, but not quite perfect, results in pull mode, assuming that pull mode results in better firmware buffer management which reduces, but doesn't quite remove, the lag.
Quoted 5 lines
Hmm... I agree that lag in reporting airtime may cause more data push to hw. Right now both tx and tx-compl are serialized by
active_txq_lock. So once lock acquired by tx path, it will download all frames. i.e it is even true for ath9k driver. Hence I am wondering how it is working only with ath9k.
If enough packets are dequeued at once that the TXQ empties and is not put back on the scheduling loop, the next_txq() loop is just going to loop through the remaining TXQs and immediately increase their quantum. In ath9k, there's a maximum of two outstanding aggregates below the TXQ level, but I think you mentioned that ath10k can queue thousands in firmware?
Your patch removes the 'max 16 packets at a time' check before the call to ath10k_mac_tx_push_txq(); try adding that back and see if it helps?
Quoted 5 lines
Quoted 3 lines
If this is indeed the reason, the queue limit patches should hopefully be a solution. So guess we need to get those working as well :)
I would prefer to baseline the basic infra into upstream first and do enhancement on top of that.
Sure, I'm fine with merging this first and building on top.
Quoted 2 lines
I request you to revisit maintaining per driver default. Otherwise there would be performance impact with 256us. :(
Hmm, how about we make it a driver-specified multiplier instead (which could be 4, 8 or 16 for ath10k)? That way it would still work even if userspace changes the weights. It would affect the minimum possible granularity, but that is probably acceptable; and we would be free to change the mechanism later, without affecting the userspace API.
-Toke
Re: [PATCH 3/6] mac80211: Add airtime accounting and scheduling to TXQs
In reply to Toke Høiland-JørgensenQuoted 69 lines · 在 2018-10-28 23:48,Toke Høiland-Jørgensen 写道:
Quoted 19 lines · Rajkumar Manoharan
Quoted 3 lines · Toke Høiland-Jørgensen
Quoted 1 line · Rajkumar Manoharan
From: Toke Høiland-Jørgensen <[email protected]>
[...]
Quoted 9 lines
include/net/mac80211.h struct ieee80211_hw { · line 2376
Quoted 4 lines
include/net/mac80211.h +1
-0u8 max_nan_de_entries;u8 tx_sk_pacing_shift; +u32 airtime_weight; };This doesn't make sense. Airtime weights can be set by userspace, so even if a driver sets another default it is not guaranteed to be honoured. So what's the point?
The reason for driver specific default is to avoid performance impact in ath10k when the user is using vanilla ath10k with default airtime. As I mentioned earlier, mac80211 default (256us) is too low for 11ac devices especially with driver is bursting aggregation.
Quoted 4 lines
Yes. I do understand the user can change airtime at anytime but It must be noted that different airtime weight will result in different throughput. IMHO the defaults should not impact current benchmark. Otherwise it will be alarmed as regression later. isn't it?
My point is that if the user has to know the implementation-specific limitations of each driver before setting a weight, then it's not a particularly friendly API. I think we should be able to do better than that...
Quoted 25 lines
Quoted 5 lines
So since we're rotating the queue on every call to the function, I'm wondering if this actually succeeds in throttling the slow station's airtime usage enough to achieve fairness? So I'll ask again: Did you test the fairness performance, and how?
We are collecting data of mixed clients (11ac, 11n and legacy) keeping them at same distance and different distance. So that lower rate clients will interfere higher MCS rate station. Also configuring different airtime weight for each stations so that throttling low rate clients more should help higher performing(better MCS) clients.
By allowing different airtime for each stations, the user can control guest network over primary network. Also It helped to improve performance of preferred station and algo. to control station is given to cloud or user application.
As of now, We are testing with 4 11ac clients of same distance. And collecting the performance data in multiple iteration. Below are current data of station's performance (Mbps) against airtime weight.
airtime station1(%airtime) station2 station3 station4
(Mbps)No ATF 182 168 166 169
Quoted 7 lines
4ms 170 (100%) 164 (100%) 185 (100%) 175 (100%)
4ms 277 (70%) 115 (10%) 103 (10%) 105 (10%)
4ms 223 (40%) 214 (40%) 109 (10%) 94 (10%)
4ms 337 (90%) 182 (8%) 23 (1%) 30 (1%)
So this looks like it's doing *something*, but not like it's succeeding in achieving the set percentages. Did you check if the actual airtime values (in debugfs) corresponds to the configured weights?
Quoted 1 line
Quoted 16 lines
Quoted 6 lines
STA1(11ac) STA2 (11n) STA3(11a) ========== ========== =========No ATF 225 166 3.5
ATF (4ms) 234 151 3.5
This also shows like ATF has no effect?
Quoted 7 lines
Quoted 7 lines
Also, taking a step back:
With this, we're doing lots of work to make sure that the hardware's round-robin scheduling queue lines up with mac80211; so if we do this anyway, why can't we just control the order directly from mac80211 (which is what we do with the other
next_txq()API)?
Toke and Raj,
How about treating any txqs before the txq that FW asked for in push-pull mode as pending txqs? Then we can dequeue and reorder them.And airtime weight need to be tuned to make sure it won't cost too much time. After that, check the txq FW wishes to fetch in txq_may_transmit.
Is this way able to achieve fairness and line up with mac80211? Also, we may need to consider if FW supports in this way.
Quoted 7 lines
Quoted 2 lines
The only way to enforce mac80211 ordering in ath10k is to disable pull mode in firmware and always operates in push mode similar to ath9k.
And I assume that is not too likely to happen, or? What is the benefit of pull mode at the firmware level?
-Toke
PATCH 4/6 ath9k: Switch to mac80211 TXQ scheduling and airtime APIs
In reply to Rajkumar ManoharanFrom: Toke Høiland-Jørgensen <[email protected]>
This moves the ath9k driver to use the mac80211 TXQ scheduling and airtime accounting APIs, removing the corresponding state tracking inside the driver.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 14 -- drivers/net/wireless/ath/ath9k/debug.c | 3 - drivers/net/wireless/ath/ath9k/debug.h | 8 - drivers/net/wireless/ath/ath9k/debug_sta.c | 70 --------- drivers/net/wireless/ath/ath9k/init.c | 3 +- drivers/net/wireless/ath/ath9k/recv.c | 9 +- drivers/net/wireless/ath/ath9k/xmit.c | 244 +++++++++-------------------- 7 files changed, 73 insertions(+), 278 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -14
@@ -112,8 +112,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,#define ATH_TXFIFO_DEPTH 8#define ATH_TX_ERROR 0x01 -#define ATH_AIRTIME_QUANTUM 300/* usec */ -/* Stop tx traffic 1ms before the GO goes away */ #define ATH_P2P_PS_STOP_TIME 1000
@@ -246,10 +244,8 @@ struct ath_atx_tid {s8 bar_index;bool active;bool clear_ps_filter; -bool has_queued; }; -void __ath_tx_queue_tid (struct ath_softc *sc,struct ath_atx_tid *tid);void ath_tx_queue_tid (struct ath_softc *sc,struct ath_atx_tid *tid);struct ath_node {
@@ -263,12 +259,9 @@ struct ath_node {bool sleeping;bool no_ps_filter; -s64 airtime_deficit[IEEE80211_NUM_ACS ]; -u32 airtime_rx_start;#ifdef CONFIG_ATH9K_STATION_STATISTICS struct ath_rx_rate_stats rx_rate_stats; -struct ath_airtime_stats airtime_stats;#endif u8 key_idx[4 ];
@@ -986,11 +979,6 @@ struct ath_ant_comb {#define ATH9K_NUM_CHANCTX 2/* supports 2 operating channels */ -#define AIRTIME_USE_TX BIT(0) -#define AIRTIME_USE_RX BIT(1) -#define AIRTIME_USE_NEW_QUEUES BIT(2) -#define AIRTIME_ACTIVE (flags) (!!(flags & (AIRTIME_USE_TX|AIRTIME_USE_RX))) -struct ath_softc {struct ieee80211_hw *hw;struct device *dev;
@@ -1034,8 +1022,6 @@ struct ath_softc {short nbcnvifs;unsigned long ps_usecount; -u16 airtime_flags;/* AIRTIME_* */ -struct ath_rx rx;struct ath_tx tx;struct ath_beacon beacon;
drivers/net/wireless/ath/ath9k/debug.c +0 -3
@@ -1443,9 +1443,6 @@ int ath9k_init_debug(struct ath_hw *ah)#endif debugfs_create_file ("tpc" ,0600 , sc->debug.debugfs_phy, sc, &fops_tpc); -debugfs_create_u16 ("airtime_flags" ,0600 , - sc->debug.debugfs_phy, &sc->airtime_flags); -debugfs_create_file ("nf_override" ,0600 , sc->debug.debugfs_phy, sc, &fops_nf_override);
drivers/net/wireless/ath/ath9k/debug.h +0 -8
@@ -319,20 +319,12 @@ static inline void ath9k_debug_stat_ant(struct ath_softc *sc,void ath_debug_rate_stats (struct ath_softc *sc,struct ath_rx_status *rs,struct sk_buff *skb); -void ath_debug_airtime (struct ath_softc *sc, -struct ath_node *an, -u32 rx,u32 tx);#else static inline void ath_debug_rate_stats (struct ath_softc *sc,struct ath_rx_status *rs,struct sk_buff *skb) { } -static inline void ath_debug_airtime (struct ath_softc *sc, -struct ath_node *an, -u32 rx,u32 tx) -{ -}#endif /* CONFIG_ATH9K_STATION_STATISTICS */ #endif /* DEBUG_H */
drivers/net/wireless/ath/ath9k/debug_sta.c +0 -70
80 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/init.c +1 -2
@@ -676,8 +676,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,/* Will be cleared in ath9k_start() */ set_bit (ATH_OP_INVALID , &common->op_flags); - sc->airtime_flags = (AIRTIME_USE_TX |AIRTIME_USE_RX | -AIRTIME_USE_NEW_QUEUES ); sc->sc_ah = ah; sc->dfs_detector =dfs_pattern_detector_init (common,NL80211_DFS_UNSET );
@@ -1013,6 +1011,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)SET_IEEE80211_PERM_ADDR (hw, common->macaddr);wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_CQM_RSSI_LIST ); +wiphy_ext_feature_set (hw->wiphy,NL80211_EXT_FEATURE_AIRTIME_FAIRNESS ); } int ath9k_init_device(u16 devid, struct ath_softc *sc,
drivers/net/wireless/ath/ath9k/recv.c +1 -8
@@ -1054,14 +1054,7 @@ static void ath_rx_count_airtime(struct ath_softc *sc, len, rxs->rate_idx, is_sp); } -if (!!(sc->airtime_flags &AIRTIME_USE_RX )) { -spin_lock_bh (&acq->lock); - an->airtime_deficit[acno] -= airtime; -if (an->airtime_deficit[acno] <=0 ) -__ath_tx_queue_tid (sc,ATH_AN_2_TID (an, tidno)); -spin_unlock_bh (&acq->lock); - } -ath_debug_airtime (sc, an, airtime,0 ); +ieee80211_sta_register_airtime (sta, tidno,0 , airtime); exit:rcu_read_unlock (); }
drivers/net/wireless/ath/ath9k/xmit.c +71 -173
489 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 5/6 ath10k: migrate to mac80211 txq scheduling
In reply to Rajkumar Manoharanath10k maintains common txqs list for all stations. This txq management can be removed by migrating to mac80211 txq APIs and let mac80211 handle txqs reordering based on reported airtime. By doing this, txq fairness maintained in ath10k i.e processing N frames per txq is removed. By adapting to mac80211 APIs, ath10k will support mac80211 based airtime fairness algorithm.
--- drivers/net/wireless/ath/ath10k/core.c | 2 - drivers/net/wireless/ath/ath10k/core.h | 6 +- drivers/net/wireless/ath/ath10k/htc.h | 1 - drivers/net/wireless/ath/ath10k/htt_rx.c | 8 +++ drivers/net/wireless/ath/ath10k/mac.c | 98 ++++++++++++++------------------ 5 files changed, 54 insertions(+), 61 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +0 -2
@@ -3065,9 +3065,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,mutex_init (&ar->conf_mutex);spin_lock_init (&ar->data_lock); -spin_lock_init (&ar->txqs_lock); -INIT_LIST_HEAD (&ar->txqs);INIT_LIST_HEAD (&ar->peers);init_waitqueue_head (&ar->peer_mapping_wq);init_waitqueue_head (&ar->htt.empty_tx_wq);
drivers/net/wireless/ath/ath10k/core.h +3 -3
@@ -90,6 +90,9 @@/* The magic used by QCA spec */ #define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_" +/* Default Airtime deficit (Tuned for multiclient performance) */ +#define ATH10K_DEFAULT_AIRTIME_WEIGHT 4096 +struct ath10k ;static inline const char *ath10k_bus_str (enum ath10k_bus bus)
@@ -1062,10 +1065,7 @@ struct ath10k {/* protects shared structure data */ spinlock_t data_lock; -/* protects: ar->txqs, artxq->list */ -spinlock_t txqs_lock; -struct list_head txqs;struct list_head arvifs;struct list_head peers;struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS ];
drivers/net/wireless/ath/ath10k/htc.h +0 -1
@@ -51,7 +51,6 @@*/ #define HTC_HOST_MAX_MSG_PER_RX_BUNDLE 8 -#define HTC_HOST_MAX_MSG_PER_TX_BUNDLE 16enum ath10k_htc_tx_flags {ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE =0x01 ,
drivers/net/wireless/ath/ath10k/htt_rx.c +8 -0
@@ -2379,6 +2379,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb)u8 tid;int ret;int i; +bool may_tx;ath10k_dbg (ar,ATH10K_DBG_HTT ,"htt rx tx fetch ind\n" );
@@ -2451,8 +2452,13 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) num_msdus =0 ; num_bytes =0 ; +ieee80211_txq_schedule_start (hw, txq->ac); + may_tx =ieee80211_txq_may_transmit (hw, txq);while (num_msdus < max_num_msdus && num_bytes < max_num_bytes) { +if (!may_tx) +break ; + ret =ath10k_mac_tx_push_txq (hw, txq);if (ret <0 )break ;
@@ -2460,6 +2466,8 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) num_msdus++; num_bytes += ret; } +ieee80211_return_txq (hw, txq); +ieee80211_txq_schedule_end (hw, txq->ac); record->num_msdus =cpu_to_le16 (num_msdus); record->num_bytes =cpu_to_le32 (num_bytes);
drivers/net/wireless/ath/ath10k/mac.c +43 -55
154 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH 5/6] ath10k: migrate to mac80211 txq scheduling
Quoted 9 lines · Rajkumar Manoharan
ath10k maintains common txqs list for all stations. This txq management can be removed by migrating to mac80211 txq APIs and let mac80211 handle txqs reordering based on reported airtime. By doing this, txq fairness maintained in ath10k i.e processing N frames per txq is removed. By adapting to mac80211 APIs, ath10k will support mac80211 based airtime fairness algorithm.
Signed-off-by Toke Høiland-Jørgensen <[email protected]>Signed-off-by Rajkumar Manoharan <[email protected]>
Is Toke the original author? Then you should add "From:" tag to mark that. And you might want to use Co-developed-by to mark yourself as co-developer.
Signature · 1 line
Kalle Valo
Re: [PATCH 5/6] ath10k: migrate to mac80211 txq scheduling
Quoted 9 lines · Kalle Valo
Quoted 7 lines · Rajkumar Manoharan
ath10k maintains common txqs list for all stations. This txq management can be removed by migrating to mac80211 txq APIs and let mac80211 handle txqs reordering based on reported airtime. By doing this, txq fairness maintained in ath10k i.e processing N frames per txq is removed. By adapting to mac80211 APIs, ath10k will support mac80211 based airtime fairness algorithm.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Toke Høiland-Jørgensen <[email protected]>Signed-off-by Rajkumar Manoharan <[email protected]>Is Toke the original author? Then you should add "From:" tag to mark that. And you might want to use Co-developed-by to mark yourself as co-developer.
Toke submitted ath10k changes in RFC v1 but those were dropped in follow up series. When I reworked on ath10k, I retaining his s-o-b.
Will fix it.
-Rajkumar
PATCH 6/6 ath10k: reporting estimated tx airtime for fairness
In reply to Rajkumar ManoharanTransmit airtime will be estimated from last tx rate used. Firmware report tx rate by peer stats. Airtime is computed on tx path and the same will be reported to mac80211 upon tx completion.
--- drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/htt_rx.c | 1 + drivers/net/wireless/ath/ath10k/mac.c | 57 ++++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath10k/txrx.c | 4 +++ 4 files changed, 61 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +2 -0
@@ -126,6 +126,7 @@ struct ath10k_skb_cb {u8 flags;u8 eid;u16 msdu_id; +u16 airtime_est;struct ieee80211_vif *vif;struct ieee80211_txq *txq; } __packed;
@@ -496,6 +497,7 @@ struct ath10k_sta {u32 smps;u16 peer_id;struct rate_info txrate; +u32 last_tx_bitrate;struct work_struct update_wk;u64 rx_duration;
drivers/net/wireless/ath/ath10k/htt_rx.c +1 -0
@@ -2808,6 +2808,7 @@ static inline int ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) arsta->txrate.nss = txrate.nss; arsta->txrate.bw =ath10k_bw_to_mac80211_bw (txrate.bw); + arsta->last_tx_bitrate =cfg80211_calculate_bitrate (&arsta->txrate);if (ath10k_debug_is_extd_tx_stats_enabled (ar)) ath10k_accumulate_per_peer_tx_stats(ar, arsta, peer_stats,
drivers/net/wireless/ath/ath10k/mac.c +54 -3
100 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/txrx.c +4 -0
@@ -95,6 +95,10 @@ 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) +ieee80211_sta_register_airtime (txq->sta, txq->tid, + skb_cb->airtime_est,0 ); +if (ar->dev_type !=ATH10K_DEV_TYPE_HL )dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE );
Signature · 1 line
1.9.1
Re: [PATCH 6/6] ath10k: reporting estimated tx airtime for fairness
Quoted 7 lines · Rajkumar Manoharan
Transmit airtime will be estimated from last tx rate used. Firmware report tx rate by peer stats. Airtime is computed on tx path and the same will be reported to mac80211 upon tx completion.
Signed-off-by Kan Yan <[email protected]>Signed-off-by Rajkumar Manoharan <[email protected]>
Same comments as in patch 5 about "From:" and Co-developed-by tags.
Signature · 1 line
Kalle Valo
Toke Høiland-Jørgensen
maintainerQuoted 9 lines · Rajkumar Manoharan
Toke,
It is been a while since mac80211 TXQ discussion started. Here is the consolidated series of mac80211, ath9k and ath10k changes to move TXQ scheduling and airtime fairness into mac80211. The major changes w.r.t 5th RFC version are in
may_transmit()API. Whenever the driver checks deficit for given TXQ, the list will be reordered so that driver/firmware RR quickly becomes in sync with mac80211 list. Also airtime tasklet approach cumbersome and causing regression in multi client performance.
Cool, thanks. I'll look at this in more detail later, but in the meantime, do you have any test results to share? Specifically, how did you measure that the fairness part actually works? :)
-Toke