summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKapil Gupta <kapgupta@codeaurora.org>2016-11-24 13:04:48 +0530
committerqcabuildsw <qcabuildsw@localhost>2017-01-04 19:02:45 -0800
commit486f061f516ebcd7886eb42264cb551efaa89163 (patch)
tree7fb25dad04bee92006eff08578c73ee0bd9b493c
parent483f692f321e5c76eadb95ba49ca931a215a9f89 (diff)
qcacld-3.0: Add callback handler for SSID scan request
qcacld-2.0 to qcacld-3.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
-rw-r--r--core/sme/src/csr/csr_api_scan.c65
-rw-r--r--core/sme/src/csr/csr_inside_api.h13
2 files changed, 74 insertions, 4 deletions
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c
index b27d974107aa..ea25d3148872 100644
--- a/core/sme/src/csr/csr_api_scan.c
+++ b/core/sme/src/csr/csr_api_scan.c
@@ -5722,9 +5722,19 @@ void csr_scan_call_callback(tpAniSirGlobal pMac, tSmeCmd *pCommand,
eCsrScanStatus scanStatus)
{
if (pCommand->u.scanCmd.callback) {
+ /*
+ * In case of eCsrScanForSsid scan, scan is aborted as host gets
+ * the desired AP, this doesn't necessaryly mean that scan is
+ * failed, send abort indication to upper layers only if scan
+ * status is not success
+ */
if (pCommand->u.scanCmd.abort_scan_indication) {
- sms_log(pMac, LOG1, FL("scanDone due to abort"));
- scanStatus = eCSR_SCAN_ABORT;
+ if ((pCommand->u.scanCmd.reason != eCsrScanForSsid) ||
+ (scanStatus != eCSR_SCAN_SUCCESS)) {
+ sms_log(pMac, LOG1,
+ FL("scanDone due to abort"));
+ scanStatus = eCSR_SCAN_ABORT;
+ }
}
pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext,
pCommand->sessionId,
@@ -6206,6 +6216,42 @@ static void csr_roam_copy_channellist(tpAniSirGlobal mac_ctx,
}
/**
+ * 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 - QDF_STATUS
+ */
+static QDF_STATUS csr_ssid_scan_done_callback(tHalHandle halHandle,
+ void *context,
+ uint8_t sessionId,
+ uint32_t scanId,
+ eCsrScanStatus status)
+{
+ struct csr_scan_for_ssid_context *scan_context =
+ (struct csr_scan_for_ssid_context *)context;
+
+ if (NULL == scan_context) {
+ QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+ FL("scan for ssid context not found"));
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (eCSR_SCAN_ABORT == status)
+ csr_roam_call_callback(scan_context->mac_ctx,
+ scan_context->session_id,
+ NULL, scan_context->roam_id,
+ eCSR_ROAM_ASSOCIATION_FAILURE,
+ eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE);
+ qdf_mem_free(scan_context);
+ return QDF_STATUS_SUCCESS;
+}
+
+
+/**
* csr_scan_for_ssid() - Function usually used for BSSs that suppresses SSID
* @mac_ctx: Pointer to Global Mac structure
* @profile: pointer to tCsrRoamProfile
@@ -6229,6 +6275,7 @@ QDF_STATUS csr_scan_for_ssid(tpAniSirGlobal mac_ctx, uint32_t session_id,
tpCsrNeighborRoamControlInfo neighbor_roaminfo =
&mac_ctx->roam.neighborRoamInfo[session_id];
tCsrSSIDs *ssids = NULL;
+ struct csr_scan_for_ssid_context *context;
sms_log(mac_ctx, LOG2, FL("called"));
@@ -6258,14 +6305,24 @@ QDF_STATUS csr_scan_for_ssid(tpAniSirGlobal mac_ctx, uint32_t session_id,
scan_cmd->u.scanCmd.pToRoamProfile,
profile);
+ context = qdf_mem_malloc(sizeof(*context));
+ if (NULL == context) {
+ sms_log(mac_ctx, LOGE,
+ "Failed to allocate memory for ssid scan context");
+ goto error;
+ }
+ context->mac_ctx = mac_ctx;
+ context->session_id = session_id;
+ context->roam_id = roam_id;
+
if (!QDF_IS_STATUS_SUCCESS(status))
goto error;
scan_cmd->u.scanCmd.roamId = roam_id;
scan_cmd->command = eSmeCommandScan;
scan_cmd->sessionId = (uint8_t) session_id;
- scan_cmd->u.scanCmd.callback = NULL;
- scan_cmd->u.scanCmd.pContext = NULL;
+ scan_cmd->u.scanCmd.callback = csr_ssid_scan_done_callback;
+ scan_cmd->u.scanCmd.pContext = context;
scan_cmd->u.scanCmd.reason = eCsrScanForSsid;
/* let it wrap around */
diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h
index 08bed5acbcbd..ea634b09112b 100644
--- a/core/sme/src/csr/csr_inside_api.h
+++ b/core/sme/src/csr/csr_inside_api.h
@@ -170,6 +170,19 @@ typedef struct {
tListElem *pCurEntry;
} tScanResultList;
+/**
+ * csr_scan_for_ssid_context() - Callback context for SSID scan
+ *
+ * @mac_ctx: mac context
+ * @session_id: scan session id
+ * @roam_id: roam Id
+ */
+struct csr_scan_for_ssid_context {
+ tpAniSirGlobal mac_ctx;
+ uint32_t session_id;
+ uint32_t roam_id;
+};
+
#define CSR_IS_ROAM_REASON(pCmd, reason) ((reason) == (pCmd)->roamCmd.roamReason)
#define CSR_IS_BETTER_PREFER_VALUE(v1, v2) ((v1) > (v2))
#define CSR_IS_EQUAL_PREFER_VALUE(v1, v2) ((v1) == (v2))