Ticket #1033: ibss_beacon_nexttbtt_fix.diff
| File ibss_beacon_nexttbtt_fix.diff, 1.5 kB (added by tjalling.hattink@ti-wmc.nl, 2 years ago) |
|---|
-
ath/if_ath.c
old new 4426 4426 { 4427 4427 #define TSF_TO_TU(_h,_l) \ 4428 4428 ((((u_int32_t)(_h)) << 22) | (((u_int32_t)(_l)) >> 10)) 4429 #define FUDGE 2 4429 4430 struct ieee80211com *ic = &sc->sc_ic; 4430 4431 struct ath_hal *ah = sc->sc_ah; 4431 4432 struct ieee80211_node *ni; … … 4481 4482 dtimcount = 0; /* XXX? */ 4482 4483 cfpperiod = 1; /* NB: no PCF support yet */ 4483 4484 cfpcount = 0; 4484 #define FUDGE 24485 4485 /* 4486 4486 * Pull nexttbtt forward to reflect the current 4487 4487 * TSF and calculate dtim+cfp state for the result. … … 4496 4496 cfpcount = cfpperiod - 1; 4497 4497 } 4498 4498 } while (nexttbtt < tsftu); 4499 #undef FUDGE4500 4499 memset(&bs, 0, sizeof(bs)); 4501 4500 bs.bs_intval = intval; 4502 4501 bs.bs_nexttbtt = nexttbtt; … … 4579 4578 intval |= HAL_BEACON_ENA; 4580 4579 if (!sc->sc_hasveol) 4581 4580 sc->sc_imask |= HAL_INT_SWBA; 4581 if ((intval & HAL_BEACON_RESET_TSF) == 0) { 4582 u_int64_t tsf; 4583 u_int32_t clintval, tsftu; 4584 /* 4585 * Pull nexttbtt forward to reflect 4586 * the current TSF. 4587 */ 4588 clintval = intval & HAL_BEACON_PERIOD; 4589 tsf = ath_hal_gettsf64(ah); 4590 tsftu = TSF_TO_TU(tsf>>32, tsf); 4591 if (tsftu < nexttbtt) 4592 tsftu = nexttbtt; 4593 tsftu += clintval + FUDGE; 4594 do { 4595 nexttbtt += clintval; 4596 } while (nexttbtt < tsftu); 4597 } 4582 4598 ath_beaconq_config(sc); 4583 4599 } else if (ic->ic_opmode == IEEE80211_M_HOSTAP) { 4584 4600 /* … … 4605 4621 } 4606 4622 sc->sc_syncbeacon = 0; 4607 4623 #undef TSF_TO_TU 4624 #undef FUDGE 4608 4625 } 4609 4626 4610 4627 static int
