Abstract out the ampdu TX pps initialisation code so it can be reused

in the superg fast-frames code.

This harks back to an earlier commit (r280349) where I found that
initialising the pps code with ticks=0 would cause hilariously bad
hz ticks wraparound failures, leading to never actually aggregating
traffic.  This is still true for the superg path and so I have to
do the same thing there.

This is a big no-op; a subsequent commit will flip this on so it
works with the fast-frames transmit path.

Tested:

* AR9170, otus(4) - STA mode, 11bg operation
* AR9331, AP mode
This commit is contained in:
adrian 2015-09-28 00:17:51 +00:00
parent 9608a36e5e
commit eb19154b86
2 changed files with 15 additions and 4 deletions

View File

@ -1081,7 +1081,7 @@ ieee80211_ht_node_init(struct ieee80211_node *ni)
tap = &ni->ni_tx_ampdu[tid];
tap->txa_tid = tid;
tap->txa_ni = ni;
tap->txa_lastsample = ticks;
ieee80211_txampdu_init_pps(tap);
/* NB: further initialization deferred */
}
ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU;
@ -1251,7 +1251,7 @@ ieee80211_ht_wds_init(struct ieee80211_node *ni)
for (tid = 0; tid < WME_NUM_TID; tid++) {
tap = &ni->ni_tx_ampdu[tid];
tap->txa_tid = tid;
tap->txa_lastsample = ticks;
ieee80211_txampdu_init_pps(tap);
}
/* NB: AMPDU tx/rx governed by IEEE80211_FHT_AMPDU_{TX,RX} */
ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU;
@ -1752,8 +1752,7 @@ ampdu_tx_stop(struct ieee80211_tx_ampdu *tap)
/*
* Reset packet estimate.
*/
tap->txa_lastsample = ticks;
tap->txa_avgpps = 0;
ieee80211_txampdu_init_pps(tap);
/* NB: clearing NAK means we may re-send ADDBA */
tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK);

View File

@ -83,9 +83,20 @@ struct ieee80211_tx_ampdu {
* available and more streams are requested than available.
*/
static __inline void
ieee80211_txampdu_init_pps(struct ieee80211_tx_ampdu *tap)
{
/*
* Reset packet estimate.
*/
tap->txa_lastsample = ticks;
tap->txa_avgpps = 0;
}
static __inline void
ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap)
{
/* NB: scale factor of 2 was picked heuristically */
tap->txa_avgpps = ((tap->txa_avgpps << 2) -
tap->txa_avgpps + tap->txa_pkts) >> 2;
@ -97,6 +108,7 @@ ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap)
static __inline void
ieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap)
{
/* XXX bound loop/do more crude estimate? */
while (ticks - tap->txa_lastsample >= hz) {
ieee80211_txampdu_update_pps(tap);