diff options
author | Eliad Peller <eliad@wizery.com> | 2011-10-10 04:13:00 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-10-11 08:09:57 -0400 |
commit | ba8447f64159927baf673d827e404605471d8f68 (patch) | |
tree | 5d204b2aba0686d680fd1146d7270a6ba1e94eb9 /drivers/net/wireless/wl12xx | |
parent | 9eb599e9c62dcfd4efece1936c385381b366b684 (diff) |
wl12xx: make WL1271_FLAG_STA_ASSOCIATED flag per-vif
This flag should be set per-vif, rather than globally.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r-- | drivers/net/wireless/wl12xx/event.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 52 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/scan.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/tx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 6 |
5 files changed, 36 insertions, 30 deletions
diff --git a/drivers/net/wireless/wl12xx/event.c b/drivers/net/wireless/wl12xx/event.c index be9e1121c8f8..cfb2835c118c 100644 --- a/drivers/net/wireless/wl12xx/event.c +++ b/drivers/net/wireless/wl12xx/event.c | |||
@@ -52,7 +52,7 @@ void wl1271_pspoll_work(struct work_struct *work) | |||
52 | if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags)) | 52 | if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags)) |
53 | goto out; | 53 | goto out; |
54 | 54 | ||
55 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 55 | if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
56 | goto out; | 56 | goto out; |
57 | 57 | ||
58 | /* | 58 | /* |
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 5ce01f1379a4..d91e8bcccaaa 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -400,10 +400,9 @@ static struct platform_device wl1271_device = { | |||
400 | static DEFINE_MUTEX(wl_list_mutex); | 400 | static DEFINE_MUTEX(wl_list_mutex); |
401 | static LIST_HEAD(wl_list); | 401 | static LIST_HEAD(wl_list); |
402 | 402 | ||
403 | static int wl1271_check_operstate(struct wl1271 *wl, unsigned char operstate) | 403 | static int wl1271_check_operstate(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
404 | unsigned char operstate) | ||
404 | { | 405 | { |
405 | struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ | ||
406 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
407 | int ret; | 406 | int ret; |
408 | 407 | ||
409 | if (operstate != IF_OPER_UP) | 408 | if (operstate != IF_OPER_UP) |
@@ -430,6 +429,7 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what, | |||
430 | struct ieee80211_hw *hw; | 429 | struct ieee80211_hw *hw; |
431 | struct wl1271 *wl; | 430 | struct wl1271 *wl; |
432 | struct wl1271 *wl_temp; | 431 | struct wl1271 *wl_temp; |
432 | struct wl12xx_vif *wlvif; | ||
433 | int ret = 0; | 433 | int ret = 0; |
434 | 434 | ||
435 | /* Check that this notification is for us. */ | 435 | /* Check that this notification is for us. */ |
@@ -463,17 +463,18 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what, | |||
463 | if (wl->state == WL1271_STATE_OFF) | 463 | if (wl->state == WL1271_STATE_OFF) |
464 | goto out; | 464 | goto out; |
465 | 465 | ||
466 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 466 | wl12xx_for_each_wlvif_sta(wl, wlvif) { |
467 | goto out; | 467 | if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
468 | 468 | continue; | |
469 | ret = wl1271_ps_elp_wakeup(wl); | ||
470 | if (ret < 0) | ||
471 | goto out; | ||
472 | 469 | ||
473 | wl1271_check_operstate(wl, dev->operstate); | 470 | ret = wl1271_ps_elp_wakeup(wl); |
471 | if (ret < 0) | ||
472 | goto out; | ||
474 | 473 | ||
475 | wl1271_ps_elp_sleep(wl); | 474 | wl1271_check_operstate(wl, wlvif, dev->operstate); |
476 | 475 | ||
476 | wl1271_ps_elp_sleep(wl); | ||
477 | } | ||
477 | out: | 478 | out: |
478 | mutex_unlock(&wl->mutex); | 479 | mutex_unlock(&wl->mutex); |
479 | 480 | ||
@@ -535,7 +536,7 @@ int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif) | |||
535 | 536 | ||
536 | /* reconfigure/disable according to new streaming_period */ | 537 | /* reconfigure/disable according to new streaming_period */ |
537 | if (period && | 538 | if (period && |
538 | test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) && | 539 | test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && |
539 | (wl->conf.rx_streaming.always || | 540 | (wl->conf.rx_streaming.always || |
540 | test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) | 541 | test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) |
541 | ret = wl1271_set_rx_streaming(wl, wlvif, true); | 542 | ret = wl1271_set_rx_streaming(wl, wlvif, true); |
@@ -558,7 +559,7 @@ static void wl1271_rx_streaming_enable_work(struct work_struct *work) | |||
558 | mutex_lock(&wl->mutex); | 559 | mutex_lock(&wl->mutex); |
559 | 560 | ||
560 | if (test_bit(WL1271_FLAG_RX_STREAMING_STARTED, &wl->flags) || | 561 | if (test_bit(WL1271_FLAG_RX_STREAMING_STARTED, &wl->flags) || |
561 | !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || | 562 | !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || |
562 | (!wl->conf.rx_streaming.always && | 563 | (!wl->conf.rx_streaming.always && |
563 | !test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) | 564 | !test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) |
564 | goto out; | 565 | goto out; |
@@ -1233,7 +1234,7 @@ static void wl1271_recovery_work(struct work_struct *work) | |||
1233 | * not encrypted. | 1234 | * not encrypted. |
1234 | */ | 1235 | */ |
1235 | wl12xx_for_each_wlvif(wl, wlvif) { | 1236 | wl12xx_for_each_wlvif(wl, wlvif) { |
1236 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || | 1237 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || |
1237 | test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) | 1238 | test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) |
1238 | wlvif->tx_security_seq += | 1239 | wlvif->tx_security_seq += |
1239 | WL1271_TX_SQN_POST_RECOVERY_PADDING; | 1240 | WL1271_TX_SQN_POST_RECOVERY_PADDING; |
@@ -1609,7 +1610,7 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl, | |||
1609 | 1610 | ||
1610 | mutex_lock(&wl->mutex); | 1611 | mutex_lock(&wl->mutex); |
1611 | 1612 | ||
1612 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 1613 | if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
1613 | goto out_unlock; | 1614 | goto out_unlock; |
1614 | 1615 | ||
1615 | ret = wl1271_ps_elp_wakeup(wl); | 1616 | ret = wl1271_ps_elp_wakeup(wl); |
@@ -2253,11 +2254,11 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
2253 | * Keep the below message for now, unless it starts bothering | 2254 | * Keep the below message for now, unless it starts bothering |
2254 | * users who really like to roam a lot :) | 2255 | * users who really like to roam a lot :) |
2255 | */ | 2256 | */ |
2256 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 2257 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
2257 | wl1271_info("JOIN while associated."); | 2258 | wl1271_info("JOIN while associated."); |
2258 | 2259 | ||
2259 | if (set_assoc) | 2260 | if (set_assoc) |
2260 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | 2261 | set_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags); |
2261 | 2262 | ||
2262 | if (is_ibss) | 2263 | if (is_ibss) |
2263 | ret = wl12xx_cmd_role_start_ibss(wl, wlvif); | 2264 | ret = wl12xx_cmd_role_start_ibss(wl, wlvif); |
@@ -2266,7 +2267,7 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
2266 | if (ret < 0) | 2267 | if (ret < 0) |
2267 | goto out; | 2268 | goto out; |
2268 | 2269 | ||
2269 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 2270 | if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
2270 | goto out; | 2271 | goto out; |
2271 | 2272 | ||
2272 | /* | 2273 | /* |
@@ -2449,7 +2450,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2449 | * possible rate for the band as a fixed rate for | 2450 | * possible rate for the band as a fixed rate for |
2450 | * association frames and other control messages. | 2451 | * association frames and other control messages. |
2451 | */ | 2452 | */ |
2452 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | 2453 | if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) |
2453 | wl1271_set_band_rate(wl, wlvif); | 2454 | wl1271_set_band_rate(wl, wlvif); |
2454 | 2455 | ||
2455 | wlvif->basic_rate = | 2456 | wlvif->basic_rate = |
@@ -2460,7 +2461,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2460 | wl1271_warning("rate policy for channel " | 2461 | wl1271_warning("rate policy for channel " |
2461 | "failed %d", ret); | 2462 | "failed %d", ret); |
2462 | 2463 | ||
2463 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { | 2464 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, |
2465 | &wlvif->flags)) { | ||
2464 | if (wl12xx_is_roc(wl)) { | 2466 | if (wl12xx_is_roc(wl)) { |
2465 | /* roaming */ | 2467 | /* roaming */ |
2466 | ret = wl12xx_croc(wl, | 2468 | ret = wl12xx_croc(wl, |
@@ -2518,7 +2520,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2518 | * If we're not, we'll enter it when joining an SSID, | 2520 | * If we're not, we'll enter it when joining an SSID, |
2519 | * through the bss_info_changed() hook. | 2521 | * through the bss_info_changed() hook. |
2520 | */ | 2522 | */ |
2521 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { | 2523 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { |
2522 | wl1271_debug(DEBUG_PSM, "psm enabled"); | 2524 | wl1271_debug(DEBUG_PSM, "psm enabled"); |
2523 | ret = wl1271_ps_set_mode(wl, wlvif, | 2525 | ret = wl1271_ps_set_mode(wl, wlvif, |
2524 | STATION_POWER_SAVE_MODE, | 2526 | STATION_POWER_SAVE_MODE, |
@@ -2981,7 +2983,7 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw, | |||
2981 | 2983 | ||
2982 | /* cancel ROC before scanning */ | 2984 | /* cancel ROC before scanning */ |
2983 | if (wl12xx_is_roc(wl)) { | 2985 | if (wl12xx_is_roc(wl)) { |
2984 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { | 2986 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { |
2985 | /* don't allow scanning right now */ | 2987 | /* don't allow scanning right now */ |
2986 | ret = -EBUSY; | 2988 | ret = -EBUSY; |
2987 | goto out_sleep; | 2989 | goto out_sleep; |
@@ -3619,8 +3621,8 @@ sta_not_found: | |||
3619 | } else { | 3621 | } else { |
3620 | /* use defaults when not associated */ | 3622 | /* use defaults when not associated */ |
3621 | bool was_assoc = | 3623 | bool was_assoc = |
3622 | !!test_and_clear_bit(WL1271_FLAG_STA_ASSOCIATED, | 3624 | !!test_and_clear_bit(WLVIF_FLAG_STA_ASSOCIATED, |
3623 | &wl->flags); | 3625 | &wlvif->flags); |
3624 | bool was_ifup = | 3626 | bool was_ifup = |
3625 | !!test_and_clear_bit(WL1271_FLAG_STA_STATE_SENT, | 3627 | !!test_and_clear_bit(WL1271_FLAG_STA_STATE_SENT, |
3626 | &wl->flags); | 3628 | &wl->flags); |
@@ -3749,7 +3751,7 @@ sta_not_found: | |||
3749 | if (ret < 0) | 3751 | if (ret < 0) |
3750 | goto out; | 3752 | goto out; |
3751 | 3753 | ||
3752 | wl1271_check_operstate(wl, | 3754 | wl1271_check_operstate(wl, wlvif, |
3753 | ieee80211_get_operstate(vif)); | 3755 | ieee80211_get_operstate(vif)); |
3754 | } | 3756 | } |
3755 | /* | 3757 | /* |
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index e1a8ce092e39..687f59b871ef 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -64,7 +64,7 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
64 | if (ret < 0) | 64 | if (ret < 0) |
65 | goto out; | 65 | goto out; |
66 | 66 | ||
67 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { | 67 | if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { |
68 | /* restore hardware connection monitoring template */ | 68 | /* restore hardware connection monitoring template */ |
69 | wl1271_cmd_build_ap_probe_req(wl, wlvif, wlvif->probereq); | 69 | wl1271_cmd_build_ap_probe_req(wl, wlvif, wlvif->probereq); |
70 | } | 70 | } |
@@ -72,7 +72,7 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
72 | /* return to ROC if needed */ | 72 | /* return to ROC if needed */ |
73 | is_sta = (wlvif->bss_type == BSS_TYPE_STA_BSS); | 73 | is_sta = (wlvif->bss_type == BSS_TYPE_STA_BSS); |
74 | is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); | 74 | is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); |
75 | if (((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) || | 75 | if (((is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) || |
76 | (is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) && | 76 | (is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) && |
77 | !test_bit(wlvif->dev_role_id, wl->roc_map)) { | 77 | !test_bit(wlvif->dev_role_id, wl->roc_map)) { |
78 | /* restore remain on channel */ | 78 | /* restore remain on channel */ |
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c index a06aa4e8df7b..bbb101b5de0c 100644 --- a/drivers/net/wireless/wl12xx/tx.c +++ b/drivers/net/wireless/wl12xx/tx.c | |||
@@ -192,7 +192,7 @@ u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
192 | 192 | ||
193 | wl1271_tx_update_filters(wl, wlvif, skb); | 193 | wl1271_tx_update_filters(wl, wlvif, skb); |
194 | 194 | ||
195 | if ((test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || | 195 | if ((test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || |
196 | test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags)) && | 196 | test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags)) && |
197 | !ieee80211_is_auth(hdr->frame_control) && | 197 | !ieee80211_is_auth(hdr->frame_control) && |
198 | !ieee80211_is_assoc_req(hdr->frame_control)) | 198 | !ieee80211_is_assoc_req(hdr->frame_control)) |
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index 52d1cd0ddb6f..efb35a66fa5e 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -313,7 +313,6 @@ struct wl1271_ap_key { | |||
313 | }; | 313 | }; |
314 | 314 | ||
315 | enum wl12xx_flags { | 315 | enum wl12xx_flags { |
316 | WL1271_FLAG_STA_ASSOCIATED, | ||
317 | WL1271_FLAG_IBSS_JOINED, | 316 | WL1271_FLAG_IBSS_JOINED, |
318 | WL1271_FLAG_GPIO_POWER, | 317 | WL1271_FLAG_GPIO_POWER, |
319 | WL1271_FLAG_TX_QUEUE_STOPPED, | 318 | WL1271_FLAG_TX_QUEUE_STOPPED, |
@@ -338,6 +337,10 @@ enum wl12xx_flags { | |||
338 | WL1271_FLAG_CS_PROGRESS, | 337 | WL1271_FLAG_CS_PROGRESS, |
339 | }; | 338 | }; |
340 | 339 | ||
340 | enum wl12xx_vif_flags { | ||
341 | WLVIF_FLAG_STA_ASSOCIATED, | ||
342 | }; | ||
343 | |||
341 | struct wl1271_link { | 344 | struct wl1271_link { |
342 | /* AP-mode - TX queue per AC in link */ | 345 | /* AP-mode - TX queue per AC in link */ |
343 | struct sk_buff_head tx_queue[NUM_TX_QUEUES]; | 346 | struct sk_buff_head tx_queue[NUM_TX_QUEUES]; |
@@ -553,6 +556,7 @@ struct wl1271_station { | |||
553 | struct wl12xx_vif { | 556 | struct wl12xx_vif { |
554 | struct wl1271 *wl; | 557 | struct wl1271 *wl; |
555 | struct list_head list; | 558 | struct list_head list; |
559 | unsigned long flags; | ||
556 | u8 bss_type; | 560 | u8 bss_type; |
557 | u8 p2p; /* we are using p2p role */ | 561 | u8 p2p; /* we are using p2p role */ |
558 | u8 role_id; | 562 | u8 role_id; |