dfs_ioctl.h 7.0 KB

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