1 /* 2 * Copyright (c) 2017-2019 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: dfs_partial_offload_radar.h 22 * This file contains partial offload specific dfs interfaces 23 */ 24 25 #ifndef _DFS_PARTIAL_OFFLOAD_RADAR_H_ 26 #define _DFS_PARTIAL_OFFLOAD_RADAR_H_ 27 28 /** 29 * dfs_get_po_radars() - Initialize the RADAR table for PO. 30 * @dfs: Pointer to wlan_dfs structure. 31 */ 32 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) 33 void dfs_get_po_radars(struct wlan_dfs *dfs); 34 #else 35 static inline void dfs_get_po_radars(struct wlan_dfs *dfs) 36 { 37 } 38 #endif 39 40 /** 41 * dfs_send_avg_params_to_fw - send avg radar parameters to FW. 42 * @dfs: Pointer to wlan_dfs structure. 43 * @params: Pointer to dfs_radar_found_params. 44 * 45 * Return: None 46 */ 47 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 48 void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs, 49 struct dfs_radar_found_params *params); 50 #else 51 static inline 52 void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs, 53 struct dfs_radar_found_params *params) 54 { 55 } 56 #endif 57 58 /** 59 * dfs_host_wait_timer_init() - Initialize dfs host status wait timer. 60 * @dfs: Pointer to wlan_dfs structure. 61 */ 62 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 63 void dfs_host_wait_timer_init(struct wlan_dfs *dfs); 64 #else 65 static inline void dfs_host_wait_timer_init(struct wlan_dfs *dfs) 66 { 67 } 68 #endif 69 70 /** 71 * dfs_host_wait_timer_detach() - Free dfs host status wait timer. 72 * @dfs: Pointer to wlan_dfs structure. 73 */ 74 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 75 void dfs_host_wait_timer_detach(struct wlan_dfs *dfs); 76 #else 77 static inline void dfs_host_wait_timer_detach(struct wlan_dfs *dfs) 78 { 79 } 80 #endif 81 82 /** 83 * dfs_set_override_status_timeout() - Change the dfs host status timeout. 84 * @dfs: Pointer to wlan_dfs structure. 85 * @status_timeout: timeout value. 86 * 87 * Return: QDF_STATUS 88 */ 89 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 90 QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs, 91 int status_timeout); 92 #else 93 static inline QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs, 94 int status_timeout) 95 { 96 return QDF_STATUS_SUCCESS; 97 } 98 #endif 99 100 /** 101 * dfs_get_override_status_timeout() - Get the dfs host status timeout value. 102 * @dfs: Pointer to wlan_dfs structure. 103 * @status_timeout: Pointer to timeout value. 104 * 105 * Return: QDF_STATUS 106 */ 107 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 108 QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs, 109 int *status_timeout); 110 #else 111 static inline 112 QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs, 113 int *status_timeout) 114 { 115 return QDF_STATUS_SUCCESS; 116 } 117 #endif 118 119 /** 120 * dfs_radarfound_action_fcc() - The dfs action on radar detection by host for 121 * FCC domain. 122 * @dfs: Pointer to wlan_dfs structure. 123 * @seg_id: segment id. 124 * 125 * Return: None 126 */ 127 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 128 void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, uint8_t seg_id); 129 #else 130 static inline void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, 131 uint8_t seg_id) 132 { 133 } 134 #endif 135 136 /** 137 * dfs_host_wait_timer_reset() - Stop dfs host wait timer. 138 * @dfs: Pointer to wlan_dfs structure. 139 */ 140 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 141 void dfs_host_wait_timer_reset(struct wlan_dfs *dfs); 142 #else 143 static inline void dfs_host_wait_timer_reset(struct wlan_dfs *dfs) 144 { 145 } 146 #endif 147 148 /** 149 * dfs_remove_spoof_channel_from_nol() - Remove the spoofed radar hit channel 150 * from NOL. 151 * @dfs: Pointer to wlan_dfs structure. 152 */ 153 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 154 void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs); 155 #else 156 static inline void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs) 157 { 158 } 159 #endif 160 161 /** 162 * dfs_reset_spoof_test() - reset the spoof test variables. 163 * @dfs: Pointer to wlan_dfs structure. 164 * 165 * Return: None. 166 */ 167 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 168 void dfs_reset_spoof_test(struct wlan_dfs *dfs); 169 #else 170 static inline void dfs_reset_spoof_test(struct wlan_dfs *dfs) 171 { 172 } 173 #endif 174 175 /** 176 * dfs_action_on_fw_radar_status_check() - The dfs action on host dfs 177 * confirmation by fw. 178 * @dfs: Pointer to wlan_dfs structure. 179 * @status: pointer to host dfs status. 180 * 181 * Return: None 182 */ 183 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 184 void dfs_action_on_fw_radar_status_check(struct wlan_dfs *dfs, 185 uint32_t *status); 186 #else 187 static inline void dfs_action_on_fw_radar_status_check(struct wlan_dfs *dfs, 188 uint32_t *status) 189 { 190 } 191 #endif 192 193 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) 194 void dfs_false_radarfound_reset_vars(struct wlan_dfs *dfs); 195 #else 196 static inline void dfs_false_radarfound_reset_vars(struct wlan_dfs *dfs) 197 { 198 } 199 #endif 200 201 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR) 202 /** 203 * dfs_allow_hw_pulses() - Set or unset dfs_allow_hw_pulses 204 * which allow or disallow HW pulses. 205 * @dfs: Pointer to DFS pdev object. 206 * @allow_hw_pulses: allow/disallow synthetic pulse detection true/false. 207 * 208 * Return: void 209 */ 210 void dfs_allow_hw_pulses(struct wlan_dfs *dfs, bool allow_hw_pulses); 211 #else 212 static inline void dfs_allow_hw_pulses(struct wlan_dfs *dfs, 213 bool allow_hw_pulses) 214 { 215 } 216 #endif 217 218 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR) 219 /** 220 * dfs_is_hw_pulses_allowed() - Check if HW pulses are allowed or not. 221 * @pdev: Pointer to DFS pdev object. 222 * 223 * Return: bool 224 */ 225 bool dfs_is_hw_pulses_allowed(struct wlan_dfs *dfs); 226 #else 227 static inline bool dfs_is_hw_pulses_allowed(struct wlan_dfs *dfs) 228 { 229 return true; 230 } 231 #endif 232 233 /** 234 * dfs_inject_synthetic_pulse_sequence() - Inject the synthetic pulse to the 235 * phyerror processing algorithm. 236 * @dfs: Pointer to wlan_dfs structure. 237 * @buf: Pointer to buffer of pulses. 238 * 239 * Return: QDF_STATUS 240 */ 241 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR) 242 QDF_STATUS dfs_inject_synthetic_pulse_sequence(struct wlan_dfs *dfs, 243 unsigned char *buf); 244 #else 245 static inline 246 QDF_STATUS dfs_inject_synthetic_pulse_sequence(struct wlan_dfs *dfs, 247 unsigned char *buf) 248 { 249 return QDF_STATUS_SUCCESS; 250 } 251 #endif /* WLAN_DFS_PARTIAL_OFFLOAD && WLAN_DFS_SYNTHETIC_RADAR */ 252 #endif /* _DFS_PARTIAL_OFFLOAD_RADAR_H_ */ 253