prima: Add support for capture TSF request
Add new ioctls for supporting capture and get tsf value from FW
Change-Id: If7df81f75c5939cdd827e95cd53582aee5be46c9
CRs-fixed: 1112993
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index 56ee96a..379e905 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -5837,7 +5837,7 @@
typedef struct
{
tANI_U32 request_id;
- tANI_U8 session_id;
+ tANI_U8 session_id;
tANI_U32 lost_ssid_sample_size;
tANI_U32 ssid_count;
tSirSsidThresholdParam ssid[WLAN_EXTSCAN_MAX_HOTLIST_SSIDS];
@@ -6256,4 +6256,40 @@
#endif /* SAP_AUTH_OFFLOAD */
+/**
+ * struct stsf - the basic stsf structure
+ *
+ * @session_id: session id from adapter
+ * @set_req: set/get request flag.
+ * @tsf_low: low 32bits of tsf
+ * @tsf_high: high 32bits of tsf
+ *
+ * driver use this struct to store the tsf info
+ */
+struct stsf {
+ uint32_t session_id;
+ bool set_tsf_req;
+ uint32_t tsf_low;
+ uint32_t tsf_high;
+ bool tsf_req_status;
+};
+
+typedef int(*tsf_rsp_cb)(void *tsf_ctx, struct stsf *pTsf);
+
+/**
+ * struct tCapTsfParams - capture tsf request
+ * @bss_idx: bss index, SAP/STA
+ * @session_id: adapter session id
+ * @bssid: bssid for SAP/STA
+ * @tsf_rsp_cb_func : handler for tsf rsp from fw
+ * @tsf_rsp_cb_ctx : hdd ctx for tsf rsp handler
+ */
+typedef struct {
+ tANI_U8 bss_idx;
+ tANI_U8 session_id;
+ tSirMacAddr bssid;
+ tsf_rsp_cb tsf_rsp_cb_func;
+ void * tsf_rsp_cb_ctx;
+}tSirCapTsfParams,*tpSirCapTsfParams;
+
#endif /* __SIR_API_H */
diff --git a/CORE/MAC/inc/wniApi.h b/CORE/MAC/inc/wniApi.h
index ff69d7f..718af27 100644
--- a/CORE/MAC/inc/wniApi.h
+++ b/CORE/MAC/inc/wniApi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2013, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013, 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -387,6 +387,8 @@
eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ,
eWNI_SME_DEL_ALL_TDLS_PEERS,
eWNI_SME_REGISTER_MGMT_FRAME_CB,
+ eWNI_SME_CAP_TSF_REQ,
+ eWNI_SME_GET_TSF_REQ,
eWNI_SME_MSG_TYPES_END
};
diff --git a/CORE/MAC/src/include/sirParams.h b/CORE/MAC/src/include/sirParams.h
index bac3ba8..a911c33 100644
--- a/CORE/MAC/src/include/sirParams.h
+++ b/CORE/MAC/src/include/sirParams.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -792,6 +792,9 @@
#define SIR_HAL_AP_FIND_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 300)
#endif/* WLAN_FEATURE_APFIND */
+#define SIR_HAL_CAP_TSF_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 300)
+#define SIR_HAL_GET_TSF_REQ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 301)
+
#define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
// CFG message types
diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c
index e2dd714..24a0fa4 100644
--- a/CORE/MAC/src/pe/lim/limApi.c
+++ b/CORE/MAC/src/pe/lim/limApi.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -2697,3 +2697,105 @@
}
return (status);
}
+/**
+ * lim_process_sme_cap_tsf_req()- send cap tsf request to WDA
+ * Get bss_idx from PE and fill in cap tsf request.
+ * @pMac:Mac ctx
+ * @pMsgBuf: message buffer from sme
+ * Returns success on post to WDA, otherwise failure
+ */
+
+tSirRetStatus lim_process_sme_cap_tsf_req(tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf)
+{
+ tSirCapTsfParams *pMsg = NULL;
+ tpPESession psessionEntry = NULL;
+ uint8_t sessionId;
+ tSirMsgQ msg;
+ tSirCapTsfParams *cap_tsf_params;
+
+ pMsg = (tSirCapTsfParams*)pMsgBuf;
+ if (pMsg == NULL) {
+ limLog(pMac, LOGE, FL("NULL pMsg"));
+ return eSIR_FAILURE;
+ }
+
+ psessionEntry = peFindSessionByBssid(pMac, pMsg->bssid, &sessionId);
+ if (NULL == psessionEntry)
+ {
+ limLog(pMac, LOGE, FL("NULL psessionEntry"));
+ return eSIR_FAILURE;
+ }
+ cap_tsf_params = (tSirCapTsfParams *)
+ vos_mem_malloc(sizeof(*cap_tsf_params));
+ if (!cap_tsf_params) {
+ limLog(pMac, LOGE, FL(" Unable to allocate memory for cap tsf params"));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ vos_mem_copy (cap_tsf_params, pMsg, sizeof(*cap_tsf_params));
+ cap_tsf_params->bss_idx = psessionEntry->bssIdx;
+
+ msg.type = WDA_CAP_TSF_REQ;
+ msg.reserved = 0;
+ msg.bodyptr = cap_tsf_params;
+ msg.bodyval = 0;
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGE, FL("lim_process_sme_cap_tsf_req failed\n"));
+ vos_mem_free(cap_tsf_params);
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+}
+
+/**
+ * lim_process_sme_get_tsf_req()- send get tsf request to WDA
+ * Get bss_idx from PE and fill in cap tsf request.
+ * @pMac:Mac ctx
+ * @pMsgBuf: message buffer from sme
+ * Returns success on post to WDA, otherwise failure
+ */
+tSirRetStatus lim_process_sme_get_tsf_req(tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf)
+{
+ tSirCapTsfParams *pMsg = NULL;
+ tpPESession psessionEntry = NULL;
+ uint8_t sessionId;
+ tSirMsgQ msg;
+ tSirCapTsfParams *get_tsf_params;
+
+ pMsg = (tSirCapTsfParams*)pMsgBuf;
+ if (pMsg == NULL) {
+ limLog(pMac, LOGE, FL("NULL pMsg"));
+ return eSIR_FAILURE;
+ }
+
+ psessionEntry = peFindSessionByBssid(pMac, pMsg->bssid, &sessionId);
+ if (NULL == psessionEntry)
+ {
+ limLog(pMac, LOGE, FL("NULL psessionEntry"));
+ return eSIR_FAILURE;
+ }
+ get_tsf_params = (tSirCapTsfParams *)
+ vos_mem_malloc(sizeof(*get_tsf_params));
+ if (!get_tsf_params) {
+ limLog(pMac, LOGE, FL(" Unable to allocate memory for cap tsf params"));
+ return eSIR_MEM_ALLOC_FAILED;
+ }
+ vos_mem_copy (get_tsf_params, pMsg, sizeof(*get_tsf_params));
+ get_tsf_params->bss_idx = psessionEntry->bssIdx;
+
+ msg.type = WDA_GET_TSF_REQ;
+ msg.reserved = 0;
+ msg.bodyptr = get_tsf_params;
+ msg.bodyval = 0;
+ if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
+ {
+ limLog(pMac, LOGE, FL("lim_process_sme_cap_tsf_req failed\n"));
+ vos_mem_free(get_tsf_params);
+ return eSIR_FAILURE;
+ }
+
+ return eSIR_SUCCESS;
+}
diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index 262a95b..abc8bad 100644
--- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -2496,6 +2496,18 @@
vos_mem_free((v_VOID_t*)limMsg->bodyptr);
limMsg->bodyptr = NULL;
break;
+
+ case eWNI_SME_CAP_TSF_REQ:
+ lim_process_sme_cap_tsf_req(pMac, limMsg->bodyptr);
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
+
+ case eWNI_SME_GET_TSF_REQ:
+ lim_process_sme_get_tsf_req(pMac, limMsg->bodyptr);
+ vos_mem_free((v_VOID_t*)limMsg->bodyptr);
+ limMsg->bodyptr = NULL;
+ break;
default:
vos_mem_free((v_VOID_t*)limMsg->bodyptr);
limMsg->bodyptr = NULL;
diff --git a/CORE/MAC/src/pe/lim/limTypes.h b/CORE/MAC/src/pe/lim/limTypes.h
index a375494..feaf1ed 100644
--- a/CORE/MAC/src/pe/lim/limTypes.h
+++ b/CORE/MAC/src/pe/lim/limTypes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -1072,5 +1072,11 @@
tANI_U32 *pMsgBuf);
tSirRetStatus limProcessSmeDelAllTdlsPeers(tpAniSirGlobal pMac,
tANI_U32 *pMsgBuf);
+
+tSirRetStatus lim_process_sme_cap_tsf_req(tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf);
+
+tSirRetStatus lim_process_sme_get_tsf_req(tpAniSirGlobal pMac,
+ tANI_U32 *pMsgBuf);
#endif /* __LIM_TYPES_H */