diff --git a/core/bmi/inc/ol_fw.h b/core/bmi/inc/ol_fw.h index 5243228970cf..fa03f1d1a291 100644 --- a/core/bmi/inc/ol_fw.h +++ b/core/bmi/inc/ol_fw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -28,9 +28,7 @@ #ifndef _OL_FW_H_ #define _OL_FW_H_ -#ifdef QCA_WIFI_FTM #include "qdf_types.h" -#endif #include "hif.h" #include "hif_hw_version.h" #include "bmi.h" diff --git a/core/hdd/inc/wlan_hdd_ftm.h b/core/hdd/inc/wlan_hdd_ftm.h index 5f9308138123..02795de9a47b 100644 --- a/core/hdd/inc/wlan_hdd_ftm.h +++ b/core/hdd/inc/wlan_hdd_ftm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -42,12 +42,14 @@ struct hdd_context; -int hdd_update_cds_config_ftm(struct hdd_context *hdd_ctx); -void hdd_ftm_mc_process_msg(void *message); #if defined(QCA_WIFI_FTM) -QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len); int wlan_hdd_qcmbr_unified_ioctl(struct hdd_adapter *adapter, struct ifreq *ifr); -#endif - -#endif +int hdd_update_cds_config_ftm(struct hdd_context *hdd_ctx); +#else +static inline int hdd_update_cds_config_ftm(struct hdd_context *hdd_ctx) +{ + return 0; +} +#endif /* QCA_WIFI_FTM */ +#endif /* WLAN_HDD_FTM_H */ diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 97550d3d4b39..a9e205fc50f2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -13846,21 +13846,6 @@ int wlan_hdd_cfg80211_init(struct device *dev, hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg); wlan_hdd_cfg80211_add_connected_pno_support(wiphy); -#if defined QCA_WIFI_FTM - if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { -#endif - - /* even with WIPHY_FLAG_CUSTOM_REGULATORY, - * driver can still register regulatory callback and - * it will get regulatory settings in wiphy->band[], but - * driver need to determine what to do with both - * regulatory settings - */ - -#if defined QCA_WIFI_FTM - } -#endif - wiphy->max_scan_ssids = MAX_SCAN_SSID; wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; @@ -20500,51 +20485,6 @@ static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, return ret; } -#if defined(QCA_WIFI_FTM) -/** - * wlan_hdd_testmode_rx_event() - test mode rx event handler - * @buf: Pointer to buffer - * @buf_len: Buffer length - * - * Return: none - */ -void wlan_hdd_testmode_rx_event(void *buf, size_t buf_len) -{ - struct sk_buff *skb; - struct hdd_context *hdd_ctx; - - if (!buf || !buf_len) { - hdd_err("buf or buf_len invalid, buf: %pK buf_len: %zu", buf, buf_len); - return; - } - - hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - if (!hdd_ctx) { - hdd_err("hdd context invalid"); - return; - } - - skb = cfg80211_testmode_alloc_event_skb(hdd_ctx->wiphy, - buf_len, GFP_KERNEL); - if (!skb) { - hdd_err("failed to allocate testmode rx skb!"); - return; - } - - if (nla_put_u32(skb, WLAN_HDD_TM_ATTR_CMD, WLAN_HDD_TM_CMD_WLAN_FTM) || - nla_put(skb, WLAN_HDD_TM_ATTR_DATA, buf_len, buf)) - goto nla_put_failure; - - hdd_debug("****FTM Rx cmd len = %zu*****", buf_len); - - cfg80211_testmode_event(skb, GFP_KERNEL); - return; - -nla_put_failure: - kfree_skb(skb); - hdd_err("nla_put failed on testmode rx skb!"); -} -#endif #endif /* CONFIG_NL80211_TESTMODE */ #ifdef QCA_HT_2040_COEX diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index fbbf908f5b55..9454b1185edb 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -348,11 +348,6 @@ int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, #endif #endif /* USE_CFG80211_DEL_STA_V2 */ - -#if defined(QCA_WIFI_FTM) && defined(CONFIG_NL80211_TESTMODE) -void wlan_hdd_testmode_rx_event(void *buf, size_t buf_len); -#endif - int wlan_hdd_send_avoid_freq_event(struct hdd_context *hdd_ctx, struct ch_avoid_ind_type *avoid_freq_list); diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index 46fba907d8fe..e61241c8d49b 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -49,20 +49,12 @@ #include "wma_types.h" #include "cfg_api.h" -#if defined(QCA_WIFI_FTM) -#include "bmi.h" -#include "ol_fw.h" +#ifdef QCA_WIFI_FTM + #include "wlan_hdd_cfg80211.h" #include "hif.h" #include -#endif -#define HDD_FTM_WMA_PRE_START_TIMEOUT (30000) /* 30 seconds */ - -#if defined(QCA_WIFI_FTM) -#if defined(LINUX_QCMBR) -#define ATH_XIOCTL_UNIFIED_UTF_CMD 0x1000 -#define ATH_XIOCTL_UNIFIED_UTF_RSP 0x1001 #define MAX_UTF_LENGTH 1024 struct qcmbr_data { unsigned int cmd; @@ -70,45 +62,6 @@ struct qcmbr_data { unsigned char buf[MAX_UTF_LENGTH + 4]; unsigned int copy_to_user; }; -struct qcmbr_queue { - unsigned char utf_buf[MAX_UTF_LENGTH + 4]; - struct list_head list; -}; -LIST_HEAD(qcmbr_queue_head); -DEFINE_SPINLOCK(qcmbr_queue_lock); -static void wlanqcmbr_mc_process_msg(void *message); -#endif -#endif - -/** - * wlan_ftm_postmsg() - Post FTM message - * @cmd_ptr: Pointer to FTM command buffer - * @cmd_len: Length of command in @cmd_ptr - * - * This function is used to send FTM commands to firmware - * - * Return: 0 for success, non zero for failure - */ -static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len) -{ - struct scheduler_msg ftmMsg = {0}; - - ENTER(); - - ftmMsg.type = WMA_FTM_CMD_REQ; - ftmMsg.reserved = 0; - ftmMsg.bodyptr = (uint8_t *) cmd_ptr; - ftmMsg.bodyval = 0; - - if (QDF_STATUS_SUCCESS != scheduler_post_msg(QDF_MODULE_ID_WMA, - &ftmMsg)) { - hdd_err("Failed to post Msg to HAL"); - return QDF_STATUS_E_FAILURE; - } - - EXIT(); - return QDF_STATUS_SUCCESS; -} /** * hdd_update_cds_config_ftm() - API to update cds configuration parameters @@ -138,65 +91,9 @@ int hdd_update_cds_config_ftm(struct hdd_context *hdd_ctx) return 0; } -/** - * hdd_ftm_mc_process_msg() - Process FTM mailbox message - * @message: FTM response message - * - * Process FTM mailbox message - * - * Return: void - */ -void hdd_ftm_mc_process_msg(void *message) -{ - void *data; - uint32_t data_len; - - if (!message) { - hdd_debug("Message is NULL, nothing to process"); - return; - } - - data_len = *((uint32_t *) message); - data = (uint32_t *) message + 1; - -#if defined(LINUX_QCMBR) - wlanqcmbr_mc_process_msg(message); -#else -#ifdef CONFIG_NL80211_TESTMODE - wlan_hdd_testmode_rx_event(data, (size_t) data_len); -#endif -#endif -} - -#if defined(QCA_WIFI_FTM) -#if defined(LINUX_QCMBR) -/** - * wlan_hdd_qcmbr_command() - QCMBR command handler - * @adapter: adapter upon which the command was received - * @pqcmbr_data: QCMBR command - * - * Return: 0 on success, non-zero on error - */ -static int wlan_hdd_qcmbr_command(struct hdd_adapter *adapter, - struct qcmbr_data *pqcmbr_data) -{ - int ret = 0; - struct hdd_context *hdd_ctx; - - hdd_ctx = WLAN_HDD_GET_CTX(adapter); - ret = wlan_hdd_validate_context(hdd_ctx); - if (ret) - return ret; - - ret = wlan_ioctl_ftm_testmode_cmd(hdd_ctx->hdd_pdev, - pqcmbr_data->cmd, - pqcmbr_data->buf, - pqcmbr_data->length); - - return ret; -} - +#ifdef LINUX_QCMBR #ifdef CONFIG_COMPAT + /** * wlan_hdd_qcmbr_ioctl() - Compatability-mode QCMBR ioctl handler * @adapter: adapter upon which the ioctl was received @@ -237,6 +134,32 @@ static int wlan_hdd_qcmbr_compat_ioctl(struct hdd_adapter *adapter, } #endif /* CONFIG_COMPAT */ +/** + * wlan_hdd_qcmbr_command() - QCMBR command handler + * @adapter: adapter upon which the command was received + * @pqcmbr_data: QCMBR command + * + * Return: 0 on success, non-zero on error + */ +static int wlan_hdd_qcmbr_command(struct hdd_adapter *adapter, + struct qcmbr_data *pqcmbr_data) +{ + int ret = 0; + struct hdd_context *hdd_ctx; + + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) + return ret; + + ret = wlan_ioctl_ftm_testmode_cmd(hdd_ctx->hdd_pdev, + pqcmbr_data->cmd, + pqcmbr_data->buf, + pqcmbr_data->length); + + return ret; +} + /** * wlan_hdd_qcmbr_ioctl() - Standard QCMBR ioctl handler * @adapter: adapter upon which the ioctl was received @@ -289,67 +212,5 @@ int wlan_hdd_qcmbr_unified_ioctl(struct hdd_adapter *adapter, return ret; } -/** - * wlanqcmbr_mc_process_msg() - Process QCMBR response message - * @message: QCMBR message - * - * Return: None - */ -static void wlanqcmbr_mc_process_msg(void *message) -{ - struct qcmbr_queue *qcmbr_buf = NULL; - uint32_t data_len; - - data_len = *((uint32_t *) message) + sizeof(uint32_t); - if (data_len > MAX_UTF_LENGTH + 4) - return; - - qcmbr_buf = qdf_mem_malloc(sizeof(*qcmbr_buf)); - if (qcmbr_buf != NULL) { - memcpy(qcmbr_buf->utf_buf, message, data_len); - spin_lock_bh(&qcmbr_queue_lock); - list_add_tail(&(qcmbr_buf->list), &qcmbr_queue_head); - spin_unlock_bh(&qcmbr_queue_lock); - } -} -#endif /*LINUX_QCMBR */ - -/** - * wlan_hdd_ftm_testmode_cmd() - Process FTM testmode command - * @data: FTM testmode command - * @len: length of @data - * - * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error - */ -QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len) -{ - struct ar6k_testmode_cmd_data *cmd_data; - - cmd_data = (struct ar6k_testmode_cmd_data *) - qdf_mem_malloc(sizeof(*cmd_data)); - - if (!cmd_data) { - hdd_err("Failed to allocate FTM command data"); - return QDF_STATUS_E_NOMEM; - } - - cmd_data->data = qdf_mem_malloc(len); - - if (!cmd_data->data) { - hdd_err("Failed to allocate FTM command data buffer"); - qdf_mem_free(cmd_data); - return QDF_STATUS_E_NOMEM; - } - - cmd_data->len = len; - qdf_mem_copy(cmd_data->data, data, len); - - if (wlan_ftm_postmsg((uint8_t *) cmd_data, sizeof(*cmd_data))) { - qdf_mem_free(cmd_data->data); - qdf_mem_free(cmd_data); - return QDF_STATUS_E_FAILURE; - } - - return QDF_STATUS_SUCCESS; -} -#endif /*QCA_WIFI_FTM */ +#endif /* LINUX_QCMBR */ +#endif /* QCA_WIFI_FTM */ diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 124f5343e280..87ad81f6dd17 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -788,10 +788,6 @@ struct sir_mgmt_msg { #define SIR_MNT_RELEASE_BD (SIR_MNT_MSG_TYPES_BEGIN + 0) #define SIR_MNT_MSG_TYPES_END (SIR_MNT_MSG_TYPES_BEGIN + 0xFF) -/* PTT message types */ -#define SIR_PTT_MSG_TYPES_BEGIN 0x3000 -#define SIR_PTT_MSG_TYPES_END 0x3300 - /* ****************************************** * * * * EVENT TYPE Defintions * diff --git a/core/mac/src/sys/common/src/wlan_qct_sys.c b/core/mac/src/sys/common/src/wlan_qct_sys.c index fdc4c10a440f..75fc0cb59ec4 100644 --- a/core/mac/src/sys/common/src/wlan_qct_sys.c +++ b/core/mac/src/sys/common/src/wlan_qct_sys.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -143,7 +143,6 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) { QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; data_stall_detect_cb data_stall_detect_callback; - tpAniSirGlobal mac_ctx; void *hHal; if (NULL == pMsg) { @@ -192,35 +191,6 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) pMsg->type, pMsg->type); break; - case SYS_MSG_ID_FTM_RSP: - hHal = cds_get_context(QDF_MODULE_ID_PE); - if (NULL == hHal) { - QDF_TRACE(QDF_MODULE_ID_SYS, - QDF_TRACE_LEVEL_ERROR, - FL("Invalid hal")); - qdf_mem_free(pMsg->bodyptr); - break; - } - mac_ctx = PMAC_STRUCT(hHal); - if (NULL == mac_ctx) { - QDF_TRACE(QDF_MODULE_ID_SYS, - QDF_TRACE_LEVEL_ERROR, - FL("Invalid mac context")); - qdf_mem_free(pMsg->bodyptr); - break; - } - if (NULL == mac_ctx->ftm_msg_processor_callback) { - QDF_TRACE(QDF_MODULE_ID_SYS, - QDF_TRACE_LEVEL_ERROR, - FL("callback pointer is NULL")); - qdf_mem_free(pMsg->bodyptr); - break; - } - mac_ctx->ftm_msg_processor_callback( - (void *)pMsg->bodyptr); - qdf_mem_free(pMsg->bodyptr); - break; - case SYS_MSG_ID_DATA_STALL_MSG: data_stall_detect_callback = pMsg->callback; if (NULL != data_stall_detect_callback) diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index 9e23573a9ea4..bf5bf50616a5 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -501,8 +501,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_MSG_TYPES_END); CASE_RETURN_STRING(WMA_AGGR_QOS_REQ); CASE_RETURN_STRING(WMA_AGGR_QOS_RSP); - CASE_RETURN_STRING(WMA_FTM_CMD_REQ); - CASE_RETURN_STRING(WMA_FTM_CMD_RSP); CASE_RETURN_STRING(WMA_ROAM_SCAN_OFFLOAD_REQ); #ifdef WLAN_FEATURE_PACKET_FILTERING CASE_RETURN_STRING(WMA_8023_MULTICAST_LIST_REQ); diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 5b64a75c6a5a..f4ee53bd3d7b 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1149,41 +1149,6 @@ struct wma_txrx_node { bool is_waiting_for_key; }; -#if defined(QCA_WIFI_FTM) -#define MAX_UTF_EVENT_LENGTH 2048 -#define MAX_WMI_UTF_LEN 252 - -/** - * struct SEG_HDR_INFO_STRUCT - header info - * @len: length - * @msgref: message refrence - * @segmentInfo: segment info - * @pad: padding - */ -typedef struct { - A_UINT32 len; - A_UINT32 msgref; - A_UINT32 segmentInfo; - A_UINT32 pad; -} SEG_HDR_INFO_STRUCT; - -/** - * struct utf_event_info - UTF event info - * @data: data ptr - * @length: length - * @offset: offset - * @currentSeq: curent squence - * @expectedSeq: expected sequence - */ -struct utf_event_info { - uint8_t *data; - uint32_t length; - qdf_size_t offset; - uint8_t currentSeq; - uint8_t expectedSeq; -}; -#endif - /** * struct scan_timer_info - scan timer info * @vdev_id: vdev id @@ -1312,7 +1277,6 @@ struct hw_mode_idx_to_mac_cap_idx { * @vht_cap_info: VHT capablity info * @vht_supp_mcs: VHT supported MCS * @num_rf_chains: number of RF chains - * @utf_event_info: UTF event information * @is_fw_assert: is fw asserted * @wow: wow related patterns & parameters * @no_of_suspend_ind: number of suspend indications @@ -1471,9 +1435,6 @@ typedef struct { uint32_t vht_cap_info; uint32_t vht_supp_mcs; uint32_t num_rf_chains; -#if defined(QCA_WIFI_FTM) - struct utf_event_info utf_event_info; -#endif uint8_t is_fw_assert; struct wma_wow wow; uint8_t no_of_suspend_ind; diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 8cc21cccfc0a..bcf8d6cc7049 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -890,16 +890,6 @@ int32_t wma_set_txrx_fw_stats_level(tp_wma_handle wma_handle, void wma_get_stats_req(WMA_HANDLE handle, tAniGetPEStatsReq *get_stats_param); -#if defined(QCA_WIFI_FTM) -void wma_utf_detach(tp_wma_handle wma_handle); - -void wma_utf_attach(tp_wma_handle wma_handle); - -QDF_STATUS -wma_process_ftm_command(tp_wma_handle wma_handle, - struct ar6k_testmode_cmd_data *msg_buffer); -#endif - /* * wma_features.c functions declarations */ diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index b53823cc1579..40f4cc557304 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -267,9 +267,6 @@ #define WMA_AGGR_QOS_REQ SIR_HAL_AGGR_QOS_REQ #define WMA_AGGR_QOS_RSP SIR_HAL_AGGR_QOS_RSP -/* FTM CMD MSG */ -#define WMA_FTM_CMD_REQ SIR_PTT_MSG_TYPES_BEGIN -#define WMA_FTM_CMD_RSP SIR_PTT_MSG_TYPES_END #define WMA_CSA_OFFLOAD_EVENT SIR_CSA_OFFLOAD_EVENT #ifdef FEATURE_WLAN_ESE @@ -651,14 +648,6 @@ typedef struct { uint32_t param_vp_dev; } wma_cli_set_cmd_t; -#if defined(QCA_WIFI_FTM) -#define AR6K_TM_DATA_MAX_LEN 5000 -struct ar6k_testmode_cmd_data { - void *data; - int len; -}; -#endif - #ifdef FEATURE_WLAN_TDLS /** * enum WMA_TdlsPeerState - TDLS PEER state diff --git a/core/wma/src/wlan_qct_wma_legacy.c b/core/wma/src/wlan_qct_wma_legacy.c index d8addd73a67c..7c7d34bb5494 100644 --- a/core/wma/src/wlan_qct_wma_legacy.c +++ b/core/wma/src/wlan_qct_wma_legacy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -133,10 +133,6 @@ tSirRetStatus u_mac_post_ctrl_msg(void *pSirGlobal, tSirMbMsg *pMb) status = sme_post_pe_message(pMac, &msg); break; - case SIR_PTT_MSG_TYPES_BEGIN: - qdf_mem_free(msg.bodyptr); - break; - default: WMA_LOGD("Unknown message type = 0x%X\n", msg.type); qdf_mem_free(msg.bodyptr); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 29f6c133a186..341d001f0b52 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -7441,12 +7441,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) qdf_mem_free(msg->bodyptr); break; #endif /* REMOVE_PKT_LOG */ -#if defined(QCA_WIFI_FTM) - case WMA_FTM_CMD_REQ: - wma_process_ftm_command(wma_handle, - (struct ar6k_testmode_cmd_data *)msg->bodyptr); - break; -#endif /* QCA_WIFI_FTM */ case WMA_ENTER_PS_REQ: wma_enable_sta_ps_mode(wma_handle, (tpEnablePsParams) msg->bodyptr); diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 3538c6812644..2d7b201220c6 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -4072,254 +4072,6 @@ struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id) return &wma->interfaces[vdev_id]; } -#if defined(QCA_WIFI_FTM) -/** - * wma_utf_rsp() - utf response - * @wma_handle: wma handle - * @payload: payload - * @len: length of payload - * - * Return: 0 for success or error code - */ -static int wma_utf_rsp(tp_wma_handle wma_handle, uint8_t **payload, - uint32_t *len) -{ - int ret = -1; - uint32_t payload_len; - - payload_len = wma_handle->utf_event_info.length; - if (payload_len) { - ret = 0; - - /* - * The first 4 bytes holds the payload size - * and the actual payload sits next to it - */ - *payload = (uint8_t *) qdf_mem_malloc((uint32_t) payload_len - + sizeof(A_UINT32)); - *(A_UINT32 *) &(*payload[0]) = - wma_handle->utf_event_info.length; - memcpy(*payload + sizeof(A_UINT32), - wma_handle->utf_event_info.data, payload_len); - wma_handle->utf_event_info.length = 0; - *len = payload_len; - } - - return ret; -} - -/** - * wma_post_ftm_response() - post ftm response to upper layer - * @wma_handle: wma handle - * - * Return: none - */ -static void wma_post_ftm_response(tp_wma_handle wma_handle) -{ - int ret; - uint8_t *payload; - uint32_t data_len; - struct scheduler_msg msg = { 0 }; - QDF_STATUS status; - - ret = wma_utf_rsp(wma_handle, &payload, &data_len); - - if (ret) - return; - - sys_build_message_header(SYS_MSG_ID_FTM_RSP, &msg); - msg.bodyptr = payload; - msg.bodyval = 0; - - status = scheduler_post_msg(QDF_MODULE_ID_SYS, &msg); - - if (status != QDF_STATUS_SUCCESS) { - WMA_LOGE("failed to post ftm response to SYS"); - qdf_mem_free(payload); - } -} - -/** - * wma_process_utf_event() - process utf event - * @handle: wma handle - * @datap: data buffer - * @dataplen: data length - * - * Return: 0 for success or error code - */ -static int -wma_process_utf_event(WMA_HANDLE handle, uint8_t *datap, uint32_t dataplen) -{ - tp_wma_handle wma_handle = (tp_wma_handle) handle; - struct seg_hdr_info segHdrInfo; - uint8_t totalNumOfSegments, currentSeq; - WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf; - uint8_t *data; - uint32_t datalen; - - param_buf = (WMI_PDEV_UTF_EVENTID_param_tlvs *) datap; - if (!param_buf) { - WMA_LOGE("Get NULL point message from FW"); - return -EINVAL; - } - data = param_buf->data; - datalen = param_buf->num_data; - - if (datalen < sizeof(segHdrInfo)) { - WMA_LOGE("message size %d is smaller than struct seg_hdr_info", - datalen); - return -EINVAL; - } - - segHdrInfo = *(struct seg_hdr_info *) &(data[0]); - - wma_handle->utf_event_info.currentSeq = (segHdrInfo.segmentInfo & 0xF); - - currentSeq = (segHdrInfo.segmentInfo & 0xF); - totalNumOfSegments = (segHdrInfo.segmentInfo >> 4) & 0xF; - - datalen = datalen - sizeof(segHdrInfo); - - if (currentSeq == 0) { - wma_handle->utf_event_info.expectedSeq = 0; - wma_handle->utf_event_info.offset = 0; - } else { - if (wma_handle->utf_event_info.expectedSeq != currentSeq) - WMA_LOGE("Mismatch in expecting seq expected Seq %d got seq %d", - wma_handle->utf_event_info.expectedSeq, - currentSeq); - } - - if ((datalen > MAX_UTF_EVENT_LENGTH) || - (wma_handle->utf_event_info.offset > - (MAX_UTF_EVENT_LENGTH - datalen))) { - WMA_LOGE("Excess data from firmware, offset:%zu, len:%d", - wma_handle->utf_event_info.offset, datalen); - return -EINVAL; - } - memcpy(&wma_handle->utf_event_info. - data[wma_handle->utf_event_info.offset], - &data[sizeof(segHdrInfo)], datalen); - wma_handle->utf_event_info.offset = - wma_handle->utf_event_info.offset + datalen; - wma_handle->utf_event_info.expectedSeq++; - - if (wma_handle->utf_event_info.expectedSeq == totalNumOfSegments) { - if (wma_handle->utf_event_info.offset != segHdrInfo.len) - WMA_LOGE("All segs received total len mismatch.. len %zu total len %d", - wma_handle->utf_event_info.offset, - segHdrInfo.len); - - wma_handle->utf_event_info.length = - wma_handle->utf_event_info.offset; - } - - wma_post_ftm_response(wma_handle); - - return 0; -} - -/** - * wma_utf_detach() - utf detach - * @wma_handle: wma handle - * - * Return: none - */ -void wma_utf_detach(tp_wma_handle wma_handle) -{ - if (wma_handle->utf_event_info.data) { - qdf_mem_free(wma_handle->utf_event_info.data); - wma_handle->utf_event_info.data = NULL; - wma_handle->utf_event_info.length = 0; - wmi_unified_unregister_event_handler(wma_handle->wmi_handle, - wmi_pdev_utf_event_id); - } -} - -/** - * wma_utf_attach() - utf attach - * @wma_handle: wma handle - * - * Return: none - */ -void wma_utf_attach(tp_wma_handle wma_handle) -{ - int ret; - - wma_handle->utf_event_info.data = (unsigned char *) - qdf_mem_malloc(MAX_UTF_EVENT_LENGTH); - wma_handle->utf_event_info.length = 0; - - ret = wmi_unified_register_event_handler(wma_handle->wmi_handle, - wmi_pdev_utf_event_id, - wma_process_utf_event, - WMA_RX_SERIALIZER_CTX); - - if (ret) - WMA_LOGE("%s: Failed to register UTF event callback", __func__); -} - -/** - * wma_utf_cmd() - utf command - * @wma_handle: wma handle - * @data: data - * @len: length - * - * Return: QDF_STATUS_SUCCESS for success or error code - */ -static QDF_STATUS wma_utf_cmd(tp_wma_handle wma_handle, uint8_t *data, - uint16_t len) -{ - struct pdev_utf_params param = {0}; - - wma_handle->utf_event_info.length = 0; - param.utf_payload = data; - param.len = len; - - return wmi_unified_pdev_utf_cmd_send(wma_handle->wmi_handle, ¶m, - WMA_WILDCARD_PDEV_ID); -} - -/** - * wma_process_ftm_command() - process ftm command - * @wma_handle: wma handle - * @msg_buffer: message buffer - * - * Return: QDF_STATUS_SUCCESS for success or error code - */ -QDF_STATUS -wma_process_ftm_command(tp_wma_handle wma_handle, - struct ar6k_testmode_cmd_data *msg_buffer) -{ - uint8_t *data = NULL; - uint16_t len = 0; - int ret; - - if (!msg_buffer) - return QDF_STATUS_E_INVAL; - - if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) { - WMA_LOGE("FTM command issued in non-FTM mode"); - qdf_mem_free(msg_buffer->data); - qdf_mem_free(msg_buffer); - return QDF_STATUS_E_NOSUPPORT; - } - - data = msg_buffer->data; - len = msg_buffer->len; - - ret = wma_utf_cmd(wma_handle, data, len); - - qdf_mem_free(msg_buffer->data); - qdf_mem_free(msg_buffer); - - if (ret) - return QDF_STATUS_E_FAILURE; - - return QDF_STATUS_SUCCESS; -} -#endif /* QCA_WIFI_FTM */ - QDF_STATUS wma_get_wcnss_software_version(uint8_t *version, uint32_t version_buffer_size) {