]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ath9k_htc: Configure the beacon timers once the scan is completed.
authorVivek Natarajan <vnatarajan@atheros.com>
Mon, 5 Apr 2010 09:18:06 +0000 (14:48 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 Apr 2010 18:37:59 +0000 (14:37 -0400)
Signed-off-by: Vivek Natarajan <vnatarajan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/htc.h
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
drivers/net/wireless/ath/ath9k/htc_drv_main.c

index 0160e83f8fb65777422e72cceca20631c45453f0..78213fc71b09bf55d4320f04bf43d480b560053f 100644 (file)
@@ -309,6 +309,14 @@ struct ath_led {
        int brightness;
 };
 
+struct htc_beacon_config {
+       u16 beacon_interval;
+       u16 listen_interval;
+       u16 dtim_period;
+       u16 bmiss_timeout;
+       u8 dtim_count;
+};
+
 #define OP_INVALID        BIT(0)
 #define OP_SCANNING       BIT(1)
 #define OP_FULL_RESET     BIT(2)
@@ -353,6 +361,7 @@ struct ath9k_htc_priv {
        spinlock_t tx_lock;
 
        struct ieee80211_vif *vif;
+       struct htc_beacon_config cur_beacon_conf;
        unsigned int rxfilter;
        struct tasklet_struct wmi_tasklet;
        struct tasklet_struct rx_tasklet;
@@ -394,8 +403,7 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
 }
 
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
-                            struct ieee80211_vif *vif,
-                            struct ieee80211_bss_conf *bss_conf);
+                            struct ieee80211_vif *vif);
 void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
 void ath9k_htc_beacon_update(struct ath9k_htc_priv *priv,
                             struct ieee80211_vif *vif);
index 25f5b5377bac24dcdb08394258af8b7687d73340..5e21f4d92ff5ca761ee4b075563231e471fc7f02 100644 (file)
@@ -19,7 +19,7 @@
 #define FUDGE 2
 
 static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
-                                       struct ieee80211_bss_conf *bss_conf)
+                                       struct htc_beacon_config *bss_conf)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
        struct ath9k_beacon_state bs;
@@ -34,8 +34,8 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
 
        memset(&bs, 0, sizeof(bs));
 
-       intval = bss_conf->beacon_int & ATH9K_BEACON_PERIOD;
-       bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_int);
+       intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
+       bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval);
 
        /*
         * Setup dtim and cfp parameters according to
@@ -138,7 +138,7 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
 }
 
 static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
-                                         struct ieee80211_bss_conf *bss_conf)
+                                         struct htc_beacon_config *bss_conf)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
        enum ath9k_int imask = 0;
@@ -146,7 +146,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
        int ret;
        u8 cmd_rsp;
 
-       intval = bss_conf->beacon_int & ATH9K_BEACON_PERIOD;
+       intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
        nexttbtt = intval;
        intval |= ATH9K_BEACON_ENA;
        if (priv->op_flags & OP_ENABLE_BEACON)
@@ -154,7 +154,7 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
 
        ath_print(common, ATH_DBG_BEACON,
                  "IBSS Beacon config, intval: %d, imask: 0x%x\n",
-                 bss_conf->beacon_int, imask);
+                 bss_conf->beacon_interval, imask);
 
        WMI_CMD(WMI_DISABLE_INTR_CMDID);
        ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
@@ -239,18 +239,35 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
        spin_unlock_bh(&priv->beacon_lock);
 }
 
+
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
-                            struct ieee80211_vif *vif,
-                            struct ieee80211_bss_conf *bss_conf)
+                            struct ieee80211_vif *vif)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
-
-       switch (vif->type) {
+       enum nl80211_iftype iftype;
+       struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
+
+       if (vif) {
+               struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
+               iftype = vif->type;
+               cur_conf->beacon_interval = bss_conf->beacon_int;
+               cur_conf->dtim_period = bss_conf->dtim_period;
+               cur_conf->listen_interval = 1;
+               cur_conf->dtim_count = 1;
+               cur_conf->bmiss_timeout =
+                       ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
+       } else
+               iftype = priv->ah->opmode;
+
+       if (cur_conf->beacon_interval == 0)
+               cur_conf->beacon_interval = 100;
+
+       switch (iftype) {
        case NL80211_IFTYPE_STATION:
-               ath9k_htc_beacon_config_sta(priv, bss_conf);
+               ath9k_htc_beacon_config_sta(priv, cur_conf);
                break;
        case NL80211_IFTYPE_ADHOC:
-               ath9k_htc_beacon_config_adhoc(priv, bss_conf);
+               ath9k_htc_beacon_config_adhoc(priv, cur_conf);
                break;
        default:
                ath_print(common, ATH_DBG_CONFIG,
index e04452f888e06670c4c353924e63520c67964097..eb7722b2cfcca62611f0e4636a38683cc456e0ca 100644 (file)
@@ -1549,7 +1549,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
            ((changed & BSS_CHANGED_BEACON_ENABLED) &&
            bss_conf->enable_beacon)) {
                priv->op_flags |= OP_ENABLE_BEACON;
-               ath9k_htc_beacon_config(priv, vif, bss_conf);
+               ath9k_htc_beacon_config(priv, vif);
        }
 
        if (changed & BSS_CHANGED_BEACON)
@@ -1558,7 +1558,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
        if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
            !bss_conf->enable_beacon) {
                priv->op_flags &= ~OP_ENABLE_BEACON;
-               ath9k_htc_beacon_config(priv, vif, bss_conf);
+               ath9k_htc_beacon_config(priv, vif);
        }
 
        if (changed & BSS_CHANGED_ERP_PREAMBLE) {
@@ -1686,6 +1686,8 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
        priv->op_flags &= ~OP_SCANNING;
        spin_unlock_bh(&priv->beacon_lock);
        priv->op_flags |= OP_FULL_RESET;
+       if (priv->op_flags & OP_ASSOCIATED)
+               ath9k_htc_beacon_config(priv, NULL);
        ath_start_ani(priv);
        mutex_unlock(&priv->mutex);
        ath9k_htc_ps_restore(priv);