Skip to content

Commit db3e1c4

Browse files
tohojojmberg-intel
authored andcommitted
mac80211: Import airtime calculation code from mt76
Felix recently added code to calculate airtime of packets to the mt76 driver. Import this into mac80211 so we can use it for airtime queue limit calculations. The airtime.c file is copied verbatim from the mt76 driver, and adjusted to be usable in mac80211. This involves: - Switching to mac80211 data structures. - Adding support for 160 MHz channels and HE mode. - Moving the symbol and duration calculations around a bit to avoid rounding with the higher rates and longer symbol times used for HE rates. The per-rate TX rate calculation is also split out to its own function so it can be used directly for the AQL calculations later. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/r/20191119060610.76681-3-kyan@google.com [fix HE_GROUP_IDX() to use 3 * bw, since there are 3 _gi values] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent bc71d8b commit db3e1c4

4 files changed

Lines changed: 632 additions & 1 deletion

File tree

‎include/net/mac80211.h‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6424,4 +6424,33 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
64246424
struct cfg80211_nan_match_params *match,
64256425
gfp_t gfp);
64266426

6427+
/**
6428+
* ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
6429+
*
6430+
* This function calculates the estimated airtime usage of a frame based on the
6431+
* rate information in the RX status struct and the frame length.
6432+
*
6433+
* @hw: pointer as obtained from ieee80211_alloc_hw()
6434+
* @status: &struct ieee80211_rx_status containing the transmission rate
6435+
* information.
6436+
* @len: frame length in bytes
6437+
*/
6438+
u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
6439+
struct ieee80211_rx_status *status,
6440+
int len);
6441+
6442+
/**
6443+
* ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
6444+
*
6445+
* This function calculates the estimated airtime usage of a frame based on the
6446+
* rate information in the TX info struct and the frame length.
6447+
*
6448+
* @hw: pointer as obtained from ieee80211_alloc_hw()
6449+
* @info: &struct ieee80211_tx_info of the frame.
6450+
* @len: frame length in bytes
6451+
*/
6452+
u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
6453+
struct ieee80211_tx_info *info,
6454+
int len);
6455+
64276456
#endif /* MAC80211_H */

‎net/mac80211/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ mac80211-y := \
3232
chan.o \
3333
trace.o mlme.o \
3434
tdls.o \
35-
ocb.o
35+
ocb.o \
36+
airtime.o
3637

3738
mac80211-$(CONFIG_MAC80211_LEDS) += led.o
3839
mac80211-$(CONFIG_MAC80211_DEBUGFS) += \

0 commit comments

Comments
 (0)