Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150434
b: refs/heads/master
c: 267a901
h: refs/heads/master
v: v3
  • Loading branch information
Jouni Malinen authored and John W. Linville committed May 22, 2009
1 parent 11e9a8e commit 2571ce3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d26285f873c3066fefe648b47b9ecf3ec18bcfbc
refs/heads/master: 267a90127472be70b02ab13cbd355b5013e2aa51
28 changes: 21 additions & 7 deletions trunk/drivers/net/wireless/ath/ath9k/beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
int cfpperiod, cfpcount;
u32 nexttbtt = 0, intval, tsftu;
u64 tsf;
int num_beacons, offset, dtim_dec_count, cfp_dec_count;

memset(&bs, 0, sizeof(bs));
intval = conf->beacon_interval & ATH9K_BEACON_PERIOD;
Expand Down Expand Up @@ -586,14 +587,27 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
*/
tsf = ath9k_hw_gettsf64(sc->sc_ah);
tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE;
do {

num_beacons = tsftu / intval + 1;
offset = tsftu % intval;
nexttbtt = tsftu - offset;
if (offset)
nexttbtt += intval;
if (--dtimcount < 0) {
dtimcount = dtimperiod - 1;
if (--cfpcount < 0)
cfpcount = cfpperiod - 1;
}
} while (nexttbtt < tsftu);

/* DTIM Beacon every dtimperiod Beacon */
dtim_dec_count = num_beacons % dtimperiod;
/* CFP every cfpperiod DTIM Beacon */
cfp_dec_count = (num_beacons / dtimperiod) % cfpperiod;
if (dtim_dec_count)
cfp_dec_count++;

dtimcount -= dtim_dec_count;
if (dtimcount < 0)
dtimcount += dtimperiod;

cfpcount -= cfp_dec_count;
if (cfpcount < 0)
cfpcount += cfpperiod;

bs.bs_intval = intval;
bs.bs_nexttbtt = nexttbtt;
Expand Down

0 comments on commit 2571ce3

Please sign in to comment.