1 /* 2 * Copyright (c) 2011, 2016-2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2010, Atheros Communications Inc. 4 * All Rights Reserved. 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: This file has dfs IOCTL Defines. 23 */ 24 25 #ifndef _DFS_IOCTL_H_ 26 #define _DFS_IOCTL_H_ 27 28 #define DFS_MUTE_TIME 1 29 #define DFS_SET_THRESH 2 30 #define DFS_GET_THRESH 3 31 #define DFS_GET_USENOL 4 32 #define DFS_SET_USENOL 5 33 #define DFS_RADARDETECTS 6 34 #define DFS_BANGRADAR 7 35 #define DFS_SHOW_NOL 8 36 #define DFS_DISABLE_DETECT 9 37 #define DFS_ENABLE_DETECT 10 38 #define DFS_DISABLE_FFT 11 39 #define DFS_ENABLE_FFT 12 40 #define DFS_SET_DEBUG_LEVEL 13 41 #define DFS_GET_NOL 14 42 #define DFS_SET_NOL 15 43 44 #define DFS_SET_FALSE_RSSI_THRES 16 45 #define DFS_SET_PEAK_MAG 17 46 #define DFS_IGNORE_CAC 18 47 #define DFS_SET_NOL_TIMEOUT 19 48 #define DFS_GET_CAC_VALID_TIME 20 49 #define DFS_SET_CAC_VALID_TIME 21 50 #define DFS_SHOW_NOLHISTORY 22 51 #define DFS_SECOND_SEGMENT_BANGRADAR 23 52 #define DFS_SHOW_PRECAC_LISTS 24 53 #define DFS_RESET_PRECAC_LISTS 25 54 #define DFS_BANGRADAR_ENH 26 55 56 /* 57 * Spectral IOCTLs use DFS_LAST_IOCTL as the base. 58 * This must always be the last IOCTL in DFS and have 59 * the highest value. 60 */ 61 #define DFS_LAST_IOCTL 27 62 63 #ifndef DFS_CHAN_MAX 64 #define DFS_CHAN_MAX 1023 65 #endif 66 67 /** 68 * struct dfsreq_nolelem - NOL elements. 69 * @nol_freq: NOL channel frequency. 70 * @nol_chwidth: NOL channel width. 71 * @nol_start_ticks: OS ticks when the NOL timer started. 72 * @nol_timeout_ms: Nol timeout value in msec. 73 */ 74 75 struct dfsreq_nolelem { 76 uint16_t nol_freq; 77 uint16_t nol_chwidth; 78 unsigned long nol_start_ticks; 79 uint32_t nol_timeout_ms; 80 }; 81 82 struct dfsreq_nolinfo { 83 uint32_t dfs_ch_nchans; 84 struct dfsreq_nolelem dfs_nol[DFS_CHAN_MAX]; 85 }; 86 87 /* 88 * IOCTL parameter types 89 */ 90 91 #define DFS_PARAM_FIRPWR 1 92 #define DFS_PARAM_RRSSI 2 93 #define DFS_PARAM_HEIGHT 3 94 #define DFS_PARAM_PRSSI 4 95 #define DFS_PARAM_INBAND 5 96 /* 5413 specific parameters */ 97 #define DFS_PARAM_RELPWR 7 98 #define DFS_PARAM_RELSTEP 8 99 #define DFS_PARAM_MAXLEN 9 100 101 /** 102 * struct dfs_ioctl_params - DFS ioctl params. 103 * @dfs_firpwr: FIR pwr out threshold. 104 * @dfs_rrssi: Radar rssi thresh. 105 * @dfs_height: Pulse height thresh. 106 * @dfs_prssi: Pulse rssi thresh. 107 * @dfs_inband: Inband thresh. 108 * @dfs_relpwr: Pulse relative pwr thresh. 109 * @dfs_relstep: Pulse relative step thresh. 110 * @dfs_maxlen: Pulse max duration. 111 */ 112 struct dfs_ioctl_params { 113 int32_t dfs_firpwr; 114 int32_t dfs_rrssi; 115 int32_t dfs_height; 116 int32_t dfs_prssi; 117 int32_t dfs_inband; 118 int32_t dfs_relpwr; 119 int32_t dfs_relstep; 120 int32_t dfs_maxlen; 121 }; 122 123 /** 124 * struct dfs_bangradar_enh_params - DFS enhanced bangradr params. 125 * @seg_id: Segment ID information. 126 * @is_chirp: Chirp radar or not. 127 * @freq_offset: Frequency offset at which radar was found. 128 */ 129 struct dfs_bangradar_enh_params { 130 uint8_t seg_id; 131 uint8_t is_chirp; 132 int32_t freq_offset; 133 }; 134 #define DFS_IOCTL_PARAM_NOVAL 65535 135 #define DFS_IOCTL_PARAM_ENABLE 0x8000 136 137 /* Random channel flags */ 138 /* Flag to exclude current operating channels */ 139 #define DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH 0x0001 /* 0000 0000 0000 0001 */ 140 141 /* Flag to exclude weather channels */ 142 #define DFS_RANDOM_CH_FLAG_NO_WEATHER_CH 0x0002 /* 0000 0000 0000 0010 */ 143 144 /* Flag to exclude indoor channels */ 145 #define DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH 0x0004 /* 0000 0000 0000 0100 */ 146 147 /* Flag to exclude outdoor channels */ 148 #define DFS_RANDOM_CH_FLAG_NO_UPEER_5G_CH 0x0008 /* 0000 0000 0000 1000 */ 149 150 /* Flag to exclude dfs channels */ 151 #define DFS_RANDOM_CH_FLAG_NO_DFS_CH 0x0010 /* 0000 0000 0001 0000 */ 152 153 /* Flag to exclude all 5GHz channels */ 154 #define DFS_RANDOM_CH_FLAG_NO_5GHZ_CH 0x0020 /* 0000 0000 0010 0000 */ 155 156 /* Flag to exclude all 2.4GHz channels */ 157 #define DFS_RANDOM_CH_FLAG_NO_2GHZ_CH 0x0040 /* 0000 0000 0100 0000 */ 158 159 /* Flag to enable Reduced BW Agile DFS */ 160 #define DFS_RANDOM_CH_FLAG_ENABLE_REDUCED_BW 0x0080 /* 0000 0000 1000 0000 */ 161 162 /** 163 * struct wlan_dfs_caps - DFS capability structure. 164 * @wlan_dfs_ext_chan_ok: Can radar be detected on the extension chan? 165 * @wlan_dfs_combined_rssi_ok: Can use combined radar RSSI? 166 * @wlan_dfs_use_enhancement: This flag is used to indicate if radar 167 * detection scheme should use enhanced chirping 168 * detection algorithm. This flag also determines 169 * if certain radar data should be discarded to 170 * minimize false detection of radar. 171 * @wlan_strong_signal_diversiry: Strong Signal fast diversity count. 172 * @wlan_chip_is_bb_tlv: Chip is BB TLV? 173 * @wlan_chip_is_over_sampled: Is Over sampled. 174 * @wlan_chip_is_ht160: IS VHT160? 175 * @wlan_chip_is_false_detect: Is False detected? 176 * @wlan_fastdiv_val: Goes with wlan_strong_signal_diversiry: If we 177 * have fast diversity capability, read off 178 * Strong Signal fast diversity count set in the 179 * ini file, and store so we can restore the 180 * value when radar is disabled. 181 */ 182 struct wlan_dfs_caps { 183 uint32_t wlan_dfs_ext_chan_ok:1, 184 wlan_dfs_combined_rssi_ok:1, 185 wlan_dfs_use_enhancement:1, 186 wlan_strong_signal_diversiry:1, 187 wlan_chip_is_bb_tlv:1, 188 wlan_chip_is_over_sampled:1, 189 wlan_chip_is_ht160:1, 190 wlan_chip_is_false_detect:1; 191 uint32_t wlan_fastdiv_val; 192 }; 193 194 /** 195 * struct wlan_dfs_phyerr_param - DFS Phyerr structure. 196 * @pe_firpwr: FIR pwr out threshold. 197 * @pe_rrssi: Radar rssi thresh. 198 * @pe_height: Pulse height thresh. 199 * @pe_prssi: Pulse rssi thresh. 200 * @pe_inband: Inband thresh. 201 * @pe_relpwr: Relative power threshold in 0.5dB steps. 202 * @pe_relstep: Pulse Relative step threshold in 0.5dB steps. 203 * @pe_maxlen: Max length of radar sign in 0.8us units. 204 * @pe_usefir128: Use the average in-band power measured over 128 cycles. 205 * @pe_blockradar: Enable to block radar check if pkt detect is done via OFDM 206 * weak signal detect or pkt is detected immediately after tx 207 * to rx transition. 208 * @pe_enmaxrssi: Enable to use the max rssi instead of the last rssi during 209 * fine gain changes for radar detection. 210 */ 211 struct wlan_dfs_phyerr_param { 212 int32_t pe_firpwr; 213 int32_t pe_rrssi; 214 int32_t pe_height; 215 int32_t pe_prssi; 216 int32_t pe_inband; 217 uint32_t pe_relpwr; 218 uint32_t pe_relstep; 219 uint32_t pe_maxlen; 220 bool pe_usefir128; 221 bool pe_blockradar; 222 bool pe_enmaxrssi; 223 }; 224 225 #endif /* _DFS_IOCTL_H_ */ 226