diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-05-24 04:18:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-02 16:13:34 -0400 |
commit | 0d58cbff2495fda8b2389719d30da694d3077a87 (patch) | |
tree | 5e9a30e0491ff6d5470bb023b8e27ba65c006197 /drivers/net/wireless/wl12xx/wl1271_main.c | |
parent | db81956cc4a6780e9aeb1e85993096e67dcb0cd3 (diff) |
wl1271: Idle handling into own function
As there is more and more stuff triggered by going in and out of idle,
create a separate function for handling that.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 108a3e2a58fd..653012662863 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -1135,11 +1135,6 @@ static int wl1271_dummy_join(struct wl1271 *wl) | |||
1135 | 1135 | ||
1136 | memcpy(wl->bssid, dummy_bssid, ETH_ALEN); | 1136 | memcpy(wl->bssid, dummy_bssid, ETH_ALEN); |
1137 | 1137 | ||
1138 | /* increment the session counter */ | ||
1139 | wl->session_counter++; | ||
1140 | if (wl->session_counter >= SESSION_COUNTER_MAX) | ||
1141 | wl->session_counter = 0; | ||
1142 | |||
1143 | /* pass through frames from all BSS */ | 1138 | /* pass through frames from all BSS */ |
1144 | wl1271_configure_filters(wl, FIF_OTHER_BSS); | 1139 | wl1271_configure_filters(wl, FIF_OTHER_BSS); |
1145 | 1140 | ||
@@ -1253,6 +1248,42 @@ static u32 wl1271_min_rate_get(struct wl1271 *wl) | |||
1253 | return rate; | 1248 | return rate; |
1254 | } | 1249 | } |
1255 | 1250 | ||
1251 | static int wl1271_handle_idle(struct wl1271 *wl, bool idle) | ||
1252 | { | ||
1253 | int ret; | ||
1254 | |||
1255 | if (idle) { | ||
1256 | if (test_bit(WL1271_FLAG_JOINED, &wl->flags)) { | ||
1257 | ret = wl1271_unjoin(wl); | ||
1258 | if (ret < 0) | ||
1259 | goto out; | ||
1260 | } | ||
1261 | wl->rate_set = wl1271_min_rate_get(wl); | ||
1262 | wl->sta_rate_set = 0; | ||
1263 | ret = wl1271_acx_rate_policies(wl); | ||
1264 | if (ret < 0) | ||
1265 | goto out; | ||
1266 | ret = wl1271_acx_keep_alive_config( | ||
1267 | wl, CMD_TEMPL_KLV_IDX_NULL_DATA, | ||
1268 | ACX_KEEP_ALIVE_TPL_INVALID); | ||
1269 | if (ret < 0) | ||
1270 | goto out; | ||
1271 | set_bit(WL1271_FLAG_IDLE, &wl->flags); | ||
1272 | } else { | ||
1273 | /* increment the session counter */ | ||
1274 | wl->session_counter++; | ||
1275 | if (wl->session_counter >= SESSION_COUNTER_MAX) | ||
1276 | wl->session_counter = 0; | ||
1277 | ret = wl1271_dummy_join(wl); | ||
1278 | if (ret < 0) | ||
1279 | goto out; | ||
1280 | clear_bit(WL1271_FLAG_IDLE, &wl->flags); | ||
1281 | } | ||
1282 | |||
1283 | out: | ||
1284 | return ret; | ||
1285 | } | ||
1286 | |||
1256 | static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | 1287 | static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) |
1257 | { | 1288 | { |
1258 | struct wl1271 *wl = hw->priv; | 1289 | struct wl1271 *wl = hw->priv; |
@@ -1307,22 +1338,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1307 | } | 1338 | } |
1308 | 1339 | ||
1309 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { | 1340 | if (changed & IEEE80211_CONF_CHANGE_IDLE) { |
1310 | if (conf->flags & IEEE80211_CONF_IDLE && | 1341 | ret = wl1271_handle_idle(wl, conf->flags & IEEE80211_CONF_IDLE); |
1311 | test_bit(WL1271_FLAG_JOINED, &wl->flags)) | 1342 | if (ret < 0) |
1312 | wl1271_unjoin(wl); | 1343 | wl1271_warning("idle mode change failed %d", ret); |
1313 | else if (!(conf->flags & IEEE80211_CONF_IDLE)) | ||
1314 | wl1271_dummy_join(wl); | ||
1315 | |||
1316 | if (conf->flags & IEEE80211_CONF_IDLE) { | ||
1317 | wl->rate_set = wl1271_min_rate_get(wl); | ||
1318 | wl->sta_rate_set = 0; | ||
1319 | wl1271_acx_rate_policies(wl); | ||
1320 | wl1271_acx_keep_alive_config( | ||
1321 | wl, CMD_TEMPL_KLV_IDX_NULL_DATA, | ||
1322 | ACX_KEEP_ALIVE_TPL_INVALID); | ||
1323 | set_bit(WL1271_FLAG_IDLE, &wl->flags); | ||
1324 | } else | ||
1325 | clear_bit(WL1271_FLAG_IDLE, &wl->flags); | ||
1326 | } | 1344 | } |
1327 | 1345 | ||
1328 | if (conf->flags & IEEE80211_CONF_PS && | 1346 | if (conf->flags & IEEE80211_CONF_PS && |