|
@@ -33,7 +33,8 @@
|
|
|
#include "sme_trace.h"
|
|
|
#include "qdf_mem.h"
|
|
|
#include "qdf_types.h"
|
|
|
-#include "wma_types.h"
|
|
|
+#include "wma.h"
|
|
|
+#include "wma_internal.h"
|
|
|
#include "wmm_apsd.h"
|
|
|
#include "cfg_api.h"
|
|
|
#include "csr_inside_api.h"
|
|
@@ -528,6 +529,56 @@ QDF_STATUS sme_ps_enable_disable(tHalHandle hal_ctx, uint32_t session_id,
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
+QDF_STATUS sme_ps_timer_flush_sync(tHalHandle hal, uint8_t session_id)
|
|
|
+{
|
|
|
+ tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
|
|
|
+ struct ps_params *ps_parm;
|
|
|
+ enum ps_state ps_state;
|
|
|
+ QDF_TIMER_STATE tstate;
|
|
|
+ struct sEnablePsParams *req;
|
|
|
+ t_wma_handle *wma;
|
|
|
+
|
|
|
+ ps_parm = &mac_ctx->sme.ps_global_info.ps_params[session_id];
|
|
|
+ tstate = qdf_mc_timer_get_current_state(&ps_parm->auto_ps_enable_timer);
|
|
|
+ if (tstate != QDF_TIMER_STATE_RUNNING)
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+
|
|
|
+ sme_debug("flushing powersave enable for vdev %u", session_id);
|
|
|
+
|
|
|
+ wma = cds_get_context(QDF_MODULE_ID_WMA);
|
|
|
+ if (!wma) {
|
|
|
+ sme_err("wma is null");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ qdf_mc_timer_stop(&ps_parm->auto_ps_enable_timer);
|
|
|
+
|
|
|
+ req = qdf_mem_malloc(sizeof(*req));
|
|
|
+ if (!req) {
|
|
|
+ sme_err("out of memory");
|
|
|
+ return QDF_STATUS_E_NOMEM;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ps_parm->uapsd_per_ac_bit_mask) {
|
|
|
+ req->psSetting = eSIR_ADDON_ENABLE_UAPSD;
|
|
|
+ sme_ps_fill_uapsd_req_params(mac_ctx, &req->uapsdParams,
|
|
|
+ session_id, &ps_state);
|
|
|
+ ps_state = UAPSD_MODE;
|
|
|
+ req->uapsdParams.enable_ps = true;
|
|
|
+ } else {
|
|
|
+ req->psSetting = eSIR_ADDON_NOTHING;
|
|
|
+ ps_state = LEGACY_POWER_SAVE_MODE;
|
|
|
+ }
|
|
|
+ req->sessionid = session_id;
|
|
|
+
|
|
|
+ wma_enable_sta_ps_mode(wma, req);
|
|
|
+ qdf_mem_free(req);
|
|
|
+
|
|
|
+ ps_parm->ps_state = ps_state;
|
|
|
+
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* sme_ps_uapsd_enable(): function to enable UAPSD.
|
|
|
* @hal_ctx: global hal_handle
|
|
@@ -821,16 +872,15 @@ tSirRetStatus sme_post_pe_message(tpAniSirGlobal mac_ctx,
|
|
|
}
|
|
|
|
|
|
QDF_STATUS sme_ps_enable_auto_ps_timer(tHalHandle hal_ctx,
|
|
|
- uint32_t session_id, uint32_t timeout, bool force_trigger)
|
|
|
+ uint32_t session_id, uint32_t timeout)
|
|
|
{
|
|
|
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx);
|
|
|
struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info;
|
|
|
struct ps_params *ps_param = &ps_global_info->ps_params[session_id];
|
|
|
QDF_STATUS qdf_status;
|
|
|
|
|
|
- if (!ps_global_info->auto_bmps_timer_val && !force_trigger) {
|
|
|
- sme_debug("auto_ps_timer is disabled in INI, force_trigger-%d",
|
|
|
- force_trigger);
|
|
|
+ if (!timeout) {
|
|
|
+ sme_debug("auto_ps_timer called with timeout 0; ignore");
|
|
|
return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -908,19 +958,21 @@ QDF_STATUS sme_ps_open_per_session(tHalHandle hal_ctx, uint32_t session_id)
|
|
|
|
|
|
void sme_auto_ps_entry_timer_expired(void *data)
|
|
|
{
|
|
|
- struct ps_params *ps_params = (struct ps_params *)data;
|
|
|
+ struct ps_params *ps_params = (struct ps_params *)data;
|
|
|
tpAniSirGlobal mac_ctx = (tpAniSirGlobal)ps_params->mac_ctx;
|
|
|
uint32_t session_id = ps_params->session_id;
|
|
|
- QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
+ QDF_STATUS status;
|
|
|
+
|
|
|
+ sme_debug("auto_ps_timer expired, enabling powersave");
|
|
|
|
|
|
status = sme_enable_sta_ps_check(mac_ctx, session_id);
|
|
|
if (QDF_STATUS_SUCCESS == status)
|
|
|
sme_ps_enable_disable((tHalHandle)mac_ctx, session_id,
|
|
|
SME_PS_ENABLE);
|
|
|
else {
|
|
|
- status =
|
|
|
- qdf_mc_timer_start(&ps_params->auto_ps_enable_timer,
|
|
|
- AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE);
|
|
|
+ sme_debug("failed to enable powersave, restarting timer");
|
|
|
+ status = qdf_mc_timer_start(&ps_params->auto_ps_enable_timer,
|
|
|
+ AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE);
|
|
|
if (!QDF_IS_STATUS_SUCCESS(status)
|
|
|
&& (QDF_STATUS_E_ALREADY != status))
|
|
|
sme_err("Cannot start traffic timer");
|