SCAN_OFFLOAD: Sending scan offload request.
Adding data structures and functions to send the start scan
offload request to FW.
Change-Id: Iea920103848436e78eebf126bb421c0ee7defeb7
CRs-fixed: 500914
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index 91873cc..3e75f60 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -4170,4 +4170,38 @@
tANI_U8 channel;
} tAniHandoffReq, *tpAniHandoffReq;
+typedef struct sSirScanOffloadReq {
+ tANI_U8 sessionId;
+ tSirMacAddr bssId;
+ tANI_U8 numSsid;
+ tSirMacSSid ssId[SIR_SCAN_MAX_NUM_SSID];
+ tANI_U8 hiddenSsid;
+ tSirMacAddr selfMacAddr;
+ tSirBssType bssType;
+ tANI_U8 dot11mode;
+ tSirScanType scanType;
+ tANI_U32 minChannelTime;
+ tANI_U32 maxChannelTime;
+ tANI_BOOLEAN p2pSearch;
+ tANI_U16 uIEFieldLen;
+ tANI_U16 uIEFieldOffset;
+ tSirChannelList channelList;
+ /*-----------------------------
+ sSirScanOffloadReq....
+ -----------------------------
+ uIEFieldLen
+ -----------------------------
+ uIEFieldOffset ----+
+ ----------------------------- |
+ channelList.numChannels |
+ ----------------------------- |
+ ... variable size up to |
+ channelNumber[numChannels-1] |
+ This can be zero, if |
+ numChannel is zero. |
+ ----------------------------- <--+
+ ... variable size uIEField
+ up to uIEFieldLen (can be 0)
+ -----------------------------*/
+} tSirScanOffloadReq, *tpSirScanOffloadReq;
#endif /* __SIR_API_H */
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index b4eccfd..cc810d1 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -576,6 +576,14 @@
#define SIR_HAL_TDLS_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 199)
#endif
+#define SIR_HAL_START_SCAN_OFFLOAD_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 197)
+#define SIR_HAL_START_SCAN_OFFLOAD_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 198)
+#define SIR_HAL_UPDATE_CHAN_LIST_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 199)
+#define SIR_HAL_UPDATE_CHAN_LIST_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 200)
+#define SIR_HAL_STOP_SCAN_OFFLOAD_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 201)
+#define SIR_HAL_STOP_SCAN_OFFLOAD_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 202)
+#define SIR_HAL_RX_SCAN_EVENT (SIR_HAL_ITC_MSG_TYPES_BEGIN + 203)
+
#define SIR_HAL_MSG_TYPES_END (SIR_HAL_ITC_MSG_TYPES_BEGIN + 0xFF)
// CFG message types
#define SIR_CFG_MSG_TYPES_BEGIN (SIR_CFG_MODULE_ID << 8)
diff --git a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
index 3196621..67e4f27 100644
--- a/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -1066,6 +1066,89 @@
palCopyMemory(pMac->hHdd, data, (tANI_U8*)random, sizeof(tSirMacAddr));
}
+static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
+ tpSirSmeScanReq pScanReq)
+{
+ tSirScanOffloadReq *pScanOffloadReq;
+ tANI_U8 *p;
+ tSirMsgQ msg;
+ eHalStatus status;
+ tANI_U16 i, len;
+ tSirRetStatus rc = eSIR_SUCCESS;
+
+ /* The tSirScanOffloadReq will reserve the space for first channel,
+ so allocate the memory for (numChannels - 1) and uIEFieldLen */
+ len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
+ pScanReq->uIEFieldLen;
+
+ status = palAllocateMemory(pMac->hHdd, (void **) &pScanOffloadReq, len);
+ if (status != eHAL_STATUS_SUCCESS)
+ {
+ limLog(pMac, LOGE,
+ FL("palAllocateMemory failed for pScanOffloadReq"));
+ return eHAL_STATUS_FAILURE;
+ }
+
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pScanOffloadReq, len);
+
+ msg.type = WDA_START_SCAN_OFFLOAD_REQ;
+ msg.bodyptr = pScanOffloadReq;
+ msg.bodyval = 0;
+
+ palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->bssId,
+ (tANI_U8*) pScanReq->bssId,
+ sizeof(tSirMacAddr));
+
+ if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
+ {
+ limLog(pMac, LOGE,
+ FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
+ return eHAL_STATUS_FAILURE;
+ }
+
+ pScanOffloadReq->numSsid = pScanReq->numSsid;
+ for (i = 0; i < pScanOffloadReq->numSsid; i++)
+ {
+ pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
+ palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
+ (tANI_U8 *) pScanReq->ssId[i].ssId,
+ pScanOffloadReq->ssId[i].length);
+ }
+
+ pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
+ palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->selfMacAddr,
+ (tANI_U8 *) pScanReq->selfMacAddr,
+ sizeof(tSirMacAddr));
+ pScanOffloadReq->bssType = pScanReq->bssType;
+ pScanOffloadReq->dot11mode = pScanReq->dot11mode;
+ pScanOffloadReq->scanType = pScanReq->scanType;
+ pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
+ pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
+ pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
+ pScanOffloadReq->sessionId = pScanReq->sessionId;
+ pScanOffloadReq->channelList.numChannels =
+ pScanReq->channelList.numChannels;
+ p = &(pScanOffloadReq->channelList.channelNumber[0]);
+ for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
+ p[i] = pScanReq->channelList.channelNumber[i];
+
+ pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
+ pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
+ palCopyMemory(pMac->hHdd, (tANI_U8 *) p + i,
+ (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
+ pScanOffloadReq->uIEFieldLen);
+
+ rc = wdaPostCtrlMsg(pMac, &msg);
+ if (rc != eSIR_SUCCESS)
+ {
+ limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"),
+ pMac);
+ palFreeMemory(pMac->hHdd, (void *)pScanOffloadReq);
+ return eHAL_STATUS_FAILURE;
+ }
+
+ return eHAL_STATUS_SUCCESS;
+}
/**
* __limProcessSmeScanReq()
@@ -1163,163 +1246,164 @@
*/
if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
{
- #if 0
- // Update global SME state
- pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
- if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
- (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
- pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
- else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
- pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
- else
-
- #endif //TO SUPPORT BT-AMP
+ if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
+ {
+ // Discard previously cached scan results
+ limReInitScanResults(pMac);
+ }
- /*Change Global SME state */
+ pMac->lim.gLim24Band11dScanDone = 0;
+ pMac->lim.gLim50Band11dScanDone = 0;
+ pMac->lim.gLimReturnAfterFirstMatch =
+ pScanReq->returnAfterFirstMatch;
+ pMac->lim.gLimBackgroundScanMode =
+ pScanReq->backgroundScanMode;
- /* Store the previous SME state */
-
- pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
-
- pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
- MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
-
- if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
- {
- // Discard previously cached scan results
- limReInitScanResults(pMac);
- }
-
- pMac->lim.gLim24Band11dScanDone = 0;
- pMac->lim.gLim50Band11dScanDone = 0;
- pMac->lim.gLimReturnAfterFirstMatch =
- pScanReq->returnAfterFirstMatch;
- pMac->lim.gLimBackgroundScanMode =
- pScanReq->backgroundScanMode;
-
- pMac->lim.gLimReturnUniqueResults =
- ((pScanReq->returnUniqueResults) > 0 ? true : false);
- /* De-activate Heartbeat timers for connected sessions while
- * scan is in progress if the system is in Active mode *
- * AND it is not a ROAMING ("background") scan */
- if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
- (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
- (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
- (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
- {
+ pMac->lim.gLimReturnUniqueResults =
+ ((pScanReq->returnUniqueResults) > 0 ? true : false);
+ /* De-activate Heartbeat timers for connected sessions while
+ * scan is in progress if the system is in Active mode *
+ * AND it is not a ROAMING ("background") scan */
+ if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
+ (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
+ (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
+ (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
+ {
for(i=0;i<pMac->lim.maxBssId;i++)
{
- if((peFindSessionBySessionId(pMac,i) != NULL) &&
- (pMac->lim.gpSession[i].valid == TRUE) &&
- (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
- {
- limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
- }
+ if((peFindSessionBySessionId(pMac,i) != NULL) &&
+ (pMac->lim.gpSession[i].valid == TRUE) &&
+ (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
+ {
+ limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
+ }
}
- }
+ }
- if (pScanReq->channelList.numChannels == 0)
- {
- tANI_U32 cfg_len;
- // Scan all channels
- len = sizeof(tLimMlmScanReq) +
+ if (pMac->fScanOffload)
+ {
+ if (eHAL_STATUS_SUCCESS !=
+ limSendHalStartScanOffloadReq(pMac, pScanReq))
+ {
+ limSendSmeScanRsp(pMac,
+ offsetof(tSirSmeScanRsp, bssDescription[0]),
+ eSIR_SME_INVALID_PARAMETERS,
+ pScanReq->sessionId,
+ pScanReq->transactionId);
+ return;
+ }
+ }
+ else
+ {
+
+ /*Change Global SME state */
+ /* Store the previous SME state */
+ pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+ pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
+ MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
+
+ if (pScanReq->channelList.numChannels == 0)
+ {
+ tANI_U32 cfg_len;
+ // Scan all channels
+ len = sizeof(tLimMlmScanReq) +
(sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
pScanReq->uIEFieldLen;
- if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
- {
- // Log error
- limLog(pMac, LOGP,
- FL("call to palAllocateMemory failed for mlmScanReq (%d)"), len);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmScanReq (%d)"), len);
- return;
- }
+ return;
+ }
- // Initialize this buffer
- palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
+ // Initialize this buffer
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
- cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
- if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
+ cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
pMlmScanReq->channelList.channelNumber,
&cfg_len) != eSIR_SUCCESS)
- {
- /**
- * Could not get Valid channel list from CFG.
- * Log error.
- */
- limLog(pMac, LOGP,
- FL("could not retrieve Valid channel list"));
- }
- pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
- }
- else
- {
- len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
- (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
- pScanReq->uIEFieldLen;
+ {
+ /**
+ * Could not get Valid channel list from CFG.
+ * Log error.
+ */
+ limLog(pMac, LOGP,
+ FL("could not retrieve Valid channel list"));
+ }
+ pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
+ }
+ else
+ {
+ len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
+ (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
+ pScanReq->uIEFieldLen;
- if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
- {
- // Log error
- limLog(pMac, LOGP,
- FL("call to palAllocateMemory failed for mlmScanReq(%d)"), len);
+ if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
+ {
+ // Log error
+ limLog(pMac, LOGP,
+ FL("call to palAllocateMemory failed for mlmScanReq(%d)"), len);
- return;
- }
+ return;
+ }
- // Initialize this buffer
- palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
- pMlmScanReq->channelList.numChannels =
- pScanReq->channelList.numChannels;
+ // Initialize this buffer
+ palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
+ pMlmScanReq->channelList.numChannels =
+ pScanReq->channelList.numChannels;
- palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
- pScanReq->channelList.channelNumber,
- pScanReq->channelList.numChannels);
- }
+ palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
+ pScanReq->channelList.channelNumber,
+ pScanReq->channelList.numChannels);
+ }
- pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
- pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
-
- if(pScanReq->uIEFieldLen)
- {
- palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
- (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
- pScanReq->uIEFieldLen);
- }
+ pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
+ pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
- pMlmScanReq->bssType = pScanReq->bssType;
- palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
- pScanReq->bssId,
- sizeof(tSirMacAddr));
- pMlmScanReq->numSsid = pScanReq->numSsid;
+ if(pScanReq->uIEFieldLen)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
+ (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
+ pScanReq->uIEFieldLen);
+ }
- i = 0;
- while (i < pMlmScanReq->numSsid)
- {
- palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
+ pMlmScanReq->bssType = pScanReq->bssType;
+ palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
+ pScanReq->bssId,
+ sizeof(tSirMacAddr));
+ pMlmScanReq->numSsid = pScanReq->numSsid;
+
+ i = 0;
+ while (i < pMlmScanReq->numSsid)
+ {
+ palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
(tANI_U8 *) &pScanReq->ssId[i],
pScanReq->ssId[i].length + 1);
- i++;
- }
-
+ i++;
+ }
- pMlmScanReq->scanType = pScanReq->scanType;
- pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
- pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
- pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
- pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
- pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
- pMlmScanReq->dot11mode = pScanReq->dot11mode;
- pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
- //Store the smeSessionID and transaction ID for later use.
- pMac->lim.gSmeSessionId = pScanReq->sessionId;
- pMac->lim.gTransactionId = pScanReq->transactionId;
+ pMlmScanReq->scanType = pScanReq->scanType;
+ pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
+ pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
+ pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
+ pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
+ pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
+ pMlmScanReq->dot11mode = pScanReq->dot11mode;
+ pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
- // Issue LIM_MLM_SCAN_REQ to MLM
- limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
+ //Store the smeSessionID and transaction ID for later use.
+ pMac->lim.gSmeSessionId = pScanReq->sessionId;
+ pMac->lim.gTransactionId = pScanReq->transactionId;
- } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
+ // Issue LIM_MLM_SCAN_REQ to MLM
+ limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
+ }
+ } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
else
{
diff --git a/CORE/WDA/inc/wlan_qct_wda.h b/CORE/WDA/inc/wlan_qct_wda.h
index d930d64..3bdb063 100644
--- a/CORE/WDA/inc/wlan_qct_wda.h
+++ b/CORE/WDA/inc/wlan_qct_wda.h
@@ -1071,6 +1071,14 @@
#define WDA_GET_ROAM_RSSI_REQ SIR_HAL_GET_ROAM_RSSI_REQ
#define WDA_GET_ROAM_RSSI_RSP SIR_HAL_GET_ROAM_RSSI_RSP
+#define WDA_START_SCAN_OFFLOAD_REQ SIR_HAL_START_SCAN_OFFLOAD_REQ
+#define WDA_START_SCAN_OFFLOAD_RSP SIR_HAL_START_SCAN_OFFLOAD_RSP
+#define WDA_START_STOP_OFFLOAD_REQ SIR_HAL_STOP_SCAN_OFFLOAD_REQ
+#define WDA_START_STOP_OFFLOAD_RSP SIR_HAL_STOP_SCAN_OFFLOAD_RSP
+#define WDA_UPDATE_CHAN_LIST_REQ SIR_HAL_UPDATE_CHAN_LIST_REQ
+#define WDA_UPDATE_CHAN_LIST_RSP SIR_HAL_UPDATE_CHAN_LIST_RSP
+#define WDA_RX_SCAN_EVENT SIR_HAL_RX_SCAN_EVENT
+
tSirRetStatus wdaPostCtrlMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
eHalStatus WDA_SetRegDomain(void * clientCtxt, v_REGDOMAIN_t regId);