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