wlan_dfs_ioctl.h 7.6 KB

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