wlan_spectral_public_structs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. /*
  2. * Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved.
  3. *
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #include <qdf_types.h>
  20. #include "wlan_dfs_ioctl.h"
  21. #ifndef _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_
  22. #define _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_
  23. #ifdef WIN32
  24. #pragma pack(push, spectral, 1)
  25. #define __ATTRIB_PACKED
  26. #else
  27. #ifndef __ATTRIB_PACKED
  28. #define __ATTRIB_PACKED __attribute__ ((packed))
  29. #endif
  30. #endif
  31. #ifndef AH_MAX_CHAINS
  32. #define AH_MAX_CHAINS 3
  33. #endif
  34. #define MAX_NUM_CHANNELS 255
  35. #define MAX_SPECTRAL_CHAINS 3
  36. #define MAX_NUM_BINS 520
  37. #define SPECTRAL_PHYERR_PARAM_NOVAL 65535
  38. /* 5 categories x (lower + upper) bands */
  39. #define MAX_INTERF 10
  40. /* ioctl parameter types */
  41. #define SPECTRAL_PARAM_FFT_PERIOD (1)
  42. #define SPECTRAL_PARAM_SCAN_PERIOD (2)
  43. #define SPECTRAL_PARAM_SCAN_COUNT (3)
  44. #define SPECTRAL_PARAM_SHORT_REPORT (4)
  45. #define SPECTRAL_PARAM_SPECT_PRI (5)
  46. #define SPECTRAL_PARAM_FFT_SIZE (6)
  47. #define SPECTRAL_PARAM_GC_ENA (7)
  48. #define SPECTRAL_PARAM_RESTART_ENA (8)
  49. #define SPECTRAL_PARAM_NOISE_FLOOR_REF (9)
  50. #define SPECTRAL_PARAM_INIT_DELAY (10)
  51. #define SPECTRAL_PARAM_NB_TONE_THR (11)
  52. #define SPECTRAL_PARAM_STR_BIN_THR (12)
  53. #define SPECTRAL_PARAM_WB_RPT_MODE (13)
  54. #define SPECTRAL_PARAM_RSSI_RPT_MODE (14)
  55. #define SPECTRAL_PARAM_RSSI_THR (15)
  56. #define SPECTRAL_PARAM_PWR_FORMAT (16)
  57. #define SPECTRAL_PARAM_RPT_MODE (17)
  58. #define SPECTRAL_PARAM_BIN_SCALE (18)
  59. #define SPECTRAL_PARAM_DBM_ADJ (19)
  60. #define SPECTRAL_PARAM_CHN_MASK (20)
  61. #define SPECTRAL_PARAM_ACTIVE (21)
  62. #define SPECTRAL_PARAM_STOP (22)
  63. #define SPECTRAL_PARAM_ENABLE (23)
  64. #ifdef SPECTRAL_USE_EMU_DEFAULTS
  65. /* Use defaults from emulation */
  66. #define SPECTRAL_SCAN_ACTIVE_DEFAULT (0x0)
  67. #define SPECTRAL_SCAN_ENABLE_DEFAULT (0x0)
  68. #define SPECTRAL_SCAN_COUNT_DEFAULT (0x0)
  69. #define SPECTRAL_SCAN_PERIOD_DEFAULT (250)
  70. #define SPECTRAL_SCAN_PRIORITY_DEFAULT (0x1)
  71. #define SPECTRAL_SCAN_FFT_SIZE_DEFAULT (0x7)
  72. #define SPECTRAL_SCAN_GC_ENA_DEFAULT (0x1)
  73. #define SPECTRAL_SCAN_RESTART_ENA_DEFAULT (0x0)
  74. #define SPECTRAL_SCAN_NOISE_FLOOR_REF_DEFAULT (0xa0)
  75. #define SPECTRAL_SCAN_INIT_DELAY_DEFAULT (0x50)
  76. #define SPECTRAL_SCAN_NB_TONE_THR_DEFAULT (0xc)
  77. #define SPECTRAL_SCAN_STR_BIN_THR_DEFAULT (0x7)
  78. #define SPECTRAL_SCAN_WB_RPT_MODE_DEFAULT (0x0)
  79. #define SPECTRAL_SCAN_RSSI_RPT_MODE_DEFAULT (0x1)
  80. #define SPECTRAL_SCAN_RSSI_THR_DEFAULT (0xf)
  81. #define SPECTRAL_SCAN_PWR_FORMAT_DEFAULT (0x1)
  82. #define SPECTRAL_SCAN_RPT_MODE_DEFAULT (0x2)
  83. #define SPECTRAL_SCAN_BIN_SCALE_DEFAULT (0x1)
  84. #define SPECTRAL_SCAN_DBM_ADJ_DEFAULT (0x0)
  85. #define SPECTRAL_SCAN_CHN_MASK_DEFAULT (0x1)
  86. #else
  87. /*
  88. * Static default values for spectral state and configuration.
  89. * These definitions should be treated as temporary. Ideally,
  90. * we should get the defaults from firmware - this will be discussed.
  91. *
  92. * Use defaults from Spectral Hardware Micro-Architecture
  93. * document (v1.0)
  94. */
  95. #define SPECTRAL_SCAN_ACTIVE_DEFAULT (0)
  96. #define SPECTRAL_SCAN_ENABLE_DEFAULT (0)
  97. #define SPECTRAL_SCAN_COUNT_DEFAULT (0)
  98. #define SPECTRAL_SCAN_PERIOD_DEFAULT (35)
  99. #define SPECTRAL_SCAN_PRIORITY_DEFAULT (1)
  100. #define SPECTRAL_SCAN_FFT_SIZE_DEFAULT (7)
  101. #define SPECTRAL_SCAN_GC_ENA_DEFAULT (1)
  102. #define SPECTRAL_SCAN_RESTART_ENA_DEFAULT (0)
  103. #define SPECTRAL_SCAN_NOISE_FLOOR_REF_DEFAULT (-96)
  104. #define SPECTRAL_SCAN_INIT_DELAY_DEFAULT (80)
  105. #define SPECTRAL_SCAN_NB_TONE_THR_DEFAULT (12)
  106. #define SPECTRAL_SCAN_STR_BIN_THR_DEFAULT (8)
  107. #define SPECTRAL_SCAN_WB_RPT_MODE_DEFAULT (0)
  108. #define SPECTRAL_SCAN_RSSI_RPT_MODE_DEFAULT (0)
  109. #define SPECTRAL_SCAN_RSSI_THR_DEFAULT (0xf0)
  110. #define SPECTRAL_SCAN_PWR_FORMAT_DEFAULT (0)
  111. #define SPECTRAL_SCAN_RPT_MODE_DEFAULT (2)
  112. #define SPECTRAL_SCAN_BIN_SCALE_DEFAULT (1)
  113. #define SPECTRAL_SCAN_DBM_ADJ_DEFAULT (1)
  114. #define SPECTRAL_SCAN_CHN_MASK_DEFAULT (1)
  115. #endif /* SPECTRAL_USE_EMU_DEFAULTS */
  116. /* The below two definitions apply only to pre-11ac chipsets */
  117. #define SPECTRAL_SCAN_SHORT_REPORT_DEFAULT (1)
  118. #define SPECTRAL_SCAN_FFT_PERIOD_DEFAULT (1)
  119. /**
  120. * enum wlan_cfg80211_spectral_vendorcmd_handler_idx - Indices to cfg80211
  121. * spectral vendor command handlers
  122. * @SPECTRAL_SCAN_START_HANDLER_IDX: Index to SPECTRAL_SCAN_START handler
  123. * @SPECTRAL_SCAN_STOP_HANDLER_IDX: Index to SPECTRAL_SCAN_STOP handler
  124. * @SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CONFIG
  125. * handler
  126. * @SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX: Index to
  127. * SPECTRAL_SCAN_GET_DIAG_STATS handler
  128. * @SPECTRAL_SCAN_GET_CAP_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CAP handler
  129. * @SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_STATUS
  130. * handler
  131. * @SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX: Number of cfg80211 spectral
  132. * vendor command handlers supported
  133. */
  134. enum wlan_cfg80211_spectral_vendorcmd_handler_idx {
  135. SPECTRAL_SCAN_START_HANDLER_IDX,
  136. SPECTRAL_SCAN_STOP_HANDLER_IDX,
  137. SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX,
  138. SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX,
  139. SPECTRAL_SCAN_GET_CAP_HANDLER_IDX,
  140. SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
  141. SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX,
  142. };
  143. /**
  144. * enum spectral_debug - Spectral debug level
  145. * @DEBUG_SPECTRAL: Minimal SPECTRAL debug
  146. * @DEBUG_SPECTRAL1: Normal SPECTRAL debug
  147. * @DEBUG_SPECTRAL2: Maximal SPECTRAL debug
  148. * @DEBUG_SPECTRAL3: Matched filterID display
  149. * @DEBUG_SPECTRAL4: One time dump of FFT report
  150. */
  151. enum spectral_debug {
  152. DEBUG_SPECTRAL = 0x00000100,
  153. DEBUG_SPECTRAL1 = 0x00000200,
  154. DEBUG_SPECTRAL2 = 0x00000400,
  155. DEBUG_SPECTRAL3 = 0x00000800,
  156. DEBUG_SPECTRAL4 = 0x00001000,
  157. };
  158. /**
  159. * enum spectral_capability_type - Spectral capability type
  160. * @SPECTRAL_CAP_PHYDIAG: Phydiag capability
  161. * @SPECTRAL_CAP_RADAR: Radar detection capability
  162. * @SPECTRAL_CAP_SPECTRAL_SCAN: Spectral capability
  163. * @SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN: Advanced spectral capability
  164. */
  165. enum spectral_capability_type {
  166. SPECTRAL_CAP_PHYDIAG,
  167. SPECTRAL_CAP_RADAR,
  168. SPECTRAL_CAP_SPECTRAL_SCAN,
  169. SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN,
  170. };
  171. /**
  172. * struct spectral_chan_stats - channel status info
  173. * @cycle_count: Cycle count
  174. * @channel_load: Channel load
  175. * @per: Period
  176. * @noisefloor: Noise floor
  177. * @comp_usablity: Computed usability
  178. * @maxregpower: Maximum allowed regulatory power
  179. * @comp_usablity_sec80: Computed usability of secondary 80 Mhz
  180. * @maxregpower_sec80: Max regulatory power of secondary 80 Mhz
  181. */
  182. struct spectral_chan_stats {
  183. int cycle_count;
  184. int channel_load;
  185. int per;
  186. int noisefloor;
  187. uint16_t comp_usablity;
  188. int8_t maxregpower;
  189. uint16_t comp_usablity_sec80;
  190. int8_t maxregpower_sec80;
  191. };
  192. /**
  193. * struct spectral_diag_stats - spectral diag stats
  194. * @spectral_mismatch: Spectral TLV signature mismatches
  195. * @spectral_sec80_sfft_insufflen: Insufficient length when parsing for
  196. * Secondary 80 Search FFT report
  197. * @spectral_no_sec80_sfft: Secondary 80 Search FFT report
  198. * TLV not found
  199. * @spectral_vhtseg1id_mismatch: VHT Operation Segment 1 ID
  200. * mismatches in Search FFT report
  201. * @spectral_vhtseg2id_mismatch: VHT Operation Segment 2 ID
  202. * mismatches in Search FFT report
  203. */
  204. struct spectral_diag_stats {
  205. uint64_t spectral_mismatch;
  206. uint64_t spectral_sec80_sfft_insufflen;
  207. uint64_t spectral_no_sec80_sfft;
  208. uint64_t spectral_vhtseg1id_mismatch;
  209. uint64_t spectral_vhtseg2id_mismatch;
  210. };
  211. /**
  212. * struct spectral_caps - Spectral capabilities structure
  213. * @phydiag_cap: Phydiag capability
  214. * @radar_cap: Radar detection capability
  215. * @spectral_cap: Spectral capability
  216. * @advncd_spectral_cap: Advanced spectral capability
  217. */
  218. struct spectral_caps {
  219. uint8_t phydiag_cap;
  220. uint8_t radar_cap;
  221. uint8_t spectral_cap;
  222. uint8_t advncd_spectral_cap;
  223. };
  224. /**
  225. * struct spectral_config - spectral config parameters
  226. * @ss_fft_period: Skip interval for FFT reports
  227. * @ss_period: Spectral scan period
  228. * @ss_count: # of reports to return from ss_active
  229. * @ss_short_report: Set to report only 1 set of FFT results
  230. * @radar_bin_thresh_sel: Select threshold to classify strong bin for FFT
  231. * @ss_spectral_pri: Priority, and are we doing a noise power cal ?
  232. * @ss_fft_size: Defines the number of FFT data points to compute,
  233. * defined as a log index num_fft_pts =
  234. * 2^ss_fft_size
  235. * @ss_gc_ena: Set, to enable targeted gain change before
  236. * starting the spectral scan FFT
  237. * @ss_restart_ena: Set, to enable abort of receive frames when in high
  238. * priority and a spectral scan is queued
  239. * @ss_noise_floor_ref: Noise floor reference number (signed) for the
  240. * calculation of bin power (dBm) Though stored as an
  241. * unsigned this should be treated as a signed 8-bit int.
  242. * @ss_init_delay: Disallow spectral scan triggers after tx/rx packets
  243. * by setting this delay value to roughly SIFS time
  244. * period or greater Delay timer count in units of 0.25us
  245. * @ss_nb_tone_thr: Number of strong bins (inclusive) per sub-channel,
  246. * below which a signal is declared a narrowband tone
  247. * @ss_str_bin_thr: Bin/max_bin ratio threshold over which a bin is
  248. * declared strong (for spectral scan bandwidth analysis)
  249. * @ss_wb_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER
  250. * (phy_error=36), if none of the sub-channels are
  251. * deemed narrowband
  252. * @ss_rssi_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER
  253. * (phy_error=36), if the ADC RSSI is below the
  254. * threshold ss_rssi_thr
  255. * @ss_rssi_thr: ADC RSSI must be greater than or equal to this
  256. * threshold (signed Db) to ensure spectral scan
  257. * reporting with normal phy error codes (please see
  258. * ss_rssi_rpt_mode above).Though stored as an unsigned
  259. * value, this should be treated as a signed 8-bit int
  260. * @ss_pwr_format: Format of frequency bin magnitude for spectral scan
  261. * triggered FFTs 0: linear magnitude
  262. * 1: log magnitude (20*log10(lin_mag), 1/2 dB step size)
  263. * @ss_rpt_mode: Format of per-FFT reports to software for spectral
  264. * scan triggered FFTs
  265. * 0: No FFT report (only pulse end summary)
  266. * 1: 2-dword summary of metrics for each completed FFT
  267. * 2: 2-dword summary + 1x-oversampled bins(in-band) per
  268. * FFT
  269. * 3: 2-dword summary + 2x-oversampled bins (all) per FFT
  270. * @ss_bin_scale: Number of LSBs to shift out to scale the FFT bins
  271. * for spectral scan triggered FFTs
  272. * @ss_dbm_adj: Set (with ss_pwr_format=1), to report bin
  273. * magnitudes
  274. * converted to dBm power using the noisefloor
  275. * calibration results
  276. * @ss_chn_mask: Per chain enable mask to select input ADC for search
  277. * FFT
  278. * @ss_nf_cal: nf calibrated values for ctl+ext
  279. * @ss_nf_pwr: nf pwr values for ctl+ext
  280. * @ss_nf_temp_data: temperature data taken during nf scan
  281. */
  282. struct spectral_config {
  283. uint16_t ss_fft_period;
  284. uint16_t ss_period;
  285. uint16_t ss_count;
  286. uint16_t ss_short_report;
  287. uint8_t radar_bin_thresh_sel;
  288. uint16_t ss_spectral_pri;
  289. uint16_t ss_fft_size;
  290. uint16_t ss_gc_ena;
  291. uint16_t ss_restart_ena;
  292. uint16_t ss_noise_floor_ref;
  293. uint16_t ss_init_delay;
  294. uint16_t ss_nb_tone_thr;
  295. uint16_t ss_str_bin_thr;
  296. uint16_t ss_wb_rpt_mode;
  297. uint16_t ss_rssi_rpt_mode;
  298. uint16_t ss_rssi_thr;
  299. uint16_t ss_pwr_format;
  300. uint16_t ss_rpt_mode;
  301. uint16_t ss_bin_scale;
  302. uint16_t ss_dbm_adj;
  303. uint16_t ss_chn_mask;
  304. int8_t ss_nf_cal[AH_MAX_CHAINS * 2];
  305. int8_t ss_nf_pwr[AH_MAX_CHAINS * 2];
  306. int32_t ss_nf_temp_data;
  307. };
  308. /**
  309. * struct spectral_scan_state - State of spectral scan
  310. * @is_active: Is spectral scan active
  311. * @is_enabled: Is spectral scan enabled
  312. */
  313. struct spectral_scan_state {
  314. uint8_t is_active;
  315. uint8_t is_enabled;
  316. };
  317. /**
  318. * enum dcs_int_type - Interference type indicated by DCS
  319. * @SPECTRAL_DCS_INT_NONE: No interference
  320. * @SPECTRAL_DCS_INT_CW: CW interference
  321. * @SPECTRAL_DCS_INT_WIFI: WLAN interference
  322. */
  323. enum dcs_int_type {
  324. SPECTRAL_DCS_INT_NONE,
  325. SPECTRAL_DCS_INT_CW,
  326. SPECTRAL_DCS_INT_WIFI
  327. };
  328. /**
  329. * struct interf_rsp - Interference record
  330. * @interf_type: eINTERF_TYPE giving type of interference
  331. * @interf_min_freq: Minimum frequency in MHz at which interference has been
  332. * found
  333. * @interf_max_freq: Maximum frequency in MHz at which interference has been
  334. * found
  335. * @advncd_spectral_cap: Advanced spectral capability
  336. */
  337. struct interf_rsp {
  338. uint8_t interf_type;
  339. uint16_t interf_min_freq;
  340. uint16_t interf_max_freq;
  341. } __ATTRIB_PACKED;
  342. /**
  343. * struct interf_src_rsp - List of interference sources
  344. * @count: Number of interference records
  345. * @interf: Array of interference records
  346. */
  347. struct interf_src_rsp {
  348. uint16_t count;
  349. struct interf_rsp interf[MAX_INTERF];
  350. } __ATTRIB_PACKED;
  351. /**
  352. * struct spectral_classifier_params - spectral classifier parameters
  353. * @spectral_20_40_mode: Is AP in 20/40 mode?
  354. * @spectral_dc_index: DC index
  355. * @spectral_dc_in_mhz: DC in MHz
  356. * @upper_chan_in_mhz: Upper channel in MHz
  357. * @lower_chan_in_mhz: Lower channel in MHz
  358. */
  359. struct spectral_classifier_params {
  360. int spectral_20_40_mode;
  361. int spectral_dc_index;
  362. int spectral_dc_in_mhz;
  363. int upper_chan_in_mhz;
  364. int lower_chan_in_mhz;
  365. } __ATTRIB_PACKED;
  366. /**
  367. * struct spectral_samp_data - Spectral Analysis Messaging Protocol Data format
  368. * @spectral_data_len: Indicates the bin size
  369. * @spectral_data_len_sec80: Indicates the bin size for secondary 80 segment
  370. * @spectral_rssi: Indicates RSSI
  371. * @spectral_rssi_sec80: Indicates RSSI for secondary 80 segment
  372. * @spectral_combined_rssi: Indicates combined RSSI from all antennas
  373. * @spectral_upper_rssi: Indicates RSSI of upper band
  374. * @spectral_lower_rssi: Indicates RSSI of lower band
  375. * @spectral_chain_ctl_rssi: RSSI for control channel, for all antennas
  376. * @spectral_chain_ext_rssi: RSSI for extension channel, for all antennas
  377. * @spectral_max_scale: Indicates scale factor
  378. * @spectral_bwinfo: Indicates bandwidth info
  379. * @spectral_tstamp: Indicates timestamp
  380. * @spectral_max_index: Indicates the index of max magnitude
  381. * @spectral_max_index_sec80: Indicates the index of max magnitude for secondary
  382. * 80 segment
  383. * @spectral_max_mag: Indicates the maximum magnitude
  384. * @spectral_max_mag_sec80: Indicates the maximum magnitude for secondary 80
  385. * segment
  386. * @spectral_max_exp: Indicates the max exp
  387. * @spectral_last_tstamp: Indicates the last time stamp
  388. * @spectral_upper_max_index: Indicates the index of max mag in upper band
  389. * @spectral_lower_max_index: Indicates the index of max mag in lower band
  390. * @spectral_nb_upper: Not Used
  391. * @spectral_nb_lower: Not Used
  392. * @classifier_params: Indicates classifier parameters
  393. * @bin_pwr_count: Indicates the number of FFT bins
  394. * @lb_edge_extrabins: Number of extra bins on left band edge
  395. * @rb_edge_extrabins: Number of extra bins on right band edge
  396. * @bin_pwr_count_sec80: Indicates the number of FFT bins in secondary 80
  397. * segment
  398. * @bin_pwr: Contains FFT magnitudes
  399. * @bin_pwr_sec80: Contains FFT magnitudes for the secondary 80
  400. * segment
  401. * @interf_list: List of interfernce sources
  402. * @noise_floor: Indicates the current noise floor
  403. * @noise_floor_sec80: Indicates the current noise floor for secondary 80
  404. * segment
  405. * @ch_width: Channel width 20/40/80/160 MHz
  406. */
  407. struct spectral_samp_data {
  408. int16_t spectral_data_len;
  409. int16_t spectral_data_len_sec80;
  410. int16_t spectral_rssi;
  411. int16_t spectral_rssi_sec80;
  412. int8_t spectral_combined_rssi;
  413. int8_t spectral_upper_rssi;
  414. int8_t spectral_lower_rssi;
  415. int8_t spectral_chain_ctl_rssi[MAX_SPECTRAL_CHAINS];
  416. int8_t spectral_chain_ext_rssi[MAX_SPECTRAL_CHAINS];
  417. uint8_t spectral_max_scale;
  418. int16_t spectral_bwinfo;
  419. int32_t spectral_tstamp;
  420. int16_t spectral_max_index;
  421. int16_t spectral_max_index_sec80;
  422. int16_t spectral_max_mag;
  423. int16_t spectral_max_mag_sec80;
  424. uint8_t spectral_max_exp;
  425. int32_t spectral_last_tstamp;
  426. int16_t spectral_upper_max_index;
  427. int16_t spectral_lower_max_index;
  428. uint8_t spectral_nb_upper;
  429. uint8_t spectral_nb_lower;
  430. struct spectral_classifier_params classifier_params;
  431. uint16_t bin_pwr_count;
  432. /*
  433. * For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are
  434. * delivered. However, there can be additional bins reported for
  435. * AR900B version 2.0 and QCA9984 as described next:
  436. *
  437. * AR900B version 2.0: An additional tone is processed on the right
  438. * hand side in order to facilitate detection of radar pulses out to
  439. * the extreme band-edge of the channel frequency.
  440. * Since the HW design processes four tones at a time,
  441. * this requires one additional Dword to be added to the
  442. * search FFT report.
  443. *
  444. * QCA9984: When spectral_scan_rpt_mode=2, i.e 2-dword summary +
  445. * 1x-oversampled bins (in-band) per FFT,
  446. * then 8 more bins (4 more on left side and 4 more on right side)
  447. * are added.
  448. */
  449. uint8_t lb_edge_extrabins;
  450. uint8_t rb_edge_extrabins;
  451. uint16_t bin_pwr_count_sec80;
  452. uint8_t bin_pwr[MAX_NUM_BINS];
  453. uint8_t bin_pwr_sec80[MAX_NUM_BINS];
  454. struct interf_src_rsp interf_list;
  455. int16_t noise_floor;
  456. int16_t noise_floor_sec80;
  457. uint32_t ch_width;
  458. } __ATTRIB_PACKED;
  459. /**
  460. * struct spectral_samp_msg - Spectral SAMP message
  461. * @signature: Validates the SAMP message
  462. * @freq: Operating frequency in MHz
  463. * @vhtop_ch_freq_seg1: VHT Segment 1 centre frequency in MHz
  464. * @vhtop_ch_freq_seg2: VHT Segment 2 centre frequency in MHz
  465. * @freq_loading: How busy was the channel
  466. * @dcs_enabled: Whether DCS is enabled
  467. * @int_type: Interference type indicated by DCS
  468. * @macaddr: Indicates the device interface
  469. * @samp_data: SAMP Data
  470. */
  471. struct spectral_samp_msg {
  472. uint32_t signature;
  473. uint16_t freq;
  474. uint16_t vhtop_ch_freq_seg1;
  475. uint16_t vhtop_ch_freq_seg2;
  476. uint16_t freq_loading;
  477. uint16_t dcs_enabled;
  478. enum dcs_int_type int_type;
  479. uint8_t macaddr[6];
  480. struct spectral_samp_data samp_data;
  481. } __ATTRIB_PACKED;
  482. /* Forward declarations */
  483. struct wlan_objmgr_pdev;
  484. /**
  485. * struct spectral_nl_cb - Spectral Netlink callbacks
  486. * @get_nbuff: Get the socket buffer to send the data to the application
  487. * @send_nl_bcast: Send data to the application using netlink broadcast
  488. * @send_nl_unicast: Send data to the application using netlink unicast
  489. * @destroy_netlink: De-initialize Netlink data structures
  490. */
  491. struct spectral_nl_cb {
  492. void *(*get_nbuff)(struct wlan_objmgr_pdev *pdev);
  493. int (*send_nl_bcast)(struct wlan_objmgr_pdev *pdev);
  494. int (*send_nl_unicast)(struct wlan_objmgr_pdev *pdev);
  495. int (*destroy_netlink)(struct wlan_objmgr_pdev *pdev);
  496. };
  497. #ifdef WIN32
  498. #pragma pack(pop, spectral)
  499. #endif
  500. #ifdef __ATTRIB_PACKED
  501. #undef __ATTRIB_PACKED
  502. #endif
  503. #endif /* _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_ */