Changeset 3637
- Timestamp:
- 05/16/08 23:03:32 (5 months ago)
- Files:
-
- madwifi/branches/madwifi-dfs/ath/if_ath.c (modified) (6 diffs)
- madwifi/branches/madwifi-dfs/net80211/ieee80211_beacon.c (modified) (1 diff)
- madwifi/branches/madwifi-dfs/net80211/ieee80211_input.c (modified) (1 diff)
- madwifi/branches/madwifi-dfs/net80211/ieee80211_output.c (modified) (1 diff)
- madwifi/branches/madwifi-dfs/net80211/ieee80211_var.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/branches/madwifi-dfs/ath/if_ath.c
r3636 r3637 1311 1311 1312 1312 /* 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)); 1314 1314 nexttbtt = sc->sc_nexttbtt + roundup_s( 1315 1315 (signed)(now_tu + 1 - sc->sc_nexttbtt), … … 2609 2609 DPRINTF(sc, ATH_DEBUG_BEACON, 2610 2610 "%s: HAL_INT_SWBA at " 2611 "tsf %10llx tsf_tu:%6 llu nexttbtt %10llx "2611 "tsf %10llx tsf_tu:%6u nexttbtt %10llx " 2612 2612 "nexttbtt_tu:%6u\n", 2613 __func__, hw_tsf, hw_tsf >> 10,2613 __func__, hw_tsf, IEEE80211_TSF_TO_TU(hw_tsf), 2614 2614 (u_int64_t)sc->sc_nexttbtt << 10, 2615 2615 sc->sc_nexttbtt); … … 5367 5367 u_int32_t tsftu; 5368 5368 5369 tsftu = hw_tsf >> 10; /* NB: 64 -> 32: See note far above. */5369 tsftu = IEEE80211_TSF_TO_TU(hw_tsf); 5370 5370 slot = ((tsftu % ic->ic_lintval) * ath_maxvaps) / ic->ic_lintval; 5371 5371 vap = sc->sc_bslot[(slot + 1) % ath_maxvaps]; … … 5650 5650 * Note : TBTT is Target Beacon Transmission Time (see IEEE 802.11-1999: 4 & 5651 5651 * 11.2.1.3). 5652 *5653 * Note: TSF is right shifted by 10 and then put into a 32-bit int, which will5654 * truncate. This does not affect the calculation as long as no more than one5655 * overflow/wraparound occurs between beacons. This is not going to happen as5656 * (2^(32 + 10 - 1) - 1)us is a really long time.5657 5652 */ 5658 5653 static void … … 5674 5669 hw_tsf = ath_hal_gettsf64(ah); 5675 5670 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); 5678 5673 5679 5674 /* We should reset hw TSF only once, so we increment … … 6790 6785 * RUN -> RUN when this happens. */ 6791 6786 hw_tsf = ath_hal_gettsf64(sc->sc_ah); 6792 hw_tu = hw_tsf >> 10;6787 hw_tu = IEEE80211_TSF_TO_TU(hw_tsf); 6793 6788 6794 6789 beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf); 6795 beacon_tu = beacon_tsf >> 10;6790 beacon_tu = IEEE80211_TSF_TO_TU(beacon_tsf); 6796 6791 6797 6792 DPRINTF(sc, ATH_DEBUG_BEACON, madwifi/branches/madwifi-dfs/net80211/ieee80211_beacon.c
r3411 r3637 495 495 } 496 496 497 now_tu = vap->iv_get_tsf(vap) >> 10;497 now_tu = IEEE80211_TSF_TO_TU(vap->iv_get_tsf(vap)); 498 498 nexttbtt = vap->iv_get_nexttbtt(vap); 499 499 madwifi/branches/madwifi-dfs/net80211/ieee80211_input.c
r3542 r3637 2755 2755 2756 2756 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)); 2758 2758 2759 2759 IEEE80211_DPRINTF(vap, IEEE80211_MSG_DOTH, madwifi/branches/madwifi-dfs/net80211/ieee80211_output.c
r3527 r3637 1786 1786 * element is transmitted. */ 1787 1787 1788 now_tu = vap->iv_get_tsf(vap) >> 10;1788 now_tu = IEEE80211_TSF_TO_TU(vap->iv_get_tsf(vap)); 1789 1789 now = jiffies; 1790 1790 madwifi/branches/madwifi-dfs/net80211/ieee80211_var.h
r3542 r3637 122 122 DEV_NAME(_v->iv_ic->ic_dev)) 123 123 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)) 124 134 #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) 125 135 #define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000)
