Commit 65cddbf1 authored by Juuso Oikarinen's avatar Juuso Oikarinen Committed by Luciano Coelho

wl1271: Reduce rate used for last PSM entry attempt

This patch reduces the rate of the null-func used to enter PSM on the last
retry as precaution.
Signed-off-by: default avatarJuuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
parent 02fabb0e
...@@ -390,7 +390,7 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable) ...@@ -390,7 +390,7 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable)
return ret; return ret;
} }
int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, u32 rates, bool send)
{ {
struct wl1271_cmd_ps_params *ps_params = NULL; struct wl1271_cmd_ps_params *ps_params = NULL;
int ret = 0; int ret = 0;
...@@ -407,7 +407,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send) ...@@ -407,7 +407,7 @@ int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send)
ps_params->send_null_data = send; ps_params->send_null_data = send;
ps_params->retries = 5; ps_params->retries = 5;
ps_params->hang_over_period = 1; ps_params->hang_over_period = 1;
ps_params->null_data_rate = cpu_to_le32(wl->basic_rate_set); ps_params->null_data_rate = cpu_to_le32(rates);
ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params,
sizeof(*ps_params), 0); sizeof(*ps_params), 0);
......
...@@ -38,7 +38,9 @@ int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); ...@@ -38,7 +38,9 @@ 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);
int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); int wl1271_cmd_data_path(struct wl1271 *wl, bool enable);
int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, bool send); int wl1271_cmd_ps_mode(struct wl1271 *wl, u8 ps_mode, u32 rates, bool send);
int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer,
size_t len);
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);
......
...@@ -52,7 +52,7 @@ void wl1271_pspoll_work(struct work_struct *work) ...@@ -52,7 +52,7 @@ void wl1271_pspoll_work(struct work_struct *work)
* delivery failure occurred, and no-one changed state since, so * delivery failure occurred, and no-one changed state since, so
* we should go back to powersave. * we should go back to powersave.
*/ */
wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, true); wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, wl->basic_rate, true);
out: out:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
...@@ -70,7 +70,8 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl) ...@@ -70,7 +70,8 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl)
/* force active mode receive data from the AP */ /* force active mode receive data from the AP */
if (test_bit(WL1271_FLAG_PSM, &wl->flags)) { if (test_bit(WL1271_FLAG_PSM, &wl->flags)) {
ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, true); ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
wl->basic_rate, true);
if (ret < 0) if (ret < 0)
return; return;
set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags); set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags);
...@@ -91,6 +92,8 @@ static int wl1271_event_ps_report(struct wl1271 *wl, ...@@ -91,6 +92,8 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
bool *beacon_loss) bool *beacon_loss)
{ {
int ret = 0; int ret = 0;
u32 total_retries = wl->conf.conn.psm_entry_retries;
u32 rates;
wl1271_debug(DEBUG_EVENT, "ps_status: 0x%x", mbox->ps_status); wl1271_debug(DEBUG_EVENT, "ps_status: 0x%x", mbox->ps_status);
...@@ -104,10 +107,14 @@ static int wl1271_event_ps_report(struct wl1271 *wl, ...@@ -104,10 +107,14 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
break; break;
} }
if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) { if (wl->psm_entry_retry < total_retries) {
wl->psm_entry_retry++; wl->psm_entry_retry++;
if (wl->psm_entry_retry == total_retries)
rates = wl->basic_rate;
else
rates = wl->basic_rate_set;
ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
true); rates, true);
} else { } else {
wl1271_info("No ack to nullfunc from AP."); wl1271_info("No ack to nullfunc from AP.");
wl->psm_entry_retry = 0; wl->psm_entry_retry = 0;
...@@ -143,7 +150,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl, ...@@ -143,7 +150,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
/* make sure the firmware goes to active mode - the frame to /* make sure the firmware goes to active mode - the frame to
be sent next will indicate to the AP, that we are active. */ be sent next will indicate to the AP, that we are active. */
ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
false); wl->basic_rate, false);
break; break;
case EVENT_EXIT_POWER_SAVE_SUCCESS: case EVENT_EXIT_POWER_SAVE_SUCCESS:
default: default:
......
...@@ -1341,7 +1341,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1341,7 +1341,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
wl1271_debug(DEBUG_PSM, "psm enabled"); wl1271_debug(DEBUG_PSM, "psm enabled");
ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
true); wl->basic_rate_set, true);
} }
} else if (!(conf->flags & IEEE80211_CONF_PS) && } else if (!(conf->flags & IEEE80211_CONF_PS) &&
test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) {
...@@ -1351,7 +1351,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1351,7 +1351,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
if (test_bit(WL1271_FLAG_PSM, &wl->flags)) if (test_bit(WL1271_FLAG_PSM, &wl->flags))
ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
true); wl->basic_rate_set, true);
} }
if (conf->power_level != wl->power_level) { if (conf->power_level != wl->power_level) {
...@@ -1826,7 +1826,9 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1826,7 +1826,9 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) && if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) &&
!test_bit(WL1271_FLAG_PSM, &wl->flags)) { !test_bit(WL1271_FLAG_PSM, &wl->flags)) {
mode = STATION_POWER_SAVE_MODE; mode = STATION_POWER_SAVE_MODE;
ret = wl1271_ps_set_mode(wl, mode, true); ret = wl1271_ps_set_mode(wl, mode,
wl->basic_rate_set,
true);
if (ret < 0) if (ret < 0)
goto out_sleep; goto out_sleep;
} }
......
...@@ -121,7 +121,7 @@ int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake) ...@@ -121,7 +121,7 @@ int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake)
} }
int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
bool send) u32 rates, bool send)
{ {
int ret; int ret;
...@@ -135,7 +135,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, ...@@ -135,7 +135,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
return ret; return ret;
} }
ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE, send); ret = wl1271_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE,
rates, send);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -158,7 +159,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, ...@@ -158,7 +159,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE, send); ret = wl1271_cmd_ps_mode(wl, STATION_ACTIVE_MODE,
rates, send);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "wl1271_acx.h" #include "wl1271_acx.h"
int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode, int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
bool send); u32 rates, bool send);
void wl1271_ps_elp_sleep(struct wl1271 *wl); void wl1271_ps_elp_sleep(struct wl1271 *wl);
int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake); int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake);
void wl1271_elp_work(struct work_struct *work); void wl1271_elp_work(struct work_struct *work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment