wlan_dfs_ioctl.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * Copyright (c) 2011, 2016-2019 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. * DOC: This file has dfs IOCTL Defines.
  22. */
  23. #ifndef _DFS_IOCTL_H_
  24. #define _DFS_IOCTL_H_
  25. #define DFS_MUTE_TIME 1
  26. #define DFS_SET_THRESH 2
  27. #define DFS_GET_THRESH 3
  28. #define DFS_GET_USENOL 4
  29. #define DFS_SET_USENOL 5
  30. #define DFS_RADARDETECTS 6
  31. #define DFS_BANGRADAR 7
  32. #define DFS_SHOW_NOL 8
  33. #define DFS_DISABLE_DETECT 9
  34. #define DFS_ENABLE_DETECT 10
  35. #define DFS_DISABLE_FFT 11
  36. #define DFS_ENABLE_FFT 12
  37. #define DFS_SET_DEBUG_LEVEL 13
  38. #define DFS_GET_NOL 14
  39. #define DFS_SET_NOL 15
  40. #define DFS_SET_FALSE_RSSI_THRES 16
  41. #define DFS_SET_PEAK_MAG 17
  42. #define DFS_IGNORE_CAC 18
  43. #define DFS_SET_NOL_TIMEOUT 19
  44. #define DFS_GET_CAC_VALID_TIME 20
  45. #define DFS_SET_CAC_VALID_TIME 21
  46. #define DFS_SHOW_NOLHISTORY 22
  47. #define DFS_SHOW_PRECAC_LISTS 23
  48. #define DFS_RESET_PRECAC_LISTS 24
  49. #define DFS_SET_DISABLE_RADAR_MARKING 25
  50. #define DFS_GET_DISABLE_RADAR_MARKING 26
  51. /*
  52. * Spectral IOCTLs use DFS_LAST_IOCTL as the base.
  53. * This must always be the last IOCTL in DFS and have
  54. * the highest value.
  55. */
  56. #define DFS_LAST_IOCTL 27
  57. #ifndef DFS_CHAN_MAX
  58. #define DFS_CHAN_MAX 1023
  59. #endif
  60. /**
  61. * struct dfsreq_nolelem - NOL elements.
  62. * @nol_freq: NOL channel frequency.
  63. * @nol_chwidth: NOL channel width.
  64. * @nol_start_ticks: OS ticks when the NOL timer started.
  65. * @nol_timeout_ms: Nol timeout value in msec.
  66. */
  67. struct dfsreq_nolelem {
  68. uint16_t nol_freq;
  69. uint16_t nol_chwidth;
  70. unsigned long nol_start_ticks;
  71. uint32_t nol_timeout_ms;
  72. };
  73. struct dfsreq_nolinfo {
  74. uint32_t dfs_ch_nchans;
  75. struct dfsreq_nolelem dfs_nol[DFS_CHAN_MAX];
  76. };
  77. /*
  78. * IOCTL parameter types
  79. */
  80. #define DFS_PARAM_FIRPWR 1
  81. #define DFS_PARAM_RRSSI 2
  82. #define DFS_PARAM_HEIGHT 3
  83. #define DFS_PARAM_PRSSI 4
  84. #define DFS_PARAM_INBAND 5
  85. /* 5413 specific parameters */
  86. #define DFS_PARAM_RELPWR 7
  87. #define DFS_PARAM_RELSTEP 8
  88. #define DFS_PARAM_MAXLEN 9
  89. /**
  90. * struct dfs_ioctl_params - DFS ioctl params.
  91. * @dfs_firpwr: FIR pwr out threshold.
  92. * @dfs_rrssi: Radar rssi thresh.
  93. * @dfs_height: Pulse height thresh.
  94. * @dfs_prssi: Pulse rssi thresh.
  95. * @dfs_inband: Inband thresh.
  96. * @dfs_relpwr: Pulse relative pwr thresh.
  97. * @dfs_relstep: Pulse relative step thresh.
  98. * @dfs_maxlen: Pulse max duration.
  99. */
  100. struct dfs_ioctl_params {
  101. int32_t dfs_firpwr;
  102. int32_t dfs_rrssi;
  103. int32_t dfs_height;
  104. int32_t dfs_prssi;
  105. int32_t dfs_inband;
  106. int32_t dfs_relpwr;
  107. int32_t dfs_relstep;
  108. int32_t dfs_maxlen;
  109. };
  110. /* Types of Bangradar commands:
  111. * @DFS_BANGRADAR_FOR_ALL_SUBCHANS : Bangradar with no arguments.
  112. * All the subchannels in the current
  113. * channel shall be added.
  114. * @DFS_BANGRADAR_FOR_ALL_SUBCHANS_OF_SEGID : Bangradar with 1 (seg_id) argument
  115. * All subchannels of the specific
  116. * seg_id shall be added.
  117. * @DFS_BANGRADAR_FOR_SPECIFIC_SUBCHANS : Bangradar with all (segment ID,
  118. * is_chirp and frequency offset)
  119. * arguments.
  120. * Only radar infected subchannels
  121. * of the specific seg_id shall be
  122. * added.
  123. *
  124. * (Unless all arguments are given, we cannot determine which specific
  125. * subchannels to simulate the radar on, hence simulate in all subchans).
  126. */
  127. enum dfs_bangradar_types {
  128. DFS_NO_BANGRADAR = 0,
  129. DFS_BANGRADAR_FOR_ALL_SUBCHANS,
  130. DFS_BANGRADAR_FOR_ALL_SUBCHANS_OF_SEGID,
  131. DFS_BANGRADAR_FOR_SPECIFIC_SUBCHANS,
  132. DFS_INVALID_BANGRADAR_TYPE
  133. };
  134. /**
  135. * struct dfs_bangradar_params - DFS bangradar params.
  136. * @bangradar_type: Type of Bangradar.
  137. * @seg_id: Segment ID information.
  138. * @is_chirp: Chirp radar or not.
  139. * @freq_offset: Frequency offset at which radar was found.
  140. */
  141. struct dfs_bangradar_params {
  142. enum dfs_bangradar_types bangradar_type;
  143. uint8_t seg_id;
  144. uint8_t is_chirp;
  145. int32_t freq_offset;
  146. };
  147. #define DFS_IOCTL_PARAM_NOVAL 65535
  148. #define DFS_IOCTL_PARAM_ENABLE 0x8000
  149. /* Random channel flags */
  150. /* Flag to exclude current operating channels */
  151. #define DFS_RANDOM_CH_FLAG_NO_CURR_OPE_CH 0x0001 /* 0000 0000 0000 0001 */
  152. /* Flag to exclude weather channels */
  153. #define DFS_RANDOM_CH_FLAG_NO_WEATHER_CH 0x0002 /* 0000 0000 0000 0010 */
  154. /* Flag to exclude indoor channels */
  155. #define DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH 0x0004 /* 0000 0000 0000 0100 */
  156. /* Flag to exclude outdoor channels */
  157. #define DFS_RANDOM_CH_FLAG_NO_UPEER_5G_CH 0x0008 /* 0000 0000 0000 1000 */
  158. /* Flag to exclude dfs channels */
  159. #define DFS_RANDOM_CH_FLAG_NO_DFS_CH 0x0010 /* 0000 0000 0001 0000 */
  160. /* Flag to exclude all 5GHz channels */
  161. #define DFS_RANDOM_CH_FLAG_NO_5GHZ_CH 0x0020 /* 0000 0000 0010 0000 */
  162. /* Flag to exclude all 2.4GHz channels */
  163. #define DFS_RANDOM_CH_FLAG_NO_2GHZ_CH 0x0040 /* 0000 0000 0100 0000 */
  164. /* Flag to enable Reduced BW Agile DFS */
  165. #define DFS_RANDOM_CH_FLAG_ENABLE_REDUCED_BW 0x0080 /* 0000 0000 1000 0000 */
  166. /* Flag to exclude Japan W53 channnels */
  167. #define DFS_RANDOM_CH_FLAG_NO_JAPAN_W53_CH 0x0100 /* 0000 0001 0000 0000 */
  168. /**
  169. * struct wlan_dfs_caps - DFS capability structure.
  170. * @wlan_dfs_ext_chan_ok: Can radar be detected on the extension chan?
  171. * @wlan_dfs_combined_rssi_ok: Can use combined radar RSSI?
  172. * @wlan_dfs_use_enhancement: This flag is used to indicate if radar
  173. * detection scheme should use enhanced chirping
  174. * detection algorithm. This flag also determines
  175. * if certain radar data should be discarded to
  176. * minimize false detection of radar.
  177. * @wlan_strong_signal_diversiry: Strong Signal fast diversity count.
  178. * @wlan_chip_is_bb_tlv: Chip is BB TLV?
  179. * @wlan_chip_is_over_sampled: Is Over sampled.
  180. * @wlan_chip_is_ht160: IS VHT160?
  181. * @wlan_chip_is_false_detect: Is False detected?
  182. * @wlan_fastdiv_val: Goes with wlan_strong_signal_diversiry: If we
  183. * have fast diversity capability, read off
  184. * Strong Signal fast diversity count set in the
  185. * ini file, and store so we can restore the
  186. * value when radar is disabled.
  187. */
  188. struct wlan_dfs_caps {
  189. uint32_t wlan_dfs_ext_chan_ok:1,
  190. wlan_dfs_combined_rssi_ok:1,
  191. wlan_dfs_use_enhancement:1,
  192. wlan_strong_signal_diversiry:1,
  193. wlan_chip_is_bb_tlv:1,
  194. wlan_chip_is_over_sampled:1,
  195. wlan_chip_is_ht160:1,
  196. wlan_chip_is_false_detect:1;
  197. uint32_t wlan_fastdiv_val;
  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. #endif /* _DFS_IOCTL_H_ */