Commit 679a6734 authored by Eliad Peller's avatar Eliad Peller Committed by Luciano Coelho

wl12xx: couple role_start_dev with roc

Device role is always started along with ROC.
Couple them together by introducing new wl12xx_start_dev
and wl12xx_stop_dev functions.

By using these functions, we solve a bug that occured during
channel switch - we started the dev role on one channel, and
ROCed on a different one.
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 0f168014
...@@ -468,7 +468,8 @@ static int wl12xx_get_new_session_id(struct wl1271 *wl, ...@@ -468,7 +468,8 @@ static int wl12xx_get_new_session_id(struct wl1271 *wl,
return wlvif->session_counter; return wlvif->session_counter;
} }
int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif) static int wl12xx_cmd_role_start_dev(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
int ret; int ret;
...@@ -516,7 +517,8 @@ int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -516,7 +517,8 @@ int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
return ret; return ret;
} }
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif) static int wl12xx_cmd_role_stop_dev(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_stop *cmd; struct wl12xx_cmd_role_stop *cmd;
int ret; int ret;
...@@ -1776,3 +1778,50 @@ int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl) ...@@ -1776,3 +1778,50 @@ int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl)
out: out:
return ret; return ret;
} }
/* start dev role and roc on its channel */
int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
int ret;
if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS ||
wlvif->bss_type == BSS_TYPE_IBSS)))
return -EINVAL;
ret = wl12xx_cmd_role_start_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wlvif, wlvif->dev_role_id);
if (ret < 0)
goto out_stop;
return 0;
out_stop:
wl12xx_cmd_role_stop_dev(wl, wlvif);
out:
return ret;
}
/* croc dev hlid, and stop the role */
int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
int ret;
if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS ||
wlvif->bss_type == BSS_TYPE_IBSS)))
return -EINVAL;
if (test_bit(wlvif->dev_role_id, wl->roc_map)) {
ret = wl12xx_croc(wl, wlvif->dev_role_id);
if (ret < 0)
goto out;
}
ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
if (ret < 0)
goto out;
out:
return ret;
}
...@@ -39,13 +39,13 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); ...@@ -39,13 +39,13 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type,
u8 *role_id); u8 *role_id);
int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id); int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif); int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif); int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif); int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif); int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif); int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
......
...@@ -2429,11 +2429,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -2429,11 +2429,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
if (idle) { if (idle) {
/* no need to croc if we weren't busy (e.g. during boot) */ /* no need to croc if we weren't busy (e.g. during boot) */
if (wl12xx_is_roc(wl)) { if (wl12xx_is_roc(wl)) {
ret = wl12xx_croc(wl, wlvif->dev_role_id); ret = wl12xx_stop_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
...@@ -2455,11 +2451,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -2455,11 +2451,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
ieee80211_sched_scan_stopped(wl->hw); ieee80211_sched_scan_stopped(wl->hw);
} }
ret = wl12xx_cmd_role_start_dev(wl, wlvif); ret = wl12xx_start_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wlvif, wlvif->dev_role_id);
if (ret < 0) if (ret < 0)
goto out; goto out;
clear_bit(WL1271_FLAG_IDLE, &wl->flags); clear_bit(WL1271_FLAG_IDLE, &wl->flags);
...@@ -2525,16 +2517,13 @@ static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -2525,16 +2517,13 @@ static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif,
*/ */
if (wl12xx_is_roc(wl) && if (wl12xx_is_roc(wl) &&
!(conf->flags & IEEE80211_CONF_IDLE)) { !(conf->flags & IEEE80211_CONF_IDLE)) {
ret = wl12xx_croc(wl, ret = wl12xx_stop_dev(wl, wlvif);
wlvif->dev_role_id);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl12xx_roc(wl, wlvif, ret = wl12xx_start_dev(wl, wlvif);
wlvif->dev_role_id);
if (ret < 0) if (ret < 0)
wl1271_warning("roc failed %d", return ret;
ret);
} }
} }
} }
...@@ -3087,8 +3076,7 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw, ...@@ -3087,8 +3076,7 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
ret = -EBUSY; ret = -EBUSY;
goto out_sleep; goto out_sleep;
} }
wl12xx_croc(wl, wlvif->dev_role_id); wl12xx_stop_dev(wl, wlvif);
wl12xx_cmd_role_stop_dev(wl, wlvif);
} }
ret = wl1271_scan(hw->priv, vif, ssid, len, req); ret = wl1271_scan(hw->priv, vif, ssid, len, req);
...@@ -3599,8 +3587,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3599,8 +3587,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (test_and_clear_bit(WLVIF_FLAG_IBSS_JOINED, if (test_and_clear_bit(WLVIF_FLAG_IBSS_JOINED,
&wlvif->flags)) { &wlvif->flags)) {
wl1271_unjoin(wl, wlvif); wl1271_unjoin(wl, wlvif);
wl12xx_cmd_role_start_dev(wl, wlvif); wl12xx_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif, wlvif->dev_role_id);
} }
} }
} }
...@@ -3776,11 +3763,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3776,11 +3763,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
} }
wl1271_unjoin(wl, wlvif); wl1271_unjoin(wl, wlvif);
if (!(conf_flags & IEEE80211_CONF_IDLE)) { if (!(conf_flags & IEEE80211_CONF_IDLE))
wl12xx_cmd_role_start_dev(wl, wlvif); wl12xx_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif,
wlvif->dev_role_id);
}
} }
} }
} }
...@@ -3859,11 +3843,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3859,11 +3843,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
* STA role). TODO: make it better. * STA role). TODO: make it better.
*/ */
if (wlvif->dev_role_id != WL12XX_INVALID_ROLE_ID) { if (wlvif->dev_role_id != WL12XX_INVALID_ROLE_ID) {
ret = wl12xx_croc(wl, wlvif->dev_role_id); ret = wl12xx_stop_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
......
...@@ -77,8 +77,7 @@ void wl1271_scan_complete_work(struct work_struct *work) ...@@ -77,8 +77,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
(is_ibss && !test_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags))) && (is_ibss && !test_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->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 */
wl12xx_cmd_role_start_dev(wl, wlvif); wl12xx_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif, wlvif->dev_role_id);
} }
wl1271_ps_elp_sleep(wl); wl1271_ps_elp_sleep(wl);
......
...@@ -99,11 +99,7 @@ static int wl1271_tx_update_filters(struct wl1271 *wl, ...@@ -99,11 +99,7 @@ static int wl1271_tx_update_filters(struct wl1271 *wl,
goto out; goto out;
wl1271_debug(DEBUG_CMD, "starting device role for roaming"); wl1271_debug(DEBUG_CMD, "starting device role for roaming");
ret = wl12xx_cmd_role_start_dev(wl, wlvif); ret = wl12xx_start_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wlvif, wlvif->dev_role_id);
if (ret < 0) if (ret < 0)
goto out; goto out;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment