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