Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -390,7 +390,7 @@ int wl1271_cmd_data_path(struct wl1271 *wl, bool enable)
	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;
	int ret = 0;
@@ -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->retries = 5;
	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,
			      sizeof(*ps_params), 0);
+3 −1
Original line number Diff line number Diff line
@@ -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_configure(struct wl1271 *wl, u16 id, void *buf, size_t len);
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,
			    void *buf, size_t buf_len, int index, u32 rates);
int wl1271_cmd_build_null_data(struct wl1271 *wl);
+12 −5
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ void wl1271_pspoll_work(struct work_struct *work)
	 * delivery failure occurred, and no-one changed state since, so
	 * 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:
	mutex_unlock(&wl->mutex);
@@ -70,7 +70,8 @@ static void wl1271_event_pspoll_delivery_fail(struct wl1271 *wl)

	/* force active mode receive data from the AP */
	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)
			return;
		set_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags);
@@ -91,6 +92,8 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
				  bool *beacon_loss)
{
	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);

@@ -104,10 +107,14 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
			break;
		}

		if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) {
		if (wl->psm_entry_retry < total_retries) {
			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,
						 true);
						 rates, true);
		} else {
			wl1271_info("No ack to nullfunc from AP.");
			wl->psm_entry_retry = 0;
@@ -143,7 +150,7 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
		/* make sure the firmware goes to active mode - the frame to
		   be sent next will indicate to the AP, that we are active. */
		ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
					 false);
					 wl->basic_rate, false);
		break;
	case EVENT_EXIT_POWER_SAVE_SUCCESS:
	default:
+5 −3
Original line number Diff line number Diff line
@@ -1341,7 +1341,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
		if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
			wl1271_debug(DEBUG_PSM, "psm enabled");
			ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
						 true);
						 wl->basic_rate_set, true);
		}
	} else if (!(conf->flags & IEEE80211_CONF_PS) &&
		   test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) {
@@ -1351,7 +1351,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)

		if (test_bit(WL1271_FLAG_PSM, &wl->flags))
			ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
						 true);
						 wl->basic_rate_set, true);
	}

	if (conf->power_level != wl->power_level) {
@@ -1826,7 +1826,9 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
			if (test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags) &&
			    !test_bit(WL1271_FLAG_PSM, &wl->flags)) {
				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)
					goto out_sleep;
			}
+5 −3
Original line number Diff line number Diff line
@@ -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,
		       bool send)
		       u32 rates, bool send)
{
	int ret;

@@ -135,7 +135,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
			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)
			return ret;

@@ -158,7 +159,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode,
		if (ret < 0)
			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)
			return ret;

Loading