qcacmn: Remove legacy dependency from Policy Manager Part 1

Remove legacy dependency from Policy Manager component Part 1

Change-Id: I87a44714c02ed37923ce4a4c4818d2aef8bc6e2f
CRs-Fixed: 2019994
This commit is contained in:
Archana Ramachandran 2017-03-02 13:14:34 -08:00 • committed by Sandeep Puligilla
commit 2eb57437bc
5 changed files with 226 additions and 13 deletions

View file

@ -60,23 +60,27 @@ typedef const enum policy_mgr_conc_next_action
/**
* policy_mgr_set_concurrency_mode() - To set concurrency mode
* @mode: adapter mode
* @psoc: PSOC object data
* @mode: device mode
*
* This routine is called to set the concurrency mode
*
* Return: NONE
*/
void policy_mgr_set_concurrency_mode(enum tQDF_ADAPTER_MODE mode);
void policy_mgr_set_concurrency_mode(struct wlan_objmgr_psoc *psoc,
enum tQDF_ADAPTER_MODE mode);
/**
* policy_mgr_clear_concurrency_mode() - To clear concurrency mode
* @mode: adapter mode
* @psoc: PSOC object data
* @mode: device mode
*
* This routine is called to clear the concurrency mode
*
* Return: NONE
*/
void policy_mgr_clear_concurrency_mode(enum tQDF_ADAPTER_MODE mode);
void policy_mgr_clear_concurrency_mode(struct wlan_objmgr_psoc *psoc,
enum tQDF_ADAPTER_MODE mode);
/**
* policy_mgr_get_connection_count() - provides the count of
@ -174,20 +178,23 @@ uint8_t policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc);
/**
* policy_mgr_set_mas() - Function to set MAS value to UMAC
* @psoc: PSOC object information
* @mas_value: 0-Disable, 1-Enable MAS
* @psoc: Pointer to psoc
* @mas_value: 0-Disable, 1-Enable MAS
* @dev_mode: device mode
*
* This function passes down the value of MAS to UMAC
*
* Return: Configuration message posting status, SUCCESS or Fail
*
*/
int32_t policy_mgr_set_mas(struct wlan_objmgr_psoc *psoc, uint8_t mas_value);
int32_t policy_mgr_set_mas(struct wlan_objmgr_psoc *psoc,
uint8_t mas_value,
enum tQDF_ADAPTER_MODE dev_mode);
/**
* policy_mgr_set_mcc_p2p_quota() - Function to set quota for P2P
* @psoc: PSOC object information
* @set_value: Qouta value for the interface
* @set_value: Quota value for the interface
*
* This function is used to set the quota for P2P cases
*
@ -772,6 +779,7 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc,
* @sme_pdev_set_hw_mode: Set the new HW mode to FW
* @sme_pdev_set_pcl: Set new PCL to FW
* @sme_nss_update_request: Update NSS value to FW
* @sme_set_mas: Set MCC adaptive scheduler value
*/
struct policy_mgr_sme_cbacks {
QDF_STATUS (*sme_get_valid_channels)(uint8_t *chan_list,
@ -786,6 +794,7 @@ struct policy_mgr_sme_cbacks {
uint8_t new_nss, policy_mgr_nss_update_cback cback,
uint8_t next_action, struct wlan_objmgr_psoc *psoc,
enum policy_mgr_conn_update_reason reason);
QDF_STATUS (*sme_set_mas) (uint32_t val);
};
/**
@ -1666,4 +1675,18 @@ static inline bool policy_mgr_is_scan_simultaneous_capable(
return false;
}
/**
* policy_mgr_is_mcc_adaptive_scheduler_enabled() - Function to
* gets the policy manager mcc adaptive scheduler enabled
* @psoc: PSOC object information
*
* This function gets the value mcc adaptive scheduler
*
* Return: true if MCC adaptive scheduler is set else false
*
*/
bool policy_mgr_is_mcc_adaptive_scheduler_enabled(
struct wlan_objmgr_psoc *psoc);
#endif /* __WLAN_POLICY_MGR_API_H */

View file

@ -144,6 +144,21 @@ bool policy_mgr_is_dual_mac_disabled_in_ini(
return wlan_objmgr_psoc_get_dual_mac_disable(psoc);
}
/**
* policy_mgr_is_mas_enabled_in_user_cfg() - Check if MCC
* adaptive scheduler is enabled in INI
* @psoc: PSOC object information
*
* Checks if MCC adaptive scheduler is enabled in INI
*
* Return: true if MCC adaptive scheduler is enabled in INI
*/
bool policy_mgr_is_mas_enabled_in_user_cfg(
struct wlan_objmgr_psoc *psoc)
{
return false;
}
/**
* policy_mgr_get_dbs_config() - Get DBS bit
*

View file

@ -566,14 +566,82 @@ bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc)
return is_mcc;
}
void policy_mgr_set_concurrency_mode(enum tQDF_ADAPTER_MODE mode)
/**
* policy_mgr_set_concurrency_mode() - To set concurrency mode
* @psoc: PSOC object data
* @mode: device mode
*
* This routine is called to set the concurrency mode
*
* Return: NONE
*/
void policy_mgr_set_concurrency_mode(struct wlan_objmgr_psoc *psoc,
enum tQDF_ADAPTER_MODE mode)
{
return;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid context");
return;
}
switch (mode) {
case QDF_STA_MODE:
case QDF_P2P_CLIENT_MODE:
case QDF_P2P_GO_MODE:
case QDF_SAP_MODE:
case QDF_IBSS_MODE:
case QDF_MONITOR_MODE:
pm_ctx->concurrency_mode |= (1 << mode);
pm_ctx->no_of_open_sessions[mode]++;
break;
default:
break;
}
policy_mgr_info("concurrency_mode = 0x%x Number of open sessions for mode %d = %d",
pm_ctx->concurrency_mode, mode,
pm_ctx->no_of_open_sessions[mode]);
}
void policy_mgr_clear_concurrency_mode(enum tQDF_ADAPTER_MODE mode)
/**
* policy_mgr_clear_concurrency_mode() - To clear concurrency mode
* @psoc: PSOC object data
* @mode: device mode
*
* This routine is called to clear the concurrency mode
*
* Return: NONE
*/
void policy_mgr_clear_concurrency_mode(struct wlan_objmgr_psoc *psoc,
enum tQDF_ADAPTER_MODE mode)
{
return;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid context");
return;
}
switch (mode) {
case QDF_STA_MODE:
case QDF_P2P_CLIENT_MODE:
case QDF_P2P_GO_MODE:
case QDF_SAP_MODE:
case QDF_MONITOR_MODE:
pm_ctx->no_of_open_sessions[mode]--;
if (!(pm_ctx->no_of_open_sessions[mode]))
pm_ctx->concurrency_mode &= (~(1 << mode));
break;
default:
break;
}
policy_mgr_info("concurrency_mode = 0x%x Number of open sessions for mode %d = %d",
pm_ctx->concurrency_mode, mode,
pm_ctx->no_of_open_sessions[mode]);
}
void policy_mgr_incr_active_session(struct wlan_objmgr_psoc *psoc,
@ -1208,8 +1276,93 @@ uint8_t policy_mgr_is_mcc_in_24G(struct wlan_objmgr_psoc *psoc)
return is_24G_mcc;
}
int32_t policy_mgr_set_mas(struct wlan_objmgr_psoc *psoc, uint8_t mas_value)
/**
* policy_mgr_is_mcc_adaptive_scheduler_enabled() - Function to
* gets the policy manager mcc adaptive scheduler enabled
* @psoc: PSOC object information
*
* This function gets the value mcc adaptive scheduler
*
* Return: true if MCC adaptive scheduler is set else false
*
*/
bool policy_mgr_is_mcc_adaptive_scheduler_enabled(
struct wlan_objmgr_psoc *psoc) {
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid context");
return false;
}
return pm_ctx->enable_mcc_adaptive_scheduler ? true : false;
}
/**
* policy_mgr_set_mas() - Function to set MAS value to UMAC
* @psoc: Pointer to psoc
* @mas_value: 0-Disable, 1-Enable MAS
* @dev_mode: device mode
*
* This function passes down the value of MAS to UMAC
*
* Return: Configuration message posting status, SUCCESS or Fail
*
*/
int32_t policy_mgr_set_mas(struct wlan_objmgr_psoc *psoc,
uint8_t mas_value,
enum tQDF_ADAPTER_MODE dev_mode)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
QDF_STATUS ret_status;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid context");
return -EFAULT;
}
if (mas_value) {
if (policy_mgr_is_mas_enabled_in_user_cfg(psoc)) {
policy_mgr_info("Miracast is ON. Disable MAS and configure P2P quota");
pm_ctx->enable_mcc_adaptive_scheduler = false;
ret_status = pm_ctx->sme_cbacks.sme_set_mas(false);
if (QDF_STATUS_SUCCESS != ret_status) {
policy_mgr_err("Failed to disable MAS");
return -EBUSY;
}
}
/* Config p2p quota */
if (dev_mode == QDF_STA_MODE)
policy_mgr_set_mcc_p2p_quota(psoc,
100 - POLICY_MGR_DEFAULT_MCC_P2P_QUOTA);
else if (dev_mode == QDF_P2P_GO_MODE)
policy_mgr_go_set_mcc_p2p_quota(psoc,
POLICY_MGR_DEFAULT_MCC_P2P_QUOTA);
else
policy_mgr_set_mcc_p2p_quota(psoc,
POLICY_MGR_DEFAULT_MCC_P2P_QUOTA);
} else {
policy_mgr_info("Miracast is OFF. Enable MAS and reset P2P quota");
if (dev_mode == QDF_P2P_GO_MODE)
policy_mgr_go_set_mcc_p2p_quota(psoc,
POLICY_MGR_RESET_MCC_P2P_QUOTA);
else
policy_mgr_set_mcc_p2p_quota(psoc,
POLICY_MGR_RESET_MCC_P2P_QUOTA);
if (policy_mgr_is_mas_enabled_in_user_cfg(psoc)) {
pm_ctx->enable_mcc_adaptive_scheduler = true;
ret_status = pm_ctx->sme_cbacks.sme_set_mas(true);
if (QDF_STATUS_SUCCESS != ret_status) {
policy_mgr_err("Unable to enable MAS");
return -EBUSY;
}
}
}
return 0;
}

View file

@ -67,6 +67,12 @@ extern enum cds_band_type cds_chan_to_band(uint32_t chan);
#define CONNECTION_UPDATE_TIMEOUT 1000
#endif
/**
* Some P2P quota calues for MCC
*/
#define POLICY_MGR_DEFAULT_MCC_P2P_QUOTA 70
#define POLICY_MGR_RESET_MCC_P2P_QUOTA 50
/**
* Policy Mgr hardware mode list bit-mask definitions.
* Bits 4:0, 31:29 are unused.
@ -252,6 +258,8 @@ extern enum policy_mgr_conc_next_action
* scan & connections
* @hw_mode_change_in_progress: This is to track if HW mode
* change is in progress
* @enable_mcc_adaptive_scheduler: Enable MCC adaptive scheduler
* value from INI
*/
struct policy_mgr_psoc_priv_obj {
struct wlan_objmgr_psoc *psoc;
@ -280,6 +288,7 @@ struct policy_mgr_psoc_priv_obj {
uint8_t conc_system_pref;
struct dual_mac_config dual_mac_cfg;
uint32_t hw_mode_change_in_progress;
uint8_t enable_mcc_adaptive_scheduler;
};
struct policy_mgr_psoc_priv_obj *policy_mgr_get_context(
@ -297,6 +306,18 @@ QDF_STATUS policy_mgr_get_updated_fw_mode_config(
bool agile_dfs);
bool policy_mgr_is_dual_mac_disabled_in_ini(
struct wlan_objmgr_psoc *psoc);
/**
* policy_mgr_is_mas_enabled_in_user_cfg() - Check if MCC
* adaptive scheduler is enabled in INI
* @psoc: PSOC object information
*
* Checks if MCC adaptive scheduler is enabled in INI
*
* Return: true if MCC adaptive scheduler is enabled in INI
*/
bool policy_mgr_is_mas_enabled_in_user_cfg(
struct wlan_objmgr_psoc *psoc);
bool policy_mgr_get_dbs_config(struct wlan_objmgr_psoc *psoc);
bool policy_mgr_get_agile_dfs_config(struct wlan_objmgr_psoc *psoc);
bool policy_mgr_get_dbs_scan_config(struct wlan_objmgr_psoc *psoc);

View file

@ -396,6 +396,7 @@ QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc,
sme_cbacks->sme_pdev_set_pcl;
pm_ctx->sme_cbacks.sme_soc_set_dual_mac_config =
sme_cbacks->sme_soc_set_dual_mac_config;
pm_ctx->sme_cbacks.sme_set_mas = sme_cbacks->sme_set_mas;
return QDF_STATUS_SUCCESS;
}