if (ret < 0)
goto out;
- memcpy(wl->bssid, conf->bssid, ETH_ALEN);
+ if (memcmp(wl->bssid, conf->bssid, ETH_ALEN)) {
+ wl1271_debug(DEBUG_MAC80211, "bssid changed");
+
+ memcpy(wl->bssid, conf->bssid, ETH_ALEN);
+
+ ret = wl1271_cmd_join(wl);
+ if (ret < 0)
+ goto out_sleep;
+ }
ret = wl1271_cmd_build_null_data(wl);
if (ret < 0)
if (wl->ssid_len)
memcpy(wl->ssid, conf->ssid, wl->ssid_len);
- if (wl->bss_type != BSS_TYPE_IBSS) {
- ret = wl1271_cmd_join(wl);
- if (ret < 0)
- goto out_sleep;
- }
-
if (conf->changed & IEEE80211_IFCC_BEACON) {
beacon = ieee80211_beacon_get(hw, vif);
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON,
dev_kfree_skb(beacon);
- if (ret < 0)
- goto out_sleep;
-
- ret = wl1271_cmd_join(wl);
-
if (ret < 0)
goto out_sleep;
}
goto out;
if (channel != wl->channel) {
- u8 old_channel = wl->channel;
+ /*
+ * We assume that the stack will configure the right channel
+ * before associating, so we don't need to send a join
+ * command here. We will join the right channel when the
+ * BSSID changes
+ */
wl->channel = channel;
-
- ret = wl1271_cmd_join(wl);
- if (ret < 0) {
- wl->channel = old_channel;
- goto out_sleep;
- }
}
ret = wl1271_cmd_build_null_data(wl);
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;
- }
-
+ /*
+ * with wl1271, we don't need to update the
+ * beacon_int and dtim_period, because the firmware
+ * updates it by itself when the first beacon is
+ * received after a join.
+ */
ret = wl1271_cmd_build_ps_poll(wl, wl->aid);
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_BASIC_RATES) {
wl->basic_rate_set = wl1271_enabled_rates_get(
wl, bss_conf->basic_rates);
- ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set);
+ 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:
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;
wl->vif = NULL;