Ver Fonte

qcacmn: Add new INI/CFG infrastructure for Policy Manager

Policy Manager component needs to adopt a new INI/CFG
infrastructure

Provide a new infrastructure and remove old INI/CFGs related
to policy manager component.

CRs-Fixed: 2324395
Change-Id: Ia16845c2aef3c5877b0b164fcef13fe7cd41c736
Krunal Soni há 6 anos atrás
pai
commit
f7ba0ea589

+ 91 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -64,6 +64,97 @@ typedef const enum policy_mgr_conc_next_action
 	((channel_select_logic_conc & PM_FW_MODE_STA_P2P_BIT_MASK) >>   \
 	 PM_FW_MODE_STA_P2P_BIT_POS)
 
+/**
+ * policy_mgr_get_mcc_scc_switch() - To mcc to scc switch setting from INI
+ * @psoc: pointer to psoc
+ * @mcc_scc_switch: value to be filled
+ *
+ * This API pulls mcc to scc switch setting which is given as part of INI and
+ * stored in policy manager's CFGs.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
+					      uint8_t *mcc_scc_switch);
+/**
+ * policy_mgr_get_sys_pref() - to get system preference
+ * @psoc: pointer to psoc
+ * @sys_pref: value to be filled
+ *
+ * This API pulls the system preference for policy manager to provide
+ * PCL
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
+					uint8_t *sys_pref);
+/**
+ * policy_mgr_get_max_conc_cxns() - to get max num of conc connections
+ * @psoc: pointer to psoc
+ * @max_conc_cxns: value to be filled
+ *
+ * This API pulls max number of active connections which can be allowed
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
+						uint8_t *max_conc_cxns);
+/**
+ * policy_mgr_get_conc_rule1() - to find out if conc rule1 is enabled
+ * @psoc: pointer to psoc
+ * @conc_rule1: value to be filled
+ *
+ * This API is used to find out if conc rule-1 is enabled by user
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule1);
+/**
+ * policy_mgr_get_conc_rule2() - to find out if conc rule2 is enabled
+ * @psoc: pointer to psoc
+ * @conc_rule2: value to be filled
+ *
+ * This API is used to find out if conc rule-2 is enabled by user
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule2);
+/**
+ * policy_mgr_get_dbs_selection_plcy() - DBS HW mode selection setting
+ * @psoc: pointer to psoc
+ * @dbs_selection_policy: value to be filled
+ *
+ * This API is used to find out DBS HW mode preference.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_dbs_selection_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *dbs_selection_policy);
+/**
+ * policy_mgr_get_vdev_priority_list() - to get vdev priority list
+ * @psoc: pointer to psoc
+ * @vdev_priority_list: value to be filled
+ *
+ * This API is used to find out vdev_priority_list setting
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_vdev_priority_list(struct wlan_objmgr_psoc *psoc,
+						uint32_t *vdev_priority_list);
+/**
+ * policy_mgr_get_chnl_select_plcy() - to get channel selection policy
+ * @psoc: pointer to psoc
+ * @chnl_select_plcy: value to be filled
+ *
+ * This API is used to find out which channel selection policy has been
+ * configured
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *chnl_select_plcy);
 /**
  * policy_mgr_set_concurrency_mode() - To set concurrency mode
  * @psoc: PSOC object data

+ 255 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_cfg.h

@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2012-2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __CFG_POLICY_MGR
+#define __CFG_POLICY_MGR
+#include "qdf_types.h"
+
+/*
+ * <ini>
+ * gWlanMccToSccSwitchMode - Control SAP channel.
+ * @Min: 0
+ * @Max: 5
+ * @Default: 0
+ *
+ * This ini is used to override SAP channel.
+ * If gWlanMccToSccSwitchMode = 0: disabled.
+ * If gWlanMccToSccSwitchMode = 1: Enable switch.
+ * If gWlainMccToSccSwitchMode = 2: Force switch with SAP restart.
+ * If gWlainMccToSccSwitchMode = 3: Force switch without SAP restart.
+ * If gWlainMccToSccSwitchMode = 4: Switch using
+ * 					fav channel(s)without SAP restart.
+ * If gWlainMccToSccSwitchMode = 5: Force switch without SAP restart.MCC allowed
+ *					in exceptional cases.
+ * If gWlainMccToSccSwitchMode = 6: Force Switch without SAP restart only in
+					user preffered band.
+ * Related: None.
+ *
+ * Supported Feature: Concurrency
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_MCC_TO_SCC_SWITCH CFG_INI_UINT(\
+					"gWlanMccToSccSwitchMode", \
+					QDF_MCC_TO_SCC_SWITCH_DISABLE, \
+					QDF_MCC_TO_SCC_SWITCH_MAX - 1, \
+					QDF_MCC_TO_SCC_SWITCH_DISABLE, \
+					CFG_VALUE_OR_DEFAULT, \
+					"Provides MCC to SCC switch mode")
+/*
+ * <ini>
+ * gSystemPref - Configure wlan system preference for PCL.
+ * @Min: 0
+ * @Max: 2
+ * @Default: 0
+ *
+ * This ini is used to configure wlan system preference option to help
+ * policy manager decide on Preferred Channel List for a new connection.
+ * For possible values refer to enum hdd_conc_priority_mode
+ *
+ * Related: None.
+ *
+ * Supported Feature: DBS
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_CONC_SYS_PREF CFG_INI_UINT(\
+					"gSystemPref", 0, 2, 0, \
+					CFG_VALUE_OR_DEFAULT, \
+					"System preference to predict PCL")
+/*
+ * <ini>
+ * gMaxConcurrentActiveSessions - Maximum number of concurrent connections.
+ * @Min: 1
+ * @Max: 4
+ * @Default: 3
+ *
+ * This ini is used to configure the maximum number of concurrent connections.
+ *
+ * Related: None.
+ *
+ * Supported Feature: Concurrency
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_MAX_CONC_CXNS CFG_INI_UINT(\
+					"gMaxConcurrentActiveSessions", \
+					1, 4, 3, \
+					CFG_VALUE_OR_DEFAULT, \
+					"Config max num allowed connections")
+/*
+ * <ini>
+ * channel_select_logic_conc - Set channel selection logic
+ * for different concurrency combinations to DBS or inter band
+ * MCC. Default is DBS for STA+STA and STA+P2P.
+ * @Min: 0x00000000
+ * @Max: 0xFFFFFFFF
+ * @Default: 0x00000000
+ *
+ * 0 - inter-band MCC
+ * 1 - DBS
+ *
+ * BIT 0: STA+STA
+ * BIT 1: STA+P2P
+ * BIT 2-31: Reserved
+ *
+ * Supported Feature: STA+STA, STA+P2P
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_CHNL_SELECT_LOGIC_CONC CFG_INI_UINT(\
+						"channel_select_logic_conc",\
+						0x00000000, \
+						0xFFFFFFFF, \
+						0x00000003, \
+						CFG_VALUE_OR_DEFAULT, \
+						"Set channel selection policy for various concurrency")
+/*
+ * <ini>
+ * dbs_selection_policy - Configure dbs selection policy.
+ * @Min: 0
+ * @Max: 3
+ * @Default: 0
+ *
+ *  set band preference or Vdev preference.
+ *      bit[0] = 0: 5G 2x2 preferred to select 2x2 5G + 1x1 2G DBS mode.
+ *      bit[0] = 1: 2G 2x2 preferred to select 2x2 2G + 1x1 5G DBS mode.
+ *      bit[1] = 1: vdev priority enabled. The INI "vdev_priority_list" will
+ * specify the vdev priority.
+ *      bit[1] = 0: vdev priority disabled.
+ * This INI only take effect for Genoa dual DBS hw.
+ *
+ * Supported Feature: DBS
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_DBS_SELECTION_PLCY CFG_INI_UINT(\
+					    "dbs_selection_policy", \
+					    0, 3, 0, \
+					    CFG_VALUE_OR_DEFAULT, \
+					    "Configure dbs selection policy")
+/*
+ * <ini>
+ * vdev_priority_list - Configure vdev priority list.
+ * @Min: 0
+ * @Max: 0x4444
+ * @Default: 0x4321
+ *
+ * @vdev_priority_list: vdev priority list
+ *      bit[0-3]: pri_id (policy_mgr_pri_id) of highest priority
+ *      bit[4-7]: pri_id (policy_mgr_pri_id) of second priority
+ *      bit[8-11]: pri_id (policy_mgr_pri_id) of third priority
+ *      bit[12-15]: pri_id (policy_mgr_pri_id) of fourth priority
+ *      example: 0x4321 - CLI < GO < SAP < STA
+ *      vdev priority id mapping:
+ *        PM_STA_PRI_ID = 1,
+ *        PM_SAP_PRI_ID = 2,
+ *        PM_P2P_GO_PRI_ID = 3,
+ *        PM_P2P_CLI_PRI_ID = 4,
+ * When the previous INI "dbs_selection_policy" bit[1]=1, which means
+ * the vdev 2x2 prioritization enabled. Then this INI will be used to
+ * specify the vdev type priority list. For example :
+ * dbs_selection_policy=0x2
+ * vdev_priority_list=0x4312
+ * means: default preference 2x2 band is 5G, vdev 2x2 prioritization enabled.
+ * And the priority list is CLI < GO < STA < SAP
+ *
+ * This INI only take effect for Genoa dual DBS hw.
+ *
+ * Supported Feature: DBS
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_VDEV_CUSTOM_PRIORITY_LIST CFG_INI_UINT(\
+					"vdev_priority_list", \
+					0, 0x4444, 0x4321, \
+					CFG_VALUE_OR_DEFAULT, \
+					"Configure vdev priority list")
+/*
+ * <ini>
+ * gEnableCustomConcRule1 - Enable custom concurrency rule1.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to enable/disable custom concurrency rule1.
+ * If SAP comes up first and STA comes up later then SAP needs to follow STA's
+ * channel.
+ *
+ * Related: None.
+ *
+ * Supported Feature: Concurrency
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_CONC_RULE1 CFG_INI_UINT(\
+					"gEnableCustomConcRule1", \
+					0, 1, 0, \
+					CFG_VALUE_OR_DEFAULT, \
+					"Enable custom concurrency rule 1")
+/*
+ * <ini>
+ * gEnableCustomConcRule2 - Enable custom concurrency rule2.
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to enable/disable custom concurrency rule2.
+ * If P2PGO comes up first and STA comes up later then P2PGO need to follow
+ * STA's channel in 5Ghz. In following if condition we are just adding sanity
+ * check to make sure that by this time P2PGO's channel is same as STA's
+ * channel.
+ *
+ * Related: None.
+ *
+ * Supported Feature: Concurrency
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_CONC_RULE2 CFG_INI_UINT(\
+					"gEnableCustomConcRule2", \
+					0, 1, 0, \
+					CFG_VALUE_OR_DEFAULT, \
+					"Enable custom concurrency rule 2")
+
+#define CFG_POLICY_MGR_ALL \
+		CFG(CFG_MCC_TO_SCC_SWITCH) \
+		CFG(CFG_CONC_SYS_PREF) \
+		CFG(CFG_MAX_CONC_CXNS) \
+		CFG(CFG_DBS_SELECTION_PLCY) \
+		CFG(CFG_VDEV_CUSTOM_PRIORITY_LIST) \
+		CFG(CFG_CHNL_SELECT_LOGIC_CONC) \
+		CFG(CFG_ENABLE_CONC_RULE1) \
+		CFG(CFG_ENABLE_CONC_RULE2)
+#endif

+ 143 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_ucfg.h

@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef __WLAN_POLICY_MGR_UCFG
+#define __WLAN_POLICY_MGR_UCFG
+#include "wlan_objmgr_psoc_obj.h"
+#include "wlan_objmgr_global_obj.h"
+#include "qdf_status.h"
+
+
+/**
+ * ucfg_policy_mgr_psoc_open() - This API sets CFGs to policy manager context
+ *
+ * This API pulls policy manager's context from PSOC and initialize the CFG
+ * structure of policy manager.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc);
+/**
+ * ucfg_policy_mgr_psoc_close() - This API resets CFGs for policy manager ctx
+ *
+ * This API pulls policy manager's context from PSOC and resets the CFG
+ * structure of policy manager.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc);
+#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
+/**
+ * ucfg_policy_mgr_get_mcc_scc_switch() - To mcc to scc switch setting from INI
+ * @psoc: pointer to psoc
+ * @mcc_scc_switch: value to be filled
+ *
+ * This API pulls mcc to scc switch setting which is given as part of INI and
+ * stored in policy manager's CFGs.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
+					      uint8_t *mcc_scc_switch);
+#else
+static inline
+QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
+					      uint8_t *mcc_scc_switch)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif //FEATURE_WLAN_MCC_TO_SCC_SWITCH
+/**
+ * ucfg_policy_mgr_get_sys_pref() - to get system preference
+ * @psoc: pointer to psoc
+ * @sys_pref: value to be filled
+ *
+ * This API pulls the system preference for policy manager to provide
+ * PCL
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
+					uint8_t *sys_pref);
+/**
+ * ucfg_policy_mgr_get_max_conc_cxns() - to get max num of conc connections
+ * @psoc: pointer to psoc
+ * @max_conc_cxns: value to be filled
+ *
+ * This API pulls max number of active connections which can be allowed
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
+						uint8_t *max_conc_cxns);
+/**
+ * ucfg_policy_mgr_get_conc_rule1() - to find out if conc rule1 is enabled
+ * @psoc: pointer to psoc
+ * @conc_rule1: value to be filled
+ *
+ * This API is used to find out if conc rule-1 is enabled by user
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule1);
+/**
+ * ucfg_policy_mgr_get_conc_rule2() - to find out if conc rule2 is enabled
+ * @psoc: pointer to psoc
+ * @conc_rule2: value to be filled
+ *
+ * This API is used to find out if conc rule-2 is enabled by user
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule2);
+/**
+ * ucfg_policy_mgr_get_dbs_selection_plcy() - DBS HW mode selection setting
+ * @psoc: pointer to psoc
+ * @dbs_selection_policy: value to be filled
+ *
+ * This API is used to find out DBS HW mode preference.
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_dbs_selection_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *dbs_selection_policy);
+/**
+ * ucfg_policy_mgr_get_vdev_priority_list() - to get vdev priority list
+ * @psoc: pointer to psoc
+ * @vdev_priority_list: value to be filled
+ *
+ * This API is used to find out vdev_priority_list setting
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_vdev_priority_list(struct wlan_objmgr_psoc *psoc,
+						uint32_t *vdev_priority_list);
+/**
+ * policy_mgr_get_chnl_select_plcy() - to get channel selection policy
+ * @psoc: pointer to psoc
+ * @chnl_select_plcy: value to be filled
+ *
+ * This API is used to find out which channel selection policy has been
+ * configured
+ *
+ * Return: QDF_STATUS_SUCCESS up on success and any other status for failure.
+ */
+QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *chnl_select_plcy);
+#endif //__WLAN_POLICY_MGR_UCFG

+ 122 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -36,6 +36,128 @@
 /* invalid channel id. */
 #define INVALID_CHANNEL_ID 0
 
+QDF_STATUS policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
+					      uint8_t *mcc_scc_switch)
+{
+	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;
+	}
+	*mcc_scc_switch = pm_ctx->cfg.mcc_to_scc_switch;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
+					uint8_t *sys_pref)
+{
+	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;
+	}
+	*sys_pref = pm_ctx->cfg.sys_pref;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
+						uint8_t *max_conc_cxns)
+{
+	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;
+	}
+	*max_conc_cxns = pm_ctx->cfg.max_conc_cxns;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule1)
+{
+	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;
+	}
+	*conc_rule1 = pm_ctx->cfg.conc_rule1;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule2)
+{
+	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;
+	}
+	*conc_rule2 = pm_ctx->cfg.conc_rule2;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_dbs_selection_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *dbs_selection_plcy)
+{
+	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;
+	}
+	*dbs_selection_plcy = pm_ctx->cfg.dbs_selection_plcy;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_vdev_priority_list(struct wlan_objmgr_psoc *psoc,
+						uint32_t *vdev_priority_list)
+{
+	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;
+	}
+	*vdev_priority_list = pm_ctx->cfg.vdev_priority_list;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *chnl_select_plcy)
+{
+	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;
+	}
+	*chnl_select_plcy = pm_ctx->cfg.chnl_select_plcy;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+
+
 void policy_mgr_update_new_hw_mode_index(struct wlan_objmgr_psoc *psoc,
 		uint32_t new_hw_mode_index)
 {

+ 23 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -213,6 +213,28 @@ struct sta_ap_intf_check_work_ctx {
 	struct wlan_objmgr_psoc *psoc;
 };
 
+/**
+ * struct policy_mgr_cfg - all the policy manager owned configs
+ * @mcc_to_scc_switch: switch to indicate MCC to SCC config
+ * @sys_pref: system's preference while selecting PCLs
+ * @max_conc_cxns: Max allowed concurrenct active connections
+ * @conc_rule1: concurrency rule1
+ * @conc_rule2: concurrency rule2
+ * @dbs_selection_plcy: DBS selection policy for concurrency
+ * @vdev_priority_list: Priority list for various vdevs
+ * @chnl_select_plcy: Channel selection policy
+ */
+struct policy_mgr_cfg {
+	uint8_t mcc_to_scc_switch;
+	uint8_t sys_pref;
+	uint8_t max_conc_cxns;
+	uint8_t conc_rule1;
+	uint8_t conc_rule2;
+	uint32_t dbs_selection_plcy;
+	uint32_t vdev_priority_list;
+	uint32_t chnl_select_plcy;
+};
+
 /**
  * struct policy_mgr_psoc_priv_obj - Policy manager private data
  * @psoc: pointer to PSOC object information
@@ -298,6 +320,7 @@ struct policy_mgr_psoc_priv_obj {
 	qdf_event_t channel_switch_complete_evt;
 	send_mode_change_event_cb mode_change_cb;
 	uint32_t user_config_sap_channel;
+	struct policy_mgr_cfg cfg;
 };
 
 /**

+ 123 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_ucfg.c

@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2018 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
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#include "wlan_policy_mgr_ucfg.h"
+#include "wlan_policy_mgr_i.h"
+#include "cfg_ucfg_api.h"
+#include "wlan_policy_mgr_api.h"
+
+static QDF_STATUS policy_mgr_init_cfg(struct wlan_objmgr_psoc *psoc)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	struct policy_mgr_cfg *cfg;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("pm_ctx is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+	cfg = &pm_ctx->cfg;
+
+	cfg->mcc_to_scc_switch = cfg_get(psoc, CFG_MCC_TO_SCC_SWITCH);
+	cfg->sys_pref = cfg_get(psoc, CFG_CONC_SYS_PREF);
+	cfg->max_conc_cxns = cfg_get(psoc, CFG_MAX_CONC_CXNS);
+	cfg->conc_rule1 = cfg_get(psoc, CFG_ENABLE_CONC_RULE1);
+	cfg->conc_rule2 = cfg_get(psoc, CFG_ENABLE_CONC_RULE2);
+	cfg->dbs_selection_plcy = cfg_get(psoc, CFG_DBS_SELECTION_PLCY);
+	cfg->vdev_priority_list = cfg_get(psoc, CFG_VDEV_CUSTOM_PRIORITY_LIST);
+	cfg->chnl_select_plcy = cfg_get(psoc, CFG_CHNL_SELECT_LOGIC_CONC);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static void policy_mgr_deinit_cfg(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("pm_ctx is NULL");
+		return;
+	}
+
+	qdf_mem_zero(&pm_ctx->cfg, sizeof(pm_ctx->cfg));
+}
+
+QDF_STATUS ucfg_policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	QDF_STATUS status;
+
+	status = policy_mgr_init_cfg(psoc);
+	if (status != QDF_STATUS_SUCCESS) {
+		policy_mgr_err("pm_ctx is NULL");
+		return status;
+	}
+	return QDF_STATUS_SUCCESS;
+}
+
+void ucfg_policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	policy_mgr_deinit_cfg(psoc);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_mcc_scc_switch(struct wlan_objmgr_psoc *psoc,
+					      uint8_t *mcc_scc_switch)
+{
+	return policy_mgr_get_mcc_scc_switch(psoc, mcc_scc_switch);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_sys_pref(struct wlan_objmgr_psoc *psoc,
+					uint8_t *sys_pref)
+{
+	return policy_mgr_get_sys_pref(psoc, sys_pref);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_max_conc_cxns(struct wlan_objmgr_psoc *psoc,
+						uint8_t *max_conc_cxns)
+{
+	return policy_mgr_get_max_conc_cxns(psoc, max_conc_cxns);;
+}
+
+QDF_STATUS ucfg_policy_mgr_get_conc_rule1(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule1)
+{
+	return policy_mgr_get_conc_rule1(psoc, conc_rule1);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_conc_rule2(struct wlan_objmgr_psoc *psoc,
+						uint8_t *conc_rule2)
+{
+	return policy_mgr_get_conc_rule2(psoc, conc_rule2);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_dbs_selection_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *dbs_selection_plcy)
+{
+	return policy_mgr_get_dbs_selection_plcy(psoc, dbs_selection_plcy);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_vdev_priority_list(struct wlan_objmgr_psoc *psoc,
+						uint32_t *vdev_priority_list)
+{
+	return policy_mgr_get_vdev_priority_list(psoc, vdev_priority_list);
+}
+
+QDF_STATUS ucfg_policy_mgr_get_chnl_select_plcy(struct wlan_objmgr_psoc *psoc,
+						uint32_t *chnl_select_plcy)
+{
+	return policy_mgr_get_chnl_select_plcy(psoc, chnl_select_plcy);
+}