qcacld-3.0: Configure chan time quota basing on Miracast on/off

If Miracast is on, driver should send WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID
to FW. Currently this wmi is blocked because gEnableMCCAdaptiveScheduler is
set as 1, which is incorrect.

Add a new dynamic_mcc_adaptive_sched flag to allow wmi command
WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID for Miracast case.

Change-Id: I18e713b75a8cafc1b631bf5a1884a9b0123e5dba
CRs-Fixed: 2652271
This commit is contained in:
bings 2020-03-25 16:20:53 +08:00 • committed by nshrivas
commit 46d6db59ec
9 changed files with 149 additions and 63 deletions

View file

@ -341,6 +341,34 @@ QDF_STATUS policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
QDF_STATUS policy_mgr_set_ch_select_plcy(struct wlan_objmgr_psoc *psoc,
uint32_t ch_select_policy);
/**
* policy_mgr_get_dynamic_mcc_adaptive_sch() - to get dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sched: value to be filled
*
* This API is used to get dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS policy_mgr_get_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sched);
/**
* policy_mgr_set_dynamic_mcc_adaptive_sch() - to set dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sched: value to be set
*
* This API is used to set dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS policy_mgr_set_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sched);
/**
* policy_mgr_get_mcc_adaptive_sch() - to get mcc adaptive scheduler
* @psoc: pointer to psoc

View file

@ -134,6 +134,34 @@ QDF_STATUS
ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
uint8_t *enable_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch() - to get dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sch: value to be filled
*
* This API is used to get dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch() - to set dynamic mcc adaptive
* scheduler
* @psoc: pointer to psoc
* @dynamic_mcc_adaptive_sch: value to be set
*
* This API is used to set dynamic mcc adaptive scheduler
*
* Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
*/
QDF_STATUS
ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sch);
/**
* ucfg_policy_mgr_get_sta_cxn_5g_band() - to get STA's connection in 5G config
*

View file

@ -340,6 +340,38 @@ QDF_STATUS policy_mgr_set_ch_select_plcy(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_set_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sched)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("pm_ctx is NULL");
return QDF_STATUS_E_FAILURE;
}
pm_ctx->dynamic_mcc_adaptive_sched = dynamic_mcc_adaptive_sched;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_get_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sched)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("pm_ctx is NULL");
return QDF_STATUS_E_FAILURE;
}
*dynamic_mcc_adaptive_sched = pm_ctx->dynamic_mcc_adaptive_sched;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
uint8_t *enable_mcc_adaptive_sch)
{

View file

@ -332,6 +332,7 @@ struct policy_mgr_cfg {
* @mode_change_cb: Mode change callback
* @user_config_sap_ch_freq: SAP channel freq configured by user application
* @cfg: Policy manager config data
* @dynamic_mcc_adaptive_sched: disable/enable mcc adaptive scheduler feature
*/
struct policy_mgr_psoc_priv_obj {
struct wlan_objmgr_psoc *psoc;
@ -372,6 +373,7 @@ struct policy_mgr_psoc_priv_obj {
struct policy_mgr_cfg cfg;
uint32_t valid_ch_freq_list[NUM_CHANNELS];
uint32_t valid_ch_freq_list_count;
bool dynamic_mcc_adaptive_sched;
};
/**

View file

@ -410,6 +410,7 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc)
{
QDF_STATUS status;
struct policy_mgr_psoc_priv_obj *pm_ctx;
uint8_t enable_mcc_adaptive_sch = 0;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
@ -450,6 +451,8 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc)
policy_mgr_err("channel_switch_complete_evt init failed");
return status;
}
policy_mgr_get_mcc_adaptive_sch(psoc, &enable_mcc_adaptive_sch);
policy_mgr_set_dynamic_mcc_adaptive_sch(psoc, enable_mcc_adaptive_sch);
pm_ctx->do_hw_mode_change = false;
pm_ctx->hw_mode_change_in_progress = POLICY_MGR_HW_MODE_NOT_IN_PROGRESS;
/* reset sap mandatory channels */

View file

@ -145,6 +145,22 @@ QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
}
QDF_STATUS ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool dynamic_mcc_adaptive_sch)
{
return policy_mgr_set_dynamic_mcc_adaptive_sch(
psoc, dynamic_mcc_adaptive_sch);
}
QDF_STATUS ucfg_policy_mgr_get_dynamic_mcc_adaptive_sch(
struct wlan_objmgr_psoc *psoc,
bool *dynamic_mcc_adaptive_sch)
{
return policy_mgr_get_dynamic_mcc_adaptive_sch(
psoc, dynamic_mcc_adaptive_sch);
}
QDF_STATUS ucfg_policy_mgr_get_mcc_adaptive_sch(struct wlan_objmgr_psoc *psoc,
uint8_t *mcc_adaptive_sch)
{

View file

@ -1157,43 +1157,6 @@ int wlan_hdd_set_power_save(struct hdd_adapter *adapter,
return qdf_status_to_os_return(status);
}
/**
* wlan_hdd_update_mcc_adaptive_scheduler() - Function to update
* MAS value to FW
* @adapter: adapter object data
* @is_enable: 0-Disable, 1-Enable MAS
*
* This function passes down the value of MAS to UMAC
*
* Return: 0 for success else non zero
*
*/
static int32_t wlan_hdd_update_mcc_adaptive_scheduler(
struct hdd_adapter *adapter, bool is_enable)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
uint8_t enable_mcc_adaptive_sch = 0;
if (!hdd_ctx) {
hdd_err("HDD context is null");
return -EINVAL;
}
hdd_info("enable/disable MAS :%d", is_enable);
ucfg_policy_mgr_get_mcc_adaptive_sch(hdd_ctx->psoc,
&enable_mcc_adaptive_sch);
if (enable_mcc_adaptive_sch) {
/* Todo check where to set the MCC apative SCHED for read */
if (QDF_STATUS_SUCCESS != sme_set_mas(is_enable)) {
hdd_err("Failed to enable/disable MAS");
return -EAGAIN;
}
}
return 0;
}
/**
* wlan_hdd_update_mcc_p2p_quota() - Function to Update P2P
* quota to FW
@ -1233,20 +1196,32 @@ static void wlan_hdd_update_mcc_p2p_quota(struct hdd_adapter *adapter,
int32_t wlan_hdd_set_mas(struct hdd_adapter *adapter, uint8_t mas_value)
{
int32_t ret = 0;
struct hdd_context *hdd_ctx;
uint8_t enable_mcc_adaptive_sch = 0;
if (!adapter) {
hdd_err("Adapter is NULL");
return -EINVAL;
}
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
if (!hdd_ctx) {
hdd_err("HDD context is null");
return -EINVAL;
}
if (mas_value) {
hdd_info("Miracast is ON. Disable MAS and configure P2P quota");
ret = wlan_hdd_update_mcc_adaptive_scheduler(
adapter, false);
if (0 != ret) {
hdd_err("Failed to disable MAS");
goto done;
ucfg_policy_mgr_get_mcc_adaptive_sch(hdd_ctx->psoc,
&enable_mcc_adaptive_sch);
if (enable_mcc_adaptive_sch) {
ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(
hdd_ctx->psoc, false);
if (QDF_STATUS_SUCCESS != sme_set_mas(false)) {
hdd_err("Failed to disable MAS");
return -EAGAIN;
}
}
/* Config p2p quota */
@ -1255,16 +1230,20 @@ int32_t wlan_hdd_set_mas(struct hdd_adapter *adapter, uint8_t mas_value)
hdd_info("Miracast is OFF. Enable MAS and reset P2P quota");
wlan_hdd_update_mcc_p2p_quota(adapter, false);
ret = wlan_hdd_update_mcc_adaptive_scheduler(
adapter, true);
if (0 != ret) {
hdd_err("Failed to enable MAS");
goto done;
ucfg_policy_mgr_get_mcc_adaptive_sch(hdd_ctx->psoc,
&enable_mcc_adaptive_sch);
if (enable_mcc_adaptive_sch) {
ucfg_policy_mgr_set_dynamic_mcc_adaptive_sch(
hdd_ctx->psoc, true);
if (QDF_STATUS_SUCCESS != sme_set_mas(true)) {
hdd_err("Failed to enable MAS");
return -EAGAIN;
}
}
}
done:
return ret;
return 0;
}
/**

View file

@ -1112,7 +1112,7 @@ QDF_STATUS wma_set_enable_disable_mcc_adaptive_scheduler(uint32_t
QDF_STATUS wma_set_mcc_channel_time_latency(tp_wma_handle wma,
uint32_t mcc_channel, uint32_t mcc_channel_time_latency)
{
uint8_t mcc_adapt_sch = 0;
bool mcc_adapt_sch = false;
struct mac_context *mac = NULL;
uint32_t channel1 = mcc_channel;
uint32_t chan1_freq = cds_chan_to_freq(channel1);
@ -1135,11 +1135,10 @@ QDF_STATUS wma_set_mcc_channel_time_latency(tp_wma_handle wma,
return QDF_STATUS_E_FAILURE;
}
/* Confirm MCC adaptive scheduler feature is disabled */
if (policy_mgr_get_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
if (policy_mgr_get_dynamic_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
QDF_STATUS_SUCCESS) {
if (mcc_adapt_sch ==
cfg_max(CFG_ENABLE_MCC_ADAPTIVE_SCH_ENABLED_NAME)) {
if (mcc_adapt_sch) {
WMA_LOGD("%s: Can't set channel latency while MCC ADAPTIVE SCHED is enabled. Exit",
__func__);
return QDF_STATUS_SUCCESS;
@ -1176,7 +1175,7 @@ QDF_STATUS wma_set_mcc_channel_time_quota(tp_wma_handle wma,
uint32_t adapter_1_chan_number, uint32_t adapter_1_quota,
uint32_t adapter_2_chan_number)
{
uint8_t mcc_adapt_sch = 0;
bool mcc_adapt_sch = false;
struct mac_context *mac = NULL;
uint32_t chan1_freq = cds_chan_to_freq(adapter_1_chan_number);
uint32_t chan2_freq = cds_chan_to_freq(adapter_2_chan_number);
@ -1200,11 +1199,10 @@ QDF_STATUS wma_set_mcc_channel_time_quota(tp_wma_handle wma,
}
/* Confirm MCC adaptive scheduler feature is disabled */
if (policy_mgr_get_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
if (policy_mgr_get_dynamic_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
QDF_STATUS_SUCCESS) {
if (mcc_adapt_sch ==
cfg_max(CFG_ENABLE_MCC_ADAPTIVE_SCH_ENABLED_NAME)) {
if (mcc_adapt_sch) {
WMA_LOGD("%s: Can't set channel quota while MCC_ADAPTIVE_SCHED is enabled. Exit",
__func__);
return QDF_STATUS_SUCCESS;

View file

@ -2447,7 +2447,7 @@ QDF_STATUS wma_post_vdev_create_setup(struct wlan_objmgr_vdev *vdev)
QDF_STATUS status = QDF_STATUS_SUCCESS;
struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
uint32_t cfg_val;
uint8_t mcc_adapt_sch;
bool mcc_adapt_sch = false;
QDF_STATUS ret;
struct mlme_ht_capabilities_info *ht_cap_info;
u_int8_t vdev_id;
@ -2679,8 +2679,8 @@ QDF_STATUS wma_post_vdev_create_setup(struct wlan_objmgr_vdev *vdev)
mac->mlme_cfg->lfr.roam_bmiss_final_bcnt,
vdev_id);
if (policy_mgr_get_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
if (policy_mgr_get_dynamic_mcc_adaptive_sch(mac->psoc,
&mcc_adapt_sch) ==
QDF_STATUS_SUCCESS) {
WMA_LOGD("%s: setting ini value for WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED: %d",
__func__, mcc_adapt_sch);