Changeset 3637

Show
Ignore:
Timestamp:
05/16/08 23:03:32 (5 months ago)
Author:
benoit
Message:

Merge r3635 from trunk.
Add IEEE80211_TSF_TO_TU macro again and explain it once there instead of
open coding >> 10 and putting notes all over the place.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/branches/madwifi-dfs/ath/if_ath.c

    r3636 r3637  
    13111311 
    13121312        /* Calculate the closest TBTT that is > now_tu. */ 
    1313         now_tu   = ath_hal_gettsf64(ah) >> 10
     1313        now_tu   = IEEE80211_TSF_TO_TU(ath_hal_gettsf64(ah))
    13141314        nexttbtt = sc->sc_nexttbtt + roundup_s( 
    13151315                (signed)(now_tu + 1 - sc->sc_nexttbtt), 
     
    26092609                        DPRINTF(sc, ATH_DEBUG_BEACON, 
    26102610                                "%s: HAL_INT_SWBA at " 
    2611                                 "tsf %10llx tsf_tu:%6llu nexttbtt %10llx " 
     2611                                "tsf %10llx tsf_tu:%6u nexttbtt %10llx " 
    26122612                                "nexttbtt_tu:%6u\n", 
    2613                                 __func__, hw_tsf, hw_tsf >> 10
     2613                                __func__, hw_tsf, IEEE80211_TSF_TO_TU(hw_tsf)
    26142614                                (u_int64_t)sc->sc_nexttbtt << 10, 
    26152615                                sc->sc_nexttbtt); 
     
    53675367                u_int32_t tsftu; 
    53685368 
    5369                 tsftu = hw_tsf >> 10; /* NB: 64 -> 32: See note far above. */ 
     5369                tsftu = IEEE80211_TSF_TO_TU(hw_tsf); 
    53705370                slot = ((tsftu % ic->ic_lintval) * ath_maxvaps) / ic->ic_lintval; 
    53715371                vap = sc->sc_bslot[(slot + 1) % ath_maxvaps]; 
     
    56505650 * Note : TBTT is Target Beacon Transmission Time (see IEEE 802.11-1999: 4 & 
    56515651 * 11.2.1.3). 
    5652  * 
    5653  * Note: TSF is right shifted by 10 and then put into a 32-bit int, which will 
    5654  * truncate. This does not affect the calculation as long as no more than one 
    5655  * overflow/wraparound occurs between beacons. This is not going to happen as 
    5656  * (2^(32 + 10 - 1) - 1)us is a really long time. 
    56575652 */ 
    56585653static void 
     
    56745669        hw_tsf = ath_hal_gettsf64(ah); 
    56755670        tsf = le64_to_cpu(ni->ni_tstamp.tsf); 
    5676         hw_tsftu = hw_tsf >> 10
    5677         tsftu = tsf >> 10; /* NB: 64 -> 32. See note above. */ 
     5671        hw_tsftu = IEEE80211_TSF_TO_TU(hw_tsf)
     5672        tsftu = IEEE80211_TSF_TO_TU(tsf); 
    56785673 
    56795674        /* We should reset hw TSF only once, so we increment 
     
    67906785                         * RUN -> RUN when this happens. */ 
    67916786                        hw_tsf = ath_hal_gettsf64(sc->sc_ah); 
    6792                         hw_tu  = hw_tsf >> 10
     6787                        hw_tu  = IEEE80211_TSF_TO_TU(hw_tsf)
    67936788 
    67946789                        beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf); 
    6795                         beacon_tu  = beacon_tsf >> 10
     6790                        beacon_tu  = IEEE80211_TSF_TO_TU(beacon_tsf)
    67966791 
    67976792                        DPRINTF(sc, ATH_DEBUG_BEACON, 
  • madwifi/branches/madwifi-dfs/net80211/ieee80211_beacon.c

    r3411 r3637  
    495495                        } 
    496496 
    497                         now_tu   = vap->iv_get_tsf(vap) >> 10
     497                        now_tu   = IEEE80211_TSF_TO_TU(vap->iv_get_tsf(vap))
    498498                        nexttbtt = vap->iv_get_nexttbtt(vap); 
    499499 
  • madwifi/branches/madwifi-dfs/net80211/ieee80211_input.c

    r3542 r3637  
    27552755 
    27562756        TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { 
    2757                 now_tu = vap->iv_get_tsf(vap) >> 10
     2757                now_tu = IEEE80211_TSF_TO_TU(vap->iv_get_tsf(vap))
    27582758 
    27592759                IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH, 
  • madwifi/branches/madwifi-dfs/net80211/ieee80211_output.c

    r3527 r3637  
    17861786         * element is transmitted. */ 
    17871787 
    1788         now_tu  = vap->iv_get_tsf(vap) >> 10
     1788        now_tu  = IEEE80211_TSF_TO_TU(vap->iv_get_tsf(vap))
    17891789        now     = jiffies; 
    17901790 
  • madwifi/branches/madwifi-dfs/net80211/ieee80211_var.h

    r3542 r3637  
    122122          DEV_NAME(_v->iv_ic->ic_dev)) 
    123123 
     124/* 
     125 * TU conversions: 
     126 * 
     127 * TU is a 32bit value and defined by IEEE802.11 (page 6) as "A measurement of 
     128 * time equal to 1024 usec (microseconds)". 
     129 * 
     130 * TSF is a 64bit value in usec, therefore if we right shift it by 10 bit this 
     131 * will directly convert it to TU. The rest is truncated to fit into 32 bit. 
     132 */ 
     133#define IEEE80211_TSF_TO_TU(_tsf)       ((u_int32_t)((_tsf) >> 10)) 
    124134#define IEEE80211_MS_TO_TU(x)   (((x) * 1000) / 1024) 
    125135#define IEEE80211_TU_TO_MS(x)   (((x) * 1024) / 1000)