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>
This commit is contained in:
Eliad Peller 2011-10-10 10:13:00 +02:00 committed by Luciano Coelho
parent 9eb599e9c6
commit ba8447f641
5 changed files with 36 additions and 30 deletions

View File

@ -52,7 +52,7 @@ void wl1271_pspoll_work(struct work_struct *work)
if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags)) if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags))
goto out; goto out;
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
goto out; goto out;
/* /*

View File

@ -400,10 +400,9 @@ static struct platform_device wl1271_device = {
static DEFINE_MUTEX(wl_list_mutex); static DEFINE_MUTEX(wl_list_mutex);
static LIST_HEAD(wl_list); static LIST_HEAD(wl_list);
static int wl1271_check_operstate(struct wl1271 *wl, unsigned char operstate) static int wl1271_check_operstate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
unsigned char operstate)
{ {
struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret; int ret;
if (operstate != IF_OPER_UP) if (operstate != IF_OPER_UP)
@ -430,6 +429,7 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct wl1271 *wl; struct wl1271 *wl;
struct wl1271 *wl_temp; struct wl1271 *wl_temp;
struct wl12xx_vif *wlvif;
int ret = 0; int ret = 0;
/* Check that this notification is for us. */ /* Check that this notification is for us. */
@ -463,17 +463,18 @@ static int wl1271_dev_notify(struct notifier_block *me, unsigned long what,
if (wl->state == WL1271_STATE_OFF) if (wl->state == WL1271_STATE_OFF)
goto out; goto out;
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) wl12xx_for_each_wlvif_sta(wl, wlvif) {
goto out; if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
continue;
ret = wl1271_ps_elp_wakeup(wl); ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0) if (ret < 0)
goto out; goto out;
wl1271_check_operstate(wl, dev->operstate); wl1271_check_operstate(wl, wlvif, dev->operstate);
wl1271_ps_elp_sleep(wl);
wl1271_ps_elp_sleep(wl);
}
out: out:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
@ -535,7 +536,7 @@ int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif)
/* reconfigure/disable according to new streaming_period */ /* reconfigure/disable according to new streaming_period */
if (period && if (period &&
test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) && test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) &&
(wl->conf.rx_streaming.always || (wl->conf.rx_streaming.always ||
test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags)))
ret = wl1271_set_rx_streaming(wl, wlvif, true); ret = wl1271_set_rx_streaming(wl, wlvif, true);
@ -558,7 +559,7 @@ static void wl1271_rx_streaming_enable_work(struct work_struct *work)
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (test_bit(WL1271_FLAG_RX_STREAMING_STARTED, &wl->flags) || if (test_bit(WL1271_FLAG_RX_STREAMING_STARTED, &wl->flags) ||
!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) ||
(!wl->conf.rx_streaming.always && (!wl->conf.rx_streaming.always &&
!test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) !test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags)))
goto out; goto out;
@ -1233,7 +1234,7 @@ static void wl1271_recovery_work(struct work_struct *work)
* not encrypted. * not encrypted.
*/ */
wl12xx_for_each_wlvif(wl, wlvif) { wl12xx_for_each_wlvif(wl, wlvif) {
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) ||
test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
wlvif->tx_security_seq += wlvif->tx_security_seq +=
WL1271_TX_SQN_POST_RECOVERY_PADDING; WL1271_TX_SQN_POST_RECOVERY_PADDING;
@ -1609,7 +1610,7 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl,
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
goto out_unlock; goto out_unlock;
ret = wl1271_ps_elp_wakeup(wl); ret = wl1271_ps_elp_wakeup(wl);
@ -2253,11 +2254,11 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
* Keep the below message for now, unless it starts bothering * Keep the below message for now, unless it starts bothering
* users who really like to roam a lot :) * users who really like to roam a lot :)
*/ */
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
wl1271_info("JOIN while associated."); wl1271_info("JOIN while associated.");
if (set_assoc) if (set_assoc)
set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); set_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags);
if (is_ibss) if (is_ibss)
ret = wl12xx_cmd_role_start_ibss(wl, wlvif); ret = wl12xx_cmd_role_start_ibss(wl, wlvif);
@ -2266,7 +2267,7 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
if (ret < 0) if (ret < 0)
goto out; goto out;
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
goto out; goto out;
/* /*
@ -2449,7 +2450,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
* possible rate for the band as a fixed rate for * possible rate for the band as a fixed rate for
* association frames and other control messages. * association frames and other control messages.
*/ */
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
wl1271_set_band_rate(wl, wlvif); wl1271_set_band_rate(wl, wlvif);
wlvif->basic_rate = wlvif->basic_rate =
@ -2460,7 +2461,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
wl1271_warning("rate policy for channel " wl1271_warning("rate policy for channel "
"failed %d", ret); "failed %d", ret);
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WLVIF_FLAG_STA_ASSOCIATED,
&wlvif->flags)) {
if (wl12xx_is_roc(wl)) { if (wl12xx_is_roc(wl)) {
/* roaming */ /* roaming */
ret = wl12xx_croc(wl, ret = wl12xx_croc(wl,
@ -2518,7 +2520,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
* If we're not, we'll enter it when joining an SSID, * If we're not, we'll enter it when joining an SSID,
* through the bss_info_changed() hook. * through the bss_info_changed() hook.
*/ */
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) {
wl1271_debug(DEBUG_PSM, "psm enabled"); wl1271_debug(DEBUG_PSM, "psm enabled");
ret = wl1271_ps_set_mode(wl, wlvif, ret = wl1271_ps_set_mode(wl, wlvif,
STATION_POWER_SAVE_MODE, STATION_POWER_SAVE_MODE,
@ -2981,7 +2983,7 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
/* cancel ROC before scanning */ /* cancel ROC before scanning */
if (wl12xx_is_roc(wl)) { if (wl12xx_is_roc(wl)) {
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) {
/* don't allow scanning right now */ /* don't allow scanning right now */
ret = -EBUSY; ret = -EBUSY;
goto out_sleep; goto out_sleep;
@ -3619,8 +3621,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
} else { } else {
/* use defaults when not associated */ /* use defaults when not associated */
bool was_assoc = bool was_assoc =
!!test_and_clear_bit(WL1271_FLAG_STA_ASSOCIATED, !!test_and_clear_bit(WLVIF_FLAG_STA_ASSOCIATED,
&wl->flags); &wlvif->flags);
bool was_ifup = bool was_ifup =
!!test_and_clear_bit(WL1271_FLAG_STA_STATE_SENT, !!test_and_clear_bit(WL1271_FLAG_STA_STATE_SENT,
&wl->flags); &wl->flags);
@ -3749,7 +3751,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (ret < 0) if (ret < 0)
goto out; goto out;
wl1271_check_operstate(wl, wl1271_check_operstate(wl, wlvif,
ieee80211_get_operstate(vif)); ieee80211_get_operstate(vif));
} }
/* /*

View File

@ -64,7 +64,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
if (ret < 0) if (ret < 0)
goto out; goto out;
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) {
/* restore hardware connection monitoring template */ /* restore hardware connection monitoring template */
wl1271_cmd_build_ap_probe_req(wl, wlvif, wlvif->probereq); wl1271_cmd_build_ap_probe_req(wl, wlvif, wlvif->probereq);
} }
@ -72,7 +72,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
/* return to ROC if needed */ /* return to ROC if needed */
is_sta = (wlvif->bss_type == BSS_TYPE_STA_BSS); is_sta = (wlvif->bss_type == BSS_TYPE_STA_BSS);
is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS);
if (((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) || if (((is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) ||
(is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) && (is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) &&
!test_bit(wlvif->dev_role_id, wl->roc_map)) { !test_bit(wlvif->dev_role_id, wl->roc_map)) {
/* restore remain on channel */ /* restore remain on channel */

View File

@ -192,7 +192,7 @@ u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wl1271_tx_update_filters(wl, wlvif, skb); wl1271_tx_update_filters(wl, wlvif, skb);
if ((test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) || if ((test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) ||
test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags)) && test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags)) &&
!ieee80211_is_auth(hdr->frame_control) && !ieee80211_is_auth(hdr->frame_control) &&
!ieee80211_is_assoc_req(hdr->frame_control)) !ieee80211_is_assoc_req(hdr->frame_control))

View File

@ -313,7 +313,6 @@ struct wl1271_ap_key {
}; };
enum wl12xx_flags { enum wl12xx_flags {
WL1271_FLAG_STA_ASSOCIATED,
WL1271_FLAG_IBSS_JOINED, WL1271_FLAG_IBSS_JOINED,
WL1271_FLAG_GPIO_POWER, WL1271_FLAG_GPIO_POWER,
WL1271_FLAG_TX_QUEUE_STOPPED, WL1271_FLAG_TX_QUEUE_STOPPED,
@ -338,6 +337,10 @@ enum wl12xx_flags {
WL1271_FLAG_CS_PROGRESS, WL1271_FLAG_CS_PROGRESS,
}; };
enum wl12xx_vif_flags {
WLVIF_FLAG_STA_ASSOCIATED,
};
struct wl1271_link { struct wl1271_link {
/* AP-mode - TX queue per AC in link */ /* AP-mode - TX queue per AC in link */
struct sk_buff_head tx_queue[NUM_TX_QUEUES]; struct sk_buff_head tx_queue[NUM_TX_QUEUES];
@ -553,6 +556,7 @@ struct wl1271_station {
struct wl12xx_vif { struct wl12xx_vif {
struct wl1271 *wl; struct wl1271 *wl;
struct list_head list; struct list_head list;
unsigned long flags;
u8 bss_type; u8 bss_type;
u8 p2p; /* we are using p2p role */ u8 p2p; /* we are using p2p role */
u8 role_id; u8 role_id;