Author: adrian
Date: Mon Sep 28 00:17:51 2015
New Revision: 288315
URL: https://svnweb.freebsd.org/changeset/base/288315

Log:
  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

Modified:
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ht.h

Modified: head/sys/net80211/ieee80211_ht.c
==============================================================================
--- head/sys/net80211/ieee80211_ht.c    Sun Sep 27 23:33:54 2015        
(r288314)
+++ head/sys/net80211/ieee80211_ht.c    Mon Sep 28 00:17:51 2015        
(r288315)
@@ -1081,7 +1081,7 @@ ieee80211_ht_node_init(struct ieee80211_
                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_n
        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 
        /*
         * 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);

Modified: head/sys/net80211/ieee80211_ht.h
==============================================================================
--- head/sys/net80211/ieee80211_ht.h    Sun Sep 27 23:33:54 2015        
(r288314)
+++ head/sys/net80211/ieee80211_ht.h    Mon Sep 28 00:17:51 2015        
(r288315)
@@ -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 ieee
 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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to