Prechádzať zdrojové kódy

qcacld-3.0: HDD change for policy manager restructuring part 2

Modify HDD code to cope with the policy manager moving to host
common.

Change-Id: I9f15fad9edba92aa95a062fe187b084de8e0d419
CRs-Fixed: 2009818
Tushnim Bhattacharyya 8 rokov pred
rodič
commit
9028cc7246

+ 1 - 1
core/hdd/src/wlan_hdd_cfg.c

@@ -45,8 +45,8 @@
 #include <wlan_hdd_misc.h>
 #include <wlan_hdd_napi.h>
 #include <cds_api.h>
-#include <cds_concurrency.h>
 #include "wlan_hdd_he.h"
+#include <wlan_policy_mgr_api.h>
 
 static void
 cb_notify_set_roam_prefer5_g_hz(hdd_context_t *pHddCtx, unsigned long notifyId)

+ 152 - 140
core/hdd/src/wlan_hdd_conc_ut.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,7 +33,7 @@
 #include <wni_api.h>
 #include <wlan_hdd_cfg.h>
 #include "wlan_hdd_trace.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "wlan_hdd_conc_ut.h"
 #include "qdf_types.h"
 #include "qdf_trace.h"
@@ -82,13 +82,13 @@ static uint32_t report_idx;
 static uint8_t wlan_hdd_valid_type_of_persona(uint32_t sub_type)
 {
 	switch (sub_type) {
-	case CDS_STA_MODE:
+	case PM_STA_MODE:
 		return WMI_VDEV_TYPE_STA;
-	case CDS_IBSS_MODE:
+	case PM_IBSS_MODE:
 		return WMI_VDEV_TYPE_IBSS;
-	case CDS_SAP_MODE:
-	case CDS_P2P_CLIENT_MODE:
-	case CDS_P2P_GO_MODE:
+	case PM_SAP_MODE:
+	case PM_P2P_CLIENT_MODE:
+	case PM_P2P_GO_MODE:
 		return WMI_VDEV_TYPE_AP;
 	default:
 		return WMI_VDEV_TYPE_STA;
@@ -98,9 +98,9 @@ static uint8_t wlan_hdd_valid_type_of_persona(uint32_t sub_type)
 static const char *system_config_to_string(uint8_t idx)
 {
 	switch (idx) {
-	CASE_RETURN_STRING(CDS_THROUGHPUT);
-	CASE_RETURN_STRING(CDS_POWERSAVE);
-	CASE_RETURN_STRING(CDS_LATENCY);
+	CASE_RETURN_STRING(PM_THROUGHPUT);
+	CASE_RETURN_STRING(PM_POWERSAVE);
+	CASE_RETURN_STRING(PM_LATENCY);
 	default:
 		return "Unknown";
 	}
@@ -110,11 +110,11 @@ static const char *system_config_to_string(uint8_t idx)
 static const char *device_mode_to_string(uint8_t idx)
 {
 	switch (idx) {
-	CASE_RETURN_STRING(CDS_STA_MODE);
-	CASE_RETURN_STRING(CDS_SAP_MODE);
-	CASE_RETURN_STRING(CDS_P2P_CLIENT_MODE);
-	CASE_RETURN_STRING(CDS_P2P_GO_MODE);
-	CASE_RETURN_STRING(CDS_IBSS_MODE);
+	CASE_RETURN_STRING(PM_STA_MODE);
+	CASE_RETURN_STRING(PM_SAP_MODE);
+	CASE_RETURN_STRING(PM_P2P_CLIENT_MODE);
+	CASE_RETURN_STRING(PM_P2P_GO_MODE);
+	CASE_RETURN_STRING(PM_IBSS_MODE);
 	default:
 		return "none";
 	}
@@ -123,25 +123,25 @@ static const char *device_mode_to_string(uint8_t idx)
 static const char *pcl_type_to_string(uint8_t idx)
 {
 	switch (idx) {
-	CASE_RETURN_STRING(CDS_NONE);
-	CASE_RETURN_STRING(CDS_24G);
-	CASE_RETURN_STRING(CDS_5G);
-	CASE_RETURN_STRING(CDS_SCC_CH);
-	CASE_RETURN_STRING(CDS_MCC_CH);
-	CASE_RETURN_STRING(CDS_SCC_CH_24G);
-	CASE_RETURN_STRING(CDS_SCC_CH_5G);
-	CASE_RETURN_STRING(CDS_24G_SCC_CH);
-	CASE_RETURN_STRING(CDS_5G_SCC_CH);
-	CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24_24G);
-	CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24_5G);
-	CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5_24G);
-	CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5_5G);
-	CASE_RETURN_STRING(CDS_SCC_ON_5_SCC_ON_24);
-	CASE_RETURN_STRING(CDS_SCC_ON_24_SCC_ON_5);
-	CASE_RETURN_STRING(CDS_MCC_CH_24G);
-	CASE_RETURN_STRING(CDS_MCC_CH_5G);
-	CASE_RETURN_STRING(CDS_24G_MCC_CH);
-	CASE_RETURN_STRING(CDS_5G_MCC_CH);
+	CASE_RETURN_STRING(PM_NONE);
+	CASE_RETURN_STRING(PM_24G);
+	CASE_RETURN_STRING(PM_5G);
+	CASE_RETURN_STRING(PM_SCC_CH);
+	CASE_RETURN_STRING(PM_MCC_CH);
+	CASE_RETURN_STRING(PM_SCC_CH_24G);
+	CASE_RETURN_STRING(PM_SCC_CH_5G);
+	CASE_RETURN_STRING(PM_24G_SCC_CH);
+	CASE_RETURN_STRING(PM_5G_SCC_CH);
+	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24_24G);
+	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24_5G);
+	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_24G);
+	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_5G);
+	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24);
+	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5);
+	CASE_RETURN_STRING(PM_MCC_CH_24G);
+	CASE_RETURN_STRING(PM_MCC_CH_5G);
+	CASE_RETURN_STRING(PM_24G_MCC_CH);
+	CASE_RETURN_STRING(PM_5G_MCC_CH);
 	default:
 		return "Unknown";
 	}
@@ -177,7 +177,8 @@ void print_report(hdd_context_t *hdd_ctx)
 void fill_report(hdd_context_t *hdd_ctx, char *title,
 	uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
 	uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
-	bool status, enum cds_pcl_type pcl_type, char *reason, uint8_t *pcl)
+	bool status, enum policy_mgr_pcl_type pcl_type, char *reason,
+	uint8_t *pcl)
 {
 	int i;
 	char buf[4] = {0};
@@ -218,7 +219,8 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 	report[report_idx].status = status;
 	snprintf(report[report_idx].dbs_value,
 		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
-		wma_is_hw_dbs_capable() ? "enable" : "disable");
+		policy_mgr_is_hw_dbs_capable(hdd_ctx->hdd_psoc)
+		? "enable" : "disable");
 	snprintf(report[report_idx].system_conf,
 		MAX_ALLOWED_CHAR_IN_REPORT, "%s",
 		system_config_to_string(hdd_ctx->config->conc_system_pref));
@@ -246,26 +248,26 @@ void fill_report(hdd_context_t *hdd_ctx, char *title,
 }
 
 static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
-	enum cds_pcl_type pcl_type, uint8_t *pcl, uint32_t pcl_len,
+	enum policy_mgr_pcl_type pcl_type, uint8_t *pcl, uint32_t pcl_len,
 	uint8_t first_connection_chnl, uint8_t second_connection_chnl,
 	char *reason, uint32_t reason_length)
 {
 	bool status = true;
 	uint32_t first_idx = 0;
 
-	if ((pcl_type != CDS_NONE) && (pcl_len == 0)) {
+	if ((pcl_type != PM_NONE) && (pcl_len == 0)) {
 		snprintf(reason, reason_length, "no of channels = 0");
 		return false;
 	}
 
 	switch (pcl_type) {
-	case CDS_NONE:
+	case PM_NONE:
 		if (pcl_len != 0) {
 			snprintf(reason, reason_length, "no of channels>0");
 			return false;
 		}
 		break;
-	case CDS_5G:
+	case PM_5G:
 		for (first_idx = 0; first_idx < pcl_len; first_idx++) {
 			if (!CDS_IS_CHANNEL_5GHZ(pcl[first_idx])) {
 				snprintf(reason, reason_length,
@@ -274,7 +276,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			}
 		}
 		break;
-	case CDS_24G:
+	case PM_24G:
 		for (first_idx = 0; first_idx < pcl_len; first_idx++) {
 			if (!CDS_IS_CHANNEL_24GHZ(pcl[first_idx])) {
 				snprintf(reason, reason_length,
@@ -283,7 +285,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			}
 		}
 		break;
-	case CDS_SCC_CH:
+	case PM_SCC_CH:
 		if (second_connection_chnl > 0 &&
 			(first_connection_chnl != second_connection_chnl)) {
 			snprintf(reason, reason_length,
@@ -296,7 +298,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_MCC_CH:
+	case PM_MCC_CH:
 		if ((pcl[0] != first_connection_chnl) &&
 				((second_connection_chnl > 0) &&
 				 (pcl[0] != second_connection_chnl))) {
@@ -312,7 +314,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_CH_24G:
+	case PM_SCC_CH_24G:
 		if (second_connection_chnl > 0 &&
 			(first_connection_chnl != second_connection_chnl)) {
 			snprintf(reason, reason_length,
@@ -330,7 +332,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_CH_5G:
+	case PM_SCC_CH_5G:
 		if (second_connection_chnl > 0 &&
 			(first_connection_chnl != second_connection_chnl)) {
 			snprintf(reason, reason_length,
@@ -348,7 +350,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_24G_SCC_CH:
+	case PM_24G_SCC_CH:
 		if (!CDS_IS_CHANNEL_24GHZ(pcl[0])) {
 			snprintf(reason, reason_length,
 				"No 2.4Ghz chnl");
@@ -366,7 +368,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_5G_SCC_CH:
+	case PM_5G_SCC_CH:
 		if (!CDS_IS_CHANNEL_5GHZ(pcl[0])) {
 			snprintf(reason, reason_length,
 				"No 5Ghz chnl");
@@ -384,7 +386,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_MCC_CH_24G:
+	case PM_MCC_CH_24G:
 		if ((pcl[0] != first_connection_chnl) &&
 			((second_connection_chnl > 0) &&
 			 (pcl[0] != second_connection_chnl))) {
@@ -405,7 +407,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_MCC_CH_5G:
+	case PM_MCC_CH_5G:
 		if ((pcl[0] != first_connection_chnl) &&
 			((second_connection_chnl > 0) &&
 			 (pcl[0] != second_connection_chnl))) {
@@ -426,7 +428,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_24G_MCC_CH:
+	case PM_24G_MCC_CH:
 		if (!CDS_IS_CHANNEL_24GHZ(pcl[0])) {
 			snprintf(reason, reason_length,
 				"No 24Ghz chnl");
@@ -447,7 +449,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_5G_MCC_CH:
+	case PM_5G_MCC_CH:
 		if (!CDS_IS_CHANNEL_5GHZ(pcl[0])) {
 			snprintf(reason, reason_length,
 				"No 5Ghz chnl");
@@ -468,7 +470,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_5_SCC_ON_24_24G:
+	case PM_SCC_ON_5_SCC_ON_24_24G:
 		if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -489,7 +491,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_5_SCC_ON_24_5G:
+	case PM_SCC_ON_5_SCC_ON_24_5G:
 		if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -510,7 +512,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_24_SCC_ON_5_24G:
+	case PM_SCC_ON_24_SCC_ON_5_24G:
 		if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -531,7 +533,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_24_SCC_ON_5_5G:
+	case PM_SCC_ON_24_SCC_ON_5_5G:
 		if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -552,7 +554,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_5_SCC_ON_24:
+	case PM_SCC_ON_5_SCC_ON_24:
 		if (!CDS_IS_CHANNEL_5GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -573,7 +575,7 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 			return false;
 		}
 		break;
-	case CDS_SCC_ON_24_SCC_ON_5:
+	case PM_SCC_ON_24_SCC_ON_5:
 		if (!CDS_IS_CHANNEL_24GHZ(pcl[0]) ||
 			(pcl[0] != first_connection_chnl &&
 			 pcl[0] != second_connection_chnl)) {
@@ -606,15 +608,15 @@ static bool wlan_hdd_validate_pcl(hdd_context_t *hdd_ctx,
 	return status;
 }
 
-static void wlan_hdd_map_subtypes_hdd_wma(enum cds_con_mode *dst,
-		enum cds_con_mode *src)
+static void wlan_hdd_map_subtypes_hdd_wma(enum policy_mgr_con_mode *dst,
+		enum policy_mgr_con_mode *src)
 {
 	/*
 	 * wma defined sap subtype as 0
 	 * Rest of the mappings are same
 	 * In future, if mapping gets changed then re-map it here
 	 */
-	if (*src == CDS_SAP_MODE)
+	if (*src == PM_SAP_MODE)
 		*dst = 0;
 	else
 		*dst = *src;
@@ -622,81 +624,82 @@ static void wlan_hdd_map_subtypes_hdd_wma(enum cds_con_mode *dst,
 
 void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx)
 {
-	enum cds_con_mode sub_type;
-	enum cds_conc_priority_mode system_pref =
+	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;
 	bool status = false;
-	enum cds_pcl_type pcl_type;
+	enum policy_mgr_pcl_type pcl_type;
 	char reason[20] = {0};
 	QDF_STATUS ret;
-	struct cds_sme_cbacks sme_cbacks;
+	struct policy_mgr_sme_cbacks sme_cbacks;
 
 	sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels;
 	sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
 	/* flush the entire table first */
-	ret = cds_init_policy_mgr(&sme_cbacks);
+	ret = policy_mgr_psoc_enable(hdd_ctx->hdd_psoc);
 	if (!QDF_IS_STATUS_SUCCESS(ret)) {
 		hdd_err("Policy manager initialization failed");
 		return;
 	}
 
-	for (sub_type = 0; sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
+	for (sub_type = 0; sub_type < PM_MAX_NUM_OF_MODE; sub_type++) {
 		/* validate one connection is created or no */
-		if (cds_get_connection_count() != 0) {
+		if (policy_mgr_get_connection_count(hdd_ctx->hdd_psoc) != 0) {
 			hdd_err("Test failed - No. of connection is not 0");
 			return;
 		}
 		qdf_mem_zero(pcl, sizeof(pcl));
 		pcl_len = 0;
-		pcl_type = get_pcl_from_first_conn_table(sub_type, system_pref);
+		pcl_type = policy_mgr_get_pcl_from_first_conn_table(
+			sub_type, system_pref);
 
 		/* check PCL value for second connection is correct or no */
-		cds_get_pcl(sub_type, pcl, &pcl_len,
+		policy_mgr_get_pcl(hdd_ctx->hdd_psoc, sub_type, pcl, &pcl_len,
 				weight_list, QDF_ARRAY_SIZE(weight_list));
 		status = wlan_hdd_validate_pcl(hdd_ctx,
 				pcl_type, pcl, pcl_len, 0, 0,
 				reason, sizeof(reason));
-		if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0))
+		if ((pcl_type == PM_MAX_PCL_TYPE) && (pcl[0] == 0))
 			continue;
 
 		fill_report(hdd_ctx, "1 connection", sub_type,
-				CDS_MAX_NUM_OF_MODE,
-				CDS_MAX_NUM_OF_MODE,
+				PM_MAX_NUM_OF_MODE,
+				PM_MAX_NUM_OF_MODE,
 				0, 0, 0,
 				status, pcl_type, reason, pcl);
 	}
 }
 
 void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
-		uint8_t first_chnl, enum cds_chain_mode first_chain_mask)
+		uint8_t first_chnl, enum policy_mgr_chain_mode first_chain_mask)
 {
 	uint8_t vdevid = 0, tx_stream = 2, rx_stream = 2;
 	uint8_t type = WMI_VDEV_TYPE_STA, channel_id = first_chnl, mac_id = 1;
 	uint8_t pcl[QDF_MAX_NUM_CHAN] = {0},
 			weight_list[QDF_MAX_NUM_CHAN] = {0};
 	uint32_t pcl_len = 0;
-	enum cds_chain_mode chain_mask = first_chain_mask;
-	enum cds_con_mode sub_type, next_sub_type, dummy_type;
-	enum cds_conc_priority_mode system_pref =
+	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 cds_pcl_type pcl_type;
-	enum cds_one_connection_mode second_index;
+	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 cds_sme_cbacks sme_cbacks;
+	struct policy_mgr_sme_cbacks sme_cbacks;
 
-	for (sub_type = CDS_STA_MODE;
-		sub_type < CDS_MAX_NUM_OF_MODE; sub_type++) {
+	for (sub_type = PM_STA_MODE;
+		sub_type < PM_MAX_NUM_OF_MODE; sub_type++) {
 		type = wlan_hdd_valid_type_of_persona(sub_type);
 
 		sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels;
 		sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
 		/* flush the entire table first */
-		ret = cds_init_policy_mgr(&sme_cbacks);
+		ret = policy_mgr_psoc_enable(hdd_ctx->hdd_psoc);
 		if (!QDF_IS_STATUS_SUCCESS(ret)) {
 			hdd_err("Policy manager initialization failed");
 			return;
@@ -705,20 +708,22 @@ void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
 		/* sub_type mapping between HDD and WMA are different */
 		wlan_hdd_map_subtypes_hdd_wma(&dummy_type, &sub_type);
 		/* add first connection as STA */
-		cds_incr_connection_count_utfw(vdevid, tx_stream,
+		policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
+				vdevid, tx_stream,
 				rx_stream, chain_mask, type, dummy_type,
 				channel_id, mac_id);
 		/* validate one connection is created or no */
-		if (cds_get_connection_count() != 1) {
+		if (policy_mgr_get_connection_count(hdd_ctx->hdd_psoc) != 1) {
 			hdd_err("Test failed - No. of connection is not 1");
 			return;
 		}
-		next_sub_type = CDS_STA_MODE;
-		while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
+		next_sub_type = PM_STA_MODE;
+		while (next_sub_type < PM_MAX_NUM_OF_MODE) {
 			/* get the PCL value & check the channels accordingly */
 			second_index =
-				cds_get_second_connection_pcl_table_index();
-			if (CDS_MAX_ONE_CONNECTION_MODE == second_index) {
+			policy_mgr_get_second_connection_pcl_table_index(
+				hdd_ctx->hdd_psoc);
+			if (PM_MAX_ONE_CONNECTION_MODE == second_index) {
 				/* not valid combination*/
 				hdd_err("couldn't find index for 2nd connection pcl table");
 				next_sub_type++;
@@ -726,22 +731,23 @@ void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
 			}
 			qdf_mem_zero(pcl, sizeof(pcl));
 			pcl_len = 0;
-			pcl_type = get_pcl_from_second_conn_table(second_index,
-					next_sub_type, system_pref,
-					wma_is_hw_dbs_capable());
+			pcl_type = policy_mgr_get_pcl_from_second_conn_table(
+				second_index, next_sub_type, system_pref,
+				policy_mgr_is_hw_dbs_capable(hdd_ctx->hdd_psoc));
 			/* check PCL for second connection is correct or no */
-			cds_get_pcl(next_sub_type, pcl, &pcl_len,
+			policy_mgr_get_pcl(hdd_ctx->hdd_psoc,
+				next_sub_type, pcl, &pcl_len,
 				weight_list, QDF_ARRAY_SIZE(weight_list));
 			status = wlan_hdd_validate_pcl(hdd_ctx,
 					pcl_type, pcl, pcl_len, channel_id, 0,
 					reason, sizeof(reason));
-			if ((pcl_type == CDS_MAX_PCL_TYPE) && (pcl[0] == 0)) {
+			if ((pcl_type == PM_MAX_PCL_TYPE) && (pcl[0] == 0)) {
 				next_sub_type++;
 				continue;
 			}
 			fill_report(hdd_ctx, "2 connections", sub_type,
 					next_sub_type,
-					CDS_MAX_NUM_OF_MODE, first_chnl,
+					PM_MAX_NUM_OF_MODE, first_chnl,
 					0, 0, status, pcl_type, reason, pcl);
 			next_sub_type++;
 		}
@@ -750,7 +756,7 @@ void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
 
 void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 		uint8_t first_chnl, uint8_t second_chnl,
-		enum cds_chain_mode chain_mask, uint8_t use_same_mac)
+		enum policy_mgr_chain_mode chain_mask, uint8_t use_same_mac)
 {
 	uint8_t vdevid_1 = 0, tx_stream_1 = 2, rx_stream_1 = 2;
 	uint8_t vdevid_2 = 1, tx_stream_2 = 2, rx_stream_2 = 2;
@@ -759,46 +765,46 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 	uint8_t type_1 = WMI_VDEV_TYPE_STA, type_2 = WMI_VDEV_TYPE_STA;
 	uint8_t pcl[MAX_NUM_CHAN] = {0}, weight_list[MAX_NUM_CHAN] = {0};
 	uint32_t pcl_len = 0;
-	enum cds_chain_mode chain_mask_1;
-	enum cds_chain_mode chain_mask_2;
-	enum cds_con_mode sub_type_1, sub_type_2, next_sub_type;
-	enum cds_con_mode dummy_type_1, dummy_type_2;
-	enum cds_conc_priority_mode system_pref =
+	enum policy_mgr_chain_mode chain_mask_1;
+	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 cds_pcl_type pcl_type;
-	enum cds_two_connection_mode third_index;
+	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 cds_sme_cbacks sme_cbacks;
+	struct policy_mgr_sme_cbacks sme_cbacks;
 
 	/* let's set the chain_mask, mac_ids*/
-	if (chain_mask == CDS_TWO_TWO) {
+	if (chain_mask == POLICY_MGR_TWO_TWO) {
 		mac_id_1 = 1;
 		mac_id_2 = 1;
-		chain_mask_1 = CDS_TWO_TWO;
-		chain_mask_2 = CDS_TWO_TWO;
+		chain_mask_1 = POLICY_MGR_TWO_TWO;
+		chain_mask_2 = POLICY_MGR_TWO_TWO;
 	} else if (use_same_mac == 1) {
 		mac_id_1 = 1;
 		mac_id_2 = 1;
-		chain_mask_1 = CDS_ONE_ONE;
-		chain_mask_2 = CDS_ONE_ONE;
+		chain_mask_1 = POLICY_MGR_ONE_ONE;
+		chain_mask_2 = POLICY_MGR_ONE_ONE;
 	} else {
 		mac_id_1 = 1;
 		mac_id_2 = 2;
-		chain_mask_1 = CDS_ONE_ONE;
-		chain_mask_2 = CDS_ONE_ONE;
+		chain_mask_1 = POLICY_MGR_ONE_ONE;
+		chain_mask_2 = POLICY_MGR_ONE_ONE;
 	}
 
-	for (sub_type_1 = CDS_STA_MODE;
-		sub_type_1 < CDS_MAX_NUM_OF_MODE; sub_type_1++) {
+	for (sub_type_1 = PM_STA_MODE;
+		sub_type_1 < PM_MAX_NUM_OF_MODE; sub_type_1++) {
 
 		type_1 = wlan_hdd_valid_type_of_persona(sub_type_1);
 
 		sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels;
 		sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
 		/* flush the entire table first */
-		ret = cds_init_policy_mgr(&sme_cbacks);
+		ret = policy_mgr_psoc_enable(hdd_ctx->hdd_psoc);
 		if (!QDF_IS_STATUS_SUCCESS(ret)) {
 			hdd_err("Policy manager initialization failed");
 			return;
@@ -807,34 +813,37 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 		/* sub_type mapping between HDD and WMA are different */
 		wlan_hdd_map_subtypes_hdd_wma(&dummy_type_1, &sub_type_1);
 		/* add first connection as STA */
-		cds_incr_connection_count_utfw(vdevid_1,
-			tx_stream_1, rx_stream_1, chain_mask_1, type_1,
-			dummy_type_1, channel_id_1, mac_id_1);
+		policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
+			vdevid_1, tx_stream_1, rx_stream_1, chain_mask_1,
+			type_1,	dummy_type_1, channel_id_1, mac_id_1);
 		/* validate one connection is created or no */
-		if (cds_get_connection_count() != 1) {
+		if (policy_mgr_get_connection_count(hdd_ctx->hdd_psoc) != 1) {
 			hdd_err("Test fail - No. of connection not 1");
 			return;
 		}
-		for (sub_type_2 = CDS_STA_MODE;
-			sub_type_2 < CDS_MAX_NUM_OF_MODE; sub_type_2++) {
+		for (sub_type_2 = PM_STA_MODE;
+			sub_type_2 < PM_MAX_NUM_OF_MODE; sub_type_2++) {
 
 			type_2 = wlan_hdd_valid_type_of_persona(sub_type_2);
 			/* sub_type mapping between HDD and WMA are different */
 			wlan_hdd_map_subtypes_hdd_wma(&dummy_type_2,
 					&sub_type_2);
-			cds_incr_connection_count_utfw(vdevid_2,
-				tx_stream_2, rx_stream_2, chain_mask_2, type_2,
+			policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
+				vdevid_2, tx_stream_2, rx_stream_2,
+				chain_mask_2, type_2,
 				dummy_type_2, channel_id_2, mac_id_2);
 			/* validate two connections are created or no */
-			if (cds_get_connection_count() != 2) {
+			if (policy_mgr_get_connection_count(hdd_ctx->hdd_psoc)
+				!= 2) {
 				hdd_err("Test fail - No. connection not 2");
 				return;
 			}
-			next_sub_type = CDS_STA_MODE;
-			while (next_sub_type < CDS_MAX_NUM_OF_MODE) {
+			next_sub_type = PM_STA_MODE;
+			while (next_sub_type < PM_MAX_NUM_OF_MODE) {
 				third_index =
-				  cds_get_third_connection_pcl_table_index();
-				if (CDS_MAX_TWO_CONNECTION_MODE ==
+				policy_mgr_get_third_connection_pcl_table_index(
+						hdd_ctx->hdd_psoc);
+				if (PM_MAX_TWO_CONNECTION_MODE ==
 						third_index) {
 					/* not valid combination */
 					next_sub_type++;
@@ -843,19 +852,21 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 				qdf_mem_zero(pcl, sizeof(pcl));
 				pcl_len = 0;
 				pcl_type =
-					get_pcl_from_third_conn_table(
-					   third_index, next_sub_type,
-					   system_pref,
-					   wma_is_hw_dbs_capable());
-				cds_get_pcl(next_sub_type,
-						pcl, &pcl_len,
-						weight_list,
-						QDF_ARRAY_SIZE(weight_list));
+				policy_mgr_get_pcl_from_third_conn_table(
+					third_index, next_sub_type,
+					system_pref,
+					policy_mgr_is_hw_dbs_capable(
+					hdd_ctx->hdd_psoc));
+				policy_mgr_get_pcl(hdd_ctx->hdd_psoc,
+					next_sub_type,
+					pcl, &pcl_len,
+					weight_list,
+					QDF_ARRAY_SIZE(weight_list));
 				status = wlan_hdd_validate_pcl(hdd_ctx,
-						pcl_type, pcl, pcl_len,
-						channel_id_1, channel_id_2,
-						reason, sizeof(reason));
-				if ((pcl_type == CDS_MAX_PCL_TYPE) &&
+					pcl_type, pcl, pcl_len,
+					channel_id_1, channel_id_2,
+					reason, sizeof(reason));
+				if ((pcl_type == PM_MAX_PCL_TYPE) &&
 					(pcl[0] == 0)) {
 					next_sub_type++;
 					continue;
@@ -868,8 +879,9 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 				next_sub_type++;
 			}
 			/* remove entry to make a room for next iteration */
-			cds_decr_connection_count(vdevid_2);
+			policy_mgr_decr_connection_count(hdd_ctx->hdd_psoc,
+				vdevid_2);
 		}
-		next_sub_type = CDS_STA_MODE;
+		next_sub_type = PM_STA_MODE;
 	}
 }

+ 1 - 1
core/hdd/src/wlan_hdd_driver_ops.c

@@ -40,7 +40,7 @@
 #include "wlan_logging_sock_svc.h"
 #include "wma_api.h"
 #include "wlan_hdd_napi.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 #include "qwlan_version.h"
 #include "bmi.h"
 #include "cdp_txrx_bus.h"

+ 2 - 2
core/hdd/src/wlan_hdd_green_ap.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,7 +31,7 @@
 #include <wlan_hdd_misc.h>
 #include "wlan_hdd_green_ap.h"
 #include "wma_api.h"
-#include "cds_concurrency.h"
+#include "wlan_policy_mgr_api.h"
 
 #define GREEN_AP_PS_ON_TIME        (0)
 #define GREEN_AP_PS_DELAY_TIME     (20)