qcacld-3.0: Use scan for preauth from LIM in roaming

Use single channel scan request for preauth operation, similar to
remain-on-channel. Remove all roaming preauth logic from WMA.

Change-Id: Ie3783306e0ff5b8a5bbcb6437e982590b03fe040
CRs-Fixed: 957094
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 51f2e11..942b3f7 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -3537,6 +3537,23 @@
 	uint8_t handoff_src;
 } tAniHandoffReq, *tpAniHandoffReq;
 
+/*
+ * @scan_id:
+ * @scan_requestor_id:
+ *     Scan id and scan requestor id are used by firmware to track each scan
+ *     request. A new scan id is generated for each request. Requestor id
+ *     shows the purpose of scan.
+ *
+ * @USER_SCAN_REQUESTOR_ID: Normal scan request from supplicant to HDD/SME.
+ * @ROC_SCAN_REQUESTOR_ID: Remain on channel usage for P2P action frames.
+ * @PREAUTH_REQUESTOR_ID: Used by LIM for preauth operation.
+ *
+ */
+
+#define USER_SCAN_REQUESTOR_ID  0xA000
+#define ROC_SCAN_REQUESTOR_ID   0xB000
+#define PREAUTH_REQUESTOR_ID    0xC000
+
 typedef struct sSirScanOffloadReq {
 	uint8_t sessionId;
 	struct cdf_mac_addr bssId;
@@ -3550,6 +3567,7 @@
 	uint32_t minChannelTime;
 	uint32_t maxChannelTime;
 	uint32_t scan_id;
+	uint32_t scan_requestor_id;
 	/* in units of milliseconds, ignored when not connected */
 	uint32_t restTime;
 	tSirP2pScanType p2pScanType;
diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h
index d1d52cf..e10b3aa 100644
--- a/core/mac/src/pe/include/lim_api.h
+++ b/core/mac/src/pe/include/lim_api.h
@@ -231,19 +231,8 @@
    --------------------------------------------------------------------------*/
 void lim_remain_on_chn_rsp(tpAniSirGlobal pMac, CDF_STATUS status, uint32_t *data);
 
-/*--------------------------------------------------------------------------
-
-   \brief lim_process_abort_scan_ind() - function for sending abort scan indication.
-
-   LIM calls this function for sending abort scan indication.
-
-   \param pMac - Pointer to Global MAC structure
-
-   \return  void
-
-   --------------------------------------------------------------------------*/
 void lim_process_abort_scan_ind(tpAniSirGlobal pMac, uint8_t sessionId,
-	uint32_t scan_id);
+	uint32_t scan_id, uint32_t scan_requestor_id);
 
 void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal, uint32_t, uint32_t *);
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
diff --git a/core/mac/src/pe/include/lim_ft.h b/core/mac/src/pe/include/lim_ft.h
index a0be848..b27e8e7 100644
--- a/core/mac/src/pe/include/lim_ft.h
+++ b/core/mac/src/pe/include/lim_ft.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -62,6 +62,12 @@
 void lim_process_mlm_ft_reassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf,
 				    tpPESession psessionEntry);
 void lim_process_ft_preauth_rsp_timeout(tpAniSirGlobal pMac);
+void lim_preauth_scan_event_handler(tpAniSirGlobal mac_ctx,
+				tSirScanEventType event,
+				uint8_t session_id,
+				uint32_t scan_id);
+tSirRetStatus lim_ft_setup_auth_session(tpAniSirGlobal pMac,
+					tpPESession psessionEntry);
 
 bool lim_process_ft_update_key(tpAniSirGlobal pMac, uint32_t *pMsgBuf);
 tSirRetStatus lim_process_ft_aggr_qos_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf);
@@ -75,6 +81,8 @@
 		uint8_t updateEntry,
 		tpPESession pftSessionEntry,
 		tpSirBssDescription bssDescription);
+CDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
+		uint8_t session_id, tSirFTPreAuthReq *ft_preauth_req);
 #endif /* __LIMFT_H__ */
 
 #endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/core/mac/src/pe/include/lim_ft_defs.h b/core/mac/src/pe/include/lim_ft_defs.h
index 599da6f..09ed064 100644
--- a/core/mac/src/pe/include/lim_ft_defs.h
+++ b/core/mac/src/pe/include/lim_ft_defs.h
@@ -43,6 +43,9 @@
    ------------------------------------------------------------------------*/
 #define MAX_FTIE_SIZE             384   /* Max size limited to 384, on acct. of IW custom events */
 
+/* Time to dwell on preauth channel during roaming, in milliseconds */
+#define LIM_FT_PREAUTH_SCAN_TIME 50
+
 /*--------------------------------------------------------------------------
    Type declarations
    ------------------------------------------------------------------------*/
@@ -61,6 +64,8 @@
 	/* BSSID currently associated to suspend the link */
 	tSirMacAddr currbssId;
 	tSirMacAddr preAuthbssId;       /* BSSID to preauth to */
+	tSirMacAddr self_mac_addr;
+	uint32_t scan_id;
 	uint16_t ft_ies_length;
 	uint8_t ft_ies[MAX_FTIE_SIZE];
 	tpSirBssDescription pbssDescription;
diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c
index e37f09d..119cee4 100644
--- a/core/mac/src/pe/lim/lim_ft.c
+++ b/core/mac/src/pe/lim/lim_ft.c
@@ -47,6 +47,7 @@
 #include <lim_session.h>
 #include <lim_admit_control.h>
 #include "wmm_apsd.h"
+#include "wma.h"
 
 extern void lim_send_set_sta_key_req(tpAniSirGlobal pMac,
 				     tLimMlmSetKeysReq *pMlmSetKeysReq,
@@ -208,43 +209,6 @@
 	cdf_mem_set(&psessionEntry->ftPEContext, sizeof(tftPEContext), 0);
 }
 
-/*------------------------------------------------------------------
- *
- * This is the handler after suspending the link.
- * We suspend the link and then now proceed to switch channel.
- *
- *------------------------------------------------------------------*/
-void static
-lim_ft_pre_auth_suspend_link_handler(tpAniSirGlobal pMac, CDF_STATUS status,
-				     uint32_t *data)
-{
-	tpPESession psessionEntry = (tpPESession) data;
-
-	/* The link is suspended of not */
-	if (NULL == psessionEntry ||
-	    NULL == psessionEntry->ftPEContext.pFTPreAuthReq ||
-	    status != CDF_STATUS_SUCCESS) {
-		PELOGE(lim_log(pMac, LOGE,
-			       FL("preAuth error, status = %d"), status);
-		       )
-		lim_post_ft_pre_auth_rsp(pMac, eSIR_FAILURE, NULL, 0,
-					 psessionEntry);
-		return;
-	}
-
-	/* Suspended, now move to a different channel.
-	 * Perform some sanity check before proceeding
-	 */
-	if (psessionEntry->ftPEContext.pFTPreAuthReq) {
-		lim_change_channel_with_callback(pMac,
-						 psessionEntry->ftPEContext.
-						 pFTPreAuthReq->preAuthchannelNum,
-						 lim_perform_ft_pre_auth, NULL,
-						 psessionEntry);
-		return;
-	}
-}
-
 /*
  * lim_process_ft_pre_auth_req() - process ft pre auth req
  *
@@ -338,8 +302,8 @@
 		lim_log(mac_ctx, LOG2,
 			FL("Performing pre-auth on diff channel(session %p)"),
 			session);
-	lim_ft_pre_auth_suspend_link_handler(mac_ctx, CDF_STATUS_SUCCESS,
-			(uint32_t *)session);
+		lim_send_preauth_scan_offload(mac_ctx, session->peSessionId,
+				session->ftPEContext.pFTPreAuthReq);
 	} else {
 		lim_log(mac_ctx, LOG2,
 			FL("Performing pre-auth on same channel (session %p)"),
@@ -1111,10 +1075,8 @@
  * Resume Link Call Back
  *------------------------------------------------------------------*/
 void lim_ft_process_pre_auth_result(tpAniSirGlobal pMac, CDF_STATUS status,
-				    uint32_t *data)
+				    tpPESession psessionEntry)
 {
-	tpPESession psessionEntry = (tpPESession) data;
-
 	if (NULL == psessionEntry ||
 	    NULL == psessionEntry->ftPEContext.pFTPreAuthReq)
 		return;
@@ -1140,22 +1102,6 @@
 				 psessionEntry);
 }
 
-/*------------------------------------------------------------------
- * Resume Link Call Back
- *------------------------------------------------------------------*/
-void lim_perform_post_ft_pre_auth_and_channel_change(tpAniSirGlobal pMac,
-						     CDF_STATUS status,
-						     uint32_t *data,
-						     tpPESession psessionEntry)
-{
-	/* Set the resume channel to Any valid channel (invalid)
-	 * This will instruct HAL to set it to any previous valid channel.
-	 */
-	pe_set_resume_channel(pMac, 0, 0);
-	lim_ft_process_pre_auth_result(pMac, CDF_STATUS_SUCCESS,
-			(uint32_t *) psessionEntry);
-}
-
 /*
  * lim_post_ft_pre_auth_rsp() - post ft pre auth response to SME.
  *
@@ -1348,10 +1294,9 @@
 	if (psessionEntry->currentOperChannel !=
 	    psessionEntry->ftPEContext.pFTPreAuthReq->preAuthchannelNum) {
 		/* Need to move to the original AP channel */
-		lim_change_channel_with_callback(pMac,
-						 psessionEntry->currentOperChannel,
-						 lim_perform_post_ft_pre_auth_and_channel_change,
-						 NULL, psessionEntry);
+		lim_process_abort_scan_ind(pMac, psessionEntry->peSessionId,
+			psessionEntry->ftPEContext.pFTPreAuthReq->scan_id,
+			PREAUTH_REQUESTOR_ID);
 	} else {
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
 		PELOGE(lim_log(pMac, LOG1,
@@ -1360,8 +1305,7 @@
 			       preAuthchannelNum);
 		       )
 #endif
-		lim_ft_process_pre_auth_result(pMac, status,
-					       (uint32_t *) psessionEntry);
+		lim_ft_process_pre_auth_result(pMac, status, psessionEntry);
 	}
 }
 
@@ -2020,5 +1964,136 @@
 
 	return eSIR_SUCCESS;
 }
+/**
+ * lim_send_preauth_scan_offload() - Send scan command to handle preauth.
+ *
+ * @mac_ctx: Pointer to Global MAC structure
+ * @session_id: pe session id
+ * @ft_preauth_req: Preauth request with parameters
+ *
+ * Builds a single channel scan request and sends it to WMA.
+ * Scan dwell time is the time allocated to go to preauth candidate
+ * channel for auth frame exchange.
+ *
+ * Return: Status of sending message to WMA.
+ */
+CDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
+			uint8_t session_id,
+			tSirFTPreAuthReq *ft_preauth_req)
+{
+	tSirScanOffloadReq *scan_offload_req;
+	tSirRetStatus rc = eSIR_SUCCESS;
+	tSirMsgQ msg;
+
+	scan_offload_req = cdf_mem_malloc(sizeof(tSirScanOffloadReq));
+	if (NULL == scan_offload_req) {
+		lim_log(mac_ctx, LOGE,
+			FL("Memory allocation failed for pScanOffloadReq"));
+		return CDF_STATUS_E_NOMEM;
+	}
+
+	cdf_mem_zero(scan_offload_req, sizeof(tSirScanOffloadReq));
+
+	msg.type = WMA_START_SCAN_OFFLOAD_REQ;
+	msg.bodyptr = scan_offload_req;
+	msg.bodyval = 0;
+
+	cdf_mem_copy((uint8_t *) &scan_offload_req->selfMacAddr.bytes,
+		     (uint8_t *) ft_preauth_req->self_mac_addr,
+		     sizeof(tSirMacAddr));
+
+	cdf_mem_copy((uint8_t *) &scan_offload_req->bssId.bytes,
+		     (uint8_t *) ft_preauth_req->currbssId,
+		     sizeof(tSirMacAddr));
+	scan_offload_req->scanType = eSIR_PASSIVE_SCAN;
+	/*
+	 * P2P_SCAN_TYPE_LISTEN tells firmware to allow mgt frames to/from
+	 * mac address that is not of connected AP.
+	 */
+	scan_offload_req->p2pScanType = P2P_SCAN_TYPE_LISTEN;
+	scan_offload_req->restTime = 0;
+	scan_offload_req->minChannelTime = LIM_FT_PREAUTH_SCAN_TIME;
+	scan_offload_req->maxChannelTime = LIM_FT_PREAUTH_SCAN_TIME;
+	scan_offload_req->sessionId = session_id;
+	scan_offload_req->channelList.numChannels = 1;
+	scan_offload_req->channelList.channelNumber[0] =
+		ft_preauth_req->preAuthchannelNum;
+	wma_get_scan_id(&ft_preauth_req->scan_id);
+	scan_offload_req->scan_id = ft_preauth_req->scan_id;
+	scan_offload_req->scan_requestor_id = PREAUTH_REQUESTOR_ID;
+
+	lim_log(mac_ctx, LOG1,
+		FL("Scan request: duration %u, session %hu, chan %hu"),
+		scan_offload_req->maxChannelTime, session_id,
+		ft_preauth_req->preAuthchannelNum);
+
+	rc = wma_post_ctrl_msg(mac_ctx, &msg);
+	if (rc != eSIR_SUCCESS) {
+		lim_log(mac_ctx, LOGE, FL("START_SCAN_OFFLOAD failed %u"), rc);
+		cdf_mem_free(scan_offload_req);
+		return CDF_STATUS_E_FAILURE;
+	}
+
+	return CDF_STATUS_SUCCESS;
+}
+
+
+/**
+ * lim_preauth_scan_event_handler() - Process firmware preauth scan events
+ *
+ * @mac_ctx:Pointer to global MAC structure
+ * @event: Scan event
+ * @session_id: session entry
+ * @scan_id: scan id from WMA scan event.
+ *
+ * If scan event signifies failure or successful completion, operation
+ * is complete.
+ * If scan event signifies that STA is on foreign channel, send auth frame
+ *
+ * Return: void
+ */
+
+void lim_preauth_scan_event_handler(tpAniSirGlobal mac_ctx,
+				tSirScanEventType event,
+				uint8_t session_id,
+				uint32_t scan_id)
+{
+	tpPESession session_entry;
+
+	session_entry = pe_find_session_by_session_id(mac_ctx, session_id);
+	if (session_entry == NULL) {
+		lim_log(mac_ctx, LOGE,
+			FL("SessionId:%d Session Does not exist"), session_id);
+		return;
+	}
+
+	switch (event) {
+	case SCAN_EVENT_START_FAILED:
+		/* Scan command is rejected by firmware */
+		lim_log(mac_ctx, LOGE, FL("Failed to start preauth scan"));
+		lim_post_ft_pre_auth_rsp(mac_ctx, eSIR_FAILURE, NULL, 0,
+					 session_entry);
+		return;
+
+	case SCAN_EVENT_COMPLETED:
+		/*
+		 * Scan either completed succesfully or or got terminated
+		 * after successful auth, or timed out. Either way, STA
+		 * is back to home channel. Data traffic can continue.
+		 */
+		lim_ft_process_pre_auth_result(mac_ctx, CDF_STATUS_SUCCESS,
+			session_entry);
+		break;
+
+	case SCAN_EVENT_FOREIGN_CHANNEL:
+		/* Sta is on candidate channel. Send auth */
+		lim_perform_ft_pre_auth(mac_ctx, CDF_STATUS_SUCCESS, NULL,
+					session_entry);
+		break;
+	default:
+		/* Don't print message for scan events that are ignored */
+		break;
+	}
+}
 
 #endif /* WLAN_FEATURE_VOWIFI_11R */
diff --git a/core/mac/src/pe/lim/lim_p2p.c b/core/mac/src/pe/lim/lim_p2p.c
index 8a776b9..5e06023 100644
--- a/core/mac/src/pe/lim/lim_p2p.c
+++ b/core/mac/src/pe/lim/lim_p2p.c
@@ -110,6 +110,7 @@
 	pScanOffloadReq->channelList.numChannels = 1;
 	pScanOffloadReq->channelList.channelNumber[0] = pRemOnChnReq->chnNum;
 	pScanOffloadReq->scan_id = pRemOnChnReq->scan_id;
+	pScanOffloadReq->scan_requestor_id = ROC_SCAN_REQUESTOR_ID;
 
 	lim_log(pMac, LOG1,
 		FL("Req-rem-on-channel: duration %u, session %hu, chan %hu"),
@@ -746,7 +747,8 @@
 void lim_abort_remain_on_chan(tpAniSirGlobal pMac, uint8_t sessionId,
 	uint32_t scan_id)
 {
-	lim_process_abort_scan_ind(pMac, sessionId, scan_id);
+	lim_process_abort_scan_ind(pMac, sessionId, scan_id,
+		ROC_SCAN_REQUESTOR_ID);
 }
 
 /* Power Save Related Functions */
@@ -787,3 +789,4 @@
 
 	return eSIR_SUCCESS;
 } /*** end __limProcessSmeGoNegReq() ***/
+
diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c
index bb73132..1158ee3 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -1023,7 +1023,7 @@
  * @return CDF_STATUS_SUCCESS or CDF_STATUS_E_FAILURE
  */
 CDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac,
-	uint8_t SessionId, uint32_t scan_id)
+	uint8_t SessionId, uint32_t scan_id, uint32_t scan_requestor_id)
 {
 	tSirMsgQ msg;
 	tSirRetStatus rc = eSIR_SUCCESS;
@@ -1038,6 +1038,7 @@
 
 	pAbortScanParams->SessionId = SessionId;
 	pAbortScanParams->scan_id = scan_id;
+	pAbortScanParams->scan_requestor_id = scan_requestor_id;
 	msg.type = WMA_STOP_SCAN_OFFLOAD_REQ;
 	msg.bodyptr = pAbortScanParams;
 	msg.bodyval = 0;
@@ -1055,30 +1056,29 @@
 }
 
 /**
- * lim_process_abort_scan_ind()
+ * lim_process_abort_scan_ind() - abort the scan which is presently being run
  *
- ***FUNCTION:
- * This function is called from HDD to abort the scan which is presently being run
+ * @mac_ctx: Pointer to Global MAC structure
+ * @session_id: PE session
+ * @scan_id: Scan ID from the scan request
+ * @scan_requesor_id: Entity requesting the scan
  *
- *
- ***NOTE:
- *
- * @param  pMac      Pointer to Global MAC structure
- * @param  *pMsgBuf  A pointer to the SME message buffer
- * @return None
+ * @return: None
  */
 void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx,
-	uint8_t session_id, uint32_t scan_id)
+	uint8_t session_id, uint32_t scan_id, uint32_t scan_requestor_id)
 {
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
-	lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
+	lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
+		NULL, 0, 0);
 #endif
 
-	lim_log(mac_ctx, LOG2, FL("Processing AbortScan Ind scan_id %d"),
-				 scan_id);
+	lim_log(mac_ctx, LOG2, FL("scan_id %d, scan_requestor_id 0x%x"),
+				 scan_id, scan_requestor_id);
 
-	/* send stop scan cmd to fw if scan offload is enabled. */
-	lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id);
+	/* send stop scan cmd to firmware */
+	lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id,
+		scan_requestor_id);
 	return;
 }
 
@@ -1324,7 +1324,7 @@
 			session_id = req_msg->sessionId;
 			scan_id = req_msg->scan_id;
 			lim_process_abort_scan_ind(mac_ctx, session_id,
-				scan_id);
+				scan_id, USER_SCAN_REQUESTOR_ID);
 			cdf_mem_free((void *)msg->bodyptr);
 			msg->bodyptr = NULL;
 		}
@@ -1386,8 +1386,8 @@
 		break;
 	case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
 		p2p_msg = (tSirMbMsgP2p *) msg->bodyptr;
-		lim_abort_remain_on_chan(mac_ctx, p2p_msg->sessionId,
-			p2p_msg->scan_id);
+		lim_process_abort_scan_ind(mac_ctx, p2p_msg->sessionId,
+			p2p_msg->scan_id, ROC_SCAN_REQUESTOR_ID);
 		cdf_mem_free(msg->bodyptr);
 		msg->bodyptr = NULL;
 		break;
diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
index c64ef91..5cb149b 100644
--- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -4165,13 +4165,14 @@
 	tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
 
 	CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO,
-		  "scan_id = %u", pScanEvent->scanId);
+		  "scan_id = %u, scan_requestor_id 0x%x", pScanEvent->scanId,
+		  pScanEvent->requestor);
 	switch (pScanEvent->event) {
 	case SCAN_EVENT_STARTED:
 		break;
 	case SCAN_EVENT_START_FAILED:
 	case SCAN_EVENT_COMPLETED:
-		if (P2P_SCAN_TYPE_LISTEN == pScanEvent->p2pScanType) {
+		if (ROC_SCAN_REQUESTOR_ID == pScanEvent->requestor) {
 			lim_send_sme_roc_rsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP,
 					 CDF_STATUS_SUCCESS,
 					 pScanEvent->sessionId,
@@ -4190,12 +4191,16 @@
 					pMac->lim.mgmtFrameSessionId, 0);
 				pMac->lim.mgmtFrameSessionId = 0xff;
 			}
+		} else if (PREAUTH_REQUESTOR_ID == pScanEvent->requestor) {
+			lim_preauth_scan_event_handler(pMac, pScanEvent->event,
+					 pScanEvent->sessionId,
+					 pScanEvent->scanId);
 		} else {
 			lim_send_scan_offload_complete(pMac, pScanEvent);
 		}
 		break;
 	case SCAN_EVENT_FOREIGN_CHANNEL:
-		if (P2P_SCAN_TYPE_LISTEN == pScanEvent->p2pScanType) {
+		if (ROC_SCAN_REQUESTOR_ID == pScanEvent->requestor) {
 			/*Send Ready on channel indication to SME */
 			if (pMac->lim.gpLimRemainOnChanReq) {
 				lim_send_sme_roc_rsp(pMac,
@@ -4207,6 +4212,10 @@
 				lim_log(pMac, LOGE,
 					FL("gpLimRemainOnChanReq is NULL"));
 			}
+		} else if (PREAUTH_REQUESTOR_ID == pScanEvent->requestor) {
+			lim_preauth_scan_event_handler(pMac, pScanEvent->event,
+					pScanEvent->sessionId,
+					pScanEvent->scanId);
 		}
 		break;
 	case SCAN_EVENT_BSS_CHANNEL:
diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
index 75dcb30..1bf678e 100644
--- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c
+++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c
@@ -1266,6 +1266,7 @@
 
 	pScanOffloadReq->sessionId = pScanReq->sessionId;
 	pScanOffloadReq->scan_id = pScanReq->scan_id;
+	pScanOffloadReq->scan_requestor_id = USER_SCAN_REQUESTOR_ID;
 
 	if (pScanOffloadReq->sessionId >= pMac->lim.maxBssId)
 		lim_log(pMac, LOGE, FL("Invalid pe sessionID : %d"),
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index 115e779..17cac14 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -17717,6 +17717,8 @@
 		     sizeof(tSirMacAddr));
 	cdf_mem_copy((void *)&pftPreAuthReq->preAuthbssId,
 		     (void *)pBssDescription->bssId, sizeof(tSirMacAddr));
+	cdf_mem_copy((void *)&pftPreAuthReq->self_mac_addr,
+		     (void *)&pSession->selfMacAddr.bytes, sizeof(tSirMacAddr));
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 	if (csr_roam_is11r_assoc(pMac, sessionId) &&
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index d338238..3a76bd4 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -187,9 +187,6 @@
 #define WMA_ROAM_BEACON_WEIGHT_DEFAULT       (14)
 #define WMA_ROAM_OPP_SCAN_PERIOD_DEFAULT     (120000)
 #define WMA_ROAM_OPP_SCAN_AGING_PERIOD_DEFAULT (WMA_ROAM_OPP_SCAN_PERIOD_DEFAULT * 5)
-#define WMA_ROAM_PREAUTH_SCAN_TIME           (50)
-#define WMA_ROAM_PREAUTH_REST_TIME           (0)
-#define WMA_ROAM_PREAUTH_MAX_SCAN_TIME       (10000)
 #define WMA_ROAM_BMISS_FIRST_BCNT_DEFAULT    (10)
 #define WMA_ROAM_BMISS_FINAL_BCNT_DEFAULT    (10)
 #define WMA_ROAM_BMISS_FIRST_BCNT_DEFAULT_P2P (15)
@@ -470,23 +467,6 @@
 };
 #endif /* FEATURE_WLAN_TDLS */
 
-
-/**
- * enum t_wma_roam_preauth_chan_state_t - Roaming preauth channel state
- * @WMA_ROAM_PREAUTH_CHAN_NONE: no preauth in progress
- * @WMA_ROAM_PREAUTH_CHAN_REQUESTED: preaduth channel requested
- * @WMA_ROAM_PREAUTH_ON_CHAN: preauth on channel
- * @WMA_ROAM_PREAUTH_CHAN_CANCEL_REQUESTED: preauth channel cancel requested
- * @WMA_ROAM_PREAUTH_CHAN_COMPLETED: preauth completed
- */
-typedef enum {
-	WMA_ROAM_PREAUTH_CHAN_NONE,
-	WMA_ROAM_PREAUTH_CHAN_REQUESTED,
-	WMA_ROAM_PREAUTH_ON_CHAN,
-	WMA_ROAM_PREAUTH_CHAN_CANCEL_REQUESTED,
-	WMA_ROAM_PREAUTH_CHAN_COMPLETED
-} t_wma_roam_preauth_chan_state_t;
-
 /**
  * struct wma_mem_chunk - memory chunks
  * @vaddr: virtual address
@@ -526,6 +506,7 @@
 	uint32_t scan_id;
 	uint32_t scan_requestor_id;
 	tSirP2pScanType p2p_scan_type;
+	uint32_t chan_freq;
 };
 
 /**
@@ -1131,10 +1112,6 @@
  * @pGetRssiReq: get RSSI request
  * @thermal_mgmt_info: Thermal mitigation related info
  * @roam_offload_enabled: is roam offload enable/disable
- * @roam_preauth_scan_state: roam preauth scan state
- * @roam_preauth_scan_id: roam preauth scan id
- * @roam_preauth_chanfreq: roam preauth channel frequency
- * @roam_preauth_chan_context: roam preauth chan context
  * @ol_ini_info: store ini status of arp offload, ns offload
  * @ssdp: ssdp flag
  * @ibss_started: is IBSS started or not
@@ -1281,10 +1258,6 @@
 	void *pGetRssiReq;
 	t_thermal_mgmt thermal_mgmt_info;
 	bool roam_offload_enabled;
-	t_wma_roam_preauth_chan_state_t roam_preauth_scan_state;
-	uint32_t roam_preauth_scan_id;
-	uint16_t roam_preauth_chanfreq;
-	void *roam_preauth_chan_context;
 	/* Here ol_ini_info is used to store ini
 	 * status of arp offload, ns offload
 	 * and others. Currently 1st bit is used
diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h
index 1dab6fa..5abd40b 100644
--- a/core/wma/inc/wma_if.h
+++ b/core/wma/inc/wma_if.h
@@ -1269,11 +1269,14 @@
 
 /**
  * struct tAbortScanParams - Abort scan parameters
- * @SessionId: session id
+ * @SessionId: PE session id
+ * @scan_id: Scan ID used for original scan request
+ * @scan_requestor_id: Scan requesting entity
  */
 typedef struct sAbortScanParams {
 	uint8_t SessionId;
 	uint32_t scan_id;
+	uint32_t scan_requestor_id;
 } tAbortScanParams, *tpAbortScanParams;
 
 /**
diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c
index 4054fd5..7fa4971 100644
--- a/core/wma/src/wma_data.c
+++ b/core/wma/src/wma_data.c
@@ -2753,8 +2753,8 @@
 	if (tx_flag & HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME)
 		use_6mbps = 1;
 
-	if (wma_handle->roam_preauth_scan_state == WMA_ROAM_PREAUTH_ON_CHAN) {
-		chanfreq = wma_handle->roam_preauth_chanfreq;
+	if (wma_handle->interfaces[vdev_id].scan_info.chan_freq != 0) {
+		chanfreq = wma_handle->interfaces[vdev_id].scan_info.chan_freq;
 		WMA_LOGI("%s: Preauth frame on channel %d", __func__, chanfreq);
 	} else if (pFc->subType == SIR_MAC_MGMT_PROBE_RSP) {
 		chanfreq = wma_handle->interfaces[vdev_id].mhz;
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index d5d0abf..5aaf9d1 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -2727,8 +2727,6 @@
 		params->status = CDF_STATUS_E_TIMEOUT;
 		WMA_LOGA("%s: WMA_SWITCH_CHANNEL_REQ timedout", __func__);
 		wma_send_msg(wma, WMA_SWITCH_CHANNEL_RSP, (void *)params, 0);
-		wma->roam_preauth_chan_context = NULL;
-		wma->roam_preauth_scan_id = -1;
 	} else if (tgt_req->msg_type == WMA_DELETE_BSS_REQ) {
 		tpDeleteBssParams params =
 			(tpDeleteBssParams) tgt_req->user_data;
diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c
index 83c6eaa..7b1291c 100644
--- a/core/wma/src/wma_scan_roam.c
+++ b/core/wma/src/wma_scan_roam.c
@@ -241,8 +241,7 @@
 		cmd->scan_id = scan_req->scan_id;
 	}
 	cmd->scan_priority = WMI_SCAN_PRIORITY_LOW;
-	cmd->scan_req_id = WMA_HOST_SCAN_REQUESTOR_ID_PREFIX |
-			   WMA_DEFAULT_SCAN_REQUESTER_ID;
+	cmd->scan_req_id = scan_req->scan_requestor_id;
 
 	/* Set the scan events which the driver is intereseted to receive */
 	/* TODO: handle all the other flags also */
@@ -562,8 +561,7 @@
 		       WMITLV_TAG_STRUC_wmi_stop_scan_cmd_fixed_param,
 		       WMITLV_GET_STRUCT_TLVLEN(wmi_stop_scan_cmd_fixed_param));
 	cmd->vdev_id = abort_scan_req->SessionId;
-	cmd->requestor = WMA_HOST_SCAN_REQUESTOR_ID_PREFIX |
-			WMA_DEFAULT_SCAN_REQUESTER_ID;
+	cmd->requestor = abort_scan_req->scan_requestor_id;
 	cmd->scan_id = abort_scan_req->scan_id;
 	/* stop the scan with the corresponding scan_id */
 	cmd->req_type = WMI_SCAN_STOP_ONE;
@@ -626,15 +624,6 @@
 
 	/* Save current scan info */
 	cmd = (wmi_start_scan_cmd_fixed_param *) wmi_buf_data(buf);
-	if (msg_type == WMA_CHNL_SWITCH_REQ) {
-		/* Adjust parameters for channel switch scan */
-		cmd->min_rest_time = WMA_ROAM_PREAUTH_REST_TIME;
-		cmd->max_rest_time = WMA_ROAM_PREAUTH_REST_TIME;
-		cmd->max_scan_time = WMA_ROAM_PREAUTH_MAX_SCAN_TIME;
-		cmd->scan_priority = WMI_SCAN_PRIORITY_HIGH;
-		cmd->scan_id = scan_req->scan_id;
-		wma_handle->roam_preauth_scan_id = cmd->scan_id;
-	}
 	if (scan_req->p2pScanType == P2P_SCAN_TYPE_LISTEN)
 		wma_set_p2p_scan_info(wma_handle, cmd->scan_id,
 			 cmd->vdev_id, P2P_SCAN_TYPE_LISTEN);
@@ -680,6 +669,7 @@
 		scan_event->sessionId = scan_req->sessionId;
 		scan_event->p2pScanType = scan_req->p2pScanType;
 		scan_event->scanId = scan_req->scan_id;
+		scan_event->requestor = scan_req->scan_requestor_id;
 		wma_send_msg(wma_handle, WMA_RX_SCAN_EVENT, (void *)scan_event,
 			     0);
 	}
@@ -725,8 +715,10 @@
 		cdf_status = CDF_STATUS_E_FAILURE;
 		goto error;
 	}
-	WMA_LOGE("scan_id %x, vdev_id %x",
-		 abort_scan_req->scan_id, abort_scan_req->SessionId);
+	WMA_LOGE("scan_id 0x%x, scan_requestor_id 0x%x, vdev_id %d",
+		 abort_scan_req->scan_id,
+		 abort_scan_req->scan_requestor_id,
+		 abort_scan_req->SessionId);
 	WMA_LOGI("WMA --> WMI_STOP_SCAN_CMDID");
 
 	return CDF_STATUS_SUCCESS;
@@ -2429,197 +2421,6 @@
 	return cdf_status;
 }
 
-/**
- * wma_roam_preauth_chan_set() - set preauth channel
- * @wma_handle: wma handle
- * @params: switch channel params
- * @vdev_id: vdev id
- *
- * Send a single channel passive scan request
- * to handle set_channel operation for preauth
- *
- * Return: CDF atatus
- */
-CDF_STATUS wma_roam_preauth_chan_set(tp_wma_handle wma_handle,
-				     tpSwitchChannelParams params,
-				     uint8_t vdev_id)
-{
-	CDF_STATUS cdf_status = CDF_STATUS_SUCCESS;
-	tSirScanOffloadReq scan_req;
-	uint8_t bssid[IEEE80211_ADDR_LEN] = {
-					0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-	WMA_LOGI("%s: channel %d", __func__, params->channelNumber);
-
-	/* Check for prior operation in progress */
-	if (wma_handle->roam_preauth_chan_context != NULL) {
-		cdf_status = CDF_STATUS_E_FAILURE;
-		WMA_LOGE("%s: Rejected request. Previous operation in progress",
-			 __func__);
-		goto send_resp;
-	}
-	wma_handle->roam_preauth_chan_context = params;
-
-	/* Prepare a dummy scan request and get the
-	 * wmi_start_scan_cmd_fixed_param structure filled properly
-	 */
-	cdf_mem_zero(&scan_req, sizeof(scan_req));
-	cdf_copy_macaddr((struct cdf_mac_addr *) &scan_req.bssId,
-			 (struct cdf_mac_addr *) bssid);
-	cdf_copy_macaddr((struct cdf_mac_addr *) &scan_req.selfMacAddr,
-			 (struct cdf_mac_addr *) &params->selfStaMacAddr);
-	scan_req.channelList.numChannels = 1;
-	scan_req.channelList.channelNumber[0] = params->channelNumber;
-	scan_req.numSsid = 0;
-	scan_req.minChannelTime = WMA_ROAM_PREAUTH_SCAN_TIME;
-	scan_req.maxChannelTime = WMA_ROAM_PREAUTH_SCAN_TIME;
-	scan_req.scanType = eSIR_PASSIVE_SCAN;
-	scan_req.p2pScanType = P2P_SCAN_TYPE_LISTEN;
-	scan_req.sessionId = vdev_id;
-	wma_get_scan_id(&scan_req.scan_id);
-	wma_handle->roam_preauth_chanfreq =
-		cds_chan_to_freq(params->channelNumber);
-
-	/* set the state in advance before calling wma_start_scan and be ready
-	 * to handle scan events from firmware. Otherwise print statments
-	 * in wma_start_can create a race condition.
-	 */
-	wma_handle->roam_preauth_scan_state = WMA_ROAM_PREAUTH_CHAN_REQUESTED;
-	cdf_status = wma_start_scan(wma_handle, &scan_req, WMA_CHNL_SWITCH_REQ);
-
-	if (cdf_status == CDF_STATUS_SUCCESS)
-		return cdf_status;
-	wma_handle->roam_preauth_scan_state = WMA_ROAM_PREAUTH_CHAN_NONE;
-	/* Failed operation. Safely clear context */
-	wma_handle->roam_preauth_chan_context = NULL;
-
-send_resp:
-	WMA_LOGI("%s: sending WMA_SWITCH_CHANNEL_RSP, status = 0x%x",
-		 __func__, cdf_status);
-	params->chainMask = wma_handle->pdevconfig.txchainmask;
-	params->smpsMode = SMPS_MODE_DISABLED;
-	params->status = cdf_status;
-	wma_send_msg(wma_handle, WMA_SWITCH_CHANNEL_RSP, (void *)params, 0);
-	return cdf_status;
-}
-
-/**
- * wma_roam_preauth_chan_cancel() - cancel preauth scan
- * @wma_handle: wma handle
- * @params: switch channel parameters
- * @vdev_id: vdev id
- *
- * Return: CDF status
- */
-CDF_STATUS wma_roam_preauth_chan_cancel(tp_wma_handle wma_handle,
-					tpSwitchChannelParams params,
-					uint8_t vdev_id)
-{
-	tAbortScanParams abort_scan_req;
-	CDF_STATUS cdf_status = CDF_STATUS_SUCCESS;
-
-	WMA_LOGI("%s: channel %d", __func__, params->channelNumber);
-	/* Check for prior operation in progress */
-	if (wma_handle->roam_preauth_chan_context != NULL) {
-		cdf_status = CDF_STATUS_E_FAILURE;
-		WMA_LOGE("%s: Rejected request. Previous operation in progress",
-			 __func__);
-		goto send_resp;
-	}
-	wma_handle->roam_preauth_chan_context = params;
-
-	abort_scan_req.SessionId = vdev_id;
-	wma_handle->roam_preauth_scan_state =
-		WMA_ROAM_PREAUTH_CHAN_CANCEL_REQUESTED;
-	cdf_status = wma_stop_scan(wma_handle, &abort_scan_req);
-	if (cdf_status == CDF_STATUS_SUCCESS)
-		return cdf_status;
-	/* Failed operation. Safely clear context */
-	wma_handle->roam_preauth_chan_context = NULL;
-
-send_resp:
-	WMA_LOGI("%s: sending WMA_SWITCH_CHANNEL_RSP, status = 0x%x",
-		 __func__, cdf_status);
-	params->chainMask = wma_handle->pdevconfig.txchainmask;
-	params->smpsMode = SMPS_MODE_DISABLED;
-	params->status = cdf_status;
-	wma_send_msg(wma_handle, WMA_SWITCH_CHANNEL_RSP, (void *)params, 0);
-	return cdf_status;
-}
-
-/**
- * wma_roam_preauth_scan_event_handler() - preauth scan event handler
- * @wma_handle: wma handle
- * @vdev_id: vdev id
- * @wmi_event: event data
- *
- * This function handles preauth scan event and send appropriate
- * message to upper layers.
- *
- * Return: none
- */
-void wma_roam_preauth_scan_event_handler(tp_wma_handle wma_handle,
-					 uint8_t vdev_id,
-					 wmi_scan_event_fixed_param *
-					 wmi_event)
-{
-	CDF_STATUS cdf_status = CDF_STATUS_SUCCESS;
-	tSwitchChannelParams *params;
-
-	WMA_LOGI("%s: preauth_scan_state %d, event 0x%x, reason 0x%x",
-		 __func__, wma_handle->roam_preauth_scan_state,
-		 wmi_event->event, wmi_event->reason);
-	switch (wma_handle->roam_preauth_scan_state) {
-	case WMA_ROAM_PREAUTH_CHAN_REQUESTED:
-		if (wmi_event->event & WMI_SCAN_EVENT_FOREIGN_CHANNEL) {
-			/* complete set_chan request */
-			wma_handle->roam_preauth_scan_state =
-				WMA_ROAM_PREAUTH_ON_CHAN;
-			cdf_status = CDF_STATUS_SUCCESS;
-		} else if (wmi_event->event & WMI_SCAN_FINISH_EVENTS) {
-			/* Failed to get preauth channel or finished (unlikely) */
-			wma_handle->roam_preauth_scan_state =
-				WMA_ROAM_PREAUTH_CHAN_NONE;
-			cdf_status = CDF_STATUS_E_FAILURE;
-		} else
-			return;
-		break;
-	case WMA_ROAM_PREAUTH_CHAN_CANCEL_REQUESTED:
-		/* Completed or cancelled, complete set_chan cancel request */
-		wma_handle->roam_preauth_scan_state =
-			WMA_ROAM_PREAUTH_CHAN_NONE;
-		break;
-
-	case WMA_ROAM_PREAUTH_ON_CHAN:
-		if ((wmi_event->event & WMI_SCAN_EVENT_BSS_CHANNEL) ||
-		    (wmi_event->event & WMI_SCAN_FINISH_EVENTS))
-			wma_handle->roam_preauth_scan_state =
-				WMA_ROAM_PREAUTH_CHAN_COMPLETED;
-
-		/* There is no WMA request to complete. Next set channel request will
-		 * look at this state and complete it.
-		 */
-		break;
-	default:
-		WMA_LOGE("%s: unhandled event 0x%x, reason 0x%x",
-			 __func__, wmi_event->event, wmi_event->reason);
-		return;
-	}
-
-	params = (tpSwitchChannelParams) wma_handle->roam_preauth_chan_context;
-	if (params) {
-		WMA_LOGI("%s: sending WMA_SWITCH_CHANNEL_RSP, status = 0x%x",
-			 __func__, cdf_status);
-		params->chainMask = wma_handle->pdevconfig.txchainmask;
-		params->smpsMode = SMPS_MODE_DISABLED;
-		params->status = cdf_status;
-		wma_send_msg(wma_handle, WMA_SWITCH_CHANNEL_RSP, (void *)params,
-			     0);
-		wma_handle->roam_preauth_chan_context = NULL;
-	}
-
-}
-
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 
 /**
@@ -3455,56 +3256,6 @@
 
 	peer = ol_txrx_find_peer_by_addr(pdev, intr[vdev_id].bssid, &peer_id);
 
-	/*
-	 * Roam offload feature is currently supported
-	 * only in STA mode. Other modes still require
-	 * to issue a Vdev Start/Vdev Restart for
-	 * channel change.
-	 */
-	if (((wma->interfaces[vdev_id].type == WMI_VDEV_TYPE_STA) &&
-	     (wma->interfaces[vdev_id].sub_type == 0)) &&
-	    !wma->interfaces[vdev_id].is_channel_switch) {
-
-		if (peer && (peer->state == ol_txrx_peer_state_conn ||
-			     peer->state == ol_txrx_peer_state_auth)) {
-			/* Trying to change channel while connected
-			 * should not invoke VDEV_START.
-			 * Instead, use start scan command in passive
-			 * mode to park station on that channel
-			 */
-			WMA_LOGI("%s: calling set_scan, state 0x%x",
-				 __func__, wma->roam_preauth_scan_state);
-			if (wma->roam_preauth_scan_state ==
-			    WMA_ROAM_PREAUTH_CHAN_NONE) {
-				/* Is channel change required?
-				 */
-				if (cds_chan_to_freq(params->channelNumber) !=
-				    wma->interfaces[vdev_id].mhz) {
-					status = wma_roam_preauth_chan_set(wma,
-									   params,
-									   vdev_id);
-					/* response will be asynchronous */
-					return;
-				}
-			} else if (wma->roam_preauth_scan_state ==
-				   WMA_ROAM_PREAUTH_CHAN_REQUESTED ||
-				   wma->roam_preauth_scan_state ==
-				   WMA_ROAM_PREAUTH_ON_CHAN) {
-				status =
-					wma_roam_preauth_chan_cancel(wma, params,
-								     vdev_id);
-				/* response will be asynchronous */
-				return;
-			} else if (wma->roam_preauth_scan_state ==
-				   WMA_ROAM_PREAUTH_CHAN_COMPLETED) {
-				/* Already back on home channel. Complete the request */
-				wma->roam_preauth_scan_state =
-					WMA_ROAM_PREAUTH_CHAN_NONE;
-				status = CDF_STATUS_SUCCESS;
-			}
-			goto send_resp;
-		}
-	}
 	cdf_mem_zero(&req, sizeof(req));
 	req.vdev_id = vdev_id;
 	msg = wma_fill_vdev_req(wma, req.vdev_id, WMA_CHNL_SWITCH_REQ,
@@ -6812,28 +6563,6 @@
 	vdev_id = wmi_event->vdev_id;
 	scan_id = wma_handle->interfaces[vdev_id].scan_info.scan_id;
 
-	if (wma_handle->roam_preauth_scan_id == wmi_event->scan_id) {
-		/* This is the scan requested by roam preauth set_channel operation */
-
-		if (wmi_event->event & WMI_SCAN_FINISH_EVENTS) {
-			WMA_LOGE("roam scan complete: scan_id 0x%x, vdev_id %d",
-				 wmi_event->scan_id, vdev_id);
-			/*wma_reset_scan_info(wma_handle, vdev_id);*/
-		}
-
-		vdev_id = wmi_event->vdev_id;
-		if (vdev_id >= wma_handle->max_bssid) {
-			WMA_LOGE("%s:Invalid vdev_id %d wmi_event %p", __func__,
-					 vdev_id, wmi_event);
-			return -EFAULT;
-		}
-
-		wma_roam_preauth_scan_event_handler(wma_handle,
-						 vdev_id, wmi_event);
-		return 0;
-
-	}
-
 	scan_event = (tSirScanOffloadEvent *) cdf_mem_malloc
 			     (sizeof(tSirScanOffloadEvent));
 	if (!scan_event) {
@@ -6843,12 +6572,12 @@
 
 	scan_event->event = wmi_event->event;
 
-	WMA_LOGI("WMA <-- wmi_scan_event : event %u, scan_id %u, "
-		 "freq %u, reason %u",
-		 wmi_event->event, wmi_event->scan_id,
+	WMA_LOGI("scan event %u, id 0x%x, requestor 0x%x, freq %u, reason %u",
+		 wmi_event->event, wmi_event->scan_id, wmi_event->requestor,
 		 wmi_event->channel_freq, wmi_event->reason);
 
 	scan_event->scanId = wmi_event->scan_id;
+	scan_event->requestor = wmi_event->requestor;
 	scan_event->chanFreq = wmi_event->channel_freq;
 
 	if (scan_event->scanId ==
@@ -6890,10 +6619,10 @@
 		break;
 	}
 
-	/* Stop the scan completion timeout if the event is WMI_SCAN_EVENT_COMPLETED */
+	/* Stop scan completion timeout if event is WMI_SCAN_EVENT_COMPLETED */
 	if (scan_event->event == (tSirScanEventType) WMI_SCAN_EVENT_COMPLETED) {
-		WMA_LOGE(" scan complete - scan_id 0x%x, vdev_id %d",
-			 wmi_event->scan_id, vdev_id);
+		WMA_LOGE("scan complete:scan_id 0x%x, requestor 0x%x, vdev %d",
+			 wmi_event->scan_id, wmi_event->requestor, vdev_id);
 	}
 
 	wma_send_msg(wma_handle, WMA_RX_SCAN_EVENT, (void *)scan_event, 0);
@@ -6916,14 +6645,16 @@
 {
 	cds_msg_t cds_msg;
 	tSirSmeCandidateFoundInd *candidate_ind;
+	struct scan_param *params;
 
+	params = &wma->interfaces[vdev_id].scan_info;
 	/* abort existing scans from GUI, but not roaming preauth scan */
-	if (wma->interfaces[vdev_id].scan_info.scan_id != 0 &&
-	    (wma->interfaces[vdev_id].scan_info.scan_id &
-	     WMA_HOST_ROAM_SCAN_REQID_PREFIX) !=
-		WMA_HOST_ROAM_SCAN_REQID_PREFIX) {
+	if (params->scan_id != 0 && params->chan_freq == 0 &&
+	    params->scan_requestor_id == USER_SCAN_REQUESTOR_ID) {
 		tAbortScanParams abortScan;
 		abortScan.SessionId = vdev_id;
+		abortScan.scan_id = params->scan_id;
+		abortScan.scan_requestor_id = params->scan_requestor_id;
 		wma_stop_scan(wma, &abortScan);
 	}