Commit 4a4495a5 authored by Oleksij Rempel's avatar Oleksij Rempel Committed by John W. Linville
Browse files

ath9k_htc: use ath9k_htc_beacon_init in ath9k_htc_beacon_config_ap

parent 7f5c4c83
Loading
Loading
Loading
Loading
+11 −20
Original line number Original line Diff line number Diff line
@@ -107,22 +107,19 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
				       struct ath_beacon_config *bss_conf)
				       struct ath_beacon_config *bss_conf)
{
{
	struct ath_common *common = ath9k_hw_common(priv->ah);
	struct ath_common *common = ath9k_hw_common(priv->ah);
	enum ath9k_int imask = 0;
	u32 tsftu;
	u32 nexttbtt, intval, tsftu;
	__be32 htc_imask = 0;
	int ret __attribute__ ((unused));
	int ret __attribute__ ((unused));
	u8 cmd_rsp;
	u64 tsf;
	u64 tsf;


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


	/*
	/*
	 * To reduce beacon misses under heavy TX load,
	 * To reduce beacon misses under heavy TX load,
	 * set the beacon response time to a larger value.
	 * set the beacon response time to a larger value.
	 */
	 */
	if (intval > DEFAULT_SWBA_RESPONSE)
	if (bss_conf->intval > DEFAULT_SWBA_RESPONSE)
		priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE;
		priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE;
	else
	else
		priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
		priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
@@ -137,25 +134,19 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
		tsf = ath9k_hw_gettsf64(priv->ah);
		tsf = ath9k_hw_gettsf64(priv->ah);
		tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
		tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
		do {
		do {
			nexttbtt += intval;
			bss_conf->nexttbtt += bss_conf->intval;
		} while (nexttbtt < tsftu);
		} while (bss_conf->nexttbtt < tsftu);
	}
	}


	if (bss_conf->enable_beacon)
	if (bss_conf->enable_beacon)
		imask |= ATH9K_INT_SWBA;
		priv->ah->imask = ATH9K_INT_SWBA;


	ath_dbg(common, CONFIG,
	ath_dbg(common, CONFIG,
		"AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d imask: 0x%x\n",
		"AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d imask: 0x%x\n",
		bss_conf->beacon_interval, nexttbtt,
		bss_conf->beacon_interval, bss_conf->nexttbtt,
		priv->ah->config.sw_beacon_response_time, imask);
		priv->ah->config.sw_beacon_response_time, priv->ah->imask);

	ath9k_htc_beaconq_config(priv);


	WMI_CMD(WMI_DISABLE_INTR_CMDID);
	ath9k_htc_beacon_init(priv, bss_conf, false);
	ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval));
	priv->beacon.bmisscnt = 0;
	htc_imask = cpu_to_be32(imask);
	WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
}
}


static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,