summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <nrawat@qca.qualcomm.com>2016-01-05 10:30:15 -0800
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-01-11 12:23:03 +0530
commitb6955fa8f34e8232dfce9d7e724cd7781eaf62db (patch)
tree86241731048071663f267eb901515e4f53509edd
parent9a23e7413e6065ef2b223beb0f98c4da97aac08e (diff)
qcacld-2.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
-rw-r--r--CORE/MAC/inc/sirApi.h1
-rw-r--r--CORE/MAC/src/pe/include/limGlobal.h1
-rw-r--r--CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c5
-rw-r--r--CORE/MAC/src/pe/lim/limSendSmeRspMessages.c2
-rw-r--r--CORE/SERVICES/WMA/wma.c65
-rw-r--r--CORE/SME/inc/oemDataApi.h4
-rw-r--r--CORE/SME/inc/oemDataInternal.h4
-rw-r--r--CORE/SME/src/oemData/oemDataApi.c24
-rw-r--r--CORE/WDA/inc/legacy/halMsgApi.h3
9 files changed, 86 insertions, 23 deletions
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index d1228a3324d4..ad328adb5b84 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -977,6 +977,7 @@ typedef struct sSirOemDataRsp
{
tANI_U16 messageType;
tANI_U16 length;
+ bool target_rsp;
tANI_U8 oemDataRsp[OEM_DATA_RSP_SIZE];
} tSirOemDataRsp, *tpSirOemDataRsp;
diff --git a/CORE/MAC/src/pe/include/limGlobal.h b/CORE/MAC/src/pe/include/limGlobal.h
index 94807df42c70..322e76167887 100644
--- a/CORE/MAC/src/pe/include/limGlobal.h
+++ b/CORE/MAC/src/pe/include/limGlobal.h
@@ -328,6 +328,7 @@ typedef struct sLimMlmOemDataReq
typedef struct sLimMlmOemDataRsp
{
+ bool target_rsp;
tANI_U8 oemDataRsp[OEM_DATA_RSP_SIZE];
} tLimMlmOemDataRsp, *tpLimMlmOemDataRsp;
#endif
diff --git a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
index ae1c6e580db2..882c30774a59 100644
--- a/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
+++ b/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -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.
*
@@ -1408,6 +1408,8 @@ error:
return;
}
+ pMlmOemDataRsp->target_rsp = false;
+
if(NULL != pMac->lim.gpLimMlmOemDataReq)
{
vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
@@ -2033,6 +2035,7 @@ static void limProcessMlmOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
pMlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
if ( pMlmOemDataRsp != NULL)
{
+ pMlmOemDataRsp->target_rsp = false;
limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
vos_mem_free(pMlmOemDataRsp);
}
diff --git a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index 9a352094f27c..28cb1e779a51 100644
--- a/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -1439,7 +1439,7 @@ void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCode
pSirSmeOemDataRsp->length = msgLength;
pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
#endif
-
+ pSirSmeOemDataRsp->target_rsp = pMlmOemDataRsp->target_rsp;
vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
//Now free the memory from MLM Rsp Message
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index 4283e4b36b16..6686e3398bb3 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -5187,6 +5187,7 @@ static int wma_oem_capability_event_callback(void *handle,
}
vos_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
+ pStartOemDataRsp->target_rsp = true;
msg_subtype = (u_int32_t *)(&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_CAPABILITY_RSP;
vos_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -5239,6 +5240,7 @@ static int wma_oem_measurement_report_event_callback(void *handle,
}
vos_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
+ pStartOemDataRsp->target_rsp = true;
msg_subtype = (u_int32_t *)(&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_MEASUREMENT_RSP;
vos_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -5291,6 +5293,7 @@ static int wma_oem_error_report_event_callback(void *handle,
}
vos_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
+ pStartOemDataRsp->target_rsp = true;
msg_subtype = (u_int32_t *)(&pStartOemDataRsp->oemDataRsp[0]);
*msg_subtype = WMI_OEM_ERROR_REPORT_RSP;
vos_mem_copy(&pStartOemDataRsp->oemDataRsp[4], data, datalen);
@@ -5301,6 +5304,61 @@ static int wma_oem_error_report_event_callback(void *handle,
wma_send_msg(wma, WDA_START_OEM_DATA_RSP, (void *)pStartOemDataRsp, 0);
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
+ */
+static 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 = vos_mem_malloc(sizeof(*oem_data_rsp));
+ if (!oem_data_rsp) {
+ WMA_LOGE(FL("Failed to alloc oem_data_rsp"));
+ return -ENOMEM;
+ }
+
+ vos_mem_zero(oem_data_rsp, sizeof(tStartOemDataRsp));
+ oem_data_rsp->target_rsp = true;
+ vos_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, WDA_START_OEM_DATA_RSP, (void *)oem_data_rsp, 0);
+ return 0;
+}
+
#endif /* FEATURE_OEM_DATA_SUPPORT */
static int wma_p2p_noa_event_handler(void *handle, u_int8_t *event, u_int32_t len)
@@ -6736,6 +6794,9 @@ VOS_STATUS WDA_open(v_VOID_t *vos_context, v_VOID_t *os_ctx,
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
/*
* Register appropriate DFS phyerr event handler for
@@ -22052,7 +22113,6 @@ static void wma_start_oem_data_req(tp_wma_handle wma_handle,
wmi_buf_t buf;
u_int8_t *cmd;
int ret = 0;
- u_int32_t *msg_subtype;
tStartOemDataRsp *pStartOemDataRsp;
WMA_LOGD("%s: Send OEM Data Request to target", __func__);
@@ -22113,8 +22173,7 @@ out:
return;
}
vos_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp));
- msg_subtype = (u_int32_t *)(&pStartOemDataRsp->oemDataRsp[0]);
- *msg_subtype = WMI_OEM_INTERNAL_RSP;
+ pStartOemDataRsp->target_rsp = false;
WMA_LOGI("%s: Sending WDA_START_OEM_DATA_RSP to clear up PE/SME pending cmd",
__func__);
diff --git a/CORE/SME/inc/oemDataApi.h b/CORE/SME/inc/oemDataApi.h
index 80c7af56f884..345574af0833 100644
--- a/CORE/SME/inc/oemDataApi.h
+++ b/CORE/SME/inc/oemDataApi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -137,6 +137,8 @@ eHalStatus oemData_IsOemDataReqAllowed(tHalHandle hHal);
--------------------------------------------------------------------------*/
void send_oem_data_rsp_msg(int length, tANI_U8 *oemDataRsp);
+typedef void (*sme_send_oem_data_rsp_msg)(int length, uint8_t *oem_data_rsp);
+
#endif //_OEM_DATA_API_H__
#endif //FEATURE_OEM_DATA_SUPPORT
diff --git a/CORE/SME/inc/oemDataInternal.h b/CORE/SME/inc/oemDataInternal.h
index ba5612edc183..07fea455d16b 100644
--- a/CORE/SME/inc/oemDataInternal.h
+++ b/CORE/SME/inc/oemDataInternal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014, 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -54,6 +54,8 @@ typedef struct tagOemDataStruct
tANI_U32 oemDataReqID; //original request ID
tOemDataReqConfig oemDataReqConfig; //current oem data request
tANI_U8 sessionId; //Session on which oem data req is active
+ /* callback for sending data response to oem application */
+ sme_send_oem_data_rsp_msg oem_data_rsp_callback;
} tOemDataStruct;
typedef struct tagOemDataCmd
diff --git a/CORE/SME/src/oemData/oemDataApi.c b/CORE/SME/src/oemData/oemDataApi.c
index d0d6df07cc79..c66e85ca46ef 100644
--- a/CORE/SME/src/oemData/oemDataApi.c
+++ b/CORE/SME/src/oemData/oemDataApi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -282,7 +282,6 @@ eHalStatus sme_HandleOemDataRsp(tHalHandle hHal, tANI_U8* pMsg)
tListElem *pEntry = NULL;
tSmeCmd *pCommand = NULL;
tSirOemDataRsp* pOemDataRsp = NULL;
- tANI_U32 *msgSubType;
pMac = PMAC_STRUCT(hHal);
@@ -321,20 +320,15 @@ eHalStatus sme_HandleOemDataRsp(tHalHandle hHal, tANI_U8* pMsg)
pOemDataRsp = (tSirOemDataRsp *)pMsg;
- /* check if message is to be forwarded to oem application or not */
- msgSubType = (tANI_U32 *) (&pOemDataRsp->oemDataRsp[0]);
- if (*msgSubType != OEM_MESSAGE_SUBTYPE_INTERNAL)
- {
- VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
- "%s: calling send_oem_data_rsp_msg, msgSubType(0x%x)",
- __func__, *msgSubType);
- send_oem_data_rsp_msg(sizeof(tOemDataRsp),
- &pOemDataRsp->oemDataRsp[0]);
+ /* Send to upper layer only if rsp is from target */
+ if (pOemDataRsp->target_rsp) {
+ smsLog(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 {
+ smsLog(pMac, LOG1, FL("received internal oem data resp"));
}
- else
- VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
- "%s: received internal oem data resp, msgSubType (0x%x)",
- __func__, *msgSubType);
} while(0);
return status;
diff --git a/CORE/WDA/inc/legacy/halMsgApi.h b/CORE/WDA/inc/legacy/halMsgApi.h
index d1be2a087306..395f21ca1e59 100644
--- a/CORE/WDA/inc/legacy/halMsgApi.h
+++ b/CORE/WDA/inc/legacy/halMsgApi.h
@@ -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.
*
@@ -754,6 +754,7 @@ typedef struct
typedef struct
{
+ bool target_rsp;
tANI_U8 oemDataRsp[OEM_DATA_RSP_SIZE];
} tStartOemDataRsp, *tpStartOemDataRsp;
#endif