beacon.c (8181d3ef26ed1d9eb21e2cdcac374e1f457fdc06) beacon.c (f29f5c0882bdd58c42b8176ee0b578f92589fda2)
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 482 unchanged lines hidden (view full) ---

491 */
492static void ath_beacon_config_ap(struct ath_softc *sc,
493 struct ath_beacon_config *conf)
494{
495 struct ath_hw *ah = sc->sc_ah;
496 u32 nexttbtt, intval;
497
498 /* NB: the beacon interval is kept internally in TU's */
1/*
2 * Copyright (c) 2008-2011 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 482 unchanged lines hidden (view full) ---

491 */
492static void ath_beacon_config_ap(struct ath_softc *sc,
493 struct ath_beacon_config *conf)
494{
495 struct ath_hw *ah = sc->sc_ah;
496 u32 nexttbtt, intval;
497
498 /* NB: the beacon interval is kept internally in TU's */
499 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD);
499 intval = TU_TO_USEC(conf->beacon_interval);
500 intval /= ATH_BCBUF; /* for staggered beacons */
501 nexttbtt = intval;
502
503 /*
504 * In AP mode we enable the beacon timers and SWBA interrupts to
505 * prepare beacon frames.
506 */
507 ah->imask |= ATH9K_INT_SWBA;

--- 30 unchanged lines hidden (view full) ---

538 /* No need to configure beacon if we are not associated */
539 if (!common->curaid) {
540 ath_dbg(common, ATH_DBG_BEACON,
541 "STA is not yet associated..skipping beacon config\n");
542 return;
543 }
544
545 memset(&bs, 0, sizeof(bs));
500 intval /= ATH_BCBUF; /* for staggered beacons */
501 nexttbtt = intval;
502
503 /*
504 * In AP mode we enable the beacon timers and SWBA interrupts to
505 * prepare beacon frames.
506 */
507 ah->imask |= ATH9K_INT_SWBA;

--- 30 unchanged lines hidden (view full) ---

538 /* No need to configure beacon if we are not associated */
539 if (!common->curaid) {
540 ath_dbg(common, ATH_DBG_BEACON,
541 "STA is not yet associated..skipping beacon config\n");
542 return;
543 }
544
545 memset(&bs, 0, sizeof(bs));
546 intval = conf->beacon_interval & ATH9K_BEACON_PERIOD;
546 intval = conf->beacon_interval;
547
548 /*
549 * Setup dtim and cfp parameters according to
550 * last beacon we received (which may be none).
551 */
552 dtimperiod = conf->dtim_period;
553 dtimcount = conf->dtim_count;
554 if (dtimcount >= dtimperiod) /* NB: sanity check */

--- 97 unchanged lines hidden (view full) ---

652{
653 struct ath_hw *ah = sc->sc_ah;
654 struct ath_common *common = ath9k_hw_common(ah);
655 u32 tsf, delta, intval, nexttbtt;
656
657 ath9k_reset_beacon_status(sc);
658
659 tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE);
547
548 /*
549 * Setup dtim and cfp parameters according to
550 * last beacon we received (which may be none).
551 */
552 dtimperiod = conf->dtim_period;
553 dtimcount = conf->dtim_count;
554 if (dtimcount >= dtimperiod) /* NB: sanity check */

--- 97 unchanged lines hidden (view full) ---

652{
653 struct ath_hw *ah = sc->sc_ah;
654 struct ath_common *common = ath9k_hw_common(ah);
655 u32 tsf, delta, intval, nexttbtt;
656
657 ath9k_reset_beacon_status(sc);
658
659 tsf = ath9k_hw_gettsf32(ah) + TU_TO_USEC(FUDGE);
660 intval = TU_TO_USEC(conf->beacon_interval & ATH9K_BEACON_PERIOD);
660 intval = TU_TO_USEC(conf->beacon_interval);
661
662 if (!sc->beacon.bc_tstamp)
663 nexttbtt = tsf + intval;
664 else {
665 if (tsf > sc->beacon.bc_tstamp)
666 delta = (tsf - sc->beacon.bc_tstamp);
667 else
668 delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));

--- 177 unchanged lines hidden ---
661
662 if (!sc->beacon.bc_tstamp)
663 nexttbtt = tsf + intval;
664 else {
665 if (tsf > sc->beacon.bc_tstamp)
666 delta = (tsf - sc->beacon.bc_tstamp);
667 else
668 delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));

--- 177 unchanged lines hidden ---