summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/if_ath.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-03-29 22:16:49 +0000
committersam <sam@FreeBSD.org>2005-03-29 22:16:49 +0000
commita7ee34db5298d042376f65b8394f33a497e65b7b (patch)
tree4700b2932918522d42e575c42966e9f902fa8fa4 /sys/dev/ath/if_ath.c
parent698438f28bfa7311d505eb77bc06e6d139786801 (diff)
downloadFreeBSD-src-a7ee34db5298d042376f65b8394f33a497e65b7b.zip
FreeBSD-src-a7ee34db5298d042376f65b8394f33a497e65b7b.tar.gz
extend the timestamp from the rx descriptor to calculate the tsf to
use when checking for an ibss merge
Diffstat (limited to 'sys/dev/ath/if_ath.c')
-rw-r--r--sys/dev/ath/if_ath.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index b28fa36..04121e6 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -2418,6 +2418,21 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf)
}
/*
+ * Extend 15-bit time stamp from rx descriptor to
+ * a full 64-bit TSF using the current h/w TSF.
+ */
+static __inline u_int64_t
+ath_extend_tsf(struct ath_hal *ah, u_int32_t rstamp)
+{
+ u_int64_t tsf;
+
+ tsf = ath_hal_gettsf64(ah);
+ if ((tsf & 0x7fff) < rstamp)
+ tsf -= 0x8000;
+ return ((tsf &~ 0x7fff) | rstamp);
+}
+
+/*
* Intercept management frames to collect beacon rssi data
* and to do ibss merges.
*/
@@ -2441,10 +2456,7 @@ ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m,
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
if (ic->ic_opmode == IEEE80211_M_IBSS &&
ic->ic_state == IEEE80211_S_RUN) {
- struct ath_hal *ah = sc->sc_ah;
- /* XXX extend rstamp */
- u_int64_t tsf = ath_hal_gettsf64(ah);
-
+ u_int64_t tsf = ath_extend_tsf(sc->sc_ah, rstamp);
/*
* Handle ibss merge as needed; check the tsf on the
* frame before attempting the merge. The 802.11 spec
@@ -2452,11 +2464,16 @@ ath_recv_mgmt(struct ieee80211com *ic, struct mbuf *m,
* the oldest station with the same ssid, where oldest
* is determined by the tsf. Note that hardware
* reconfiguration happens through callback to
- * ath_newstate as the state machine will be go
- * from RUN -> RUN when this happens.
+ * ath_newstate as the state machine will go from
+ * RUN -> RUN when this happens.
*/
- if (le64toh(ni->ni_tstamp.tsf) >= tsf)
+ if (le64toh(ni->ni_tstamp.tsf) >= tsf) {
+ DPRINTF(sc, ATH_DEBUG_STATE,
+ "ibss merge, rstamp %u tsf %llu "
+ "tstamp %llu\n", rstamp, tsf,
+ ni->ni_tstamp.tsf);
(void) ieee80211_ibss_merge(ic, ni);
+ }
}
break;
}
OpenPOWER on IntegriCloud