xref: /wlan-dirver/qca-wifi-host-cmn/umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: wlan_dfs_public_struct.h
21  * This file contains DFS data structures
22  */
23 
24 #ifndef __WLAN_DFS_PUBLIC_STRUCT_H_
25 #define __WLAN_DFS_PUBLIC_STRUCT_H_
26 
27 /* TODO: This structure has many redundant variables, needs cleanup */
28 /**
29  * struct radar_found_info - radar found info
30  * @pdev_id:        pdev id.
31  * @detection_mode: 0 indicates RADAR detected, non-zero indicates debug mode.
32  * @freq_offset:    frequency offset.
33  * @chan_width:     channel width.
34  * @detector_id:    detector id for full-offload.
35  * @segment_id:     segment id (same as detector_id) for partial-offload.
36  * @timestamp:      timestamp (Time when filter match is found in Firmware).
37  * @is_chirp:       is chirp or not.
38  * @chan_freq:      channel frequency (Primary channel frequency).
39  * @radar_freq:     radar frequency (Is it same as '@chan_freq'?).
40  * @sidx:           sidx value (same as freq_offset).
41  */
42 struct radar_found_info {
43 	uint32_t pdev_id;
44 	uint32_t detection_mode;
45 	int32_t freq_offset;
46 	uint32_t chan_width;
47 	uint32_t detector_id;
48 	uint32_t segment_id;
49 	uint32_t timestamp;
50 	uint32_t is_chirp;
51 	uint32_t chan_freq;
52 	uint32_t radar_freq;
53 	int32_t  sidx;
54 };
55 
56 /**
57  * struct dfs_acs_info - acs info, ch range
58  * @acs_mode: to enable/disable acs 1/0.
59  * @chan_freq_list: channel frequency list
60  * @num_of_channel: number of channel in ACS channel list
61  */
62 struct dfs_acs_info {
63 	uint8_t acs_mode;
64 	uint32_t *chan_freq_list;
65 	uint8_t num_of_channel;
66 };
67 
68 /**
69  * struct radar_event_info - radar event info.
70  * @pulse_is_chirp: flag to indicate if this pulse is chirp.
71  * @pulse_center_freq: the center frequency of the radar pulse detected, KHz.
72  * @pulse_duration: the duaration of the pulse in us.
73  * @rssi: RSSI recorded in the ppdu.
74  * @pulse_detect_ts: timestamp indicates the time when DFS pulse is detected.
75  * @upload_fullts_low: low 32 tsf timestamp get from MAC tsf timer indicates
76  *  the time that the radar event uploading to host.
77  * @upload_fullts_high: high 32 tsf timestamp get from MAC tsf timer indicates
78  *  the time that the radar event uploading to host.
79  * @peak_sidx: index of peak magnitude bin (signed)
80  * @pdev_id: pdev_id for identifying the MAC.
81  * @delta_diff: Delta diff value.
82  * @delta_peak: Delta peak value.
83  * @psidx_diff: Psidx diff value.
84  * @is_psidx_diff_valid: Does fw send valid psidx diff.
85  */
86 struct radar_event_info {
87 	uint8_t  pulse_is_chirp;
88 	uint32_t pulse_center_freq;
89 	uint32_t pulse_duration;
90 	uint8_t  rssi;
91 	uint32_t pulse_detect_ts;
92 	uint32_t upload_fullts_low;
93 	uint32_t upload_fullts_high;
94 	int32_t  peak_sidx;
95 	uint8_t  pdev_id;
96 	uint8_t  delta_diff;
97 	int8_t   delta_peak;
98 	int8_t   psidx_diff;
99 	int8_t   is_psidx_diff_valid;
100 };
101 
102 /**
103  * struct dfs_user_config - user configuration required for for DFS.
104  * @dfs_is_phyerr_filter_offload: flag to indicate DFS phyerr filtering offload.
105  */
106 struct dfs_user_config {
107 	bool dfs_is_phyerr_filter_offload;
108 };
109 
110 /**
111  * struct dfs_radar_found_params - radar found parameters.
112  * @pri_min: Minimum PRI of detected radar pulse.
113  * @pri_max: Max PRI of detected radar pulse.
114  * @duration_min: Min duration of detected pulse in us.
115  * @duration_max: Max duration of detected pulse in us.
116  * @sidx_min: Min softare index of detected radar pulse.
117  * @sidx_max: Max software index of detected radar pulse.
118  */
119 struct dfs_radar_found_params {
120 	u_int32_t pri_min;
121 	u_int32_t pri_max;
122 	u_int32_t duration_min;
123 	u_int32_t duration_max;
124 	u_int32_t sidx_min;
125 	u_int32_t sidx_max;
126 };
127 
128 /**
129  * enum adfs_ocac_mode - Various Off-Channel CAC modes.
130  * @QUICK_OCAC_MODE: Used for OCAC where the CAC timeout value is finite.
131  *                   This is also known as PreCAC.
132  * @EXTENSIVE_OCAC:  Extensive OCAC.
133  * @QUICK_RCAC_MODE: Used for RollingCAC where the timeout value is assumed to
134  *                   be infinite by the Firmware code, that is, the FW has to
135  *                   be on the agile channel until host stop/aborts the agile
136  *                   CAC.
137  */
138 enum adfs_ocac_mode {
139 	QUICK_OCAC_MODE = 0,
140 	EXTENSIVE_OCAC_MODE,
141 	QUICK_RCAC_MODE,
142 };
143 
144 /**
145  * struct dfs_agile_cac_params - Agile DFS-CAC parameters.
146  * @precac_chan:           Agile preCAC channel.
147  * @precac_center_freq_1:  Agile preCAC channel frequency in MHz for 20/40/80/
148  *                         160 and left center frequency(5690MHz) for restricted
149  *                         80p80.
150  * @precac_center_freq_2:  Second segment Agile frequency if applicable. 0 for
151  *                         20/40/80/160 and right center frequency(5775MHz) for
152  *                         restricted 80p80.
153  * @precac_chwidth:        Agile preCAC channel width.
154  * @min_precac_timeout:    Minimum agile preCAC timeout.
155  * @max_precac_timeout:    Maximum agile preCAC timeout.
156  * @ocac_mode:             Off-Channel CAC mode.
157  */
158 struct dfs_agile_cac_params {
159 	uint8_t precac_chan;
160 	uint16_t precac_center_freq_1;
161 	uint16_t precac_center_freq_2;
162 	enum phy_ch_width precac_chwidth;
163 	uint32_t min_precac_timeout;
164 	uint32_t max_precac_timeout;
165 	enum adfs_ocac_mode ocac_mode;
166 };
167 #endif
168