aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/main.c
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-10 04:13:00 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-11 08:09:57 -0400
commitba8447f64159927baf673d827e404605471d8f68 (patch)
tree5d204b2aba0686d680fd1146d7270a6ba1e94eb9 /drivers/net/wireless/wl12xx/main.c
parent9eb599e9c62dcfd4efece1936c385381b366b684 (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/main.c')
-rw-r--r--drivers/net/wireless/wl12xx/main.c52
1 files changed, 27 insertions, 25 deletions
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 = {
400static DEFINE_MUTEX(wl_list_mutex); 400static DEFINE_MUTEX(wl_list_mutex);
401static LIST_HEAD(wl_list); 401static 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, 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 }
477out: 478out:
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 /*