linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <linux@rempel-privat.de>
To: linux-wireless@vger.kernel.org, sujith@msujith.org,
	linville@tuxdriver.com
Cc: Oleksij Rempel <linux@rempel-privat.de>
Subject: [PATCH 14/23] ath9k_htc: use ath9k_cmn_beacon_config_sta
Date: Sat,  1 Mar 2014 21:15:57 +0100	[thread overview]
Message-ID: <1393704966-13985-15-git-send-email-linux@rempel-privat.de> (raw)
In-Reply-To: <1393704966-13985-1-git-send-email-linux@rempel-privat.de>

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c | 84 +------------------------
 1 file changed, 2 insertions(+), 82 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 9ff9e6e..fc16c10 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -62,97 +62,17 @@ void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
 	}
 }
 
-
 static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
 					struct ath_beacon_config *bss_conf)
 {
-	struct ath_common *common = ath9k_hw_common(priv->ah);
 	struct ath9k_beacon_state bs;
 	enum ath9k_int imask = 0;
-	int dtimperiod, dtimcount;
-	int bmiss_timeout;
-	u32 nexttbtt = 0, intval, tsftu;
 	__be32 htc_imask = 0;
-	u64 tsf;
-	int num_beacons, offset, dtim_dec_count;
 	int ret __attribute__ ((unused));
 	u8 cmd_rsp;
 
-	memset(&bs, 0, sizeof(bs));
-
-	intval = bss_conf->beacon_interval;
-	bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval);
-
-	/*
-	 * Setup dtim 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;
-
-	/*
-	 * Pull nexttbtt forward to reflect the current
-	 * TSF and calculate dtim 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;
-	dtimcount -= dtim_dec_count;
-	if (dtimcount < 0)
-		dtimcount += dtimperiod;
-
-	bs.bs_intval = TU_TO_USEC(intval);
-	bs.bs_nexttbtt = TU_TO_USEC(nexttbtt);
-	bs.bs_dtimperiod = dtimperiod * bs.bs_intval;
-	bs.bs_nextdtim = bs.bs_nexttbtt + dtimcount * bs.bs_intval;
-
-	/*
-	 * 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.
-	 */
-	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 = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100),
-						 intval));
-	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;
-
-	ath_dbg(common, CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
-		intval, tsf, tsftu);
-	ath_dbg(common, CONFIG, "bmiss: %u sleep: %u\n",
-		bs.bs_bmissthreshold, bs.bs_sleepduration);
-
-	/* Set the computed STA beacon timers */
+	if (ath9k_cmn_beacon_config_sta(priv->ah, bss_conf, &bs) == -EPERM)
+		return;
 
 	WMI_CMD(WMI_DISABLE_INTR_CMDID);
 	ath9k_hw_set_sta_beacon_timers(priv->ah, &bs);
-- 
1.9.0


  parent reply	other threads:[~2014-03-01 20:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-01 20:15 [PATCH 00/23] ath9k|ath9k_htc: move dups to common-beacon Oleksij Rempel
2014-03-01 20:15 ` [PATCH 01/23] ath9k: move struct ath_beacon_config to common Oleksij Rempel
2014-03-01 20:15 ` [PATCH 02/23] ath9k_htc: use common ath_beacon_config Oleksij Rempel
2014-03-01 20:15 ` [PATCH 03/23] ath9k_htc: move beaconq to struct htc_beacon Oleksij Rempel
2014-03-01 20:15 ` [PATCH 04/23] ath9k_htc: use ath_beacon_conf.enable_beacon Oleksij Rempel
2014-03-01 20:15 ` [PATCH 05/23] ath9k: move sc_flags to ath_common Oleksij Rempel
2014-03-01 20:15 ` [PATCH 06/23] ath9k_htc: use common->op_flags Oleksij Rempel
2014-03-01 20:15 ` [PATCH 07/23] ath9k_htc: add ATH_OP_PRIM_STA_VIF Oleksij Rempel
2014-03-01 20:15 ` [PATCH 08/23] ath9k: remove unused bc_tstamp Oleksij Rempel
2014-03-01 20:15 ` [PATCH 09/23] ath9k_htc: sync beacon slot code with ath9k Oleksij Rempel
2014-03-01 20:15 ` [PATCH 10/23] ath9k: remove unused beacon_qi Oleksij Rempel
2014-03-01 20:15 ` [PATCH 11/23] ath9k|ath9k_htc: move IEEE80211_MS_TO_TU to common Oleksij Rempel
2014-03-01 20:15 ` [PATCH 12/23] ath9k-common: add nexttbtt and intval to ath_beacon_config Oleksij Rempel
2014-03-01 20:15 ` [PATCH 13/23] ath9k: move ath9k_beacon_config_sta to common-beacon Oleksij Rempel
2014-03-01 20:15 ` Oleksij Rempel [this message]
2014-03-01 20:15 ` [PATCH 15/23] ath9k: move ath9k_beacon_config_adhoc to common Oleksij Rempel
2014-03-01 20:15 ` [PATCH 16/23] ath9k_htc: add ath9k_htc_beacon_init (but not use it) Oleksij Rempel
2014-03-01 20:16 ` [PATCH 17/23] ath9k_htc: use ath9k_htc_beacon_init in ath9k_htc_beacon_config_ap Oleksij Rempel
2014-03-01 20:16 ` [PATCH 18/23] ath9k_htc: use ath9k_htc_beacon_init in ath9k_htc_beacon_config_adhoc Oleksij Rempel
2014-03-01 20:16 ` [PATCH 19/23] ath9k_htc: use ath9k_cmn_beacon_config_adhoc Oleksij Rempel
2014-03-01 20:16 ` [PATCH 20/23] ath9k: move ath9k_beacon_config_ap common Oleksij Rempel
2014-03-01 20:16 ` [PATCH 21/23] ath9k: remove unused ath9k_get_next_tbtt Oleksij Rempel
2014-03-01 20:16 ` [PATCH 22/23] ath9k_htc: use ath9k_cmn_beacon_config_ap Oleksij Rempel
2014-03-01 20:16 ` [PATCH 23/23] ath9k_htc: move DEFAULT_SWBA_RESPONSE check to ath9k_htc_beacon_init Oleksij Rempel
2014-03-02  2:14 ` [PATCH 00/23] ath9k|ath9k_htc: move dups to common-beacon Sujith Manoharan
2014-03-02  7:27   ` Oleksij Rempel
2014-03-02  7:50     ` Sujith Manoharan
2014-03-06 18:42       ` John W. Linville
2014-03-07  9:55         ` Oleksij Rempel
2014-03-07 10:18           ` Sujith Manoharan
2014-03-10 15:08             ` Oleksij Rempel
2014-03-14 19:22               ` John W. Linville
2014-03-15  7:51                 ` Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393704966-13985-15-git-send-email-linux@rempel-privat.de \
    --to=linux@rempel-privat.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=sujith@msujith.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).