wl1271: remove unnecessary joins and join only when the bssid changes
authorLuciano Coelho <luciano.coelho@nokia.com>
Mon, 12 Oct 2009 12:08:57 +0000 (15:08 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 27 Oct 2009 20:48:06 +0000 (16:48 -0400)
We were using the join command to change some settings when the stack asked
us to do it.  In many cases they were not needed (and could cause potential
problems), so they were removed.  In other cases there are ACX commands that
can be used instead of using join to reconfigure.

Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl12xx/wl1271.h
drivers/net/wireless/wl12xx/wl1271_cmd.c
drivers/net/wireless/wl12xx/wl1271_main.c

index b2bc7b59d6451dd6189c7d599c277e56e8a650b6..aa9bb2ea8554a0a27ac258b96b5a991e3ba571b8 100644 (file)
@@ -378,10 +378,6 @@ struct wl1271 {
        /* Our association ID */
        u16 aid;
 
-       /* Beacon parameters */
-       u16 beacon_int;
-       u8 dtim_period;
-
        /* currently configured rate set */
        u32 basic_rate_set;
 
index f727744dcff73aadf47829c87bd7bf1a6da1fbc4..eaa1de97339c8075c34f5499c53f5fd6fbcc1697 100644 (file)
@@ -232,8 +232,8 @@ int wl1271_cmd_join(struct wl1271 *wl)
        join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
                RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
 
-       join->beacon_interval = wl->beacon_int;
-       join->dtim_interval = wl->dtim_period;
+       join->beacon_interval = WL1271_DEFAULT_BEACON_INT;
+       join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD;
        join->bss_type = wl->bss_type;
        join->channel = wl->channel;
        join->ssid_len = wl->ssid_len;
index fc0d03fd24cb8c73e59b9c0c65c254c50823c078..821a7752adfe74f432a31b7c330321f251953656 100644 (file)
@@ -710,7 +710,15 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
        if (ret < 0)
                goto out;
 
-       memcpy(wl->bssid, conf->bssid, ETH_ALEN);
+       if (memcmp(wl->bssid, conf->bssid, ETH_ALEN)) {
+               wl1271_debug(DEBUG_MAC80211, "bssid changed");
+
+               memcpy(wl->bssid, conf->bssid, ETH_ALEN);
+
+               ret = wl1271_cmd_join(wl);
+               if (ret < 0)
+                       goto out_sleep;
+       }
 
        ret = wl1271_cmd_build_null_data(wl);
        if (ret < 0)
@@ -720,12 +728,6 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
        if (wl->ssid_len)
                memcpy(wl->ssid, conf->ssid, wl->ssid_len);
 
-       if (wl->bss_type != BSS_TYPE_IBSS) {
-               ret = wl1271_cmd_join(wl);
-               if (ret < 0)
-                       goto out_sleep;
-       }
-
        if (conf->changed & IEEE80211_IFCC_BEACON) {
                beacon = ieee80211_beacon_get(hw, vif);
                ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
@@ -741,11 +743,6 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
 
                dev_kfree_skb(beacon);
 
-               if (ret < 0)
-                       goto out_sleep;
-
-               ret = wl1271_cmd_join(wl);
-
                if (ret < 0)
                        goto out_sleep;
        }
@@ -782,14 +779,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
                goto out;
 
        if (channel != wl->channel) {
-               u8 old_channel = wl->channel;
+               /*
+                * We assume that the stack will configure the right channel
+                * before associating, so we don't need to send a join
+                * command here.  We will join the right channel when the
+                * BSSID changes
+                */
                wl->channel = channel;
-
-               ret = wl1271_cmd_join(wl);
-               if (ret < 0) {
-                       wl->channel = old_channel;
-                       goto out_sleep;
-               }
        }
 
        ret = wl1271_cmd_build_null_data(wl);
@@ -1102,17 +1098,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 
        if (changed & BSS_CHANGED_ASSOC) {
                if (bss_conf->assoc) {
-                       wl->beacon_int = bss_conf->beacon_int;
-                       wl->dtim_period = bss_conf->dtim_period;
                        wl->aid = bss_conf->aid;
 
-                       ret = wl1271_cmd_join(wl);
-                       if (ret < 0) {
-                               wl1271_warning("Association configuration "
-                                              "failed %d", ret);
-                               goto out_sleep;
-                       }
-
+                       /*
+                        * with wl1271, we don't need to update the
+                        * beacon_int and dtim_period, because the firmware
+                        * updates it by itself when the first beacon is
+                        * received after a join.
+                        */
                        ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
                        if (ret < 0)
                                goto out_sleep;
@@ -1130,8 +1123,6 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
                        }
                } else {
                        /* use defaults when not associated */
-                       wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
-                       wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
                        wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
                        wl->aid = 0;
                }
@@ -1170,18 +1161,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
        if (changed & BSS_CHANGED_BASIC_RATES) {
                wl->basic_rate_set = wl1271_enabled_rates_get(
                        wl, bss_conf->basic_rates);
-               ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
 
+               ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
                if (ret < 0) {
                        wl1271_warning("Set rate policies failed %d", ret);
                        goto out_sleep;
                }
-               ret = wl1271_cmd_join(wl);
-               if (ret < 0) {
-                       wl1271_warning("Join with new basic rate "
-                                      "set failed %d", ret);
-                       goto out_sleep;
-               }
        }
 
 out_sleep:
@@ -1380,8 +1365,6 @@ static int __devinit wl1271_probe(struct spi_device *spi)
        wl->psm_requested = false;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
-       wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
-       wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
        wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
        wl->band = IEEE80211_BAND_2GHZ;
        wl->vif = NULL;
This page took 0.035144 seconds and 5 git commands to generate.