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/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"),