wl12xx: move ap_global_hlid and ap_bcast_hlid into wlvif

move ap_global_hlid and ap_bcast_hlid into the per-interface
data, rather than being global.

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-05 11:55:54 +02:00 committed by Luciano Coelho
parent 154da67c7d
commit a8ab39a4b5
6 changed files with 50 additions and 41 deletions

View File

@ -671,19 +671,19 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
goto out; goto out;
} }
ret = wl12xx_allocate_link(wl, &wl->ap_global_hlid); ret = wl12xx_allocate_link(wl, &wlvif->ap.global_hlid);
if (ret < 0) if (ret < 0)
goto out_free; goto out_free;
ret = wl12xx_allocate_link(wl, &wl->ap_bcast_hlid); ret = wl12xx_allocate_link(wl, &wlvif->ap.bcast_hlid);
if (ret < 0) if (ret < 0)
goto out_free_global; goto out_free_global;
cmd->role_id = wlvif->role_id; cmd->role_id = wlvif->role_id;
cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period); cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period);
cmd->ap.bss_index = WL1271_AP_BSS_INDEX; cmd->ap.bss_index = WL1271_AP_BSS_INDEX;
cmd->ap.global_hlid = wl->ap_global_hlid; cmd->ap.global_hlid = wlvif->ap.global_hlid;
cmd->ap.broadcast_hlid = wl->ap_bcast_hlid; cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid;
cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
cmd->ap.beacon_interval = cpu_to_le16(wl->beacon_int); cmd->ap.beacon_interval = cpu_to_le16(wl->beacon_int);
cmd->ap.dtim_interval = bss_conf->dtim_period; cmd->ap.dtim_interval = bss_conf->dtim_period;
@ -725,10 +725,10 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
goto out_free; goto out_free;
out_free_bcast: out_free_bcast:
wl12xx_free_link(wl, &wl->ap_bcast_hlid); wl12xx_free_link(wl, &wlvif->ap.bcast_hlid);
out_free_global: out_free_global:
wl12xx_free_link(wl, &wl->ap_global_hlid); wl12xx_free_link(wl, &wlvif->ap.global_hlid);
out_free: out_free:
kfree(cmd); kfree(cmd);
@ -758,8 +758,8 @@ int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
goto out_free; goto out_free;
} }
wl12xx_free_link(wl, &wl->ap_bcast_hlid); wl12xx_free_link(wl, &wlvif->ap.bcast_hlid);
wl12xx_free_link(wl, &wl->ap_global_hlid); wl12xx_free_link(wl, &wlvif->ap.global_hlid);
out_free: out_free:
kfree(cmd); kfree(cmd);
@ -1264,12 +1264,11 @@ out:
return ret; return ret;
} }
int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct ieee80211_vif *vif, int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 action, u8 id, u8 key_type, u16 action, u8 id, u8 key_type,
u8 key_size, const u8 *key, const u8 *addr, u8 key_size, const u8 *key, const u8 *addr,
u32 tx_seq_32, u16 tx_seq_16) u32 tx_seq_32, u16 tx_seq_16)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct wl1271_cmd_set_keys *cmd; struct wl1271_cmd_set_keys *cmd;
int ret = 0; int ret = 0;
@ -1334,7 +1333,8 @@ out:
* TODO: merge with sta/ibss into 1 set_key function. * TODO: merge with sta/ibss into 1 set_key function.
* note there are slight diffs * note there are slight diffs
*/ */
int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 action, u8 id, u8 key_type,
u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32, u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
u16 tx_seq_16) u16 tx_seq_16)
{ {
@ -1346,7 +1346,7 @@ int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
if (!cmd) if (!cmd)
return -ENOMEM; return -ENOMEM;
if (hlid == wl->ap_bcast_hlid) { if (hlid == wlvif->ap.bcast_hlid) {
if (key_type == KEY_WEP) if (key_type == KEY_WEP)
lid_type = WEP_DEFAULT_LID_TYPE; lid_type = WEP_DEFAULT_LID_TYPE;
else else

View File

@ -70,11 +70,12 @@ int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif);
int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl, int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
struct wl12xx_vif *wlvif); struct wl12xx_vif *wlvif);
int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid); int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid);
int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct ieee80211_vif *vif, int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 action, u8 id, u8 key_type, u16 action, u8 id, u8 key_type,
u8 key_size, const u8 *key, const u8 *addr, u8 key_size, const u8 *key, const u8 *addr,
u32 tx_seq_32, u16 tx_seq_16); u32 tx_seq_32, u16 tx_seq_16);
int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 action, u8 id, u8 key_type,
u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32, u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
u16 tx_seq_16); u16 tx_seq_16);
int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid); int wl12xx_cmd_set_peer_state(struct wl1271 *wl, u8 hlid);

View File

@ -1488,8 +1488,9 @@ int wl1271_plt_stop(struct wl1271 *wl)
static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(control->control.vif); struct ieee80211_vif *vif = info->control.vif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
unsigned long flags; unsigned long flags;
int q, mapping; int q, mapping;
u8 hlid = 0; u8 hlid = 0;
@ -1498,7 +1499,7 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
q = wl1271_tx_get_queue(mapping); q = wl1271_tx_get_queue(mapping);
if (wlvif->bss_type == BSS_TYPE_AP_BSS) if (wlvif->bss_type == BSS_TYPE_AP_BSS)
hlid = wl12xx_tx_get_hlid_ap(wl, skb); hlid = wl12xx_tx_get_hlid_ap(wl, wlvif, skb);
spin_lock_irqsave(&wl->wl_lock, flags); spin_lock_irqsave(&wl->wl_lock, flags);
@ -1858,7 +1859,12 @@ static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
wlvif->bss_type = MAX_BSS_TYPE; wlvif->bss_type = MAX_BSS_TYPE;
wlvif->role_id = WL12XX_INVALID_ROLE_ID; wlvif->role_id = WL12XX_INVALID_ROLE_ID;
wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
/* TODO: init union by type */
wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; wlvif->sta.hlid = WL12XX_INVALID_LINK_ID;
wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID;
wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID;
wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
@ -2084,8 +2090,8 @@ deinit:
/* clear all hlids (except system_hlid) */ /* clear all hlids (except system_hlid) */
wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; wlvif->sta.hlid = WL12XX_INVALID_LINK_ID;
wl->dev_hlid = WL12XX_INVALID_LINK_ID; wl->dev_hlid = WL12XX_INVALID_LINK_ID;
wl->ap_bcast_hlid = WL12XX_INVALID_LINK_ID; wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID;
wl->ap_global_hlid = WL12XX_INVALID_LINK_ID; wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID;
/* /*
* this must be before the cancel_work calls below, so that the work * this must be before the cancel_work calls below, so that the work
@ -2653,7 +2659,7 @@ static void wl1271_free_ap_keys(struct wl1271 *wl)
} }
} }
static int wl1271_ap_init_hwenc(struct wl1271 *wl) static int wl1271_ap_init_hwenc(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
int i, ret = 0; int i, ret = 0;
struct wl1271_ap_key *key; struct wl1271_ap_key *key;
@ -2667,9 +2673,9 @@ static int wl1271_ap_init_hwenc(struct wl1271 *wl)
key = wl->recorded_ap_keys[i]; key = wl->recorded_ap_keys[i];
hlid = key->hlid; hlid = key->hlid;
if (hlid == WL12XX_INVALID_LINK_ID) if (hlid == WL12XX_INVALID_LINK_ID)
hlid = wl->ap_bcast_hlid; hlid = wlvif->ap.bcast_hlid;
ret = wl1271_cmd_set_ap_key(wl, KEY_ADD_OR_REPLACE, ret = wl1271_cmd_set_ap_key(wl, wlvif, KEY_ADD_OR_REPLACE,
key->id, key->key_type, key->id, key->key_type,
key->key_size, key->key, key->key_size, key->key,
hlid, key->tx_seq_32, hlid, key->tx_seq_32,
@ -2683,7 +2689,7 @@ static int wl1271_ap_init_hwenc(struct wl1271 *wl)
if (wep_key_added) { if (wep_key_added) {
ret = wl12xx_cmd_set_default_wep_key(wl, wl->default_key, ret = wl12xx_cmd_set_default_wep_key(wl, wl->default_key,
wl->ap_bcast_hlid); wlvif->ap.bcast_hlid);
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
@ -2709,7 +2715,7 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wl_sta = (struct wl1271_station *)sta->drv_priv; wl_sta = (struct wl1271_station *)sta->drv_priv;
hlid = wl_sta->hlid; hlid = wl_sta->hlid;
} else { } else {
hlid = wl->ap_bcast_hlid; hlid = wlvif->ap.bcast_hlid;
} }
if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) { if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) {
@ -2725,7 +2731,7 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
key, hlid, tx_seq_32, key, hlid, tx_seq_32,
tx_seq_16); tx_seq_16);
} else { } else {
ret = wl1271_cmd_set_ap_key(wl, action, ret = wl1271_cmd_set_ap_key(wl, wlvif, action,
id, key_type, key_size, id, key_type, key_size,
key, hlid, tx_seq_32, key, hlid, tx_seq_32,
tx_seq_16); tx_seq_16);
@ -2769,7 +2775,7 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) wlvif->sta.hlid == WL12XX_INVALID_LINK_ID)
return 0; return 0;
ret = wl1271_cmd_set_sta_key(wl, vif, action, ret = wl1271_cmd_set_sta_key(wl, wlvif, action,
id, key_type, key_size, id, key_type, key_size,
key, addr, tx_seq_32, key, addr, tx_seq_32,
tx_seq_16); tx_seq_16);
@ -3375,7 +3381,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = wl1271_ap_init_hwenc(wl); ret = wl1271_ap_init_hwenc(wl, wlvif);
if (ret < 0) if (ret < 0)
goto out; goto out;
@ -4891,8 +4897,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->system_hlid = WL12XX_SYSTEM_HLID; wl->system_hlid = WL12XX_SYSTEM_HLID;
wl->dev_hlid = WL12XX_INVALID_LINK_ID; wl->dev_hlid = WL12XX_INVALID_LINK_ID;
wl->session_counter = 0; wl->session_counter = 0;
wl->ap_bcast_hlid = WL12XX_INVALID_LINK_ID;
wl->ap_global_hlid = WL12XX_INVALID_LINK_ID;
wl->active_sta_count = 0; wl->active_sta_count = 0;
setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer, setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
(unsigned long) wl); (unsigned long) wl);

View File

@ -40,7 +40,7 @@ static int wl1271_set_default_wep_key(struct wl1271 *wl,
if (is_ap) if (is_ap)
ret = wl12xx_cmd_set_default_wep_key(wl, id, ret = wl12xx_cmd_set_default_wep_key(wl, id,
wl->ap_bcast_hlid); wlvif->ap.bcast_hlid);
else else
ret = wl12xx_cmd_set_default_wep_key(wl, id, wlvif->sta.hlid); ret = wl12xx_cmd_set_default_wep_key(wl, id, wlvif->sta.hlid);
@ -156,7 +156,8 @@ bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
return wl->dummy_packet == skb; return wl->dummy_packet == skb;
} }
u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb) u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif,
struct sk_buff *skb)
{ {
struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb);
@ -174,9 +175,9 @@ u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb)
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (ieee80211_is_mgmt(hdr->frame_control)) if (ieee80211_is_mgmt(hdr->frame_control))
return wl->ap_global_hlid; return wlvif->ap.global_hlid;
else else
return wl->ap_bcast_hlid; return wlvif->ap.bcast_hlid;
} }
} }
@ -191,7 +192,7 @@ static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct ieee80211_vif *vif,
return wl->system_hlid; return wl->system_hlid;
if (wlvif->bss_type == BSS_TYPE_AP_BSS) if (wlvif->bss_type == BSS_TYPE_AP_BSS)
return wl12xx_tx_get_hlid_ap(wl, skb); return wl12xx_tx_get_hlid_ap(wl, wlvif, skb);
wl1271_tx_update_filters(wl, wlvif, skb); wl1271_tx_update_filters(wl, wlvif, skb);
@ -341,9 +342,9 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct ieee80211_vif *vif,
else else
rate_idx = ACX_TX_BASIC_RATE; rate_idx = ACX_TX_BASIC_RATE;
} else { } else {
if (hlid == wl->ap_global_hlid) if (hlid == wlvif->ap.global_hlid)
rate_idx = ACX_TX_AP_MODE_MGMT_RATE; rate_idx = ACX_TX_AP_MODE_MGMT_RATE;
else if (hlid == wl->ap_bcast_hlid) else if (hlid == wlvif->ap.bcast_hlid)
rate_idx = ACX_TX_AP_MODE_BCST_RATE; rate_idx = ACX_TX_AP_MODE_BCST_RATE;
else else
rate_idx = ac; rate_idx = ac;

View File

@ -212,7 +212,8 @@ u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set, u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set,
enum ieee80211_band rate_band); enum ieee80211_band rate_band);
u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set); u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set);
u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb); u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif,
struct sk_buff *skb);
void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid);
void wl1271_handle_tx_low_watermark(struct wl1271 *wl); void wl1271_handle_tx_low_watermark(struct wl1271 *wl);
bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb); bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb);

View File

@ -403,8 +403,6 @@ struct wl1271 {
int channel; int channel;
u8 system_hlid; u8 system_hlid;
u8 dev_hlid; u8 dev_hlid;
u8 ap_global_hlid;
u8 ap_bcast_hlid;
unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)]; unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
@ -627,6 +625,10 @@ struct wl12xx_vif {
struct { struct {
u8 hlid; u8 hlid;
} sta; } sta;
struct {
u8 global_hlid;
u8 bcast_hlid;
} ap;
}; };
u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; u8 ssid[IEEE80211_MAX_SSID_LEN + 1];