|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2015-2019 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2015-2020 The Linux Foundation. All rights reserved.
|
|
|
*
|
|
|
* Permission to use, copy, modify, and/or distribute this software for
|
|
|
* any purpose with or without fee is hereby granted, provided that the
|
|
@@ -323,7 +323,7 @@ QDF_STATUS sme_ps_process_command(struct mac_context *mac_ctx, uint32_t session_
|
|
|
* 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: sme_ps_cmd
|
|
|
* Pre Condition for enabling sta mode power save
|
|
|
* 1) Sta Mode Ps should be enabled in ini file.
|
|
|
* 2) Session should be in infra mode and in connected state.
|
|
@@ -331,7 +331,7 @@ QDF_STATUS sme_ps_process_command(struct mac_context *mac_ctx, uint32_t session_
|
|
|
* Return: QDF_STATUS
|
|
|
*/
|
|
|
QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
|
|
|
- uint32_t session_id)
|
|
|
+ uint32_t session_id, enum sme_ps_cmd command)
|
|
|
{
|
|
|
struct wlan_mlme_powersave *powersave_params;
|
|
|
|
|
@@ -346,7 +346,7 @@ QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
|
|
|
return QDF_STATUS_E_FAILURE;
|
|
|
}
|
|
|
|
|
|
- if (!mac_ctx->usr_cfg_ps_enable) {
|
|
|
+ if (command == SME_PS_ENABLE && !mac_ctx->usr_cfg_ps_enable) {
|
|
|
sme_debug("Cannot initiate PS. PS is disabled by usr(ioctl)");
|
|
|
return QDF_STATUS_E_FAILURE;
|
|
|
}
|
|
@@ -386,7 +386,7 @@ QDF_STATUS sme_ps_enable_disable(mac_handle_t mac_handle, uint32_t session_id,
|
|
|
QDF_STATUS status = QDF_STATUS_E_FAILURE;
|
|
|
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
|
|
|
|
|
|
- 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) {
|
|
|
/*
|
|
|
* In non associated state driver wont handle the power save
|
|
@@ -417,7 +417,7 @@ QDF_STATUS sme_ps_timer_flush_sync(mac_handle_t mac_handle, uint8_t session_id)
|
|
|
if (session_id >= WLAN_MAX_VDEVS)
|
|
|
return QDF_STATUS_E_INVAL;
|
|
|
|
|
|
- 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;
|
|
@@ -475,7 +475,8 @@ QDF_STATUS sme_ps_uapsd_enable(mac_handle_t mac_handle, uint32_t session_id)
|
|
|
QDF_STATUS status = QDF_STATUS_E_FAILURE;
|
|
|
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
|
|
|
|
|
|
- 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,
|
|
@@ -499,7 +500,8 @@ QDF_STATUS sme_ps_uapsd_disable(mac_handle_t mac_handle, uint32_t session_id)
|
|
|
QDF_STATUS status = QDF_STATUS_E_FAILURE;
|
|
|
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
|
|
|
|
|
|
- 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,
|
|
@@ -866,7 +868,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(MAC_HANDLE(mac_ctx), session_id,
|
|
|
SME_PS_ENABLE);
|