提交 87fbcb0f 编写于 作者: E Eliad Peller 提交者: Luciano Coelho

wl12xx: define wl12xx_vif

Define a per-vif data struct.
This struct holds all the vif-specifc data, which is
currently being hold by the global wl struct.

Start by moving the basic_rate_set field into it.

NOTE: in order to make the patches a bit smaller, start by
using wl->vif in some functions, instead of changing all
the function prototypes at once. finally, wl->vif will be
removed altogether.
Signed-off-by: NEliad Peller <eliad@wizery.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 92c77c73
...@@ -555,7 +555,7 @@ int wl12xx_cmd_role_stop_dev(struct wl1271 *wl) ...@@ -555,7 +555,7 @@ int wl12xx_cmd_role_stop_dev(struct wl1271 *wl)
return ret; return ret;
} }
int wl12xx_cmd_role_start_sta(struct wl1271 *wl) int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
int ret; int ret;
...@@ -572,7 +572,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl) ...@@ -572,7 +572,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl)
if (wl->band == IEEE80211_BAND_5GHZ) if (wl->band == IEEE80211_BAND_5GHZ)
cmd->band = WL12XX_BAND_5GHZ; cmd->band = WL12XX_BAND_5GHZ;
cmd->channel = wl->channel; cmd->channel = wl->channel;
cmd->sta.basic_rate_set = cpu_to_le32(wl->basic_rate_set); cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
cmd->sta.beacon_interval = cpu_to_le16(wl->beacon_int); cmd->sta.beacon_interval = cpu_to_le16(wl->beacon_int);
cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY; cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY;
cmd->sta.ssid_len = wl->ssid_len; cmd->sta.ssid_len = wl->ssid_len;
...@@ -592,7 +592,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl) ...@@ -592,7 +592,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl)
wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d "
"basic_rate_set: 0x%x, remote_rates: 0x%x", "basic_rate_set: 0x%x, remote_rates: 0x%x",
wl->role_id, cmd->sta.hlid, cmd->sta.session, wl->role_id, cmd->sta.hlid, cmd->sta.session,
wl->basic_rate_set, wl->rate_set); wlvif->basic_rate_set, wl->rate_set);
ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0);
if (ret < 0) { if (ret < 0) {
...@@ -649,7 +649,7 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl) ...@@ -649,7 +649,7 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl)
return ret; return ret;
} }
int wl12xx_cmd_role_start_ap(struct wl1271 *wl) int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf;
...@@ -683,7 +683,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl) ...@@ -683,7 +683,7 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl)
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 = wl->ap_global_hlid;
cmd->ap.broadcast_hlid = wl->ap_bcast_hlid; cmd->ap.broadcast_hlid = wl->ap_bcast_hlid;
cmd->ap.basic_rate_set = cpu_to_le32(wl->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;
cmd->ap.beacon_expiry = WL1271_AP_DEF_BEACON_EXP; cmd->ap.beacon_expiry = WL1271_AP_DEF_BEACON_EXP;
...@@ -767,7 +767,7 @@ int wl12xx_cmd_role_stop_ap(struct wl1271 *wl) ...@@ -767,7 +767,7 @@ int wl12xx_cmd_role_stop_ap(struct wl1271 *wl)
return ret; return ret;
} }
int wl12xx_cmd_role_start_ibss(struct wl1271 *wl) int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf;
...@@ -785,7 +785,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl) ...@@ -785,7 +785,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl)
if (wl->band == IEEE80211_BAND_5GHZ) if (wl->band == IEEE80211_BAND_5GHZ)
cmd->band = WL12XX_BAND_5GHZ; cmd->band = WL12XX_BAND_5GHZ;
cmd->channel = wl->channel; cmd->channel = wl->channel;
cmd->ibss.basic_rate_set = cpu_to_le32(wl->basic_rate_set); cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
cmd->ibss.beacon_interval = cpu_to_le16(wl->beacon_int); cmd->ibss.beacon_interval = cpu_to_le16(wl->beacon_int);
cmd->ibss.dtim_interval = bss_conf->dtim_period; cmd->ibss.dtim_interval = bss_conf->dtim_period;
cmd->ibss.ssid_type = WL12XX_SSID_TYPE_ANY; cmd->ibss.ssid_type = WL12XX_SSID_TYPE_ANY;
...@@ -805,7 +805,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl) ...@@ -805,7 +805,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl)
wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d "
"basic_rate_set: 0x%x, remote_rates: 0x%x", "basic_rate_set: 0x%x, remote_rates: 0x%x",
wl->role_id, cmd->sta.hlid, cmd->sta.session, wl->role_id, cmd->sta.hlid, cmd->sta.session,
wl->basic_rate_set, wl->rate_set); wlvif->basic_rate_set, wl->rate_set);
wl1271_debug(DEBUG_CMD, "wl->bssid = %pM", wl->bssid); wl1271_debug(DEBUG_CMD, "wl->bssid = %pM", wl->bssid);
...@@ -1085,7 +1085,8 @@ int wl1271_cmd_build_klv_null_data(struct wl1271 *wl) ...@@ -1085,7 +1085,8 @@ int wl1271_cmd_build_klv_null_data(struct wl1271 *wl)
} }
int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid) int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 aid)
{ {
struct sk_buff *skb; struct sk_buff *skb;
int ret = 0; int ret = 0;
...@@ -1095,7 +1096,7 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid) ...@@ -1095,7 +1096,7 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid)
goto out; goto out;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, skb->data, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PS_POLL, skb->data,
skb->len, 0, wl->basic_rate_set); skb->len, 0, wlvif->basic_rate_set);
out: out:
dev_kfree_skb(skb); dev_kfree_skb(skb);
......
...@@ -41,11 +41,11 @@ int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, ...@@ -41,11 +41,11 @@ int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type,
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); int wl12xx_cmd_role_start_dev(struct wl1271 *wl);
int wl12xx_cmd_role_stop_dev(struct wl1271 *wl); int wl12xx_cmd_role_stop_dev(struct wl1271 *wl);
int wl12xx_cmd_role_start_sta(struct wl1271 *wl); int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_stop_sta(struct wl1271 *wl); int wl12xx_cmd_role_stop_sta(struct wl1271 *wl);
int wl12xx_cmd_role_start_ap(struct wl1271 *wl); int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl12xx_cmd_role_stop_ap(struct wl1271 *wl); int wl12xx_cmd_role_stop_ap(struct wl1271 *wl);
int wl12xx_cmd_role_start_ibss(struct wl1271 *wl); int wl12xx_cmd_role_start_ibss(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);
...@@ -56,7 +56,8 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, ...@@ -56,7 +56,8 @@ int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id, int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
void *buf, size_t buf_len, int index, u32 rates); void *buf, size_t buf_len, int index, u32 rates);
int wl1271_cmd_build_null_data(struct wl1271 *wl); int wl1271_cmd_build_null_data(struct wl1271 *wl);
int wl1271_cmd_build_ps_poll(struct wl1271 *wl, u16 aid); int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 aid);
int wl1271_cmd_build_probe_req(struct wl1271 *wl, int wl1271_cmd_build_probe_req(struct wl1271 *wl,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len, u8 band); const u8 *ie, size_t ie_len, u8 band);
......
...@@ -353,7 +353,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, ...@@ -353,7 +353,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
DRIVER_STATE_PRINT_INT(bss_type); DRIVER_STATE_PRINT_INT(bss_type);
DRIVER_STATE_PRINT_INT(channel); DRIVER_STATE_PRINT_INT(channel);
DRIVER_STATE_PRINT_HEX(rate_set); DRIVER_STATE_PRINT_HEX(rate_set);
DRIVER_STATE_PRINT_HEX(basic_rate_set);
DRIVER_STATE_PRINT_HEX(basic_rate); DRIVER_STATE_PRINT_HEX(basic_rate);
DRIVER_STATE_PRINT_INT(band); DRIVER_STATE_PRINT_INT(band);
DRIVER_STATE_PRINT_INT(beacon_int); DRIVER_STATE_PRINT_INT(beacon_int);
......
...@@ -122,7 +122,8 @@ int wl1271_init_templates_config(struct wl1271 *wl) ...@@ -122,7 +122,8 @@ int wl1271_init_templates_config(struct wl1271 *wl)
return 0; return 0;
} }
static int wl1271_ap_init_deauth_template(struct wl1271 *wl) static int wl1271_ap_init_deauth_template(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{ {
struct wl12xx_disconn_template *tmpl; struct wl12xx_disconn_template *tmpl;
int ret; int ret;
...@@ -137,7 +138,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl) ...@@ -137,7 +138,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl)
tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_DEAUTH); IEEE80211_STYPE_DEAUTH);
rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_DEAUTH_AP,
tmpl, sizeof(*tmpl), 0, rate); tmpl, sizeof(*tmpl), 0, rate);
...@@ -149,6 +150,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl) ...@@ -149,6 +150,7 @@ static int wl1271_ap_init_deauth_template(struct wl1271 *wl)
static int wl1271_ap_init_null_template(struct wl1271 *wl, static int wl1271_ap_init_null_template(struct wl1271 *wl,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct ieee80211_hdr_3addr *nullfunc; struct ieee80211_hdr_3addr *nullfunc;
int ret; int ret;
u32 rate; u32 rate;
...@@ -168,7 +170,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl, ...@@ -168,7 +170,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl,
memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); memcpy(nullfunc->addr2, vif->addr, ETH_ALEN);
memcpy(nullfunc->addr3, vif->addr, ETH_ALEN); memcpy(nullfunc->addr3, vif->addr, ETH_ALEN);
rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_NULL_DATA, nullfunc,
sizeof(*nullfunc), 0, rate); sizeof(*nullfunc), 0, rate);
...@@ -180,6 +182,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl, ...@@ -180,6 +182,7 @@ static int wl1271_ap_init_null_template(struct wl1271 *wl,
static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, static int wl1271_ap_init_qos_null_template(struct wl1271 *wl,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct ieee80211_qos_hdr *qosnull; struct ieee80211_qos_hdr *qosnull;
int ret; int ret;
u32 rate; u32 rate;
...@@ -199,7 +202,7 @@ static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, ...@@ -199,7 +202,7 @@ static int wl1271_ap_init_qos_null_template(struct wl1271 *wl,
memcpy(qosnull->addr2, vif->addr, ETH_ALEN); memcpy(qosnull->addr2, vif->addr, ETH_ALEN);
memcpy(qosnull->addr3, vif->addr, ETH_ALEN); memcpy(qosnull->addr3, vif->addr, ETH_ALEN);
rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_QOS_NULL_DATA, qosnull,
sizeof(*qosnull), 0, rate); sizeof(*qosnull), 0, rate);
...@@ -370,7 +373,7 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) ...@@ -370,7 +373,7 @@ static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl)
} }
/* generic ap initialization (non vif-specific) */ /* generic ap initialization (non vif-specific) */
static int wl1271_ap_hw_init(struct wl1271 *wl) static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
int ret; int ret;
...@@ -379,7 +382,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl) ...@@ -379,7 +382,7 @@ static int wl1271_ap_hw_init(struct wl1271 *wl)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_init_ap_rates(wl); ret = wl1271_init_ap_rates(wl, wlvif);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -388,9 +391,10 @@ static int wl1271_ap_hw_init(struct wl1271 *wl) ...@@ -388,9 +391,10 @@ static int wl1271_ap_hw_init(struct wl1271 *wl)
int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif) int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret; int ret;
ret = wl1271_ap_init_deauth_template(wl); ret = wl1271_ap_init_deauth_template(wl, wlvif);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -419,18 +423,19 @@ static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl, ...@@ -419,18 +423,19 @@ static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl,
return wl1271_ap_init_templates(wl, vif); return wl1271_ap_init_templates(wl, vif);
} }
int wl1271_init_ap_rates(struct wl1271 *wl) int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
int i, ret; int i, ret;
struct conf_tx_rate_class rc; struct conf_tx_rate_class rc;
u32 supported_rates; u32 supported_rates;
wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", wl->basic_rate_set); wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x",
wlvif->basic_rate_set);
if (wl->basic_rate_set == 0) if (wlvif->basic_rate_set == 0)
return -EINVAL; return -EINVAL;
rc.enabled_rates = wl->basic_rate_set; rc.enabled_rates = wlvif->basic_rate_set;
rc.long_retry_limit = 10; rc.long_retry_limit = 10;
rc.short_retry_limit = 10; rc.short_retry_limit = 10;
rc.aflags = 0; rc.aflags = 0;
...@@ -439,7 +444,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl) ...@@ -439,7 +444,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl)
return ret; return ret;
/* use the min basic rate for AP broadcast/multicast */ /* use the min basic rate for AP broadcast/multicast */
rc.enabled_rates = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); rc.enabled_rates = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
rc.short_retry_limit = 10; rc.short_retry_limit = 10;
rc.long_retry_limit = 10; rc.long_retry_limit = 10;
rc.aflags = 0; rc.aflags = 0;
...@@ -451,7 +456,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl) ...@@ -451,7 +456,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl)
* If the basic rates contain OFDM rates, use OFDM only * If the basic rates contain OFDM rates, use OFDM only
* rates for unicast TX as well. Else use all supported rates. * rates for unicast TX as well. Else use all supported rates.
*/ */
if ((wl->basic_rate_set & CONF_TX_OFDM_RATES)) if ((wlvif->basic_rate_set & CONF_TX_OFDM_RATES))
supported_rates = CONF_TX_OFDM_RATES; supported_rates = CONF_TX_OFDM_RATES;
else else
supported_rates = CONF_TX_AP_ENABLED_RATES; supported_rates = CONF_TX_AP_ENABLED_RATES;
...@@ -564,6 +569,7 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif) ...@@ -564,6 +569,7 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif)
int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct conf_tx_ac_category *conf_ac; struct conf_tx_ac_category *conf_ac;
struct conf_tx_tid *conf_tid; struct conf_tx_tid *conf_tid;
bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
...@@ -572,7 +578,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) ...@@ -572,7 +578,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
/* Mode specific init */ /* Mode specific init */
if (is_ap) { if (is_ap) {
ret = wl1271_ap_hw_init(wl); ret = wl1271_ap_hw_init(wl, wlvif);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -34,7 +34,7 @@ int wl1271_init_energy_detection(struct wl1271 *wl); ...@@ -34,7 +34,7 @@ int wl1271_init_energy_detection(struct wl1271 *wl);
int wl1271_chip_specific_init(struct wl1271 *wl); int wl1271_chip_specific_init(struct wl1271 *wl);
int wl1271_hw_init(struct wl1271 *wl); int wl1271_hw_init(struct wl1271 *wl);
int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif); int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif);
int wl1271_init_ap_rates(struct wl1271 *wl); int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif);
int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif); int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif);
#endif #endif
...@@ -1837,6 +1837,11 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl) ...@@ -1837,6 +1837,11 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl)
return WL12XX_INVALID_ROLE_TYPE; return WL12XX_INVALID_ROLE_TYPE;
} }
static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
{
wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
}
static int wl1271_op_add_interface(struct ieee80211_hw *hw, static int wl1271_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
...@@ -1857,6 +1862,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ...@@ -1857,6 +1862,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
} }
wl12xx_init_vif_data(wl12xx_vif_to_data(vif));
/* /*
* in some very corner case HW recovery scenarios its possible to * in some very corner case HW recovery scenarios its possible to
...@@ -2163,7 +2169,8 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, ...@@ -2163,7 +2169,8 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
cancel_work_sync(&wl->recovery_work); cancel_work_sync(&wl->recovery_work);
} }
static int wl1271_join(struct wl1271 *wl, bool set_assoc) static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
bool set_assoc)
{ {
int ret; int ret;
bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS);
...@@ -2184,9 +2191,9 @@ static int wl1271_join(struct wl1271 *wl, bool set_assoc) ...@@ -2184,9 +2191,9 @@ static int wl1271_join(struct wl1271 *wl, bool set_assoc)
set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags);
if (is_ibss) if (is_ibss)
ret = wl12xx_cmd_role_start_ibss(wl); ret = wl12xx_cmd_role_start_ibss(wl, wlvif);
else else
ret = wl12xx_cmd_role_start_sta(wl); ret = wl12xx_cmd_role_start_sta(wl, wlvif);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -2244,10 +2251,10 @@ static int wl1271_unjoin(struct wl1271 *wl) ...@@ -2244,10 +2251,10 @@ static int wl1271_unjoin(struct wl1271 *wl)
return ret; return ret;
} }
static void wl1271_set_band_rate(struct wl1271 *wl) static void wl1271_set_band_rate(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
wl->basic_rate_set = wl->bitrate_masks[wl->band]; wlvif->basic_rate_set = wl->bitrate_masks[wl->band];
wl->rate_set = wl->basic_rate_set; wl->rate_set = wlvif->basic_rate_set;
} }
static bool wl12xx_is_roc(struct wl1271 *wl) static bool wl12xx_is_roc(struct wl1271 *wl)
...@@ -2261,7 +2268,8 @@ static bool wl12xx_is_roc(struct wl1271 *wl) ...@@ -2261,7 +2268,8 @@ static bool wl12xx_is_roc(struct wl1271 *wl)
return true; return true;
} }
static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
bool idle)
{ {
int ret; int ret;
...@@ -2276,7 +2284,8 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) ...@@ -2276,7 +2284,8 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle)
if (ret < 0) if (ret < 0)
goto out; goto out;
} }
wl->rate_set = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); wl->rate_set = wl1271_tx_min_rate_get(wl,
wlvif->basic_rate_set);
ret = wl1271_acx_sta_rate_policies(wl); ret = wl1271_acx_sta_rate_policies(wl);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -2310,6 +2319,8 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle) ...@@ -2310,6 +2319,8 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, bool idle)
static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_vif *vif = wl->vif; /* TODO: reconfig all vifs */
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct ieee80211_conf *conf = &hw->conf; struct ieee80211_conf *conf = &hw->conf;
int channel, ret = 0; int channel, ret = 0;
bool is_ap; bool is_ap;
...@@ -2371,10 +2382,11 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -2371,10 +2382,11 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
* association frames and other control messages. * association frames and other control messages.
*/ */
if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
wl1271_set_band_rate(wl); wl1271_set_band_rate(wl, wlvif);
wl->basic_rate = wl->basic_rate =
wl1271_tx_min_rate_get(wl, wl->basic_rate_set); wl1271_tx_min_rate_get(wl,
wlvif->basic_rate_set);
ret = wl1271_acx_sta_rate_policies(wl); ret = wl1271_acx_sta_rate_policies(wl);
if (ret < 0) if (ret < 0)
wl1271_warning("rate policy for channel " wl1271_warning("rate policy for channel "
...@@ -2387,7 +2399,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -2387,7 +2399,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
if (ret < 0) if (ret < 0)
goto out_sleep; goto out_sleep;
} }
ret = wl1271_join(wl, false); ret = wl1271_join(wl, wlvif, false);
if (ret < 0) if (ret < 0)
wl1271_warning("cmd join on channel " wl1271_warning("cmd join on channel "
"failed %d", ret); "failed %d", ret);
...@@ -2413,7 +2425,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -2413,7 +2425,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_IDLE && !is_ap) { if (changed & IEEE80211_CONF_CHANGE_IDLE && !is_ap) {
ret = wl1271_sta_handle_idle(wl, ret = wl1271_sta_handle_idle(wl, wlvif,
conf->flags & IEEE80211_CONF_IDLE); conf->flags & IEEE80211_CONF_IDLE);
if (ret < 0) if (ret < 0)
wl1271_warning("idle mode change failed %d", ret); wl1271_warning("idle mode change failed %d", ret);
...@@ -3207,6 +3219,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, ...@@ -3207,6 +3219,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
struct ieee80211_bss_conf *bss_conf, struct ieee80211_bss_conf *bss_conf,
u32 changed) u32 changed)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
int ret = 0; int ret = 0;
...@@ -3235,7 +3248,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, ...@@ -3235,7 +3248,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
dev_kfree_skb(beacon); dev_kfree_skb(beacon);
goto out; goto out;
} }
min_rate = wl1271_tx_min_rate_get(wl, wl->basic_rate_set); min_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set);
tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON :
CMD_TEMPL_BEACON; CMD_TEMPL_BEACON;
ret = wl1271_cmd_template_set(wl, tmpl_id, ret = wl1271_cmd_template_set(wl, tmpl_id,
...@@ -3290,17 +3303,18 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl, ...@@ -3290,17 +3303,18 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
struct ieee80211_bss_conf *bss_conf, struct ieee80211_bss_conf *bss_conf,
u32 changed) u32 changed)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret = 0; int ret = 0;
if ((changed & BSS_CHANGED_BASIC_RATES)) { if ((changed & BSS_CHANGED_BASIC_RATES)) {
u32 rates = bss_conf->basic_rates; u32 rates = bss_conf->basic_rates;
wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates,
wl->band); wl->band);
wl->basic_rate = wl1271_tx_min_rate_get(wl, wl->basic_rate = wl1271_tx_min_rate_get(wl,
wl->basic_rate_set); wlvif->basic_rate_set);
ret = wl1271_init_ap_rates(wl); ret = wl1271_init_ap_rates(wl, wlvif);
if (ret < 0) { if (ret < 0) {
wl1271_error("AP rate policy change failed %d", ret); wl1271_error("AP rate policy change failed %d", ret);
goto out; goto out;
...@@ -3318,7 +3332,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl, ...@@ -3318,7 +3332,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
if ((changed & BSS_CHANGED_BEACON_ENABLED)) { if ((changed & BSS_CHANGED_BEACON_ENABLED)) {
if (bss_conf->enable_beacon) { if (bss_conf->enable_beacon) {
if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) { if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) {
ret = wl12xx_cmd_role_start_ap(wl); ret = wl12xx_cmd_role_start_ap(wl, wlvif);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -3366,6 +3380,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3366,6 +3380,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
struct ieee80211_bss_conf *bss_conf, struct ieee80211_bss_conf *bss_conf,
u32 changed) u32 changed)
{ {
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
bool do_join = false, set_assoc = false; bool do_join = false, set_assoc = false;
bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS);
bool ibss_joined = false; bool ibss_joined = false;
...@@ -3480,11 +3495,12 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3480,11 +3495,12 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
* to use with control frames. * to use with control frames.
*/ */
rates = bss_conf->basic_rates; rates = bss_conf->basic_rates;
wl->basic_rate_set = wlvif->basic_rate_set =
wl1271_tx_enabled_rates_get(wl, rates, wl1271_tx_enabled_rates_get(wl, rates,
wl->band); wl->band);
wl->basic_rate = wl->basic_rate =
wl1271_tx_min_rate_get(wl, wl->basic_rate_set); wl1271_tx_min_rate_get(wl,
wlvif->basic_rate_set);
if (sta_rate_set) if (sta_rate_set)
wl->rate_set = wl1271_tx_enabled_rates_get(wl, wl->rate_set = wl1271_tx_enabled_rates_get(wl,
sta_rate_set, sta_rate_set,
...@@ -3499,7 +3515,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3499,7 +3515,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
* updates it by itself when the first beacon is * updates it by itself when the first beacon is
* received after a join. * received after a join.
*/ */
ret = wl1271_cmd_build_ps_poll(wl, wl->aid); ret = wl1271_cmd_build_ps_poll(wl, wlvif, wl->aid);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -3534,9 +3550,10 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3534,9 +3550,10 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
ieee80211_enable_dyn_ps(wl->vif); ieee80211_enable_dyn_ps(wl->vif);
/* revert back to minimum rates for the current band */ /* revert back to minimum rates for the current band */
wl1271_set_band_rate(wl); wl1271_set_band_rate(wl, wlvif);
wl->basic_rate = wl->basic_rate =
wl1271_tx_min_rate_get(wl, wl->basic_rate_set); wl1271_tx_min_rate_get(wl,
wlvif->basic_rate_set);
ret = wl1271_acx_sta_rate_policies(wl); ret = wl1271_acx_sta_rate_policies(wl);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -3587,11 +3604,12 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3587,11 +3604,12 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (bss_conf->ibss_joined) { if (bss_conf->ibss_joined) {
u32 rates = bss_conf->basic_rates; u32 rates = bss_conf->basic_rates;
wl->basic_rate_set = wlvif->basic_rate_set =
wl1271_tx_enabled_rates_get(wl, rates, wl1271_tx_enabled_rates_get(wl, rates,
wl->band); wl->band);
wl->basic_rate = wl->basic_rate =
wl1271_tx_min_rate_get(wl, wl->basic_rate_set); wl1271_tx_min_rate_get(wl,
wlvif->basic_rate_set);
/* by default, use 11b + OFDM rates */ /* by default, use 11b + OFDM rates */
wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES; wl->rate_set = CONF_TX_IBSS_DEFAULT_RATES;
...@@ -3634,7 +3652,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3634,7 +3652,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
} }
if (do_join) { if (do_join) {
ret = wl1271_join(wl, set_assoc); ret = wl1271_join(wl, wlvif, set_assoc);
if (ret < 0) { if (ret < 0) {
wl1271_warning("cmd join failed %d", ret); wl1271_warning("cmd join failed %d", ret);
goto out; goto out;
...@@ -4750,6 +4768,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl) ...@@ -4750,6 +4768,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl)); SET_IEEE80211_DEV(wl->hw, wl1271_wl_to_dev(wl));
wl->hw->sta_data_size = sizeof(struct wl1271_station); wl->hw->sta_data_size = sizeof(struct wl1271_station);
wl->hw->vif_data_size = sizeof(struct wl12xx_vif);
wl->hw->max_rx_aggregation_subframes = 8; wl->hw->max_rx_aggregation_subframes = 8;
...@@ -4824,7 +4843,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void) ...@@ -4824,7 +4843,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->rx_counter = 0; wl->rx_counter = 0;
wl->psm_entry_retry = 0; wl->psm_entry_retry = 0;
wl->power_level = WL1271_DEFAULT_POWER_LEVEL; wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
wl->basic_rate = CONF_TX_RATE_MASK_BASIC; wl->basic_rate = CONF_TX_RATE_MASK_BASIC;
wl->rate_set = CONF_TX_RATE_MASK_BASIC; wl->rate_set = CONF_TX_RATE_MASK_BASIC;
wl->band = IEEE80211_BAND_2GHZ; wl->band = IEEE80211_BAND_2GHZ;
......
...@@ -525,7 +525,6 @@ struct wl1271 { ...@@ -525,7 +525,6 @@ struct wl1271 {
* bits 16-23 - 802.11n MCS index mask * bits 16-23 - 802.11n MCS index mask
* support only 1 stream, thus only 8 bits for the MCS rates (0-7). * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
*/ */
u32 basic_rate_set;
u32 basic_rate; u32 basic_rate;
u32 rate_set; u32 rate_set;
u32 bitrate_masks[IEEE80211_NUM_BANDS]; u32 bitrate_masks[IEEE80211_NUM_BANDS];
...@@ -639,6 +638,21 @@ struct wl1271_station { ...@@ -639,6 +638,21 @@ struct wl1271_station {
u8 hlid; u8 hlid;
}; };
struct wl12xx_vif {
u32 basic_rate_set;
};
static inline struct wl12xx_vif *wl12xx_vif_to_data(struct ieee80211_vif *vif)
{
return (struct wl12xx_vif *)vif->drv_priv;
}
static inline
struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif)
{
return container_of((void *)wlvif, struct ieee80211_vif, drv_priv);
}
int wl1271_plt_start(struct wl1271 *wl); int wl1271_plt_start(struct wl1271 *wl);
int wl1271_plt_stop(struct wl1271 *wl); int wl1271_plt_stop(struct wl1271 *wl);
int wl1271_recalc_rx_streaming(struct wl1271 *wl); int wl1271_recalc_rx_streaming(struct wl1271 *wl);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册