Author: adrian
Date: Wed Nov 28 01:55:22 2012
New Revision: 243642
URL: http://svnweb.freebsd.org/changeset/base/243642

Log:
  Pull out the debugging code from the critical path and make sure it
  happens _after_ all of the time delta calculations.

Modified:
  head/sys/dev/ath/if_ath_tdma.c

Modified: head/sys/dev/ath/if_ath_tdma.c
==============================================================================
--- head/sys/dev/ath/if_ath_tdma.c      Wed Nov 28 00:36:40 2012        
(r243641)
+++ head/sys/dev/ath/if_ath_tdma.c      Wed Nov 28 01:55:22 2012        
(r243642)
@@ -402,28 +402,6 @@ ath_tdma_update(struct ieee80211_node *n
         * not just 0..65535 TU.
         */
        nextslottu = TSF_TO_TU(nextslot>>32, nextslot);
-       DPRINTF(sc, ATH_DEBUG_TDMA_TIMER,
-           "rs->rstamp %llu rstamp %llu tsf %llu txtime %d, nextslot %llu, 
nextslottu %d, nextslottume %d\n",
-           (unsigned long long) rs->rs_tstamp, rstamp, tsf, txtime, nextslot, 
nextslottu, TSF_TO_TU(nextslot >> 32, nextslot));
-       DPRINTF(sc, ATH_DEBUG_TDMA,
-           "  beacon tstamp: %llu (0x%016llx)\n",
-           le64toh(ni->ni_tstamp.tsf),
-           le64toh(ni->ni_tstamp.tsf));
-
-#ifdef ATH_DEBUG_ALQ
-       if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE)) {
-               struct if_ath_alq_tdma_beacon_state t;
-               t.rx_tsf = htobe64(rstamp);
-               t.beacon_tsf = htobe64(le64toh(ni->ni_tstamp.tsf));
-               t.tsf64 = htobe64(tsf);
-               t.nextslot_tsf = htobe64(nextslot);
-               t.nextslot_tu = htobe32(nextslottu);
-               t.txtime = htobe32(txtime);
-               if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE,
-                   sizeof(t), (char *) &t);
-       }
-#endif
-
        /*
         * Retrieve the hardware NextTBTT in usecs
         * and calculate the difference between what the
@@ -459,27 +437,22 @@ ath_tdma_update(struct ieee80211_node *n
        tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - 
nexttbtt);
 
        DPRINTF(sc, ATH_DEBUG_TDMA_TIMER,
+           "rs->rstamp %llu rstamp %llu tsf %llu txtime %d, nextslot %llu, "
+           "nextslottu %d, nextslottume %d\n",
+           (unsigned long long) rs->rs_tstamp, rstamp, tsf, txtime,
+           nextslot, nextslottu, TSF_TO_TU(nextslot >> 32, nextslot));
+       DPRINTF(sc, ATH_DEBUG_TDMA,
+           "  beacon tstamp: %llu (0x%016llx)\n",
+           le64toh(ni->ni_tstamp.tsf),
+           le64toh(ni->ni_tstamp.tsf));
+
+       DPRINTF(sc, ATH_DEBUG_TDMA_TIMER,
            "nexttbtt %llu (0x%08llx) tsfdelta %d avg +%d/-%d\n",
            nexttbtt,
            (long long) nexttbtt,
            tsfdelta,
            TDMA_AVG(sc->sc_avgtsfdeltap), TDMA_AVG(sc->sc_avgtsfdeltam));
 
-#ifdef ATH_DEBUG_ALQ
-       if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) {
-               struct if_ath_alq_tdma_slot_calc t;
-
-               t.nexttbtt = htobe64(nexttbtt_full);
-               t.next_slot = htobe64(nextslot);
-               t.tsfdelta = htobe32(tsfdelta);
-               t.avg_plus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltap));
-               t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam));
-
-               if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC,
-                   sizeof(t), (char *) &t);
-       }
-#endif
-
        if (tsfdelta < 0) {
                TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0);
                TDMA_SAMPLE(sc->sc_avgtsfdeltam, -tsfdelta);
@@ -496,6 +469,33 @@ ath_tdma_update(struct ieee80211_node *n
        }
        tudelta = nextslottu - TSF_TO_TU(nexttbtt_full >> 32, nexttbtt_full);
 
+#ifdef ATH_DEBUG_ALQ
+       if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE)) {
+               struct if_ath_alq_tdma_beacon_state t;
+               t.rx_tsf = htobe64(rstamp);
+               t.beacon_tsf = htobe64(le64toh(ni->ni_tstamp.tsf));
+               t.tsf64 = htobe64(tsf);
+               t.nextslot_tsf = htobe64(nextslot);
+               t.nextslot_tu = htobe32(nextslottu);
+               t.txtime = htobe32(txtime);
+               if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_BEACON_STATE,
+                   sizeof(t), (char *) &t);
+       }
+
+       if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC)) {
+               struct if_ath_alq_tdma_slot_calc t;
+
+               t.nexttbtt = htobe64(nexttbtt_full);
+               t.next_slot = htobe64(nextslot);
+               t.tsfdelta = htobe32(tsfdelta);
+               t.avg_plus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltap));
+               t.avg_minus = htobe32(TDMA_AVG(sc->sc_avgtsfdeltam));
+
+               if_ath_alq_post(&sc->sc_alq, ATH_ALQ_TDMA_SLOT_CALC,
+                   sizeof(t), (char *) &t);
+       }
+#endif
+
        /*
         * Copy sender's timetstamp into tdma ie so they can
         * calculate roundtrip time.  We submit a beacon frame
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to