Prechádzať zdrojové kódy

qcacld-3.0: Use the connection manager API to initiate disconnect

Use connection manager API to initiate disconnect from HDD and CSR.

Change-Id: I04c3b0c3cc65d1f21ac3a5047be448c305a2ca6b
CRs-Fixed: 2846108
gaurank kathpalia 4 rokov pred
rodič
commit
af3603f2dc

+ 17 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_api.h

@@ -209,6 +209,23 @@ QDF_STATUS cm_process_peer_create(struct scheduler_msg *msg);
  */
 QDF_STATUS cm_process_disconnect_req(struct scheduler_msg *msg);
 
+/**
+ * cm_disconnect() - disconnect start request
+ * @psoc: psoc pointer
+ * @vdev_id: vdev id
+ * @source: disconnect source
+ * @reason_code: disconnect reason
+ * @bssid: bssid of AP to disconnect, can be null if not known
+ *
+ * Context: can be called from any context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cm_disconnect(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			 enum wlan_cm_source source,
+			 enum wlan_reason_code reason_code,
+			 struct qdf_mac_addr *bssid);
+
 /**
  * cm_disconnect_indication() - Process vdev discon ind and send to CM
  * @msg: scheduler message

+ 25 - 15
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_disconnect.c

@@ -76,10 +76,30 @@ QDF_STATUS cm_send_vdev_down_req(struct wlan_objmgr_vdev *vdev)
 					     sizeof(*resp), resp);
 }
 
+QDF_STATUS cm_disconnect(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
+			 enum wlan_cm_source source,
+			 enum wlan_reason_code reason_code,
+			 struct qdf_mac_addr *bssid)
+{
+	struct wlan_objmgr_vdev *vdev;
+	QDF_STATUS status;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_CM_ID);
+	if (!vdev) {
+		mlme_err("vdev_id: %d: vdev not found", vdev_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wlan_cm_disconnect(vdev, source, reason_code, bssid);
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
+
+	return status;
+}
+
 QDF_STATUS cm_disconnect_indication(struct scheduler_msg *msg)
 {
 	struct cm_vdev_discon_ind *ind;
-	struct wlan_objmgr_vdev *vdev;
 	QDF_STATUS status;
 
 	if (!msg || !msg->bodyptr)
@@ -87,20 +107,10 @@ QDF_STATUS cm_disconnect_indication(struct scheduler_msg *msg)
 
 	ind = msg->bodyptr;
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
-			ind->psoc, ind->disconnect_param.vdev_id,
-			WLAN_MLME_CM_ID);
-	if (!vdev) {
-		mlme_err("vdev_id: %d : vdev not found",
-			 ind->disconnect_param.vdev_id);
-		qdf_mem_free(ind);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	status = wlan_cm_disconnect(vdev, ind->disconnect_param.source,
-				    ind->disconnect_param.reason_code,
-				    &ind->disconnect_param.bssid);
-	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
+	status = cm_disconnect(ind->psoc, ind->disconnect_param.vdev_id,
+			       ind->disconnect_param.source,
+			       ind->disconnect_param.reason_code,
+			       &ind->disconnect_param.bssid);
 	qdf_mem_free(ind);
 
 	return status;

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -118,6 +118,7 @@
 
 #include "wlan_hdd_sta_info.h"
 #include "wlan_hdd_bus_bandwidth.h"
+#include <wlan_hdd_cm_api.h>
 
 /*
  * Preprocessor definitions and constants

+ 40 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -488,10 +488,17 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
 void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *sta_adapter;
+#ifndef FEATURE_CM_ENABLE
 	QDF_STATUS status;
+#endif
 
 	sta_adapter = hdd_get_sta_connection_in_progress(hdd_ctx);
 	if (sta_adapter) {
+		/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+		wlan_hdd_cm_issue_disconnect(sta_adapter,
+					     REASON_UNSPEC_FAILURE, false);
+#else
 		hdd_debug("Disconnecting STA on vdev: %d",
 			  sta_adapter->vdev_id);
 		status = wlan_hdd_disconnect(sta_adapter,
@@ -501,6 +508,7 @@ void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx)
 			hdd_err("wlan_hdd_disconnect failed, status: %d",
 				status);
 		}
+#endif
 	}
 }
 
@@ -1051,23 +1059,29 @@ void hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
 	hdd_sta_ctx->cache_conn_info.he_operation = hdd_he_operation;
 }
 
+#ifndef FEATURE_CM_ENABLE
 static void __hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
 				    struct csr_roam_info *roam_info)
 {
 	hdd_copy_he_operation(hdd_sta_ctx, &roam_info->he_operation);
 }
+#endif
 #else
+#ifndef FEATURE_CM_ENABLE
 static inline void __hdd_copy_he_operation(struct hdd_station_ctx *hdd_sta_ctx,
 					   struct csr_roam_info *roam_info)
 {
 }
 #endif
+#endif
 
 bool hdd_is_roam_sync_in_progress(struct hdd_context *hdd_ctx, uint8_t vdev_id)
 {
 	return MLME_IS_ROAM_SYNCH_IN_PROGRESS(hdd_ctx->psoc, vdev_id);
 }
 
+#ifndef FEATURE_CM_ENABLE
+
 /**
  * hdd_save_bss_info() - save connection info in hdd sta ctx
  * @adapter: Pointer to adapter
@@ -1274,6 +1288,8 @@ hdd_send_ft_assoc_response(struct net_device *dev,
 	qdf_mem_free(buff);
 }
 
+#endif
+
 /**
  * hdd_send_ft_event() - send fast transition event
  * @adapter: pointer to adapter
@@ -1381,6 +1397,7 @@ static void hdd_send_ft_event(struct hdd_adapter *adapter)
 #endif
 }
 
+#ifndef FEATURE_CM_ENABLE
 #ifdef FEATURE_WLAN_ESE
 /**
  * hdd_send_new_ap_channel_info() - send new ap channel info
@@ -1641,6 +1658,7 @@ static void hdd_send_association_event(struct net_device *dev,
 #endif
 	}
 }
+#endif
 
 void hdd_conn_remove_connect_info(struct hdd_station_ctx *sta_ctx)
 {
@@ -1727,6 +1745,7 @@ void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter)
 	hdd_exit();
 }
 
+#ifndef FEATURE_CM_ENABLE
 /**
  * hdd_dis_connect_handler() - disconnect event handler
  * @adapter: pointer to adapter
@@ -1879,6 +1898,7 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter,
 
 	return status;
 }
+#endif
 
 /**
  * hdd_set_peer_authorized_event() - set peer_authorized_event
@@ -2152,6 +2172,7 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter,
 	return qdf_status;
 }
 
+#ifndef FEATURE_CM_ENABLE
 /**
  * hdd_send_roamed_ind() - send roamed indication to cfg80211
  * @dev: network device
@@ -2190,6 +2211,7 @@ static inline void hdd_send_roamed_ind(struct net_device *dev,
 			    GFP_KERNEL);
 }
 #endif
+#endif
 
 #if defined(WLAN_FEATURE_ROAM_OFFLOAD)
 #if defined(WLAN_FEATURE_FILS_SK)
@@ -2239,6 +2261,7 @@ void hdd_save_gtk_params(struct hdd_adapter *adapter,
 #endif
 #endif
 
+#ifndef FEATURE_CM_ENABLE
 static void hdd_roam_decr_conn_count(struct hdd_adapter *adapter,
 				     struct hdd_context *hdd_ctx)
 {
@@ -2251,6 +2274,7 @@ static void hdd_roam_decr_conn_count(struct hdd_adapter *adapter,
 						adapter->device_mode,
 						adapter->vdev_id);
 }
+
 /**
  * hdd_send_re_assoc_event() - send reassoc event
  * @dev: pointer to net device
@@ -2400,6 +2424,7 @@ done:
 	qdf_mem_free(rsp_rsn_ie);
 	qdf_mem_free(assoc_req_ies);
 }
+#endif
 
 /**
  * hdd_change_sta_state_authenticated()-
@@ -2605,6 +2630,7 @@ static inline void hdd_netif_queue_enable(struct hdd_adapter *adapter)
 	}
 }
 
+#ifndef FEATURE_CM_ENABLE
 static void hdd_save_connect_status(struct hdd_adapter *adapter,
 				    struct csr_roam_info *roam_info)
 {
@@ -3373,6 +3399,8 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
+
 
 bool hdd_save_peer(struct hdd_station_ctx *sta_ctx,
 		   struct qdf_mac_addr *peer_mac_addr)
@@ -4147,9 +4175,12 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info,
 	case eCSR_ROAM_FT_REASSOC_FAILED:
 		hdd_err("Reassoc Failed with roam_status: %d roam_result: %d SessionID: %d",
 			 roam_status, roam_result, adapter->vdev_id);
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		qdf_ret_status =
 			hdd_dis_connect_handler(adapter, roam_info, roam_id,
 						roam_status, roam_result);
+#endif
 		sta_ctx->ft_carrier_on = false;
 		sta_ctx->hdd_reassoc_scenario = false;
 		hdd_debug("hdd_reassoc_scenario set to: %d, ReAssoc Failed, session: %d",
@@ -4224,9 +4255,12 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info,
 		 */
 		hdd_disable_and_flush_mc_addr_list(adapter,
 			pmo_peer_disconnect);
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		qdf_ret_status =
 			hdd_dis_connect_handler(adapter, roam_info, roam_id,
 						roam_status, roam_result);
+#endif
 	}
 	break;
 	case eCSR_ROAM_ASSOCIATION_COMPLETION:
@@ -4248,10 +4282,13 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info,
 				  sta_ctx->hdd_reassoc_scenario,
 				  adapter->vdev_id);
 		}
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		qdf_ret_status =
 			hdd_association_completion_handler(adapter, roam_info,
 							   roam_id, roam_status,
 							   roam_result);
+#endif
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 		if (roam_info)
 			roam_info->roamSynchInProgress = false;
@@ -4261,11 +4298,14 @@ hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info,
 		hdd_debug("****eCSR_ROAM_CANCELLED****");
 		/* fallthrough */
 	case eCSR_ROAM_ASSOCIATION_FAILURE:
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		qdf_ret_status = hdd_association_completion_handler(adapter,
 								    roam_info,
 								    roam_id,
 								    roam_status,
 								    roam_result);
+#endif
 		break;
 	case eCSR_ROAM_MIC_ERROR_IND:
 		hdd_roam_mic_error_indication_handler(adapter, roam_info);

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

@@ -99,7 +99,13 @@ wlan_hdd_btc_chain_mode_handler(struct wlan_objmgr_vdev *vdev)
 	switch (adapter->device_mode) {
 	case QDF_STA_MODE:
 	case QDF_P2P_CLIENT_MODE:
+		/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+		wlan_hdd_cm_issue_disconnect(adapter,
+					     REASON_PREV_AUTH_NOT_VALID, false);
+#else
 		wlan_hdd_disconnect(adapter, 0, REASON_PREV_AUTH_NOT_VALID);
+#endif
 		break;
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:

+ 1 - 24
core/hdd/src/wlan_hdd_cfg80211.c

@@ -20460,7 +20460,6 @@ static void wlan_hdd_cfg80211_clear_privacy(struct hdd_adapter *adapter)
 
 	wlan_hdd_clear_wapi_privacy(adapter);
 }
-#endif /* FEATURE_CM_ENABLE */
 
 static int wlan_hdd_wait_for_disconnect(mac_handle_t mac_handle,
 					struct hdd_adapter *adapter,
@@ -20593,7 +20592,6 @@ int wlan_hdd_try_disconnect(struct hdd_adapter *adapter,
 					    reason);
 }
 
-#ifndef FEATURE_CM_ENABLE
 /**
  * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present
  * @adapter: Pointer to the HDD adapter
@@ -21096,27 +21094,7 @@ wlan_hdd_cfg80211_indicate_disconnect(struct hdd_adapter *adapter,
 }
 #endif
 
-#ifdef WLAN_FEATURE_MSCS
-/**
- * reset_mscs_params() - Reset mscs parameters
- * @adapter: pointer to adapter structure
- *
- * Reset mscs parameters whils disconnection
- *
- * Return: None
- */
-static void reset_mscs_params(struct hdd_adapter *adapter)
-{
-	mlme_set_is_mscs_req_sent(adapter->vdev, false);
-	adapter->mscs_counter = 0;
-}
-#else
-static inline
-void reset_mscs_params(struct hdd_adapter *adapter)
-{
-	return;
-}
-#endif
+#ifndef FEATURE_CM_ENABLE
 
 int wlan_hdd_disconnect(struct hdd_adapter *adapter, u16 reason,
 			enum wlan_reason_code mac_reason)
@@ -21148,7 +21126,6 @@ int wlan_hdd_disconnect(struct hdd_adapter *adapter, u16 reason,
 	return ret;
 }
 
-#ifndef FEATURE_CM_ENABLE
 /**
  * __wlan_hdd_cfg80211_disconnect() - cfg80211 disconnect api
  * @wiphy: Pointer to wiphy

+ 2 - 1
core/hdd/src/wlan_hdd_cfg80211.h

@@ -684,6 +684,7 @@ void hdd_set_rate_bw(struct rate_info *info, enum hdd_rate_info_bw hdd_bw);
  */
 uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx);
 
+#ifndef FEATURE_CM_ENABLE
 /**
  * wlan_hdd_try_disconnect() - try disconnnect from previous connection
  * @adapter: Pointer to adapter
@@ -708,7 +709,7 @@ int wlan_hdd_try_disconnect(struct hdd_adapter *adapter,
  */
 int wlan_hdd_disconnect(struct hdd_adapter *adapter, u16 reason,
 			enum wlan_reason_code mac_reason);
-
+#endif
 /**
  * wlan_hdd_get_adjacent_chan(): Gets next/previous channel
  * to the channel passed.

+ 28 - 10
core/hdd/src/wlan_hdd_cm_api.h

@@ -43,6 +43,20 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 			struct net_device *ndev,
 			struct cfg80211_connect_params *req);
 
+/**
+ * wlan_hdd_cm_issue_disconnect() - initiate disconnect from osif
+ * @adapter: Pointer to adapter
+ * @reason: Disconnect reason code
+ * @sync: true if wait for disconnect to complete is required.
+ *
+ * This function is used to issue disconnect request to conection manager
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_hdd_cm_issue_disconnect(struct hdd_adapter *adapter,
+					enum wlan_reason_code reason,
+					bool sync);
+
 /**
  * wlan_hdd_cm_disconnect() - cfg80211 disconnect api
  * @wiphy: Pointer to wiphy
@@ -67,19 +81,23 @@ QDF_STATUS hdd_cm_netif_queue_control(struct wlan_objmgr_vdev *vdev,
 QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
 				   struct wlan_cm_connect_resp *rsp,
 				   enum osif_cb_type type);
+#endif
 
+#ifdef WLAN_FEATURE_MSCS
+/**
+ * reset_mscs_params() - Reset mscs parameters
+ * @adapter: pointer to adapter structure
+ *
+ * Reset mscs parameters whils disconnection
+ *
+ * Return: None
+ */
+void reset_mscs_params(struct hdd_adapter *adapter);
 #else
-static inline int
-wlan_hdd_cm_connect(struct wiphy *wiphy, struct net_device *ndev,
-		    struct cfg80211_connect_params *req)
-{
-	return 0;
-}
-
-static inline int
-wlan_hdd_cm_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason)
+static inline
+void reset_mscs_params(struct hdd_adapter *adapter)
 {
-	return 0;
+	return;
 }
 #endif
 

+ 47 - 17
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -41,6 +41,8 @@
 #include "wlan_hdd_bootup_marker.h"
 #include "wlan_p2p_ucfg_api.h"
 #include "wlan_crypto_global_api.h"
+#include "wlan_mlme_vdev_mgr_interface.h"
+#include "hif.h"
 
 void hdd_handle_disassociation_event(struct hdd_adapter *adapter,
 				     struct qdf_mac_addr *peer_macaddr)
@@ -200,13 +202,54 @@ void __hdd_cm_disconnect_handler_post_user_update(struct hdd_adapter *adapter)
 	hdd_cm_print_bss_info(sta_ctx);
 }
 
+#ifdef WLAN_FEATURE_MSCS
+void reset_mscs_params(struct hdd_adapter *adapter)
+{
+	mlme_set_is_mscs_req_sent(adapter->vdev, false);
+	adapter->mscs_counter = 0;
+}
+#endif
+
 #ifdef FEATURE_CM_ENABLE
+QDF_STATUS wlan_hdd_cm_issue_disconnect(struct hdd_adapter *adapter,
+					enum wlan_reason_code reason,
+					bool sync)
+{
+	QDF_STATUS status;
+	struct wlan_objmgr_vdev *vdev;
+	void *hif_ctx;
+
+	vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_CM_ID);
+	if (!vdev)
+		return QDF_STATUS_E_INVAL;
+	hdd_place_marker(adapter, "TRY TO DISCONNECT", NULL);
+	reset_mscs_params(adapter);
+	wlan_hdd_netif_queue_control(adapter,
+				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
+				     WLAN_CONTROL_PATH);
+
+	hif_ctx = cds_get_context(QDF_MODULE_ID_HIF);
+	if (hif_ctx)
+		/*
+		 * Trigger runtime sync resume before sending disconneciton
+		 */
+		hif_pm_runtime_sync_resume(hif_ctx);
+
+	if (sync)
+		status = osif_cm_disconnect_sync(vdev, reason);
+	else
+		status = osif_cm_disconnect(adapter->dev, vdev, reason);
+
+	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_CM_ID);
+
+	return status;
+}
+
 int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 			   struct net_device *dev, u16 reason)
 {
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	int status;
-	struct wlan_objmgr_vdev *vdev;
+	QDF_STATUS status;
 
 	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
 		hdd_err("Command not allowed in FTM mode");
@@ -216,10 +259,6 @@ int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 	if (wlan_hdd_validate_vdev_id(adapter->vdev_id))
 		return -EINVAL;
 
-	vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_CM_ID);
-	if (!vdev)
-		return -EINVAL;
-
 	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
 		   TRACE_CODE_HDD_CFG80211_DISCONNECT,
 		   adapter->vdev_id, reason);
@@ -230,18 +269,9 @@ int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 		qdf_dp_trace_dump_all(
 				WLAN_DEAUTH_DPTRACE_DUMP_COUNT,
 				QDF_TRACE_DEFAULT_PDEV_ID);
+	status = wlan_hdd_cm_issue_disconnect(adapter, reason, false);
 
-	/* To-Do: This is static api move this api to this file
-	 * once this is removed from wlan_hdd_cfg80211.c file
-	 * reset_mscs_params(adapter);
-	 */
-	wlan_hdd_netif_queue_control(adapter,
-				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
-				     WLAN_CONTROL_PATH);
-	status = osif_cm_disconnect(dev, vdev, reason);
-	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_CM_ID);
-
-	return status;
+	return qdf_status_to_os_return(status);
 }
 
 static QDF_STATUS

+ 5 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -4837,8 +4837,13 @@ hdd_check_and_disconnect_sta_on_invalid_channel(struct hdd_context *hdd_ctx,
 	}
 
 	hdd_err("chan %d not valid, issue disconnect", sta_chan_freq);
+	/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+	wlan_hdd_cm_issue_disconnect(sta_adapter, reason, false);
+#else
 	/* Issue Disconnect request */
 	wlan_hdd_disconnect(sta_adapter, eCSR_DISCONNECT_REASON_DEAUTH, reason);
+#endif
 }
 
 #ifdef DISABLE_CHANNEL_LIST

+ 36 - 24
core/hdd/src/wlan_hdd_main.c

@@ -7079,38 +7079,41 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 					adapter->vdev_id,
 					eCSR_DISCONNECT_REASON_NDI_DELETE,
 					reason);
-			}
-			else if (adapter->device_mode == QDF_STA_MODE) {
+				if (QDF_IS_STATUS_SUCCESS(status)) {
+					rc = wait_for_completion_timeout(
+						&adapter->disconnect_comp_var,
+						msecs_to_jiffies
+						 (SME_DISCONNECT_TIMEOUT));
+					if (!rc)
+						hdd_warn("disconn_comp_var wait fail");
+					hdd_cleanup_ndi(hdd_ctx, adapter);
+				}
+			} else if (adapter->device_mode == QDF_STA_MODE ||
+				   adapter->device_mode == QDF_P2P_CLIENT_MODE) {
+				/*
+				 * This is temp ifdef will be removed in near
+				 * future
+				 */
+#ifdef FEATURE_CM_ENABLE
+				status = wlan_hdd_cm_issue_disconnect(adapter,
+								      reason,
+								      true);
+#else
+				status = QDF_STATUS_SUCCESS;
 				rc = wlan_hdd_disconnect(
 						adapter,
 						eCSR_DISCONNECT_REASON_DEAUTH,
 						reason);
-				if (rc != 0 && ucfg_ipa_is_enabled()) {
+				if (rc != 0)
+					status = QDF_STATUS_E_TIMEOUT;
+#endif
+				if (QDF_IS_STATUS_ERROR(status) &&
+				    ucfg_ipa_is_enabled()) {
 					hdd_err("STA disconnect failed");
 					ucfg_ipa_uc_cleanup_sta(hdd_ctx->pdev,
 								adapter->dev);
 				}
-			} else {
-				status = sme_roam_disconnect(
-					mac_handle,
-					adapter->vdev_id,
-					eCSR_DISCONNECT_REASON_UNSPECIFIED,
-					reason);
-			}
-			/* success implies disconnect is queued */
-			if (QDF_IS_STATUS_SUCCESS(status) &&
-			    adapter->device_mode != QDF_STA_MODE) {
-				rc = wait_for_completion_timeout(
-					&adapter->disconnect_comp_var,
-					msecs_to_jiffies
-						(SME_DISCONNECT_TIMEOUT));
-				if (!rc)
-					hdd_warn("disconn_comp_var wait fail");
-				if (adapter->device_mode == QDF_NDI_MODE)
-					hdd_cleanup_ndi(hdd_ctx, adapter);
 			}
-			if (QDF_IS_STATUS_ERROR(status))
-				hdd_warn("failed to post disconnect");
 
 			memset(&wrqu, '\0', sizeof(wrqu));
 			wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -18573,9 +18576,12 @@ wlan_hdd_add_monitor_check(struct hdd_context *hdd_ctx,
 {
 	struct hdd_adapter *sta_adapter;
 	struct hdd_adapter *mon_adapter;
-	int errno;
 	uint8_t num_open_session = 0;
 	QDF_STATUS status;
+#ifndef FEATURE_CM_ENABLE
+	int errno;
+#endif
+
 
 	/* if no interface is up do not add monitor mode */
 	if (!hdd_is_any_interface_open(hdd_ctx))
@@ -18605,12 +18611,18 @@ wlan_hdd_add_monitor_check(struct hdd_context *hdd_ctx,
 	if (num_open_session == 1) {
 		hdd_ctx->disconnect_for_sta_mon_conc = true;
 		/* Try disconnecting if already in connected state */
+		/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+		wlan_hdd_cm_issue_disconnect(sta_adapter, REASON_UNSPEC_FAILURE,
+					     true);
+#else
 		errno = wlan_hdd_try_disconnect(sta_adapter,
 						REASON_UNSPEC_FAILURE);
 		if (errno > 0) {
 			hdd_err("Failed to disconnect the existing connection");
 			return -EALREADY;
 		}
+#endif
 	}
 
 	if (ucfg_pkt_capture_get_mode(hdd_ctx->psoc) !=

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

@@ -265,6 +265,12 @@ hdd_handle_nud_fail_sta(struct hdd_context *hdd_ctx,
 static void
 hdd_handle_nud_fail_non_sta(struct hdd_adapter *adapter)
 {
+	/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+	wlan_hdd_cm_issue_disconnect(adapter,
+				     REASON_GATEWAY_REACHABILITY_FAILURE,
+				     false);
+#else
 	int status;
 
 	qdf_mutex_acquire(&adapter->disconnection_status_lock);
@@ -279,6 +285,7 @@ hdd_handle_nud_fail_non_sta(struct hdd_adapter *adapter)
 
 	hdd_debug("Disconnecting vdev with vdev id: %d",
 		  adapter->vdev_id);
+
 	/* Issue Disconnect */
 	status = wlan_hdd_disconnect(adapter, eCSR_DISCONNECT_REASON_DEAUTH,
 				     REASON_GATEWAY_REACHABILITY_FAILURE);
@@ -287,6 +294,7 @@ hdd_handle_nud_fail_non_sta(struct hdd_adapter *adapter)
 			status);
 		hdd_set_disconnect_status(adapter, false);
 	}
+#endif
 }
 
 #ifdef WLAN_NUD_TRACKING

+ 7 - 0
core/hdd/src/wlan_hdd_regulatory.c

@@ -1423,11 +1423,18 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx)
 			phy_changed = (roam_profile->phyMode != csr_phy_mode);
 
 			if (phy_changed || freq_changed) {
+			/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+				wlan_hdd_cm_issue_disconnect(adapter,
+							 REASON_UNSPEC_FAILURE,
+							 false);
+#else
 				sme_roam_disconnect(
 					hdd_ctx->mac_handle,
 					adapter->vdev_id,
 					eCSR_DISCONNECT_REASON_UNSPECIFIED,
 					REASON_UNSPEC_FAILURE);
+#endif
 				roam_profile->phyMode = csr_phy_mode;
 			}
 			break;

+ 13 - 0
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -1573,6 +1573,16 @@ static void lim_process_nb_disconnect_req(struct mac_context *mac_ctx,
 	reason_code = req->req.reason_code;
 
 	switch (reason_code) {
+	case REASON_IFACE_DOWN:
+	case REASON_DEVICE_RECOVERY:
+	case REASON_OPER_CHANNEL_BAND_CHANGE:
+	case REASON_USER_TRIGGERED_ROAM_FAILURE:
+	case REASON_CHANNEL_SWITCH_FAILED:
+	case REASON_GATEWAY_REACHABILITY_FAILURE:
+	case REASON_OPER_CHANNEL_DISABLED_INDOOR:
+		/* Set reason REASON_DEAUTH_NETWORK_LEAVING for prop deauth */
+		req->req.reason_code = REASON_DEAUTH_NETWORK_LEAVING;
+		/* fallthrough */
 	case REASON_PREV_AUTH_NOT_VALID:
 	case REASON_CLASS2_FRAME_FROM_NON_AUTH_STA:
 		lim_prepare_and_send_deauth(mac_ctx, req);
@@ -1588,6 +1598,9 @@ static void lim_process_nb_disconnect_req(struct mac_context *mac_ctx,
 		lim_prepare_and_send_deauth(mac_ctx, req);
 		break;
 	default:
+		/* Set reason REASON_UNSPEC_FAILURE for prop disassoc */
+		if (reason_code >= REASON_PROP_START)
+			req->req.reason_code = REASON_UNSPEC_FAILURE;
 		lim_prepare_and_send_disassoc(mac_ctx, req);
 	}
 }

+ 5 - 1
core/sme/inc/csr_api.h

@@ -461,14 +461,18 @@ typedef enum {
 } eCsrRoamResult;
 
 typedef enum {
+#ifndef FEATURE_CM_ENABLE
 	eCSR_DISCONNECT_REASON_UNSPECIFIED = 0,
 	eCSR_DISCONNECT_REASON_MIC_ERROR,
 	eCSR_DISCONNECT_REASON_DISASSOC,
 	eCSR_DISCONNECT_REASON_DEAUTH,
 	eCSR_DISCONNECT_REASON_HANDOFF,
 	eCSR_DISCONNECT_REASON_STA_HAS_LEFT,
-	eCSR_DISCONNECT_REASON_NDI_DELETE,
+#endif
+	eCSR_DISCONNECT_REASON_NDI_DELETE = 6,
+#ifndef FEATURE_CM_ENABLE
 	eCSR_DISCONNECT_REASON_ROAM_HO_FAIL,
+#endif
 } eCsrRoamDisconnectReason;
 
 typedef enum {

+ 8 - 0
core/sme/inc/csr_internal.h

@@ -104,18 +104,24 @@ enum csr_roam_reason {
 	eCsrNoConnection,
 	/* roaming because LIM reported a cap change in the associated AP. */
 	eCsrCapsChange,
+#ifndef FEATURE_CM_ENABLE
 	/* roaming because someone asked us to Disassoc & stay disassociated. */
 	eCsrForcedDisassoc,
+#endif
 	/* roaming because an 802.11 request was issued to the driver. */
 	eCsrHddIssued,
+#ifndef FEATURE_CM_ENABLE
 	/* roaming because we need to force a Disassoc due to MIC failure */
 	eCsrForcedDisassocMICFailure,
+#endif
 	eCsrHddIssuedReassocToSameAP,
 	eCsrSmeIssuedReassocToSameAP,
+#ifndef FEATURE_CM_ENABLE
 	/* roaming because someone asked us to deauth and stay disassociated. */
 	eCsrForcedDeauth,
 	/* will be issued by Handoff logic to disconect from current AP */
 	eCsrSmeIssuedDisassocForHandoff,
+#endif
 	/* will be issued by Handoff logic to join a new AP with same profile */
 	eCsrSmeIssuedAssocToSimilarAP,
 	eCsrStopBss,
@@ -602,7 +608,9 @@ struct csr_roam_session {
 	uint8_t nss;
 	bool disable_hi_rssi;
 	bool dhcp_done;
+#ifndef FEATURE_CM_ENABLE
 	enum wlan_reason_code disconnect_reason;
+#endif
 	uint8_t uapsd_mask;
 	struct scan_cmd_info scan_info;
 	qdf_mc_timer_t roaming_offload_timer;

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

@@ -69,6 +69,7 @@
 #include "wlan_cm_tgt_if_tx_api.h"
 #include "wlan_cm_api.h"
 #include "parser_api.h"
+#include <../../core/src/wlan_cm_vdev_api.h>
 
 static QDF_STATUS init_sme_cmd_list(struct mac_context *mac);
 
@@ -5464,9 +5465,15 @@ static void sme_disconnect_connected_sessions(struct mac_context *mac_ctx,
 		found = sme_search_in_base_ch_freq_lst(mac_ctx, chan_freq);
 		if (!found) {
 			sme_debug("Disconnect Session: %d", session_id);
+			/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+			cm_disconnect(mac_ctx->psoc, session_id,
+				      CM_MLME_DISCONNECT, reason, NULL);
+#else
 			csr_roam_disconnect(mac_ctx, session_id,
 					    eCSR_DISCONNECT_REASON_UNSPECIFIED,
 					    reason);
+#endif
 		}
 	}
 }

+ 115 - 7
core/sme/src/csr/csr_api_roam.c

@@ -69,7 +69,7 @@
 #include "wlan_p2p_cfg_api.h"
 #include "cfg_nan_api.h"
 #include "nan_ucfg_api.h"
-
+#include <../../core/src/wlan_cm_vdev_api.h>
 #include <ol_defines.h>
 #include "wlan_pkt_capture_ucfg_api.h"
 #include "wlan_psoc_mlme_api.h"
@@ -2951,14 +2951,21 @@ static void csr_roam_remove_duplicate_pending_cmd_from_list(
 					sizeof(QDF_MAC_ADDR_SIZE))) &&
 				((command->u.roamCmd.roamReason ==
 					dup_cmd->u.roamCmd.roamReason) ||
+			/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 				(eCsrForcedDisassoc ==
 					command->u.roamCmd.roamReason) ||
+#endif
 				(eCsrHddIssued ==
 					command->u.roamCmd.roamReason)))) ||
 			/* OR if pCommand is NULL */
 			((vdev_id == dup_cmd->vdev_id) &&
 			(eSmeCommandRoam == dup_cmd->command) &&
-			((eCsrForcedDisassoc == roam_reason) ||
+			(
+			/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
+			(eCsrForcedDisassoc == roam_reason) ||
+#endif
 			(eCsrHddIssued == roam_reason &&
 			!CSR_IS_DISCONNECT_COMMAND(dup_cmd))))) {
 			sme_debug("RoamReason: %d",
@@ -3796,6 +3803,7 @@ QDF_STATUS csr_roam_issue_deauth_sta_cmd(struct mac_context *mac,
 	return status;
 }
 
+#ifndef FEATURE_CM_ENABLE
 static
 QDF_STATUS csr_roam_issue_deauth(struct mac_context *mac, uint32_t sessionId,
 				 enum csr_roam_substate NewSubstate)
@@ -3830,6 +3838,7 @@ QDF_STATUS csr_roam_issue_deauth(struct mac_context *mac, uint32_t sessionId,
 
 	return status;
 }
+#endif
 
 QDF_STATUS csr_roam_save_connected_bss_desc(struct mac_context *mac,
 					    uint32_t sessionId,
@@ -5854,9 +5863,13 @@ QDF_STATUS csr_roam_process_command(struct mac_context *mac, tSmeCmd *pCommand)
 	sme_debug("Roam Reason: %d sessionId: %d",
 		pCommand->u.roamCmd.roamReason, sessionId);
 
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	pSession->disconnect_reason = pCommand->u.roamCmd.disconnect_reason;
-
+#endif
 	switch (pCommand->u.roamCmd.roamReason) {
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	case eCsrForcedDisassoc:
 		status = csr_roam_process_disassoc_deauth(mac, pCommand,
 				true, false);
@@ -5901,6 +5914,7 @@ QDF_STATUS csr_roam_process_command(struct mac_context *mac, tSmeCmd *pCommand)
 		csr_free_roam_profile(mac, sessionId);
 		sme_release_global_lock(&mac->sme);
 		break;
+#endif
 	case eCsrHddIssuedReassocToSameAP:
 	case eCsrSmeIssuedReassocToSameAP:
 		status = csr_roam_trigger_reassociate(mac, pCommand,
@@ -6293,6 +6307,8 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 
 	sme_debug("Assoc ref count: %d", session->bRefAssocStartCnt);
 
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	/* Update AP's assoc info in scan before removing connectedProfile */
 	switch (cmd->u.roamCmd.roamReason) {
 	case eCsrSmeIssuedDisassocForHandoff:
@@ -6305,6 +6321,7 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 	default:
 		break;
 	}
+#endif
 	if (CSR_IS_INFRASTRUCTURE(&session->connectedProfile)
 		|| CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(mac_ctx, session_id)) {
 		/*
@@ -6330,7 +6347,10 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 	case eCsrSmeIssuedFTReassoc:
 	case eCsrSmeIssuedAssocToSimilarAP:
 	case eCsrHddIssued:
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	case eCsrSmeIssuedDisassocForHandoff:
+#endif
 		csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE,
 			session_id);
 		roam_info->bss_desc = cmd->u.roamCmd.pLastRoamBss;
@@ -6409,6 +6429,8 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 		csr_roam_completion(mac_ctx, session_id, NULL, cmd,
 			eCSR_ROAM_RESULT_FAILURE, false);
 		break;
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	case eCsrForcedDisassoc:
 	case eCsrForcedDeauth:
 		csr_roam_state_change(mac_ctx, eCSR_ROAMING_STATE_IDLE,
@@ -6441,6 +6463,7 @@ static void csr_roam_process_results_default(struct mac_context *mac_ctx,
 			SME_QOS_CSR_DISCONNECT_REQ, NULL);
 #endif
 		break;
+#endif /* ndef FEATURE_CM_ENABLE */
 	case eCsrStopBss:
 		csr_roam_call_callback(mac_ctx, session_id, NULL,
 			cmd->u.roamCmd.roamId, eCSR_ROAM_INFRA_IND,
@@ -7987,6 +8010,8 @@ QDF_STATUS csr_roam_connect(struct mac_context *mac, uint32_t sessionId,
 	csr_scan_abort_mac_scan(mac, sessionId, INVAL_SCAN_ID);
 	csr_roam_remove_duplicate_command(mac, sessionId, NULL, eCsrHddIssued);
 
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	/* Check whether ssid changes */
 	if (csr_is_conn_state_connected(mac, sessionId) &&
 	    pProfile->SSIDs.numOfSSIDs &&
@@ -7995,6 +8020,7 @@ QDF_STATUS csr_roam_connect(struct mac_context *mac, uint32_t sessionId,
 		csr_roam_issue_disassociate_cmd(mac, sessionId,
 					eCSR_DISCONNECT_REASON_UNSPECIFIED,
 					REASON_UNSPEC_FAILURE);
+#endif
 	/*
 	 * If roamSession.connectState is disconnecting that mean
 	 * disconnect was received with scan for ssid in progress
@@ -8227,6 +8253,8 @@ csr_roam_reassoc(struct mac_context *mac_ctx, uint32_t session_id,
 	return status;
 }
 
+/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 QDF_STATUS csr_roam_process_disassoc_deauth(struct mac_context *mac,
 						tSmeCmd *pCommand,
 					    bool fDisassoc, bool fMICFailure)
@@ -8317,6 +8345,7 @@ QDF_STATUS csr_roam_process_disassoc_deauth(struct mac_context *mac,
 		sme_warn(" failed with status %d", status);
 	return status;
 }
+#endif
 
 QDF_STATUS csr_roam_issue_disassociate_cmd(struct mac_context *mac,
 					uint32_t sessionId,
@@ -8326,6 +8355,11 @@ QDF_STATUS csr_roam_issue_disassociate_cmd(struct mac_context *mac,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tSmeCmd *pCommand;
 
+#ifdef FEATURE_CM_ENABLE
+	if (reason != eCSR_DISCONNECT_REASON_NDI_DELETE)
+		return QDF_STATUS_E_INVAL;
+#endif
+
 	do {
 		pCommand = csr_get_command_buffer(mac);
 		if (!pCommand) {
@@ -8333,14 +8367,19 @@ QDF_STATUS csr_roam_issue_disassociate_cmd(struct mac_context *mac,
 			status = QDF_STATUS_E_RESOURCES;
 			break;
 		}
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		/* Change the substate in case it is wait-for-key */
 		if (CSR_IS_WAIT_FOR_KEY(mac, sessionId)) {
 			csr_roam_stop_wait_for_key_timer(mac);
 			csr_roam_substate_change(mac, eCSR_ROAM_SUBSTATE_NONE,
 						 sessionId);
 		}
+#endif
 		pCommand->command = eSmeCommandRoam;
 		pCommand->vdev_id = (uint8_t) sessionId;
+		/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 		sme_debug("Disassociate reason: %d, vdev_id: %d mac_reason %d",
 			 reason, sessionId, mac_reason);
 		switch (reason) {
@@ -8377,9 +8416,17 @@ QDF_STATUS csr_roam_issue_disassociate_cmd(struct mac_context *mac,
 			break;
 		}
 		pCommand->u.roamCmd.disconnect_reason = mac_reason;
+#else
+		pCommand->u.roamCmd.roamReason = eCsrStopBss;
+		pCommand->u.roamCmd.roamProfile.BSSType =
+				eCSR_BSS_TYPE_NDI;
+		sme_debug("NDI Stop reason: %d, vdev_id: %d mac_reason %d",
+			  reason, sessionId, mac_reason);
+#endif
 		status = csr_queue_sme_command(mac, pCommand, true);
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			sme_err("fail to send message status: %d", status);
+
 	} while (0);
 	return status;
 }
@@ -8411,6 +8458,7 @@ QDF_STATUS csr_roam_issue_stop_bss_cmd(struct mac_context *mac, uint32_t session
 	return status;
 }
 
+#ifndef FEATURE_CM_ENABLE
 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
 static void
 csr_disable_roaming_offload(struct mac_context *mac_ctx, uint32_t vdev_id)
@@ -8424,6 +8472,7 @@ static inline void
 csr_disable_roaming_offload(struct mac_context *mac_ctx, uint32_t session_id)
 {}
 #endif
+#endif
 
 QDF_STATUS csr_roam_disconnect(struct mac_context *mac_ctx, uint32_t session_id,
 			       eCsrRoamDisconnectReason reason,
@@ -8436,7 +8485,8 @@ QDF_STATUS csr_roam_disconnect(struct mac_context *mac_ctx, uint32_t session_id,
 		sme_err("session: %d not found ", session_id);
 		return QDF_STATUS_E_FAILURE;
 	}
-
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	session->discon_in_progress = true;
 
 	csr_roam_cancel_roaming(mac_ctx, session_id);
@@ -8450,7 +8500,11 @@ QDF_STATUS csr_roam_disconnect(struct mac_context *mac_ctx, uint32_t session_id,
 	    || CSR_IS_CONN_NDI(&session->connectedProfile))
 		status = csr_roam_issue_disassociate_cmd(mac_ctx, session_id,
 							 reason, mac_reason);
-
+#else
+	if (CSR_IS_CONN_NDI(&session->connectedProfile))
+		status = csr_roam_issue_disassociate_cmd(mac_ctx, session_id,
+							 reason, mac_reason);
+#endif
 	return status;
 }
 
@@ -11604,9 +11658,16 @@ csr_roam_chk_lnk_swt_ch_ind(struct mac_context *mac_ctx, tSirSmeRsp *msg_ptr)
 
 	if (QDF_IS_STATUS_ERROR(pSwitchChnInd->status)) {
 		sme_err("Channel switch failed");
+		/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+		cm_disconnect(mac_ctx->psoc, sessionId,
+			      CM_MLME_DISCONNECT,
+			      REASON_CHANNEL_SWITCH_FAILED, NULL);
+#else
 		csr_roam_disconnect(mac_ctx, sessionId,
 				    eCSR_DISCONNECT_REASON_DEAUTH,
 				    REASON_CHANNEL_SWITCH_FAILED);
+#endif
 		return;
 	}
 	session->connectedProfile.op_freq = pSwitchChnInd->freq;
@@ -11866,9 +11927,16 @@ csr_roam_chk_lnk_wm_status_change_ntf(struct mac_context *mac_ctx,
 		    || (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC ==
 			 mac_ctx->roam.curSubState[sessionId]))) {
 			sme_warn("Calling csr_roam_disconnect");
+			/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+			cm_disconnect(mac_ctx->psoc, sessionId,
+				      CM_MLME_DISCONNECT,
+				      REASON_UNSPEC_FAILURE, NULL);
+#else
 			csr_roam_disconnect(mac_ctx, sessionId,
 					    eCSR_DISCONNECT_REASON_UNSPECIFIED,
 					    REASON_UNSPEC_FAILURE);
+#endif
 		} else {
 			sme_warn("Skipping the new scan as CSR is in state: %s and sub-state: %s",
 				mac_trace_getcsr_roam_state(
@@ -12275,9 +12343,19 @@ void csr_roam_wait_for_key_time_out_handler(void *pv)
 			csr_roam_link_up(mac,
 					 pSession->connectedProfile.bssid);
 			if (QDF_IS_STATUS_SUCCESS(status)) {
+				/*
+				 * This is temp ifdef will be removed in near
+				 * future
+				 */
+#ifdef FEATURE_CM_ENABLE
+				cm_disconnect(mac->psoc, vdev_id,
+					      CM_MLME_DISCONNECT,
+					      REASON_KEY_TIMEOUT, NULL);
+#else
 				csr_roam_disconnect(mac, vdev_id,
 					eCSR_DISCONNECT_REASON_UNSPECIFIED,
 					REASON_KEY_TIMEOUT);
+#endif
 			}
 		} else {
 			sme_err("session not found");
@@ -15024,9 +15102,11 @@ QDF_STATUS csr_send_mb_disassoc_req_msg(struct mac_context *mac,
 			     bssId, QDF_MAC_ADDR_SIZE);
 	}
 	pMsg->reasonCode = reasonCode;
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	pMsg->process_ho_fail = (pSession->disconnect_reason ==
 		REASON_FW_TRIGGERED_ROAM_FAILURE) ? true : false;
-
+#endif
 	/* Update the disconnect stats */
 	pSession->disconnect_stats.disconnection_cnt++;
 	pSession->disconnect_stats.disconnection_by_app++;
@@ -18328,11 +18408,14 @@ static enum wlan_serialization_cmd_type csr_get_roam_cmd_type(
 	enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX;
 
 	switch (sme_cmd->u.roamCmd.roamReason) {
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	case eCsrForcedDisassoc:
 	case eCsrForcedDeauth:
 	case eCsrForcedDisassocMICFailure:
 		cmd_type = WLAN_SER_CMD_VDEV_DISCONNECT;
 		break;
+#endif
 	case eCsrHddIssued:
 		if (CSR_IS_INFRA_AP(&sme_cmd->u.roamCmd.roamProfile) ||
 		    CSR_IS_NDI(&sme_cmd->u.roamCmd.roamProfile))
@@ -18346,10 +18429,13 @@ static enum wlan_serialization_cmd_type csr_get_roam_cmd_type(
 	case eCsrSmeIssuedReassocToSameAP:
 		cmd_type = WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP;
 		break;
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	case eCsrSmeIssuedDisassocForHandoff:
 		cmd_type =
 			WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF;
 		break;
+#endif
 	case eCsrSmeIssuedAssocToSimilarAP:
 		cmd_type =
 			WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP;
@@ -19088,9 +19174,16 @@ void csr_process_ho_fail_ind(struct mac_context *mac_ctx, void *msg_buf)
 	csr_roam_synch_clean_up(mac_ctx, sessionId);
 	csr_roaming_report_diag_event(mac_ctx, NULL,
 			eCSR_REASON_ROAM_HO_FAIL);
+	/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+	cm_disconnect(mac_ctx->psoc, sessionId,
+		      CM_MLME_DISCONNECT,
+		      REASON_FW_TRIGGERED_ROAM_FAILURE, NULL);
+#else
 	csr_roam_disconnect(mac_ctx, sessionId,
 			eCSR_DISCONNECT_REASON_ROAM_HO_FAIL,
 			REASON_FW_TRIGGERED_ROAM_FAILURE);
+#endif
 	if (mac_ctx->mlme_cfg->gen.fatal_event_trigger)
 		cds_flush_logs(WLAN_LOG_TYPE_FATAL,
 				WLAN_LOG_INDICATOR_HOST_DRIVER,
@@ -20101,10 +20194,18 @@ csr_process_roam_sync_callback(struct mac_context *mac_ctx,
 
 		/* Userspace roam req fail, disconnect with AP */
 		if (vdev_roam_params->source == USERSPACE_INITIATED ||
-		    mac_ctx->nud_fail_behaviour == DISCONNECT_AFTER_ROAM_FAIL)
+		    mac_ctx->nud_fail_behaviour == DISCONNECT_AFTER_ROAM_FAIL) {
+			/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+			cm_disconnect(mac_ctx->psoc, session_id,
+				      CM_ROAM_DISCONNECT,
+				      REASON_USER_TRIGGERED_ROAM_FAILURE, NULL);
+#else
 			csr_roam_disconnect(mac_ctx, session_id,
 				    eCSR_DISCONNECT_REASON_DEAUTH,
 				    REASON_USER_TRIGGERED_ROAM_FAILURE);
+#endif
+		}
 
 		vdev_roam_params->roam_invoke_in_progress = false;
 		goto end;
@@ -20120,9 +20221,16 @@ csr_process_roam_sync_callback(struct mac_context *mac_ctx,
 		 */
 		if (wlan_reg_is_disable_for_freq(mac_ctx->pdev,
 						 roam_synch_data->chan_freq)) {
+			/* This is temp ifdef will be removed in near future */
+#ifdef FEATURE_CM_ENABLE
+			cm_disconnect(mac_ctx->psoc, session_id,
+				      CM_ROAM_DISCONNECT,
+				      REASON_OPER_CHANNEL_BAND_CHANGE, NULL);
+#else
 			csr_roam_disconnect(mac_ctx, session_id,
 					    eCSR_DISCONNECT_REASON_DEAUTH,
 					    REASON_OPER_CHANNEL_BAND_CHANGE);
+#endif
 			sme_debug("Roaming Failed for disabled channel or band");
 			vdev_roam_params->roam_invoke_in_progress = false;
 			goto end;

+ 3 - 0
core/sme/src/csr/csr_host_scan_roam.c

@@ -568,6 +568,8 @@ void csr_neighbor_roam_request_handoff(struct mac_context *mac_ctx,
 
 	sme_debug("csr_roamHandoffRequested: disassociating with current AP");
 
+	/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 	if (!QDF_IS_STATUS_SUCCESS(csr_roam_issue_disassociate_cmd(
 					mac_ctx,
 					session_id,
@@ -577,6 +579,7 @@ void csr_neighbor_roam_request_handoff(struct mac_context *mac_ctx,
 		qdf_mem_free(roam_info);
 		return;
 	}
+#endif
 	/* notify HDD for handoff, providing the BSSID too */
 	roam_info->reasonCode = eCsrRoamReasonBetterAP;
 

+ 7 - 2
core/sme/src/csr/csr_inside_api.h

@@ -112,6 +112,7 @@ struct scan_result_list {
 				     (eCSR_ENCRYPT_TYPE_WEP40 != (encType)) && \
 				       (eCSR_ENCRYPT_TYPE_WEP104 != (encType)))
 
+#ifndef FEATURE_CM_ENABLE
 #define CSR_IS_DISCONNECT_COMMAND(pCommand) ((eSmeCommandRoam == \
 		(pCommand)->command) && \
 		((eCsrForcedDisassoc == (pCommand)->u.roamCmd.roamReason) || \
@@ -120,6 +121,9 @@ struct scan_result_list {
 					(pCommand)->u.roamCmd.roamReason) || \
 					(eCsrForcedDisassocMICFailure == \
 					(pCommand)->u.roamCmd.roamReason)))
+#else
+#define CSR_IS_DISCONNECT_COMMAND(pCommand) false
+#endif
 
 enum csr_roam_state csr_roam_state_change(struct mac_context *mac,
 					  enum csr_roam_state NewRoamState,
@@ -217,11 +221,12 @@ csr_issue_set_context_req_helper(struct mac_context *mac,
 				 bool unicast, tAniKeyDirection key_direction,
 				 uint8_t key_id, uint16_t key_length,
 				 uint8_t *key);
-
+/* This is temp ifdef will be removed in near future */
+#ifndef FEATURE_CM_ENABLE
 QDF_STATUS csr_roam_process_disassoc_deauth(struct mac_context *mac,
 						tSmeCmd *pCommand,
 					    bool fDisassoc, bool fMICFailure);
-
+#endif
 QDF_STATUS
 csr_roam_save_connected_information(struct mac_context *mac,
 				    uint32_t sessionId,