提交 d94cd297 编写于 作者: J Juuso Oikarinen 提交者: John W. Linville

wl1271: Update join usage

Update the usage of join's, including using actual beacon interval and
dtim from AP, and configuring a basic rate set from AP.
Signed-off-by: NJuuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: NLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: NLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 8a5a37a6
......@@ -104,6 +104,8 @@ enum {
CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
#define WL1271_DEFAULT_BASIC_RATE_SET (ACX_RATE_MASK_ALL)
#define WL1271_FW_NAME "wl1271-fw.bin"
#define WL1271_NVS_NAME "wl1271-nvs.bin"
......@@ -118,6 +120,9 @@ enum {
#define WL1271_ELP_HW_STATE_ASLEEP 0
#define WL1271_ELP_HW_STATE_IRQ 1
#define WL1271_DEFAULT_BEACON_INT 100
#define WL1271_DEFAULT_DTIM_PERIOD 1
enum wl1271_state {
WL1271_STATE_OFF,
WL1271_STATE_ON,
......@@ -369,6 +374,13 @@ struct wl1271 {
/* Our association ID */
u16 aid;
/* Beacon parameters */
u16 beacon_int;
u8 dtim_period;
/* currently configured rate set */
u32 basic_rate_set;
/* The current band */
enum ieee80211_band band;
......
......@@ -175,11 +175,9 @@ int wl1271_cmd_cal(struct wl1271 *wl)
return ret;
}
int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
u16 beacon_interval, u8 wait)
int wl1271_cmd_join(struct wl1271 *wl)
{
static bool do_cal = true;
unsigned long timeout;
struct wl1271_cmd_join *join;
int ret, i;
u8 *bssid;
......@@ -213,9 +211,9 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
join->beacon_interval = beacon_interval;
join->dtim_interval = dtim_interval;
join->bss_type = bss_type;
join->beacon_interval = wl->beacon_int;
join->dtim_interval = wl->dtim_period;
join->bss_type = wl->bss_type;
join->channel = wl->channel;
join->ssid_len = wl->ssid_len;
memcpy(join->ssid, wl->ssid, wl->ssid_len);
......@@ -239,14 +237,11 @@ int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
goto out_free;
}
timeout = msecs_to_jiffies(JOIN_TIMEOUT);
/*
* ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
* simplify locking we just sleep instead, for now
*/
if (wait)
msleep(10);
msleep(10);
out_free:
kfree(join);
......
......@@ -30,8 +30,7 @@
struct acx_header;
int wl1271_cmd_send(struct wl1271 *wl, u16 type, void *buf, size_t buf_len);
int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type, u8 dtim_interval,
u16 beacon_interval, u8 wait);
int wl1271_cmd_join(struct wl1271 *wl);
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_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
......
......@@ -394,8 +394,7 @@ static void wl1271_filter_work(struct work_struct *work)
if (ret < 0)
goto out;
/* FIXME: replace the magic numbers with proper definitions */
ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
ret = wl1271_cmd_join(wl);
if (ret < 0)
goto out_sleep;
......@@ -672,8 +671,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
memcpy(wl->ssid, conf->ssid, wl->ssid_len);
if (wl->bss_type != BSS_TYPE_IBSS) {
/* FIXME: replace the magic numbers with proper definitions */
ret = wl1271_cmd_join(wl, wl->bss_type, 5, 100, 1);
ret = wl1271_cmd_join(wl);
if (ret < 0)
goto out_sleep;
}
......@@ -696,8 +694,7 @@ static int wl1271_op_config_interface(struct ieee80211_hw *hw,
if (ret < 0)
goto out_sleep;
/* FIXME: replace the magic numbers with proper definitions */
ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
ret = wl1271_cmd_join(wl);
if (ret < 0)
goto out_sleep;
......@@ -738,8 +735,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
u8 old_channel = wl->channel;
wl->channel = channel;
/* FIXME: use beacon interval provided by mac80211 */
ret = wl1271_cmd_join(wl, wl->bss_type, 1, 100, 0);
ret = wl1271_cmd_join(wl);
if (ret < 0) {
wl->channel = old_channel;
goto out_sleep;
......@@ -1016,8 +1012,17 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_ASSOC) {
if (bss_conf->assoc) {
wl->beacon_int = bss_conf->beacon_int;
wl->dtim_period = bss_conf->dtim_period;
wl->aid = bss_conf->aid;
ret = wl1271_cmd_join(wl);
if (ret < 0) {
wl1271_warning("Association configuration "
"failed %d", ret);
goto out_sleep;
}
ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
if (ret < 0)
goto out_sleep;
......@@ -1033,7 +1038,14 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
if (ret < 0)
goto out_sleep;
}
} else {
/* use defaults when not associated */
wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
wl->aid = 0;
}
}
if (changed & BSS_CHANGED_ERP_SLOT) {
......@@ -1066,13 +1078,20 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
}
if (changed & BSS_CHANGED_BASIC_RATES) {
u32 enabled_rates = wl1271_enabled_rates_get(
wl->basic_rate_set = wl1271_enabled_rates_get(
wl, bss_conf->basic_rates);
ret = wl1271_acx_rate_policies(wl, enabled_rates);
ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
if (ret < 0) {
wl1271_warning("Set rate policies failed %d", ret);
goto out_sleep;
}
ret = wl1271_cmd_join(wl);
if (ret < 0) {
wl1271_warning("Join with new basic rate "
"set failed %d", ret);
goto out_sleep;
}
}
out_sleep:
......@@ -1269,6 +1288,9 @@ static int __devinit wl1271_probe(struct spi_device *spi)
wl->psm_requested = false;
wl->tx_queue_stopped = false;
wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
wl->dtim_period = WL1271_DEFAULT_DTIM_PERIOD;
wl->basic_rate_set = WL1271_DEFAULT_BASIC_RATE_SET;
wl->band = IEEE80211_BAND_2GHZ;
/* We use the default power on sleep time until we know which chip
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册