1 /* 2 * Copyright (c) 2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * 6 * Permission to use, copy, modify, and/or distribute this software for 7 * any purpose with or without fee is hereby granted, provided that the 8 * above copyright notice and this permission notice appear in all 9 * copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 13 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 14 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 15 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 16 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 17 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 18 * PERFORMANCE OF THIS SOFTWARE. 19 */ 20 21 /** 22 * DOC: declare the ftm service data structure and apis 23 */ 24 #ifndef _WLAN_FTM_UCFG_API_H_ 25 #define _WLAN_FTM_UCFG_API_H_ 26 27 #include <qdf_types.h> 28 #include <qdf_status.h> 29 #include <wlan_objmgr_cmn.h> 30 31 #define FTM_DEBUG 0 32 33 #if FTM_DEBUG 34 #define ftm_alert(params...) \ 35 QDF_TRACE_FATAL(QDF_MODULE_ID_FTM, params) 36 #define ftm_err(params...) \ 37 QDF_TRACE_ERROR(QDF_MODULE_ID_FTM, params) 38 #define ftm_warn(params...) \ 39 QDF_TRACE_WARN(QDF_MODULE_ID_FTM, params) 40 #define ftm_notice(params...) \ 41 QDF_TRACE_INFO(QDF_MODULE_ID_FTM, params) 42 #define ftm_debug(params...) \ 43 QDF_TRACE_DEBUG(QDF_MODULE_ID_FTM, params) 44 45 #define ftm_nofl_alert(params...) \ 46 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_FTM, params) 47 #define ftm_nofl_err(params...) \ 48 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_FTM, params) 49 #define ftm_nofl_warn(params...) \ 50 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_FTM, params) 51 #define ftm_nofl_notice(params...) \ 52 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_FTM, params) 53 #define ftm_nofl_debug(params...) \ 54 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_FTM, params) 55 56 #else 57 #define ftm_alert(params...) 58 #define ftm_err(params...) 59 #define ftm_warn(params...) 60 #define ftm_notice(params...) 61 #define ftm_debug(params...) 62 63 #define ftm_nofl_alert(params...) 64 #define ftm_nofl_err(params...) 65 #define ftm_nofl_warn(params...) 66 #define ftm_nofl_notice(params...) 67 #define ftm_nofl_debug(params...) 68 #endif 69 70 #define FTM_IOCTL_UNIFIED_UTF_CMD 0x1000 71 #define FTM_IOCTL_UNIFIED_UTF_RSP 0x1001 72 #define FTM_CMD_MAX_BUF_LENGTH 2048 73 74 /** 75 * enum wifi_ftm_pdev_cmd_type - the enumeration of the command source per pdev 76 * @WIFI_FTM_CMD_IOCTL: command from ioctl on the pdev 77 * @WIFI_FTM_CMD_NL80211: command from nl80211 on the pdev 78 * @WIFI_FTM_CMD_UNKNOWN: unknown command 79 * 80 */ 81 enum wifi_ftm_pdev_cmd_type { 82 WIFI_FTM_CMD_IOCTL = 1, 83 WIFI_FTM_CMD_NL80211, 84 85 /* command should be added above */ 86 WIFI_FTM_CMD_UNKNOWN, 87 }; 88 89 /** 90 * struct wifi_ftm_pdev_priv_obj - wifi ftm pdev utf event info 91 * @pdev: pointer to pdev 92 * @data: data ptr 93 * @current_seq: current sequence 94 * @expected_seq: expected sequence 95 * @length: length 96 * @offset: offset 97 * @cmd_type: command type from either ioctl or nl80211 98 */ 99 struct wifi_ftm_pdev_priv_obj { 100 struct wlan_objmgr_pdev *pdev; 101 uint8_t *data; 102 uint8_t current_seq; 103 uint8_t expected_seq; 104 qdf_size_t length; 105 qdf_size_t offset; 106 enum wifi_ftm_pdev_cmd_type cmd_type; 107 }; 108 109 /** 110 * ucfg_wlan_ftm_testmode_cmd() - handle FTM testmode command 111 * @pdev: pdev pointer 112 * @data: data 113 * @len: data length 114 * 115 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 116 */ 117 QDF_STATUS ucfg_wlan_ftm_testmode_cmd(struct wlan_objmgr_pdev *pdev, 118 uint8_t *data, uint32_t len); 119 120 /** 121 * ucfg_wlan_ftm_testmode_rsp() - handle FTM testmode command 122 * @pdev: pdev pointer 123 * @data: data 124 * 125 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 126 */ 127 QDF_STATUS ucfg_wlan_ftm_testmode_rsp(struct wlan_objmgr_pdev *pdev, 128 uint8_t *data); 129 130 /** 131 * wlan_ftm_process_utf_event() - process ftm UTF event 132 * @pdev: pdev pointer 133 * @event_buf: event buffer 134 * @len: event length 135 * 136 * Return: QDF_STATUS_SUCCESS for success or error code 137 */ 138 QDF_STATUS wlan_ftm_process_utf_event(struct wlan_objmgr_pdev *pdev, 139 uint8_t *event_buf, uint32_t len); 140 #endif /* _WLAN_FTM_UCFG_API_H_ */ 141