Skip to content

Commit

Permalink
Merge tag 'mac80211-next-for-net-next-2019-11-22' of git://git.kernel…
Browse files Browse the repository at this point in the history
….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]>
  • Loading branch information
davem330 committed Nov 22, 2019
2 parents 41b416f + 7a89233 commit 4bbb02f
Show file tree
Hide file tree
Showing 13 changed files with 966 additions and 26 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/virt_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,14 @@ static void virt_wifi_net_device_destructor(struct net_device *dev)
*/
kfree(dev->ieee80211_ptr);
dev->ieee80211_ptr = NULL;
free_netdev(dev);
}

/* No lock interaction. */
static void virt_wifi_setup(struct net_device *dev)
{
ether_setup(dev);
dev->netdev_ops = &virt_wifi_ops;
dev->priv_destructor = virt_wifi_net_device_destructor;
dev->needs_free_netdev = true;
}

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

dev->priv_destructor = virt_wifi_net_device_destructor;
priv->being_deleted = false;
priv->is_connected = false;
priv->is_up = false;
Expand Down
7 changes: 7 additions & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,13 @@ enum wiphy_params_flags {

#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256

/* The per TXQ device queue limit in airtime */
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000

/* The per interface airtime threshold to switch to lower queue limit */
#define IEEE80211_AQL_THRESHOLD 24000

/**
* struct cfg80211_pmksa - PMK Security Association
*
Expand Down
57 changes: 57 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,22 @@ struct ieee80211_tx_info {
};
};

static inline u16
ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
{
/* We only have 10 bits in tx_time_est, so store airtime
* in increments of 4us and clamp the maximum to 2**12-1
*/
info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
return info->tx_time_est << 2;
}

static inline u16
ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
{
return info->tx_time_est << 2;
}

/**
* struct ieee80211_tx_status - extended tx status info for rate control
*
Expand Down Expand Up @@ -5565,6 +5581,18 @@ void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
u32 tx_airtime, u32 rx_airtime);

/**
* ieee80211_txq_airtime_check - check if a txq can send frame to device
*
* @hw: pointer obtained from ieee80211_alloc_hw()
* @txq: pointer obtained from station or virtual interface
*
* Return true if the AQL's airtime limit has not been reached and the txq can
* continue to send more packets to the device. Otherwise return false.
*/
bool
ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);

/**
* ieee80211_iter_keys - iterate keys programmed into the device
* @hw: pointer obtained from ieee80211_alloc_hw()
Expand Down Expand Up @@ -6424,4 +6452,33 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
struct cfg80211_nan_match_params *match,
gfp_t gfp);

/**
* ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
*
* This function calculates the estimated airtime usage of a frame based on the
* rate information in the RX status struct and the frame length.
*
* @hw: pointer as obtained from ieee80211_alloc_hw()
* @status: &struct ieee80211_rx_status containing the transmission rate
* information.
* @len: frame length in bytes
*/
u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
struct ieee80211_rx_status *status,
int len);

/**
* ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
*
* This function calculates the estimated airtime usage of a frame based on the
* rate information in the TX info struct and the frame length.
*
* @hw: pointer as obtained from ieee80211_alloc_hw()
* @info: &struct ieee80211_tx_info of the frame.
* @len: frame length in bytes
*/
u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
struct ieee80211_tx_info *info,
int len);

#endif /* MAC80211_H */
3 changes: 2 additions & 1 deletion net/mac80211/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ mac80211-y := \
chan.o \
trace.o mlme.o \
tdls.o \
ocb.o
ocb.o \
airtime.o

mac80211-$(CONFIG_MAC80211_LEDS) += led.o
mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
Expand Down
Loading

0 comments on commit 4bbb02f

Please sign in to comment.