提交 7edebf56 编写于 作者: E Eliad Peller 提交者: Luciano Coelho

wl12xx: move dev_role_id into wlvif

move dev_role_id into the per-interface data, rather than
being global.
Signed-off-by: NEliad Peller <eliad@wizery.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 0603d891
......@@ -464,7 +464,7 @@ static int wl12xx_get_new_session_id(struct wl1271 *wl)
return wl->session_counter;
}
int wl12xx_cmd_role_start_dev(struct wl1271 *wl)
int wl12xx_cmd_role_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
struct wl12xx_cmd_role_start *cmd;
int ret;
......@@ -475,9 +475,9 @@ int wl12xx_cmd_role_start_dev(struct wl1271 *wl)
goto out;
}
wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wl->dev_role_id);
wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wlvif->dev_role_id);
cmd->role_id = wl->dev_role_id;
cmd->role_id = wlvif->dev_role_id;
if (wl->band == IEEE80211_BAND_5GHZ)
cmd->band = WL12XX_BAND_5GHZ;
cmd->channel = wl->channel;
......@@ -514,7 +514,7 @@ int wl12xx_cmd_role_start_dev(struct wl1271 *wl)
return ret;
}
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl)
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{
struct wl12xx_cmd_role_stop *cmd;
int ret;
......@@ -530,7 +530,7 @@ int wl12xx_cmd_role_stop_dev(struct wl1271 *wl)
wl1271_debug(DEBUG_CMD, "cmd role stop dev");
cmd->role_id = wl->dev_role_id;
cmd->role_id = wlvif->dev_role_id;
cmd->disc_type = DISCONNECT_IMMEDIATE;
cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED);
......
......@@ -39,8 +39,8 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type,
u8 *role_id);
int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id);
int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
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_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
......
......@@ -1857,6 +1857,7 @@ static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
{
wlvif->bss_type = MAX_BSS_TYPE;
wlvif->role_id = WL12XX_INVALID_ROLE_ID;
wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
......@@ -1958,7 +1959,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
*/
ret = wl12xx_cmd_role_enable(wl, vif->addr,
WL1271_ROLE_DEVICE,
&wl->dev_role_id);
&wlvif->dev_role_id);
if (ret < 0)
goto irq_disable;
}
......@@ -2067,7 +2068,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
goto deinit;
if (wlvif->bss_type == BSS_TYPE_STA_BSS) {
ret = wl12xx_cmd_role_disable(wl, &wl->dev_role_id);
ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id);
if (ret < 0)
goto deinit;
}
......@@ -2131,7 +2132,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
wl->ap_ps_map = 0;
wl->sched_scanning = false;
wlvif->role_id = WL12XX_INVALID_ROLE_ID;
wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
memset(wl->roles_map, 0, sizeof(wl->roles_map));
memset(wl->links_map, 0, sizeof(wl->links_map));
memset(wl->roc_map, 0, sizeof(wl->roc_map));
......@@ -2289,11 +2290,11 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
if (idle) {
/* no need to croc if we weren't busy (e.g. during boot) */
if (wl12xx_is_roc(wl)) {
ret = wl12xx_croc(wl, wl->dev_role_id);
ret = wl12xx_croc(wl, wlvif->dev_role_id);
if (ret < 0)
goto out;
ret = wl12xx_cmd_role_stop_dev(wl);
ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
if (ret < 0)
goto out;
}
......@@ -2315,11 +2316,11 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
ieee80211_sched_scan_stopped(wl->hw);
}
ret = wl12xx_cmd_role_start_dev(wl);
ret = wl12xx_cmd_role_start_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wl->dev_role_id);
ret = wl12xx_roc(wl, wlvif->dev_role_id);
if (ret < 0)
goto out;
clear_bit(WL1271_FLAG_IDLE, &wl->flags);
......@@ -2408,7 +2409,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
if (wl12xx_is_roc(wl)) {
/* roaming */
ret = wl12xx_croc(wl, wl->dev_role_id);
ret = wl12xx_croc(wl,
wlvif->dev_role_id);
if (ret < 0)
goto out_sleep;
}
......@@ -2424,11 +2426,13 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
*/
if (wl12xx_is_roc(wl) &&
!(conf->flags & IEEE80211_CONF_IDLE)) {
ret = wl12xx_croc(wl, wl->dev_role_id);
ret = wl12xx_croc(wl,
wlvif->dev_role_id);
if (ret < 0)
goto out_sleep;
ret = wl12xx_roc(wl, wl->dev_role_id);
ret = wl12xx_roc(wl,
wlvif->dev_role_id);
if (ret < 0)
wl1271_warning("roc failed %d",
ret);
......@@ -2891,6 +2895,8 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
struct cfg80211_scan_request *req)
{
struct wl1271 *wl = hw->priv;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret;
u8 *ssid = NULL;
size_t len = 0;
......@@ -2925,8 +2931,8 @@ static int wl1271_op_hw_scan(struct ieee80211_hw *hw,
ret = -EBUSY;
goto out_sleep;
}
wl12xx_croc(wl, wl->dev_role_id);
wl12xx_cmd_role_stop_dev(wl);
wl12xx_croc(wl, wlvif->dev_role_id);
wl12xx_cmd_role_stop_dev(wl, wlvif);
}
ret = wl1271_scan(hw->priv, vif, ssid, len, req);
......@@ -3437,8 +3443,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (test_and_clear_bit(WL1271_FLAG_IBSS_JOINED,
&wl->flags)) {
wl1271_unjoin(wl, wlvif);
wl12xx_cmd_role_start_dev(wl);
wl12xx_roc(wl, wl->dev_role_id);
wl12xx_cmd_role_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif->dev_role_id);
}
}
}
......@@ -3605,16 +3611,17 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
* roaming on the same channel. until we will
* have a better flow...)
*/
if (test_bit(wl->dev_role_id, wl->roc_map)) {
ret = wl12xx_croc(wl, wl->dev_role_id);
if (test_bit(wlvif->dev_role_id, wl->roc_map)) {
ret = wl12xx_croc(wl,
wlvif->dev_role_id);
if (ret < 0)
goto out;
}
wl1271_unjoin(wl, wlvif);
if (!(conf_flags & IEEE80211_CONF_IDLE)) {
wl12xx_cmd_role_start_dev(wl);
wl12xx_roc(wl, wl->dev_role_id);
wl12xx_cmd_role_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif->dev_role_id);
}
}
}
......@@ -3693,12 +3700,12 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
* stop device role if started (we might already be in
* STA role). TODO: make it better.
*/
if (wl->dev_role_id != WL12XX_INVALID_ROLE_ID) {
ret = wl12xx_croc(wl, wl->dev_role_id);
if (wlvif->dev_role_id != WL12XX_INVALID_ROLE_ID) {
ret = wl12xx_croc(wl, wlvif->dev_role_id);
if (ret < 0)
goto out;
ret = wl12xx_cmd_role_stop_dev(wl);
ret = wl12xx_cmd_role_stop_dev(wl, wlvif);
if (ret < 0)
goto out;
}
......@@ -4882,7 +4889,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
wl->system_hlid = WL12XX_SYSTEM_HLID;
wl->sta_hlid = WL12XX_INVALID_LINK_ID;
wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
wl->dev_hlid = WL12XX_INVALID_LINK_ID;
wl->session_counter = 0;
wl->ap_bcast_hlid = WL12XX_INVALID_LINK_ID;
......
......@@ -34,6 +34,7 @@ void wl1271_scan_complete_work(struct work_struct *work)
{
struct delayed_work *dwork;
struct wl1271 *wl;
struct ieee80211_vif *vif;
struct wl12xx_vif *wlvif;
int ret;
bool is_sta, is_ibss;
......@@ -51,7 +52,8 @@ void wl1271_scan_complete_work(struct work_struct *work)
if (wl->scan.state == WL1271_SCAN_STATE_IDLE)
goto out;
wlvif = wl12xx_vif_to_data(wl->scan_vif);
vif = wl->scan_vif;
wlvif = wl12xx_vif_to_data(vif);
wl->scan.state = WL1271_SCAN_STATE_IDLE;
memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
......@@ -72,10 +74,10 @@ void wl1271_scan_complete_work(struct work_struct *work)
is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS);
if (((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) ||
(is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) &&
!test_bit(wl->dev_role_id, wl->roc_map)) {
!test_bit(wlvif->dev_role_id, wl->roc_map)) {
/* restore remain on channel */
wl12xx_cmd_role_start_dev(wl);
wl12xx_roc(wl, wl->dev_role_id);
wl12xx_cmd_role_start_dev(wl, wlvif);
wl12xx_roc(wl, wlvif->dev_role_id);
}
wl1271_ps_elp_sleep(wl);
......
......@@ -77,7 +77,8 @@ static void wl1271_free_tx_id(struct wl1271 *wl, int id)
}
static int wl1271_tx_update_filters(struct wl1271 *wl,
struct sk_buff *skb)
struct wl12xx_vif *wlvif,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr;
int ret;
......@@ -97,11 +98,11 @@ static int wl1271_tx_update_filters(struct wl1271 *wl,
goto out;
wl1271_debug(DEBUG_CMD, "starting device role for roaming");
ret = wl12xx_cmd_role_start_dev(wl);
ret = wl12xx_cmd_role_start_dev(wl, wlvif);
if (ret < 0)
goto out;
ret = wl12xx_roc(wl, wl->dev_role_id);
ret = wl12xx_roc(wl, wlvif->dev_role_id);
if (ret < 0)
goto out;
out:
......@@ -192,7 +193,7 @@ static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct ieee80211_vif *vif,
if (wlvif->bss_type == BSS_TYPE_AP_BSS)
return wl12xx_tx_get_hlid_ap(wl, skb);
wl1271_tx_update_filters(wl, skb);
wl1271_tx_update_filters(wl, wlvif, skb);
if ((test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags) ||
test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags)) &&
......
......@@ -401,7 +401,6 @@ struct wl1271 {
u8 mac_addr[ETH_ALEN];
int channel;
u8 dev_role_id;
u8 system_hlid;
u8 sta_hlid;
u8 dev_hlid;
......@@ -622,6 +621,9 @@ struct wl12xx_vif {
u8 p2p; /* we are using p2p role */
u8 role_id;
/* sta/ibss specific */
u8 dev_role_id;
u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
u8 ssid_len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册