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