2 * Copyright (c) 2010-2011 Atheros Communications Inc.
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.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 void ath9k_htc_beaconq_config(struct ath9k_htc_priv
*priv
)
23 struct ath_hw
*ah
= priv
->ah
;
24 struct ath9k_tx_queue_info qi
, qi_be
;
26 memset(&qi
, 0, sizeof(struct ath9k_tx_queue_info
));
27 memset(&qi_be
, 0, sizeof(struct ath9k_tx_queue_info
));
29 ath9k_hw_get_txq_props(ah
, priv
->beaconq
, &qi
);
31 if (priv
->ah
->opmode
== NL80211_IFTYPE_AP
||
32 priv
->ah
->opmode
== NL80211_IFTYPE_MESH_POINT
) {
36 } else if (priv
->ah
->opmode
== NL80211_IFTYPE_ADHOC
) {
37 int qnum
= priv
->hwq_map
[IEEE80211_AC_BE
];
39 ath9k_hw_get_txq_props(ah
, qnum
, &qi_be
);
41 qi
.tqi_aifs
= qi_be
.tqi_aifs
;
44 * For WIFI Beacon Distribution
45 * Long slot time : 2x cwmin
46 * Short slot time : 4x cwmin
48 if (ah
->slottime
== ATH9K_SLOT_TIME_20
)
49 qi
.tqi_cwmin
= 2*qi_be
.tqi_cwmin
;
51 qi
.tqi_cwmin
= 4*qi_be
.tqi_cwmin
;
53 qi
.tqi_cwmax
= qi_be
.tqi_cwmax
;
57 if (!ath9k_hw_set_txq_props(ah
, priv
->beaconq
, &qi
)) {
58 ath_err(ath9k_hw_common(ah
),
59 "Unable to update beacon queue %u!\n", priv
->beaconq
);
61 ath9k_hw_resettxqueue(ah
, priv
->beaconq
);
66 static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv
*priv
,
67 struct htc_beacon_config
*bss_conf
)
69 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
70 struct ath9k_beacon_state bs
;
71 enum ath9k_int imask
= 0;
72 int dtimperiod
, dtimcount
, sleepduration
;
73 int cfpperiod
, cfpcount
, bmiss_timeout
;
74 u32 nexttbtt
= 0, intval
, tsftu
;
77 int num_beacons
, offset
, dtim_dec_count
, cfp_dec_count
;
78 int ret
__attribute__ ((unused
));
81 memset(&bs
, 0, sizeof(bs
));
83 intval
= bss_conf
->beacon_interval
;
84 bmiss_timeout
= (ATH_DEFAULT_BMISS_LIMIT
* bss_conf
->beacon_interval
);
87 * Setup dtim and cfp parameters according to
88 * last beacon we received (which may be none).
90 dtimperiod
= bss_conf
->dtim_period
;
91 if (dtimperiod
<= 0) /* NB: 0 if not known */
94 if (dtimcount
>= dtimperiod
) /* NB: sanity check */
96 cfpperiod
= 1; /* NB: no PCF support yet */
99 sleepduration
= intval
;
100 if (sleepduration
<= 0)
101 sleepduration
= intval
;
104 * Pull nexttbtt forward to reflect the current
105 * TSF and calculate dtim+cfp state for the result.
107 tsf
= ath9k_hw_gettsf64(priv
->ah
);
108 tsftu
= TSF_TO_TU(tsf
>>32, tsf
) + FUDGE
;
110 num_beacons
= tsftu
/ intval
+ 1;
111 offset
= tsftu
% intval
;
112 nexttbtt
= tsftu
- offset
;
116 /* DTIM Beacon every dtimperiod Beacon */
117 dtim_dec_count
= num_beacons
% dtimperiod
;
118 /* CFP every cfpperiod DTIM Beacon */
119 cfp_dec_count
= (num_beacons
/ dtimperiod
) % cfpperiod
;
123 dtimcount
-= dtim_dec_count
;
125 dtimcount
+= dtimperiod
;
127 cfpcount
-= cfp_dec_count
;
129 cfpcount
+= cfpperiod
;
131 bs
.bs_intval
= intval
;
132 bs
.bs_nexttbtt
= nexttbtt
;
133 bs
.bs_dtimperiod
= dtimperiod
*intval
;
134 bs
.bs_nextdtim
= bs
.bs_nexttbtt
+ dtimcount
*intval
;
135 bs
.bs_cfpperiod
= cfpperiod
*bs
.bs_dtimperiod
;
136 bs
.bs_cfpnext
= bs
.bs_nextdtim
+ cfpcount
*bs
.bs_dtimperiod
;
137 bs
.bs_cfpmaxduration
= 0;
140 * Calculate the number of consecutive beacons to miss* before taking
141 * a BMISS interrupt. The configuration is specified in TU so we only
142 * need calculate based on the beacon interval. Note that we clamp the
143 * result to at most 15 beacons.
145 if (sleepduration
> intval
) {
146 bs
.bs_bmissthreshold
= ATH_DEFAULT_BMISS_LIMIT
/ 2;
148 bs
.bs_bmissthreshold
= DIV_ROUND_UP(bmiss_timeout
, intval
);
149 if (bs
.bs_bmissthreshold
> 15)
150 bs
.bs_bmissthreshold
= 15;
151 else if (bs
.bs_bmissthreshold
<= 0)
152 bs
.bs_bmissthreshold
= 1;
156 * Calculate sleep duration. The configuration is given in ms.
157 * We ensure a multiple of the beacon period is used. Also, if the sleep
158 * duration is greater than the DTIM period then it makes senses
159 * to make it a multiple of that.
164 bs
.bs_sleepduration
= roundup(IEEE80211_MS_TO_TU(100), sleepduration
);
165 if (bs
.bs_sleepduration
> bs
.bs_dtimperiod
)
166 bs
.bs_sleepduration
= bs
.bs_dtimperiod
;
168 /* TSF out of range threshold fixed at 1 second */
169 bs
.bs_tsfoor_threshold
= ATH9K_TSFOOR_THRESHOLD
;
171 ath_dbg(common
, CONFIG
, "intval: %u tsf: %llu tsftu: %u\n",
173 ath_dbg(common
, CONFIG
,
174 "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n",
175 bs
.bs_bmissthreshold
, bs
.bs_sleepduration
,
176 bs
.bs_cfpperiod
, bs
.bs_cfpmaxduration
, bs
.bs_cfpnext
);
178 /* Set the computed STA beacon timers */
180 WMI_CMD(WMI_DISABLE_INTR_CMDID
);
181 ath9k_hw_set_sta_beacon_timers(priv
->ah
, &bs
);
182 imask
|= ATH9K_INT_BMISS
;
183 htc_imask
= cpu_to_be32(imask
);
184 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID
, &htc_imask
);
187 static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv
*priv
,
188 struct htc_beacon_config
*bss_conf
)
190 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
191 enum ath9k_int imask
= 0;
192 u32 nexttbtt
, intval
, tsftu
;
193 __be32 htc_imask
= 0;
194 int ret
__attribute__ ((unused
));
198 intval
= bss_conf
->beacon_interval
;
199 intval
/= ATH9K_HTC_MAX_BCN_VIF
;
203 * To reduce beacon misses under heavy TX load,
204 * set the beacon response time to a larger value.
206 if (intval
> DEFAULT_SWBA_RESPONSE
)
207 priv
->ah
->config
.sw_beacon_response_time
= DEFAULT_SWBA_RESPONSE
;
209 priv
->ah
->config
.sw_beacon_response_time
= MIN_SWBA_RESPONSE
;
211 if (test_bit(OP_TSF_RESET
, &priv
->op_flags
)) {
212 ath9k_hw_reset_tsf(priv
->ah
);
213 clear_bit(OP_TSF_RESET
, &priv
->op_flags
);
216 * Pull nexttbtt forward to reflect the current TSF.
218 tsf
= ath9k_hw_gettsf64(priv
->ah
);
219 tsftu
= TSF_TO_TU(tsf
>> 32, tsf
) + FUDGE
;
222 } while (nexttbtt
< tsftu
);
225 if (test_bit(OP_ENABLE_BEACON
, &priv
->op_flags
))
226 imask
|= ATH9K_INT_SWBA
;
228 ath_dbg(common
, CONFIG
,
229 "AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d imask: 0x%x\n",
230 bss_conf
->beacon_interval
, nexttbtt
,
231 priv
->ah
->config
.sw_beacon_response_time
, imask
);
233 ath9k_htc_beaconq_config(priv
);
235 WMI_CMD(WMI_DISABLE_INTR_CMDID
);
236 ath9k_hw_beaconinit(priv
->ah
, TU_TO_USEC(nexttbtt
), TU_TO_USEC(intval
));
237 priv
->cur_beacon_conf
.bmiss_cnt
= 0;
238 htc_imask
= cpu_to_be32(imask
);
239 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID
, &htc_imask
);
242 static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv
*priv
,
243 struct htc_beacon_config
*bss_conf
)
245 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
246 enum ath9k_int imask
= 0;
247 u32 nexttbtt
, intval
, tsftu
;
248 __be32 htc_imask
= 0;
249 int ret
__attribute__ ((unused
));
253 intval
= bss_conf
->beacon_interval
;
257 * Pull nexttbtt forward to reflect the current TSF.
259 tsf
= ath9k_hw_gettsf64(priv
->ah
);
260 tsftu
= TSF_TO_TU(tsf
>> 32, tsf
) + FUDGE
;
263 } while (nexttbtt
< tsftu
);
266 * Only one IBSS interfce is allowed.
268 if (intval
> DEFAULT_SWBA_RESPONSE
)
269 priv
->ah
->config
.sw_beacon_response_time
= DEFAULT_SWBA_RESPONSE
;
271 priv
->ah
->config
.sw_beacon_response_time
= MIN_SWBA_RESPONSE
;
273 if (test_bit(OP_ENABLE_BEACON
, &priv
->op_flags
))
274 imask
|= ATH9K_INT_SWBA
;
276 ath_dbg(common
, CONFIG
,
277 "IBSS Beacon config, intval: %d, nexttbtt: %u, resp_time: %d, imask: 0x%x\n",
278 bss_conf
->beacon_interval
, nexttbtt
,
279 priv
->ah
->config
.sw_beacon_response_time
, imask
);
281 WMI_CMD(WMI_DISABLE_INTR_CMDID
);
282 ath9k_hw_beaconinit(priv
->ah
, TU_TO_USEC(nexttbtt
), TU_TO_USEC(intval
));
283 priv
->cur_beacon_conf
.bmiss_cnt
= 0;
284 htc_imask
= cpu_to_be32(imask
);
285 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID
, &htc_imask
);
288 void ath9k_htc_beaconep(void *drv_priv
, struct sk_buff
*skb
,
289 enum htc_endpoint_id ep_id
, bool txok
)
291 dev_kfree_skb_any(skb
);
294 static void ath9k_htc_send_buffered(struct ath9k_htc_priv
*priv
,
297 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
298 struct ieee80211_vif
*vif
;
300 struct ieee80211_hdr
*hdr
;
301 int padpos
, padsize
, ret
, tx_slot
;
303 spin_lock_bh(&priv
->beacon_lock
);
305 vif
= priv
->cur_beacon_conf
.bslot
[slot
];
307 skb
= ieee80211_get_buffered_bc(priv
->hw
, vif
);
310 hdr
= (struct ieee80211_hdr
*) skb
->data
;
312 padpos
= ieee80211_hdrlen(hdr
->frame_control
);
313 padsize
= padpos
& 3;
314 if (padsize
&& skb
->len
> padpos
) {
315 if (skb_headroom(skb
) < padsize
) {
316 dev_kfree_skb_any(skb
);
319 skb_push(skb
, padsize
);
320 memmove(skb
->data
, skb
->data
+ padsize
, padpos
);
323 tx_slot
= ath9k_htc_tx_get_slot(priv
);
325 ath_dbg(common
, XMIT
, "No free CAB slot\n");
326 dev_kfree_skb_any(skb
);
330 ret
= ath9k_htc_tx_start(priv
, NULL
, skb
, tx_slot
, true);
332 ath9k_htc_tx_clear_slot(priv
, tx_slot
);
333 dev_kfree_skb_any(skb
);
335 ath_dbg(common
, XMIT
, "Failed to send CAB frame\n");
337 spin_lock_bh(&priv
->tx
.tx_lock
);
338 priv
->tx
.queued_cnt
++;
339 spin_unlock_bh(&priv
->tx
.tx_lock
);
342 skb
= ieee80211_get_buffered_bc(priv
->hw
, vif
);
345 spin_unlock_bh(&priv
->beacon_lock
);
348 static void ath9k_htc_send_beacon(struct ath9k_htc_priv
*priv
,
351 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
352 struct ieee80211_vif
*vif
;
353 struct ath9k_htc_vif
*avp
;
354 struct tx_beacon_header beacon_hdr
;
355 struct ath9k_htc_tx_ctl
*tx_ctl
;
356 struct ieee80211_tx_info
*info
;
357 struct ieee80211_mgmt
*mgmt
;
358 struct sk_buff
*beacon
;
362 memset(&beacon_hdr
, 0, sizeof(struct tx_beacon_header
));
364 spin_lock_bh(&priv
->beacon_lock
);
366 vif
= priv
->cur_beacon_conf
.bslot
[slot
];
367 avp
= (struct ath9k_htc_vif
*)vif
->drv_priv
;
369 if (unlikely(test_bit(OP_SCANNING
, &priv
->op_flags
))) {
370 spin_unlock_bh(&priv
->beacon_lock
);
374 /* Get a new beacon */
375 beacon
= ieee80211_beacon_get(priv
->hw
, vif
);
377 spin_unlock_bh(&priv
->beacon_lock
);
382 * Update the TSF adjust value here, the HW will
383 * add this value for every beacon.
385 mgmt
= (struct ieee80211_mgmt
*)beacon
->data
;
386 mgmt
->u
.beacon
.timestamp
= avp
->tsfadjust
;
388 info
= IEEE80211_SKB_CB(beacon
);
389 if (info
->flags
& IEEE80211_TX_CTL_ASSIGN_SEQ
) {
390 struct ieee80211_hdr
*hdr
=
391 (struct ieee80211_hdr
*) beacon
->data
;
393 hdr
->seq_ctrl
&= cpu_to_le16(IEEE80211_SCTL_FRAG
);
394 hdr
->seq_ctrl
|= cpu_to_le16(avp
->seq_no
);
397 tx_ctl
= HTC_SKB_CB(beacon
);
398 memset(tx_ctl
, 0, sizeof(*tx_ctl
));
400 tx_ctl
->type
= ATH9K_HTC_BEACON
;
401 tx_ctl
->epid
= priv
->beacon_ep
;
403 beacon_hdr
.vif_index
= avp
->index
;
404 tx_fhdr
= skb_push(beacon
, sizeof(beacon_hdr
));
405 memcpy(tx_fhdr
, (u8
*) &beacon_hdr
, sizeof(beacon_hdr
));
407 ret
= htc_send(priv
->htc
, beacon
);
409 if (ret
== -ENOMEM
) {
410 ath_dbg(common
, BSTUCK
,
411 "Failed to send beacon, no free TX buffer\n");
413 dev_kfree_skb_any(beacon
);
416 spin_unlock_bh(&priv
->beacon_lock
);
419 static int ath9k_htc_choose_bslot(struct ath9k_htc_priv
*priv
,
420 struct wmi_event_swba
*swba
)
422 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
428 intval
= priv
->cur_beacon_conf
.beacon_interval
;
430 tsf
= be64_to_cpu(swba
->tsf
);
431 tsftu
= TSF_TO_TU(tsf
>> 32, tsf
);
432 slot
= ((tsftu
% intval
) * ATH9K_HTC_MAX_BCN_VIF
) / intval
;
433 slot
= ATH9K_HTC_MAX_BCN_VIF
- slot
- 1;
435 ath_dbg(common
, BEACON
,
436 "Choose slot: %d, tsf: %llu, tsftu: %u, intval: %u\n",
437 slot
, tsf
, tsftu
, intval
);
442 void ath9k_htc_swba(struct ath9k_htc_priv
*priv
,
443 struct wmi_event_swba
*swba
)
445 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
448 if (swba
->beacon_pending
!= 0) {
449 priv
->cur_beacon_conf
.bmiss_cnt
++;
450 if (priv
->cur_beacon_conf
.bmiss_cnt
> BSTUCK_THRESHOLD
) {
451 ath_dbg(common
, BSTUCK
, "Beacon stuck, HW reset\n");
452 ieee80211_queue_work(priv
->hw
,
458 if (priv
->cur_beacon_conf
.bmiss_cnt
) {
459 ath_dbg(common
, BSTUCK
,
460 "Resuming beacon xmit after %u misses\n",
461 priv
->cur_beacon_conf
.bmiss_cnt
);
462 priv
->cur_beacon_conf
.bmiss_cnt
= 0;
465 slot
= ath9k_htc_choose_bslot(priv
, swba
);
466 spin_lock_bh(&priv
->beacon_lock
);
467 if (priv
->cur_beacon_conf
.bslot
[slot
] == NULL
) {
468 spin_unlock_bh(&priv
->beacon_lock
);
471 spin_unlock_bh(&priv
->beacon_lock
);
473 ath9k_htc_send_buffered(priv
, slot
);
474 ath9k_htc_send_beacon(priv
, slot
);
477 void ath9k_htc_assign_bslot(struct ath9k_htc_priv
*priv
,
478 struct ieee80211_vif
*vif
)
480 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
481 struct ath9k_htc_vif
*avp
= (struct ath9k_htc_vif
*)vif
->drv_priv
;
484 spin_lock_bh(&priv
->beacon_lock
);
485 for (i
= 0; i
< ATH9K_HTC_MAX_BCN_VIF
; i
++) {
486 if (priv
->cur_beacon_conf
.bslot
[i
] == NULL
) {
492 priv
->cur_beacon_conf
.bslot
[avp
->bslot
] = vif
;
493 spin_unlock_bh(&priv
->beacon_lock
);
495 ath_dbg(common
, CONFIG
, "Added interface at beacon slot: %d\n",
499 void ath9k_htc_remove_bslot(struct ath9k_htc_priv
*priv
,
500 struct ieee80211_vif
*vif
)
502 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
503 struct ath9k_htc_vif
*avp
= (struct ath9k_htc_vif
*)vif
->drv_priv
;
505 spin_lock_bh(&priv
->beacon_lock
);
506 priv
->cur_beacon_conf
.bslot
[avp
->bslot
] = NULL
;
507 spin_unlock_bh(&priv
->beacon_lock
);
509 ath_dbg(common
, CONFIG
, "Removed interface at beacon slot: %d\n",
514 * Calculate the TSF adjustment value for all slots
517 void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv
*priv
,
518 struct ieee80211_vif
*vif
)
520 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
521 struct ath9k_htc_vif
*avp
= (struct ath9k_htc_vif
*)vif
->drv_priv
;
522 struct htc_beacon_config
*cur_conf
= &priv
->cur_beacon_conf
;
529 * The beacon interval cannot be different for multi-AP mode,
530 * and we reach here only for VIF slots greater than zero,
531 * so beacon_interval is guaranteed to be set in cur_conf.
533 tsfadjust
= cur_conf
->beacon_interval
* avp
->bslot
/ ATH9K_HTC_MAX_BCN_VIF
;
534 avp
->tsfadjust
= cpu_to_le64(TU_TO_USEC(tsfadjust
));
536 ath_dbg(common
, CONFIG
, "tsfadjust is: %llu for bslot: %d\n",
537 (unsigned long long)tsfadjust
, avp
->bslot
);
540 static void ath9k_htc_beacon_iter(void *data
, u8
*mac
, struct ieee80211_vif
*vif
)
542 bool *beacon_configured
= (bool *)data
;
543 struct ath9k_htc_vif
*avp
= (struct ath9k_htc_vif
*) vif
->drv_priv
;
545 if (vif
->type
== NL80211_IFTYPE_STATION
&&
546 avp
->beacon_configured
)
547 *beacon_configured
= true;
550 static bool ath9k_htc_check_beacon_config(struct ath9k_htc_priv
*priv
,
551 struct ieee80211_vif
*vif
)
553 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
554 struct htc_beacon_config
*cur_conf
= &priv
->cur_beacon_conf
;
555 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
556 bool beacon_configured
;
559 * Changing the beacon interval when multiple AP interfaces
560 * are configured will affect beacon transmission of all
563 if ((priv
->ah
->opmode
== NL80211_IFTYPE_AP
) &&
564 (priv
->num_ap_vif
> 1) &&
565 (vif
->type
== NL80211_IFTYPE_AP
) &&
566 (cur_conf
->beacon_interval
!= bss_conf
->beacon_int
)) {
567 ath_dbg(common
, CONFIG
,
568 "Changing beacon interval of multiple AP interfaces !\n");
573 * If the HW is operating in AP mode, any new station interfaces that
574 * are added cannot change the beacon parameters.
576 if (priv
->num_ap_vif
&&
577 (vif
->type
!= NL80211_IFTYPE_AP
)) {
578 ath_dbg(common
, CONFIG
,
579 "HW in AP mode, cannot set STA beacon parameters\n");
584 * The beacon parameters are configured only for the first
587 if ((priv
->ah
->opmode
== NL80211_IFTYPE_STATION
) &&
588 (priv
->num_sta_vif
> 1) &&
589 (vif
->type
== NL80211_IFTYPE_STATION
)) {
590 beacon_configured
= false;
591 ieee80211_iterate_active_interfaces_atomic(
592 priv
->hw
, IEEE80211_IFACE_ITER_RESUME_ALL
,
593 ath9k_htc_beacon_iter
, &beacon_configured
);
595 if (beacon_configured
) {
596 ath_dbg(common
, CONFIG
,
597 "Beacon already configured for a station interface\n");
605 void ath9k_htc_beacon_config(struct ath9k_htc_priv
*priv
,
606 struct ieee80211_vif
*vif
)
608 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
609 struct htc_beacon_config
*cur_conf
= &priv
->cur_beacon_conf
;
610 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
611 struct ath9k_htc_vif
*avp
= (struct ath9k_htc_vif
*) vif
->drv_priv
;
613 if (!ath9k_htc_check_beacon_config(priv
, vif
))
616 cur_conf
->beacon_interval
= bss_conf
->beacon_int
;
617 if (cur_conf
->beacon_interval
== 0)
618 cur_conf
->beacon_interval
= 100;
620 cur_conf
->dtim_period
= bss_conf
->dtim_period
;
621 cur_conf
->bmiss_timeout
=
622 ATH_DEFAULT_BMISS_LIMIT
* cur_conf
->beacon_interval
;
625 case NL80211_IFTYPE_STATION
:
626 ath9k_htc_beacon_config_sta(priv
, cur_conf
);
627 avp
->beacon_configured
= true;
629 case NL80211_IFTYPE_ADHOC
:
630 ath9k_htc_beacon_config_adhoc(priv
, cur_conf
);
632 case NL80211_IFTYPE_MESH_POINT
:
633 case NL80211_IFTYPE_AP
:
634 ath9k_htc_beacon_config_ap(priv
, cur_conf
);
637 ath_dbg(common
, CONFIG
, "Unsupported beaconing mode\n");
642 void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv
*priv
)
644 struct ath_common
*common
= ath9k_hw_common(priv
->ah
);
645 struct htc_beacon_config
*cur_conf
= &priv
->cur_beacon_conf
;
647 switch (priv
->ah
->opmode
) {
648 case NL80211_IFTYPE_STATION
:
649 ath9k_htc_beacon_config_sta(priv
, cur_conf
);
651 case NL80211_IFTYPE_ADHOC
:
652 ath9k_htc_beacon_config_adhoc(priv
, cur_conf
);
654 case NL80211_IFTYPE_MESH_POINT
:
655 case NL80211_IFTYPE_AP
:
656 ath9k_htc_beacon_config_ap(priv
, cur_conf
);
659 ath_dbg(common
, CONFIG
, "Unsupported beaconing mode\n");