fix a kmap leak in virtio_console
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath9k / htc_drv_beacon.c
blob8b575773459677055fe6b427e8443f65796c4ae2
1 /*
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.
17 #include "htc.h"
19 #define FUDGE 2
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) {
33 qi.tqi_aifs = 1;
34 qi.tqi_cwmin = 0;
35 qi.tqi_cwmax = 0;
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;
50 else
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);
60 } else {
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 bmiss_timeout;
74 u32 nexttbtt = 0, intval, tsftu;
75 __be32 htc_imask = 0;
76 u64 tsf;
77 int num_beacons, offset, dtim_dec_count;
78 int ret __attribute__ ((unused));
79 u8 cmd_rsp;
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 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 */
92 dtimperiod = 1;
93 dtimcount = 1;
94 if (dtimcount >= dtimperiod) /* NB: sanity check */
95 dtimcount = 0;
97 sleepduration = intval;
98 if (sleepduration <= 0)
99 sleepduration = intval;
102 * Pull nexttbtt forward to reflect the current
103 * TSF and calculate dtim state for the result.
105 tsf = ath9k_hw_gettsf64(priv->ah);
106 tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE;
108 num_beacons = tsftu / intval + 1;
109 offset = tsftu % intval;
110 nexttbtt = tsftu - offset;
111 if (offset)
112 nexttbtt += intval;
114 /* DTIM Beacon every dtimperiod Beacon */
115 dtim_dec_count = num_beacons % dtimperiod;
116 dtimcount -= dtim_dec_count;
117 if (dtimcount < 0)
118 dtimcount += dtimperiod;
120 bs.bs_intval = TU_TO_USEC(intval);
121 bs.bs_nexttbtt = TU_TO_USEC(nexttbtt);
122 bs.bs_dtimperiod = dtimperiod * bs.bs_intval;
123 bs.bs_nextdtim = bs.bs_nexttbtt + dtimcount * bs.bs_intval;
126 * Calculate the number of consecutive beacons to miss* before taking
127 * a BMISS interrupt. The configuration is specified in TU so we only
128 * need calculate based on the beacon interval. Note that we clamp the
129 * result to at most 15 beacons.
131 if (sleepduration > intval) {
132 bs.bs_bmissthreshold = ATH_DEFAULT_BMISS_LIMIT / 2;
133 } else {
134 bs.bs_bmissthreshold = DIV_ROUND_UP(bmiss_timeout, intval);
135 if (bs.bs_bmissthreshold > 15)
136 bs.bs_bmissthreshold = 15;
137 else if (bs.bs_bmissthreshold <= 0)
138 bs.bs_bmissthreshold = 1;
142 * Calculate sleep duration. The configuration is given in ms.
143 * We ensure a multiple of the beacon period is used. Also, if the sleep
144 * duration is greater than the DTIM period then it makes senses
145 * to make it a multiple of that.
147 * XXX fixed at 100ms
150 bs.bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100),
151 sleepduration));
152 if (bs.bs_sleepduration > bs.bs_dtimperiod)
153 bs.bs_sleepduration = bs.bs_dtimperiod;
155 /* TSF out of range threshold fixed at 1 second */
156 bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
158 ath_dbg(common, CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
159 intval, tsf, tsftu);
160 ath_dbg(common, CONFIG, "bmiss: %u sleep: %u\n",
161 bs.bs_bmissthreshold, bs.bs_sleepduration);
163 /* Set the computed STA beacon timers */
165 WMI_CMD(WMI_DISABLE_INTR_CMDID);
166 ath9k_hw_set_sta_beacon_timers(priv->ah, &bs);
167 imask |= ATH9K_INT_BMISS;
168 htc_imask = cpu_to_be32(imask);
169 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
172 static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
173 struct htc_beacon_config *bss_conf)
175 struct ath_common *common = ath9k_hw_common(priv->ah);
176 enum ath9k_int imask = 0;
177 u32 nexttbtt, intval, tsftu;
178 __be32 htc_imask = 0;
179 int ret __attribute__ ((unused));
180 u8 cmd_rsp;
181 u64 tsf;
183 intval = bss_conf->beacon_interval;
184 intval /= ATH9K_HTC_MAX_BCN_VIF;
185 nexttbtt = intval;
188 * To reduce beacon misses under heavy TX load,
189 * set the beacon response time to a larger value.
191 if (intval > DEFAULT_SWBA_RESPONSE)
192 priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE;
193 else
194 priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
196 if (test_bit(OP_TSF_RESET, &priv->op_flags)) {
197 ath9k_hw_reset_tsf(priv->ah);
198 clear_bit(OP_TSF_RESET, &priv->op_flags);
199 } else {
201 * Pull nexttbtt forward to reflect the current TSF.
203 tsf = ath9k_hw_gettsf64(priv->ah);
204 tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
205 do {
206 nexttbtt += intval;
207 } while (nexttbtt < tsftu);
210 if (test_bit(OP_ENABLE_BEACON, &priv->op_flags))
211 imask |= ATH9K_INT_SWBA;
213 ath_dbg(common, CONFIG,
214 "AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d imask: 0x%x\n",
215 bss_conf->beacon_interval, nexttbtt,
216 priv->ah->config.sw_beacon_response_time, imask);
218 ath9k_htc_beaconq_config(priv);
220 WMI_CMD(WMI_DISABLE_INTR_CMDID);
221 ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval));
222 priv->cur_beacon_conf.bmiss_cnt = 0;
223 htc_imask = cpu_to_be32(imask);
224 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
227 static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
228 struct htc_beacon_config *bss_conf)
230 struct ath_common *common = ath9k_hw_common(priv->ah);
231 enum ath9k_int imask = 0;
232 u32 nexttbtt, intval, tsftu;
233 __be32 htc_imask = 0;
234 int ret __attribute__ ((unused));
235 u8 cmd_rsp;
236 u64 tsf;
238 intval = bss_conf->beacon_interval;
239 nexttbtt = intval;
242 * Pull nexttbtt forward to reflect the current TSF.
244 tsf = ath9k_hw_gettsf64(priv->ah);
245 tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
246 do {
247 nexttbtt += intval;
248 } while (nexttbtt < tsftu);
251 * Only one IBSS interfce is allowed.
253 if (intval > DEFAULT_SWBA_RESPONSE)
254 priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE;
255 else
256 priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
258 if (test_bit(OP_ENABLE_BEACON, &priv->op_flags))
259 imask |= ATH9K_INT_SWBA;
261 ath_dbg(common, CONFIG,
262 "IBSS Beacon config, intval: %d, nexttbtt: %u, resp_time: %d, imask: 0x%x\n",
263 bss_conf->beacon_interval, nexttbtt,
264 priv->ah->config.sw_beacon_response_time, imask);
266 WMI_CMD(WMI_DISABLE_INTR_CMDID);
267 ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval));
268 priv->cur_beacon_conf.bmiss_cnt = 0;
269 htc_imask = cpu_to_be32(imask);
270 WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
273 void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
274 enum htc_endpoint_id ep_id, bool txok)
276 dev_kfree_skb_any(skb);
279 static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv,
280 int slot)
282 struct ath_common *common = ath9k_hw_common(priv->ah);
283 struct ieee80211_vif *vif;
284 struct sk_buff *skb;
285 struct ieee80211_hdr *hdr;
286 int padpos, padsize, ret, tx_slot;
288 spin_lock_bh(&priv->beacon_lock);
290 vif = priv->cur_beacon_conf.bslot[slot];
292 skb = ieee80211_get_buffered_bc(priv->hw, vif);
294 while(skb) {
295 hdr = (struct ieee80211_hdr *) skb->data;
297 padpos = ieee80211_hdrlen(hdr->frame_control);
298 padsize = padpos & 3;
299 if (padsize && skb->len > padpos) {
300 if (skb_headroom(skb) < padsize) {
301 dev_kfree_skb_any(skb);
302 goto next;
304 skb_push(skb, padsize);
305 memmove(skb->data, skb->data + padsize, padpos);
308 tx_slot = ath9k_htc_tx_get_slot(priv);
309 if (tx_slot < 0) {
310 ath_dbg(common, XMIT, "No free CAB slot\n");
311 dev_kfree_skb_any(skb);
312 goto next;
315 ret = ath9k_htc_tx_start(priv, NULL, skb, tx_slot, true);
316 if (ret != 0) {
317 ath9k_htc_tx_clear_slot(priv, tx_slot);
318 dev_kfree_skb_any(skb);
320 ath_dbg(common, XMIT, "Failed to send CAB frame\n");
321 } else {
322 spin_lock_bh(&priv->tx.tx_lock);
323 priv->tx.queued_cnt++;
324 spin_unlock_bh(&priv->tx.tx_lock);
326 next:
327 skb = ieee80211_get_buffered_bc(priv->hw, vif);
330 spin_unlock_bh(&priv->beacon_lock);
333 static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
334 int slot)
336 struct ath_common *common = ath9k_hw_common(priv->ah);
337 struct ieee80211_vif *vif;
338 struct ath9k_htc_vif *avp;
339 struct tx_beacon_header beacon_hdr;
340 struct ath9k_htc_tx_ctl *tx_ctl;
341 struct ieee80211_tx_info *info;
342 struct ieee80211_mgmt *mgmt;
343 struct sk_buff *beacon;
344 u8 *tx_fhdr;
345 int ret;
347 memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header));
349 spin_lock_bh(&priv->beacon_lock);
351 vif = priv->cur_beacon_conf.bslot[slot];
352 avp = (struct ath9k_htc_vif *)vif->drv_priv;
354 if (unlikely(test_bit(OP_SCANNING, &priv->op_flags))) {
355 spin_unlock_bh(&priv->beacon_lock);
356 return;
359 /* Get a new beacon */
360 beacon = ieee80211_beacon_get(priv->hw, vif);
361 if (!beacon) {
362 spin_unlock_bh(&priv->beacon_lock);
363 return;
367 * Update the TSF adjust value here, the HW will
368 * add this value for every beacon.
370 mgmt = (struct ieee80211_mgmt *)beacon->data;
371 mgmt->u.beacon.timestamp = avp->tsfadjust;
373 info = IEEE80211_SKB_CB(beacon);
374 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
375 struct ieee80211_hdr *hdr =
376 (struct ieee80211_hdr *) beacon->data;
377 avp->seq_no += 0x10;
378 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
379 hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
382 tx_ctl = HTC_SKB_CB(beacon);
383 memset(tx_ctl, 0, sizeof(*tx_ctl));
385 tx_ctl->type = ATH9K_HTC_BEACON;
386 tx_ctl->epid = priv->beacon_ep;
388 beacon_hdr.vif_index = avp->index;
389 tx_fhdr = skb_push(beacon, sizeof(beacon_hdr));
390 memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr));
392 ret = htc_send(priv->htc, beacon);
393 if (ret != 0) {
394 if (ret == -ENOMEM) {
395 ath_dbg(common, BSTUCK,
396 "Failed to send beacon, no free TX buffer\n");
398 dev_kfree_skb_any(beacon);
401 spin_unlock_bh(&priv->beacon_lock);
404 static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv,
405 struct wmi_event_swba *swba)
407 struct ath_common *common = ath9k_hw_common(priv->ah);
408 u64 tsf;
409 u32 tsftu;
410 u16 intval;
411 int slot;
413 intval = priv->cur_beacon_conf.beacon_interval;
415 tsf = be64_to_cpu(swba->tsf);
416 tsftu = TSF_TO_TU(tsf >> 32, tsf);
417 slot = ((tsftu % intval) * ATH9K_HTC_MAX_BCN_VIF) / intval;
418 slot = ATH9K_HTC_MAX_BCN_VIF - slot - 1;
420 ath_dbg(common, BEACON,
421 "Choose slot: %d, tsf: %llu, tsftu: %u, intval: %u\n",
422 slot, tsf, tsftu, intval);
424 return slot;
427 void ath9k_htc_swba(struct ath9k_htc_priv *priv,
428 struct wmi_event_swba *swba)
430 struct ath_common *common = ath9k_hw_common(priv->ah);
431 int slot;
433 if (swba->beacon_pending != 0) {
434 priv->cur_beacon_conf.bmiss_cnt++;
435 if (priv->cur_beacon_conf.bmiss_cnt > BSTUCK_THRESHOLD) {
436 ath_dbg(common, BSTUCK, "Beacon stuck, HW reset\n");
437 ieee80211_queue_work(priv->hw,
438 &priv->fatal_work);
440 return;
443 if (priv->cur_beacon_conf.bmiss_cnt) {
444 ath_dbg(common, BSTUCK,
445 "Resuming beacon xmit after %u misses\n",
446 priv->cur_beacon_conf.bmiss_cnt);
447 priv->cur_beacon_conf.bmiss_cnt = 0;
450 slot = ath9k_htc_choose_bslot(priv, swba);
451 spin_lock_bh(&priv->beacon_lock);
452 if (priv->cur_beacon_conf.bslot[slot] == NULL) {
453 spin_unlock_bh(&priv->beacon_lock);
454 return;
456 spin_unlock_bh(&priv->beacon_lock);
458 ath9k_htc_send_buffered(priv, slot);
459 ath9k_htc_send_beacon(priv, slot);
462 void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
463 struct ieee80211_vif *vif)
465 struct ath_common *common = ath9k_hw_common(priv->ah);
466 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;
467 int i = 0;
469 spin_lock_bh(&priv->beacon_lock);
470 for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) {
471 if (priv->cur_beacon_conf.bslot[i] == NULL) {
472 avp->bslot = i;
473 break;
477 priv->cur_beacon_conf.bslot[avp->bslot] = vif;
478 spin_unlock_bh(&priv->beacon_lock);
480 ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
481 avp->bslot);
484 void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
485 struct ieee80211_vif *vif)
487 struct ath_common *common = ath9k_hw_common(priv->ah);
488 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;
490 spin_lock_bh(&priv->beacon_lock);
491 priv->cur_beacon_conf.bslot[avp->bslot] = NULL;
492 spin_unlock_bh(&priv->beacon_lock);
494 ath_dbg(common, CONFIG, "Removed interface at beacon slot: %d\n",
495 avp->bslot);
499 * Calculate the TSF adjustment value for all slots
500 * other than zero.
502 void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
503 struct ieee80211_vif *vif)
505 struct ath_common *common = ath9k_hw_common(priv->ah);
506 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;
507 struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
508 u64 tsfadjust;
510 if (avp->bslot == 0)
511 return;
514 * The beacon interval cannot be different for multi-AP mode,
515 * and we reach here only for VIF slots greater than zero,
516 * so beacon_interval is guaranteed to be set in cur_conf.
518 tsfadjust = cur_conf->beacon_interval * avp->bslot / ATH9K_HTC_MAX_BCN_VIF;
519 avp->tsfadjust = cpu_to_le64(TU_TO_USEC(tsfadjust));
521 ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
522 (unsigned long long)tsfadjust, avp->bslot);
525 static void ath9k_htc_beacon_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
527 bool *beacon_configured = (bool *)data;
528 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;
530 if (vif->type == NL80211_IFTYPE_STATION &&
531 avp->beacon_configured)
532 *beacon_configured = true;
535 static bool ath9k_htc_check_beacon_config(struct ath9k_htc_priv *priv,
536 struct ieee80211_vif *vif)
538 struct ath_common *common = ath9k_hw_common(priv->ah);
539 struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
540 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
541 bool beacon_configured;
544 * Changing the beacon interval when multiple AP interfaces
545 * are configured will affect beacon transmission of all
546 * of them.
548 if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
549 (priv->num_ap_vif > 1) &&
550 (vif->type == NL80211_IFTYPE_AP) &&
551 (cur_conf->beacon_interval != bss_conf->beacon_int)) {
552 ath_dbg(common, CONFIG,
553 "Changing beacon interval of multiple AP interfaces !\n");
554 return false;
558 * If the HW is operating in AP mode, any new station interfaces that
559 * are added cannot change the beacon parameters.
561 if (priv->num_ap_vif &&
562 (vif->type != NL80211_IFTYPE_AP)) {
563 ath_dbg(common, CONFIG,
564 "HW in AP mode, cannot set STA beacon parameters\n");
565 return false;
569 * The beacon parameters are configured only for the first
570 * station interface.
572 if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
573 (priv->num_sta_vif > 1) &&
574 (vif->type == NL80211_IFTYPE_STATION)) {
575 beacon_configured = false;
576 ieee80211_iterate_active_interfaces_atomic(
577 priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
578 ath9k_htc_beacon_iter, &beacon_configured);
580 if (beacon_configured) {
581 ath_dbg(common, CONFIG,
582 "Beacon already configured for a station interface\n");
583 return false;
587 return true;
590 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
591 struct ieee80211_vif *vif)
593 struct ath_common *common = ath9k_hw_common(priv->ah);
594 struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
595 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
596 struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;
598 if (!ath9k_htc_check_beacon_config(priv, vif))
599 return;
601 cur_conf->beacon_interval = bss_conf->beacon_int;
602 if (cur_conf->beacon_interval == 0)
603 cur_conf->beacon_interval = 100;
605 cur_conf->dtim_period = bss_conf->dtim_period;
606 cur_conf->bmiss_timeout =
607 ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
609 switch (vif->type) {
610 case NL80211_IFTYPE_STATION:
611 ath9k_htc_beacon_config_sta(priv, cur_conf);
612 avp->beacon_configured = true;
613 break;
614 case NL80211_IFTYPE_ADHOC:
615 ath9k_htc_beacon_config_adhoc(priv, cur_conf);
616 break;
617 case NL80211_IFTYPE_MESH_POINT:
618 case NL80211_IFTYPE_AP:
619 ath9k_htc_beacon_config_ap(priv, cur_conf);
620 break;
621 default:
622 ath_dbg(common, CONFIG, "Unsupported beaconing mode\n");
623 return;
627 void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)
629 struct ath_common *common = ath9k_hw_common(priv->ah);
630 struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
632 switch (priv->ah->opmode) {
633 case NL80211_IFTYPE_STATION:
634 ath9k_htc_beacon_config_sta(priv, cur_conf);
635 break;
636 case NL80211_IFTYPE_ADHOC:
637 ath9k_htc_beacon_config_adhoc(priv, cur_conf);
638 break;
639 case NL80211_IFTYPE_MESH_POINT:
640 case NL80211_IFTYPE_AP:
641 ath9k_htc_beacon_config_ap(priv, cur_conf);
642 break;
643 default:
644 ath_dbg(common, CONFIG, "Unsupported beaconing mode\n");
645 return;