aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2009-10-08 14:56:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:47:50 -0400
commitd94cd297e58b55bb272fdfd51ff0de7acbc1941b (patch)
tree84b809c8ff5a24514c1c9f77983f2ec38ecfa9dd
parent8a5a37a6c492f7c9602aa72ef19f69c926cdca15 (diff)
wl1271: Update join usage
Update the usage of join's, including using actual beacon interval and dtim from AP, and configuring a basic rate set from AP. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h12
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c15
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h3
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c42
4 files changed, 50 insertions, 22 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 671dc5af2e68..05eb29c847c6 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -104,6 +104,8 @@ enum {
104 CFG_RX_CTL_EN | CFG_RX_BCN_EN | \ 104 CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
105 CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN) 105 CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
106 106
107#define WL1271_DEFAULT_BASIC_RATE_SET (ACX_RATE_MASK_ALL)
108
107#define WL1271_FW_NAME "wl1271-fw.bin" 109#define WL1271_FW_NAME "wl1271-fw.bin"
108#define WL1271_NVS_NAME "wl1271-nvs.bin" 110#define WL1271_NVS_NAME "wl1271-nvs.bin"
109 111
@@ -118,6 +120,9 @@ enum {
118#define WL1271_ELP_HW_STATE_ASLEEP 0 120#define WL1271_ELP_HW_STATE_ASLEEP 0
119#define WL1271_ELP_HW_STATE_IRQ 1 121#define WL1271_ELP_HW_STATE_IRQ 1
120 122
123#define WL1271_DEFAULT_BEACON_INT 100
124#define WL1271_DEFAULT_DTIM_PERIOD 1
125
121enum wl1271_state { 126enum wl1271_state {
122 WL1271_STATE_OFF, 127 WL1271_STATE_OFF,
123 WL1271_STATE_ON, 128 WL1271_STATE_ON,
@@ -369,6 +374,13 @@ struct wl1271 {
369 /* Our association ID */ 374 /* Our association ID */
370 u16 aid; 375 u16 aid;
371 376
377 /* Beacon parameters */
378 u16 beacon_int;
379 u8 dtim_period;
380
381 /* currently configured rate set */
382 u32 basic_rate_set;
383
372 /* The current band */ 384 /* The current band */
373 enum ieee80211_band band; 385 enum ieee80211_band band;
374 386
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index bd65b38eb1d9..35a6e67f7ae4 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -175,11 +175,9 @@ int wl1271_cmd_cal(struct wl1271 *wl)
175 return ret; 175 return ret;
176} 176}
177 177
178int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval, 178int wl1271_cmd_join(struct wl1271 *wl)
179 u16 beacon_interval, u8 wait)
180{ 179{
181 static bool do_cal = true; 180 static bool do_cal = true;
182 unsigned long timeout;
183 struct wl1271_cmd_join *join; 181 struct wl1271_cmd_join *join;
184 int ret, i; 182 int ret, i;
185 u8 *bssid; 183 u8 *bssid;
@@ -213,9 +211,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
213 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | 211 join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
214 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; 212 RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
215 213
216 join->beacon_interval = beacon_interval; 214 join->beacon_interval = wl->beacon_int;
217 join->dtim_interval = dtim_interval; 215 join->dtim_interval = wl->dtim_period;
218 join->bss_type = bss_type; 216 join->bss_type = wl->bss_type;
219 join->channel = wl->channel; 217 join->channel = wl->channel;
220 join->ssid_len = wl->ssid_len; 218 join->ssid_len = wl->ssid_len;
221 memcpy(join->ssid, wl->ssid, wl->ssid_len); 219 memcpy(join->ssid, wl->ssid, wl->ssid_len);
@@ -239,14 +237,11 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
239 goto out_free; 237 goto out_free;
240 } 238 }
241 239
242 timeout = msecs_to_jiffies(JOIN_TIMEOUT);
243
244 /* 240 /*
245 * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to 241 * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
246 * simplify locking we just sleep instead, for now 242 * simplify locking we just sleep instead, for now
247 */ 243 */
248 if (wait) 244 msleep(10);
249 msleep(10);
250 245
251out_free: 246out_free:
252 kfree(join); 247 kfree(join);
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 7c4d3aaaa819..63bc4417deb8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -30,8 +30,7 @@
30struct acx_header; 30struct acx_header;
31 31
32int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len); 32int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len);
33int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval, 33int wl1271_cmd_join(struct wl1271 *wl);
34 u16 beacon_interval, u8 wait);
35int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); 34int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
36int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); 35int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
37int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); 36int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index b9b1c2013744..6e35fcf37e4f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -394,8 +394,7 @@ static void wl1271_filter_work(struct work_struct *work)
394 if (ret < 0) 394 if (ret < 0)
395 goto out; 395 goto out;
396 396
397 /* FIXME: replace the magic numbers with proper definitions */ 397 ret = wl1271_cmd_join(wl);
398 ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
399 if (ret < 0) 398 if (ret < 0)
400 goto out_sleep; 399 goto out_sleep;
401 400
@@ -672,8 +671,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
672 memcpy(wl->ssid, conf->ssid, wl->ssid_len); 671 memcpy(wl->ssid, conf->ssid, wl->ssid_len);
673 672
674 if (wl->bss_type != BSS_TYPE_IBSS) { 673 if (wl->bss_type != BSS_TYPE_IBSS) {
675 /* FIXME: replace the magic numbers with proper definitions */ 674 ret = wl1271_cmd_join(wl);
676 ret = wl1271_cmd_join(wl, wl->bss_type, 5, 100, 1);
677 if (ret < 0) 675 if (ret < 0)
678 goto out_sleep; 676 goto out_sleep;
679 } 677 }
@@ -696,8 +694,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
696 if (ret < 0) 694 if (ret < 0)
697 goto out_sleep; 695 goto out_sleep;
698 696
699 /* FIXME: replace the magic numbers with proper definitions */ 697 ret = wl1271_cmd_join(wl);
700 ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
701 698
702 if (ret < 0) 699 if (ret < 0)
703 goto out_sleep; 700 goto out_sleep;
@@ -738,8 +735,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
738 u8 old_channel = wl->channel; 735 u8 old_channel = wl->channel;
739 wl->channel = channel; 736 wl->channel = channel;
740 737
741 /* FIXME: use beacon interval provided by mac80211 */ 738 ret = wl1271_cmd_join(wl);
742 ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
743 if (ret < 0) { 739 if (ret < 0) {
744 wl->channel = old_channel; 740 wl->channel = old_channel;
745 goto out_sleep; 741 goto out_sleep;
@@ -1016,8 +1012,17 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1016 1012
1017 if (changed & BSS_CHANGED_ASSOC) { 1013 if (changed & BSS_CHANGED_ASSOC) {
1018 if (bss_conf->assoc) { 1014 if (bss_conf->assoc) {
1015 wl->beacon_int = bss_conf->beacon_int;
1016 wl->dtim_period = bss_conf->dtim_period;
1019 wl->aid = bss_conf->aid; 1017 wl->aid = bss_conf->aid;
1020 1018
1019 ret = wl1271_cmd_join(wl);
1020 if (ret < 0) {
1021 wl1271_warning("Association configuration "
1022 "failed %d", ret);
1023 goto out_sleep;
1024 }
1025
1021 ret = wl1271_cmd_build_ps_poll(wl, wl->aid); 1026 ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
1022 if (ret < 0) 1027 if (ret < 0)
1023 goto out_sleep; 1028 goto out_sleep;
@@ -1033,7 +1038,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1033 if (ret < 0) 1038 if (ret < 0)
1034 goto out_sleep; 1039 goto out_sleep;
1035 } 1040 }
1041 } else {
1042 /* use defaults when not associated */
1043 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1044 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1045 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
1046 wl->aid = 0;
1036 } 1047 }
1048
1037 } 1049 }
1038 1050
1039 if (changed & BSS_CHANGED_ERP_SLOT) { 1051 if (changed & BSS_CHANGED_ERP_SLOT) {
@@ -1066,13 +1078,20 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
1066 } 1078 }
1067 1079
1068 if (changed & BSS_CHANGED_BASIC_RATES) { 1080 if (changed & BSS_CHANGED_BASIC_RATES) {
1069 u32 enabled_rates = wl1271_enabled_rates_get( 1081 wl->basic_rate_set = wl1271_enabled_rates_get(
1070 wl, bss_conf->basic_rates); 1082 wl, bss_conf->basic_rates);
1071 ret = wl1271_acx_rate_policies(wl, enabled_rates); 1083 ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
1084
1072 if (ret < 0) { 1085 if (ret < 0) {
1073 wl1271_warning("Set rate policies failed %d", ret); 1086 wl1271_warning("Set rate policies failed %d", ret);
1074 goto out_sleep; 1087 goto out_sleep;
1075 } 1088 }
1089 ret = wl1271_cmd_join(wl);
1090 if (ret < 0) {
1091 wl1271_warning("Join with new basic rate "
1092 "set failed %d", ret);
1093 goto out_sleep;
1094 }
1076 } 1095 }
1077 1096
1078out_sleep: 1097out_sleep:
@@ -1269,6 +1288,9 @@ static int __devinit wl1271_probe(struct spi_device *spi)
1269 wl->psm_requested = false; 1288 wl->psm_requested = false;
1270 wl->tx_queue_stopped = false; 1289 wl->tx_queue_stopped = false;
1271 wl->power_level = WL1271_DEFAULT_POWER_LEVEL; 1290 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
1291 wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
1292 wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
1293 wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
1272 wl->band = IEEE80211_BAND_2GHZ; 1294 wl->band = IEEE80211_BAND_2GHZ;
1273 1295
1274 /* We use the default power on sleep time until we know which chip 1296 /* We use the default power on sleep time until we know which chip