Переглянути джерело

qcacld-3.0: Fix chain mask & nss in policy manager connection table

The chain mask in policy manager connection table needs to be updated
with the capability that HW advertises at load time intersected with
related ini configuration on host. The dynamic change of the chain
mask & NSS values will be handled only by chain mask manager in
firmware.

Change-Id: I250668c93920a63c9278aefe93491cb5aaa91ca7
CRs-Fixed: 1037816
Tushnim Bhattacharyya 8 роки тому
батько
коміт
f44a9d86cd

+ 13 - 0
core/cds/inc/cds_api.h

@@ -73,6 +73,19 @@ enum cds_driver_state {
 
 #define __CDS_IS_DRIVER_STATE(_state, _mask) (((_state) & (_mask)) == (_mask))
 
+/**
+ * struct cds_sme_cbacks - list of sme functions registered with
+ * CDS
+ * @sme_get_valid_channels: gets the valid channel list for
+ *  				   current reg domain
+ * @sme_get_nss_for_vdev: gets the nss allowed for the vdev type
+ */
+struct cds_sme_cbacks {
+	QDF_STATUS (*sme_get_valid_channels)(void*, uint8_t *, uint32_t *);
+	void (*sme_get_nss_for_vdev)(void*, enum tQDF_ADAPTER_MODE,
+		uint8_t *, uint8_t *);
+};
+
 void cds_set_driver_state(enum cds_driver_state);
 void cds_clear_driver_state(enum cds_driver_state);
 enum cds_driver_state cds_get_driver_state(void);

+ 4 - 6
core/cds/inc/cds_concurrency.h

@@ -532,8 +532,7 @@ enum cds_band {
  * @chan: channel of the connection
  * @bw: channel bandwidth used for the connection
  * @mac: The HW mac it is running
- * @tx_spatial_stream: Tx spatial stream used by the connection
- * @rx_spatial_stream: Tx spatial stream used by the connection
+ * @chain_mask: The original capability advertised by HW
  * @original_nss: nss negotiated at connection time
  * @vdev_id: vdev id of the connection
  * @in_use: if the table entry is active
@@ -544,8 +543,6 @@ struct cds_conc_connection_info {
 	enum hw_mode_bandwidth bw;
 	uint8_t       mac;
 	enum cds_chain_mode chain_mask;
-	uint8_t       tx_spatial_stream;
-	uint8_t       rx_spatial_stream;
 	uint32_t      original_nss;
 	uint32_t      vdev_id;
 	bool          in_use;
@@ -651,8 +648,7 @@ void cds_decr_active_session(enum tQDF_ADAPTER_MODE mode,
 				uint8_t sessionId);
 void cds_decr_session_set_pcl(enum tQDF_ADAPTER_MODE mode,
 		uint8_t session_id);
-QDF_STATUS cds_init_policy_mgr(
-	QDF_STATUS (*sme_get_valid_chans)(void*, uint8_t *, uint32_t *));
+QDF_STATUS cds_init_policy_mgr(struct cds_sme_cbacks *sme_cbacks);
 QDF_STATUS cds_deinit_policy_mgr(void);
 QDF_STATUS cds_get_pcl(enum cds_con_mode mode,
 			uint8_t *pcl_channels, uint32_t *len,
@@ -768,6 +764,8 @@ QDF_STATUS cds_update_and_wait_for_connection_update(uint8_t session_id,
 bool cds_is_sap_mandatory_channel_set(void);
 bool cds_list_has_24GHz_channel(uint8_t *channel_list, uint32_t list_len);
 QDF_STATUS cds_get_valid_chans(uint8_t *chan_list, uint32_t *list_len);
+QDF_STATUS cds_get_nss_for_vdev(enum cds_con_mode mode,
+		uint8_t *nss_2g, uint8_t *nss_5g);
 QDF_STATUS cds_get_sap_mandatory_channel(uint32_t *chan);
 QDF_STATUS cds_set_sap_mandatory_channels(uint8_t *channels, uint32_t len);
 QDF_STATUS cds_reset_sap_mandatory_channels(void);

+ 4 - 1
core/cds/inc/cds_sched.h

@@ -305,7 +305,10 @@ typedef struct _cds_context_type {
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 	void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t);
 #endif
-	QDF_STATUS (*sme_get_valid_chans)(void*, uint8_t *, uint32_t *);
+	QDF_STATUS (*sme_get_valid_channels)(void*, uint8_t *, uint32_t *);
+	void (*sme_get_nss_for_vdev)(void*, enum tQDF_ADAPTER_MODE,
+		uint8_t *, uint8_t *);
+
 	/* This list is not sessionized. This mandatory channel list would be
 	 * as per OEMs preference as per the regulatory/other considerations.
 	 * So, this would remain same for all the interfaces.

+ 130 - 69
core/cds/src/cds_concurrency.c

@@ -2091,8 +2091,6 @@ bool cds_set_connection_in_progress(bool value)
  * @bw: Bandwidth
  * @mac: Mac id
  * @chain_mask: Chain mask
- * @tx_spatial_stream: Tx spatial stream
- * @rx_spatial_stream: Rx spatial stream
  * @vdev_id: vdev id
  * @in_use: Flag to indicate if the index is in use or not
  *
@@ -2106,8 +2104,6 @@ static void cds_update_conc_list(uint32_t conn_index,
 		enum hw_mode_bandwidth bw,
 		uint8_t mac,
 		enum cds_chain_mode chain_mask,
-		uint8_t tx_spatial_stream,
-		uint8_t rx_spatial_stream,
 		uint32_t original_nss,
 		uint32_t vdev_id,
 		bool in_use)
@@ -2122,8 +2118,6 @@ static void cds_update_conc_list(uint32_t conn_index,
 	conc_connection_list[conn_index].bw = bw;
 	conc_connection_list[conn_index].mac = mac;
 	conc_connection_list[conn_index].chain_mask = chain_mask;
-	conc_connection_list[conn_index].tx_spatial_stream = tx_spatial_stream;
-	conc_connection_list[conn_index].rx_spatial_stream = rx_spatial_stream;
 	conc_connection_list[conn_index].original_nss = original_nss;
 	conc_connection_list[conn_index].vdev_id = vdev_id;
 	conc_connection_list[conn_index].in_use = in_use;
@@ -2265,22 +2259,9 @@ static void cds_update_hw_mode_conn_info(uint32_t num_vdev_mac_entries,
 		if (found) {
 			conc_connection_list[conn_index].mac =
 				vdev_mac_map[i].mac_id;
-			if (vdev_mac_map[i].mac_id == 0) {
-				conc_connection_list[conn_index].
-					tx_spatial_stream = hw_mode.mac0_tx_ss;
-				conc_connection_list[conn_index].
-					rx_spatial_stream = hw_mode.mac0_rx_ss;
-			} else {
-				conc_connection_list[conn_index].
-					tx_spatial_stream = hw_mode.mac1_tx_ss;
-				conc_connection_list[conn_index].
-					rx_spatial_stream = hw_mode.mac1_rx_ss;
-			}
-			cds_info("vdev:%d, mac:%d, tx ss:%d, rx ss;%d",
+			cds_info("vdev:%d, mac:%d",
 			  conc_connection_list[conn_index].vdev_id,
-			  conc_connection_list[conn_index].mac,
-			  conc_connection_list[conn_index].tx_spatial_stream,
-			  conc_connection_list[conn_index].rx_spatial_stream);
+			  conc_connection_list[conn_index].mac);
 		}
 	}
 	cds_dump_connection_status_info();
@@ -3886,7 +3867,8 @@ QDF_STATUS cds_deinit_policy_mgr(void)
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	cds_ctx->sme_get_valid_chans = NULL;
+	cds_ctx->sme_get_valid_channels = NULL;
+	cds_ctx->sme_get_nss_for_vdev = NULL;
 
 	if (QDF_IS_STATUS_ERROR(cds_reset_sap_mandatory_channels())) {
 		cds_err("failed to reset sap mandatory channels");
@@ -3904,8 +3886,7 @@ QDF_STATUS cds_deinit_policy_mgr(void)
  *
  * Return: Success if the policy manager is initialized completely
  */
-QDF_STATUS cds_init_policy_mgr(
-	QDF_STATUS (*sme_get_valid_chans)(void*, uint8_t *, uint32_t *))
+QDF_STATUS cds_init_policy_mgr(struct cds_sme_cbacks *sme_cbacks)
 {
 	QDF_STATUS status;
 	hdd_context_t *hdd_ctx;
@@ -3953,7 +3934,8 @@ QDF_STATUS cds_init_policy_mgr(
 	}
 
 	cds_ctx->do_hw_mode_change = false;
-	cds_ctx->sme_get_valid_chans = sme_get_valid_chans;
+	cds_ctx->sme_get_valid_channels = sme_cbacks->sme_get_valid_channels;
+	cds_ctx->sme_get_nss_for_vdev = sme_cbacks->sme_get_nss_for_vdev;
 
 	status = cds_reset_sap_mandatory_channels();
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -4117,6 +4099,11 @@ QDF_STATUS cds_incr_connection_count(uint32_t vdev_id)
 	struct wma_txrx_node *wma_conn_table_entry;
 	hdd_context_t *hdd_ctx;
 	cds_context_type *cds_ctx;
+	enum cds_chain_mode chain_mask = CDS_ONE_ONE;
+	uint8_t nss_2g, nss_5g;
+	enum cds_con_mode mode;
+	uint8_t chan;
+	uint32_t nss = 0;
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -4143,23 +4130,32 @@ QDF_STATUS cds_incr_connection_count(uint32_t vdev_id)
 		cds_err("can't find vdev_id %d in WMA table", vdev_id);
 		return status;
 	}
+	mode = cds_get_mode(wma_conn_table_entry->type,
+					wma_conn_table_entry->sub_type);
+	chan = cds_freq_to_chan(wma_conn_table_entry->mhz);
+	status = cds_get_nss_for_vdev(mode, &nss_2g, &nss_5g);
+	if (QDF_IS_STATUS_SUCCESS(status)) {
+		if ((CDS_IS_CHANNEL_24GHZ(chan) && (nss_2g > 1)) ||
+			(CDS_IS_CHANNEL_5GHZ(chan) && (nss_5g > 1)))
+			chain_mask = CDS_TWO_TWO;
+		else
+			chain_mask = CDS_ONE_ONE;
+		nss = (CDS_IS_CHANNEL_24GHZ(chan)) ? nss_2g : nss_5g;
+	} else {
+		cds_err("Error in getting nss");
+	}
+
 
 	/* add the entry */
 	cds_update_conc_list(conn_index,
-			cds_get_mode(wma_conn_table_entry->type,
-					wma_conn_table_entry->sub_type),
-			cds_freq_to_chan(wma_conn_table_entry->mhz),
+			mode,
+			chan,
 			cds_get_bw(wma_conn_table_entry->chan_width),
 			wma_conn_table_entry->mac_id,
-			wma_conn_table_entry->chain_mask,
-			wma_conn_table_entry->tx_streams,
-			wma_conn_table_entry->rx_streams,
-			wma_conn_table_entry->nss, vdev_id, true);
-	cds_info("Add at idx:%d vdev %d tx ss=%d rx ss=%d chainmask=%d mac=%d",
+			chain_mask,
+			nss, vdev_id, true);
+	cds_info("Add at idx:%d vdev %d mac=%d",
 		conn_index, vdev_id,
-		wma_conn_table_entry->tx_streams,
-		wma_conn_table_entry->rx_streams,
-		wma_conn_table_entry->chain_mask,
 		wma_conn_table_entry->mac_id);
 
 	return QDF_STATUS_SUCCESS;
@@ -4183,6 +4179,11 @@ QDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 	bool found = false;
 	struct wma_txrx_node *wma_conn_table_entry;
 	cds_context_type *cds_ctx;
+	enum cds_chain_mode chain_mask = CDS_ONE_ONE;
+	uint8_t nss_2g, nss_5g;
+	enum cds_con_mode mode;
+	uint8_t chan;
+	uint32_t nss = 0;
 
 	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
 	if (!cds_ctx) {
@@ -4215,20 +4216,31 @@ QDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 		cds_err("can't find vdev_id %d in WMA table", vdev_id);
 		return status;
 	}
+	mode = cds_get_mode(wma_conn_table_entry->type,
+					wma_conn_table_entry->sub_type);
+	chan = cds_freq_to_chan(wma_conn_table_entry->mhz);
+	status = cds_get_nss_for_vdev(mode, &nss_2g, &nss_5g);
+	if (QDF_IS_STATUS_SUCCESS(status)) {
+		if ((CDS_IS_CHANNEL_24GHZ(chan) && (nss_2g > 1)) ||
+			(CDS_IS_CHANNEL_5GHZ(chan) && (nss_5g > 1)))
+			chain_mask = CDS_TWO_TWO;
+		else
+			chain_mask = CDS_ONE_ONE;
+		nss = (CDS_IS_CHANNEL_24GHZ(chan)) ? nss_2g : nss_5g;
+	} else {
+		cds_err("Error in getting nss");
+	}
 
 	cds_debug("update PM connection table for vdev:%d", vdev_id);
 
 	/* add the entry */
 	cds_update_conc_list(conn_index,
-			cds_get_mode(wma_conn_table_entry->type,
-					wma_conn_table_entry->sub_type),
-			cds_freq_to_chan(wma_conn_table_entry->mhz),
+			mode,
+			chan,
 			cds_get_bw(wma_conn_table_entry->chan_width),
 			wma_conn_table_entry->mac_id,
-			wma_conn_table_entry->chain_mask,
-			wma_conn_table_entry->tx_streams,
-			wma_conn_table_entry->rx_streams,
-			wma_conn_table_entry->nss, vdev_id, true);
+			chain_mask,
+			nss, vdev_id, true);
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 	return QDF_STATUS_SUCCESS;
 }
@@ -4267,10 +4279,6 @@ QDF_STATUS cds_decr_connection_count(uint32_t vdev_id)
 	while (CONC_CONNECTION_LIST_VALID_INDEX(next_conn_index)) {
 		conc_connection_list[conn_index].vdev_id =
 			conc_connection_list[next_conn_index].vdev_id;
-		conc_connection_list[conn_index].tx_spatial_stream =
-			conc_connection_list[next_conn_index].tx_spatial_stream;
-		conc_connection_list[conn_index].rx_spatial_stream =
-			conc_connection_list[next_conn_index].rx_spatial_stream;
 		conc_connection_list[conn_index].mode =
 			conc_connection_list[next_conn_index].mode;
 		conc_connection_list[conn_index].mac =
@@ -5993,11 +6001,9 @@ bool cds_wait_for_nss_update(uint8_t action)
 			conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
 			conn_index++) {
 			if ((conc_connection_list
-				[conn_index].original_nss == 1) &&
+				[conn_index].original_nss == 2) &&
 				(conc_connection_list
-				[conn_index].tx_spatial_stream == 2) &&
-				(conc_connection_list
-				[conn_index].rx_spatial_stream == 2) &&
+				[conn_index].chain_mask == CDS_TWO_TWO) &&
 				conc_connection_list[conn_index].in_use &&
 				((conc_connection_list[conn_index].mode ==
 				CDS_P2P_GO_MODE) ||
@@ -6012,11 +6018,9 @@ bool cds_wait_for_nss_update(uint8_t action)
 			conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
 			conn_index++) {
 			if ((conc_connection_list
-				[conn_index].original_nss == 1) &&
-				(conc_connection_list
-				[conn_index].tx_spatial_stream == 1) &&
+				[conn_index].original_nss == 2) &&
 				(conc_connection_list
-				[conn_index].rx_spatial_stream == 1) &&
+				[conn_index].chain_mask == CDS_TWO_TWO) &&
 				conc_connection_list[conn_index].in_use &&
 				((conc_connection_list[conn_index].mode ==
 				CDS_P2P_GO_MODE) ||
@@ -6077,13 +6081,9 @@ void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 	}
 	switch (next_action) {
 	case CDS_DBS:
-		conc_connection_list[conn_index].tx_spatial_stream = 1;
-		conc_connection_list[conn_index].rx_spatial_stream = 1;
 		wait = cds_wait_for_nss_update(next_action);
 		break;
 	case CDS_SINGLE_MAC:
-		conc_connection_list[conn_index].tx_spatial_stream = 2;
-		conc_connection_list[conn_index].rx_spatial_stream = 2;
 		wait = cds_wait_for_nss_update(next_action);
 		break;
 	default:
@@ -7708,8 +7708,7 @@ QDF_STATUS cds_update_connection_info_utfw(
 	cds_update_conc_list(conn_index,
 			cds_get_mode(type, sub_type),
 			channelid, HW_MODE_20_MHZ,
-			mac_id, chain_mask, tx_streams,
-			rx_streams, 0, vdev_id, true);
+			mac_id, chain_mask, 0, vdev_id, true);
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 
 	return QDF_STATUS_SUCCESS;
@@ -7751,8 +7750,7 @@ QDF_STATUS cds_incr_connection_count_utfw(
 	cds_update_conc_list(conn_index,
 				cds_get_mode(type, sub_type),
 				channelid, HW_MODE_20_MHZ,
-				mac_id, chain_mask, tx_streams,
-				rx_streams, 0, vdev_id, true);
+				mac_id, chain_mask, 0, vdev_id, true);
 	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
 
 	return QDF_STATUS_SUCCESS;
@@ -7763,6 +7761,7 @@ QDF_STATUS cds_decr_connection_count_utfw(uint32_t del_all,
 {
 	QDF_STATUS status;
 	cds_context_type *cds_ctx;
+	struct cds_sme_cbacks sme_cbacks;
 
 	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
 	if (!cds_ctx) {
@@ -7770,8 +7769,10 @@ QDF_STATUS cds_decr_connection_count_utfw(uint32_t del_all,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels;
+	sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
 	if (del_all) {
-		status = cds_init_policy_mgr(sme_get_cfg_valid_channels);
+		status = cds_init_policy_mgr(&sme_cbacks);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
 			cds_err("Policy manager initialization failed");
 			return QDF_STATUS_E_FAILURE;
@@ -8391,13 +8392,13 @@ QDF_STATUS cds_get_valid_chans(uint8_t *chan_list, uint32_t *list_len)
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!cds_ctx->sme_get_valid_chans) {
+	if (!cds_ctx->sme_get_valid_channels) {
 		cds_err("sme_get_valid_chans callback is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	*list_len = QDF_MAX_NUM_CHAN;
-	status = cds_ctx->sme_get_valid_chans(hdd_ctx->hHal,
+	status = cds_ctx->sme_get_valid_channels(hdd_ctx->hHal,
 					chan_list, list_len);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		cds_err("Error in getting valid channels");
@@ -8408,6 +8409,68 @@ QDF_STATUS cds_get_valid_chans(uint8_t *chan_list, uint32_t *list_len)
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * cds_get_nss_for_vdev() - Get the allowed nss value for the
+ * vdev
+ * @dev_mode: connection type.
+ * @nss2g: Pointer to the 2G Nss parameter.
+ * @nss5g: Pointer to the 5G Nss parameter.
+ *
+ * Fills the 2G and 5G Nss values based on connection type.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cds_get_nss_for_vdev(enum cds_con_mode mode,
+		uint8_t *nss_2g, uint8_t *nss_5g)
+{
+	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
+	enum tQDF_ADAPTER_MODE dev_mode;
+
+	switch (mode) {
+	case CDS_STA_MODE:
+		dev_mode = QDF_STA_MODE;
+		break;
+	case CDS_SAP_MODE:
+		dev_mode = QDF_SAP_MODE;
+		break;
+	case CDS_P2P_CLIENT_MODE:
+		dev_mode = QDF_P2P_CLIENT_MODE;
+		break;
+	case CDS_P2P_GO_MODE:
+		dev_mode = QDF_P2P_GO_MODE;
+		break;
+	case CDS_IBSS_MODE:
+		dev_mode = QDF_IBSS_MODE;
+		break;
+	default:
+		cds_err("Invalid mode to get allowed NSS value");
+		return QDF_STATUS_E_FAILURE;
+	};
+
+	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	if (!hdd_ctx) {
+		cds_err("HDD context is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!cds_ctx->sme_get_nss_for_vdev) {
+		cds_err("sme_get_nss_for_vdev callback is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cds_ctx->sme_get_nss_for_vdev(hdd_ctx->hHal,
+					dev_mode, nss_2g, nss_5g);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * cds_list_has_24GHz_channel() - Check if list contains 2.4GHz channels
  * @channel_list: Channel list
@@ -8774,11 +8837,9 @@ void cds_dump_connection_status_info(void)
 	}
 
 	for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) {
-		cds_debug("%d: use:%d vdev:%d tx:%d rx:%d mode:%d mac:%d chan:%d chainmask:%d orig nss:%d bw:%d",
+		cds_debug("%d: use:%d vdev:%d mode:%d mac:%d chan:%d orig chainmask:%d orig nss:%d bw:%d",
 				i, conc_connection_list[i].in_use,
 				conc_connection_list[i].vdev_id,
-				conc_connection_list[i].tx_spatial_stream,
-				conc_connection_list[i].rx_spatial_stream,
 				conc_connection_list[i].mode,
 				conc_connection_list[i].mac,
 				conc_connection_list[i].chan,

+ 13 - 3
core/hdd/src/wlan_hdd_conc_ut.c

@@ -632,9 +632,12 @@ void wlan_hdd_one_connection_scenario(hdd_context_t *hdd_ctx)
 	enum cds_pcl_type pcl_type;
 	char reason[20] = {0};
 	QDF_STATUS ret;
+	struct cds_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_get_cfg_valid_channels);
+	ret = cds_init_policy_mgr(&sme_cbacks);
 	if (!QDF_IS_STATUS_SUCCESS(ret)) {
 		hdd_err("Policy manager initialization failed");
 		return;
@@ -685,13 +688,16 @@ void wlan_hdd_two_connections_scenario(hdd_context_t *hdd_ctx,
 	char reason[20] = {0};
 	bool status = false;
 	QDF_STATUS ret;
+	struct cds_sme_cbacks sme_cbacks;
 
 	for (sub_type = CDS_STA_MODE;
 		sub_type < CDS_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_get_cfg_valid_channels);
+		ret = cds_init_policy_mgr(&sme_cbacks);
 		if (!QDF_IS_STATUS_SUCCESS(ret)) {
 			hdd_err("Policy manager initialization failed");
 			return;
@@ -766,6 +772,7 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 	char reason[20] = {0};
 	bool status = false;
 	QDF_STATUS ret;
+	struct cds_sme_cbacks sme_cbacks;
 
 	/* let's set the chain_mask, mac_ids*/
 	if (chain_mask == CDS_TWO_TWO) {
@@ -789,8 +796,11 @@ void wlan_hdd_three_connections_scenario(hdd_context_t *hdd_ctx,
 		sub_type_1 < CDS_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_get_cfg_valid_channels);
+		ret = cds_init_policy_mgr(&sme_cbacks);
 		if (!QDF_IS_STATUS_SUCCESS(ret)) {
 			hdd_err("Policy manager initialization failed");
 			return;

+ 8 - 3
core/hdd/src/wlan_hdd_main.c

@@ -1376,11 +1376,12 @@ void hdd_update_tgt_cfg(void *context, void *param)
 	hdd_ctx->ap_arpns_support = cfg->ap_arpns_support;
 	hdd_update_tgt_services(hdd_ctx, &cfg->services);
 
-	hdd_update_vdev_nss(hdd_ctx);
-
 	hdd_update_tgt_ht_cap(hdd_ctx, &cfg->ht_cap);
 
 	hdd_update_tgt_vht_cap(hdd_ctx, &cfg->vht_cap);
+
+	hdd_update_vdev_nss(hdd_ctx);
+
 	hdd_ctx->config->fine_time_meas_cap &= cfg->fine_time_measurement_cap;
 	hdd_ctx->fine_time_meas_cap_target = cfg->fine_time_measurement_cap;
 	hdd_info(FL("fine_time_meas_cap: 0x%x"),
@@ -6558,6 +6559,8 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc)
 	int ret;
 	tSirTxPowerLimit hddtxlimit;
 	bool rtnl_held;
+	/* structure of function pointers to be used by CDS */
+	struct cds_sme_cbacks sme_cbacks;
 
 	ENTER();
 
@@ -6710,7 +6713,9 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc)
 #endif
 
 	wlan_hdd_nan_init(hdd_ctx);
-	status = cds_init_policy_mgr(sme_get_cfg_valid_channels);
+	sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels;
+	sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
+	status = cds_init_policy_mgr(&sme_cbacks);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		hdd_err("Policy manager initialization failed");
 		goto err_debugfs_exit;

+ 0 - 6
core/hdd/src/wlan_hdd_wext.c

@@ -7853,12 +7853,6 @@ static int __iw_set_var_ints_getnone(struct net_device *dev,
 		for (i = 0; i < len; i++) {
 			pr_info("|table_index[%d]\t\t|\n", i);
 			pr_info("|\t|vdev_id - %d\t\t|\n", conn_info->vdev_id);
-			pr_info("|\t|tx_spatial_stream - %d\t|\n",
-						conn_info->tx_spatial_stream);
-			pr_info("|\t|rx_spatial_stream - %d\t|\n",
-						conn_info->rx_spatial_stream);
-			pr_info("|\t|chain_mask - %d\t\t|\n",
-						conn_info->chain_mask);
 			pr_info("|\t|chan - %d\t\t|\n", conn_info->chan);
 			pr_info("|\t|bw - %d\t\t|\n", conn_info->bw);
 			pr_info("|\t|mode - %d\t\t|\n", conn_info->mode);

+ 2 - 0
core/sme/inc/sme_api.h

@@ -1136,4 +1136,6 @@ QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id,
 				       struct sir_mac_pwr_dbg_cmd*
 				       dbg_args);
 
+void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode,
+		uint8_t *nss_2g, uint8_t *nss_5g);
 #endif /* #if !defined( __SME_API_H ) */

+ 0 - 3
core/sme/inc/sme_inside.h

@@ -235,9 +235,6 @@ QDF_STATUS oem_data_process_oem_data_req_command(tpAniSirGlobal pMac,
 		tSmeCmd *pCommand);
 #endif
 
-void csr_get_vdev_type_nss(tpAniSirGlobal mac_ctx,
-		enum tQDF_ADAPTER_MODE dev_mode,
-		uint8_t *nss_2g, uint8_t *nss_5g);
 QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac,
 		tSmeCmd *pCommand);
 QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg);

+ 17 - 0
core/sme/src/common/sme_api.c

@@ -15866,3 +15866,20 @@ QDF_STATUS sme_process_mac_pwr_dbg_cmd(tHalHandle hal, uint32_t session_id,
 	}
 	return QDF_STATUS_SUCCESS;
 }
+/**
+ * sme_get_vdev_type_nss() - gets the nss per vdev type
+ * @hal: Pointer to HAL
+ * @dev_mode: connection type.
+ * @nss2g: Pointer to the 2G Nss parameter.
+ * @nss5g: Pointer to the 5G Nss parameter.
+ *
+ * Fills the 2G and 5G Nss values based on connection type.
+ *
+ * Return: None
+ */
+void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode,
+		uint8_t *nss_2g, uint8_t *nss_5g)
+{
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g);
+}

+ 4 - 0
core/sme/src/csr/csr_inside_api.h

@@ -613,6 +613,10 @@ QDF_STATUS csr_get_active_scan_entry(tpAniSirGlobal mac, uint32_t scan_id,
 bool csr_is_profile_wapi(tCsrRoamProfile *pProfile);
 #endif /* FEATURE_WLAN_WAPI */
 
+void csr_get_vdev_type_nss(tpAniSirGlobal mac_ctx,
+		enum tQDF_ADAPTER_MODE dev_mode,
+		uint8_t *nss_2g, uint8_t *nss_5g);
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
 
 /* Security */