qcacld-3.0: Add event handler for oem data response

Add event handler for oem data response event from FW.
Add new boolean member to differentiate the response
generated internally and one coming from the FW.

Change-Id: Ia906c5dcbb7e560fd78ccd96fc47c7801b33aa6a
CRs-Fixed: 942261
此提交包含在:
Krishna Kumaar Natarajan
2015-11-20 13:35:05 -08:00
提交者 Akash Patel
父節點 7b36dbfc44
當前提交 2b72327980
共有 9 個檔案被更改,包括 90 行新增28 行删除

查看文件

@@ -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.
*
@@ -881,6 +881,7 @@ typedef struct sSirOemDataReq {
typedef struct sSirOemDataRsp {
uint16_t messageType;
uint16_t length;
bool target_rsp;
uint8_t oemDataRsp[OEM_DATA_RSP_SIZE];
} tSirOemDataRsp, *tpSirOemDataRsp;

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2015 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.
*
@@ -311,6 +311,7 @@ typedef struct sLimMlmOemDataReq {
} tLimMlmOemDataReq, *tpLimMlmOemDataReq;
typedef struct sLimMlmOemDataRsp {
bool target_rsp;
uint8_t oemDataRsp[OEM_DATA_RSP_SIZE];
} tLimMlmOemDataRsp, *tpLimMlmOemDataRsp;
#endif

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2015 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.
*
@@ -421,6 +421,7 @@ error:
("memory allocation for mlm_oem_data_rsp"));
return;
}
mlm_oem_data_rsp->target_rsp = false;
if (NULL != mac_ctx->lim.gpLimMlmOemDataReq) {
cdf_mem_free(mac_ctx->lim.gpLimMlmOemDataReq);
@@ -822,6 +823,7 @@ static void lim_process_mlm_oem_data_req(tpAniSirGlobal mac_ctx,
/* Return Meas confirm with INVALID_PARAMETERS */
mlm_oem_data_rsp = cdf_mem_malloc(sizeof(tLimMlmOemDataRsp));
if (mlm_oem_data_rsp != NULL) {
mlm_oem_data_rsp->target_rsp = false;
lim_post_sme_message(mac_ctx, LIM_MLM_OEM_DATA_CNF,
(uint32_t *) mlm_oem_data_rsp);
cdf_mem_free(mlm_oem_data_rsp);

查看文件

@@ -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.
*
@@ -844,7 +844,7 @@ void lim_send_sme_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *pMsgBuf,
pSirSmeOemDataRsp->length = msgLength;
pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
#endif
pSirSmeOemDataRsp->target_rsp = pMlmOemDataRsp->target_rsp;
cdf_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp,
OEM_DATA_RSP_SIZE);

查看文件

@@ -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.
*
@@ -290,7 +290,6 @@ CDF_STATUS sme_handle_oem_data_rsp(tHalHandle hHal, uint8_t *pMsg)
tListElem *pEntry = NULL;
tSmeCmd *pCommand = NULL;
tSirOemDataRsp *pOemDataRsp = NULL;
uint32_t *msgSubType;
pMac = PMAC_STRUCT(hHal);
@@ -326,21 +325,18 @@ CDF_STATUS sme_handle_oem_data_rsp(tHalHandle hHal, uint8_t *pMsg)
pOemDataRsp = (tSirOemDataRsp *) pMsg;
/* check if message is to be forwarded to oem application or not */
msgSubType = (uint32_t *) (&pOemDataRsp->oemDataRsp[0]);
if (*msgSubType != OEM_MESSAGE_SUBTYPE_INTERNAL) {
CDF_TRACE(CDF_MODULE_ID_SME, CDF_TRACE_LEVEL_INFO,
"%s: calling send_oem_data_rsp_msg, msgSubType(0x%x)",
__func__, *msgSubType);
if (pMac->oemData.oem_data_rsp_callback != NULL) {
pMac->oemData.oem_data_rsp_callback(
sizeof(tOemDataRsp),
&pOemDataRsp->oemDataRsp[0]);
}
} else
CDF_TRACE(CDF_MODULE_ID_SME, CDF_TRACE_LEVEL_INFO,
"%s: received internal oem data resp, msgSubType (0x%x)",
__func__, *msgSubType);
/* Send to upper layer only if rsp is from target */
if (pOemDataRsp->target_rsp) {
sms_log(pMac, LOG1,
FL("received target oem data resp"));
if (pMac->oemData.oem_data_rsp_callback != NULL)
pMac->oemData.oem_data_rsp_callback(
sizeof(tOemDataRsp),
&pOemDataRsp->oemDataRsp[0]);
} else {
sms_log(pMac, LOG1,
FL("received internal oem data resp"));
}
} while (0);
return status;

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2015 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.
*
@@ -688,6 +688,7 @@ typedef struct {
* @oemDataRsp: OEM Data response
*/
typedef struct {
bool target_rsp;
uint8_t oemDataRsp[OEM_DATA_RSP_SIZE];
} tStartOemDataRsp, *tpStartOemDataRsp;
#endif /* FEATURE_OEM_DATA_SUPPORT */

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -910,6 +910,9 @@ int wma_oem_measurement_report_event_callback(void *handle, uint8_t *datap,
int wma_oem_error_report_event_callback(void *handle, uint8_t *datap,
uint32_t len);
int wma_oem_data_response_handler(void *handle, uint8_t *datap,
uint32_t len);
#endif
void wma_register_dfs_event_handler(tp_wma_handle wma_handle);

查看文件

@@ -1699,6 +1699,7 @@ int wma_oem_capability_event_callback(void *handle,
}
cdf_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
pStartOemDataRsp->target_rsp = true;
msg_subtype = (uint32_t *) (&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_CAPABILITY_RSP;
cdf_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -1760,6 +1761,7 @@ int wma_oem_measurement_report_event_callback(void *handle,
}
cdf_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
pStartOemDataRsp->target_rsp = true;
msg_subtype = (uint32_t *) (&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_MEASUREMENT_RSP;
cdf_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -1820,6 +1822,7 @@ int wma_oem_error_report_event_callback(void *handle,
}
cdf_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
pStartOemDataRsp->target_rsp = true;
msg_subtype = (uint32_t *) (&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_ERROR_REPORT_RSP;
cdf_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -1831,6 +1834,59 @@ int wma_oem_error_report_event_callback(void *handle,
return 0;
}
/**
* wma_oem_data_response_handler() - OEM data response event handler
* @handle: wma handle
* @datap: data ptr
* @len: data length
*
* Return: 0 for success or error code
*/
int wma_oem_data_response_handler(void *handle,
uint8_t *datap, uint32_t len)
{
tp_wma_handle wma = (tp_wma_handle) handle;
WMI_OEM_RESPONSE_EVENTID_param_tlvs *param_buf;
uint8_t *data;
uint32_t datalen;
tStartOemDataRsp *oem_data_rsp;
param_buf = (WMI_OEM_RESPONSE_EVENTID_param_tlvs *) datap;
if (!param_buf) {
WMA_LOGE(FL("Received NULL buf ptr from FW"));
return -ENOMEM;
}
data = param_buf->data;
datalen = param_buf->num_data;
if (!data) {
WMA_LOGE(FL("Received NULL data from FW"));
return -EINVAL;
}
if (datalen > OEM_DATA_RSP_SIZE) {
WMA_LOGE(FL("Received data len %d exceeds max value %d"),
datalen, OEM_DATA_RSP_SIZE);
return -EINVAL;
}
oem_data_rsp = cdf_mem_malloc(sizeof(*oem_data_rsp));
if (!oem_data_rsp) {
WMA_LOGE(FL("Failed to alloc oem_data_rsp"));
return -ENOMEM;
}
cdf_mem_zero(oem_data_rsp, sizeof(tStartOemDataRsp));
oem_data_rsp->target_rsp = true;
cdf_mem_copy(&oem_data_rsp->oemDataRsp[0], data, datalen);
WMA_LOGI(FL("Sending WMA_START_OEM_DATA_RSP, data len %d"), datalen);
wma_send_msg(wma, WMA_START_OEM_DATA_RSP, (void *)oem_data_rsp, 0);
return 0;
}
/**
* wma_start_oem_data_req() - start OEM data request to target
* @wma_handle: wma handle
@@ -1844,7 +1900,6 @@ void wma_start_oem_data_req(tp_wma_handle wma_handle,
wmi_buf_t buf;
uint8_t *cmd;
int ret = 0;
uint32_t *msg_subtype;
tStartOemDataRsp *pStartOemDataRsp;
WMA_LOGD("%s: Send OEM Data Request to target", __func__);
@@ -1903,8 +1958,7 @@ out:
return;
}
cdf_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
msg_subtype = (uint32_t *) (&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_INTERNAL_RSP;
pStartOemDataRsp->target_rsp = false;
WMA_LOGI("%s: Sending WMA_START_OEM_DATA_RSP to clear up PE/SME pending cmd",
__func__);

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -1817,6 +1817,10 @@ CDF_STATUS wma_open(void *cds_context,
wmi_unified_register_event_handler(wma_handle->wmi_handle,
WMI_OEM_ERROR_REPORT_EVENTID,
wma_oem_error_report_event_callback);
wmi_unified_register_event_handler(wma_handle->wmi_handle,
WMI_OEM_RESPONSE_EVENTID,
wma_oem_data_response_handler);
#endif /* FEATURE_OEM_DATA_SUPPORT */
/*
* Register appropriate DFS phyerr event handler for