summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2015-09-28 00:17:51 +0000
committeradrian <adrian@FreeBSD.org>2015-09-28 00:17:51 +0000
commiteb19154b866bff2bc4645cc133dd71952088f5ac (patch)
tree3297d5634455e0d63f8177bbc55b1c42816ecb5a /sys/net80211
parent9608a36e5e2b574b78c58a663a55f5958eec344a (diff)
downloadFreeBSD-src-eb19154b866bff2bc4645cc133dd71952088f5ac.zip
FreeBSD-src-eb19154b866bff2bc4645cc133dd71952088f5ac.tar.gz
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
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_ht.c7
-rw-r--r--sys/net80211/ieee80211_ht.h12
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c
index b43bc07..a850a33 100644
--- a/sys/net80211/ieee80211_ht.c
+++ b/sys/net80211/ieee80211_ht.c
@@ -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);
diff --git a/sys/net80211/ieee80211_ht.h b/sys/net80211/ieee80211_ht.h
index f099ffe..e2b3318 100644
--- a/sys/net80211/ieee80211_ht.h
+++ b/sys/net80211/ieee80211_ht.h
@@ -84,8 +84,19 @@ struct ieee80211_tx_ampdu {
*/
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);
OpenPOWER on IntegriCloud