aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-05 05:55:51 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-07 01:32:42 -0400
commit0603d891c5b5153f667a79357d4652824c22b54e (patch)
treea5662e776f2609db07d05415d65c5fa74a0ef564 /drivers/net/wireless
parent6840e37aec6fd9ffa5b4cf62674af55afdb565ed (diff)
wl12xx: move role_id into wlvif
move role_id 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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/wl12xx/acx.c124
-rw-r--r--drivers/net/wireless/wl12xx/acx.h71
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c33
-rw-r--r--drivers/net/wireless/wl12xx/cmd.h7
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c10
-rw-r--r--drivers/net/wireless/wl12xx/event.c13
-rw-r--r--drivers/net/wireless/wl12xx/init.c69
-rw-r--r--drivers/net/wireless/wl12xx/main.c118
-rw-r--r--drivers/net/wireless/wl12xx/ps.c14
-rw-r--r--drivers/net/wireless/wl12xx/ps.h4
-rw-r--r--drivers/net/wireless/wl12xx/scan.c5
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h2
12 files changed, 270 insertions, 200 deletions
diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 015938f94805..9b4eef61bd01 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -33,7 +33,7 @@
33#include "reg.h" 33#include "reg.h"
34#include "ps.h" 34#include "ps.h"
35 35
36int wl1271_acx_wake_up_conditions(struct wl1271 *wl) 36int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif)
37{ 37{
38 struct acx_wake_up_condition *wake_up; 38 struct acx_wake_up_condition *wake_up;
39 int ret; 39 int ret;
@@ -46,7 +46,7 @@ int wl1271_acx_wake_up_conditions(struct wl1271 *wl)
46 goto out; 46 goto out;
47 } 47 }
48 48
49 wake_up->role_id = wl->role_id; 49 wake_up->role_id = wlvif->role_id;
50 wake_up->wake_up_event = wl->conf.conn.wake_up_event; 50 wake_up->wake_up_event = wl->conf.conn.wake_up_event;
51 wake_up->listen_interval = wl->conf.conn.listen_interval; 51 wake_up->listen_interval = wl->conf.conn.listen_interval;
52 52
@@ -84,7 +84,8 @@ out:
84 return ret; 84 return ret;
85} 85}
86 86
87int wl1271_acx_tx_power(struct wl1271 *wl, int power) 87int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
88 int power)
88{ 89{
89 struct acx_current_tx_power *acx; 90 struct acx_current_tx_power *acx;
90 int ret; 91 int ret;
@@ -100,7 +101,7 @@ int wl1271_acx_tx_power(struct wl1271 *wl, int power)
100 goto out; 101 goto out;
101 } 102 }
102 103
103 acx->role_id = wl->role_id; 104 acx->role_id = wlvif->role_id;
104 acx->current_tx_power = power * 10; 105 acx->current_tx_power = power * 10;
105 106
106 ret = wl1271_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx)); 107 ret = wl1271_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx));
@@ -114,7 +115,7 @@ out:
114 return ret; 115 return ret;
115} 116}
116 117
117int wl1271_acx_feature_cfg(struct wl1271 *wl) 118int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif)
118{ 119{
119 struct acx_feature_config *feature; 120 struct acx_feature_config *feature;
120 int ret; 121 int ret;
@@ -128,7 +129,7 @@ int wl1271_acx_feature_cfg(struct wl1271 *wl)
128 } 129 }
129 130
130 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */ 131 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
131 feature->role_id = wl->role_id; 132 feature->role_id = wlvif->role_id;
132 feature->data_flow_options = 0; 133 feature->data_flow_options = 0;
133 feature->options = 0; 134 feature->options = 0;
134 135
@@ -210,7 +211,8 @@ out:
210 return ret; 211 return ret;
211} 212}
212 213
213int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time) 214int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif,
215 enum acx_slot_type slot_time)
214{ 216{
215 struct acx_slot *slot; 217 struct acx_slot *slot;
216 int ret; 218 int ret;
@@ -223,7 +225,7 @@ int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time)
223 goto out; 225 goto out;
224 } 226 }
225 227
226 slot->role_id = wl->role_id; 228 slot->role_id = wlvif->role_id;
227 slot->wone_index = STATION_WONE_INDEX; 229 slot->wone_index = STATION_WONE_INDEX;
228 slot->slot_time = slot_time; 230 slot->slot_time = slot_time;
229 231
@@ -238,8 +240,8 @@ out:
238 return ret; 240 return ret;
239} 241}
240 242
241int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable, 243int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif,
242 void *mc_list, u32 mc_list_len) 244 bool enable, void *mc_list, u32 mc_list_len)
243{ 245{
244 struct acx_dot11_grp_addr_tbl *acx; 246 struct acx_dot11_grp_addr_tbl *acx;
245 int ret; 247 int ret;
@@ -253,7 +255,7 @@ int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable,
253 } 255 }
254 256
255 /* MAC filtering */ 257 /* MAC filtering */
256 acx->role_id = wl->role_id; 258 acx->role_id = wlvif->role_id;
257 acx->enabled = enable; 259 acx->enabled = enable;
258 acx->num_groups = mc_list_len; 260 acx->num_groups = mc_list_len;
259 memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN); 261 memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
@@ -270,7 +272,8 @@ out:
270 return ret; 272 return ret;
271} 273}
272 274
273int wl1271_acx_service_period_timeout(struct wl1271 *wl) 275int wl1271_acx_service_period_timeout(struct wl1271 *wl,
276 struct wl12xx_vif *wlvif)
274{ 277{
275 struct acx_rx_timeout *rx_timeout; 278 struct acx_rx_timeout *rx_timeout;
276 int ret; 279 int ret;
@@ -283,7 +286,7 @@ int wl1271_acx_service_period_timeout(struct wl1271 *wl)
283 286
284 wl1271_debug(DEBUG_ACX, "acx service period timeout"); 287 wl1271_debug(DEBUG_ACX, "acx service period timeout");
285 288
286 rx_timeout->role_id = wl->role_id; 289 rx_timeout->role_id = wlvif->role_id;
287 rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout); 290 rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout);
288 rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout); 291 rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout);
289 292
@@ -300,7 +303,8 @@ out:
300 return ret; 303 return ret;
301} 304}
302 305
303int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold) 306int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif,
307 u32 rts_threshold)
304{ 308{
305 struct acx_rts_threshold *rts; 309 struct acx_rts_threshold *rts;
306 int ret; 310 int ret;
@@ -320,7 +324,7 @@ int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold)
320 goto out; 324 goto out;
321 } 325 }
322 326
323 rts->role_id = wl->role_id; 327 rts->role_id = wlvif->role_id;
324 rts->threshold = cpu_to_le16((u16)rts_threshold); 328 rts->threshold = cpu_to_le16((u16)rts_threshold);
325 329
326 ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); 330 ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
@@ -363,7 +367,8 @@ out:
363 return ret; 367 return ret;
364} 368}
365 369
366int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter) 370int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif,
371 bool enable_filter)
367{ 372{
368 struct acx_beacon_filter_option *beacon_filter = NULL; 373 struct acx_beacon_filter_option *beacon_filter = NULL;
369 int ret = 0; 374 int ret = 0;
@@ -380,7 +385,7 @@ int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter)
380 goto out; 385 goto out;
381 } 386 }
382 387
383 beacon_filter->role_id = wl->role_id; 388 beacon_filter->role_id = wlvif->role_id;
384 beacon_filter->enable = enable_filter; 389 beacon_filter->enable = enable_filter;
385 390
386 /* 391 /*
@@ -401,7 +406,8 @@ out:
401 return ret; 406 return ret;
402} 407}
403 408
404int wl1271_acx_beacon_filter_table(struct wl1271 *wl) 409int wl1271_acx_beacon_filter_table(struct wl1271 *wl,
410 struct wl12xx_vif *wlvif)
405{ 411{
406 struct acx_beacon_filter_ie_table *ie_table; 412 struct acx_beacon_filter_ie_table *ie_table;
407 int i, idx = 0; 413 int i, idx = 0;
@@ -417,7 +423,7 @@ int wl1271_acx_beacon_filter_table(struct wl1271 *wl)
417 } 423 }
418 424
419 /* configure default beacon pass-through rules */ 425 /* configure default beacon pass-through rules */
420 ie_table->role_id = wl->role_id; 426 ie_table->role_id = wlvif->role_id;
421 ie_table->num_ie = 0; 427 ie_table->num_ie = 0;
422 for (i = 0; i < wl->conf.conn.bcn_filt_ie_count; i++) { 428 for (i = 0; i < wl->conf.conn.bcn_filt_ie_count; i++) {
423 struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]); 429 struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]);
@@ -458,7 +464,8 @@ out:
458 464
459#define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff 465#define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff
460 466
461int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable) 467int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif,
468 bool enable)
462{ 469{
463 struct acx_conn_monit_params *acx; 470 struct acx_conn_monit_params *acx;
464 u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE; 471 u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE;
@@ -479,7 +486,7 @@ int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable)
479 timeout = wl->conf.conn.bss_lose_timeout; 486 timeout = wl->conf.conn.bss_lose_timeout;
480 } 487 }
481 488
482 acx->role_id = wl->role_id; 489 acx->role_id = wlvif->role_id;
483 acx->synch_fail_thold = cpu_to_le32(threshold); 490 acx->synch_fail_thold = cpu_to_le32(threshold);
484 acx->bss_lose_timeout = cpu_to_le32(timeout); 491 acx->bss_lose_timeout = cpu_to_le32(timeout);
485 492
@@ -582,7 +589,7 @@ out:
582 return ret; 589 return ret;
583} 590}
584 591
585int wl1271_acx_bcn_dtim_options(struct wl1271 *wl) 592int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif)
586{ 593{
587 struct acx_beacon_broadcast *bb; 594 struct acx_beacon_broadcast *bb;
588 int ret; 595 int ret;
@@ -595,7 +602,7 @@ int wl1271_acx_bcn_dtim_options(struct wl1271 *wl)
595 goto out; 602 goto out;
596 } 603 }
597 604
598 bb->role_id = wl->role_id; 605 bb->role_id = wlvif->role_id;
599 bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout); 606 bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout);
600 bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout); 607 bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout);
601 bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; 608 bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps;
@@ -612,7 +619,7 @@ out:
612 return ret; 619 return ret;
613} 620}
614 621
615int wl1271_acx_aid(struct wl1271 *wl, u16 aid) 622int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid)
616{ 623{
617 struct acx_aid *acx_aid; 624 struct acx_aid *acx_aid;
618 int ret; 625 int ret;
@@ -625,7 +632,7 @@ int wl1271_acx_aid(struct wl1271 *wl, u16 aid)
625 goto out; 632 goto out;
626 } 633 }
627 634
628 acx_aid->role_id = wl->role_id; 635 acx_aid->role_id = wlvif->role_id;
629 acx_aid->aid = cpu_to_le16(aid); 636 acx_aid->aid = cpu_to_le16(aid);
630 637
631 ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); 638 ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
@@ -668,7 +675,8 @@ out:
668 return ret; 675 return ret;
669} 676}
670 677
671int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble) 678int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif,
679 enum acx_preamble_type preamble)
672{ 680{
673 struct acx_preamble *acx; 681 struct acx_preamble *acx;
674 int ret; 682 int ret;
@@ -681,7 +689,7 @@ int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble)
681 goto out; 689 goto out;
682 } 690 }
683 691
684 acx->role_id = wl->role_id; 692 acx->role_id = wlvif->role_id;
685 acx->preamble = preamble; 693 acx->preamble = preamble;
686 694
687 ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx)); 695 ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx));
@@ -695,7 +703,7 @@ out:
695 return ret; 703 return ret;
696} 704}
697 705
698int wl1271_acx_cts_protect(struct wl1271 *wl, 706int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif,
699 enum acx_ctsprotect_type ctsprotect) 707 enum acx_ctsprotect_type ctsprotect)
700{ 708{
701 struct acx_ctsprotect *acx; 709 struct acx_ctsprotect *acx;
@@ -709,7 +717,7 @@ int wl1271_acx_cts_protect(struct wl1271 *wl,
709 goto out; 717 goto out;
710 } 718 }
711 719
712 acx->role_id = wl->role_id; 720 acx->role_id = wlvif->role_id;
713 acx->ctsprotect = ctsprotect; 721 acx->ctsprotect = ctsprotect;
714 722
715 ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); 723 ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx));
@@ -839,8 +847,8 @@ out:
839 return ret; 847 return ret;
840} 848}
841 849
842int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, 850int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
843 u8 aifsn, u16 txop) 851 u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop)
844{ 852{
845 struct acx_ac_cfg *acx; 853 struct acx_ac_cfg *acx;
846 int ret = 0; 854 int ret = 0;
@@ -855,7 +863,7 @@ int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
855 goto out; 863 goto out;
856 } 864 }
857 865
858 acx->role_id = wl->role_id; 866 acx->role_id = wlvif->role_id;
859 acx->ac = ac; 867 acx->ac = ac;
860 acx->cw_min = cw_min; 868 acx->cw_min = cw_min;
861 acx->cw_max = cpu_to_le16(cw_max); 869 acx->cw_max = cpu_to_le16(cw_max);
@@ -873,7 +881,8 @@ out:
873 return ret; 881 return ret;
874} 882}
875 883
876int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, 884int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
885 u8 queue_id, u8 channel_type,
877 u8 tsid, u8 ps_scheme, u8 ack_policy, 886 u8 tsid, u8 ps_scheme, u8 ack_policy,
878 u32 apsd_conf0, u32 apsd_conf1) 887 u32 apsd_conf0, u32 apsd_conf1)
879{ 888{
@@ -889,7 +898,7 @@ int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
889 goto out; 898 goto out;
890 } 899 }
891 900
892 acx->role_id = wl->role_id; 901 acx->role_id = wlvif->role_id;
893 acx->queue_id = queue_id; 902 acx->queue_id = queue_id;
894 acx->channel_type = channel_type; 903 acx->channel_type = channel_type;
895 acx->tsid = tsid; 904 acx->tsid = tsid;
@@ -1098,7 +1107,8 @@ out:
1098 return ret; 1107 return ret;
1099} 1108}
1100 1109
1101int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable) 1110int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1111 bool enable)
1102{ 1112{
1103 struct wl1271_acx_bet_enable *acx = NULL; 1113 struct wl1271_acx_bet_enable *acx = NULL;
1104 int ret = 0; 1114 int ret = 0;
@@ -1114,7 +1124,7 @@ int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable)
1114 goto out; 1124 goto out;
1115 } 1125 }
1116 1126
1117 acx->role_id = wl->role_id; 1127 acx->role_id = wlvif->role_id;
1118 acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE; 1128 acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE;
1119 acx->max_consecutive = wl->conf.conn.bet_max_consecutive; 1129 acx->max_consecutive = wl->conf.conn.bet_max_consecutive;
1120 1130
@@ -1129,7 +1139,8 @@ out:
1129 return ret; 1139 return ret;
1130} 1140}
1131 1141
1132int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 enable, __be32 address) 1142int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1143 u8 enable, __be32 address)
1133{ 1144{
1134 struct wl1271_acx_arp_filter *acx; 1145 struct wl1271_acx_arp_filter *acx;
1135 int ret; 1146 int ret;
@@ -1142,7 +1153,7 @@ int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 enable, __be32 address)
1142 goto out; 1153 goto out;
1143 } 1154 }
1144 1155
1145 acx->role_id = wl->role_id; 1156 acx->role_id = wlvif->role_id;
1146 acx->version = ACX_IPV4_VERSION; 1157 acx->version = ACX_IPV4_VERSION;
1147 acx->enable = enable; 1158 acx->enable = enable;
1148 1159
@@ -1189,7 +1200,8 @@ out:
1189 return ret; 1200 return ret;
1190} 1201}
1191 1202
1192int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable) 1203int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1204 bool enable)
1193{ 1205{
1194 struct wl1271_acx_keep_alive_mode *acx = NULL; 1206 struct wl1271_acx_keep_alive_mode *acx = NULL;
1195 int ret = 0; 1207 int ret = 0;
@@ -1202,7 +1214,7 @@ int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable)
1202 goto out; 1214 goto out;
1203 } 1215 }
1204 1216
1205 acx->role_id = wl->role_id; 1217 acx->role_id = wlvif->role_id;
1206 acx->enabled = enable; 1218 acx->enabled = enable;
1207 1219
1208 ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx)); 1220 ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx));
@@ -1216,7 +1228,8 @@ out:
1216 return ret; 1228 return ret;
1217} 1229}
1218 1230
1219int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid) 1231int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1232 u8 index, u8 tpl_valid)
1220{ 1233{
1221 struct wl1271_acx_keep_alive_config *acx = NULL; 1234 struct wl1271_acx_keep_alive_config *acx = NULL;
1222 int ret = 0; 1235 int ret = 0;
@@ -1229,7 +1242,7 @@ int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid)
1229 goto out; 1242 goto out;
1230 } 1243 }
1231 1244
1232 acx->role_id = wl->role_id; 1245 acx->role_id = wlvif->role_id;
1233 acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval); 1246 acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval);
1234 acx->index = index; 1247 acx->index = index;
1235 acx->tpl_validation = tpl_valid; 1248 acx->tpl_validation = tpl_valid;
@@ -1247,8 +1260,8 @@ out:
1247 return ret; 1260 return ret;
1248} 1261}
1249 1262
1250int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, bool enable, 1263int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1251 s16 thold, u8 hyst) 1264 bool enable, s16 thold, u8 hyst)
1252{ 1265{
1253 struct wl1271_acx_rssi_snr_trigger *acx = NULL; 1266 struct wl1271_acx_rssi_snr_trigger *acx = NULL;
1254 int ret = 0; 1267 int ret = 0;
@@ -1263,7 +1276,7 @@ int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, bool enable,
1263 1276
1264 wl->last_rssi_event = -1; 1277 wl->last_rssi_event = -1;
1265 1278
1266 acx->role_id = wl->role_id; 1279 acx->role_id = wlvif->role_id;
1267 acx->pacing = cpu_to_le16(wl->conf.roam_trigger.trigger_pacing); 1280 acx->pacing = cpu_to_le16(wl->conf.roam_trigger.trigger_pacing);
1268 acx->metric = WL1271_ACX_TRIG_METRIC_RSSI_BEACON; 1281 acx->metric = WL1271_ACX_TRIG_METRIC_RSSI_BEACON;
1269 acx->type = WL1271_ACX_TRIG_TYPE_EDGE; 1282 acx->type = WL1271_ACX_TRIG_TYPE_EDGE;
@@ -1288,7 +1301,8 @@ out:
1288 return ret; 1301 return ret;
1289} 1302}
1290 1303
1291int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl) 1304int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl,
1305 struct wl12xx_vif *wlvif)
1292{ 1306{
1293 struct wl1271_acx_rssi_snr_avg_weights *acx = NULL; 1307 struct wl1271_acx_rssi_snr_avg_weights *acx = NULL;
1294 struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger; 1308 struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger;
@@ -1302,7 +1316,7 @@ int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl)
1302 goto out; 1316 goto out;
1303 } 1317 }
1304 1318
1305 acx->role_id = wl->role_id; 1319 acx->role_id = wlvif->role_id;
1306 acx->rssi_beacon = c->avg_weight_rssi_beacon; 1320 acx->rssi_beacon = c->avg_weight_rssi_beacon;
1307 acx->rssi_data = c->avg_weight_rssi_data; 1321 acx->rssi_data = c->avg_weight_rssi_data;
1308 acx->snr_beacon = c->avg_weight_snr_beacon; 1322 acx->snr_beacon = c->avg_weight_snr_beacon;
@@ -1367,6 +1381,7 @@ out:
1367} 1381}
1368 1382
1369int wl1271_acx_set_ht_information(struct wl1271 *wl, 1383int wl1271_acx_set_ht_information(struct wl1271 *wl,
1384 struct wl12xx_vif *wlvif,
1370 u16 ht_operation_mode) 1385 u16 ht_operation_mode)
1371{ 1386{
1372 struct wl1271_acx_ht_information *acx; 1387 struct wl1271_acx_ht_information *acx;
@@ -1380,7 +1395,7 @@ int wl1271_acx_set_ht_information(struct wl1271 *wl,
1380 goto out; 1395 goto out;
1381 } 1396 }
1382 1397
1383 acx->role_id = wl->role_id; 1398 acx->role_id = wlvif->role_id;
1384 acx->ht_protection = 1399 acx->ht_protection =
1385 (u8)(ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION); 1400 (u8)(ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION);
1386 acx->rifs_mode = 0; 1401 acx->rifs_mode = 0;
@@ -1402,7 +1417,8 @@ out:
1402} 1417}
1403 1418
1404/* Configure BA session initiator/receiver parameters setting in the FW. */ 1419/* Configure BA session initiator/receiver parameters setting in the FW. */
1405int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl) 1420int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
1421 struct wl12xx_vif *wlvif)
1406{ 1422{
1407 struct wl1271_acx_ba_initiator_policy *acx; 1423 struct wl1271_acx_ba_initiator_policy *acx;
1408 int ret; 1424 int ret;
@@ -1416,7 +1432,7 @@ int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl)
1416 } 1432 }
1417 1433
1418 /* set for the current role */ 1434 /* set for the current role */
1419 acx->role_id = wl->role_id; 1435 acx->role_id = wlvif->role_id;
1420 acx->tid_bitmap = wl->conf.ht.tx_ba_tid_bitmap; 1436 acx->tid_bitmap = wl->conf.ht.tx_ba_tid_bitmap;
1421 acx->win_size = wl->conf.ht.tx_ba_win_size; 1437 acx->win_size = wl->conf.ht.tx_ba_win_size;
1422 acx->inactivity_timeout = wl->conf.ht.inactivity_timeout; 1438 acx->inactivity_timeout = wl->conf.ht.inactivity_timeout;
@@ -1496,6 +1512,8 @@ out:
1496 1512
1497int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable) 1513int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable)
1498{ 1514{
1515 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
1516 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1499 struct wl1271_acx_ps_rx_streaming *rx_streaming; 1517 struct wl1271_acx_ps_rx_streaming *rx_streaming;
1500 u32 conf_queues, enable_queues; 1518 u32 conf_queues, enable_queues;
1501 int i, ret = 0; 1519 int i, ret = 0;
@@ -1523,7 +1541,7 @@ int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable)
1523 if (!(conf_queues & BIT(i))) 1541 if (!(conf_queues & BIT(i)))
1524 continue; 1542 continue;
1525 1543
1526 rx_streaming->role_id = wl->role_id; 1544 rx_streaming->role_id = wlvif->role_id;
1527 rx_streaming->tid = i; 1545 rx_streaming->tid = i;
1528 rx_streaming->enable = enable_queues & BIT(i); 1546 rx_streaming->enable = enable_queues & BIT(i);
1529 rx_streaming->period = wl->conf.rx_streaming.interval; 1547 rx_streaming->period = wl->conf.rx_streaming.interval;
@@ -1542,7 +1560,7 @@ out:
1542 return ret; 1560 return ret;
1543} 1561}
1544 1562
1545int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl) 1563int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1546{ 1564{
1547 struct wl1271_acx_ap_max_tx_retry *acx = NULL; 1565 struct wl1271_acx_ap_max_tx_retry *acx = NULL;
1548 int ret; 1566 int ret;
@@ -1553,7 +1571,7 @@ int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl)
1553 if (!acx) 1571 if (!acx)
1554 return -ENOMEM; 1572 return -ENOMEM;
1555 1573
1556 acx->role_id = wl->role_id; 1574 acx->role_id = wlvif->role_id;
1557 acx->max_tx_retry = cpu_to_le16(wl->conf.tx.max_tx_retries); 1575 acx->max_tx_retry = cpu_to_le16(wl->conf.tx.max_tx_retries);
1558 1576
1559 ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx)); 1577 ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx));
diff --git a/drivers/net/wireless/wl12xx/acx.h b/drivers/net/wireless/wl12xx/acx.h
index 2678e1d505f9..7fccfcc55ca0 100644
--- a/drivers/net/wireless/wl12xx/acx.h
+++ b/drivers/net/wireless/wl12xx/acx.h
@@ -1234,39 +1234,49 @@ enum {
1234}; 1234};
1235 1235
1236 1236
1237int wl1271_acx_wake_up_conditions(struct wl1271 *wl); 1237int wl1271_acx_wake_up_conditions(struct wl1271 *wl,
1238 struct wl12xx_vif *wlvif);
1238int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth); 1239int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth);
1239int wl1271_acx_tx_power(struct wl1271 *wl, int power); 1240int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1240int wl1271_acx_feature_cfg(struct wl1271 *wl); 1241 int power);
1242int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1241int wl1271_acx_mem_map(struct wl1271 *wl, 1243int wl1271_acx_mem_map(struct wl1271 *wl,
1242 struct acx_header *mem_map, size_t len); 1244 struct acx_header *mem_map, size_t len);
1243int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl); 1245int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl);
1244int wl1271_acx_pd_threshold(struct wl1271 *wl); 1246int wl1271_acx_pd_threshold(struct wl1271 *wl);
1245int wl1271_acx_slot(struct wl1271 *wl, enum acx_slot_type slot_time); 1247int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1246int wl1271_acx_group_address_tbl(struct wl1271 *wl, bool enable, 1248 enum acx_slot_type slot_time);
1247 void *mc_list, u32 mc_list_len); 1249int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1248int wl1271_acx_service_period_timeout(struct wl1271 *wl); 1250 bool enable, void *mc_list, u32 mc_list_len);
1249int wl1271_acx_rts_threshold(struct wl1271 *wl, u32 rts_threshold); 1251int wl1271_acx_service_period_timeout(struct wl1271 *wl,
1252 struct wl12xx_vif *wlvif);
1253int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1254 u32 rts_threshold);
1250int wl1271_acx_dco_itrim_params(struct wl1271 *wl); 1255int wl1271_acx_dco_itrim_params(struct wl1271 *wl);
1251int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, bool enable_filter); 1256int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1252int wl1271_acx_beacon_filter_table(struct wl1271 *wl); 1257 bool enable_filter);
1253int wl1271_acx_conn_monit_params(struct wl1271 *wl, bool enable); 1258int wl1271_acx_beacon_filter_table(struct wl1271 *wl,
1259 struct wl12xx_vif *wlvif);
1260int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1261 bool enable);
1254int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable); 1262int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable);
1255int wl12xx_acx_sg_cfg(struct wl1271 *wl); 1263int wl12xx_acx_sg_cfg(struct wl1271 *wl);
1256int wl1271_acx_cca_threshold(struct wl1271 *wl); 1264int wl1271_acx_cca_threshold(struct wl1271 *wl);
1257int wl1271_acx_bcn_dtim_options(struct wl1271 *wl); 1265int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1258int wl1271_acx_aid(struct wl1271 *wl, u16 aid); 1266int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid);
1259int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask); 1267int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask);
1260int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble); 1268int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1261int wl1271_acx_cts_protect(struct wl1271 *wl, 1269 enum acx_preamble_type preamble);
1270int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1262 enum acx_ctsprotect_type ctsprotect); 1271 enum acx_ctsprotect_type ctsprotect);
1263int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats); 1272int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats);
1264int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif); 1273int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1265int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c, 1274int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
1266 u8 idx); 1275 u8 idx);
1267int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max, 1276int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1268 u8 aifsn, u16 txop); 1277 u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop);
1269int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type, 1278int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1279 u8 queue_id, u8 channel_type,
1270 u8 tsid, u8 ps_scheme, u8 ack_policy, 1280 u8 tsid, u8 ps_scheme, u8 ack_policy,
1271 u32 apsd_conf0, u32 apsd_conf1); 1281 u32 apsd_conf0, u32 apsd_conf1);
1272int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold); 1282int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold);
@@ -1276,25 +1286,32 @@ int wl1271_acx_init_mem_config(struct wl1271 *wl);
1276int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap); 1286int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap);
1277int wl1271_acx_init_rx_interrupt(struct wl1271 *wl); 1287int wl1271_acx_init_rx_interrupt(struct wl1271 *wl);
1278int wl1271_acx_smart_reflex(struct wl1271 *wl); 1288int wl1271_acx_smart_reflex(struct wl1271 *wl);
1279int wl1271_acx_bet_enable(struct wl1271 *wl, bool enable); 1289int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1280int wl1271_acx_arp_ip_filter(struct wl1271 *wl, u8 enable, __be32 address); 1290 bool enable);
1291int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1292 u8 enable, __be32 address);
1281int wl1271_acx_pm_config(struct wl1271 *wl); 1293int wl1271_acx_pm_config(struct wl1271 *wl);
1282int wl1271_acx_keep_alive_mode(struct wl1271 *wl, bool enable); 1294int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *vif,
1283int wl1271_acx_keep_alive_config(struct wl1271 *wl, u8 index, u8 tpl_valid); 1295 bool enable);
1284int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, bool enable, 1296int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1285 s16 thold, u8 hyst); 1297 u8 index, u8 tpl_valid);
1286int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl); 1298int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1299 bool enable, s16 thold, u8 hyst);
1300int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl,
1301 struct wl12xx_vif *wlvif);
1287int wl1271_acx_set_ht_capabilities(struct wl1271 *wl, 1302int wl1271_acx_set_ht_capabilities(struct wl1271 *wl,
1288 struct ieee80211_sta_ht_cap *ht_cap, 1303 struct ieee80211_sta_ht_cap *ht_cap,
1289 bool allow_ht_operation, u8 hlid); 1304 bool allow_ht_operation, u8 hlid);
1290int wl1271_acx_set_ht_information(struct wl1271 *wl, 1305int wl1271_acx_set_ht_information(struct wl1271 *wl,
1306 struct wl12xx_vif *wlvif,
1291 u16 ht_operation_mode); 1307 u16 ht_operation_mode);
1292int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl); 1308int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
1309 struct wl12xx_vif *wlvif);
1293int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index, 1310int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
1294 u16 ssn, bool enable, u8 peer_hlid); 1311 u16 ssn, bool enable, u8 peer_hlid);
1295int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime); 1312int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime);
1296int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable); 1313int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, bool enable);
1297int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl); 1314int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1298int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif); 1315int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1299int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr); 1316int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr);
1300int wl1271_acx_fm_coex(struct wl1271 *wl); 1317int wl1271_acx_fm_coex(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index 1f29eab82146..918faca517cf 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -567,9 +567,9 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
567 goto out; 567 goto out;
568 } 568 }
569 569
570 wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wl->role_id); 570 wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wlvif->role_id);
571 571
572 cmd->role_id = wl->role_id; 572 cmd->role_id = wlvif->role_id;
573 if (wl->band == IEEE80211_BAND_5GHZ) 573 if (wl->band == IEEE80211_BAND_5GHZ)
574 cmd->band = WL12XX_BAND_5GHZ; 574 cmd->band = WL12XX_BAND_5GHZ;
575 cmd->channel = wl->channel; 575 cmd->channel = wl->channel;
@@ -592,7 +592,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
592 592
593 wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " 593 wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d "
594 "basic_rate_set: 0x%x, remote_rates: 0x%x", 594 "basic_rate_set: 0x%x, remote_rates: 0x%x",
595 wl->role_id, cmd->sta.hlid, cmd->sta.session, 595 wlvif->role_id, cmd->sta.hlid, cmd->sta.session,
596 wlvif->basic_rate_set, wlvif->rate_set); 596 wlvif->basic_rate_set, wlvif->rate_set);
597 597
598 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); 598 ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0);
@@ -615,7 +615,7 @@ out:
615} 615}
616 616
617/* use this function to stop ibss as well */ 617/* use this function to stop ibss as well */
618int wl12xx_cmd_role_stop_sta(struct wl1271 *wl) 618int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
619{ 619{
620 struct wl12xx_cmd_role_stop *cmd; 620 struct wl12xx_cmd_role_stop *cmd;
621 int ret; 621 int ret;
@@ -629,9 +629,9 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl)
629 goto out; 629 goto out;
630 } 630 }
631 631
632 wl1271_debug(DEBUG_CMD, "cmd role stop sta %d", wl->role_id); 632 wl1271_debug(DEBUG_CMD, "cmd role stop sta %d", wlvif->role_id);
633 633
634 cmd->role_id = wl->role_id; 634 cmd->role_id = wlvif->role_id;
635 cmd->disc_type = DISCONNECT_IMMEDIATE; 635 cmd->disc_type = DISCONNECT_IMMEDIATE;
636 cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED); 636 cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED);
637 637
@@ -656,7 +656,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
656 struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf; 656 struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf;
657 int ret; 657 int ret;
658 658
659 wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wl->role_id); 659 wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id);
660 660
661 /* trying to use hidden SSID with an old hostapd version */ 661 /* trying to use hidden SSID with an old hostapd version */
662 if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) { 662 if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) {
@@ -679,7 +679,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
679 if (ret < 0) 679 if (ret < 0)
680 goto out_free_global; 680 goto out_free_global;
681 681
682 cmd->role_id = wl->role_id; 682 cmd->role_id = wlvif->role_id;
683 cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period); 683 cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period);
684 cmd->ap.bss_index = WL1271_AP_BSS_INDEX; 684 cmd->ap.bss_index = WL1271_AP_BSS_INDEX;
685 cmd->ap.global_hlid = wl->ap_global_hlid; 685 cmd->ap.global_hlid = wl->ap_global_hlid;
@@ -737,7 +737,7 @@ out:
737 return ret; 737 return ret;
738} 738}
739 739
740int wl12xx_cmd_role_stop_ap(struct wl1271 *wl) 740int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
741{ 741{
742 struct wl12xx_cmd_role_stop *cmd; 742 struct wl12xx_cmd_role_stop *cmd;
743 int ret; 743 int ret;
@@ -748,9 +748,9 @@ int wl12xx_cmd_role_stop_ap(struct wl1271 *wl)
748 goto out; 748 goto out;
749 } 749 }
750 750
751 wl1271_debug(DEBUG_CMD, "cmd role stop ap %d", wl->role_id); 751 wl1271_debug(DEBUG_CMD, "cmd role stop ap %d", wlvif->role_id);
752 752
753 cmd->role_id = wl->role_id; 753 cmd->role_id = wlvif->role_id;
754 754
755 ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); 755 ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0);
756 if (ret < 0) { 756 if (ret < 0) {
@@ -781,9 +781,9 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
781 goto out; 781 goto out;
782 } 782 }
783 783
784 wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wl->role_id); 784 wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wlvif->role_id);
785 785
786 cmd->role_id = wl->role_id; 786 cmd->role_id = wlvif->role_id;
787 if (wl->band == IEEE80211_BAND_5GHZ) 787 if (wl->band == IEEE80211_BAND_5GHZ)
788 cmd->band = WL12XX_BAND_5GHZ; 788 cmd->band = WL12XX_BAND_5GHZ;
789 cmd->channel = wl->channel; 789 cmd->channel = wl->channel;
@@ -806,7 +806,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
806 806
807 wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " 807 wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d "
808 "basic_rate_set: 0x%x, remote_rates: 0x%x", 808 "basic_rate_set: 0x%x, remote_rates: 0x%x",
809 wl->role_id, cmd->sta.hlid, cmd->sta.session, 809 wlvif->role_id, cmd->sta.hlid, cmd->sta.session,
810 wlvif->basic_rate_set, wlvif->rate_set); 810 wlvif->basic_rate_set, wlvif->rate_set);
811 811
812 wl1271_debug(DEBUG_CMD, "vif->bss_conf.bssid = %pM", 812 wl1271_debug(DEBUG_CMD, "vif->bss_conf.bssid = %pM",
@@ -966,7 +966,8 @@ out:
966 return ret; 966 return ret;
967} 967}
968 968
969int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode) 969int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
970 u8 ps_mode)
970{ 971{
971 struct wl1271_cmd_ps_params *ps_params = NULL; 972 struct wl1271_cmd_ps_params *ps_params = NULL;
972 int ret = 0; 973 int ret = 0;
@@ -979,7 +980,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode)
979 goto out; 980 goto out;
980 } 981 }
981 982
982 ps_params->role_id = wl->role_id; 983 ps_params->role_id = wlvif->role_id;
983 ps_params->ps_mode = ps_mode; 984 ps_params->ps_mode = ps_mode;
984 985
985 ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, 986 ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
diff --git a/drivers/net/wireless/wl12xx/cmd.h b/drivers/net/wireless/wl12xx/cmd.h
index d5749f5b3bf1..bf2c45b8b911 100644
--- a/drivers/net/wireless/wl12xx/cmd.h
+++ b/drivers/net/wireless/wl12xx/cmd.h
@@ -42,15 +42,16 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
42int wl12xx_cmd_role_start_dev(struct wl1271 *wl); 42int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
43int wl12xx_cmd_role_stop_dev(struct wl1271 *wl); 43int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
44int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif); 44int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
45int wl12xx_cmd_role_stop_sta(struct wl1271 *wl); 45int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
46int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif); 46int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
47int wl12xx_cmd_role_stop_ap(struct wl1271 *wl); 47int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
48int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif); 48int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif);
49int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); 49int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
50int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); 50int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
51int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); 51int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
52int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); 52int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
53int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode); 53int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
54 u8 ps_mode);
54int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, 55int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
55 size_t len); 56 size_t len);
56int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, 57int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 8f88ad6496f9..3309fea2e90e 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -620,11 +620,19 @@ static ssize_t beacon_filtering_write(struct file *file,
620 size_t count, loff_t *ppos) 620 size_t count, loff_t *ppos)
621{ 621{
622 struct wl1271 *wl = file->private_data; 622 struct wl1271 *wl = file->private_data;
623 struct ieee80211_vif *vif;
624 struct wl12xx_vif *wlvif;
623 char buf[10]; 625 char buf[10];
624 size_t len; 626 size_t len;
625 unsigned long value; 627 unsigned long value;
626 int ret; 628 int ret;
627 629
630 if (!wl->vif)
631 return -EINVAL;
632
633 vif = wl->vif;
634 wlvif = wl12xx_vif_to_data(vif);
635
628 len = min(count, sizeof(buf) - 1); 636 len = min(count, sizeof(buf) - 1);
629 if (copy_from_user(buf, user_buf, len)) 637 if (copy_from_user(buf, user_buf, len))
630 return -EFAULT; 638 return -EFAULT;
@@ -642,7 +650,7 @@ static ssize_t beacon_filtering_write(struct file *file,
642 if (ret < 0) 650 if (ret < 0)
643 goto out; 651 goto out;
644 652
645 ret = wl1271_acx_beacon_filter_opt(wl, !!value); 653 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, !!value);
646 654
647 wl1271_ps_elp_sleep(wl); 655 wl1271_ps_elp_sleep(wl);
648out: 656out:
diff --git a/drivers/net/wireless/wl12xx/event.c b/drivers/net/wireless/wl12xx/event.c
index 072addc0bffc..28a4396fb8e4 100644
--- a/drivers/net/wireless/wl12xx/event.c
+++ b/drivers/net/wireless/wl12xx/event.c
@@ -64,8 +64,8 @@ void wl1271_pspoll_work(struct work_struct *work)
64 if (ret < 0) 64 if (ret < 0)
65 goto out; 65 goto out;
66 66
67 wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, wlvif->basic_rate, 67 wl1271_ps_set_mode(wl, wlvif, STATION_POWER_SAVE_MODE,
68 true); 68 wlvif->basic_rate, true);
69 69
70 wl1271_ps_elp_sleep(wl); 70 wl1271_ps_elp_sleep(wl);
71out: 71out:
@@ -85,7 +85,7 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl,
85 85
86 /* force active mode receive data from the AP */ 86 /* force active mode receive data from the AP */
87 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { 87 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) {
88 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 88 ret = wl1271_ps_set_mode(wl, wlvif, STATION_ACTIVE_MODE,
89 wlvif->basic_rate, true); 89 wlvif->basic_rate, true);
90 if (ret < 0) 90 if (ret < 0)
91 return; 91 return;
@@ -124,7 +124,8 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
124 124
125 if (wl->psm_entry_retry < total_retries) { 125 if (wl->psm_entry_retry < total_retries) {
126 wl->psm_entry_retry++; 126 wl->psm_entry_retry++;
127 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 127 ret = wl1271_ps_set_mode(wl, wlvif,
128 STATION_POWER_SAVE_MODE,
128 wlvif->basic_rate, true); 129 wlvif->basic_rate, true);
129 } else { 130 } else {
130 wl1271_info("No ack to nullfunc from AP."); 131 wl1271_info("No ack to nullfunc from AP.");
@@ -136,7 +137,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
136 wl->psm_entry_retry = 0; 137 wl->psm_entry_retry = 0;
137 138
138 /* enable beacon filtering */ 139 /* enable beacon filtering */
139 ret = wl1271_acx_beacon_filter_opt(wl, true); 140 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true);
140 if (ret < 0) 141 if (ret < 0)
141 break; 142 break;
142 143
@@ -146,7 +147,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
146 */ 147 */
147 if (wl->band == IEEE80211_BAND_2GHZ) 148 if (wl->band == IEEE80211_BAND_2GHZ)
148 /* enable beacon early termination */ 149 /* enable beacon early termination */
149 ret = wl1271_acx_bet_enable(wl, true); 150 ret = wl1271_acx_bet_enable(wl, wlvif, true);
150 151
151 if (wl->ps_compl) { 152 if (wl->ps_compl) {
152 complete(wl->ps_compl); 153 complete(wl->ps_compl);
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index e54cc693ff69..1eaa0a3d9273 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -233,35 +233,37 @@ int wl1271_init_phy_config(struct wl1271 *wl)
233 return 0; 233 return 0;
234} 234}
235 235
236static int wl12xx_init_phy_vif_config(struct wl1271 *wl) 236static int wl12xx_init_phy_vif_config(struct wl1271 *wl,
237 struct wl12xx_vif *wlvif)
237{ 238{
238 int ret; 239 int ret;
239 240
240 ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME); 241 ret = wl1271_acx_slot(wl, wlvif, DEFAULT_SLOT_TIME);
241 if (ret < 0) 242 if (ret < 0)
242 return ret; 243 return ret;
243 244
244 ret = wl1271_acx_service_period_timeout(wl); 245 ret = wl1271_acx_service_period_timeout(wl, wlvif);
245 if (ret < 0) 246 if (ret < 0)
246 return ret; 247 return ret;
247 248
248 ret = wl1271_acx_rts_threshold(wl, wl->hw->wiphy->rts_threshold); 249 ret = wl1271_acx_rts_threshold(wl, wlvif, wl->hw->wiphy->rts_threshold);
249 if (ret < 0) 250 if (ret < 0)
250 return ret; 251 return ret;
251 252
252 return 0; 253 return 0;
253} 254}
254 255
255static int wl1271_init_beacon_filter(struct wl1271 *wl) 256static int wl1271_init_beacon_filter(struct wl1271 *wl,
257 struct wl12xx_vif *wlvif)
256{ 258{
257 int ret; 259 int ret;
258 260
259 /* disable beacon filtering at this stage */ 261 /* disable beacon filtering at this stage */
260 ret = wl1271_acx_beacon_filter_opt(wl, false); 262 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
261 if (ret < 0) 263 if (ret < 0)
262 return ret; 264 return ret;
263 265
264 ret = wl1271_acx_beacon_filter_table(wl); 266 ret = wl1271_acx_beacon_filter_table(wl, wlvif);
265 if (ret < 0) 267 if (ret < 0)
266 return ret; 268 return ret;
267 269
@@ -294,11 +296,12 @@ int wl1271_init_energy_detection(struct wl1271 *wl)
294 return 0; 296 return 0;
295} 297}
296 298
297static int wl1271_init_beacon_broadcast(struct wl1271 *wl) 299static int wl1271_init_beacon_broadcast(struct wl1271 *wl,
300 struct wl12xx_vif *wlvif)
298{ 301{
299 int ret; 302 int ret;
300 303
301 ret = wl1271_acx_bcn_dtim_options(wl); 304 ret = wl1271_acx_bcn_dtim_options(wl, wlvif);
302 if (ret < 0) 305 if (ret < 0)
303 return ret; 306 return ret;
304 307
@@ -352,20 +355,22 @@ static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
352 return 0; 355 return 0;
353} 356}
354 357
355static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) 358static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl,
359 struct ieee80211_vif *vif)
356{ 360{
361 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
357 int ret, i; 362 int ret, i;
358 363
359 /* disable all keep-alive templates */ 364 /* disable all keep-alive templates */
360 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { 365 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
361 ret = wl1271_acx_keep_alive_config(wl, i, 366 ret = wl1271_acx_keep_alive_config(wl, wlvif, i,
362 ACX_KEEP_ALIVE_TPL_INVALID); 367 ACX_KEEP_ALIVE_TPL_INVALID);
363 if (ret < 0) 368 if (ret < 0)
364 return ret; 369 return ret;
365 } 370 }
366 371
367 /* disable the keep-alive feature */ 372 /* disable the keep-alive feature */
368 ret = wl1271_acx_keep_alive_mode(wl, false); 373 ret = wl1271_acx_keep_alive_mode(wl, wlvif, false);
369 if (ret < 0) 374 if (ret < 0)
370 return ret; 375 return ret;
371 376
@@ -410,7 +415,7 @@ int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif)
410 * when operating as AP we want to receive external beacons for 415 * when operating as AP we want to receive external beacons for
411 * configuring ERP protection. 416 * configuring ERP protection.
412 */ 417 */
413 ret = wl1271_acx_beacon_filter_opt(wl, false); 418 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
414 if (ret < 0) 419 if (ret < 0)
415 return ret; 420 return ret;
416 421
@@ -495,7 +500,7 @@ static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif)
495 wl->ba_support = true; 500 wl->ba_support = true;
496 501
497 /* 802.11n initiator BA session setting */ 502 /* 802.11n initiator BA session setting */
498 return wl12xx_acx_set_ba_initiator_policy(wl); 503 return wl12xx_acx_set_ba_initiator_policy(wl, wlvif);
499} 504}
500 505
501int wl1271_chip_specific_init(struct wl1271 *wl) 506int wl1271_chip_specific_init(struct wl1271 *wl)
@@ -519,31 +524,31 @@ out:
519} 524}
520 525
521/* vif-specifc initialization */ 526/* vif-specifc initialization */
522static int wl12xx_init_sta_role(struct wl1271 *wl, struct ieee80211_vif *vif) 527static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
523{ 528{
524 int ret; 529 int ret;
525 530
526 ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0); 531 ret = wl1271_acx_group_address_tbl(wl, wlvif, true, NULL, 0);
527 if (ret < 0) 532 if (ret < 0)
528 return ret; 533 return ret;
529 534
530 /* Initialize connection monitoring thresholds */ 535 /* Initialize connection monitoring thresholds */
531 ret = wl1271_acx_conn_monit_params(wl, false); 536 ret = wl1271_acx_conn_monit_params(wl, wlvif, false);
532 if (ret < 0) 537 if (ret < 0)
533 return ret; 538 return ret;
534 539
535 /* Beacon filtering */ 540 /* Beacon filtering */
536 ret = wl1271_init_beacon_filter(wl); 541 ret = wl1271_init_beacon_filter(wl, wlvif);
537 if (ret < 0) 542 if (ret < 0)
538 return ret; 543 return ret;
539 544
540 /* Beacons and broadcast settings */ 545 /* Beacons and broadcast settings */
541 ret = wl1271_init_beacon_broadcast(wl); 546 ret = wl1271_init_beacon_broadcast(wl, wlvif);
542 if (ret < 0) 547 if (ret < 0)
543 return ret; 548 return ret;
544 549
545 /* Configure rssi/snr averaging weights */ 550 /* Configure rssi/snr averaging weights */
546 ret = wl1271_acx_rssi_snr_avg_weights(wl); 551 ret = wl1271_acx_rssi_snr_avg_weights(wl, wlvif);
547 if (ret < 0) 552 if (ret < 0)
548 return ret; 553 return ret;
549 554
@@ -551,16 +556,16 @@ static int wl12xx_init_sta_role(struct wl1271 *wl, struct ieee80211_vif *vif)
551} 556}
552 557
553/* vif-specific intialization */ 558/* vif-specific intialization */
554static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif) 559static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
555{ 560{
556 int ret; 561 int ret;
557 562
558 ret = wl1271_acx_ap_max_tx_retry(wl); 563 ret = wl1271_acx_ap_max_tx_retry(wl, wlvif);
559 if (ret < 0) 564 if (ret < 0)
560 return ret; 565 return ret;
561 566
562 /* initialize Tx power */ 567 /* initialize Tx power */
563 ret = wl1271_acx_tx_power(wl, wl->power_level); 568 ret = wl1271_acx_tx_power(wl, wlvif, wl->power_level);
564 if (ret < 0) 569 if (ret < 0)
565 return ret; 570 return ret;
566 571
@@ -582,7 +587,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
582 if (ret < 0) 587 if (ret < 0)
583 return ret; 588 return ret;
584 589
585 ret = wl12xx_init_ap_role(wl, vif); 590 ret = wl12xx_init_ap_role(wl, wlvif);
586 if (ret < 0) 591 if (ret < 0)
587 return ret; 592 return ret;
588 } else { 593 } else {
@@ -590,25 +595,25 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
590 if (ret < 0) 595 if (ret < 0)
591 return ret; 596 return ret;
592 597
593 ret = wl12xx_init_sta_role(wl, vif); 598 ret = wl12xx_init_sta_role(wl, wlvif);
594 if (ret < 0) 599 if (ret < 0)
595 return ret; 600 return ret;
596 } 601 }
597 602
598 wl12xx_init_phy_vif_config(wl); 603 wl12xx_init_phy_vif_config(wl, wlvif);
599 604
600 /* Default TID/AC configuration */ 605 /* Default TID/AC configuration */
601 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); 606 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
602 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 607 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
603 conf_ac = &wl->conf.tx.ac_conf[i]; 608 conf_ac = &wl->conf.tx.ac_conf[i];
604 ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, 609 ret = wl1271_acx_ac_cfg(wl, wlvif, conf_ac->ac,
605 conf_ac->cw_max, conf_ac->aifsn, 610 conf_ac->cw_min, conf_ac->cw_max,
606 conf_ac->tx_op_limit); 611 conf_ac->aifsn, conf_ac->tx_op_limit);
607 if (ret < 0) 612 if (ret < 0)
608 return ret; 613 return ret;
609 614
610 conf_tid = &wl->conf.tx.tid_conf[i]; 615 conf_tid = &wl->conf.tx.tid_conf[i];
611 ret = wl1271_acx_tid_cfg(wl, 616 ret = wl1271_acx_tid_cfg(wl, wlvif,
612 conf_tid->queue_id, 617 conf_tid->queue_id,
613 conf_tid->channel_type, 618 conf_tid->channel_type,
614 conf_tid->tsid, 619 conf_tid->tsid,
@@ -621,7 +626,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
621 } 626 }
622 627
623 /* Configure HW encryption */ 628 /* Configure HW encryption */
624 ret = wl1271_acx_feature_cfg(wl); 629 ret = wl1271_acx_feature_cfg(wl, wlvif);
625 if (ret < 0) 630 if (ret < 0)
626 return ret; 631 return ret;
627 632
@@ -629,7 +634,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
629 if (is_ap) 634 if (is_ap)
630 ret = wl1271_ap_hw_init_post_mem(wl, vif); 635 ret = wl1271_ap_hw_init_post_mem(wl, vif);
631 else 636 else
632 ret = wl1271_sta_hw_init_post_mem(wl); 637 ret = wl1271_sta_hw_init_post_mem(wl, vif);
633 638
634 if (ret < 0) 639 if (ret < 0)
635 return ret; 640 return ret;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index e0a557fc3a31..b3d4ef5b900d 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -402,7 +402,10 @@ static LIST_HEAD(wl_list);
402 402
403static int wl1271_check_operstate(struct wl1271 *wl, unsigned char operstate) 403static int wl1271_check_operstate(struct wl1271 *wl, unsigned char operstate)
404{ 404{
405 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
406 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
405 int ret; 407 int ret;
408
406 if (operstate != IF_OPER_UP) 409 if (operstate != IF_OPER_UP)
407 return 0; 410 return 0;
408 411
@@ -413,7 +416,7 @@ static int wl1271_check_operstate(struct wl1271 *wl, unsigned char operstate)
413 if (ret < 0) 416 if (ret < 0)
414 return ret; 417 return ret;
415 418
416 wl12xx_croc(wl, wl->role_id); 419 wl12xx_croc(wl, wlvif->role_id);
417 420
418 wl1271_info("Association completed."); 421 wl1271_info("Association completed.");
419 return 0; 422 return 0;
@@ -695,7 +698,7 @@ static int wl1271_plt_init(struct wl1271 *wl)
695 goto out_free_memmap; 698 goto out_free_memmap;
696 699
697 /* Initialize connection monitoring thresholds */ 700 /* Initialize connection monitoring thresholds */
698 ret = wl1271_acx_conn_monit_params(wl, false); 701 ret = wl1271_acx_conn_monit_params(wl, NULL, false); /* TODO: fix */
699 if (ret < 0) 702 if (ret < 0)
700 goto out_free_memmap; 703 goto out_free_memmap;
701 704
@@ -727,14 +730,16 @@ static int wl1271_plt_init(struct wl1271 *wl)
727 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); 730 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
728 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 731 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
729 conf_ac = &wl->conf.tx.ac_conf[i]; 732 conf_ac = &wl->conf.tx.ac_conf[i];
730 ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, 733 /* TODO: fix */
734 ret = wl1271_acx_ac_cfg(wl, NULL, conf_ac->ac, conf_ac->cw_min,
731 conf_ac->cw_max, conf_ac->aifsn, 735 conf_ac->cw_max, conf_ac->aifsn,
732 conf_ac->tx_op_limit); 736 conf_ac->tx_op_limit);
733 if (ret < 0) 737 if (ret < 0)
734 goto out_free_memmap; 738 goto out_free_memmap;
735 739
736 conf_tid = &wl->conf.tx.tid_conf[i]; 740 conf_tid = &wl->conf.tx.tid_conf[i];
737 ret = wl1271_acx_tid_cfg(wl, conf_tid->queue_id, 741 /* TODO: fix */
742 ret = wl1271_acx_tid_cfg(wl, NULL, conf_tid->queue_id,
738 conf_tid->channel_type, 743 conf_tid->channel_type,
739 conf_tid->tsid, 744 conf_tid->tsid,
740 conf_tid->ps_scheme, 745 conf_tid->ps_scheme,
@@ -1631,7 +1636,7 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl,
1631 DECLARE_COMPLETION_ONSTACK(compl); 1636 DECLARE_COMPLETION_ONSTACK(compl);
1632 1637
1633 wl->ps_compl = &compl; 1638 wl->ps_compl = &compl;
1634 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 1639 ret = wl1271_ps_set_mode(wl, wlvif, STATION_POWER_SAVE_MODE,
1635 wlvif->basic_rate, true); 1640 wlvif->basic_rate, true);
1636 if (ret < 0) 1641 if (ret < 0)
1637 goto out_sleep; 1642 goto out_sleep;
@@ -1664,7 +1669,8 @@ out:
1664 1669
1665} 1670}
1666 1671
1667static int wl1271_configure_suspend_ap(struct wl1271 *wl) 1672static int wl1271_configure_suspend_ap(struct wl1271 *wl,
1673 struct wl12xx_vif *wlvif)
1668{ 1674{
1669 int ret = 0; 1675 int ret = 0;
1670 1676
@@ -1677,7 +1683,7 @@ static int wl1271_configure_suspend_ap(struct wl1271 *wl)
1677 if (ret < 0) 1683 if (ret < 0)
1678 goto out_unlock; 1684 goto out_unlock;
1679 1685
1680 ret = wl1271_acx_beacon_filter_opt(wl, true); 1686 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true);
1681 1687
1682 wl1271_ps_elp_sleep(wl); 1688 wl1271_ps_elp_sleep(wl);
1683out_unlock: 1689out_unlock:
@@ -1692,7 +1698,7 @@ static int wl1271_configure_suspend(struct wl1271 *wl,
1692 if (wlvif->bss_type == BSS_TYPE_STA_BSS) 1698 if (wlvif->bss_type == BSS_TYPE_STA_BSS)
1693 return wl1271_configure_suspend_sta(wl, wlvif); 1699 return wl1271_configure_suspend_sta(wl, wlvif);
1694 if (wlvif->bss_type == BSS_TYPE_AP_BSS) 1700 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
1695 return wl1271_configure_suspend_ap(wl); 1701 return wl1271_configure_suspend_ap(wl, wlvif);
1696 return 0; 1702 return 0;
1697} 1703}
1698 1704
@@ -1714,10 +1720,10 @@ static void wl1271_configure_resume(struct wl1271 *wl,
1714 if (is_sta) { 1720 if (is_sta) {
1715 /* exit psm if it wasn't configured */ 1721 /* exit psm if it wasn't configured */
1716 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) 1722 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags))
1717 wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 1723 wl1271_ps_set_mode(wl, wlvif, STATION_ACTIVE_MODE,
1718 wlvif->basic_rate, true); 1724 wlvif->basic_rate, true);
1719 } else if (is_ap) { 1725 } else if (is_ap) {
1720 wl1271_acx_beacon_filter_opt(wl, false); 1726 wl1271_acx_beacon_filter_opt(wl, wlvif, false);
1721 } 1727 }
1722 1728
1723 wl1271_ps_elp_sleep(wl); 1729 wl1271_ps_elp_sleep(wl);
@@ -1850,6 +1856,7 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1850static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) 1856static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
1851{ 1857{
1852 wlvif->bss_type = MAX_BSS_TYPE; 1858 wlvif->bss_type = MAX_BSS_TYPE;
1859 wlvif->role_id = WL12XX_INVALID_ROLE_ID;
1853 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; 1860 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
1854 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; 1861 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
1855 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; 1862 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
@@ -1957,7 +1964,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
1957 } 1964 }
1958 1965
1959 ret = wl12xx_cmd_role_enable(wl, vif->addr, 1966 ret = wl12xx_cmd_role_enable(wl, vif->addr,
1960 role_type, &wl->role_id); 1967 role_type, &wlvif->role_id);
1961 if (ret < 0) 1968 if (ret < 0)
1962 goto irq_disable; 1969 goto irq_disable;
1963 1970
@@ -2065,7 +2072,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
2065 goto deinit; 2072 goto deinit;
2066 } 2073 }
2067 2074
2068 ret = wl12xx_cmd_role_disable(wl, &wl->role_id); 2075 ret = wl12xx_cmd_role_disable(wl, &wlvif->role_id);
2069 if (ret < 0) 2076 if (ret < 0)
2070 goto deinit; 2077 goto deinit;
2071 2078
@@ -2123,7 +2130,7 @@ deinit:
2123 wl->ap_fw_ps_map = 0; 2130 wl->ap_fw_ps_map = 0;
2124 wl->ap_ps_map = 0; 2131 wl->ap_ps_map = 0;
2125 wl->sched_scanning = false; 2132 wl->sched_scanning = false;
2126 wl->role_id = WL12XX_INVALID_ROLE_ID; 2133 wlvif->role_id = WL12XX_INVALID_ROLE_ID;
2127 wl->dev_role_id = WL12XX_INVALID_ROLE_ID; 2134 wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
2128 memset(wl->roles_map, 0, sizeof(wl->roles_map)); 2135 memset(wl->roles_map, 0, sizeof(wl->roles_map));
2129 memset(wl->links_map, 0, sizeof(wl->links_map)); 2136 memset(wl->links_map, 0, sizeof(wl->links_map));
@@ -2213,11 +2220,11 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2213 * the join. The acx_aid starts the keep-alive process, and the order 2220 * the join. The acx_aid starts the keep-alive process, and the order
2214 * of the commands below is relevant. 2221 * of the commands below is relevant.
2215 */ 2222 */
2216 ret = wl1271_acx_keep_alive_mode(wl, true); 2223 ret = wl1271_acx_keep_alive_mode(wl, wlvif, true);
2217 if (ret < 0) 2224 if (ret < 0)
2218 goto out; 2225 goto out;
2219 2226
2220 ret = wl1271_acx_aid(wl, wlvif->aid); 2227 ret = wl1271_acx_aid(wl, wlvif, wlvif->aid);
2221 if (ret < 0) 2228 if (ret < 0)
2222 goto out; 2229 goto out;
2223 2230
@@ -2225,7 +2232,8 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2225 if (ret < 0) 2232 if (ret < 0)
2226 goto out; 2233 goto out;
2227 2234
2228 ret = wl1271_acx_keep_alive_config(wl, CMD_TEMPL_KLV_IDX_NULL_DATA, 2235 ret = wl1271_acx_keep_alive_config(wl, wlvif,
2236 CMD_TEMPL_KLV_IDX_NULL_DATA,
2229 ACX_KEEP_ALIVE_TPL_VALID); 2237 ACX_KEEP_ALIVE_TPL_VALID);
2230 if (ret < 0) 2238 if (ret < 0)
2231 goto out; 2239 goto out;
@@ -2234,7 +2242,7 @@ out:
2234 return ret; 2242 return ret;
2235} 2243}
2236 2244
2237static int wl1271_unjoin(struct wl1271 *wl) 2245static int wl1271_unjoin(struct wl1271 *wl, struct wl12xx_vif *wlvif)
2238{ 2246{
2239 int ret; 2247 int ret;
2240 2248
@@ -2244,7 +2252,7 @@ static int wl1271_unjoin(struct wl1271 *wl)
2244 } 2252 }
2245 2253
2246 /* to stop listening to a channel, we disconnect */ 2254 /* to stop listening to a channel, we disconnect */
2247 ret = wl12xx_cmd_role_stop_sta(wl); 2255 ret = wl12xx_cmd_role_stop_sta(wl, wlvif);
2248 if (ret < 0) 2256 if (ret < 0)
2249 goto out; 2257 goto out;
2250 2258
@@ -2295,7 +2303,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2295 if (ret < 0) 2303 if (ret < 0)
2296 goto out; 2304 goto out;
2297 ret = wl1271_acx_keep_alive_config( 2305 ret = wl1271_acx_keep_alive_config(
2298 wl, CMD_TEMPL_KLV_IDX_NULL_DATA, 2306 wl, wlvif, CMD_TEMPL_KLV_IDX_NULL_DATA,
2299 ACX_KEEP_ALIVE_TPL_INVALID); 2307 ACX_KEEP_ALIVE_TPL_INVALID);
2300 if (ret < 0) 2308 if (ret < 0)
2301 goto out; 2309 goto out;
@@ -2454,7 +2462,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2454 */ 2462 */
2455 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { 2463 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
2456 wl1271_debug(DEBUG_PSM, "psm enabled"); 2464 wl1271_debug(DEBUG_PSM, "psm enabled");
2457 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 2465 ret = wl1271_ps_set_mode(wl, wlvif,
2466 STATION_POWER_SAVE_MODE,
2458 wlvif->basic_rate, true); 2467 wlvif->basic_rate, true);
2459 } 2468 }
2460 } else if (!(conf->flags & IEEE80211_CONF_PS) && 2469 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
@@ -2464,12 +2473,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2464 clear_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags); 2473 clear_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags);
2465 2474
2466 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) 2475 if (test_bit(WL1271_FLAG_PSM, &wl->flags))
2467 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 2476 ret = wl1271_ps_set_mode(wl, wlvif,
2477 STATION_ACTIVE_MODE,
2468 wlvif->basic_rate, true); 2478 wlvif->basic_rate, true);
2469 } 2479 }
2470 2480
2471 if (conf->power_level != wl->power_level) { 2481 if (conf->power_level != wl->power_level) {
2472 ret = wl1271_acx_tx_power(wl, conf->power_level); 2482 ret = wl1271_acx_tx_power(wl, wlvif, conf->power_level);
2473 if (ret < 0) 2483 if (ret < 0)
2474 goto out_sleep; 2484 goto out_sleep;
2475 2485
@@ -2558,9 +2568,11 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw,
2558 2568
2559 if (wlvif->bss_type != BSS_TYPE_AP_BSS) { 2569 if (wlvif->bss_type != BSS_TYPE_AP_BSS) {
2560 if (*total & FIF_ALLMULTI) 2570 if (*total & FIF_ALLMULTI)
2561 ret = wl1271_acx_group_address_tbl(wl, false, NULL, 0); 2571 ret = wl1271_acx_group_address_tbl(wl, wlvif, false,
2572 NULL, 0);
2562 else if (fp) 2573 else if (fp)
2563 ret = wl1271_acx_group_address_tbl(wl, fp->enabled, 2574 ret = wl1271_acx_group_address_tbl(wl, wlvif,
2575 fp->enabled,
2564 fp->mc_list, 2576 fp->mc_list,
2565 fp->mc_list_length); 2577 fp->mc_list_length);
2566 if (ret < 0) 2578 if (ret < 0)
@@ -3051,6 +3063,8 @@ out:
3051static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 3063static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
3052{ 3064{
3053 struct wl1271 *wl = hw->priv; 3065 struct wl1271 *wl = hw->priv;
3066 struct ieee80211_vif *vif = wl->vif;
3067 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
3054 int ret = 0; 3068 int ret = 0;
3055 3069
3056 mutex_lock(&wl->mutex); 3070 mutex_lock(&wl->mutex);
@@ -3064,7 +3078,7 @@ static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
3064 if (ret < 0) 3078 if (ret < 0)
3065 goto out; 3079 goto out;
3066 3080
3067 ret = wl1271_acx_rts_threshold(wl, value); 3081 ret = wl1271_acx_rts_threshold(wl, wlvif, value);
3068 if (ret < 0) 3082 if (ret < 0)
3069 wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret); 3083 wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret);
3070 3084
@@ -3190,16 +3204,18 @@ static int wl1271_ap_set_probe_resp_tmpl(struct wl1271 *wl,
3190} 3204}
3191 3205
3192static int wl1271_bss_erp_info_changed(struct wl1271 *wl, 3206static int wl1271_bss_erp_info_changed(struct wl1271 *wl,
3207 struct ieee80211_vif *vif,
3193 struct ieee80211_bss_conf *bss_conf, 3208 struct ieee80211_bss_conf *bss_conf,
3194 u32 changed) 3209 u32 changed)
3195{ 3210{
3211 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
3196 int ret = 0; 3212 int ret = 0;
3197 3213
3198 if (changed & BSS_CHANGED_ERP_SLOT) { 3214 if (changed & BSS_CHANGED_ERP_SLOT) {
3199 if (bss_conf->use_short_slot) 3215 if (bss_conf->use_short_slot)
3200 ret = wl1271_acx_slot(wl, SLOT_TIME_SHORT); 3216 ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_SHORT);
3201 else 3217 else
3202 ret = wl1271_acx_slot(wl, SLOT_TIME_LONG); 3218 ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_LONG);
3203 if (ret < 0) { 3219 if (ret < 0) {
3204 wl1271_warning("Set slot time failed %d", ret); 3220 wl1271_warning("Set slot time failed %d", ret);
3205 goto out; 3221 goto out;
@@ -3208,16 +3224,18 @@ static int wl1271_bss_erp_info_changed(struct wl1271 *wl,
3208 3224
3209 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 3225 if (changed & BSS_CHANGED_ERP_PREAMBLE) {
3210 if (bss_conf->use_short_preamble) 3226 if (bss_conf->use_short_preamble)
3211 wl1271_acx_set_preamble(wl, ACX_PREAMBLE_SHORT); 3227 wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_SHORT);
3212 else 3228 else
3213 wl1271_acx_set_preamble(wl, ACX_PREAMBLE_LONG); 3229 wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_LONG);
3214 } 3230 }
3215 3231
3216 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 3232 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
3217 if (bss_conf->use_cts_prot) 3233 if (bss_conf->use_cts_prot)
3218 ret = wl1271_acx_cts_protect(wl, CTSPROTECT_ENABLE); 3234 ret = wl1271_acx_cts_protect(wl, wlvif,
3235 CTSPROTECT_ENABLE);
3219 else 3236 else
3220 ret = wl1271_acx_cts_protect(wl, CTSPROTECT_DISABLE); 3237 ret = wl1271_acx_cts_protect(wl, wlvif,
3238 CTSPROTECT_DISABLE);
3221 if (ret < 0) { 3239 if (ret < 0) {
3222 wl1271_warning("Set ctsprotect failed %d", ret); 3240 wl1271_warning("Set ctsprotect failed %d", ret);
3223 goto out; 3241 goto out;
@@ -3359,7 +3377,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
3359 } 3377 }
3360 } else { 3378 } else {
3361 if (test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) { 3379 if (test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) {
3362 ret = wl12xx_cmd_role_stop_ap(wl); 3380 ret = wl12xx_cmd_role_stop_ap(wl, wlvif);
3363 if (ret < 0) 3381 if (ret < 0)
3364 goto out; 3382 goto out;
3365 3383
@@ -3369,14 +3387,14 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
3369 } 3387 }
3370 } 3388 }
3371 3389
3372 ret = wl1271_bss_erp_info_changed(wl, bss_conf, changed); 3390 ret = wl1271_bss_erp_info_changed(wl, vif, bss_conf, changed);
3373 if (ret < 0) 3391 if (ret < 0)
3374 goto out; 3392 goto out;
3375 3393
3376 /* Handle HT information change */ 3394 /* Handle HT information change */
3377 if ((changed & BSS_CHANGED_HT) && 3395 if ((changed & BSS_CHANGED_HT) &&
3378 (bss_conf->channel_type != NL80211_CHAN_NO_HT)) { 3396 (bss_conf->channel_type != NL80211_CHAN_NO_HT)) {
3379 ret = wl1271_acx_set_ht_information(wl, 3397 ret = wl1271_acx_set_ht_information(wl, wlvif,
3380 bss_conf->ht_operation_mode); 3398 bss_conf->ht_operation_mode);
3381 if (ret < 0) { 3399 if (ret < 0) {
3382 wl1271_warning("Set ht information failed %d", ret); 3400 wl1271_warning("Set ht information failed %d", ret);
@@ -3418,7 +3436,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
3418 } else { 3436 } else {
3419 if (test_and_clear_bit(WL1271_FLAG_IBSS_JOINED, 3437 if (test_and_clear_bit(WL1271_FLAG_IBSS_JOINED,
3420 &wl->flags)) { 3438 &wl->flags)) {
3421 wl1271_unjoin(wl); 3439 wl1271_unjoin(wl, wlvif);
3422 wl12xx_cmd_role_start_dev(wl); 3440 wl12xx_cmd_role_start_dev(wl);
3423 wl12xx_roc(wl, wl->dev_role_id); 3441 wl12xx_roc(wl, wl->dev_role_id);
3424 } 3442 }
@@ -3443,7 +3461,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
3443 bool enable = false; 3461 bool enable = false;
3444 if (bss_conf->cqm_rssi_thold) 3462 if (bss_conf->cqm_rssi_thold)
3445 enable = true; 3463 enable = true;
3446 ret = wl1271_acx_rssi_snr_trigger(wl, enable, 3464 ret = wl1271_acx_rssi_snr_trigger(wl, wlvif, enable,
3447 bss_conf->cqm_rssi_thold, 3465 bss_conf->cqm_rssi_thold,
3448 bss_conf->cqm_rssi_hyst); 3466 bss_conf->cqm_rssi_hyst);
3449 if (ret < 0) 3467 if (ret < 0)
@@ -3533,7 +3551,7 @@ sta_not_found:
3533 wl1271_ssid_set(vif, wlvif->probereq, ieoffset); 3551 wl1271_ssid_set(vif, wlvif->probereq, ieoffset);
3534 3552
3535 /* enable the connection monitoring feature */ 3553 /* enable the connection monitoring feature */
3536 ret = wl1271_acx_conn_monit_params(wl, true); 3554 ret = wl1271_acx_conn_monit_params(wl, wlvif, true);
3537 if (ret < 0) 3555 if (ret < 0)
3538 goto out; 3556 goto out;
3539 } else { 3557 } else {
@@ -3563,10 +3581,10 @@ sta_not_found:
3563 goto out; 3581 goto out;
3564 3582
3565 /* disable connection monitor features */ 3583 /* disable connection monitor features */
3566 ret = wl1271_acx_conn_monit_params(wl, false); 3584 ret = wl1271_acx_conn_monit_params(wl, wlvif, false);
3567 3585
3568 /* Disable the keep-alive feature */ 3586 /* Disable the keep-alive feature */
3569 ret = wl1271_acx_keep_alive_mode(wl, false); 3587 ret = wl1271_acx_keep_alive_mode(wl, wlvif, false);
3570 if (ret < 0) 3588 if (ret < 0)
3571 goto out; 3589 goto out;
3572 3590
@@ -3578,7 +3596,7 @@ sta_not_found:
3578 * no IF_OPER_UP notification. 3596 * no IF_OPER_UP notification.
3579 */ 3597 */
3580 if (!was_ifup) { 3598 if (!was_ifup) {
3581 ret = wl12xx_croc(wl, wl->role_id); 3599 ret = wl12xx_croc(wl, wlvif->role_id);
3582 if (ret < 0) 3600 if (ret < 0)
3583 goto out; 3601 goto out;
3584 } 3602 }
@@ -3593,7 +3611,7 @@ sta_not_found:
3593 goto out; 3611 goto out;
3594 } 3612 }
3595 3613
3596 wl1271_unjoin(wl); 3614 wl1271_unjoin(wl, wlvif);
3597 if (!(conf_flags & IEEE80211_CONF_IDLE)) { 3615 if (!(conf_flags & IEEE80211_CONF_IDLE)) {
3598 wl12xx_cmd_role_start_dev(wl); 3616 wl12xx_cmd_role_start_dev(wl);
3599 wl12xx_roc(wl, wl->dev_role_id); 3617 wl12xx_roc(wl, wl->dev_role_id);
@@ -3623,7 +3641,7 @@ sta_not_found:
3623 } 3641 }
3624 } 3642 }
3625 3643
3626 ret = wl1271_bss_erp_info_changed(wl, bss_conf, changed); 3644 ret = wl1271_bss_erp_info_changed(wl, vif, bss_conf, changed);
3627 if (ret < 0) 3645 if (ret < 0)
3628 goto out; 3646 goto out;
3629 3647
@@ -3645,11 +3663,11 @@ sta_not_found:
3645 goto out; 3663 goto out;
3646 } 3664 }
3647 3665
3648 ret = wl1271_acx_arp_ip_filter(wl, 3666 ret = wl1271_acx_arp_ip_filter(wl, wlvif,
3649 ACX_ARP_FILTER_ARP_FILTERING, 3667 ACX_ARP_FILTER_ARP_FILTERING,
3650 addr); 3668 addr);
3651 } else 3669 } else
3652 ret = wl1271_acx_arp_ip_filter(wl, 0, addr); 3670 ret = wl1271_acx_arp_ip_filter(wl, wlvif, 0, addr);
3653 3671
3654 if (ret < 0) 3672 if (ret < 0)
3655 goto out; 3673 goto out;
@@ -3664,7 +3682,7 @@ sta_not_found:
3664 3682
3665 /* ROC until connected (after EAPOL exchange) */ 3683 /* ROC until connected (after EAPOL exchange) */
3666 if (!is_ibss) { 3684 if (!is_ibss) {
3667 ret = wl12xx_roc(wl, wl->role_id); 3685 ret = wl12xx_roc(wl, wlvif->role_id);
3668 if (ret < 0) 3686 if (ret < 0)
3669 goto out; 3687 goto out;
3670 3688
@@ -3691,7 +3709,7 @@ sta_not_found:
3691 enum wl1271_cmd_ps_mode mode; 3709 enum wl1271_cmd_ps_mode mode;
3692 3710
3693 mode = STATION_POWER_SAVE_MODE; 3711 mode = STATION_POWER_SAVE_MODE;
3694 ret = wl1271_ps_set_mode(wl, mode, 3712 ret = wl1271_ps_set_mode(wl, wlvif, mode,
3695 wlvif->basic_rate, 3713 wlvif->basic_rate,
3696 true); 3714 true);
3697 if (ret < 0) 3715 if (ret < 0)
@@ -3730,7 +3748,7 @@ sta_not_found:
3730 /* Handle HT information change. Done after join. */ 3748 /* Handle HT information change. Done after join. */
3731 if ((changed & BSS_CHANGED_HT) && 3749 if ((changed & BSS_CHANGED_HT) &&
3732 (bss_conf->channel_type != NL80211_CHAN_NO_HT)) { 3750 (bss_conf->channel_type != NL80211_CHAN_NO_HT)) {
3733 ret = wl1271_acx_set_ht_information(wl, 3751 ret = wl1271_acx_set_ht_information(wl, wlvif,
3734 bss_conf->ht_operation_mode); 3752 bss_conf->ht_operation_mode);
3735 if (ret < 0) { 3753 if (ret < 0) {
3736 wl1271_warning("Set ht information failed %d", ret); 3754 wl1271_warning("Set ht information failed %d", ret);
@@ -3780,6 +3798,7 @@ static int wl1271_op_conf_tx(struct ieee80211_hw *hw,
3780 const struct ieee80211_tx_queue_params *params) 3798 const struct ieee80211_tx_queue_params *params)
3781{ 3799{
3782 struct wl1271 *wl = hw->priv; 3800 struct wl1271 *wl = hw->priv;
3801 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
3783 u8 ps_scheme; 3802 u8 ps_scheme;
3784 int ret = 0; 3803 int ret = 0;
3785 3804
@@ -3826,13 +3845,13 @@ static int wl1271_op_conf_tx(struct ieee80211_hw *hw,
3826 * the txop is confed in units of 32us by the mac80211, 3845 * the txop is confed in units of 32us by the mac80211,
3827 * we need us 3846 * we need us
3828 */ 3847 */
3829 ret = wl1271_acx_ac_cfg(wl, wl1271_tx_get_queue(queue), 3848 ret = wl1271_acx_ac_cfg(wl, wlvif, wl1271_tx_get_queue(queue),
3830 params->cw_min, params->cw_max, 3849 params->cw_min, params->cw_max,
3831 params->aifs, params->txop << 5); 3850 params->aifs, params->txop << 5);
3832 if (ret < 0) 3851 if (ret < 0)
3833 goto out_sleep; 3852 goto out_sleep;
3834 3853
3835 ret = wl1271_acx_tid_cfg(wl, wl1271_tx_get_queue(queue), 3854 ret = wl1271_acx_tid_cfg(wl, wlvif, wl1271_tx_get_queue(queue),
3836 CONF_CHANNEL_TYPE_EDCF, 3855 CONF_CHANNEL_TYPE_EDCF,
3837 wl1271_tx_get_queue(queue), 3856 wl1271_tx_get_queue(queue),
3838 ps_scheme, CONF_ACK_POLICY_LEGACY, 3857 ps_scheme, CONF_ACK_POLICY_LEGACY,
@@ -4861,7 +4880,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
4861 wl->tx_security_seq = 0; 4880 wl->tx_security_seq = 0;
4862 wl->tx_security_last_seq_lsb = 0; 4881 wl->tx_security_last_seq_lsb = 0;
4863 wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; 4882 wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
4864 wl->role_id = WL12XX_INVALID_ROLE_ID;
4865 wl->system_hlid = WL12XX_SYSTEM_HLID; 4883 wl->system_hlid = WL12XX_SYSTEM_HLID;
4866 wl->sta_hlid = WL12XX_INVALID_LINK_ID; 4884 wl->sta_hlid = WL12XX_INVALID_LINK_ID;
4867 wl->dev_role_id = WL12XX_INVALID_ROLE_ID; 4885 wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
diff --git a/drivers/net/wireless/wl12xx/ps.c b/drivers/net/wireless/wl12xx/ps.c
index c15ebf2efd40..ac3f20716f5b 100644
--- a/drivers/net/wireless/wl12xx/ps.c
+++ b/drivers/net/wireless/wl12xx/ps.c
@@ -143,8 +143,8 @@ out:
143 return 0; 143 return 0;
144} 144}
145 145
146int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, 146int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
147 u32 rates, bool send) 147 enum wl1271_cmd_ps_mode mode, u32 rates, bool send)
148{ 148{
149 int ret; 149 int ret;
150 150
@@ -152,13 +152,13 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
152 case STATION_POWER_SAVE_MODE: 152 case STATION_POWER_SAVE_MODE:
153 wl1271_debug(DEBUG_PSM, "entering psm"); 153 wl1271_debug(DEBUG_PSM, "entering psm");
154 154
155 ret = wl1271_acx_wake_up_conditions(wl); 155 ret = wl1271_acx_wake_up_conditions(wl, wlvif);
156 if (ret < 0) { 156 if (ret < 0) {
157 wl1271_error("couldn't set wake up conditions"); 157 wl1271_error("couldn't set wake up conditions");
158 return ret; 158 return ret;
159 } 159 }
160 160
161 ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE); 161 ret = wl1271_cmd_ps_mode(wl, wlvif, STATION_POWER_SAVE_MODE);
162 if (ret < 0) 162 if (ret < 0)
163 return ret; 163 return ret;
164 164
@@ -170,17 +170,17 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
170 170
171 /* disable beacon early termination */ 171 /* disable beacon early termination */
172 if (wl->band == IEEE80211_BAND_2GHZ) { 172 if (wl->band == IEEE80211_BAND_2GHZ) {
173 ret = wl1271_acx_bet_enable(wl, false); 173 ret = wl1271_acx_bet_enable(wl, wlvif, false);
174 if (ret < 0) 174 if (ret < 0)
175 return ret; 175 return ret;
176 } 176 }
177 177
178 /* disable beacon filtering */ 178 /* disable beacon filtering */
179 ret = wl1271_acx_beacon_filter_opt(wl, false); 179 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
180 if (ret < 0) 180 if (ret < 0)
181 return ret; 181 return ret;
182 182
183 ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE); 183 ret = wl1271_cmd_ps_mode(wl, wlvif, STATION_ACTIVE_MODE);
184 if (ret < 0) 184 if (ret < 0)
185 return ret; 185 return ret;
186 186
diff --git a/drivers/net/wireless/wl12xx/ps.h b/drivers/net/wireless/wl12xx/ps.h
index 25eb9bc9b628..6ad0a0bd29bd 100644
--- a/drivers/net/wireless/wl12xx/ps.h
+++ b/drivers/net/wireless/wl12xx/ps.h
@@ -27,8 +27,8 @@
27#include "wl12xx.h" 27#include "wl12xx.h"
28#include "acx.h" 28#include "acx.h"
29 29
30int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, 30int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
31 u32 rates, bool send); 31 enum wl1271_cmd_ps_mode mode, u32 rates, bool send);
32void wl1271_ps_elp_sleep(struct wl1271 *wl); 32void wl1271_ps_elp_sleep(struct wl1271 *wl);
33int wl1271_ps_elp_wakeup(struct wl1271 *wl); 33int wl1271_ps_elp_wakeup(struct wl1271 *wl);
34void wl1271_elp_work(struct work_struct *work); 34void wl1271_elp_work(struct work_struct *work);
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index e3b863b895f3..9d0dfb516e26 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -163,6 +163,7 @@ static int wl1271_scan_send(struct wl1271 *wl, struct ieee80211_vif *vif,
163 enum ieee80211_band band, 163 enum ieee80211_band band,
164 bool passive, u32 basic_rate) 164 bool passive, u32 basic_rate)
165{ 165{
166 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
166 struct wl1271_cmd_scan *cmd; 167 struct wl1271_cmd_scan *cmd;
167 struct wl1271_cmd_trigger_scan_to *trigger; 168 struct wl1271_cmd_trigger_scan_to *trigger;
168 int ret; 169 int ret;
@@ -182,11 +183,11 @@ static int wl1271_scan_send(struct wl1271 *wl, struct ieee80211_vif *vif,
182 if (passive) 183 if (passive)
183 scan_options |= WL1271_SCAN_OPT_PASSIVE; 184 scan_options |= WL1271_SCAN_OPT_PASSIVE;
184 185
185 if (WARN_ON(wl->role_id == WL12XX_INVALID_ROLE_ID)) { 186 if (WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID)) {
186 ret = -EINVAL; 187 ret = -EINVAL;
187 goto out; 188 goto out;
188 } 189 }
189 cmd->params.role_id = wl->role_id; 190 cmd->params.role_id = wlvif->role_id;
190 cmd->params.scan_options = cpu_to_le16(scan_options); 191 cmd->params.scan_options = cpu_to_le16(scan_options);
191 192
192 cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, 193 cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req,
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index e6d3c214acf9..e249b459f62b 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -401,7 +401,6 @@ struct wl1271 {
401 401
402 u8 mac_addr[ETH_ALEN]; 402 u8 mac_addr[ETH_ALEN];
403 int channel; 403 int channel;
404 u8 role_id;
405 u8 dev_role_id; 404 u8 dev_role_id;
406 u8 system_hlid; 405 u8 system_hlid;
407 u8 sta_hlid; 406 u8 sta_hlid;
@@ -621,6 +620,7 @@ struct wl1271_station {
621struct wl12xx_vif { 620struct wl12xx_vif {
622 u8 bss_type; 621 u8 bss_type;
623 u8 p2p; /* we are using p2p role */ 622 u8 p2p; /* we are using p2p role */
623 u8 role_id;
624 624
625 u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; 625 u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
626 u8 ssid_len; 626 u8 ssid_len;