Skip to content

Commit 4bbb02f

Browse files
committed
Merge tag 'mac80211-next-for-net-next-2019-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Johannes Berg says: ==================== The interesting new thing here is AQL, the Airtime Queue Limit patchset from Kan Yan (Google) and Toke Høiland-Jørgensen (Redhat). The effect is intended to eventually be similar to BQL, but byte queue limits are not useful in wifi where the actual throughput can vary by around 4 orders of magnitude. There are more details in the patches themselves. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 41b416f + 7a89233 commit 4bbb02f

File tree

13 files changed

+966
-26
lines changed

13 files changed

+966
-26
lines changed

drivers/net/wireless/virt_wifi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,14 @@ static void virt_wifi_net_device_destructor(struct net_device *dev)
450450
*/
451451
kfree(dev->ieee80211_ptr);
452452
dev->ieee80211_ptr = NULL;
453-
free_netdev(dev);
454453
}
455454

456455
/* No lock interaction. */
457456
static void virt_wifi_setup(struct net_device *dev)
458457
{
459458
ether_setup(dev);
460459
dev->netdev_ops = &virt_wifi_ops;
461-
dev->priv_destructor = virt_wifi_net_device_destructor;
460+
dev->needs_free_netdev = true;
462461
}
463462

464463
/* Called in a RCU read critical section from netif_receive_skb */
@@ -544,6 +543,7 @@ static int virt_wifi_newlink(struct net *src_net, struct net_device *dev,
544543
goto unregister_netdev;
545544
}
546545

546+
dev->priv_destructor = virt_wifi_net_device_destructor;
547547
priv->being_deleted = false;
548548
priv->is_connected = false;
549549
priv->is_up = false;

include/net/cfg80211.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,13 @@ enum wiphy_params_flags {
26062606

26072607
#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
26082608

2609+
/* The per TXQ device queue limit in airtime */
2610+
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2611+
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2612+
2613+
/* The per interface airtime threshold to switch to lower queue limit */
2614+
#define IEEE80211_AQL_THRESHOLD 24000
2615+
26092616
/**
26102617
* struct cfg80211_pmksa - PMK Security Association
26112618
*

include/net/mac80211.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,22 @@ struct ieee80211_tx_info {
10601060
};
10611061
};
10621062

1063+
static inline u16
1064+
ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
1065+
{
1066+
/* We only have 10 bits in tx_time_est, so store airtime
1067+
* in increments of 4us and clamp the maximum to 2**12-1
1068+
*/
1069+
info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
1070+
return info->tx_time_est << 2;
1071+
}
1072+
1073+
static inline u16
1074+
ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
1075+
{
1076+
return info->tx_time_est << 2;
1077+
}
1078+
10631079
/**
10641080
* struct ieee80211_tx_status - extended tx status info for rate control
10651081
*
@@ -5565,6 +5581,18 @@ void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
55655581
void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
55665582
u32 tx_airtime, u32 rx_airtime);
55675583

5584+
/**
5585+
* ieee80211_txq_airtime_check - check if a txq can send frame to device
5586+
*
5587+
* @hw: pointer obtained from ieee80211_alloc_hw()
5588+
* @txq: pointer obtained from station or virtual interface
5589+
*
5590+
* Return true if the AQL's airtime limit has not been reached and the txq can
5591+
* continue to send more packets to the device. Otherwise return false.
5592+
*/
5593+
bool
5594+
ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
5595+
55685596
/**
55695597
* ieee80211_iter_keys - iterate keys programmed into the device
55705598
* @hw: pointer obtained from ieee80211_alloc_hw()
@@ -6424,4 +6452,33 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
64246452
struct cfg80211_nan_match_params *match,
64256453
gfp_t gfp);
64266454

6455+
/**
6456+
* ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
6457+
*
6458+
* This function calculates the estimated airtime usage of a frame based on the
6459+
* rate information in the RX status struct and the frame length.
6460+
*
6461+
* @hw: pointer as obtained from ieee80211_alloc_hw()
6462+
* @status: &struct ieee80211_rx_status containing the transmission rate
6463+
* information.
6464+
* @len: frame length in bytes
6465+
*/
6466+
u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
6467+
struct ieee80211_rx_status *status,
6468+
int len);
6469+
6470+
/**
6471+
* ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
6472+
*
6473+
* This function calculates the estimated airtime usage of a frame based on the
6474+
* rate information in the TX info struct and the frame length.
6475+
*
6476+
* @hw: pointer as obtained from ieee80211_alloc_hw()
6477+
* @info: &struct ieee80211_tx_info of the frame.
6478+
* @len: frame length in bytes
6479+
*/
6480+
u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
6481+
struct ieee80211_tx_info *info,
6482+
int len);
6483+
64276484
#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)