From 569cf70ce7f412141bdfec30d4cde0bf2b01c657 Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Tue, 15 Nov 2016 14:54:13 +0530 Subject: qcacld-2.0: Add callback handler for SSID scan request prima to qcacld-2.0 propagation SSID scan is done as part of join request, if scan aborted it should be informed to HDD otherwise HDD may have incorrect connection state. Add changes to inform scan status using callback handler. Change-Id: Ia2b064a78554a2c0260e0f87609b3e274698f7a4 CRs-Fixed: 1081496 --- CORE/SME/src/csr/csrApiScan.c | 56 +++++++++++++++++++++++++++++++++++++---- CORE/SME/src/csr/csrInsideApi.h | 15 +++++++++-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c index 65a8dc47fa30..ab52745ece21 100644 --- a/CORE/SME/src/csr/csrApiScan.c +++ b/CORE/SME/src/csr/csrApiScan.c @@ -6824,14 +6824,19 @@ void csrScanCallCallback(tpAniSirGlobal pMac, tSmeCmd *pCommand, eCsrScanStatus if(pCommand->u.scanCmd.callback) { if (pCommand->u.scanCmd.abort_scan_indication) { - smsLog(pMac, LOG1, FL("scanDone due to abort")); - scanStatus = eCSR_SCAN_ABORT; + if ((pCommand->u.scanCmd.reason != eCsrScanForSsid) || + (scanStatus != eCSR_SCAN_SUCCESS)) { + smsLog( pMac, LOG1, FL("scanDone due to abort")); + scanStatus = eCSR_SCAN_ABORT; + } } pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, pCommand->sessionId, pCommand->u.scanCmd.scanID, scanStatus); } else { - smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!", __func__, __LINE__); + smsLog(pMac, LOG2, + FL("Callback NULL cmd reason %d"), + pCommand->u.scanCmd.reason); } } @@ -7671,7 +7676,37 @@ eHalStatus csrScanGetBKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId, } #endif /* FEATURE_WLAN_WAPI */ +/** + * csr_ssid_scan_done_callback() - Callback to indicate + * scan is done for ssid scan + * @halHandle: handle to hal + * @context: SSID scan context + * @scanId: Scan id for the scheduled scan + * @status: scan done status + * + * Return - eHalStatus + */ +static eHalStatus csr_ssid_scan_done_callback(tHalHandle halHandle, + void *context, + tANI_U8 sessionId, + tANI_U32 scanId, + eCsrScanStatus status) +{ + struct csr_scan_for_ssid_context *scan_context = + (struct csr_scan_for_ssid_context *)context; + + if (NULL == scan_context) + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + FL("scan for ssid context not found")); + if (eCSR_SCAN_ABORT == status) + csrRoamCallCallback(scan_context->pMac, scan_context->sessionId, + NULL, scan_context->roamId, + eCSR_ROAM_ASSOCIATION_FAILURE, + eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE); + vos_mem_free(scan_context); + return eHAL_STATUS_SUCCESS; +} //This function is usually used for BSSs that suppresses SSID so the profile //shall have one and only one SSID @@ -7684,6 +7719,7 @@ eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi tANI_U32 numSsid = pProfile->SSIDs.numOfSSIDs; tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo[sessionId]; + struct csr_scan_for_ssid_context *context; smsLog(pMac, LOG2, FL("called")); //For WDS, we use the index 0. There must be at least one in there @@ -7711,13 +7747,23 @@ eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi { status = csrRoamCopyProfile(pMac, pScanCmd->u.scanCmd.pToRoamProfile, pProfile); } + context = vos_mem_malloc(sizeof(*context)); + if (NULL == context) + { + smsLog(pMac, LOGE, + "Failed to allocate memory for ssid scan context"); + status = eHAL_STATUS_FAILED_ALLOC; + } if(!HAL_STATUS_SUCCESS(status)) break; + context->pMac = pMac; + context->sessionId = sessionId; + context->roamId = roamId; pScanCmd->u.scanCmd.roamId = roamId; pScanCmd->command = eSmeCommandScan; pScanCmd->sessionId = (tANI_U8)sessionId; - pScanCmd->u.scanCmd.callback = NULL; - pScanCmd->u.scanCmd.pContext = NULL; + pScanCmd->u.scanCmd.callback = csr_ssid_scan_done_callback; + pScanCmd->u.scanCmd.pContext = context; pScanCmd->u.scanCmd.reason = eCsrScanForSsid;//Need to check: might need a new reason for SSID scan for LFR during multisession with p2p pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around vos_mem_set(&pScanCmd->u.scanCmd.u.scanRequest, sizeof(tCsrScanRequest), 0); diff --git a/CORE/SME/src/csr/csrInsideApi.h b/CORE/SME/src/csr/csrInsideApi.h index 570c4a62d64c..0b1def3bfda0 100644 --- a/CORE/SME/src/csr/csrInsideApi.h +++ b/CORE/SME/src/csr/csrInsideApi.h @@ -199,8 +199,19 @@ typedef struct tListElem *pCurEntry; }tScanResultList; - - +/** + * csr_scan_for_ssid_context() - Callback context for SSID scan + * + * @pMac: pMac handle + * @sessionId: scan session id + * @roamId: roam Id + */ +struct csr_scan_for_ssid_context +{ + tpAniSirGlobal pMac; + tANI_U32 sessionId; + tANI_U32 roamId; +}; #define CSR_IS_ROAM_REASON( pCmd, reason ) ( (reason) == (pCmd)->roamCmd.roamReason ) #define CSR_IS_BETTER_PREFER_VALUE(v1, v2) ((v1) > (v2)) -- cgit v1.2.3