[PATCH ath-next v3 7/9] wifi: ath11k: charge received airtime to the station deficit
Julius Bairaktaris <[email protected]>
| Newsgroups | org.kernel.vger.linux-wireless,org.infradead.lists.ath11k,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
mac80211's airtime scheduler is configured to account both directions: local->airtime_flags is AIRTIME_USE_TX | AIRTIME_USE_RX, and ieee80211_sta_register_airtime() adds the received airtime to the same deficit the transmit side subtracts from. ath11k passes zero for it, so an access point serving a station that mostly uploads charges that station nothing for the medium it occupies, and the deficit that decides whose queue is served next describes half the traffic. Register the duration the hardware reports for each received PPDU. It arrives in the RXPCU PPDU end TLV on the monitor status ring, which is subscribed for every radio, and ath11k already accumulates it as the station's rx_duration. Charging it once per PPDU matches what the transmit side registers, whereas an estimate rebuilt per MSDU counts the preamble and the interframe space once for every subframe of an aggregate: measured against one HE station, the per-MSDU estimate from ieee80211_calc_rx_airtime() reports 16.9 s of receive airtime where the hardware measured 6.8 s. A PPDU that reports no TID is charged to BE, matching what the transmit side does with a frame carrying no QoS control field; the value cannot be masked into range because ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU reporting none leaves 65535 and masking would select VO. A PPDU from a peer with no station entry is not charged to anyone. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris <[email protected]> --- drivers/net/wireless/ath/ath11k/dp_rx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 28aaf39cf342..7ef58152719d 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5341,6 +5341,26 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id, arsta = ath11k_sta_to_arsta(peer->sta); ath11k_dp_rx_update_peer_stats(arsta, ppdu_info); + /* The airtime a station spends transmitting is airtime it takes + * from the others, so the fairness deficit is charged for it as + * well. This is the duration the hardware measured for the + * whole PPDU, which is what the transmit side registers too. + * + * ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU + * that reports no TID leaves it at 65535; charge that airtime to + * the same access category the transmit side gives a frame with + * no QoS TID. + */ + if (ppdu_info->rx_duration) { + u8 tid = 0; + + if (ppdu_info->tid < IEEE80211_NUM_TIDS) + tid = ppdu_info->tid; + + ieee80211_sta_register_airtime(peer->sta, tid, 0, + ppdu_info->rx_duration); + } + if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr)) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); -- 2.53.0