htc_drv_beacon.c 14.7 KB
Newer Older
S
Sujith 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Copyright (c) 2010 Atheros Communications Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "htc.h"

#define FUDGE 2

static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
22
					struct htc_beacon_config *bss_conf)
S
Sujith 已提交
23 24 25 26 27 28
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct ath9k_beacon_state bs;
	enum ath9k_int imask = 0;
	int dtimperiod, dtimcount, sleepduration;
	int cfpperiod, cfpcount, bmiss_timeout;
S
Sujith 已提交
29 30
	u32 nexttbtt = 0, intval, tsftu;
	__be32 htc_imask = 0;
S
Sujith 已提交
31 32 33 34 35 36 37
	u64 tsf;
	int num_beacons, offset, dtim_dec_count, cfp_dec_count;
	int ret;
	u8 cmd_rsp;

	memset(&bs, 0, sizeof(bs));

38 39
	intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
	bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval);
S
Sujith 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

	/*
	 * Setup dtim and cfp parameters according to
	 * last beacon we received (which may be none).
	 */
	dtimperiod = bss_conf->dtim_period;
	if (dtimperiod <= 0)		/* NB: 0 if not known */
		dtimperiod = 1;
	dtimcount = 1;
	if (dtimcount >= dtimperiod)	/* NB: sanity check */
		dtimcount = 0;
	cfpperiod = 1;			/* NB: no PCF support yet */
	cfpcount = 0;

	sleepduration = intval;
	if (sleepduration <= 0)
		sleepduration = intval;

	/*
	 * Pull nexttbtt forward to reflect the current
	 * TSF and calculate dtim+cfp state for the result.
	 */
	tsf = ath9k_hw_gettsf64(priv->ah);
	tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE;

	num_beacons = tsftu / intval + 1;
	offset = tsftu % intval;
	nexttbtt = tsftu - offset;
	if (offset)
		nexttbtt += intval;

	/* 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;
	bs.bs_dtimperiod = dtimperiod*intval;
	bs.bs_nextdtim = bs.bs_nexttbtt + dtimcount*intval;
	bs.bs_cfpperiod = cfpperiod*bs.bs_dtimperiod;
	bs.bs_cfpnext = bs.bs_nextdtim + cfpcount*bs.bs_dtimperiod;
	bs.bs_cfpmaxduration = 0;

	/*
	 * Calculate the number of consecutive beacons to miss* before taking
	 * a BMISS interrupt. The configuration is specified in TU so we only
	 * need calculate based	on the beacon interval.  Note that we clamp the
	 * result to at most 15 beacons.
	 */
	if (sleepduration > intval) {
		bs.bs_bmissthreshold = ATH_DEFAULT_BMISS_LIMIT / 2;
	} else {
		bs.bs_bmissthreshold = DIV_ROUND_UP(bmiss_timeout, intval);
		if (bs.bs_bmissthreshold > 15)
			bs.bs_bmissthreshold = 15;
		else if (bs.bs_bmissthreshold <= 0)
			bs.bs_bmissthreshold = 1;
	}

	/*
	 * Calculate sleep duration. The configuration is given in ms.
	 * We ensure a multiple of the beacon period is used. Also, if the sleep
	 * duration is greater than the DTIM period then it makes senses
	 * to make it a multiple of that.
	 *
	 * XXX fixed at 100ms
	 */

	bs.bs_sleepduration = roundup(IEEE80211_MS_TO_TU(100), sleepduration);
	if (bs.bs_sleepduration > bs.bs_dtimperiod)
		bs.bs_sleepduration = bs.bs_dtimperiod;

	/* TSF out of range threshold fixed at 1 second */
	bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;

126 127 128
	ath_dbg(common, ATH_DBG_CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
		intval, tsf, tsftu);
	ath_dbg(common, ATH_DBG_CONFIG,
J
Joe Perches 已提交
129 130 131
		"bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n",
		bs.bs_bmissthreshold, bs.bs_sleepduration,
		bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext);
S
Sujith 已提交
132 133 134 135 136 137 138 139 140 141

	/* Set the computed STA beacon timers */

	WMI_CMD(WMI_DISABLE_INTR_CMDID);
	ath9k_hw_set_sta_beacon_timers(priv->ah, &bs);
	imask |= ATH9K_INT_BMISS;
	htc_imask = cpu_to_be32(imask);
	WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
}

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
				       struct htc_beacon_config *bss_conf)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	enum ath9k_int imask = 0;
	u32 nexttbtt, intval, tsftu;
	__be32 htc_imask = 0;
	int ret;
	u8 cmd_rsp;
	u64 tsf;

	intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
	intval /= ATH9K_HTC_MAX_BCN_VIF;
	nexttbtt = intval;

	if (priv->op_flags & OP_TSF_RESET) {
158
		ath9k_hw_reset_tsf(priv->ah);
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
		priv->op_flags &= ~OP_TSF_RESET;
	} else {
		/*
		 * Pull nexttbtt forward to reflect the current TSF.
		 */
		tsf = ath9k_hw_gettsf64(priv->ah);
		tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
		do {
			nexttbtt += intval;
		} while (nexttbtt < tsftu);
	}

	if (priv->op_flags & OP_ENABLE_BEACON)
		imask |= ATH9K_INT_SWBA;

	ath_dbg(common, ATH_DBG_CONFIG,
S
Sujith Manoharan 已提交
175 176
		"AP Beacon config, intval: %d, nexttbtt: %u "
		"imask: 0x%x\n",
177 178 179
		bss_conf->beacon_interval, nexttbtt, imask);

	WMI_CMD(WMI_DISABLE_INTR_CMDID);
180
	ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval));
S
Sujith Manoharan 已提交
181
	priv->cur_beacon_conf.bmiss_cnt = 0;
182 183 184 185
	htc_imask = cpu_to_be32(imask);
	WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
}

S
Sujith 已提交
186
static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
187
					  struct htc_beacon_config *bss_conf)
S
Sujith 已提交
188 189 190
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	enum ath9k_int imask = 0;
191
	u32 nexttbtt, intval, tsftu;
S
Sujith 已提交
192
	__be32 htc_imask = 0;
S
Sujith 已提交
193 194
	int ret;
	u8 cmd_rsp;
195
	u64 tsf;
S
Sujith 已提交
196

197
	intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
S
Sujith 已提交
198
	nexttbtt = intval;
199 200 201 202 203 204 205 206 207 208

	/*
	 * Pull nexttbtt forward to reflect the current TSF.
	 */
	tsf = ath9k_hw_gettsf64(priv->ah);
	tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
	do {
		nexttbtt += intval;
	} while (nexttbtt < tsftu);

S
Sujith 已提交
209 210 211
	if (priv->op_flags & OP_ENABLE_BEACON)
		imask |= ATH9K_INT_SWBA;

212 213 214
	ath_dbg(common, ATH_DBG_CONFIG,
		"IBSS Beacon config, intval: %d, nexttbtt: %u, imask: 0x%x\n",
		bss_conf->beacon_interval, nexttbtt, imask);
S
Sujith 已提交
215 216

	WMI_CMD(WMI_DISABLE_INTR_CMDID);
217
	ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval));
S
Sujith Manoharan 已提交
218
	priv->cur_beacon_conf.bmiss_cnt = 0;
S
Sujith 已提交
219 220 221 222
	htc_imask = cpu_to_be32(imask);
	WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
}

S
Sujith 已提交
223 224
void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
			enum htc_endpoint_id ep_id, bool txok)
S
Sujith 已提交
225
{
S
Sujith 已提交
226
	dev_kfree_skb_any(skb);
S
Sujith 已提交
227 228
}

S
Sujith Manoharan 已提交
229 230
static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
				  int slot)
S
Sujith 已提交
231
{
S
Sujith Manoharan 已提交
232 233
	struct ieee80211_vif *vif;
	struct ath9k_htc_vif *avp;
S
Sujith 已提交
234 235 236
	struct tx_beacon_header beacon_hdr;
	struct ath9k_htc_tx_ctl tx_ctl;
	struct ieee80211_tx_info *info;
S
Sujith 已提交
237
	struct sk_buff *beacon;
S
Sujith 已提交
238 239 240 241 242 243 244
	u8 *tx_fhdr;

	memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header));
	memset(&tx_ctl, 0, sizeof(struct ath9k_htc_tx_ctl));

	spin_lock_bh(&priv->beacon_lock);

S
Sujith Manoharan 已提交
245 246 247
	vif = priv->cur_beacon_conf.bslot[slot];
	avp = (struct ath9k_htc_vif *)vif->drv_priv;

S
Sujith 已提交
248 249 250 251 252 253
	if (unlikely(priv->op_flags & OP_SCANNING)) {
		spin_unlock_bh(&priv->beacon_lock);
		return;
	}

	/* Get a new beacon */
S
Sujith Manoharan 已提交
254
	beacon = ieee80211_beacon_get(priv->hw, vif);
S
Sujith 已提交
255
	if (!beacon) {
S
Sujith 已提交
256 257 258 259
		spin_unlock_bh(&priv->beacon_lock);
		return;
	}

S
Sujith 已提交
260
	info = IEEE80211_SKB_CB(beacon);
S
Sujith 已提交
261 262
	if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
		struct ieee80211_hdr *hdr =
S
Sujith 已提交
263
			(struct ieee80211_hdr *) beacon->data;
264
		avp->seq_no += 0x10;
S
Sujith 已提交
265
		hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
266
		hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
S
Sujith 已提交
267 268 269 270
	}

	tx_ctl.type = ATH9K_HTC_NORMAL;
	beacon_hdr.vif_index = avp->index;
S
Sujith 已提交
271
	tx_fhdr = skb_push(beacon, sizeof(beacon_hdr));
S
Sujith 已提交
272 273
	memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr));

S
Sujith 已提交
274
	htc_send(priv->htc, beacon, priv->beacon_ep, &tx_ctl);
S
Sujith 已提交
275 276 277 278

	spin_unlock_bh(&priv->beacon_lock);
}

S
Sujith Manoharan 已提交
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	unsigned long flags;
	u64 tsf;
	u32 tsftu;
	u16 intval;
	int slot;

	intval = priv->cur_beacon_conf.beacon_interval & ATH9K_BEACON_PERIOD;

	spin_lock_irqsave(&priv->wmi->wmi_lock, flags);
	tsf = priv->wmi->tsf;
	spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);

	tsftu = TSF_TO_TU(tsf >> 32, tsf);
	slot = ((tsftu % intval) * ATH9K_HTC_MAX_BCN_VIF) / intval;
	slot = ATH9K_HTC_MAX_BCN_VIF - slot - 1;

	ath_dbg(common, ATH_DBG_BEACON,
		"Choose slot: %d, tsf: %llu, tsftu: %u, intval: %u\n",
		slot, tsf, tsftu, intval);

	return slot;
}

void ath9k_htc_swba(struct ath9k_htc_priv *priv)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	unsigned long flags;
	int slot;

	spin_lock_irqsave(&priv->wmi->wmi_lock, flags);
	if (priv->wmi->beacon_pending != 0) {
		spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);
		priv->cur_beacon_conf.bmiss_cnt++;
		if (priv->cur_beacon_conf.bmiss_cnt > BSTUCK_THRESHOLD) {
			ath_dbg(common, ATH_DBG_BEACON,
				"Beacon stuck, HW reset\n");
			ath9k_htc_reset(priv);
		}
		return;
	}
	spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);

	if (priv->cur_beacon_conf.bmiss_cnt) {
		ath_dbg(common, ATH_DBG_BEACON,
			"Resuming beacon xmit after %u misses\n",
			priv->cur_beacon_conf.bmiss_cnt);
		priv->cur_beacon_conf.bmiss_cnt = 0;
	}

	slot = ath9k_htc_choose_bslot(priv);
	spin_lock_bh(&priv->beacon_lock);
	if (priv->cur_beacon_conf.bslot[slot] == NULL) {
		spin_unlock_bh(&priv->beacon_lock);
		return;
	}
	spin_unlock_bh(&priv->beacon_lock);

	ath9k_htc_send_beacon(priv, slot);
}

S
Sujith 已提交
342 343 344 345 346
/* Currently, only for IBSS */
void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
{
	struct ath_hw *ah = priv->ah;
	struct ath9k_tx_queue_info qi, qi_be;
347
	int qnum = priv->hwq_map[WME_AC_BE];
S
Sujith 已提交
348 349 350 351 352 353 354

	memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
	memset(&qi_be, 0, sizeof(struct ath9k_tx_queue_info));

	ath9k_hw_get_txq_props(ah, qnum, &qi_be);

	qi.tqi_aifs = qi_be.tqi_aifs;
355 356 357 358 359 360 361 362
	/* For WIFI Beacon Distribution
	 * Long slot time  : 2x cwmin
	 * Short slot time : 4x cwmin
	 */
	if (ah->slottime == ATH9K_SLOT_TIME_20)
		qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
	else
		qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
S
Sujith 已提交
363 364 365
	qi.tqi_cwmax = qi_be.tqi_cwmax;

	if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) {
366 367
		ath_err(ath9k_hw_common(ah),
			"Unable to update beacon queue %u!\n", qnum);
S
Sujith 已提交
368 369 370 371
	} else {
		ath9k_hw_resettxqueue(ah, priv->beaconq);
	}
}
372

S
Sujith Manoharan 已提交
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
			    struct ieee80211_vif *vif)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;
	int i = 0;

	spin_lock_bh(&priv->beacon_lock);
	for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) {
		if (priv->cur_beacon_conf.bslot[i] == NULL) {
			avp->bslot = i;
			break;
		}
	}

	priv->cur_beacon_conf.bslot[avp->bslot] = vif;
	spin_unlock_bh(&priv->beacon_lock);

	ath_dbg(common, ATH_DBG_CONFIG,
		"Added interface at beacon slot: %d\n", avp->bslot);
}

void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
			    struct ieee80211_vif *vif)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;

	spin_lock_bh(&priv->beacon_lock);
	priv->cur_beacon_conf.bslot[avp->bslot] = NULL;
	spin_unlock_bh(&priv->beacon_lock);

	ath_dbg(common, ATH_DBG_CONFIG,
		"Removed interface at beacon slot: %d\n", avp->bslot);
}

409 410 411 412 413 414 415 416 417 418 419 420
static void ath9k_htc_beacon_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
{
	bool *beacon_configured = (bool *)data;
	struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;

	if (vif->type == NL80211_IFTYPE_STATION &&
	    avp->beacon_configured)
		*beacon_configured = true;
}

static bool ath9k_htc_check_beacon_config(struct ath9k_htc_priv *priv,
					  struct ieee80211_vif *vif)
S
Sujith 已提交
421 422
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
423
	struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
S
Sujith 已提交
424
	struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
425
	bool beacon_configured;
426

427 428 429 430 431 432 433 434 435 436 437
	/*
	 * Changing the beacon interval when multiple AP interfaces
	 * are configured will affect beacon transmission of all
	 * of them.
	 */
	if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
	    (priv->num_ap_vif > 1) &&
	    (vif->type == NL80211_IFTYPE_AP) &&
	    (cur_conf->beacon_interval != bss_conf->beacon_int)) {
		ath_dbg(common, ATH_DBG_CONFIG,
			"Changing beacon interval of multiple AP interfaces !\n");
438
		return false;
439 440 441 442 443 444 445 446 447 448
	}

	/*
	 * If the HW is operating in AP mode, any new station interfaces that
	 * are added cannot change the beacon parameters.
	 */
	if (priv->num_ap_vif &&
	    (vif->type != NL80211_IFTYPE_AP)) {
		ath_dbg(common, ATH_DBG_CONFIG,
			"HW in AP mode, cannot set STA beacon parameters\n");
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
		return false;
	}

	/*
	 * The beacon parameters are configured only for the first
	 * station interface.
	 */
	if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
	    (priv->num_sta_vif > 1) &&
	    (vif->type == NL80211_IFTYPE_STATION)) {
		beacon_configured = false;
		ieee80211_iterate_active_interfaces_atomic(priv->hw,
							   ath9k_htc_beacon_iter,
							   &beacon_configured);

		if (beacon_configured) {
			ath_dbg(common, ATH_DBG_CONFIG,
				"Beacon already configured for a station interface\n");
			return false;
		}
469 470
	}

471 472 473 474 475 476 477 478 479 480 481 482 483 484
	return true;
}

void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
			     struct ieee80211_vif *vif)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
	struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
	struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;

	if (!ath9k_htc_check_beacon_config(priv, vif))
		return;

S
Sujith 已提交
485
	cur_conf->beacon_interval = bss_conf->beacon_int;
486 487 488
	if (cur_conf->beacon_interval == 0)
		cur_conf->beacon_interval = 100;

S
Sujith 已提交
489 490 491 492 493
	cur_conf->dtim_period = bss_conf->dtim_period;
	cur_conf->bmiss_timeout =
		ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;

	switch (vif->type) {
S
Sujith 已提交
494
	case NL80211_IFTYPE_STATION:
495
		ath9k_htc_beacon_config_sta(priv, cur_conf);
496
		avp->beacon_configured = true;
S
Sujith 已提交
497 498
		break;
	case NL80211_IFTYPE_ADHOC:
499
		ath9k_htc_beacon_config_adhoc(priv, cur_conf);
S
Sujith 已提交
500
		break;
501 502 503
	case NL80211_IFTYPE_AP:
		ath9k_htc_beacon_config_ap(priv, cur_conf);
		break;
S
Sujith 已提交
504
	default:
J
Joe Perches 已提交
505 506
		ath_dbg(common, ATH_DBG_CONFIG,
			"Unsupported beaconing mode\n");
S
Sujith 已提交
507 508 509
		return;
	}
}
510 511 512 513 514 515 516 517 518 519 520 521 522

void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;

	switch (priv->ah->opmode) {
	case NL80211_IFTYPE_STATION:
		ath9k_htc_beacon_config_sta(priv, cur_conf);
		break;
	case NL80211_IFTYPE_ADHOC:
		ath9k_htc_beacon_config_adhoc(priv, cur_conf);
		break;
523 524 525
	case NL80211_IFTYPE_AP:
		ath9k_htc_beacon_config_ap(priv, cur_conf);
		break;
526 527 528 529 530 531
	default:
		ath_dbg(common, ATH_DBG_CONFIG,
			"Unsupported beaconing mode\n");
		return;
	}
}