static void ath9k_beacon_config_adhoc(struct ath_softc *sc, struct ath_beacon_config *conf) { struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); u32 intval, nexttbtt; ath9k_reset_beacon_status(sc); intval = TU_TO_USEC(conf->beacon_interval); if (conf->ibss_creator) { nexttbtt = intval; } else { u32 tbtt, offset, tsftu; u64 tsf; /* * Pull nexttbtt forward to reflect the current * sync'd TSF. */ tsf = ath9k_hw_gettsf64(ah); tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE; offset = tsftu % conf->beacon_interval; tbtt = tsftu - offset; if (offset) tbtt += conf->beacon_interval; nexttbtt = TU_TO_USEC(tbtt); } if (conf->enable_beacon) ah->imask |= ATH9K_INT_SWBA; else ah->imask &= ~ATH9K_INT_SWBA; ath_dbg(common, BEACON, "IBSS (%s) nexttbtt: %u intval: %u conf_intval: %u\n", (conf->enable_beacon) ? "Enable" : "Disable", nexttbtt, intval, conf->beacon_interval); ath9k_beacon_init(sc, nexttbtt, intval, conf->ibss_creator); /* * Set the global 'beacon has been configured' flag for the * joiner case in IBSS mode. */ if (!conf->ibss_creator && conf->enable_beacon) set_bit(SC_OP_BEACONS, &sc->sc_flags); }
static void ath9k_beacon_config_adhoc(struct ath_softc *sc, struct ath_beacon_config *conf) { struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); u32 intval, nexttbtt; ath9k_reset_beacon_status(sc); intval = TU_TO_USEC(conf->beacon_interval); nexttbtt = intval; if (conf->enable_beacon) ah->imask |= ATH9K_INT_SWBA; else ah->imask &= ~ATH9K_INT_SWBA; ath_dbg(common, BEACON, "IBSS nexttbtt: %u intval: %u conf_intval: %u\n", nexttbtt, intval, conf->beacon_interval); ath9k_beacon_init(sc, nexttbtt, intval); }
/* * For multi-bss ap support beacons are either staggered evenly over N slots or * burst together. For the former arrange for the SWBA to be delivered for each * slot. Slots that are not occupied will generate nothing. */ static void ath9k_beacon_config_ap(struct ath_softc *sc, struct ath_beacon_config *conf) { struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); u32 nexttbtt, intval; /* NB: the beacon interval is kept internally in TU's */ intval = TU_TO_USEC(conf->beacon_interval); intval /= ATH_BCBUF; nexttbtt = intval; if (conf->enable_beacon) ah->imask |= ATH9K_INT_SWBA; else ah->imask &= ~ATH9K_INT_SWBA; ath_dbg(common, BEACON, "AP nexttbtt: %u intval: %u conf_intval: %u\n", nexttbtt, intval, conf->beacon_interval); ath9k_beacon_init(sc, nexttbtt, intval); }