summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeshwanth Sriram Guntuka <ysriramg@codeaurora.org>2017-11-12 13:31:02 +0530
committersnandini <snandini@codeaurora.org>2017-11-15 08:33:36 -0800
commitd0cf417f8f6ef6ebbab0bf7409936a45c64eafbc (patch)
tree9834f95f31349ef9860038acfcd68997809dc9b2
parent5607c41861036fc0e47fbe58aeab44da34387013 (diff)
qcacld-3.0: Avoid auto ps timer to prematurely enable power save
Android framwork decides when to put driver in power save state. When it disables powersave driver starts a timer to re-enter power save which is not required. Fix this by not starting auto ps timer for power save disable case. Framwork sends disable power save in disconneced state and driver returns error, Due to this firmware power state is still in BMPS and it reenables power save immediately after connection and this causes power state mismatch between framwork and driver/firmware. Fix is to handle full power request in disconnected state and send this full power request to firmware as it can handle it. Change-Id: Ib17c898b8288de31c424896acbfe89216e59ff49 CRs-Fixed: 2143017
-rw-r--r--core/hdd/src/wlan_hdd_power.c19
-rw-r--r--core/hdd/src/wlan_hdd_tx_rx.c3
-rw-r--r--core/sme/inc/sme_power_save_api.h3
-rw-r--r--core/sme/src/common/sme_power_save.c26
4 files changed, 32 insertions, 19 deletions
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index c6b31adf72de..4141c658fdf4 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -1685,8 +1685,6 @@ int wlan_hdd_set_powersave(hdd_adapter_t *adapter,
if (allow_power_save &&
adapter->device_mode == QDF_STA_MODE &&
!adapter->sessionCtx.station.ap_supports_immediate_power_save) {
- /* override user's requested flag */
- allow_power_save = false;
timeout = AUTO_PS_DEFER_TIMEOUT_MS;
hdd_debug("Defer power-save due to AP spec non-conformance");
}
@@ -1707,8 +1705,13 @@ int wlan_hdd_set_powersave(hdd_adapter_t *adapter,
* Enter Power Save command received from GUI
* this means DHCP is completed
*/
- sme_ps_enable_disable(hal, adapter->sessionId,
- SME_PS_ENABLE);
+ if (timeout)
+ sme_ps_enable_auto_ps_timer(hal,
+ adapter->sessionId,
+ timeout);
+ else
+ sme_ps_enable_disable(hal, adapter->sessionId,
+ SME_PS_ENABLE);
} else {
hdd_debug("Power Save is not enabled in the cfg");
}
@@ -1722,8 +1725,6 @@ int wlan_hdd_set_powersave(hdd_adapter_t *adapter,
sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX(adapter),
adapter->sessionId);
sme_ps_enable_disable(hal, adapter->sessionId, SME_PS_DISABLE);
- sme_ps_enable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX(adapter),
- adapter->sessionId, timeout);
}
return 0;
@@ -2206,9 +2207,9 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
ENTER();
if (timeout < 0) {
- hdd_debug("User space timeout: %d; Using default instead: %d",
- timeout, AUTO_PS_ENTRY_USER_TIMER_DEFAULT_VALUE);
- timeout = AUTO_PS_ENTRY_USER_TIMER_DEFAULT_VALUE;
+ hdd_debug("User space timeout: %d; Enter full power or power save",
+ timeout);
+ timeout = 0;
}
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c
index 384e1f50972e..06d20911a83f 100644
--- a/core/hdd/src/wlan_hdd_tx_rx.c
+++ b/core/hdd/src/wlan_hdd_tx_rx.c
@@ -448,6 +448,9 @@ wlan_hdd_latency_opt(hdd_adapter_t *adapter, struct sk_buff *skb)
QDF_NBUF_CB_PACKET_TYPE_ICMP) {
wlan_hdd_set_powersave(adapter, false,
hdd_ctx->config->icmp_disable_ps_val);
+ sme_ps_enable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX(adapter),
+ adapter->sessionId,
+ hdd_ctx->config->icmp_disable_ps_val);
}
}
#else
diff --git a/core/sme/inc/sme_power_save_api.h b/core/sme/inc/sme_power_save_api.h
index 745f91b6cd4d..8ab6c821fba9 100644
--- a/core/sme/inc/sme_power_save_api.h
+++ b/core/sme/inc/sme_power_save_api.h
@@ -42,7 +42,8 @@ QDF_STATUS sme_ps_uapsd_enable(tHalHandle hal_ctx, uint32_t session_id);
QDF_STATUS sme_ps_uapsd_disable(tHalHandle hal_ctx, uint32_t session_id);
/* Condition check if driver is ready to enter in PS */
-QDF_STATUS sme_enable_sta_ps_check(tpAniSirGlobal mac_ctx, uint32_t session_id);
+QDF_STATUS sme_enable_sta_ps_check(tpAniSirGlobal mac_ctx, uint32_t session_id,
+ enum sme_ps_cmd command);
QDF_STATUS sme_ps_process_command(tpAniSirGlobal mac_ctx,
uint32_t session_id,
diff --git a/core/sme/src/common/sme_power_save.c b/core/sme/src/common/sme_power_save.c
index 5da7a3b01471..851c630f38e6 100644
--- a/core/sme/src/common/sme_power_save.c
+++ b/core/sme/src/common/sme_power_save.c
@@ -481,6 +481,7 @@ QDF_STATUS sme_ps_process_command(tpAniSirGlobal mac_ctx, uint32_t session_id,
* sme_enable_sta_ps_check(): Checks if it is ok to enable power save or not.
* @mac_ctx: global mac context
* @session_id: session id
+ * @command: power save cmd of type enum sme_ps_cmd
*
*Pre Condition for enabling sta mode power save
*1) Sta Mode Ps should be enabled in ini file.
@@ -488,7 +489,8 @@ QDF_STATUS sme_ps_process_command(tpAniSirGlobal mac_ctx, uint32_t session_id,
*
* Return: QDF_STATUS
*/
-QDF_STATUS sme_enable_sta_ps_check(tpAniSirGlobal mac_ctx, uint32_t session_id)
+QDF_STATUS sme_enable_sta_ps_check(tpAniSirGlobal mac_ctx, uint32_t session_id,
+ enum sme_ps_cmd command)
{
struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info;
@@ -498,10 +500,14 @@ QDF_STATUS sme_enable_sta_ps_check(tpAniSirGlobal mac_ctx, uint32_t session_id)
return QDF_STATUS_E_FAILURE;
}
- /* Check whether the given session is Infra and in Connected State */
- if (!csr_is_conn_state_connected_infra(mac_ctx, session_id)) {
+ /* Check whether the given session is Infra and in Connected State
+ * also if command is power save disable there is not need to check
+ * for connected state as firmware can handle this
+ */
+ if ((command != SME_PS_DISABLE) &&
+ !csr_is_conn_state_connected_infra(mac_ctx, session_id)) {
sme_debug("STA not infra/connected state Session_id: %d",
- session_id);
+ session_id);
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
@@ -522,7 +528,7 @@ QDF_STATUS sme_ps_enable_disable(tHalHandle hal_ctx, uint32_t session_id,
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx);
- status = sme_enable_sta_ps_check(mac_ctx, session_id);
+ status = sme_enable_sta_ps_check(mac_ctx, session_id, command);
if (status != QDF_STATUS_SUCCESS)
return status;
status = sme_ps_process_command(mac_ctx, session_id, command);
@@ -539,7 +545,7 @@ QDF_STATUS sme_ps_timer_flush_sync(tHalHandle hal, uint8_t session_id)
struct sEnablePsParams *req;
t_wma_handle *wma;
- status = sme_enable_sta_ps_check(mac_ctx, session_id);
+ status = sme_enable_sta_ps_check(mac_ctx, session_id, SME_PS_ENABLE);
if (QDF_IS_STATUS_ERROR(status)) {
sme_debug("Power save not allowed for vdev id %d", session_id);
return QDF_STATUS_SUCCESS;
@@ -599,7 +605,8 @@ QDF_STATUS sme_ps_uapsd_enable(tHalHandle hal_ctx, uint32_t session_id)
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx);
- status = sme_enable_sta_ps_check(mac_ctx, session_id);
+ status = sme_enable_sta_ps_check(mac_ctx, session_id,
+ SME_PS_UAPSD_ENABLE);
if (status != QDF_STATUS_SUCCESS)
return status;
status = sme_ps_process_command(mac_ctx, session_id,
@@ -623,7 +630,8 @@ QDF_STATUS sme_ps_uapsd_disable(tHalHandle hal_ctx, uint32_t session_id)
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx);
- status = sme_enable_sta_ps_check(mac_ctx, session_id);
+ status = sme_enable_sta_ps_check(mac_ctx, session_id,
+ SME_PS_UAPSD_DISABLE);
if (status != QDF_STATUS_SUCCESS)
return status;
status = sme_ps_process_command(mac_ctx, session_id,
@@ -1145,7 +1153,7 @@ void sme_auto_ps_entry_timer_expired(void *data)
session_id = ps_params->session_id;
sme_debug("auto_ps_timer expired, enabling powersave");
- status = sme_enable_sta_ps_check(mac_ctx, session_id);
+ status = sme_enable_sta_ps_check(mac_ctx, session_id, SME_PS_ENABLE);
if (QDF_STATUS_SUCCESS == status)
sme_ps_enable_disable((tHalHandle)mac_ctx, session_id,
SME_PS_ENABLE);