diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-03-02 23:46:51 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-05 14:39:41 -0500 |
commit | 9fc9ab0a6929c9f137747df0ecf294e9582607f9 (patch) | |
tree | 6a338c68b7395b404c9eb8e3c5a8e46b9c0b21c5 | |
parent | 0c98de6535f4de746618547c057dccd442ba968a (diff) |
ath9k: Scrub beacon.c
Remove useless comments, fix indentation.
Also, remove all occurrences of ASSERT(vif) which are not needed.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath9k/ath9k.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/beacon.c | 177 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 2 |
3 files changed, 55 insertions, 126 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h index 0fb66b0c9e8e..f74ed7af31e0 100644 --- a/drivers/net/wireless/ath9k/ath9k.h +++ b/drivers/net/wireless/ath9k/ath9k.h | |||
@@ -453,7 +453,7 @@ struct ath_beacon { | |||
453 | struct list_head bbuf; | 453 | struct list_head bbuf; |
454 | }; | 454 | }; |
455 | 455 | ||
456 | void ath9k_beacon_tasklet(unsigned long data); | 456 | void ath_beacon_tasklet(unsigned long data); |
457 | void ath_beacon_config(struct ath_softc *sc, int if_id); | 457 | void ath_beacon_config(struct ath_softc *sc, int if_id); |
458 | int ath_beaconq_setup(struct ath_hw *ah); | 458 | int ath_beaconq_setup(struct ath_hw *ah); |
459 | int ath_beacon_alloc(struct ath_softc *sc, int if_id); | 459 | int ath_beacon_alloc(struct ath_softc *sc, int if_id); |
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c index 18bda362d3ab..c3044891a935 100644 --- a/drivers/net/wireless/ath9k/beacon.c +++ b/drivers/net/wireless/ath9k/beacon.c | |||
@@ -44,15 +44,14 @@ static int ath_beaconq_config(struct ath_softc *sc) | |||
44 | "unable to update h/w beacon queue parameters\n"); | 44 | "unable to update h/w beacon queue parameters\n"); |
45 | return 0; | 45 | return 0; |
46 | } else { | 46 | } else { |
47 | ath9k_hw_resettxqueue(ah, sc->beacon.beaconq); /* push to h/w */ | 47 | ath9k_hw_resettxqueue(ah, sc->beacon.beaconq); |
48 | return 1; | 48 | return 1; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | static void ath_bstuck_process(struct ath_softc *sc) | 52 | static void ath_bstuck_process(struct ath_softc *sc) |
53 | { | 53 | { |
54 | DPRINTF(sc, ATH_DBG_BEACON, | 54 | DPRINTF(sc, ATH_DBG_BEACON, "stuck beacon; resetting (bmiss count %u)\n", |
55 | "stuck beacon; resetting (bmiss count %u)\n", | ||
56 | sc->beacon.bmisscnt); | 55 | sc->beacon.bmisscnt); |
57 | ath_reset(sc, false); | 56 | ath_reset(sc, false); |
58 | } | 57 | } |
@@ -62,24 +61,18 @@ static void ath_bstuck_process(struct ath_softc *sc) | |||
62 | * up all required antenna switch parameters, rate codes, and channel flags. | 61 | * up all required antenna switch parameters, rate codes, and channel flags. |
63 | * Beacons are always sent out at the lowest rate, and are not retried. | 62 | * Beacons are always sent out at the lowest rate, and are not retried. |
64 | */ | 63 | */ |
65 | static void ath_beacon_setup(struct ath_softc *sc, | 64 | static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp, |
66 | struct ath_vif *avp, struct ath_buf *bf) | 65 | struct ath_buf *bf) |
67 | { | 66 | { |
68 | struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; | 67 | struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; |
69 | struct ath_hw *ah = sc->sc_ah; | 68 | struct ath_hw *ah = sc->sc_ah; |
70 | struct ath_desc *ds; | 69 | struct ath_desc *ds; |
71 | struct ath9k_11n_rate_series series[4]; | 70 | struct ath9k_11n_rate_series series[4]; |
72 | struct ath_rate_table *rt; | 71 | struct ath_rate_table *rt; |
73 | int flags, antenna; | 72 | int flags, antenna, ctsrate = 0, ctsduration = 0; |
74 | u8 rix, rate; | 73 | u8 rate; |
75 | int ctsrate = 0; | ||
76 | int ctsduration = 0; | ||
77 | |||
78 | DPRINTF(sc, ATH_DBG_BEACON, "m %p len %u\n", skb, skb->len); | ||
79 | 74 | ||
80 | /* setup descriptors */ | ||
81 | ds = bf->bf_desc; | 75 | ds = bf->bf_desc; |
82 | |||
83 | flags = ATH9K_TXDESC_NOACK; | 76 | flags = ATH9K_TXDESC_NOACK; |
84 | 77 | ||
85 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC && | 78 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC && |
@@ -92,53 +85,39 @@ static void ath_beacon_setup(struct ath_softc *sc, | |||
92 | ds->ds_link = 0; | 85 | ds->ds_link = 0; |
93 | /* | 86 | /* |
94 | * Switch antenna every beacon. | 87 | * Switch antenna every beacon. |
95 | * Should only switch every beacon period, not for every | 88 | * Should only switch every beacon period, not for every SWBA |
96 | * SWBA's | 89 | * XXX assumes two antennae |
97 | * XXX assumes two antenna | ||
98 | */ | 90 | */ |
99 | antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1); | 91 | antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1); |
100 | } | 92 | } |
101 | 93 | ||
102 | ds->ds_data = bf->bf_buf_addr; | 94 | ds->ds_data = bf->bf_buf_addr; |
103 | 95 | ||
104 | /* | ||
105 | * Calculate rate code. | ||
106 | * XXX everything at min xmit rate | ||
107 | */ | ||
108 | rix = 0; | ||
109 | rt = sc->cur_rate_table; | 96 | rt = sc->cur_rate_table; |
110 | rate = rt->info[rix].ratecode; | 97 | rate = rt->info[0].ratecode; |
111 | if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) | 98 | if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) |
112 | rate |= rt->info[rix].short_preamble; | 99 | rate |= rt->info[0].short_preamble; |
113 | 100 | ||
114 | ath9k_hw_set11n_txdesc(ah, ds, | 101 | ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN, |
115 | skb->len + FCS_LEN, /* frame length */ | 102 | ATH9K_PKT_TYPE_BEACON, |
116 | ATH9K_PKT_TYPE_BEACON, /* Atheros packet type */ | 103 | MAX_RATE_POWER, |
117 | MAX_RATE_POWER, /* FIXME */ | 104 | ATH9K_TXKEYIX_INVALID, |
118 | ATH9K_TXKEYIX_INVALID, /* no encryption */ | 105 | ATH9K_KEY_TYPE_CLEAR, |
119 | ATH9K_KEY_TYPE_CLEAR, /* no encryption */ | 106 | flags); |
120 | flags /* no ack, | ||
121 | veol for beacons */ | ||
122 | ); | ||
123 | 107 | ||
124 | /* NB: beacon's BufLen must be a multiple of 4 bytes */ | 108 | /* NB: beacon's BufLen must be a multiple of 4 bytes */ |
125 | ath9k_hw_filltxdesc(ah, ds, | 109 | ath9k_hw_filltxdesc(ah, ds, roundup(skb->len, 4), |
126 | roundup(skb->len, 4), /* buffer length */ | 110 | true, true, ds); |
127 | true, /* first segment */ | ||
128 | true, /* last segment */ | ||
129 | ds /* first descriptor */ | ||
130 | ); | ||
131 | 111 | ||
132 | memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); | 112 | memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); |
133 | series[0].Tries = 1; | 113 | series[0].Tries = 1; |
134 | series[0].Rate = rate; | 114 | series[0].Rate = rate; |
135 | series[0].ChSel = sc->tx_chainmask; | 115 | series[0].ChSel = sc->tx_chainmask; |
136 | series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; | 116 | series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; |
137 | ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, | 117 | ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration, |
138 | ctsrate, ctsduration, series, 4, 0); | 118 | series, 4, 0); |
139 | } | 119 | } |
140 | 120 | ||
141 | /* Generate beacon frame and queue cab data for a VIF */ | ||
142 | static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | 121 | static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) |
143 | { | 122 | { |
144 | struct ath_buf *bf; | 123 | struct ath_buf *bf; |
@@ -150,8 +129,6 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
150 | int cabq_depth; | 129 | int cabq_depth; |
151 | 130 | ||
152 | vif = sc->vifs[if_id]; | 131 | vif = sc->vifs[if_id]; |
153 | ASSERT(vif); | ||
154 | |||
155 | avp = (void *)vif->drv_priv; | 132 | avp = (void *)vif->drv_priv; |
156 | cabq = sc->beacon.cabq; | 133 | cabq = sc->beacon.cabq; |
157 | 134 | ||
@@ -161,15 +138,18 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
161 | return NULL; | 138 | return NULL; |
162 | } | 139 | } |
163 | 140 | ||
141 | /* Release the old beacon first */ | ||
142 | |||
164 | bf = avp->av_bcbuf; | 143 | bf = avp->av_bcbuf; |
165 | skb = (struct sk_buff *)bf->bf_mpdu; | 144 | skb = (struct sk_buff *)bf->bf_mpdu; |
166 | if (skb) { | 145 | if (skb) { |
167 | dma_unmap_single(sc->dev, bf->bf_dmacontext, | 146 | dma_unmap_single(sc->dev, bf->bf_dmacontext, |
168 | skb->len, | 147 | skb->len, DMA_TO_DEVICE); |
169 | DMA_TO_DEVICE); | ||
170 | dev_kfree_skb_any(skb); | 148 | dev_kfree_skb_any(skb); |
171 | } | 149 | } |
172 | 150 | ||
151 | /* Get a new beacon from mac80211 */ | ||
152 | |||
173 | skb = ieee80211_beacon_get(sc->hw, vif); | 153 | skb = ieee80211_beacon_get(sc->hw, vif); |
174 | bf->bf_mpdu = skb; | 154 | bf->bf_mpdu = skb; |
175 | if (skb == NULL) | 155 | if (skb == NULL) |
@@ -189,13 +169,11 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
189 | 169 | ||
190 | bf->bf_buf_addr = bf->bf_dmacontext = | 170 | bf->bf_buf_addr = bf->bf_dmacontext = |
191 | dma_map_single(sc->dev, skb->data, | 171 | dma_map_single(sc->dev, skb->data, |
192 | skb->len, | 172 | skb->len, DMA_TO_DEVICE); |
193 | DMA_TO_DEVICE); | ||
194 | if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { | 173 | if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { |
195 | dev_kfree_skb_any(skb); | 174 | dev_kfree_skb_any(skb); |
196 | bf->bf_mpdu = NULL; | 175 | bf->bf_mpdu = NULL; |
197 | DPRINTF(sc, ATH_DBG_CONFIG, | 176 | DPRINTF(sc, ATH_DBG_FATAL, "dma_mapping_error on beaconing\n"); |
198 | "dma_mapping_error() on beaconing\n"); | ||
199 | return NULL; | 177 | return NULL; |
200 | } | 178 | } |
201 | 179 | ||
@@ -214,25 +192,15 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id) | |||
214 | spin_unlock_bh(&cabq->axq_lock); | 192 | spin_unlock_bh(&cabq->axq_lock); |
215 | 193 | ||
216 | if (skb && cabq_depth) { | 194 | if (skb && cabq_depth) { |
217 | /* | ||
218 | * Unlock the cabq lock as ath_tx_draintxq acquires | ||
219 | * the lock again which is a common function and that | ||
220 | * acquires txq lock inside. | ||
221 | */ | ||
222 | if (sc->nvifs > 1) { | 195 | if (sc->nvifs > 1) { |
223 | ath_draintxq(sc, cabq, false); | ||
224 | DPRINTF(sc, ATH_DBG_BEACON, | 196 | DPRINTF(sc, ATH_DBG_BEACON, |
225 | "flush previous cabq traffic\n"); | 197 | "Flushing previous cabq traffic\n"); |
198 | ath_draintxq(sc, cabq, false); | ||
226 | } | 199 | } |
227 | } | 200 | } |
228 | 201 | ||
229 | /* Construct tx descriptor. */ | ||
230 | ath_beacon_setup(sc, avp, bf); | 202 | ath_beacon_setup(sc, avp, bf); |
231 | 203 | ||
232 | /* | ||
233 | * Enable the CAB queue before the beacon queue to | ||
234 | * insure cab frames are triggered by this beacon. | ||
235 | */ | ||
236 | while (skb) { | 204 | while (skb) { |
237 | ath_tx_cabq(sc, skb); | 205 | ath_tx_cabq(sc, skb); |
238 | skb = ieee80211_get_buffered_bc(sc->hw, vif); | 206 | skb = ieee80211_get_buffered_bc(sc->hw, vif); |
@@ -254,19 +222,14 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id) | |||
254 | struct sk_buff *skb; | 222 | struct sk_buff *skb; |
255 | 223 | ||
256 | vif = sc->vifs[if_id]; | 224 | vif = sc->vifs[if_id]; |
257 | ASSERT(vif); | ||
258 | |||
259 | avp = (void *)vif->drv_priv; | 225 | avp = (void *)vif->drv_priv; |
260 | 226 | ||
261 | if (avp->av_bcbuf == NULL) { | 227 | if (avp->av_bcbuf == NULL) |
262 | DPRINTF(sc, ATH_DBG_BEACON, "avp=%p av_bcbuf=%p\n", | ||
263 | avp, avp != NULL ? avp->av_bcbuf : NULL); | ||
264 | return; | 228 | return; |
265 | } | 229 | |
266 | bf = avp->av_bcbuf; | 230 | bf = avp->av_bcbuf; |
267 | skb = (struct sk_buff *) bf->bf_mpdu; | 231 | skb = (struct sk_buff *) bf->bf_mpdu; |
268 | 232 | ||
269 | /* Construct tx descriptor. */ | ||
270 | ath_beacon_setup(sc, avp, bf); | 233 | ath_beacon_setup(sc, avp, bf); |
271 | 234 | ||
272 | /* NB: caller is known to have already stopped tx dma */ | 235 | /* NB: caller is known to have already stopped tx dma */ |
@@ -298,8 +261,6 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) | |||
298 | __le64 tstamp; | 261 | __le64 tstamp; |
299 | 262 | ||
300 | vif = sc->vifs[if_id]; | 263 | vif = sc->vifs[if_id]; |
301 | ASSERT(vif); | ||
302 | |||
303 | avp = (void *)vif->drv_priv; | 264 | avp = (void *)vif->drv_priv; |
304 | 265 | ||
305 | /* Allocate a beacon descriptor if we haven't done so. */ | 266 | /* Allocate a beacon descriptor if we haven't done so. */ |
@@ -339,22 +300,17 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) | |||
339 | } | 300 | } |
340 | } | 301 | } |
341 | 302 | ||
342 | /* release the previous beacon frame , if it already exists. */ | 303 | /* release the previous beacon frame, if it already exists. */ |
343 | bf = avp->av_bcbuf; | 304 | bf = avp->av_bcbuf; |
344 | if (bf->bf_mpdu != NULL) { | 305 | if (bf->bf_mpdu != NULL) { |
345 | skb = (struct sk_buff *)bf->bf_mpdu; | 306 | skb = (struct sk_buff *)bf->bf_mpdu; |
346 | dma_unmap_single(sc->dev, bf->bf_dmacontext, | 307 | dma_unmap_single(sc->dev, bf->bf_dmacontext, |
347 | skb->len, | 308 | skb->len, DMA_TO_DEVICE); |
348 | DMA_TO_DEVICE); | ||
349 | dev_kfree_skb_any(skb); | 309 | dev_kfree_skb_any(skb); |
350 | bf->bf_mpdu = NULL; | 310 | bf->bf_mpdu = NULL; |
351 | } | 311 | } |
352 | 312 | ||
353 | /* | 313 | /* NB: the beacon data buffer must be 32-bit aligned. */ |
354 | * NB: the beacon data buffer must be 32-bit aligned. | ||
355 | * FIXME: Fill avp->av_btxctl.txpower and | ||
356 | * avp->av_btxctl.shortPreamble | ||
357 | */ | ||
358 | skb = ieee80211_beacon_get(sc->hw, vif); | 314 | skb = ieee80211_beacon_get(sc->hw, vif); |
359 | if (skb == NULL) { | 315 | if (skb == NULL) { |
360 | DPRINTF(sc, ATH_DBG_BEACON, "cannot get skb\n"); | 316 | DPRINTF(sc, ATH_DBG_BEACON, "cannot get skb\n"); |
@@ -403,13 +359,12 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id) | |||
403 | bf->bf_mpdu = skb; | 359 | bf->bf_mpdu = skb; |
404 | bf->bf_buf_addr = bf->bf_dmacontext = | 360 | bf->bf_buf_addr = bf->bf_dmacontext = |
405 | dma_map_single(sc->dev, skb->data, | 361 | dma_map_single(sc->dev, skb->data, |
406 | skb->len, | 362 | skb->len, DMA_TO_DEVICE); |
407 | DMA_TO_DEVICE); | ||
408 | if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { | 363 | if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { |
409 | dev_kfree_skb_any(skb); | 364 | dev_kfree_skb_any(skb); |
410 | bf->bf_mpdu = NULL; | 365 | bf->bf_mpdu = NULL; |
411 | DPRINTF(sc, ATH_DBG_CONFIG, | 366 | DPRINTF(sc, ATH_DBG_FATAL, |
412 | "dma_mapping_error() on beacon alloc\n"); | 367 | "dma_mapping_error on beacon alloc\n"); |
413 | return -ENOMEM; | 368 | return -ENOMEM; |
414 | } | 369 | } |
415 | 370 | ||
@@ -430,8 +385,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp) | |||
430 | if (bf->bf_mpdu != NULL) { | 385 | if (bf->bf_mpdu != NULL) { |
431 | struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; | 386 | struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; |
432 | dma_unmap_single(sc->dev, bf->bf_dmacontext, | 387 | dma_unmap_single(sc->dev, bf->bf_dmacontext, |
433 | skb->len, | 388 | skb->len, DMA_TO_DEVICE); |
434 | DMA_TO_DEVICE); | ||
435 | dev_kfree_skb_any(skb); | 389 | dev_kfree_skb_any(skb); |
436 | bf->bf_mpdu = NULL; | 390 | bf->bf_mpdu = NULL; |
437 | } | 391 | } |
@@ -441,18 +395,15 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp) | |||
441 | } | 395 | } |
442 | } | 396 | } |
443 | 397 | ||
444 | void ath9k_beacon_tasklet(unsigned long data) | 398 | void ath_beacon_tasklet(unsigned long data) |
445 | { | 399 | { |
446 | struct ath_softc *sc = (struct ath_softc *)data; | 400 | struct ath_softc *sc = (struct ath_softc *)data; |
447 | struct ath_hw *ah = sc->sc_ah; | 401 | struct ath_hw *ah = sc->sc_ah; |
448 | struct ath_buf *bf = NULL; | 402 | struct ath_buf *bf = NULL; |
449 | int slot, if_id; | 403 | int slot, if_id; |
450 | u32 bfaddr; | 404 | u32 bfaddr, show_cycles = 0, bc = 0, tsftu; |
451 | u32 rx_clear = 0, rx_frame = 0, tx_frame = 0; | 405 | u32 rx_clear = 0, rx_frame = 0, tx_frame = 0; |
452 | u32 show_cycles = 0; | ||
453 | u32 bc = 0; /* beacon count */ | ||
454 | u64 tsf; | 406 | u64 tsf; |
455 | u32 tsftu; | ||
456 | u16 intval; | 407 | u16 intval; |
457 | 408 | ||
458 | if (sc->sc_flags & SC_OP_NO_RESET) { | 409 | if (sc->sc_flags & SC_OP_NO_RESET) { |
@@ -627,7 +578,6 @@ void ath_beacon_config(struct ath_softc *sc, int if_id) | |||
627 | 578 | ||
628 | if (if_id != ATH_IF_ID_ANY) { | 579 | if (if_id != ATH_IF_ID_ANY) { |
629 | vif = sc->vifs[if_id]; | 580 | vif = sc->vifs[if_id]; |
630 | ASSERT(vif); | ||
631 | avp = (void *)vif->drv_priv; | 581 | avp = (void *)vif->drv_priv; |
632 | opmode = avp->av_opmode; | 582 | opmode = avp->av_opmode; |
633 | } else { | 583 | } else { |
@@ -757,30 +707,11 @@ void ath_beacon_config(struct ath_softc *sc, int if_id) | |||
757 | bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; | 707 | bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; |
758 | 708 | ||
759 | DPRINTF(sc, ATH_DBG_BEACON, | 709 | DPRINTF(sc, ATH_DBG_BEACON, |
760 | "tsf %llu " | 710 | "tsf: %llu tsftu: %u\n", tsf, tsftu); |
761 | "tsf:tu %u " | 711 | DPRINTF(sc, ATH_DBG_BEACON, |
762 | "intval %u " | 712 | "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", |
763 | "nexttbtt %u " | 713 | bs.bs_bmissthreshold, bs.bs_sleepduration, |
764 | "dtim %u " | 714 | bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); |
765 | "nextdtim %u " | ||
766 | "bmiss %u " | ||
767 | "sleep %u " | ||
768 | "cfp:period %u " | ||
769 | "maxdur %u " | ||
770 | "next %u " | ||
771 | "timoffset %u\n", | ||
772 | (unsigned long long)tsf, tsftu, | ||
773 | bs.bs_intval, | ||
774 | bs.bs_nexttbtt, | ||
775 | bs.bs_dtimperiod, | ||
776 | bs.bs_nextdtim, | ||
777 | bs.bs_bmissthreshold, | ||
778 | bs.bs_sleepduration, | ||
779 | bs.bs_cfpperiod, | ||
780 | bs.bs_cfpmaxduration, | ||
781 | bs.bs_cfpnext, | ||
782 | bs.bs_timoffset | ||
783 | ); | ||
784 | 715 | ||
785 | ath9k_hw_set_interrupts(ah, 0); | 716 | ath9k_hw_set_interrupts(ah, 0); |
786 | ath9k_hw_set_sta_beacon_timers(ah, &bs); | 717 | ath9k_hw_set_sta_beacon_timers(ah, &bs); |
@@ -789,17 +720,15 @@ void ath_beacon_config(struct ath_softc *sc, int if_id) | |||
789 | } else { | 720 | } else { |
790 | u64 tsf; | 721 | u64 tsf; |
791 | u32 tsftu; | 722 | u32 tsftu; |
723 | |||
792 | ath9k_hw_set_interrupts(ah, 0); | 724 | ath9k_hw_set_interrupts(ah, 0); |
793 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) { | 725 | if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) { |
794 | /* | 726 | /* Pull nexttbtt forward to reflect the current TSF */ |
795 | * Pull nexttbtt forward to reflect the current | ||
796 | * TSF | ||
797 | */ | ||
798 | #define FUDGE 2 | 727 | #define FUDGE 2 |
799 | if (!(intval & ATH9K_BEACON_RESET_TSF)) { | 728 | if (!(intval & ATH9K_BEACON_RESET_TSF)) { |
800 | tsf = ath9k_hw_gettsf64(ah); | 729 | tsf = ath9k_hw_gettsf64(ah); |
801 | tsftu = TSF_TO_TU((u32)(tsf>>32), | 730 | tsftu = TSF_TO_TU((u32)(tsf>>32), |
802 | (u32)tsf) + FUDGE; | 731 | (u32)tsf) + FUDGE; |
803 | do { | 732 | do { |
804 | nexttbtt += intval; | 733 | nexttbtt += intval; |
805 | } while (nexttbtt < tsftu); | 734 | } while (nexttbtt < tsftu); |
@@ -807,8 +736,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id) | |||
807 | #undef FUDGE | 736 | #undef FUDGE |
808 | DPRINTF(sc, ATH_DBG_BEACON, | 737 | DPRINTF(sc, ATH_DBG_BEACON, |
809 | "IBSS nexttbtt %u intval %u (%u)\n", | 738 | "IBSS nexttbtt %u intval %u (%u)\n", |
810 | nexttbtt, | 739 | nexttbtt, intval & ~ATH9K_BEACON_RESET_TSF, |
811 | intval & ~ATH9K_BEACON_RESET_TSF, | ||
812 | conf.beacon_interval); | 740 | conf.beacon_interval); |
813 | 741 | ||
814 | /* | 742 | /* |
@@ -825,18 +753,19 @@ void ath_beacon_config(struct ath_softc *sc, int if_id) | |||
825 | } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { | 753 | } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { |
826 | if (nexttbtt == intval) | 754 | if (nexttbtt == intval) |
827 | intval |= ATH9K_BEACON_RESET_TSF; | 755 | intval |= ATH9K_BEACON_RESET_TSF; |
828 | |||
829 | /* | 756 | /* |
830 | * In AP mode we enable the beacon timers and | 757 | * In AP mode we enable the beacon timers and |
831 | * SWBA interrupts to prepare beacon frames. | 758 | * SWBA interrupts to prepare beacon frames. |
832 | */ | 759 | */ |
833 | intval |= ATH9K_BEACON_ENA; | 760 | intval |= ATH9K_BEACON_ENA; |
834 | sc->imask |= ATH9K_INT_SWBA; /* beacon prepare */ | 761 | sc->imask |= ATH9K_INT_SWBA; |
835 | ath_beaconq_config(sc); | 762 | ath_beaconq_config(sc); |
836 | } | 763 | } |
764 | |||
837 | ath9k_hw_beaconinit(ah, nexttbtt, intval); | 765 | ath9k_hw_beaconinit(ah, nexttbtt, intval); |
838 | sc->beacon.bmisscnt = 0; | 766 | sc->beacon.bmisscnt = 0; |
839 | ath9k_hw_set_interrupts(ah, sc->imask); | 767 | ath9k_hw_set_interrupts(ah, sc->imask); |
768 | |||
840 | /* | 769 | /* |
841 | * When using a self-linked beacon descriptor in | 770 | * When using a self-linked beacon descriptor in |
842 | * ibss mode load it once here. | 771 | * ibss mode load it once here. |
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 48beef9235b3..94297b6d69fb 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1374,7 +1374,7 @@ static int ath_init(u16 devid, struct ath_softc *sc) | |||
1374 | spin_lock_init(&sc->sc_resetlock); | 1374 | spin_lock_init(&sc->sc_resetlock); |
1375 | mutex_init(&sc->mutex); | 1375 | mutex_init(&sc->mutex); |
1376 | tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); | 1376 | tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); |
1377 | tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet, | 1377 | tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet, |
1378 | (unsigned long)sc); | 1378 | (unsigned long)sc); |
1379 | 1379 | ||
1380 | /* | 1380 | /* |