ath9k: fix ad-hoc mode beacon selection
In ad-hoc mode, beacon timers are configured differently compared to AP mode, and (depending on the scenario) can vary enough to make the beacon tasklet not detect slot 0 based on the TSF. Since staggered beacons are not (and cannot be) used in ad-hoc mode, it makes more sense to just hardcode slot 0 here, avoiding unnecessary TSF reads and calculations. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Reported-by: Rajkumar Manoharan <rmanoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
ed9d01026f
commit
c6820f1e6c
|
@ -351,9 +351,7 @@ void ath_beacon_tasklet(unsigned long data)
|
||||||
struct ath_buf *bf = NULL;
|
struct ath_buf *bf = NULL;
|
||||||
struct ieee80211_vif *vif;
|
struct ieee80211_vif *vif;
|
||||||
int slot;
|
int slot;
|
||||||
u32 bfaddr, bc = 0, tsftu;
|
u32 bfaddr, bc = 0;
|
||||||
u64 tsf;
|
|
||||||
u16 intval;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the previous beacon has gone out. If
|
* Check if the previous beacon has gone out. If
|
||||||
|
@ -388,17 +386,27 @@ void ath_beacon_tasklet(unsigned long data)
|
||||||
* on the tsf to safeguard against missing an swba.
|
* on the tsf to safeguard against missing an swba.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL;
|
|
||||||
|
|
||||||
tsf = ath9k_hw_gettsf64(ah);
|
if (ah->opmode == NL80211_IFTYPE_AP) {
|
||||||
tsf += TU_TO_USEC(ah->config.sw_beacon_response_time);
|
u16 intval;
|
||||||
tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF);
|
u32 tsftu;
|
||||||
slot = (tsftu % (intval * ATH_BCBUF)) / intval;
|
u64 tsf;
|
||||||
vif = sc->beacon.bslot[slot];
|
|
||||||
|
intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL;
|
||||||
|
tsf = ath9k_hw_gettsf64(ah);
|
||||||
|
tsf += TU_TO_USEC(ah->config.sw_beacon_response_time);
|
||||||
|
tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF);
|
||||||
|
slot = (tsftu % (intval * ATH_BCBUF)) / intval;
|
||||||
|
vif = sc->beacon.bslot[slot];
|
||||||
|
|
||||||
|
ath_dbg(common, ATH_DBG_BEACON,
|
||||||
|
"slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
|
||||||
|
slot, tsf, tsftu / ATH_BCBUF, intval, vif);
|
||||||
|
} else {
|
||||||
|
slot = 0;
|
||||||
|
vif = sc->beacon.bslot[slot];
|
||||||
|
}
|
||||||
|
|
||||||
ath_dbg(common, ATH_DBG_BEACON,
|
|
||||||
"slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
|
|
||||||
slot, tsf, tsftu / ATH_BCBUF, intval, vif);
|
|
||||||
|
|
||||||
bfaddr = 0;
|
bfaddr = 0;
|
||||||
if (vif) {
|
if (vif) {
|
||||||
|
|
Loading…
Reference in New Issue