wlan_spectral_public_structs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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_GEN_I_DEFAULT (35)
  99. #define SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT (35)
  100. #define SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT (224)
  101. #define SPECTRAL_SCAN_PRIORITY_DEFAULT (1)
  102. #define SPECTRAL_SCAN_FFT_SIZE_DEFAULT (7)
  103. #define SPECTRAL_SCAN_GC_ENA_DEFAULT (1)
  104. #define SPECTRAL_SCAN_RESTART_ENA_DEFAULT (0)
  105. #define SPECTRAL_SCAN_NOISE_FLOOR_REF_DEFAULT (-96)
  106. #define SPECTRAL_SCAN_INIT_DELAY_DEFAULT (80)
  107. #define SPECTRAL_SCAN_NB_TONE_THR_DEFAULT (12)
  108. #define SPECTRAL_SCAN_STR_BIN_THR_DEFAULT (8)
  109. #define SPECTRAL_SCAN_WB_RPT_MODE_DEFAULT (0)
  110. #define SPECTRAL_SCAN_RSSI_RPT_MODE_DEFAULT (0)
  111. #define SPECTRAL_SCAN_RSSI_THR_DEFAULT (0xf0)
  112. #define SPECTRAL_SCAN_PWR_FORMAT_DEFAULT (0)
  113. #define SPECTRAL_SCAN_RPT_MODE_DEFAULT (2)
  114. #define SPECTRAL_SCAN_BIN_SCALE_DEFAULT (1)
  115. #define SPECTRAL_SCAN_DBM_ADJ_DEFAULT (1)
  116. #define SPECTRAL_SCAN_CHN_MASK_DEFAULT (1)
  117. #endif /* SPECTRAL_USE_EMU_DEFAULTS */
  118. /* The below two definitions apply only to pre-11ac chipsets */
  119. #define SPECTRAL_SCAN_SHORT_REPORT_DEFAULT (1)
  120. #define SPECTRAL_SCAN_FFT_PERIOD_DEFAULT (1)
  121. /**
  122. * enum wlan_cfg80211_spectral_vendorcmd_handler_idx - Indices to cfg80211
  123. * spectral vendor command handlers
  124. * @SPECTRAL_SCAN_START_HANDLER_IDX: Index to SPECTRAL_SCAN_START handler
  125. * @SPECTRAL_SCAN_STOP_HANDLER_IDX: Index to SPECTRAL_SCAN_STOP handler
  126. * @SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CONFIG
  127. * handler
  128. * @SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX: Index to
  129. * SPECTRAL_SCAN_GET_DIAG_STATS handler
  130. * @SPECTRAL_SCAN_GET_CAP_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CAP handler
  131. * @SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_STATUS
  132. * handler
  133. * @SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX: Number of cfg80211 spectral
  134. * vendor command handlers supported
  135. */
  136. enum wlan_cfg80211_spectral_vendorcmd_handler_idx {
  137. SPECTRAL_SCAN_START_HANDLER_IDX,
  138. SPECTRAL_SCAN_STOP_HANDLER_IDX,
  139. SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX,
  140. SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX,
  141. SPECTRAL_SCAN_GET_CAP_HANDLER_IDX,
  142. SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
  143. SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX,
  144. };
  145. /**
  146. * enum spectral_debug - Spectral debug level
  147. * @DEBUG_SPECTRAL: Minimal SPECTRAL debug
  148. * @DEBUG_SPECTRAL1: Normal SPECTRAL debug
  149. * @DEBUG_SPECTRAL2: Maximal SPECTRAL debug
  150. * @DEBUG_SPECTRAL3: Matched filterID display
  151. * @DEBUG_SPECTRAL4: One time dump of FFT report
  152. */
  153. enum spectral_debug {
  154. DEBUG_SPECTRAL = 0x00000100,
  155. DEBUG_SPECTRAL1 = 0x00000200,
  156. DEBUG_SPECTRAL2 = 0x00000400,
  157. DEBUG_SPECTRAL3 = 0x00000800,
  158. DEBUG_SPECTRAL4 = 0x00001000,
  159. };
  160. /**
  161. * enum spectral_capability_type - Spectral capability type
  162. * @SPECTRAL_CAP_PHYDIAG: Phydiag capability
  163. * @SPECTRAL_CAP_RADAR: Radar detection capability
  164. * @SPECTRAL_CAP_SPECTRAL_SCAN: Spectral capability
  165. * @SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN: Advanced spectral capability
  166. */
  167. enum spectral_capability_type {
  168. SPECTRAL_CAP_PHYDIAG,
  169. SPECTRAL_CAP_RADAR,
  170. SPECTRAL_CAP_SPECTRAL_SCAN,
  171. SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN,
  172. };
  173. /**
  174. * struct spectral_chan_stats - channel status info
  175. * @cycle_count: Cycle count
  176. * @channel_load: Channel load
  177. * @per: Period
  178. * @noisefloor: Noise floor
  179. * @comp_usablity: Computed usability
  180. * @maxregpower: Maximum allowed regulatory power
  181. * @comp_usablity_sec80: Computed usability of secondary 80 Mhz
  182. * @maxregpower_sec80: Max regulatory power of secondary 80 Mhz
  183. */
  184. struct spectral_chan_stats {
  185. int cycle_count;
  186. int channel_load;
  187. int per;
  188. int noisefloor;
  189. uint16_t comp_usablity;
  190. int8_t maxregpower;
  191. uint16_t comp_usablity_sec80;
  192. int8_t maxregpower_sec80;
  193. };
  194. /**
  195. * struct spectral_diag_stats - spectral diag stats
  196. * @spectral_mismatch: Spectral TLV signature mismatches
  197. * @spectral_sec80_sfft_insufflen: Insufficient length when parsing for
  198. * Secondary 80 Search FFT report
  199. * @spectral_no_sec80_sfft: Secondary 80 Search FFT report
  200. * TLV not found
  201. * @spectral_vhtseg1id_mismatch: VHT Operation Segment 1 ID
  202. * mismatches in Search FFT report
  203. * @spectral_vhtseg2id_mismatch: VHT Operation Segment 2 ID
  204. * mismatches in Search FFT report
  205. */
  206. struct spectral_diag_stats {
  207. uint64_t spectral_mismatch;
  208. uint64_t spectral_sec80_sfft_insufflen;
  209. uint64_t spectral_no_sec80_sfft;
  210. uint64_t spectral_vhtseg1id_mismatch;
  211. uint64_t spectral_vhtseg2id_mismatch;
  212. };
  213. /**
  214. * struct spectral_caps - Spectral capabilities structure
  215. * @phydiag_cap: Phydiag capability
  216. * @radar_cap: Radar detection capability
  217. * @spectral_cap: Spectral capability
  218. * @advncd_spectral_cap: Advanced spectral capability
  219. * @hw_gen: Spectral hw generation
  220. */
  221. struct spectral_caps {
  222. uint8_t phydiag_cap;
  223. uint8_t radar_cap;
  224. uint8_t spectral_cap;
  225. uint8_t advncd_spectral_cap;
  226. uint32_t hw_gen;
  227. };
  228. /**
  229. * struct spectral_config - spectral config parameters
  230. * @ss_fft_period: Skip interval for FFT reports
  231. * @ss_period: Spectral scan period
  232. * @ss_count: # of reports to return from ss_active
  233. * @ss_short_report: Set to report only 1 set of FFT results
  234. * @radar_bin_thresh_sel: Select threshold to classify strong bin for FFT
  235. * @ss_spectral_pri: Priority, and are we doing a noise power cal ?
  236. * @ss_fft_size: Defines the number of FFT data points to compute,
  237. * defined as a log index num_fft_pts =
  238. * 2^ss_fft_size
  239. * @ss_gc_ena: Set, to enable targeted gain change before
  240. * starting the spectral scan FFT
  241. * @ss_restart_ena: Set, to enable abort of receive frames when in high
  242. * priority and a spectral scan is queued
  243. * @ss_noise_floor_ref: Noise floor reference number (signed) for the
  244. * calculation of bin power (dBm) Though stored as an
  245. * unsigned this should be treated as a signed 8-bit int.
  246. * @ss_init_delay: Disallow spectral scan triggers after tx/rx packets
  247. * by setting this delay value to roughly SIFS time
  248. * period or greater Delay timer count in units of 0.25us
  249. * @ss_nb_tone_thr: Number of strong bins (inclusive) per sub-channel,
  250. * below which a signal is declared a narrowband tone
  251. * @ss_str_bin_thr: Bin/max_bin ratio threshold over which a bin is
  252. * declared strong (for spectral scan bandwidth analysis)
  253. * @ss_wb_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER
  254. * (phy_error=36), if none of the sub-channels are
  255. * deemed narrowband
  256. * @ss_rssi_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER
  257. * (phy_error=36), if the ADC RSSI is below the
  258. * threshold ss_rssi_thr
  259. * @ss_rssi_thr: ADC RSSI must be greater than or equal to this
  260. * threshold (signed Db) to ensure spectral scan
  261. * reporting with normal phy error codes (please see
  262. * ss_rssi_rpt_mode above).Though stored as an unsigned
  263. * value, this should be treated as a signed 8-bit int
  264. * @ss_pwr_format: Format of frequency bin magnitude for spectral scan
  265. * triggered FFTs 0: linear magnitude
  266. * 1: log magnitude (20*log10(lin_mag), 1/2 dB step size)
  267. * @ss_rpt_mode: Format of per-FFT reports to software for spectral
  268. * scan triggered FFTs
  269. * 0: No FFT report (only pulse end summary)
  270. * 1: 2-dword summary of metrics for each completed FFT
  271. * 2: 2-dword summary + 1x-oversampled bins(in-band) per
  272. * FFT
  273. * 3: 2-dword summary + 2x-oversampled bins (all) per FFT
  274. * @ss_bin_scale: Number of LSBs to shift out to scale the FFT bins
  275. * for spectral scan triggered FFTs
  276. * @ss_dbm_adj: Set (with ss_pwr_format=1), to report bin
  277. * magnitudes
  278. * converted to dBm power using the noisefloor
  279. * calibration results
  280. * @ss_chn_mask: Per chain enable mask to select input ADC for search
  281. * FFT
  282. * @ss_nf_cal: nf calibrated values for ctl+ext
  283. * @ss_nf_pwr: nf pwr values for ctl+ext
  284. * @ss_nf_temp_data: temperature data taken during nf scan
  285. */
  286. struct spectral_config {
  287. uint16_t ss_fft_period;
  288. uint16_t ss_period;
  289. uint16_t ss_count;
  290. uint16_t ss_short_report;
  291. uint8_t radar_bin_thresh_sel;
  292. uint16_t ss_spectral_pri;
  293. uint16_t ss_fft_size;
  294. uint16_t ss_gc_ena;
  295. uint16_t ss_restart_ena;
  296. uint16_t ss_noise_floor_ref;
  297. uint16_t ss_init_delay;
  298. uint16_t ss_nb_tone_thr;
  299. uint16_t ss_str_bin_thr;
  300. uint16_t ss_wb_rpt_mode;
  301. uint16_t ss_rssi_rpt_mode;
  302. uint16_t ss_rssi_thr;
  303. uint16_t ss_pwr_format;
  304. uint16_t ss_rpt_mode;
  305. uint16_t ss_bin_scale;
  306. uint16_t ss_dbm_adj;
  307. uint16_t ss_chn_mask;
  308. int8_t ss_nf_cal[AH_MAX_CHAINS * 2];
  309. int8_t ss_nf_pwr[AH_MAX_CHAINS * 2];
  310. int32_t ss_nf_temp_data;
  311. };
  312. /**
  313. * struct spectral_scan_state - State of spectral scan
  314. * @is_active: Is spectral scan active
  315. * @is_enabled: Is spectral scan enabled
  316. */
  317. struct spectral_scan_state {
  318. uint8_t is_active;
  319. uint8_t is_enabled;
  320. };
  321. /**
  322. * enum dcs_int_type - Interference type indicated by DCS
  323. * @SPECTRAL_DCS_INT_NONE: No interference
  324. * @SPECTRAL_DCS_INT_CW: CW interference
  325. * @SPECTRAL_DCS_INT_WIFI: WLAN interference
  326. */
  327. enum dcs_int_type {
  328. SPECTRAL_DCS_INT_NONE,
  329. SPECTRAL_DCS_INT_CW,
  330. SPECTRAL_DCS_INT_WIFI
  331. };
  332. /**
  333. * struct interf_rsp - Interference record
  334. * @interf_type: eINTERF_TYPE giving type of interference
  335. * @interf_min_freq: Minimum frequency in MHz at which interference has been
  336. * found
  337. * @interf_max_freq: Maximum frequency in MHz at which interference has been
  338. * found
  339. * @advncd_spectral_cap: Advanced spectral capability
  340. */
  341. struct interf_rsp {
  342. uint8_t interf_type;
  343. uint16_t interf_min_freq;
  344. uint16_t interf_max_freq;
  345. } __ATTRIB_PACKED;
  346. /**
  347. * struct interf_src_rsp - List of interference sources
  348. * @count: Number of interference records
  349. * @interf: Array of interference records
  350. */
  351. struct interf_src_rsp {
  352. uint16_t count;
  353. struct interf_rsp interf[MAX_INTERF];
  354. } __ATTRIB_PACKED;
  355. /**
  356. * struct spectral_classifier_params - spectral classifier parameters
  357. * @spectral_20_40_mode: Is AP in 20/40 mode?
  358. * @spectral_dc_index: DC index
  359. * @spectral_dc_in_mhz: DC in MHz
  360. * @upper_chan_in_mhz: Upper channel in MHz
  361. * @lower_chan_in_mhz: Lower channel in MHz
  362. */
  363. struct spectral_classifier_params {
  364. int spectral_20_40_mode;
  365. int spectral_dc_index;
  366. int spectral_dc_in_mhz;
  367. int upper_chan_in_mhz;
  368. int lower_chan_in_mhz;
  369. } __ATTRIB_PACKED;
  370. /**
  371. * struct spectral_samp_data - Spectral Analysis Messaging Protocol Data format
  372. * @spectral_data_len: Indicates the bin size
  373. * @spectral_data_len_sec80: Indicates the bin size for secondary 80 segment
  374. * @spectral_rssi: Indicates RSSI
  375. * @spectral_rssi_sec80: Indicates RSSI for secondary 80 segment
  376. * @spectral_combined_rssi: Indicates combined RSSI from all antennas
  377. * @spectral_upper_rssi: Indicates RSSI of upper band
  378. * @spectral_lower_rssi: Indicates RSSI of lower band
  379. * @spectral_chain_ctl_rssi: RSSI for control channel, for all antennas
  380. * @spectral_chain_ext_rssi: RSSI for extension channel, for all antennas
  381. * @spectral_max_scale: Indicates scale factor
  382. * @spectral_bwinfo: Indicates bandwidth info
  383. * @spectral_tstamp: Indicates timestamp
  384. * @spectral_max_index: Indicates the index of max magnitude
  385. * @spectral_max_index_sec80: Indicates the index of max magnitude for secondary
  386. * 80 segment
  387. * @spectral_max_mag: Indicates the maximum magnitude
  388. * @spectral_max_mag_sec80: Indicates the maximum magnitude for secondary 80
  389. * segment
  390. * @spectral_max_exp: Indicates the max exp
  391. * @spectral_last_tstamp: Indicates the last time stamp
  392. * @spectral_upper_max_index: Indicates the index of max mag in upper band
  393. * @spectral_lower_max_index: Indicates the index of max mag in lower band
  394. * @spectral_nb_upper: Not Used
  395. * @spectral_nb_lower: Not Used
  396. * @classifier_params: Indicates classifier parameters
  397. * @bin_pwr_count: Indicates the number of FFT bins
  398. * @lb_edge_extrabins: Number of extra bins on left band edge
  399. * @rb_edge_extrabins: Number of extra bins on right band edge
  400. * @bin_pwr_count_sec80: Indicates the number of FFT bins in secondary 80
  401. * segment
  402. * @bin_pwr: Contains FFT magnitudes
  403. * @bin_pwr_sec80: Contains FFT magnitudes for the secondary 80
  404. * segment
  405. * @interf_list: List of interfernce sources
  406. * @noise_floor: Indicates the current noise floor
  407. * @noise_floor_sec80: Indicates the current noise floor for secondary 80
  408. * segment
  409. * @ch_width: Channel width 20/40/80/160 MHz
  410. */
  411. struct spectral_samp_data {
  412. int16_t spectral_data_len;
  413. int16_t spectral_data_len_sec80;
  414. int16_t spectral_rssi;
  415. int16_t spectral_rssi_sec80;
  416. int8_t spectral_combined_rssi;
  417. int8_t spectral_upper_rssi;
  418. int8_t spectral_lower_rssi;
  419. int8_t spectral_chain_ctl_rssi[MAX_SPECTRAL_CHAINS];
  420. int8_t spectral_chain_ext_rssi[MAX_SPECTRAL_CHAINS];
  421. uint8_t spectral_max_scale;
  422. int16_t spectral_bwinfo;
  423. int32_t spectral_tstamp;
  424. int16_t spectral_max_index;
  425. int16_t spectral_max_index_sec80;
  426. int16_t spectral_max_mag;
  427. int16_t spectral_max_mag_sec80;
  428. uint8_t spectral_max_exp;
  429. int32_t spectral_last_tstamp;
  430. int16_t spectral_upper_max_index;
  431. int16_t spectral_lower_max_index;
  432. uint8_t spectral_nb_upper;
  433. uint8_t spectral_nb_lower;
  434. struct spectral_classifier_params classifier_params;
  435. uint16_t bin_pwr_count;
  436. /*
  437. * For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are
  438. * delivered. However, there can be additional bins reported for
  439. * AR900B version 2.0 and QCA9984 as described next:
  440. *
  441. * AR900B version 2.0: An additional tone is processed on the right
  442. * hand side in order to facilitate detection of radar pulses out to
  443. * the extreme band-edge of the channel frequency.
  444. * Since the HW design processes four tones at a time,
  445. * this requires one additional Dword to be added to the
  446. * search FFT report.
  447. *
  448. * QCA9984: When spectral_scan_rpt_mode=2, i.e 2-dword summary +
  449. * 1x-oversampled bins (in-band) per FFT,
  450. * then 8 more bins (4 more on left side and 4 more on right side)
  451. * are added.
  452. */
  453. uint8_t lb_edge_extrabins;
  454. uint8_t rb_edge_extrabins;
  455. uint16_t bin_pwr_count_sec80;
  456. uint8_t bin_pwr[MAX_NUM_BINS];
  457. uint8_t bin_pwr_sec80[MAX_NUM_BINS];
  458. struct interf_src_rsp interf_list;
  459. int16_t noise_floor;
  460. int16_t noise_floor_sec80;
  461. uint32_t ch_width;
  462. } __ATTRIB_PACKED;
  463. /**
  464. * struct spectral_samp_msg - Spectral SAMP message
  465. * @signature: Validates the SAMP message
  466. * @freq: Operating frequency in MHz
  467. * @vhtop_ch_freq_seg1: VHT Segment 1 centre frequency in MHz
  468. * @vhtop_ch_freq_seg2: VHT Segment 2 centre frequency in MHz
  469. * @freq_loading: How busy was the channel
  470. * @dcs_enabled: Whether DCS is enabled
  471. * @int_type: Interference type indicated by DCS
  472. * @macaddr: Indicates the device interface
  473. * @samp_data: SAMP Data
  474. */
  475. struct spectral_samp_msg {
  476. uint32_t signature;
  477. uint16_t freq;
  478. uint16_t vhtop_ch_freq_seg1;
  479. uint16_t vhtop_ch_freq_seg2;
  480. uint16_t freq_loading;
  481. uint16_t dcs_enabled;
  482. enum dcs_int_type int_type;
  483. uint8_t macaddr[6];
  484. struct spectral_samp_data samp_data;
  485. } __ATTRIB_PACKED;
  486. /* Forward declarations */
  487. struct wlan_objmgr_pdev;
  488. /**
  489. * struct spectral_nl_cb - Spectral Netlink callbacks
  490. * @get_nbuff: Get the socket buffer to send the data to the application
  491. * @send_nl_bcast: Send data to the application using netlink broadcast
  492. * @send_nl_unicast: Send data to the application using netlink unicast
  493. */
  494. struct spectral_nl_cb {
  495. void *(*get_nbuff)(struct wlan_objmgr_pdev *pdev);
  496. int (*send_nl_bcast)(struct wlan_objmgr_pdev *pdev);
  497. int (*send_nl_unicast)(struct wlan_objmgr_pdev *pdev);
  498. };
  499. #ifdef WIN32
  500. #pragma pack(pop, spectral)
  501. #endif
  502. #ifdef __ATTRIB_PACKED
  503. #undef __ATTRIB_PACKED
  504. #endif
  505. #endif /* _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_ */