aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-05 05:55:43 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-07 01:32:35 -0400
commitd2d66c56cf6c8727662aa321991f791604c22094 (patch)
tree3e916d6cd0c36cf1761a18ee82f724413229cdf9
parent30d0c8fd5b87d1c5486705d6420545a21533e115 (diff)
wl12xx: move basic_rate into wlvif
move basic_rate into the per-interface data, rather than being global. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/acx.c8
-rw-r--r--drivers/net/wireless/wl12xx/acx.h2
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c23
-rw-r--r--drivers/net/wireless/wl12xx/cmd.h8
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c1
-rw-r--r--drivers/net/wireless/wl12xx/event.c21
-rw-r--r--drivers/net/wireless/wl12xx/init.c2
-rw-r--r--drivers/net/wireless/wl12xx/main.c47
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h8
9 files changed, 68 insertions, 52 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 1ef9b0b48635..015938f94805 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -755,11 +755,11 @@ int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif)
755 } 755 }
756 756
757 wl1271_debug(DEBUG_ACX, "basic_rate: 0x%x, full_rate: 0x%x", 757 wl1271_debug(DEBUG_ACX, "basic_rate: 0x%x, full_rate: 0x%x",
758 wl->basic_rate, wlvif->rate_set); 758 wlvif->basic_rate, wlvif->rate_set);
759 759
760 /* configure one basic rate class */ 760 /* configure one basic rate class */
761 acx->rate_policy_idx = cpu_to_le32(ACX_TX_BASIC_RATE); 761 acx->rate_policy_idx = cpu_to_le32(ACX_TX_BASIC_RATE);
762 acx->rate_policy.enabled_rates = cpu_to_le32(wl->basic_rate); 762 acx->rate_policy.enabled_rates = cpu_to_le32(wlvif->basic_rate);
763 acx->rate_policy.short_retry_limit = c->short_retry_limit; 763 acx->rate_policy.short_retry_limit = c->short_retry_limit;
764 acx->rate_policy.long_retry_limit = c->long_retry_limit; 764 acx->rate_policy.long_retry_limit = c->long_retry_limit;
765 acx->rate_policy.aflags = c->aflags; 765 acx->rate_policy.aflags = c->aflags;
@@ -1567,7 +1567,7 @@ out:
1567 return ret; 1567 return ret;
1568} 1568}
1569 1569
1570int wl1271_acx_config_ps(struct wl1271 *wl) 1570int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1571{ 1571{
1572 struct wl1271_acx_config_ps *config_ps; 1572 struct wl1271_acx_config_ps *config_ps;
1573 int ret; 1573 int ret;
@@ -1582,7 +1582,7 @@ int wl1271_acx_config_ps(struct wl1271 *wl)
1582 1582
1583 config_ps->exit_retries = wl->conf.conn.psm_exit_retries; 1583 config_ps->exit_retries = wl->conf.conn.psm_exit_retries;
1584 config_ps->enter_retries = wl->conf.conn.psm_entry_retries; 1584 config_ps->enter_retries = wl->conf.conn.psm_entry_retries;
1585 config_ps->null_data_rate = cpu_to_le32(wl->basic_rate); 1585 config_ps->null_data_rate = cpu_to_le32(wlvif->basic_rate);
1586 1586
1587 ret = wl1271_cmd_configure(wl, ACX_CONFIG_PS, config_ps, 1587 ret = wl1271_cmd_configure(wl, ACX_CONFIG_PS, config_ps,
1588 sizeof(*config_ps)); 1588 sizeof(*config_ps));
diff --git a/drivers/net/wireless/wl12xx/acx.h b/drivers/net/wireless/wl12xx/acx.h
index 81779f45ab41..2678e1d505f9 100644
--- a/drivers/net/wireless/wl12xx/acx.h
+++ b/drivers/net/wireless/wl12xx/acx.h
@@ -1295,7 +1295,7 @@ int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
1295int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime); 1295int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime);
1296int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable); 1296int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable);
1297int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl); 1297int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl);
1298int wl1271_acx_config_ps(struct wl1271 *wl); 1298int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1299int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr); 1299int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
1300int wl1271_acx_fm_coex(struct wl1271 *wl); 1300int wl1271_acx_fm_coex(struct wl1271 *wl);
1301int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl); 1301int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index 6a2f758eb1d3..ce734157980a 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -1031,7 +1031,7 @@ out:
1031 return ret; 1031 return ret;
1032} 1032}
1033 1033
1034int wl1271_cmd_build_null_data(struct wl1271 *wl) 1034int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1035{ 1035{
1036 struct sk_buff *skb = NULL; 1036 struct sk_buff *skb = NULL;
1037 int size; 1037 int size;
@@ -1043,7 +1043,8 @@ int wl1271_cmd_build_null_data(struct wl1271 *wl)
1043 size = sizeof(struct wl12xx_null_data_template); 1043 size = sizeof(struct wl12xx_null_data_template);
1044 ptr = NULL; 1044 ptr = NULL;
1045 } else { 1045 } else {
1046 skb = ieee80211_nullfunc_get(wl->hw, wl->vif); 1046 skb = ieee80211_nullfunc_get(wl->hw,
1047 wl12xx_wlvif_to_vif(wlvif));
1047 if (!skb) 1048 if (!skb)
1048 goto out; 1049 goto out;
1049 size = skb->len; 1050 size = skb->len;
@@ -1051,7 +1052,7 @@ int wl1271_cmd_build_null_data(struct wl1271 *wl)
1051 } 1052 }
1052 1053
1053 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size, 0, 1054 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, ptr, size, 0,
1054 wl->basic_rate); 1055 wlvif->basic_rate);
1055 1056
1056out: 1057out:
1057 dev_kfree_skb(skb); 1058 dev_kfree_skb(skb);
@@ -1062,19 +1063,21 @@ out:
1062 1063
1063} 1064}
1064 1065
1065int wl1271_cmd_build_klv_null_data(struct wl1271 *wl) 1066int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
1067 struct wl12xx_vif *wlvif)
1066{ 1068{
1069 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
1067 struct sk_buff *skb = NULL; 1070 struct sk_buff *skb = NULL;
1068 int ret = -ENOMEM; 1071 int ret = -ENOMEM;
1069 1072
1070 skb = ieee80211_nullfunc_get(wl->hw, wl->vif); 1073 skb = ieee80211_nullfunc_get(wl->hw, vif);
1071 if (!skb) 1074 if (!skb)
1072 goto out; 1075 goto out;
1073 1076
1074 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, 1077 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV,
1075 skb->data, skb->len, 1078 skb->data, skb->len,
1076 CMD_TEMPL_KLV_IDX_NULL_DATA, 1079 CMD_TEMPL_KLV_IDX_NULL_DATA,
1077 wl->basic_rate); 1080 wlvif->basic_rate);
1078 1081
1079out: 1082out:
1080 dev_kfree_skb(skb); 1083 dev_kfree_skb(skb);
@@ -1161,7 +1164,8 @@ out:
1161 return skb; 1164 return skb;
1162} 1165}
1163 1166
1164int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr) 1167int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1168 __be32 ip_addr)
1165{ 1169{
1166 int ret; 1170 int ret;
1167 struct wl12xx_arp_rsp_template tmpl; 1171 struct wl12xx_arp_rsp_template tmpl;
@@ -1197,13 +1201,14 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr)
1197 1201
1198 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP, 1202 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP,
1199 &tmpl, sizeof(tmpl), 0, 1203 &tmpl, sizeof(tmpl), 0,
1200 wl->basic_rate); 1204 wlvif->basic_rate);
1201 1205
1202 return ret; 1206 return ret;
1203} 1207}
1204 1208
1205int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif) 1209int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif)
1206{ 1210{
1211 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1207 struct ieee80211_qos_hdr template; 1212 struct ieee80211_qos_hdr template;
1208 1213
1209 memset(&template, 0, sizeof(template)); 1214 memset(&template, 0, sizeof(template));
@@ -1221,7 +1226,7 @@ int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif)
1221 1226
1222 return wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, &template, 1227 return wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, &template,
1223 sizeof(template), 0, 1228 sizeof(template), 0,
1224 wl->basic_rate); 1229 wlvif->basic_rate);
1225} 1230}
1226 1231
1227int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid) 1232int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid)
diff --git a/drivers/net/wireless/wl12xx/cmd.h b/drivers/net/wireless/wl12xx/cmd.h
index 234a8dc90559..d5749f5b3bf1 100644
--- a/drivers/net/wireless/wl12xx/cmd.h
+++ b/drivers/net/wireless/wl12xx/cmd.h
@@ -55,7 +55,7 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
55 size_t len); 55 size_t len);
56int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, 56int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
57 void *buf, size_t buf_len, int index, u32 rates); 57 void *buf, size_t buf_len, int index, u32 rates);
58int wl1271_cmd_build_null_data(struct wl1271 *wl); 58int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif);
59int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, 59int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
60 u16 aid); 60 u16 aid);
61int wl1271_cmd_build_probe_req(struct wl1271 *wl, 61int wl1271_cmd_build_probe_req(struct wl1271 *wl,
@@ -63,9 +63,11 @@ int wl1271_cmd_build_probe_req(struct wl1271 *wl,
63 const u8 *ie, size_t ie_len, u8 band); 63 const u8 *ie, size_t ie_len, u8 band);
64struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, 64struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
65 struct sk_buff *skb); 65 struct sk_buff *skb);
66int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr); 66int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
67 __be32 ip_addr);
67int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif); 68int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
68int wl1271_cmd_build_klv_null_data(struct wl1271 *wl); 69int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
70 struct wl12xx_vif *wlvif);
69int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid); 71int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
70int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, 72int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
71 u8 key_size, const u8 *key, const u8 *addr, 73 u8 key_size, const u8 *key, const u8 *addr,
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index e63fea4b120d..620acbfd9ec3 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -352,7 +352,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
352 DRIVER_STATE_PRINT_INT(state); 352 DRIVER_STATE_PRINT_INT(state);
353 DRIVER_STATE_PRINT_INT(bss_type); 353 DRIVER_STATE_PRINT_INT(bss_type);
354 DRIVER_STATE_PRINT_INT(channel); 354 DRIVER_STATE_PRINT_INT(channel);
355 DRIVER_STATE_PRINT_HEX(basic_rate);
356 DRIVER_STATE_PRINT_INT(band); 355 DRIVER_STATE_PRINT_INT(band);
357 DRIVER_STATE_PRINT_INT(beacon_int); 356 DRIVER_STATE_PRINT_INT(beacon_int);
358 DRIVER_STATE_PRINT_INT(psm_entry_retry); 357 DRIVER_STATE_PRINT_INT(psm_entry_retry);
diff --git a/drivers/net/wireless/wl12xx/event.c b/drivers/net/wireless/wl12xx/event.c
index 7e3ff808feef..af4cef366a3e 100644
--- a/drivers/net/wireless/wl12xx/event.c
+++ b/drivers/net/wireless/wl12xx/event.c
@@ -31,12 +31,16 @@
31 31
32void wl1271_pspoll_work(struct work_struct *work) 32void wl1271_pspoll_work(struct work_struct *work)
33{ 33{
34 struct ieee80211_vif *vif;
35 struct wl12xx_vif *wlvif;
34 struct delayed_work *dwork; 36 struct delayed_work *dwork;
35 struct wl1271 *wl; 37 struct wl1271 *wl;
36 int ret; 38 int ret;
37 39
38 dwork = container_of(work, struct delayed_work, work); 40 dwork = container_of(work, struct delayed_work, work);
39 wl = container_of(dwork, struct wl1271, pspoll_work); 41 wl = container_of(dwork, struct wl1271, pspoll_work);
42 vif = wl->vif; /* TODO: move work into vif struct */
43 wlvif = wl12xx_vif_to_data(vif);
40 44
41 wl1271_debug(DEBUG_EVENT, "pspoll work"); 45 wl1271_debug(DEBUG_EVENT, "pspoll work");
42 46
@@ -60,14 +64,16 @@ void wl1271_pspoll_work(struct work_struct *work)
60 if (ret < 0) 64 if (ret < 0)
61 goto out; 65 goto out;
62 66
63 wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, wl->basic_rate, true); 67 wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, wlvif->basic_rate,
68 true);
64 69
65 wl1271_ps_elp_sleep(wl); 70 wl1271_ps_elp_sleep(wl);
66out: 71out:
67 mutex_unlock(&wl->mutex); 72 mutex_unlock(&wl->mutex);
68}; 73};
69 74
70static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl) 75static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl,
76 struct wl12xx_vif *wlvif)
71{ 77{
72 int delay = wl->conf.conn.ps_poll_recovery_period; 78 int delay = wl->conf.conn.ps_poll_recovery_period;
73 int ret; 79 int ret;
@@ -80,7 +86,7 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl)
80 /* force active mode receive data from the AP */ 86 /* force active mode receive data from the AP */
81 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { 87 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) {
82 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 88 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
83 wl->basic_rate, true); 89 wlvif->basic_rate, true);
84 if (ret < 0) 90 if (ret < 0)
85 return; 91 return;
86 set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags); 92 set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags);
@@ -97,6 +103,7 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl)
97} 103}
98 104
99static int wl1271_event_ps_report(struct wl1271 *wl, 105static int wl1271_event_ps_report(struct wl1271 *wl,
106 struct wl12xx_vif *wlvif,
100 struct event_mailbox *mbox, 107 struct event_mailbox *mbox,
101 bool *beacon_loss) 108 bool *beacon_loss)
102{ 109{
@@ -118,7 +125,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
118 if (wl->psm_entry_retry < total_retries) { 125 if (wl->psm_entry_retry < total_retries) {
119 wl->psm_entry_retry++; 126 wl->psm_entry_retry++;
120 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 127 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
121 wl->basic_rate, true); 128 wlvif->basic_rate, true);
122 } else { 129 } else {
123 wl1271_info("No ack to nullfunc from AP."); 130 wl1271_info("No ack to nullfunc from AP.");
124 wl->psm_entry_retry = 0; 131 wl->psm_entry_retry = 0;
@@ -217,6 +224,8 @@ static void wl1271_event_mbox_dump(struct event_mailbox *mbox)
217 224
218static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) 225static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
219{ 226{
227 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
228 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
220 int ret; 229 int ret;
221 u32 vector; 230 u32 vector;
222 bool beacon_loss = false; 231 bool beacon_loss = false;
@@ -276,13 +285,13 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
276 285
277 if ((vector & PS_REPORT_EVENT_ID) && !is_ap) { 286 if ((vector & PS_REPORT_EVENT_ID) && !is_ap) {
278 wl1271_debug(DEBUG_EVENT, "PS_REPORT_EVENT"); 287 wl1271_debug(DEBUG_EVENT, "PS_REPORT_EVENT");
279 ret = wl1271_event_ps_report(wl, mbox, &beacon_loss); 288 ret = wl1271_event_ps_report(wl, wlvif, mbox, &beacon_loss);
280 if (ret < 0) 289 if (ret < 0)
281 return ret; 290 return ret;
282 } 291 }
283 292
284 if ((vector & PSPOLL_DELIVERY_FAILURE_EVENT_ID) && !is_ap) 293 if ((vector & PSPOLL_DELIVERY_FAILURE_EVENT_ID) && !is_ap)
285 wl1271_event_pspoll_delivery_fail(wl); 294 wl1271_event_pspoll_delivery_fail(wl, wlvif);
286 295
287 if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) { 296 if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) {
288 wl1271_debug(DEBUG_EVENT, "RSSI_SNR_TRIGGER_0_EVENT"); 297 wl1271_debug(DEBUG_EVENT, "RSSI_SNR_TRIGGER_0_EVENT");
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index 37955dad1f93..ed27c5f06bb2 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -331,7 +331,7 @@ static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
331 } 331 }
332 332
333 /* PS config */ 333 /* PS config */
334 ret = wl1271_acx_config_ps(wl); 334 ret = wl12xx_acx_config_ps(wl, wlvif);
335 if (ret < 0) 335 if (ret < 0)
336 return ret; 336 return ret;
337 337
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 195dcbdf1fc7..8863ea542ea6 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1609,7 +1609,8 @@ static struct notifier_block wl1271_dev_notifier = {
1609}; 1609};
1610 1610
1611#ifdef CONFIG_PM 1611#ifdef CONFIG_PM
1612static int wl1271_configure_suspend_sta(struct wl1271 *wl) 1612static int wl1271_configure_suspend_sta(struct wl1271 *wl,
1613 struct wl12xx_vif *wlvif)
1613{ 1614{
1614 int ret = 0; 1615 int ret = 0;
1615 1616
@@ -1628,7 +1629,7 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl)
1628 1629
1629 wl->ps_compl = &compl; 1630 wl->ps_compl = &compl;
1630 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 1631 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
1631 wl->basic_rate, true); 1632 wlvif->basic_rate, true);
1632 if (ret < 0) 1633 if (ret < 0)
1633 goto out_sleep; 1634 goto out_sleep;
1634 1635
@@ -1682,16 +1683,18 @@ out_unlock:
1682 1683
1683} 1684}
1684 1685
1685static int wl1271_configure_suspend(struct wl1271 *wl) 1686static int wl1271_configure_suspend(struct wl1271 *wl,
1687 struct wl12xx_vif *wlvif)
1686{ 1688{
1687 if (wl->bss_type == BSS_TYPE_STA_BSS) 1689 if (wl->bss_type == BSS_TYPE_STA_BSS)
1688 return wl1271_configure_suspend_sta(wl); 1690 return wl1271_configure_suspend_sta(wl, wlvif);
1689 if (wl->bss_type == BSS_TYPE_AP_BSS) 1691 if (wl->bss_type == BSS_TYPE_AP_BSS)
1690 return wl1271_configure_suspend_ap(wl); 1692 return wl1271_configure_suspend_ap(wl);
1691 return 0; 1693 return 0;
1692} 1694}
1693 1695
1694static void wl1271_configure_resume(struct wl1271 *wl) 1696static void wl1271_configure_resume(struct wl1271 *wl,
1697 struct wl12xx_vif *wlvif)
1695{ 1698{
1696 int ret; 1699 int ret;
1697 bool is_sta = wl->bss_type == BSS_TYPE_STA_BSS; 1700 bool is_sta = wl->bss_type == BSS_TYPE_STA_BSS;
@@ -1709,7 +1712,7 @@ static void wl1271_configure_resume(struct wl1271 *wl)
1709 /* exit psm if it wasn't configured */ 1712 /* exit psm if it wasn't configured */
1710 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) 1713 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags))
1711 wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 1714 wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
1712 wl->basic_rate, true); 1715 wlvif->basic_rate, true);
1713 } else if (is_ap) { 1716 } else if (is_ap) {
1714 wl1271_acx_beacon_filter_opt(wl, false); 1717 wl1271_acx_beacon_filter_opt(wl, false);
1715 } 1718 }
@@ -1723,13 +1726,15 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1723 struct cfg80211_wowlan *wow) 1726 struct cfg80211_wowlan *wow)
1724{ 1727{
1725 struct wl1271 *wl = hw->priv; 1728 struct wl1271 *wl = hw->priv;
1729 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
1730 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1726 int ret; 1731 int ret;
1727 1732
1728 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); 1733 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow);
1729 WARN_ON(!wow || !wow->any); 1734 WARN_ON(!wow || !wow->any);
1730 1735
1731 wl->wow_enabled = true; 1736 wl->wow_enabled = true;
1732 ret = wl1271_configure_suspend(wl); 1737 ret = wl1271_configure_suspend(wl, wlvif);
1733 if (ret < 0) { 1738 if (ret < 0) {
1734 wl1271_warning("couldn't prepare device to suspend"); 1739 wl1271_warning("couldn't prepare device to suspend");
1735 return ret; 1740 return ret;
@@ -1760,6 +1765,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1760static int wl1271_op_resume(struct ieee80211_hw *hw) 1765static int wl1271_op_resume(struct ieee80211_hw *hw)
1761{ 1766{
1762 struct wl1271 *wl = hw->priv; 1767 struct wl1271 *wl = hw->priv;
1768 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
1769 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1763 unsigned long flags; 1770 unsigned long flags;
1764 bool run_irq_work = false; 1771 bool run_irq_work = false;
1765 1772
@@ -1783,7 +1790,7 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
1783 wl1271_irq(0, wl); 1790 wl1271_irq(0, wl);
1784 wl1271_enable_interrupts(wl); 1791 wl1271_enable_interrupts(wl);
1785 } 1792 }
1786 wl1271_configure_resume(wl); 1793 wl1271_configure_resume(wl, wlvif);
1787 wl->wow_enabled = false; 1794 wl->wow_enabled = false;
1788 1795
1789 return 0; 1796 return 0;
@@ -1840,6 +1847,7 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl)
1840static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) 1847static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
1841{ 1848{
1842 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; 1849 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
1850 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
1843 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; 1851 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
1844} 1852}
1845 1853
@@ -2214,7 +2222,7 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2214 if (ret < 0) 2222 if (ret < 0)
2215 goto out; 2223 goto out;
2216 2224
2217 ret = wl1271_cmd_build_klv_null_data(wl); 2225 ret = wl12xx_cmd_build_klv_null_data(wl, wlvif);
2218 if (ret < 0) 2226 if (ret < 0)
2219 goto out; 2227 goto out;
2220 2228
@@ -2384,7 +2392,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2384 if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) 2392 if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
2385 wl1271_set_band_rate(wl, wlvif); 2393 wl1271_set_band_rate(wl, wlvif);
2386 2394
2387 wl->basic_rate = 2395 wlvif->basic_rate =
2388 wl1271_tx_min_rate_get(wl, 2396 wl1271_tx_min_rate_get(wl,
2389 wlvif->basic_rate_set); 2397 wlvif->basic_rate_set);
2390 ret = wl1271_acx_sta_rate_policies(wl, wlvif); 2398 ret = wl1271_acx_sta_rate_policies(wl, wlvif);
@@ -2450,7 +2458,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2450 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { 2458 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
2451 wl1271_debug(DEBUG_PSM, "psm enabled"); 2459 wl1271_debug(DEBUG_PSM, "psm enabled");
2452 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 2460 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
2453 wl->basic_rate, true); 2461 wlvif->basic_rate, true);
2454 } 2462 }
2455 } else if (!(conf->flags & IEEE80211_CONF_PS) && 2463 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
2456 test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { 2464 test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) {
@@ -2460,7 +2468,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2460 2468
2461 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) 2469 if (test_bit(WL1271_FLAG_PSM, &wl->flags))
2462 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 2470 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
2463 wl->basic_rate, true); 2471 wlvif->basic_rate, true);
2464 } 2472 }
2465 2473
2466 if (conf->power_level != wl->power_level) { 2474 if (conf->power_level != wl->power_level) {
@@ -3311,7 +3319,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
3311 3319
3312 wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, 3320 wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates,
3313 wl->band); 3321 wl->band);
3314 wl->basic_rate = wl1271_tx_min_rate_get(wl, 3322 wlvif->basic_rate = wl1271_tx_min_rate_get(wl,
3315 wlvif->basic_rate_set); 3323 wlvif->basic_rate_set);
3316 3324
3317 ret = wl1271_init_ap_rates(wl, wlvif); 3325 ret = wl1271_init_ap_rates(wl, wlvif);
@@ -3450,7 +3458,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
3450 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 3458 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
3451 3459
3452 if (!is_zero_ether_addr(wl->bssid)) { 3460 if (!is_zero_ether_addr(wl->bssid)) {
3453 ret = wl1271_cmd_build_null_data(wl); 3461 ret = wl12xx_cmd_build_null_data(wl, wlvif);
3454 if (ret < 0) 3462 if (ret < 0)
3455 goto out; 3463 goto out;
3456 3464
@@ -3498,7 +3506,7 @@ sta_not_found:
3498 wlvif->basic_rate_set = 3506 wlvif->basic_rate_set =
3499 wl1271_tx_enabled_rates_get(wl, rates, 3507 wl1271_tx_enabled_rates_get(wl, rates,
3500 wl->band); 3508 wl->band);
3501 wl->basic_rate = 3509 wlvif->basic_rate =
3502 wl1271_tx_min_rate_get(wl, 3510 wl1271_tx_min_rate_get(wl,
3503 wlvif->basic_rate_set); 3511 wlvif->basic_rate_set);
3504 if (sta_rate_set) 3512 if (sta_rate_set)
@@ -3552,7 +3560,7 @@ sta_not_found:
3552 3560
3553 /* revert back to minimum rates for the current band */ 3561 /* revert back to minimum rates for the current band */
3554 wl1271_set_band_rate(wl, wlvif); 3562 wl1271_set_band_rate(wl, wlvif);
3555 wl->basic_rate = 3563 wlvif->basic_rate =
3556 wl1271_tx_min_rate_get(wl, 3564 wl1271_tx_min_rate_get(wl,
3557 wlvif->basic_rate_set); 3565 wlvif->basic_rate_set);
3558 ret = wl1271_acx_sta_rate_policies(wl, wlvif); 3566 ret = wl1271_acx_sta_rate_policies(wl, wlvif);
@@ -3608,7 +3616,7 @@ sta_not_found:
3608 wlvif->basic_rate_set = 3616 wlvif->basic_rate_set =
3609 wl1271_tx_enabled_rates_get(wl, rates, 3617 wl1271_tx_enabled_rates_get(wl, rates,
3610 wl->band); 3618 wl->band);
3611 wl->basic_rate = 3619 wlvif->basic_rate =
3612 wl1271_tx_min_rate_get(wl, 3620 wl1271_tx_min_rate_get(wl,
3613 wlvif->basic_rate_set); 3621 wlvif->basic_rate_set);
3614 3622
@@ -3636,7 +3644,7 @@ sta_not_found:
3636 * isn't being set (when sending), so we have to 3644 * isn't being set (when sending), so we have to
3637 * reconfigure the template upon every ip change. 3645 * reconfigure the template upon every ip change.
3638 */ 3646 */
3639 ret = wl1271_cmd_build_arp_rsp(wl, addr); 3647 ret = wl1271_cmd_build_arp_rsp(wl, wlvif, addr);
3640 if (ret < 0) { 3648 if (ret < 0) {
3641 wl1271_warning("build arp rsp failed: %d", ret); 3649 wl1271_warning("build arp rsp failed: %d", ret);
3642 goto out; 3650 goto out;
@@ -3689,7 +3697,7 @@ sta_not_found:
3689 3697
3690 mode = STATION_POWER_SAVE_MODE; 3698 mode = STATION_POWER_SAVE_MODE;
3691 ret = wl1271_ps_set_mode(wl, mode, 3699 ret = wl1271_ps_set_mode(wl, mode,
3692 wl->basic_rate, 3700 wlvif->basic_rate,
3693 true); 3701 true);
3694 if (ret < 0) 3702 if (ret < 0)
3695 goto out; 3703 goto out;
@@ -4844,7 +4852,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
4844 wl->rx_counter = 0; 4852 wl->rx_counter = 0;
4845 wl->psm_entry_retry = 0; 4853 wl->psm_entry_retry = 0;
4846 wl->power_level = WL1271_DEFAULT_POWER_LEVEL; 4854 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
4847 wl->basic_rate = CONF_TX_RATE_MASK_BASIC;
4848 wl->band = IEEE80211_BAND_2GHZ; 4855 wl->band = IEEE80211_BAND_2GHZ;
4849 wl->vif = NULL; 4856 wl->vif = NULL;
4850 wl->flags = 0; 4857 wl->flags = 0;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 6f3efbae740e..d355c737044b 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -519,13 +519,6 @@ struct wl1271 {
519 /* Our association ID */ 519 /* Our association ID */
520 u16 aid; 520 u16 aid;
521 521
522 /*
523 * currently configured rate set:
524 * bits 0-15 - 802.11abg rates
525 * bits 16-23 - 802.11n MCS index mask
526 * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
527 */
528 u32 basic_rate;
529 u32 bitrate_masks[IEEE80211_NUM_BANDS]; 522 u32 bitrate_masks[IEEE80211_NUM_BANDS];
530 523
531 /* The current band */ 524 /* The current band */
@@ -646,6 +639,7 @@ struct wl12xx_vif {
646 * bits 16-23 - 802.11n MCS index mask 639 * bits 16-23 - 802.11n MCS index mask
647 * support only 1 stream, thus only 8 bits for the MCS rates (0-7). 640 * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
648 */ 641 */
642 u32 basic_rate;
649 u32 rate_set; 643 u32 rate_set;
650}; 644};
651 645