wlan: Host driver changes to support batch scan
Host driver changes to support batch scan feature
CRs-fixed: 543172
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index d7affd4..cc5e6ff 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -394,6 +394,13 @@
#else
NULL,
#endif /* FEATURE_WLAN_LPHB */
+
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ WDI_ProcessSetBatchScanReq, /* WDI_SET_BATCH_SCAN_REQ */
+#else
+ NULL,
+#endif /* FEATURE_WLAN_BATCH_SCAN */
+
/*-------------------------------------------------------------------------
Indications
-------------------------------------------------------------------------*/
@@ -408,6 +415,13 @@
#endif
WDI_ProcessAddPeriodicTxPtrnInd, /* WDI_ADD_PERIODIC_TX_PATTERN_IND */
WDI_ProcessDelPeriodicTxPtrnInd, /* WDI_DEL_PERIODIC_TX_PATTERN_IND */
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ WDI_ProcessStopBatchScanInd, /* WDI_STOP_BATCH_SCAN_IND */
+ WDI_ProcessTriggerBatchScanResultInd, /* WDI_TRIGGER_BATCH_SCAN_RESULT_IND */
+#else
+ NULL,
+ NULL,
+#endif /* FEATURE_WLAN_BATCH_SCAN */
};
@@ -591,6 +605,13 @@
#else
NULL,
#endif /* FEATURE_WLAN_LPHB */
+
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ WDI_ProcessSetBatchScanRsp, /* WDI_SET_BATCH_SCAN_RESP */
+#else
+ NULL,
+#endif /*FEATURE_WLAN_BATCH_SCAN*/
+
/*---------------------------------------------------------------------
Indications
---------------------------------------------------------------------*/
@@ -637,6 +658,13 @@
WDI_ProcessIbssPeerInactivityInd, /* WDI_HAL_IBSS_PEER_INACTIVITY_IND */
WDI_ProcessPeriodicTxPtrnFwInd, /* WDI_HAL_PERIODIC_TX_PTRN_FW_IND */
+
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ WDI_ProcessBatchScanResultInd, /* WDI_BATCHSCAN_RESULT_IND */
+#else
+ NULL,
+#endif
+
};
@@ -946,6 +974,11 @@
#ifdef WLAN_FEATURE_11W
CASE_RETURN_STRING( WDI_EXCLUDE_UNENCRYPTED_IND );
#endif
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ CASE_RETURN_STRING( WDI_SET_BATCH_SCAN_REQ);
+ CASE_RETURN_STRING( WDI_STOP_BATCH_SCAN_IND );
+ CASE_RETURN_STRING( WDI_TRIGGER_BATCH_SCAN_RESULT_IND);
+#endif
default:
return "Unknown WDI MessageId";
}
@@ -1049,6 +1082,9 @@
CASE_RETURN_STRING( WDI_SHUTDOWN_RESP );
CASE_RETURN_STRING( WDI_SET_POWER_PARAMS_RESP );
CASE_RETURN_STRING( WDI_GET_ROAM_RSSI_RESP );
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ CASE_RETURN_STRING( WDI_SET_BATCH_SCAN_RESP);
+#endif
default:
return "Unknown WDI MessageId";
}
@@ -22630,6 +22666,15 @@
case WDI_DEL_PERIODIC_TX_PATTERN_IND:
return WLAN_HAL_DEL_PERIODIC_TX_PTRN_IND;
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ case WDI_SET_BATCH_SCAN_REQ:
+ return WLAN_HAL_BATCHSCAN_SET_REQ;
+ case WDI_STOP_BATCH_SCAN_IND:
+ return WLAN_HAL_BATCHSCAN_STOP_IND;
+ case WDI_TRIGGER_BATCH_SCAN_RESULT_IND:
+ return WLAN_HAL_BATCHSCAN_TRIGGER_RESULT_IND;
+#endif
+
default:
return WLAN_HAL_MSG_MAX;
}
@@ -22878,6 +22923,13 @@
case WLAN_HAL_PERIODIC_TX_PTRN_FW_IND:
return WDI_HAL_PERIODIC_TX_PTRN_FW_IND;
+#ifdef FEATURE_WLAN_BATCH_SCAN
+ case WLAN_HAL_BATCHSCAN_SET_RSP:
+ return WDI_SET_BATCH_SCAN_RESP;
+ case WLAN_HAL_BATCHSCAN_RESULT_IND:
+ return WDI_BATCHSCAN_RESULT_IND;
+#endif // FEATURE_WLAN_BATCH_SCAN
+
default:
return eDRIVER_TYPE_MAX;
}
@@ -28345,3 +28397,449 @@
return WDI_STATUS_SUCCESS;
} /*WDI_ProcessIbssPeerInactivityInd*/
+
+#ifdef FEATURE_WLAN_BATCH_SCAN
+
+/**
+ @brief Process stop batch indication from WDA
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessStopBatchScanInd
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ wpt_uint8* pSendBuffer = NULL;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+ WDI_Status wdiStatus;
+ tHalBatchScanStopIndParam *pHalInd = NULL;
+ WDI_StopBatchScanIndType *pWdiInd = NULL;
+
+
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+ "%s", __func__);
+
+ /*-------------------------------------------------------------------------
+ Sanity check
+ -------------------------------------------------------------------------*/
+
+ if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+ pWdiInd = (WDI_StopBatchScanIndType *)pEventData->pEventData;
+ /*-----------------------------------------------------------------------
+ Get message buffer
+ -----------------------------------------------------------------------*/
+
+ if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+ WDI_STOP_BATCH_SCAN_IND,
+ sizeof(tHalBatchScanStopIndParam),
+ &pSendBuffer, &usDataOffset, &usSendSize))||
+ ( usSendSize < (usDataOffset + sizeof(tHalBatchScanStopIndParam))))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "Unable to get send buffer in stop batch scan ind %p ",
+ pEventData);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ pHalInd = (tHalBatchScanStopIndParam *)(pSendBuffer + usDataOffset);
+ pHalInd->param = pWdiInd->param;
+
+ pWDICtx->pReqStatusUserData = NULL;
+ pWDICtx->pfncRspCB = NULL;
+ /*-------------------------------------------------------------------------
+ Send Stop batch scan indication to HAL
+ -------------------------------------------------------------------------*/
+ wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
+ return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
+}
+
+/**
+ @brief This API is called to trigger batch scan results from FW
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessTriggerBatchScanResultInd
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ WDI_Status wdiStatus;
+ wpt_uint8* pSendBuffer = NULL;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+ tHalBatchScanTriggerResultParam *pHalInd = NULL;
+ WDI_TriggerBatchScanResultIndType *pWdiInd = NULL;
+
+
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+ "%s", __func__);
+
+ /*-------------------------------------------------------------------------
+ Sanity check
+ -------------------------------------------------------------------------*/
+
+ if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+ pWdiInd = (WDI_TriggerBatchScanResultIndType *)pEventData->pEventData;
+ /*-----------------------------------------------------------------------
+ Get message buffer
+ -----------------------------------------------------------------------*/
+
+ if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+ WDI_TRIGGER_BATCH_SCAN_RESULT_IND,
+ sizeof(tHalBatchScanTriggerResultParam),
+ &pSendBuffer, &usDataOffset, &usSendSize))||
+ ( usSendSize < (usDataOffset + sizeof(tHalBatchScanTriggerResultParam))))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "Unable to get send buffer in stop batch scan ind %p ",
+ pEventData);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ pHalInd = (tHalBatchScanTriggerResultParam *)(pSendBuffer + usDataOffset);
+ pHalInd->param = pWdiInd->param;
+
+ pWDICtx->pReqStatusUserData = NULL;
+ pWDICtx->pfncRspCB = NULL;
+ /*-------------------------------------------------------------------------
+ Send trigger batch scan result indication to HAL
+ -------------------------------------------------------------------------*/
+ wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
+ return (wdiStatus != WDI_STATUS_SUCCESS) ? wdiStatus:WDI_STATUS_SUCCESS_SYNC;
+}
+
+
+/**
+ @brief Process set batch scan response from FW
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessSetBatchScanRsp
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ WDI_SetBatchScanCb wdiSetBatchScanCb;
+ WDI_SetBatchScanRspType *pSetBatchScanRsp;
+
+ tHalBatchScanSetRspParam *pHalSetBatchScanRsp;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*sanity check*/
+ if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+ ( NULL == pEventData->pEventData))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ wdiSetBatchScanCb = (WDI_SetBatchScanCb)pWDICtx->pfncRspCB;
+ if ( NULL == wdiSetBatchScanCb)
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
+ "%s: call back function is NULL", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ pSetBatchScanRsp = wpalMemoryAllocate(sizeof(WDI_SetBatchScanRspType));
+
+ if (NULL == pSetBatchScanRsp)
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "Failed to allocate memory in set batch scan response %x %x %x ",
+ pWDICtx, pEventData, pEventData->pEventData);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ /*extract response and send it to UMAC*/
+ pHalSetBatchScanRsp = (tHalBatchScanSetRspParam *)pEventData->pEventData;
+
+ pSetBatchScanRsp->nScansToBatch = pHalSetBatchScanRsp->supportedMscan;
+
+ /*Notify UMAC*/
+ wdiSetBatchScanCb(pSetBatchScanRsp, pWDICtx->pRspCBUserData);
+
+ wpalMemoryFree(pSetBatchScanRsp);
+
+ return WDI_STATUS_SUCCESS;
+}/*WDI_ProcessSetBatchScanRsp*/
+
+/**
+ @brief Process batch scan result indication from FW
+
+ @param pWDICtx: pointer to the WLAN DAL context
+ pEventData: pointer to the event information structure
+
+ @see
+ @return Result of the function call
+*/
+WDI_Status
+WDI_ProcessBatchScanResultInd
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ void *pBatchScanResultInd;
+ WDI_LowLevelIndType wdiInd;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*sanity check*/
+ if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
+ ( NULL == pEventData->pEventData))
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "%s: Invalid parameters", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ /*extract response and send it to UMAC*/
+ pBatchScanResultInd = (void *)pEventData->pEventData;
+
+ /*Fill in the indication parameters*/
+ wdiInd.wdiIndicationType = WDI_BATCH_SCAN_RESULT_IND;
+
+ wdiInd.wdiIndicationData.pBatchScanResult = pBatchScanResultInd;
+
+ /*Notify UMAC*/
+ if (pWDICtx->wdiLowLevelIndCB)
+ {
+ pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
+ }
+ else
+ {
+ WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "%s: WDILowLevelIndCb is null", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ return WDI_STATUS_SUCCESS;
+} /*End of WDI_ProcessBatchScanResultInd*/
+
+/**
+ @brief WDI_ProcessSetBatchScanReq -
+ Set batch scan request to FW
+
+ @param pWDICtx : wdi context
+ pEventData : indication data
+
+ @see
+ @return none
+*/
+WDI_Status WDI_ProcessSetBatchScanReq
+(
+ WDI_ControlBlockType* pWDICtx,
+ WDI_EventInfoType* pEventData
+)
+{
+ WDI_SetBatchScanReqType *pWdiReq;
+ WDI_Status wdiStatus;
+ wpt_uint8* pSendBuffer = NULL;
+ wpt_uint16 usDataOffset = 0;
+ wpt_uint16 usSendSize = 0;
+ tHalBatchScanSetParams *pHalReq;
+ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+ /*sanity check*/
+ if ((NULL == pEventData) || (NULL == pEventData->pEventData))
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
+ "%s: Invalid parameters in set batch scan request", __func__);
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+
+ pWdiReq = (WDI_SetBatchScanReqType *)pEventData->pEventData;
+
+
+ /*get message buffer*/
+ if ((WDI_STATUS_SUCCESS != WDI_GetMessageBuffer(pWDICtx,
+ WDI_SET_BATCH_SCAN_REQ,
+ sizeof(tHalBatchScanSetParams),
+ &pSendBuffer, &usDataOffset, &usSendSize))||
+ (usSendSize < (usDataOffset + sizeof(tHalBatchScanSetParams))))
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "Unable to get send buffer for SET_BATCH_SCAN_REQ ");
+ WDI_ASSERT(0);
+ return WDI_STATUS_E_FAILURE;
+ }
+
+ pHalReq = (tHalBatchScanSetParams *)(pSendBuffer + usDataOffset);
+
+ pHalReq->rtt = pWdiReq->rtt;
+ pHalReq->rfBand = pWdiReq->rfBand;
+ pHalReq->bestNetworks = pWdiReq->bestNetwork;
+ pHalReq->scanInterval = pWdiReq->scanFrequency;
+ pHalReq->numScan2Batch = pWdiReq->numberOfScansToBatch;
+
+ /*send set batch scan request to fw*/
+ pWDICtx->pfncRspCB = pEventData->pCBfnc;
+ pWDICtx->pReqStatusUserData = pEventData->pUserData;
+
+ wdiStatus = WDI_SendMsg(pWDICtx, pSendBuffer,
+ usSendSize, pWDICtx->pfncRspCB,
+ pWDICtx->pReqStatusUserData,
+ WDI_SET_BATCH_SCAN_RESP);
+
+ return wdiStatus;
+}
+
+/**
+ @brief WDI_SetBatchScanReq
+ This API is called to set batch scan request in FW
+
+ @param pBatchScanReqParam : pointer to set batch scan re param
+ usrData : Client context
+ setBatchScanRspCb : set batch scan resp callback
+ @see
+ @return SUCCESS or FAIL
+*/
+WDI_Status WDI_SetBatchScanReq
+(
+ void *pBatchScanReqParam,
+ void *usrData,
+ WDI_SetBatchScanCb setBatchScanRspCb
+)
+{
+ WDI_EventInfoType wdiEventData;
+
+ /*sanity check*/
+ if (eWLAN_PAL_FALSE == gWDIInitialized)
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API call before module is initialized - Fail request");
+
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ /* fill in event data and post to the main FSM */
+ wdiEventData.wdiRequest = WDI_SET_BATCH_SCAN_REQ;
+ wdiEventData.pEventData = pBatchScanReqParam;
+ wdiEventData.uEventDataSize = sizeof(WDI_SetBatchScanReqType);
+ wdiEventData.pCBfnc = setBatchScanRspCb;
+ wdiEventData.pUserData = usrData;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief WDI_StopbatchScanInd: Send stop batch scan indication to FW
+
+ @param None
+
+ @see
+
+ @return Status of the request
+*/
+WDI_Status
+WDI_StopBatchScanInd(WDI_StopBatchScanIndType *pWdiReq)
+{
+ WDI_EventInfoType wdiEventData;
+
+ /*-------------------------------------------------------------------------
+ Sanity Check
+ ------------------------------------------------------------------------*/
+ if (eWLAN_PAL_FALSE == gWDIInitialized)
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API call before module is initialized - Fail request!");
+
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ /*-------------------------------------------------------------------------
+ Fill in Event data and post to the Main FSM
+ ------------------------------------------------------------------------*/
+ wdiEventData.wdiRequest = WDI_STOP_BATCH_SCAN_IND;
+ wdiEventData.pEventData = pWdiReq;
+ wdiEventData.uEventDataSize = sizeof(WDI_StopBatchScanIndType);
+ wdiEventData.pCBfnc = NULL;
+ wdiEventData.pUserData = NULL;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+/**
+ @brief WDI_TriggerBatchScanResultInd
+ This API is called to pull batch scan result from FW
+
+ @param pWdiReq : pointer to get batch scan ind param
+ @see
+ @return SUCCESS or FAIL
+*/
+WDI_Status WDI_TriggerBatchScanResultInd
+(
+ WDI_TriggerBatchScanResultIndType *pWdiReq
+)
+{
+ WDI_EventInfoType wdiEventData;
+ /*-------------------------------------------------------------------------
+ Sanity Check
+ ------------------------------------------------------------------------*/
+ if (eWLAN_PAL_FALSE == gWDIInitialized)
+ {
+ WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+ "WDI API call before module is initialized - Fail request!");
+
+ return WDI_STATUS_E_NOT_ALLOWED;
+ }
+
+ /*-------------------------------------------------------------------------
+ Fill in Event data and post to the Main FSM
+ ------------------------------------------------------------------------*/
+ wdiEventData.wdiRequest = WDI_TRIGGER_BATCH_SCAN_RESULT_IND;
+ wdiEventData.pEventData = pWdiReq;
+ wdiEventData.uEventDataSize = sizeof(WDI_TriggerBatchScanResultIndType);
+ wdiEventData.pCBfnc = NULL;
+ wdiEventData.pUserData = NULL;
+
+ return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
+}
+
+#endif /*FEATURE_WLAN_BATCH_SCAN*/