aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@nokia.com>2009-10-12 08:08:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:06 -0400
commitae751bab9f55c3152ebf713c89a4fb6f439c2575 (patch)
treee555199eee90de975eea0b3172344c53d346dcf1 /drivers
parent0535d9f4f07df9a592b77fe75f66faee66a851e8 (diff)
wl1271: remove unnecessary joins and join only when the bssid changes
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c61
3 files changed, 24 insertions, 45 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index b2bc7b59d645..aa9bb2ea8554 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -378,10 +378,6 @@ struct wl1271 {
378 /* Our association ID */ 378 /* Our association ID */
379 u16 aid; 379 u16 aid;
380 380
381 /* Beacon parameters */
382 u16 beacon_int;
383 u8 dtim_period;
384
385 /* currently configured rate set */ 381 /* currently configured rate set */
386 u32 basic_rate_set; 382 u32 basic_rate_set;
387 383
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index f727744dcff7..eaa1de97339c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -232,8 +232,8 @@ int wl1271_cmd_join(struct wl1271 *wl)
232 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | 232 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
233 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; 233 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
234 234
235 join->beacon_interval = wl->beacon_int; 235 join->beacon_interval = WL1271_DEFAULT_BEACON_INT;
236 join->dtim_interval = wl->dtim_period; 236 join->dtim_interval = WL1271_DEFAULT_DTIM_PERIOD;
237 join->bss_type = wl->bss_type; 237 join->bss_type = wl->bss_type;
238 join->channel = wl->channel; 238 join->channel = wl->channel;
239 join->ssid_len = wl->ssid_len; 239 join->ssid_len = wl->ssid_len;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index fc0d03fd24cb..821a7752adfe 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -710,7 +710,15 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
710 if (ret < 0) 710 if (ret < 0)
711 goto out; 711 goto out;
712 712
713 memcpy(wl->bssid, conf->bssid, ETH_ALEN); 713 if (memcmp(wl->bssid, conf->bssid, ETH_ALEN)) {
714 wl1271_debug(DEBUG_MAC80211, "bssid changed");
715
716 memcpy(wl->bssid, conf->bssid, ETH_ALEN);
717
718 ret = wl1271_cmd_join(wl);
719 if (ret < 0)
720 goto out_sleep;
721 }
714 722
715 ret = wl1271_cmd_build_null_data(wl); 723 ret = wl1271_cmd_build_null_data(wl);
716 if (ret < 0) 724 if (ret < 0)
@@ -720,12 +728,6 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
720 if (wl->ssid_len) 728 if (wl->ssid_len)
721 memcpy(wl->ssid, conf->ssid, wl->ssid_len); 729 memcpy(wl->ssid, conf->ssid, wl->ssid_len);
722 730
723 if (wl->bss_type != BSS_TYPE_IBSS) {
724 ret = wl1271_cmd_join(wl);
725 if (ret < 0)
726 goto out_sleep;
727 }
728
729 if (conf->changed & IEEE80211_IFCC_BEACON) { 731 if (conf->changed & IEEE80211_IFCC_BEACON) {
730 beacon = ieee80211_beacon_get(hw, vif); 732 beacon = ieee80211_beacon_get(hw, vif);
731 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, 733 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
@@ -743,11 +745,6 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
743 745
744 if (ret < 0) 746 if (ret < 0)
745 goto out_sleep; 747 goto out_sleep;
746
747 ret = wl1271_cmd_join(wl);
748
749 if (ret < 0)
750 goto out_sleep;
751 } 748 }
752 749
753out_sleep: 750out_sleep:
@@ -782,14 +779,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
782 goto out; 779 goto out;
783 780
784 if (channel != wl->channel) { 781 if (channel != wl->channel) {
785 u8 old_channel = wl->channel; 782 /*
783 * We assume that the stack will configure the right channel
784 * before associating, so we don't need to send a join
785 * command here. We will join the right channel when the
786 * BSSID changes
787 */
786 wl->channel = channel; 788 wl->channel = channel;
787
788 ret = wl1271_cmd_join(wl);
789 if (ret < 0) {
790 wl->channel = old_channel;
791 goto out_sleep;
792 }
793 } 789 }
794 790
795 ret = wl1271_cmd_build_null_data(wl); 791 ret = wl1271_cmd_build_null_data(wl);
@@ -1102,17 +1098,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1102 1098
1103 if (changed & BSS_CHANGED_ASSOC) { 1099 if (changed & BSS_CHANGED_ASSOC) {
1104 if (bss_conf->assoc) { 1100 if (bss_conf->assoc) {
1105 wl->beacon_int = bss_conf->beacon_int;
1106 wl->dtim_period = bss_conf->dtim_period;
1107 wl->aid = bss_conf->aid; 1101 wl->aid = bss_conf->aid;
1108 1102
1109 ret = wl1271_cmd_join(wl); 1103 /*
1110 if (ret < 0) { 1104 * with wl1271, we don't need to update the
1111 wl1271_warning("Association configuration " 1105 * beacon_int and dtim_period, because the firmware
1112 "failed %d", ret); 1106 * updates it by itself when the first beacon is
1113 goto out_sleep; 1107 * received after a join.
1114 } 1108 */
1115
1116 ret = wl1271_cmd_build_ps_poll(wl, wl->aid); 1109 ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
1117 if (ret < 0) 1110 if (ret < 0)
1118 goto out_sleep; 1111 goto out_sleep;
@@ -1130,8 +1123,6 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1130 } 1123 }
1131 } else { 1124 } else {
1132 /* use defaults when not associated */ 1125 /* use defaults when not associated */
1133 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1134 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1135 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET; 1126 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
1136 wl->aid = 0; 1127 wl->aid = 0;
1137 } 1128 }
@@ -1170,18 +1161,12 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1170 if (changed & BSS_CHANGED_BASIC_RATES) { 1161 if (changed & BSS_CHANGED_BASIC_RATES) {
1171 wl->basic_rate_set = wl1271_enabled_rates_get( 1162 wl->basic_rate_set = wl1271_enabled_rates_get(
1172 wl, bss_conf->basic_rates); 1163 wl, bss_conf->basic_rates);
1173 ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
1174 1164
1165 ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
1175 if (ret < 0) { 1166 if (ret < 0) {
1176 wl1271_warning("Set rate policies failed %d", ret); 1167 wl1271_warning("Set rate policies failed %d", ret);
1177 goto out_sleep; 1168 goto out_sleep;
1178 } 1169 }
1179 ret = wl1271_cmd_join(wl);
1180 if (ret < 0) {
1181 wl1271_warning("Join with new basic rate "
1182 "set failed %d", ret);
1183 goto out_sleep;
1184 }
1185 } 1170 }
1186 1171
1187out_sleep: 1172out_sleep:
@@ -1380,8 +1365,6 @@ static int __devinit wl1271_probe(struct spi_device *spi)
1380 wl->psm_requested = false; 1365 wl->psm_requested = false;
1381 wl->tx_queue_stopped = false; 1366 wl->tx_queue_stopped = false;
1382 wl->power_level = WL1271_DEFAULT_POWER_LEVEL; 1367 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
1383 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1384 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1385 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET; 1368 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
1386 wl->band = IEEE80211_BAND_2GHZ; 1369 wl->band = IEEE80211_BAND_2GHZ;
1387 wl->vif = NULL; 1370 wl->vif = NULL;