Browse Source

qcacld-3.0: Move gSystemPref from HDD to Policy manager

As part of new INI/CFG model, move gSystemPref ownership
from HDD to policy manager.

CRs-Fixed: 2324393
Change-Id: Ia586896ea55c6e71d8dcff705bf0e74879931dbb
Krunal Soni 6 years ago
parent
commit
e71838de7e

+ 0 - 25
core/hdd/inc/wlan_hdd_cfg.h

@@ -4985,30 +4985,6 @@ enum hdd_link_speed_rpt_type {
 #define CFG_ENABLE_NON_DFS_CHAN_ON_RADAR_MAX       (1)
 #define CFG_ENABLE_NON_DFS_CHAN_ON_RADAR_DEFAULT   (0)
 
-/*
- * <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_SYSTEM_PREF               "gSystemPref"
-#define CFG_CONC_SYSTEM_PREF_MIN           (0)
-#define CFG_CONC_SYSTEM_PREF_MAX           (2)
-#define CFG_CONC_SYSTEM_PREF_DEFAULT       (0)
-
 /*
  * <ini>
  * dbs_selection_policy - Configure dbs selection policy.
@@ -7748,7 +7724,6 @@ struct hdd_config {
 	uint8_t sap_11ac_override;
 	uint8_t go_11ac_override;
 	uint8_t prefer_non_dfs_on_radar;
-	uint8_t conc_system_pref;
 	uint32_t dbs_selection_policy;
 	uint32_t vdev_priority_list;
 	bool tso_enable;

+ 6 - 2
core/hdd/src/wlan_hdd_active_tos.c

@@ -29,6 +29,7 @@
 #include <linux/etherdevice.h>
 #include <linux/if_ether.h>
 #include <wlan_hdd_active_tos.h>
+#include "wlan_policy_mgr_ucfg.h"
 
 /**
  * tos - Type of service requested by the application
@@ -93,12 +94,15 @@ hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter,
 	uint32_t max_off_chan_time = 0;
 	QDF_STATUS status;
 	int ret;
+	uint8_t def_sys_pref = 0;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	ret = wlan_hdd_validate_context(hdd_ctx);
 
 	if (ret < 0)
 		return ret;
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc,
+				     &def_sys_pref);
 
 	ac_bit = limit_off_chan_tbl[tos][HDD_AC_BIT_INDX];
 
@@ -122,12 +126,12 @@ hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter,
 			/*ignore this command if only BE/BK is active */
 			is_tos_active = false;
 			policy_mgr_set_cur_conc_system_pref(hdd_ctx->psoc,
-					hdd_ctx->config->conc_system_pref);
+							    def_sys_pref);
 		}
 	} else {
 		/* No active tos */
 		policy_mgr_set_cur_conc_system_pref(hdd_ctx->psoc,
-				hdd_ctx->config->conc_system_pref);
+						    def_sys_pref);
 	}
 
 	status = sme_send_limit_off_channel_params(hdd_ctx->mac_handle,

+ 0 - 8
core/hdd/src/wlan_hdd_cfg.c

@@ -2095,13 +2095,6 @@ struct reg_table_entry g_registry_table[] = {
 		     CFG_ENABLE_NON_DFS_CHAN_ON_RADAR_MIN,
 		     CFG_ENABLE_NON_DFS_CHAN_ON_RADAR_MAX),
 
-	REG_VARIABLE(CFG_CONC_SYSTEM_PREF, WLAN_PARAM_Integer,
-		   struct hdd_config, conc_system_pref,
-		   VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		   CFG_CONC_SYSTEM_PREF_DEFAULT,
-		   CFG_CONC_SYSTEM_PREF_MIN,
-		   CFG_CONC_SYSTEM_PREF_MAX),
-
 	REG_VARIABLE(CFG_DBS_SELECTION_POLICY, WLAN_PARAM_Integer,
 		     struct hdd_config, dbs_selection_policy,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -4270,7 +4263,6 @@ QDF_STATUS hdd_set_policy_mgr_user_cfg(struct hdd_context *hdd_ctx)
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	user_cfg->conc_system_pref = hdd_ctx->config->conc_system_pref;
 	user_cfg->enable_mcc_adaptive_scheduler =
 		hdd_ctx->config->enableMCCAdaptiveScheduler;
 	user_cfg->max_concurrent_active_sessions =

+ 15 - 7
core/hdd/src/wlan_hdd_conc_ut.c

@@ -32,6 +32,7 @@
 #include "wma_types.h"
 #include "wma.h"
 #include "wma_api.h"
+#include "wlan_policy_mgr_ucfg.h"
 
 #define NUMBER_OF_SCENARIO 300
 #define MAX_ALLOWED_CHAR_IN_REPORT 50
@@ -174,9 +175,13 @@ void fill_report(struct hdd_context *hdd_ctx, char *title,
 {
 	int i;
 	char buf[4] = {0};
+	uint8_t sys_pref = 0;
 
 	if (report_idx >= NUMBER_OF_SCENARIO)
 		return;
+
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &sys_pref);
+
 	snprintf(report[report_idx].title,
 		2 * MAX_ALLOWED_CHAR_IN_REPORT, "pcl for[%s] pcl_type[%s]",
 		title, pcl_type_to_string(pcl_type));
@@ -215,7 +220,7 @@ void fill_report(struct hdd_context *hdd_ctx, char *title,
 		? "enable" : "disable");
 	snprintf(report[report_idx].system_conf,
 		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
-		system_config_to_string(hdd_ctx->config->conc_system_pref));
+		system_config_to_string(sys_pref));
 	snprintf(report[report_idx].result_code,
 		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 		status ? "PASS" : "FAIL");
@@ -617,8 +622,6 @@ static void wlan_hdd_map_subtypes_hdd_wma(enum policy_mgr_con_mode *dst,
 void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
 {
 	enum policy_mgr_con_mode sub_type;
-	enum policy_mgr_conc_priority_mode system_pref =
-			hdd_ctx->config->conc_system_pref;
 	uint8_t pcl[QDF_MAX_NUM_CHAN] = {0},
 		weight_list[QDF_MAX_NUM_CHAN] = {0};
 	uint32_t pcl_len = 0;
@@ -627,6 +630,9 @@ void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
 	char reason[20] = {0};
 	QDF_STATUS ret;
 	struct policy_mgr_sme_cbacks sme_cbacks;
+	uint8_t system_pref = 0;
+
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
 
 	sme_cbacks.sme_get_valid_channels = sme_get_valid_channels;
 	sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
@@ -675,14 +681,15 @@ void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
 	uint32_t pcl_len = 0;
 	enum policy_mgr_chain_mode chain_mask = first_chain_mask;
 	enum policy_mgr_con_mode sub_type, next_sub_type, dummy_type;
-	enum policy_mgr_conc_priority_mode system_pref =
-			hdd_ctx->config->conc_system_pref;
 	enum policy_mgr_pcl_type pcl_type;
 	enum policy_mgr_one_connection_mode second_index;
 	char reason[20] = {0};
 	bool status = false;
 	QDF_STATUS ret;
 	struct policy_mgr_sme_cbacks sme_cbacks;
+	uint8_t system_pref = 0;
+
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
 
 	for (sub_type = PM_STA_MODE;
 		sub_type < PM_MAX_NUM_OF_MODE; sub_type++) {
@@ -762,14 +769,15 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
 	enum policy_mgr_chain_mode chain_mask_2;
 	enum policy_mgr_con_mode sub_type_1, sub_type_2, next_sub_type;
 	enum policy_mgr_con_mode dummy_type_1, dummy_type_2;
-	enum policy_mgr_conc_priority_mode system_pref =
-			hdd_ctx->config->conc_system_pref;
 	enum policy_mgr_pcl_type pcl_type;
 	enum policy_mgr_two_connection_mode third_index;
 	char reason[20] = {0};
 	bool status = false;
 	QDF_STATUS ret;
 	struct policy_mgr_sme_cbacks sme_cbacks;
+	uint8_t system_pref = 0;
+
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
 
 	/* let's set the chain_mask, mac_ids*/
 	if (chain_mask == POLICY_MGR_TWO_TWO) {

+ 4 - 7
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -35,6 +35,7 @@
 #include "wma_api.h"
 #endif
 #include "wlan_hdd_power.h"
+#include "wlan_policy_mgr_ucfg.h"
 #include <cdp_txrx_stats.h>
 #include "wlan_dfs_utils_api.h"
 #include <wlan_ipa_ucfg_api.h>
@@ -519,16 +520,12 @@ static __iw_softap_setparam(struct net_device *dev,
 			ret = -EINVAL;
 		}
 		break;
+
 	case QCSAP_PARAM_CONC_SYSTEM_PREF:
 		hdd_debug("New preference: %d", set_value);
-		if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
-				(set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
-			hdd_err("Invalid system preference: %d", set_value);
-			return -EINVAL;
-		}
-		/* hdd_ctx, hdd_ctx->config are already checked for null */
-		hdd_ctx->config->conc_system_pref = set_value;
+		ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, set_value);
 		break;
+
 	case QCSAP_PARAM_MAX_ASSOC:
 		if (WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) {
 			hdd_err("Invalid setMaxAssoc value %d",

+ 7 - 4
core/hdd/src/wlan_hdd_main.c

@@ -147,6 +147,7 @@
 #include "cfg_mlme_acs.h"
 #include "wlan_mlme_public_struct.h"
 #include "wlan_fwol_ucfg_api.h"
+#include "wlan_policy_mgr_ucfg.h"
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
 #endif
@@ -2718,7 +2719,7 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
 		if (QDF_IS_STATUS_ERROR(status)) {
 			hdd_err("Failed to Open CDS; status: %d", status);
 			ret = qdf_status_to_os_return(status);
-			goto hdd_psoc_close;
+			goto psoc_close;
 		}
 
 		hdd_ctx->mac_handle = cds_get_context(QDF_MODULE_ID_SME);
@@ -2816,7 +2817,7 @@ close:
 
 	cds_close(hdd_ctx->psoc);
 
-hdd_psoc_close:
+psoc_close:
 	hdd_component_psoc_close(hdd_ctx->psoc);
 	cds_deinit_ini_config();
 
@@ -14426,15 +14427,17 @@ int hdd_reset_limit_off_chan(struct hdd_adapter *adapter)
 	struct hdd_context *hdd_ctx;
 	int ret;
 	QDF_STATUS status;
+	uint8_t sys_pref = 0;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	ret = wlan_hdd_validate_context(hdd_ctx);
 	if (ret < 0)
 		return ret;
 
+	ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc,
+				     &sys_pref);
 	/* set the system preferece to default */
-	policy_mgr_set_cur_conc_system_pref(hdd_ctx->psoc,
-			hdd_ctx->config->conc_system_pref);
+	policy_mgr_set_cur_conc_system_pref(hdd_ctx->psoc, sys_pref);
 
 	/* clear the bitmap */
 	adapter->active_ac = 0;

+ 4 - 12
core/hdd/src/wlan_hdd_wext.c

@@ -102,6 +102,7 @@
 #include "cfg_mlme_sta.h"
 #include "wlan_mlme_public_struct.h"
 #include "cfg_ucfg_api.h"
+#include "wlan_policy_mgr_ucfg.h"
 #include "wlan_mlme_public_struct.h"
 #include "cfg_ucfg_api.h"
 #include "cfg_mlme_threshold.h"
@@ -5183,19 +5184,9 @@ static int __iw_setint_getnone(struct net_device *dev,
 		break;
 	}
 	case WE_SET_CONC_SYSTEM_PREF:
-	{
 		hdd_debug("New preference: %d", set_value);
-		if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
-				(set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
-			hdd_err("Invalid system preference %d", set_value);
-			ret = -EINVAL;
-			break;
-		}
-
-		/* hdd_ctx, hdd_ctx->config are already checked for null */
-		hdd_ctx->config->conc_system_pref = set_value;
+		ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, set_value);
 		break;
-	}
 	case WE_SET_11AX_RATE:
 		ret = hdd_set_11ax_rate(adapter, set_value, NULL);
 		break;
@@ -6968,7 +6959,8 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
 		if (apps_args[1] >= PM_THROUGHPUT &&
 			apps_args[1] <= PM_LATENCY) {
 			pr_info("setting system pref to [%d]\n", apps_args[1]);
-			hdd_ctx->config->conc_system_pref = apps_args[1];
+			ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
+						     apps_args[1]);
 		}
 	}
 	break;