diff options
author | Eliad Peller <eliad@wizery.com> | 2011-10-05 05:55:41 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-10-07 01:32:33 -0400 |
commit | 87fbcb0f8c5c8fd57a4e3e7e638977c04ce1e0ca (patch) | |
tree | 7c4198319bbb1dc6bbcd5b4b683d4a023a635875 /drivers/net/wireless/wl12xx/init.c | |
parent | 92c77c734f958474ac73af670834bc32cb833e54 (diff) |
wl12xx: define wl12xx_vif
Define a per-vif data struct.
This struct holds all the vif-specifc data, which is
currently being hold by the global wl struct.
Start by moving the basic_rate_set field into it.
NOTE: in order to make the patches a bit smaller, start by
using wl->vif in some functions, instead of changing all
the function prototypes at once. finally, wl->vif will be
removed altogether.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/init.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/init.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c index 145601dddab0..c00bdf8a3584 100644 --- a/drivers/net/wireless/wl12xx/init.c +++ b/drivers/net/wireless/wl12xx/init.c | |||
@@ -122,7 +122,8 @@ int wl1271_init_templates_config(struct wl1271 *wl) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int wl1271_ap_init_deauth_template(struct wl1271 *wl) | 125 | static int wl1271_ap_init_deauth_template(struct wl1271 *wl, |
126 | struct wl12xx_vif *wlvif) | ||
126 | { | 127 | { |
127 | struct wl12xx_disconn_template *tmpl; | 128 | struct wl12xx_disconn_template *tmpl; |
128 | int ret; | 129 | int ret; |
@@ -137,7 +138,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl) | |||
137 | tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 138 | tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
138 | IEEE80211_STYPE_DEAUTH); | 139 | IEEE80211_STYPE_DEAUTH); |
139 | 140 | ||
140 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 141 | rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); |
141 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, | 142 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, |
142 | tmpl, sizeof(*tmpl), 0, rate); | 143 | tmpl, sizeof(*tmpl), 0, rate); |
143 | 144 | ||
@@ -149,6 +150,7 @@ out: | |||
149 | static int wl1271_ap_init_null_template(struct wl1271 *wl, | 150 | static int wl1271_ap_init_null_template(struct wl1271 *wl, |
150 | struct ieee80211_vif *vif) | 151 | struct ieee80211_vif *vif) |
151 | { | 152 | { |
153 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
152 | struct ieee80211_hdr_3addr *nullfunc; | 154 | struct ieee80211_hdr_3addr *nullfunc; |
153 | int ret; | 155 | int ret; |
154 | u32 rate; | 156 | u32 rate; |
@@ -168,7 +170,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl, | |||
168 | memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); | 170 | memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); |
169 | memcpy(nullfunc->addr3, vif->addr, ETH_ALEN); | 171 | memcpy(nullfunc->addr3, vif->addr, ETH_ALEN); |
170 | 172 | ||
171 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 173 | rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); |
172 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc, | 174 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc, |
173 | sizeof(*nullfunc), 0, rate); | 175 | sizeof(*nullfunc), 0, rate); |
174 | 176 | ||
@@ -180,6 +182,7 @@ out: | |||
180 | static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, | 182 | static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, |
181 | struct ieee80211_vif *vif) | 183 | struct ieee80211_vif *vif) |
182 | { | 184 | { |
185 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
183 | struct ieee80211_qos_hdr *qosnull; | 186 | struct ieee80211_qos_hdr *qosnull; |
184 | int ret; | 187 | int ret; |
185 | u32 rate; | 188 | u32 rate; |
@@ -199,7 +202,7 @@ static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, | |||
199 | memcpy(qosnull->addr2, vif->addr, ETH_ALEN); | 202 | memcpy(qosnull->addr2, vif->addr, ETH_ALEN); |
200 | memcpy(qosnull->addr3, vif->addr, ETH_ALEN); | 203 | memcpy(qosnull->addr3, vif->addr, ETH_ALEN); |
201 | 204 | ||
202 | rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 205 | rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); |
203 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull, | 206 | ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull, |
204 | sizeof(*qosnull), 0, rate); | 207 | sizeof(*qosnull), 0, rate); |
205 | 208 | ||
@@ -370,7 +373,7 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) | |||
370 | } | 373 | } |
371 | 374 | ||
372 | /* generic ap initialization (non vif-specific) */ | 375 | /* generic ap initialization (non vif-specific) */ |
373 | static int wl1271_ap_hw_init(struct wl1271 *wl) | 376 | static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
374 | { | 377 | { |
375 | int ret; | 378 | int ret; |
376 | 379 | ||
@@ -379,7 +382,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl) | |||
379 | if (ret < 0) | 382 | if (ret < 0) |
380 | return ret; | 383 | return ret; |
381 | 384 | ||
382 | ret = wl1271_init_ap_rates(wl); | 385 | ret = wl1271_init_ap_rates(wl, wlvif); |
383 | if (ret < 0) | 386 | if (ret < 0) |
384 | return ret; | 387 | return ret; |
385 | 388 | ||
@@ -388,9 +391,10 @@ static int wl1271_ap_hw_init(struct wl1271 *wl) | |||
388 | 391 | ||
389 | int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif) | 392 | int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif) |
390 | { | 393 | { |
394 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
391 | int ret; | 395 | int ret; |
392 | 396 | ||
393 | ret = wl1271_ap_init_deauth_template(wl); | 397 | ret = wl1271_ap_init_deauth_template(wl, wlvif); |
394 | if (ret < 0) | 398 | if (ret < 0) |
395 | return ret; | 399 | return ret; |
396 | 400 | ||
@@ -419,18 +423,19 @@ static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl, | |||
419 | return wl1271_ap_init_templates(wl, vif); | 423 | return wl1271_ap_init_templates(wl, vif); |
420 | } | 424 | } |
421 | 425 | ||
422 | int wl1271_init_ap_rates(struct wl1271 *wl) | 426 | int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
423 | { | 427 | { |
424 | int i, ret; | 428 | int i, ret; |
425 | struct conf_tx_rate_class rc; | 429 | struct conf_tx_rate_class rc; |
426 | u32 supported_rates; | 430 | u32 supported_rates; |
427 | 431 | ||
428 | wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set); | 432 | wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", |
433 | wlvif->basic_rate_set); | ||
429 | 434 | ||
430 | if (wl->basic_rate_set == 0) | 435 | if (wlvif->basic_rate_set == 0) |
431 | return -EINVAL; | 436 | return -EINVAL; |
432 | 437 | ||
433 | rc.enabled_rates = wl->basic_rate_set; | 438 | rc.enabled_rates = wlvif->basic_rate_set; |
434 | rc.long_retry_limit = 10; | 439 | rc.long_retry_limit = 10; |
435 | rc.short_retry_limit = 10; | 440 | rc.short_retry_limit = 10; |
436 | rc.aflags = 0; | 441 | rc.aflags = 0; |
@@ -439,7 +444,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl) | |||
439 | return ret; | 444 | return ret; |
440 | 445 | ||
441 | /* use the min basic rate for AP broadcast/multicast */ | 446 | /* use the min basic rate for AP broadcast/multicast */ |
442 | rc.enabled_rates = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); | 447 | rc.enabled_rates = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); |
443 | rc.short_retry_limit = 10; | 448 | rc.short_retry_limit = 10; |
444 | rc.long_retry_limit = 10; | 449 | rc.long_retry_limit = 10; |
445 | rc.aflags = 0; | 450 | rc.aflags = 0; |
@@ -451,7 +456,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl) | |||
451 | * If the basic rates contain OFDM rates, use OFDM only | 456 | * If the basic rates contain OFDM rates, use OFDM only |
452 | * rates for unicast TX as well. Else use all supported rates. | 457 | * rates for unicast TX as well. Else use all supported rates. |
453 | */ | 458 | */ |
454 | if ((wl->basic_rate_set & CONF_TX_OFDM_RATES)) | 459 | if ((wlvif->basic_rate_set & CONF_TX_OFDM_RATES)) |
455 | supported_rates = CONF_TX_OFDM_RATES; | 460 | supported_rates = CONF_TX_OFDM_RATES; |
456 | else | 461 | else |
457 | supported_rates = CONF_TX_AP_ENABLED_RATES; | 462 | supported_rates = CONF_TX_AP_ENABLED_RATES; |
@@ -564,6 +569,7 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif) | |||
564 | 569 | ||
565 | int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) | 570 | int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) |
566 | { | 571 | { |
572 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
567 | struct conf_tx_ac_category *conf_ac; | 573 | struct conf_tx_ac_category *conf_ac; |
568 | struct conf_tx_tid *conf_tid; | 574 | struct conf_tx_tid *conf_tid; |
569 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 575 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); |
@@ -572,7 +578,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) | |||
572 | 578 | ||
573 | /* Mode specific init */ | 579 | /* Mode specific init */ |
574 | if (is_ap) { | 580 | if (is_ap) { |
575 | ret = wl1271_ap_hw_init(wl); | 581 | ret = wl1271_ap_hw_init(wl, wlvif); |
576 | if (ret < 0) | 582 | if (ret < 0) |
577 | return ret; | 583 | return ret; |
578 | 584 | ||