qcacld-3.0: Set moddtim dynamically in the li offload mode

Extend hdd_config_modulated_dtim() to configure moddtim
dynamically in the both non li offload and li offload mode.

Change-Id: I8669ec618d4aa9cd87c4c234972ca500c98119b6
CRs-Fixed: 2970090
This commit is contained in:
Li Feng
2021-06-18 17:01:32 +08:00
committed by Madan Koyyalamudi
parent e7df98e50e
commit 4548644d92
8 changed files with 324 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2019, 2021 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
@@ -107,6 +107,7 @@ struct wlan_pmo_ctx {
* @beacon_interval: vdev beacon interval
* @dyn_modulated_dtim: dynamically configured modulated dtim value
* @dyn_modulated_dtim_enabled: if dynamically modulated dtim is set or not
* @is_dyn_modulated_dtim_activated: if dynamically modulated dtim is sent to fw
* @dyn_listen_interval: dynamically user configured listen interval
* @restore_dtim_setting: DTIM settings restore flag
* @pmo_vdev_lock: spin lock for pmo vdev priv ctx
@@ -129,6 +130,7 @@ struct pmo_vdev_priv_obj {
uint8_t beacon_interval;
uint32_t dyn_modulated_dtim;
bool dyn_modulated_dtim_enabled;
bool is_dyn_modulated_dtim_activated;
uint32_t dyn_listen_interval;
bool restore_dtim_setting;
qdf_spinlock_t pmo_vdev_lock;

View File

@@ -395,6 +395,125 @@ pmo_core_enable_igmp_offload(struct wlan_objmgr_vdev *vdev,
return QDF_STATUS_SUCCESS;
}
#endif
/**
* pmo_core_vdev_get_moddtim_user_enabled() - Get vdev if mod dtim set
* by user
* @vdev: objmgr vdev handle
*
* Return: mod dtim set by user or not
*/
static inline
bool pmo_core_vdev_get_moddtim_user_enabled(struct wlan_objmgr_vdev *vdev)
{
bool value;
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
value = vdev_ctx->dyn_modulated_dtim_enabled;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
return value;
}
/**
* pmo_core_vdev_set_moddtim_user_enabled() - vdev moddtim user enable setting
* @vdev: objmgr vdev handle
* @value: vdev moddtim user enable or not
*
* Return: None
*/
static inline
void pmo_core_vdev_set_moddtim_user_enabled(struct wlan_objmgr_vdev *vdev,
bool value)
{
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
vdev_ctx->dyn_modulated_dtim_enabled = value;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
}
/**
* pmo_core_vdev_get_moddtim_user_active() - Get vdev if moddtim user is
* sent to fw
* @vdev: objmgr vdev handle
*
* Return: moddtim user is sent to fw or not
*/
static inline
bool pmo_core_vdev_get_moddtim_user_active(struct wlan_objmgr_vdev *vdev)
{
bool retval;
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
retval = vdev_ctx->is_dyn_modulated_dtim_activated;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
return retval;
}
/**
* pmo_core_vdev_set_moddtim_user_active() - vdev moddtim user active setting
* @vdev: objmgr vdev handle
* @value: vdev moddtim user active or not
*
* Return: None
*/
static inline
void pmo_core_vdev_set_moddtim_user_active(struct wlan_objmgr_vdev *vdev,
bool value)
{
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
vdev_ctx->is_dyn_modulated_dtim_activated = value;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
}
/**
* pmo_core_vdev_get_moddtim_user() - Get vdev moddtim set by user
* @vdev: objmgr vdev handle
*
* Return: moddtim value set by user
*/
static inline
uint32_t pmo_core_vdev_get_moddtim_user(struct wlan_objmgr_vdev *vdev)
{
uint32_t value;
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
value = vdev_ctx->dyn_modulated_dtim;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
return value;
}
/**
* pmo_core_vdev_set_moddtim_user() - vdev moddtim user value setting
* @vdev: objmgr vdev handle
* @value: vdev moddtim value set by user
*
* Return: None
*/
static inline
void pmo_core_vdev_set_moddtim_user(struct wlan_objmgr_vdev *vdev,
uint32_t value)
{
struct pmo_vdev_priv_obj *vdev_ctx;
vdev_ctx = pmo_vdev_get_priv(vdev);
qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
vdev_ctx->dyn_modulated_dtim = value;
qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
}
#endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
#endif /* end of _WLAN_PMO_SUSPEND_RESUME_H_ */

View File

@@ -40,6 +40,7 @@
#include "cfg_mlme_sap.h"
#include "cfg_ucfg_api.h"
#include "cdp_txrx_bus.h"
#include "wlan_pmo_ucfg_api.h"
/**
* pmo_core_get_vdev_dtim_period() - Get vdev dtim period
@@ -1799,8 +1800,9 @@ QDF_STATUS pmo_core_config_forced_dtim(struct wlan_objmgr_vdev *vdev,
return status;
}
QDF_STATUS pmo_core_config_modulated_dtim(struct wlan_objmgr_vdev *vdev,
uint32_t mod_dtim)
static QDF_STATUS
pmo_core_config_non_li_offload_modulated_dtim(struct wlan_objmgr_vdev *vdev,
uint32_t mod_dtim)
{
struct pmo_vdev_priv_obj *vdev_ctx;
struct pmo_psoc_cfg *psoc_cfg;
@@ -1891,6 +1893,74 @@ out:
return status;
}
static QDF_STATUS
pmo_core_config_li_offload_modulated_dtim(struct wlan_objmgr_vdev *vdev,
uint32_t mod_dtim)
{
struct pmo_vdev_priv_obj *vdev_ctx;
struct pmo_psoc_cfg *psoc_cfg;
QDF_STATUS status;
uint8_t vdev_id;
pmo_enter();
status = pmo_vdev_get_ref(vdev);
if (status != QDF_STATUS_SUCCESS)
goto out;
vdev_id = pmo_vdev_get_id(vdev);
vdev_ctx = pmo_vdev_get_priv(vdev);
psoc_cfg = &vdev_ctx->pmo_psoc_ctx->psoc_cfg;
if (mod_dtim > psoc_cfg->sta_max_li_mod_dtim)
mod_dtim = psoc_cfg->sta_max_li_mod_dtim;
pmo_core_vdev_set_moddtim_user(vdev, mod_dtim);
pmo_core_vdev_set_moddtim_user_enabled(vdev, true);
if (!ucfg_pmo_is_vdev_connected(vdev)) {
pmo_core_vdev_set_moddtim_user_active(vdev, false);
wlan_objmgr_vdev_release_ref(vdev, WLAN_PMO_ID);
goto out;
}
status = pmo_tgt_vdev_update_param_req(vdev,
pmo_vdev_param_moddtim,
mod_dtim);
if (QDF_IS_STATUS_SUCCESS(status)) {
pmo_debug("Set modulated dtim for vdev id %d",
vdev_id);
pmo_core_vdev_set_moddtim_user_active(vdev, true);
} else {
pmo_err("Failed to Set modulated dtim for vdev id %d",
vdev_id);
}
wlan_objmgr_vdev_release_ref(vdev, WLAN_PMO_ID);
out:
pmo_exit();
return status;
}
QDF_STATUS pmo_core_config_modulated_dtim(struct wlan_objmgr_vdev *vdev,
uint32_t mod_dtim)
{
struct pmo_vdev_priv_obj *vdev_ctx;
struct pmo_psoc_priv_obj *psoc_ctx;
QDF_STATUS status;
vdev_ctx = pmo_vdev_get_priv(vdev);
psoc_ctx = vdev_ctx->pmo_psoc_ctx;
if (psoc_ctx->caps.li_offload)
status = pmo_core_config_li_offload_modulated_dtim(vdev,
mod_dtim);
else
status = pmo_core_config_non_li_offload_modulated_dtim(vdev,
mod_dtim);
return status;
}
#ifdef SYSTEM_PM_CHECK
void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc)
{