xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/inc/wlan_scan_public_structs.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
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: contains scan structure definations
21  */
22 
23 #ifndef _WLAN_SCAN_STRUCTS_H_
24 #define _WLAN_SCAN_STRUCTS_H_
25 #include <wlan_cmn.h>
26 #include <qdf_time.h>
27 #include <qdf_list.h>
28 #include <qdf_atomic.h>
29 #include <wlan_cmn_ieee80211.h>
30 #include <wlan_mgmt_txrx_utils_api.h>
31 #include <reg_services_public_struct.h>
32 
33 typedef uint16_t wlan_scan_requester;
34 typedef uint32_t wlan_scan_id;
35 
36 #define WLAN_SCAN_MAX_HINT_S_SSID        10
37 #define WLAN_SCAN_MAX_HINT_BSSID         10
38 #define MAX_RNR_BSS                      5
39 #define WLAN_SCAN_MAX_NUM_SSID          16
40 #define WLAN_SCAN_MAX_NUM_BSSID         4
41 
42 #define SCM_CANCEL_SCAN_WAIT_TIME 50
43 #define SCM_CANCEL_SCAN_WAIT_ITERATION 600
44 
45 #define INVAL_SCAN_ID        0xFFFFFFFF
46 #define CANCEL_HOST_SCAN_ID  0xFFFFFFFE
47 #define INVAL_VDEV_ID        0xFFFFFFFF
48 #define INVAL_PDEV_ID        0xFFFFFFFF
49 
50 #define USER_SCAN_REQUESTOR_ID  0xA0000
51 #define PREAUTH_REQUESTOR_ID    0xC0000
52 
53 #define BURST_SCAN_MAX_NUM_OFFCHANNELS 3
54 #define P2P_SCAN_MAX_BURST_DURATION 180
55 /* Increase dwell time for P2P search in ms */
56 #define P2P_SEARCH_DWELL_TIME_INC 20
57 
58 #define PROBE_REQ_BITMAP_LEN 8
59 #define MAX_PROBE_REQ_OUIS 16
60 
61 /* forward declaration */
62 struct wlan_objmgr_vdev;
63 struct wlan_objmgr_pdev;
64 struct wlan_objmgr_psoc;
65 
66 /**
67  * struct channel_info - BSS channel information
68  * @chan_freq: channel frequency
69  * @cfreq0: channel frequency index0
70  * @cfreq1: channel frequency index1
71  * @priv: channel private information
72  */
73 struct channel_info {
74 	uint32_t chan_freq;
75 	uint32_t cfreq0;
76 	uint32_t cfreq1;
77 	void *priv;
78 };
79 
80 /**
81  * struct ie_list - pointers to various IEs
82  * @tim:        pointer to tim ie
83  * @country:    pointer to country ie
84  * @ssid:       pointer to ssid ie
85  * @rates:      pointer to supported rates ie
86  * @xrates:     pointer to extended supported rate ie
87  * @ds_param:   pointer to ds params
88  * @csa:        pointer to csa ie
89  * @xcsa:       pointer to extended csa ie
90  * @mcst:       pointer to maximum channel switch time ie
91  * @wpa:        pointer to wpa ie
92  * @wcn:        pointer to wcn ie
93  * @rsn:        pointer to rsn ie
94  * @wps:        pointer to wps ie
95  * @wmeinfo:    pointer to wmeinfo ie
96  * @wmeparam:   pointer to wmeparam ie
97  * @quiet:      pointer to quiet ie
98  * @htcap:      pointer to htcap ie
99  * @htinfo:     pointer to htinfo ie
100  * @athcaps:    pointer to athcaps ie
101  * @athextcaps: pointer to extended athcaps ie
102  * @sfa:        pointer to sfa ie
103  * @vendor:     pointer to vendor ie
104  * @qbssload:   pointer to qbssload ie
105  * @wapi:       pointer to wapi ie
106  * @p2p:        pointer to p2p ie
107  * @alt_wcn:    pointer to alternate wcn ie
108  * @extcaps:    pointer to extended caps ie
109  * @ibssdfs:    pointer to ibssdfs ie
110  * @sonadv:     pointer to wifi son ie
111  * @vhtcap:     pointer to vhtcap ie
112  * @vhtop:      pointer to vhtop ie
113  * @opmode:     pointer to opmode ie
114  * @cswrp:      pointer to channel switch announcement wrapper ie
115  * @widebw:     pointer to wide band channel switch sub ie
116  * @txpwrenvlp: pointer to tx power envelop sub ie
117  * @hecap:      pointer to hecap ie
118  * @hecap_6g:   pointer to he 6ghz cap ie
119  * @srp: pointer to spatial reuse parameter sub extended ie
120  * @fils_indication: pointer to FILS indication ie
121  * @esp: pointer to ESP indication ie
122  * @mbo_oce: pointer to mbo/oce indication ie
123  * @rnrie: reduced neighbor report IE
124  * @adaptive_11r: pointer to adaptive 11r IE
125  * @single_pmk: Pointer to sae single pmk IE
126  */
127 struct ie_list {
128 	uint8_t *tim;
129 	uint8_t *country;
130 	uint8_t *ssid;
131 	uint8_t *rates;
132 	uint8_t *xrates;
133 	uint8_t *ds_param;
134 	uint8_t *csa;
135 	uint8_t *xcsa;
136 	uint8_t *mcst;
137 	uint8_t *wpa;
138 	uint8_t *wcn;
139 	uint8_t *rsn;
140 	uint8_t *wps;
141 	uint8_t *wmeinfo;
142 	uint8_t *wmeparam;
143 	uint8_t *quiet;
144 	uint8_t *htcap;
145 	uint8_t *htinfo;
146 	uint8_t *athcaps;
147 	uint8_t *athextcaps;
148 	uint8_t *sfa;
149 	uint8_t *vendor;
150 	uint8_t *qbssload;
151 	uint8_t *wapi;
152 	uint8_t *p2p;
153 	uint8_t *alt_wcn;
154 	uint8_t *extcaps;
155 	uint8_t *ibssdfs;
156 	uint8_t *sonadv;
157 	uint8_t *vhtcap;
158 	uint8_t *vhtop;
159 	uint8_t *opmode;
160 	uint8_t *cswrp;
161 	uint8_t *widebw;
162 	uint8_t *txpwrenvlp;
163 	uint8_t *bwnss_map;
164 	uint8_t *secchanoff;
165 	uint8_t *mdie;
166 	uint8_t *hecap;
167 	uint8_t *hecap_6g;
168 	uint8_t *heop;
169 	uint8_t *srp;
170 	uint8_t *fils_indication;
171 	uint8_t *esp;
172 	uint8_t *mbo_oce;
173 	uint8_t *muedca;
174 	uint8_t *rnrie;
175 	uint8_t *extender;
176 	uint8_t *adaptive_11r;
177 	uint8_t *single_pmk;
178 };
179 
180 enum scan_entry_connection_state {
181 	SCAN_ENTRY_CON_STATE_NONE,
182 	SCAN_ENTRY_CON_STATE_AUTH,
183 	SCAN_ENTRY_CON_STATE_ASSOC
184 };
185 
186 /**
187  * struct mlme_info - mlme specific info
188  * temporarily maintained in scan cache for backward compatibility.
189  * must be removed as part of umac convergence.
190  * @bad_ap_time: time when this ap was marked bad
191  * @status: status
192  * @rank: rank
193  * @utility: utility
194  * @assoc_state: association state
195  * @chanload: channel load
196  */
197 struct mlme_info {
198 	qdf_time_t bad_ap_time;
199 	uint32_t status;
200 	uint32_t rank;
201 	uint32_t utility;
202 	uint32_t assoc_state;
203 	uint32_t chanload;
204 };
205 
206 /**
207  * struct bss_info - information required to uniquely define a bss
208  * @freq: freq of operating primary channel
209  * @ssid: ssid of bss
210  * @bssid: bssid of bss
211  */
212 struct bss_info {
213 	uint32_t freq;
214 	struct wlan_ssid ssid;
215 	struct qdf_mac_addr bssid;
216 };
217 
218 #define SCAN_NODE_ACTIVE_COOKIE 0x1248F842
219 /**
220  * struct scan_cache_node - Scan cache entry node
221  * @node: node pointers
222  * @ref_cnt: ref count if in use
223  * @cookie: cookie to check if entry is logically active
224  * @entry: scan entry pointer
225  */
226 struct scan_cache_node {
227 	qdf_list_node_t node;
228 	qdf_atomic_t ref_cnt;
229 	uint32_t cookie;
230 	struct scan_cache_entry *entry;
231 };
232 
233 /**
234  * struct security_info - Scan cache security info
235  * @authmodeset: auth mode
236  * @key_mgmt: key management
237  * @ucastcipherset: unicast cipher set
238  * @mcastcipherset: multicast cipher set
239  * @mgmtcipherset: mgmt cipher set
240  */
241 struct security_info {
242 	uint32_t authmodeset;
243 	uint32_t key_mgmt;
244 	uint32_t ucastcipherset;
245 	uint32_t mcastcipherset;
246 	uint32_t mgmtcipherset;
247 };
248 
249 /**
250  * struct scan_mbssid_info - Scan mbssid information
251  * @profile_num: profile number
252  * @profile_count: total profile count
253  * @trans_bssid: TX BSSID address
254  */
255 struct scan_mbssid_info {
256 	uint8_t profile_num;
257 	uint8_t profile_count;
258 	uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
259 };
260 
261 /**
262  * struct rnr_bss_info - Reduced Neighbor Report BSS information
263  * @neighbor_ap_tbtt_offset: Neighbor AP TBTT offset
264  * @channel_number: channel number
265  * @operating_class: operting class
266  * @bssid: BSS MAC address
267  * @short_ssid: short ssid
268  * @bss_params: BSS parameters
269  * @psd_20mhz: 20MHz power spectral density
270  */
271 struct rnr_bss_info {
272 	uint8_t neighbor_ap_tbtt_offset;
273 	uint32_t channel_number;
274 	uint32_t operating_class;
275 	struct qdf_mac_addr bssid;
276 	uint32_t short_ssid;
277 	uint8_t bss_params;
278 	uint8_t psd_20mhz;
279 };
280 
281 /**
282  * struct tbtt_information_header - TBTT information header
283  * @tbbt_info_fieldtype: TBTT information field type
284  * @filter_neighbor_ap: filtered neighbor ap
285  * @tbbt_info_count: TBTT information count
286  * @tbtt_info_length: TBTT informaiton length
287  */
288 struct tbtt_information_header {
289 	uint16_t tbbt_info_fieldtype:2;
290 	uint16_t filtered_neighbor_ap:1;
291 	uint16_t reserved:1;
292 	uint16_t tbtt_info_count:4;
293 	uint16_t tbtt_info_length:8;
294 };
295 
296 /**
297  * struct neighbor_ap_info_field - Neighbor information field
298  * @tbtt_info_header: TBTT information header
299  * @operting_class: operating class
300  * @channel_number: channel number
301  */
302 struct neighbor_ap_info_field {
303 	struct tbtt_information_header tbtt_header;
304 	uint8_t operting_class;
305 	uint8_t channel_number;
306 };
307 
308 /**
309  * enum tbtt_information_field - TBTT information field
310  * @TBTT_NEIGHBOR_AP_OFFSET_ONLY: TBTT information field type
311  * @TBTT_NEIGHBOR_AP_BSS_PARAM: neighbor AP and bss param
312  * @TBTT_NEIGHBOR_AP_SHORTSSID: neighbor AP and Short ssid
313  * @TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM: neighbor AP, short ssid and bss param
314  * @TBTT_NEIGHBOR_AP_BSSID: neighbor AP and bssid
315  * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM: neighbor AP, bssid and bss param
316  * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid and bss
317  * param and 20MHz PSD
318  * @TBTT_NEIGHBOR_AP_BSSSID_S_SSID: neighbor AP, bssid and short ssid
319  * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM: neighbor AP, bssid, short ssid
320  * and bss params
321  * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid,
322  * short ssid, bss params and 20MHz PSD
323  */
324 enum tbtt_information_field {
325 	TBTT_NEIGHBOR_AP_OFFSET_ONLY = 1,
326 	TBTT_NEIGHBOR_AP_BSS_PARAM = 2,
327 	TBTT_NEIGHBOR_AP_SHORTSSID = 5,
328 	TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM = 6,
329 	TBTT_NEIGHBOR_AP_BSSID = 7,
330 	TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM = 8,
331 	TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD = 9,
332 	TBTT_NEIGHBOR_AP_BSSSID_S_SSID = 11,
333 	TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM = 12,
334 	TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD = 13
335 };
336 
337 /**
338  * struct reduced_neighbor_report - Reduced Neighbor Report
339  * @bss_info: RNR BSS Information
340  */
341 struct reduced_neighbor_report {
342 	struct rnr_bss_info bss_info[MAX_RNR_BSS];
343 };
344 
345 #define SCAN_SECURITY_TYPE_WEP 0x01
346 #define SCAN_SECURITY_TYPE_WPA 0x02
347 #define SCAN_SECURITY_TYPE_WAPI 0x04
348 #define SCAN_SECURITY_TYPE_RSN 0x08
349 
350 /**
351  * struct scan_cache_entry: structure containing scan entry
352  * @frm_subtype: updated from beacon/probe
353  * @bssid: bssid
354  * @mac_addr: mac address
355  * @ssid: ssid
356  * @is_hidden_ssid: is AP having hidden ssid.
357  * @security_type: security supported
358  * @seq_num: sequence number
359  * @phy_mode: Phy mode of the AP
360  * @avg_rssi: Average RSSI of the AP
361  * @rssi_raw: The rssi of the last beacon/probe received
362  * @snr: The snr of the last beacon/probe received
363  * @avg_snr: Average SNR of the AP
364  * @bcn_int: Beacon interval of the AP
365  * @cap_info: Capability of the AP
366  * @tsf_info: TSF info
367  * @erp: erp info
368  * @dtim_period: dtime period
369  * @air_time_fraction: Air time fraction from ESP param
370  * @qbss_chan_load: Qbss channel load
371  * @nss: supported NSS information
372  * @is_p2p_ssid: is P2P entry
373  * @adaptive_11r_ap: flag to check if AP supports adaptive 11r
374  * @scan_entry_time: boottime in microsec when last beacon/probe is received
375  * @rssi_timestamp: boottime in microsec when RSSI was updated
376  * @hidden_ssid_timestamp: boottime in microsec when hidden
377  *                         ssid was received
378  * @mbssid_info: Multi bssid information
379  * @rnr: Reduced neighbor report information
380  * @channel: channel info on which AP is present
381  * @channel_mismatch: if channel received in metadata
382  *                    doesnot match the one in beacon
383  * @tsf_delta: TSF delta
384  * @bss_score: bss score calculated on basis of RSSI/caps etc.
385  * @neg_sec_info: negotiated security info
386  * @per_chain_rssi: per chain RSSI value received.
387  * boottime_ns: boottime in ns.
388  * @rrm_parent_tsf: RRM parent tsf
389  * @mlme_info: Mlme info, this will be updated by MLME for the scan entry
390  * @alt_wcn_ie: alternate WCN IE
391  * @ie_list: IE list pointers
392  * @raw_frame: contain raw frame and the length of the raw frame
393  * @pdev_id: pdev id
394  */
395 struct scan_cache_entry {
396 	uint8_t frm_subtype;
397 	struct qdf_mac_addr bssid;
398 	struct qdf_mac_addr mac_addr;
399 	struct wlan_ssid ssid;
400 	bool is_hidden_ssid;
401 	uint8_t security_type;
402 	uint16_t seq_num;
403 	enum wlan_phymode phy_mode;
404 	int32_t avg_rssi;
405 	int8_t rssi_raw;
406 	uint8_t snr;
407 	uint32_t avg_snr;
408 	uint16_t bcn_int;
409 	union wlan_capability cap_info;
410 	union {
411 		uint8_t data[8];
412 		uint64_t tsf;
413 	} tsf_info;
414 	uint8_t erp;
415 	uint8_t dtim_period;
416 	uint8_t air_time_fraction;
417 	uint8_t qbss_chan_load;
418 	uint8_t nss;
419 	bool is_p2p;
420 	bool adaptive_11r_ap;
421 	qdf_time_t scan_entry_time;
422 	qdf_time_t rssi_timestamp;
423 	qdf_time_t hidden_ssid_timestamp;
424 	struct scan_mbssid_info mbssid_info;
425 	struct reduced_neighbor_report rnr;
426 	struct channel_info channel;
427 	bool channel_mismatch;
428 	struct mlme_info mlme_info;
429 	uint32_t tsf_delta;
430 	uint32_t bss_score;
431 	struct security_info neg_sec_info;
432 	uint8_t per_chain_rssi[WLAN_MGMT_TXRX_HOST_MAX_ANTENNA];
433 	uint64_t boottime_ns;
434 	uint32_t rrm_parent_tsf;
435 	struct element_info alt_wcn_ie;
436 	struct ie_list ie_list;
437 	struct element_info raw_frame;
438 	/*
439 	 * This is added temporarily for 6GHz channel to freq conversion
440 	 * to get pdev wherever it requores to convert frequency to
441 	 * channel as regulatory apis requires pdev as argument
442 	 */
443 	uint8_t pdev_id;
444 };
445 
446 #define MAX_FAVORED_BSSID 16
447 #define MAX_ALLOWED_SSID_LIST 4
448 
449 #define WLAN_SCAN_FILTER_NUM_SSID 5
450 #define WLAN_SCAN_FILTER_NUM_BSSID 5
451 
452 #define REAM_HASH_LEN 2
453 #define CACHE_IDENTIFIER_LEN 2
454 #define HESSID_LEN 6
455 
456 #ifdef WLAN_FEATURE_FILS_SK
457 /**
458  * struct fils_filter_info: FILS info present in scan filter
459  * @realm_check: whether realm check is required
460  * @fils_realm: realm hash value
461  * @security_type: type of security supported
462  */
463 struct fils_filter_info {
464 	bool realm_check;
465 	uint8_t fils_realm[REAM_HASH_LEN];
466 	uint8_t security_type;
467 };
468 #endif
469 
470 /**
471  * struct scan_filter: scan filter
472  * @enable_adaptive_11r:    flag to check if adaptive 11r ini is enabled
473  * @rrm_measurement_filter: For measurement reports.if set, only SSID, BSSID
474  *                          and channel is considered for filtering.
475  * @ignore_pmf_cap: Ignore pmf capability match
476  * @ignore_auth_enc_type: Ignore enc type if
477  *                        this is set (For WPS/OSEN connection)
478  * @ignore_nol_chan: Ignore entry with channel in the NOL list
479  * @age_threshold: If set return entry which are newer than the age_threshold
480  * @num_of_bssid: number of bssid passed
481  * @num_of_ssid: number of ssid
482  * @num_of_channels: number of  channels
483  * @pmf_cap: Pmf capability
484  * @dot11_mode: operating modes 0 mean any
485  *              11a , 11g, 11n , 11ac , 11b etc
486  * @band: to get specific band 2.4G, 5G or 4.9 G
487  * @rssi_threshold: AP having RSSI greater than
488  *                  rssi threasholed (ignored if set 0)
489  * @mobility_domain: Mobility domain for 11r
490  * @authmodeset: auth mode
491  * @key_mgmt: key management
492  * @ucastcipherset: unicast cipher set
493  * @mcastcipherset: multicast cipher set
494  * @mgmtcipherset: mgmt cipher set
495  * @fils_scan_filter: FILS info
496  * @bssid_hint: Mac address of bssid_hint
497  * @bssid_list: bssid list
498  * @ssid_list: ssid list
499  * @chan_freq_list: channel frequency list, frequency unit: MHz
500  */
501 struct scan_filter {
502 	uint8_t enable_adaptive_11r:1,
503 		rrm_measurement_filter:1,
504 		ignore_pmf_cap:1,
505 		ignore_auth_enc_type:1,
506 		ignore_nol_chan:1;
507 	qdf_time_t age_threshold;
508 	uint8_t num_of_bssid;
509 	uint8_t num_of_ssid;
510 	uint16_t num_of_channels;
511 	enum wlan_pmf_cap pmf_cap;
512 	enum wlan_phymode dot11_mode;
513 	enum wlan_band band;
514 	uint8_t rssi_threshold;
515 	uint32_t mobility_domain;
516 	uint32_t authmodeset;
517 	uint32_t key_mgmt;
518 	uint32_t ucastcipherset;
519 	uint32_t mcastcipherset;
520 	uint32_t mgmtcipherset;
521 #ifdef WLAN_FEATURE_FILS_SK
522 	struct fils_filter_info fils_scan_filter;
523 #endif
524 	struct qdf_mac_addr bssid_hint;
525 	/* Variable params list */
526 	struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID];
527 	struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID];
528 	qdf_freq_t chan_freq_list[NUM_CHANNELS];
529 };
530 
531 /**
532  * enum scan_disable_reason - scan enable/disable reason
533  * @REASON_SUSPEND: reason is suspend
534  * @REASON_SYSTEM_DOWN: reason is system going down
535  * @REASON_USER_SPACE: reason is user space initiated
536  * @REASON_VDEV_DOWN: reason is vdev going down
537  */
538 enum scan_disable_reason {
539 	REASON_SUSPEND  = 0x1,
540 	REASON_SYSTEM_DOWN = 0x2,
541 	REASON_USER_SPACE = 0x4,
542 	REASON_VDEV_DOWN = 0x8,
543 };
544 
545 /**
546  * enum scan_priority - scan priority definitions
547  * @SCAN_PRIORITY_VERY_LOW: very low priority
548  * @SCAN_PRIORITY_LOW: low scan priority
549  * @SCAN_PRIORITY_MEDIUM: medium priority
550  * @SCAN_PRIORITY_HIGH: high priority
551  * @SCAN_PRIORITY_VERY_HIGH: very high priority
552  * @SCAN_PRIORITY_COUNT: number of priorities supported
553  */
554 enum scan_priority {
555 	SCAN_PRIORITY_VERY_LOW,
556 	SCAN_PRIORITY_LOW,
557 	SCAN_PRIORITY_MEDIUM,
558 	SCAN_PRIORITY_HIGH,
559 	SCAN_PRIORITY_VERY_HIGH,
560 	SCAN_PRIORITY_COUNT,
561 };
562 
563 /**
564  * enum scan_phy_mode - phymode used for scan
565  * @SCAN_PHY_MODE_11A: 11a mode
566  * @SCAN_PHY_MODE_11G: 11g mode
567  * @SCAN_PHY_MODE_11B: 11b mode
568  * @SCAN_PHY_MODE_11GONLY: 11g only mode
569  * @SCAN_PHY_MODE_11NA_HT20: 11na ht20 mode
570  * @SCAN_PHY_MODE_11NG_HT20: 11ng ht20 mode
571  * @SCAN_PHY_MODE_11NA_HT40: 11na ht40 mode
572  * @SCAN_PHY_MODE_11NG_HT40: 11ng ht40 mode
573  * @SCAN_PHY_MODE_11AC_VHT20: 11ac vht20 mode
574  * @SCAN_PHY_MODE_11AC_VHT40: 11ac vht40 mode
575  * @SCAN_PHY_MODE_11AC_VHT80: 11ac vht80 mode
576  * @SCAN_PHY_MODE_11AC_VHT20_2G: 2GHz 11ac vht20 mode
577  * @SCAN_PHY_MODE_11AC_VHT40_2G: 2GHz 11ac vht40 mode
578  * @SCAN_PHY_MODE_11AC_VHT80_2G: 2GHz 11ac vht80 mode
579  * @SCAN_PHY_MODE_11AC_VHT80_80: 11ac vht 80+80 mode
580  * @SCAN_PHY_MODE_11AC_VHT160: 11ac vht160 mode
581  * @SCAN_PHY_MODE_11AX_HE20: 11ax he20 mode
582  * @SCAN_PHY_MODE_11AX_HE40: 11ax he40 mode
583  * @SCAN_PHY_MODE_11AX_HE80: 11ax he80 mode
584  * @SCAN_PHY_MODE_11AX_HE80_80: 11ax he80+80 mode
585  * @SCAN_PHY_MODE_11AX_HE160: 11ax he160 mode
586  * @SCAN_PHY_MODE_11AX_HE20_2G: 2GHz 11ax he20 mode
587  * @SCAN_PHY_MODE_11AX_HE40_2G: 2GHz 11ax he40 mode
588  * @SCAN_PHY_MODE_11AX_HE80_2G: 2GHz 11ax he80 mode
589  * @SCAN_PHY_MODE_UNKNOWN: unknown phy mode
590  * @SCAN_PHY_MODE_MAX: max valid phymode
591  */
592 enum scan_phy_mode {
593 	SCAN_PHY_MODE_11A = 0,
594 	SCAN_PHY_MODE_11G = 1,
595 	SCAN_PHY_MODE_11B = 2,
596 	SCAN_PHY_MODE_11GONLY = 3,
597 	SCAN_PHY_MODE_11NA_HT20 = 4,
598 	SCAN_PHY_MODE_11NG_HT20 = 5,
599 	SCAN_PHY_MODE_11NA_HT40 = 6,
600 	SCAN_PHY_MODE_11NG_HT40 = 7,
601 	SCAN_PHY_MODE_11AC_VHT20 = 8,
602 	SCAN_PHY_MODE_11AC_VHT40 = 9,
603 	SCAN_PHY_MODE_11AC_VHT80 = 10,
604 	SCAN_PHY_MODE_11AC_VHT20_2G = 11,
605 	SCAN_PHY_MODE_11AC_VHT40_2G = 12,
606 	SCAN_PHY_MODE_11AC_VHT80_2G = 13,
607 	SCAN_PHY_MODE_11AC_VHT80_80 = 14,
608 	SCAN_PHY_MODE_11AC_VHT160 = 15,
609 	SCAN_PHY_MODE_11AX_HE20 = 16,
610 	SCAN_PHY_MODE_11AX_HE40 = 17,
611 	SCAN_PHY_MODE_11AX_HE80 = 18,
612 	SCAN_PHY_MODE_11AX_HE80_80 = 19,
613 	SCAN_PHY_MODE_11AX_HE160 = 20,
614 	SCAN_PHY_MODE_11AX_HE20_2G = 21,
615 	SCAN_PHY_MODE_11AX_HE40_2G = 22,
616 	SCAN_PHY_MODE_11AX_HE80_2G = 23,
617 	SCAN_PHY_MODE_UNKNOWN = 24,
618 	SCAN_PHY_MODE_MAX = 24
619 };
620 
621 /**
622  * enum scan_dwelltime_adaptive_mode: dwelltime_mode
623  * @SCAN_DWELL_MODE_DEFAULT: Use firmware default mode
624  * @SCAN_DWELL_MODE_CONSERVATIVE: Conservative adaptive mode
625  * @SCAN_DWELL_MODE_MODERATE: Moderate adaptive mode
626  * @SCAN_DWELL_MODE_AGGRESSIVE: Aggressive adaptive mode
627  * @SCAN_DWELL_MODE_STATIC: static adaptive mode
628  */
629 enum scan_dwelltime_adaptive_mode {
630 	SCAN_DWELL_MODE_DEFAULT = 0,
631 	SCAN_DWELL_MODE_CONSERVATIVE = 1,
632 	SCAN_DWELL_MODE_MODERATE = 2,
633 	SCAN_DWELL_MODE_AGGRESSIVE = 3,
634 	SCAN_DWELL_MODE_STATIC = 4
635 };
636 
637 /**
638  * struct scan_random_attr - holds scan randomization attrs
639  * @randomize: set to true for scan randomization
640  * @mac_addr: mac addr to be randomized
641  * @mac_mask: used to represent bits in mac_addr for randomization
642  */
643 struct scan_random_attr {
644 	bool randomize;
645 	uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
646 	uint8_t mac_mask[QDF_MAC_ADDR_SIZE];
647 };
648 
649 /**
650  * struct probe_req_whitelist_attr - holds probe req ie whitelist attrs
651  * @white_list: enable/disable whitelist
652  * @ie_bitmap: bitmap of IEs to be enabled
653  * @num_vendor_oui: number of vendor OUIs
654  * @voui: vendor oui buffer
655  */
656 struct probe_req_whitelist_attr {
657 	bool white_list;
658 	uint32_t ie_bitmap[PROBE_REQ_BITMAP_LEN];
659 	uint32_t num_vendor_oui;
660 	uint32_t voui[MAX_PROBE_REQ_OUIS];
661 };
662 
663 /**
664  * struct chan_info - channel information
665  * @freq: frequency to scan
666  * @phymode: phymode in which @frequency should be scanned
667  */
668 struct chan_info {
669 	qdf_freq_t freq;
670 	uint32_t phymode;
671 };
672 
673 /**
674  * struct chan_list - list of frequencies to be scanned
675  *  and their phymode
676  * @num_chan: number of channels to scan
677  * @chan: channel parameters used for this scan
678  */
679 struct chan_list {
680 	uint8_t num_chan;
681 	struct chan_info chan[NUM_CHANNELS];
682 };
683 
684 /**
685  * struct hint_short_ssid - short SSID hint
686  *  and their phymode
687  * @freq_flags: freq unit: MHz (upper 16bits)
688  *              flags (lower 16bits)
689  * @short_ssid: short SSID
690  */
691 struct hint_short_ssid {
692 	uint32_t freq_flags;
693 	uint32_t short_ssid;
694 };
695 
696 /**
697  * struct hint_bssid - BSSID hint
698  *  and their phymode
699  * @freq_flags: freq unit: MHz (upper 16bits)
700  *              flags (lower 16bits)
701  * @bssid: BSSID
702  */
703 struct hint_bssid {
704 	uint32_t freq_flags;
705 	struct qdf_mac_addr bssid;
706 };
707 
708 /**
709  * enum scan_request_type: scan type
710  * @SCAN_TYPE_DEFAULT: Def scan
711  * @SCAN_TYPE_P2P_SEARCH: P2P Search
712  * @SCAN_TYPE_P2P_LISTEN: P2P listed
713  * @SCAN_TYPE_RRM: RRM scan request
714  * @SCAN_TYPE_SCAN_FOR_CONNECT : Scan for connect
715  */
716 enum scan_request_type {
717 	SCAN_TYPE_DEFAULT = 0,
718 	SCAN_TYPE_P2P_SEARCH = 1,
719 	SCAN_TYPE_P2P_LISTEN = 2,
720 	SCAN_TYPE_RRM = 3,
721 	SCAN_TYPE_SCAN_FOR_CONNECT = 4
722 };
723 
724 /**
725  * struct scan_req_params - start scan request parameter
726  * @scan_id: scan id
727  * @scan_req_id: scan requester id
728  * @vdev_id: vdev id where scan was originated
729  * @pdev_id: pdev id of parent pdev
730  * @scan_priority: scan priority
731  * @scan_ev_started: notify scan started event
732  * @scan_ev_completed: notify scan completed event
733  * @scan_ev_bss_chan: notify bss chan event
734  * @scan_ev_foreign_chan: notify foreign chan event
735  * @scan_ev_dequeued: notify scan request dequed event
736  * @scan_ev_preempted: notify scan preempted event
737  * @scan_ev_start_failed: notify scan start failed event
738  * @scan_ev_restarted: notify scan restarted event
739  * @scan_ev_foreign_chn_exit: notify foreign chan exit event
740  * @scan_ev_invalid: notify invalid scan request event
741  * @scan_ev_gpio_timeout: notify gpio timeout event
742  * @scan_ev_suspended: notify scan suspend event
743  * @scan_ev_resumed: notify scan resumed event
744  * @scan_events: variable to read and set scan_ev_* flags in one shot
745  *               can be used to dump all scan_ev_* flags for debug
746  * @dwell_time_active: active dwell time
747  * @dwell_time_active_2g: active dwell time for 2G channels, if it's not zero
748  * @dwell_time_passive: passive dwell time
749  * @dwell_time_active_6g: 6Ghz active dwell time
750  * @dwell_time_passive_6g: 6Ghz passive dwell time
751  * @min_rest_time: min rest time
752  * @max_rest_time: max rest time
753  * @repeat_probe_time: repeat probe time
754  * @probe_spacing_time: probe spacing time
755  * @idle_time: idle time
756  * @max_scan_time: max scan time
757  * @probe_delay: probe delay
758  * @scan_offset_time: Support split scanning on the
759  *                    same channel for CBS feature.
760  * @scan_f_passive: passively scan all channels including active channels
761  * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
762  * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req
763  * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req
764  * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor
765  * @scan_f_filter_prb_req: filter Probe request frames
766  * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels
767  * @scan_f_continue_on_err:continue scan even if few certain erros have occurred
768  * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan
769  * @scan_f_offchan_data_tx: allow data transmission during off channel scan
770  * @scan_f_promisc_mode: scan with promiscuous mode
771  * @scan_f_capture_phy_err: enable capture ppdu with phy errrors
772  * @scan_f_strict_passive_pch: do passive scan on passive channels
773  * @scan_f_half_rate: enable HALF (10MHz) rate support
774  * @scan_f_quarter_rate: set Quarter (5MHz) rate support
775  * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel
776  * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame
777  * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame
778  * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe
779  * @scan_f_add_rand_seq_in_probe: use random sequence number in probe
780  * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe
781  * @scan_f_forced: force scan even in presence of data traffic
782  * @scan_f_2ghz: scan 2.4 GHz channels
783  * @scan_f_5ghz: scan 5 GHz channels
784  * @scan_f_wide_band: scan in 40 MHz or higher bandwidth
785  * @scan_flags: variable to read and set scan_f_* flags in one shot
786  *              can be used to dump all scan_f_* flags for debug
787  * @burst_duration: burst duration
788  * @num_bssid: no of bssid
789  * @num_ssids: no of ssid
790  * @n_probes: no of probe
791  * @chan_list: channel list
792  * @ssid: ssid list
793  * @bssid_list: Lisst of bssid to scan
794  * @scan_random: scan randomization params
795  * @ie_whitelist: probe req IE whitelist attrs
796  * @extraie: list of optional/vendor specific ie's to be added in probe requests
797  * @htcap: htcap ie
798  * @vhtcap: vhtcap ie
799  * @scan_ctrl_flags_ext: scan control flag extended
800  * @num_hint_s_ssid: number of short SSID hints
801  * @num_hint_bssid: number of BSSID hints
802  * @hint_s_ssid: short SSID hints
803  * @hint_bssid: BSSID hints
804  */
805 
806 struct scan_req_params {
807 	uint32_t scan_id;
808 	uint32_t scan_req_id;
809 	uint32_t vdev_id;
810 	uint32_t pdev_id;
811 	enum scan_priority scan_priority;
812 	enum scan_request_type scan_type;
813 	union {
814 		struct {
815 			uint32_t scan_ev_started:1,
816 				 scan_ev_completed:1,
817 				 scan_ev_bss_chan:1,
818 				 scan_ev_foreign_chan:1,
819 				 scan_ev_dequeued:1,
820 				 scan_ev_preempted:1,
821 				 scan_ev_start_failed:1,
822 				 scan_ev_restarted:1,
823 				 scan_ev_foreign_chn_exit:1,
824 				 scan_ev_invalid:1,
825 				 scan_ev_gpio_timeout:1,
826 				 scan_ev_suspended:1,
827 				 scan_ev_resumed:1;
828 		};
829 		uint32_t scan_events;
830 	};
831 	uint32_t dwell_time_active;
832 	uint32_t dwell_time_active_2g;
833 	uint32_t dwell_time_passive;
834 	uint32_t dwell_time_active_6g;
835 	uint32_t dwell_time_passive_6g;
836 	uint32_t min_rest_time;
837 	uint32_t max_rest_time;
838 	uint32_t repeat_probe_time;
839 	uint32_t probe_spacing_time;
840 	uint32_t idle_time;
841 	uint32_t max_scan_time;
842 	uint32_t probe_delay;
843 	uint32_t scan_offset_time;
844 	union {
845 		struct {
846 			uint32_t scan_f_passive:1,
847 				 scan_f_bcast_probe:1,
848 				 scan_f_cck_rates:1,
849 				 scan_f_ofdm_rates:1,
850 				 scan_f_chan_stat_evnt:1,
851 				 scan_f_filter_prb_req:1,
852 				 scan_f_bypass_dfs_chn:1,
853 				 scan_f_continue_on_err:1,
854 				 scan_f_offchan_mgmt_tx:1,
855 				 scan_f_offchan_data_tx:1,
856 				 scan_f_promisc_mode:1,
857 				 scan_f_capture_phy_err:1,
858 				 scan_f_strict_passive_pch:1,
859 				 scan_f_half_rate:1,
860 				 scan_f_quarter_rate:1,
861 				 scan_f_force_active_dfs_chn:1,
862 				 scan_f_add_tpc_ie_in_probe:1,
863 				 scan_f_add_ds_ie_in_probe:1,
864 				 scan_f_add_spoofed_mac_in_probe:1,
865 				 scan_f_add_rand_seq_in_probe:1,
866 				 scan_f_en_ie_whitelist_in_probe:1,
867 				 scan_f_forced:1,
868 				 scan_f_2ghz:1,
869 				 scan_f_5ghz:1,
870 				 scan_f_wide_band:1;
871 		};
872 		uint32_t scan_flags;
873 	};
874 	union {
875 		struct {
876 			uint32_t scan_policy_high_accuracy:1,
877 				 scan_policy_low_span:1,
878 				 scan_policy_low_power:1;
879 		};
880 		uint32_t scan_policy_type;
881 	};
882 
883 	enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode;
884 	uint32_t burst_duration;
885 	uint32_t num_bssid;
886 	uint32_t num_ssids;
887 	uint32_t n_probes;
888 	struct chan_list chan_list;
889 	struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID];
890 	struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID];
891 	struct scan_random_attr scan_random;
892 	struct probe_req_whitelist_attr ie_whitelist;
893 	struct element_info extraie;
894 	struct element_info htcap;
895 	struct element_info vhtcap;
896 	uint32_t scan_ctrl_flags_ext;
897 	uint32_t num_hint_s_ssid;
898 	uint32_t num_hint_bssid;
899 	struct hint_short_ssid hint_s_ssid[WLAN_SCAN_MAX_HINT_S_SSID];
900 	struct hint_bssid hint_bssid[WLAN_SCAN_MAX_HINT_BSSID];
901 };
902 
903 /**
904  * struct scan_start_request - scan request config
905  * @vdev: vdev
906  * @scan_req: common scan start request parameters
907  */
908 struct scan_start_request {
909 	struct wlan_objmgr_vdev *vdev;
910 	struct scan_req_params scan_req;
911 };
912 
913 /**
914  * enum scan_cancel_type - type specifiers for cancel scan request
915  * @WLAN_SCAN_CANCEL_SINGLE: cancel particular scan specified by scan_id
916  * @WLAN_SCAN_CANCEL_VAP_ALL: cancel all scans running on a particular vdevid
917  * @WLAN_SCAN_CANCEL_PDEV_ALL: cancel all scans running on parent pdev of vdevid
918  * @WLAN_SCAN_CANCEL_HOST_VDEV_ALL: Cancel all host triggered scans alone on
919  * vdev
920  */
921 enum scan_cancel_req_type {
922 	WLAN_SCAN_CANCEL_SINGLE = 1,
923 	WLAN_SCAN_CANCEL_VDEV_ALL,
924 	WLAN_SCAN_CANCEL_PDEV_ALL,
925 	WLAN_SCAN_CANCEL_HOST_VDEV_ALL,
926 };
927 
928 /**
929  * struct scan_cancel_param - stop scan cmd parameter
930  * @requester: scan requester
931  * @scan_id: scan id
932  * @req_type: scan request type
933  * @vdev_id: vdev id
934  * @pdev_id: pdev id of parent pdev
935  */
936 struct scan_cancel_param {
937 	uint32_t requester;
938 	uint32_t scan_id;
939 	enum scan_cancel_req_type req_type;
940 	uint32_t vdev_id;
941 	uint32_t pdev_id;
942 };
943 
944 /**
945  * struct scan_cancel_request - stop scan cmd
946  * @vdev: vdev object
947  * @wait_tgt_cancel: wait for target to cancel scan
948  * @cancel_req: stop scan cmd parameter
949  */
950 struct scan_cancel_request {
951 	/* Extra parameters consumed by scan module or serialization */
952 	struct wlan_objmgr_vdev *vdev;
953 	bool wait_tgt_cancel;
954 	/* Actual scan cancel request parameters */
955 	struct scan_cancel_param cancel_req;
956 };
957 
958 /**
959  * enum scan_event_type - scan event types
960  * @SCAN_EVENT_TYPE_STARTED: scan started
961  * @SCAN_EVENT_TYPE_COMPLETED: scan completed
962  * @SCAN_EVENT_TYPE_BSS_CHANNEL: HW came back to home channel
963  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL: HW moved to foreign channel
964  * @SCAN_EVENT_TYPE_DEQUEUED: scan request dequeued
965  * @SCAN_EVENT_TYPE_PREEMPTED: scan got preempted
966  * @SCAN_EVENT_TYPE_START_FAILED: couldn't start scan
967  * @SCAN_EVENT_TYPE_RESTARTED: scan restarted
968  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT: HW exited foreign channel
969  * @SCAN_EVENT_TYPE_SUSPENDED: scan got suspended
970  * @SCAN_EVENT_TYPE_RESUMED: scan resumed
971  * @SCAN_EVENT_TYPE_NLO_COMPLETE: NLO completed
972  * @SCAN_EVENT_TYPE_NLO_MATCH: NLO match event
973  * @SCAN_EVENT_TYPE_INVALID: invalid request
974  * @SCAN_EVENT_TYPE_GPIO_TIMEOUT: gpio timeout
975  * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START: radio measurement start
976  * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END: radio measurement end
977  * @SCAN_EVENT_TYPE_BSSID_MATCH: bssid match found
978  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF: foreign channel noise floor
979  * @SCAN_EVENT_TYPE_MAX: marker for invalid event
980  */
981 enum scan_event_type {
982 	SCAN_EVENT_TYPE_STARTED,
983 	SCAN_EVENT_TYPE_COMPLETED,
984 	SCAN_EVENT_TYPE_BSS_CHANNEL,
985 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL,
986 	SCAN_EVENT_TYPE_DEQUEUED,
987 	SCAN_EVENT_TYPE_PREEMPTED,
988 	SCAN_EVENT_TYPE_START_FAILED,
989 	SCAN_EVENT_TYPE_RESTARTED,
990 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT,
991 	SCAN_EVENT_TYPE_SUSPENDED,
992 	SCAN_EVENT_TYPE_RESUMED,
993 	SCAN_EVENT_TYPE_NLO_COMPLETE,
994 	SCAN_EVENT_TYPE_NLO_MATCH,
995 	SCAN_EVENT_TYPE_INVALID,
996 	SCAN_EVENT_TYPE_GPIO_TIMEOUT,
997 	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START,
998 	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END,
999 	SCAN_EVENT_TYPE_BSSID_MATCH,
1000 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF,
1001 	SCAN_EVENT_TYPE_MAX,
1002 };
1003 
1004 /**
1005  * enum scan_completion_reason - scan completion reason
1006  * @SCAN_REASON_NONE: un specified reason
1007  * @SCAN_REASON_COMPLETED: scan successfully completed
1008  * @SCAN_REASON_CANCELLED: scan got cancelled
1009  * @SCAN_REASON_PREEMPTED: scan got preempted
1010  * @SCAN_REASON_TIMEDOUT: couldnt complete within specified time
1011  * @SCAN_REASON_INTERNAL_FAILURE: cancelled because of some failure
1012  * @SCAN_REASON_SUSPENDED: scan suspended
1013  * @SCAN_REASON_RUN_FAILED: run failed
1014  * @SCAN_REASON_TERMINATION_FUNCTION: termination function
1015  * @SCAN_REASON_MAX_OFFCHAN_RETRIES: max retries exceeded thresold
1016  * @SCAN_REASON_DFS_VIOLATION: Scan start failure due to DFS violation.
1017  * @SCAN_REASON_MAX: invalid completion reason marker
1018  */
1019 enum scan_completion_reason {
1020 	SCAN_REASON_NONE,
1021 	SCAN_REASON_COMPLETED,
1022 	SCAN_REASON_CANCELLED,
1023 	SCAN_REASON_PREEMPTED,
1024 	SCAN_REASON_TIMEDOUT,
1025 	SCAN_REASON_INTERNAL_FAILURE,
1026 	SCAN_REASON_SUSPENDED,
1027 	SCAN_REASON_RUN_FAILED,
1028 	SCAN_REASON_TERMINATION_FUNCTION,
1029 	SCAN_REASON_MAX_OFFCHAN_RETRIES,
1030 	SCAN_REASON_DFS_VIOLATION,
1031 	SCAN_REASON_MAX,
1032 };
1033 
1034 /**
1035  * struct scan_event - scan event definition
1036  * @vdev_id: vdev where scan was run
1037  * @type: type of scan event
1038  * @reason: completion reason
1039  * @chan_freq: channel centre frequency
1040  * @requester: requester id
1041  * @scan_id: scan id
1042  * @timestamp: timestamp in microsec recorded by target for the scan event
1043  * @scan_start_req: scan request object used to start this scan
1044  */
1045 struct scan_event {
1046 	uint32_t vdev_id;
1047 	enum scan_event_type type;
1048 	enum scan_completion_reason reason;
1049 	uint32_t chan_freq;
1050 	uint32_t requester;
1051 	uint32_t scan_id;
1052 	uint32_t timestamp;
1053 	struct scan_start_request *scan_start_req;
1054 };
1055 
1056 /**
1057  * struct scan_event_info - scan event information
1058  * @vdev: vdev object
1059  * @event: scan event
1060  */
1061 struct scan_event_info {
1062 	struct wlan_objmgr_vdev *vdev;
1063 	struct scan_event event;
1064 };
1065 
1066 /**
1067  * enum scm_scan_status - scan status
1068  * @SCAN_NOT_IN_PROGRESS: Neither active nor pending scan in progress
1069  * @SCAN_IS_ACTIVE: scan request is present only in active list
1070  * @SCAN_IS_PENDING: scan request is present only in pending list
1071  * @SCAN_IS_ACTIVE_AND_PENDING: scan request is present in active
1072  *                               and pending both lists
1073  */
1074 enum scm_scan_status {
1075 	SCAN_NOT_IN_PROGRESS = 0, /* Must be 0 */
1076 	SCAN_IS_ACTIVE,
1077 	SCAN_IS_PENDING,
1078 	SCAN_IS_ACTIVE_AND_PENDING,
1079 };
1080 
1081 /**
1082  * scan_event_handler() - function prototype of scan event handlers
1083  * @vdev: vdev object
1084  * @event: scan event
1085  * @arg: argument
1086  *
1087  * PROTO TYPE, scan event handler call back function prototype
1088  *
1089  * @Return: void
1090  */
1091 typedef void (*scan_event_handler) (struct wlan_objmgr_vdev *vdev,
1092 	struct scan_event *event, void *arg);
1093 
1094 /**
1095  * enum scan_cb_type - update beacon cb type
1096  * @SCAN_CB_TYPE_INFORM_BCN: Calback to indicate beacon to OS
1097  * @SCAN_CB_TYPE_UPDATE_BCN: Calback to indicate beacon
1098  * @SCAN_CB_TYPE_UNLINK_BSS: cb to unlink bss entry
1099  *                    to MLME and update MLME info
1100  *
1101  */
1102 enum scan_cb_type {
1103 	SCAN_CB_TYPE_INFORM_BCN,
1104 	SCAN_CB_TYPE_UPDATE_BCN,
1105 	SCAN_CB_TYPE_UNLINK_BSS,
1106 };
1107 
1108 /* Set PNO */
1109 #define SCAN_PNO_MAX_PLAN_REQUEST   2
1110 #define SCAN_PNO_MAX_NETW_CHANNELS_EX  (NUM_CHANNELS)
1111 #define SCAN_PNO_MAX_SUPP_NETWORKS  16
1112 #define SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER 6
1113 #define SCAN_PNO_DEF_SCAN_TIMER_REPEAT 20
1114 #define SCAN_PNO_MATCH_WAKE_LOCK_TIMEOUT         (5 * 1000)     /* in msec */
1115 #define SCAN_MAX_IE_LENGTH 255
1116 #ifdef CONFIG_SLUB_DEBUG_ON
1117 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (2 * 1000)     /* in msec */
1118 #else
1119 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (1 * 1000)     /* in msec */
1120 #endif /* CONFIG_SLUB_DEBUG_ON */
1121 
1122 /**
1123  * enum ssid_bc_type - SSID broadcast type
1124  * @SSID_BC_TYPE_UNKNOWN: Broadcast unknown
1125  * @SSID_BC_TYPE_NORMAL: Broadcast normal
1126  * @SSID_BC_TYPE_HIDDEN: Broadcast hidden
1127  */
1128 enum ssid_bc_type {
1129 	SSID_BC_TYPE_UNKNOWN = 0,
1130 	SSID_BC_TYPE_NORMAL = 1,
1131 	SSID_BC_TYPE_HIDDEN = 2,
1132 };
1133 
1134 /**
1135  * struct pno_nw_type - pno nw type
1136  * @ssid: ssid
1137  * @authentication: authentication type
1138  * @encryption: encryption type
1139  * @bcastNetwType: broadcast nw type
1140  * @ucChannelCount: uc channel count
1141  * @aChannels: pno channel
1142  * @rssiThreshold: rssi threshold
1143  */
1144 struct pno_nw_type {
1145 	struct wlan_ssid ssid;
1146 	uint32_t authentication;
1147 	uint32_t encryption;
1148 	uint32_t bc_new_type;
1149 	uint8_t channel_cnt;
1150 	uint32_t channels[SCAN_PNO_MAX_NETW_CHANNELS_EX];
1151 	int32_t rssi_thresh;
1152 };
1153 
1154 /**
1155  * struct connected_pno_band_rssi_pref - BSS preference based on band
1156  * and RSSI
1157  * @band: band preference
1158  * @rssi_pref: RSSI preference
1159  */
1160 struct cpno_band_rssi_pref {
1161 	int8_t band;
1162 	int8_t rssi;
1163 };
1164 
1165 /**
1166  * struct nlo_mawc_params - Motion Aided Wireless Connectivity based
1167  *                          Network List Offload configuration
1168  * @vdev_id: VDEV ID on which the configuration needs to be applied
1169  * @enable: flag to enable or disable
1170  * @exp_backoff_ratio: ratio of exponential backoff
1171  * @init_scan_interval: initial scan interval(msec)
1172  * @max_scan_interval:  max scan interval(msec)
1173  */
1174 struct nlo_mawc_params {
1175 	uint8_t vdev_id;
1176 	bool enable;
1177 	uint32_t exp_backoff_ratio;
1178 	uint32_t init_scan_interval;
1179 	uint32_t max_scan_interval;
1180 };
1181 
1182 /**
1183  * struct pno_scan_req_params - PNO Scan request structure
1184  * @networks_cnt: Number of networks
1185  * @do_passive_scan: Flag to request passive scan to fw
1186  * @vdev_id: vdev id
1187  * @fast_scan_period: Fast Scan period
1188  * @slow_scan_period: Slow scan period
1189  * @delay_start_time: delay in seconds to use before starting the first scan
1190  * @fast_scan_max_cycles: Fast scan max cycles
1191  * @scan_backoff_multiplier: multiply fast scan period by this after max cycles
1192  * @pno_channel_prediction: PNO channel prediction feature status
1193  * @uint32_t active_dwell_time: active dwell time
1194  * @uint32_t passive_dwell_time: passive dwell time
1195  * @top_k_num_of_channels: top K number of channels are used for tanimoto
1196  * distance calculation.
1197  * @stationary_thresh: threshold value to determine that the STA is stationary.
1198  * @adaptive_dwell_mode: adaptive dwelltime mode for pno scan
1199  * @channel_prediction_full_scan: periodic timer upon which a full scan needs
1200  * to be triggered.
1201  * @networks_list: Preferred network list
1202  * @scan_random: scan randomization params
1203  * @ie_whitelist: probe req IE whitelist attrs
1204  * @relative_rssi_set: Flag to check whether realtive_rssi is set or not
1205  * @relative_rssi: Relative rssi threshold, used for connected pno
1206  * @band_rssi_pref: Band and RSSI preference that can be given to one BSS
1207  *     over the other BSS
1208  *
1209  * E.g.
1210  *	{ fast_scan_period=120, fast_scan_max_cycles=2,
1211  *	  slow_scan_period=1800, scan_backoff_multiplier=2 }
1212  *	Result: 120s x2, 240s x2, 480s x2, 960s x2, 1800s xN
1213  * @mawc_params: Configuration parameters for NLO MAWC.
1214  */
1215 struct pno_scan_req_params {
1216 	uint32_t networks_cnt;
1217 	bool     do_passive_scan;
1218 	uint32_t vdev_id;
1219 	uint32_t fast_scan_period;
1220 	uint32_t slow_scan_period;
1221 	uint32_t delay_start_time;
1222 	uint32_t fast_scan_max_cycles;
1223 	uint8_t scan_backoff_multiplier;
1224 	uint32_t active_dwell_time;
1225 	uint32_t passive_dwell_time;
1226 	uint32_t pno_channel_prediction;
1227 	uint32_t top_k_num_of_channels;
1228 	uint32_t stationary_thresh;
1229 	enum scan_dwelltime_adaptive_mode adaptive_dwell_mode;
1230 	uint32_t channel_prediction_full_scan;
1231 	struct pno_nw_type networks_list[SCAN_PNO_MAX_SUPP_NETWORKS];
1232 	struct scan_random_attr scan_random;
1233 	struct probe_req_whitelist_attr ie_whitelist;
1234 	bool relative_rssi_set;
1235 	int8_t relative_rssi;
1236 	struct cpno_band_rssi_pref band_rssi_pref;
1237 	struct nlo_mawc_params mawc_params;
1238 };
1239 
1240 /**
1241  * struct scan_user_cfg - user configuration required for for scan
1242  * @ie_whitelist: probe req IE whitelist attrs
1243  * @sta_miracast_mcc_rest_time: sta miracast mcc rest time
1244  */
1245 struct scan_user_cfg {
1246 	struct probe_req_whitelist_attr ie_whitelist;
1247 	uint32_t sta_miracast_mcc_rest_time;
1248 };
1249 
1250 /**
1251  * update_beacon_cb() - cb to inform/update beacon
1252  * @psoc: psoc pointer
1253  * @scan_params:  scan entry to inform/update
1254  *
1255  * @Return: void
1256  */
1257 typedef void (*update_beacon_cb) (struct wlan_objmgr_pdev *pdev,
1258 	struct scan_cache_entry *scan_entry);
1259 
1260 /**
1261  * scan_iterator_func() - function prototype of scan iterator function
1262  * @scan_entry: scan entry object
1263  * @arg: extra argument
1264  *
1265  * PROTO TYPE, scan iterator function prototype
1266  *
1267  * @Return: QDF_STATUS
1268  */
1269 typedef QDF_STATUS (*scan_iterator_func) (void *arg,
1270 	struct scan_cache_entry *scan_entry);
1271 
1272 /**
1273  * enum scan_priority - scan priority definitions
1274  * @SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT: disable scan command timeout
1275  * @SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH: config to drop beacon/probe
1276  *  response frames if received channel and IE channels do not match
1277  */
1278 enum scan_config {
1279 	SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT,
1280 	SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH,
1281 };
1282 
1283 /**
1284  * enum ext_cap_bit_field - Extended capabilities bit field
1285  * @BSS_2040_COEX_MGMT_SUPPORT: 20/40 BSS Coexistence Management Support field
1286  * @OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT: OBSS Narrow  Bandwidth RU
1287  *     in UL OFDMA  Tolerance Support
1288  */
1289 enum ext_cap_bit_field {
1290 	BSS_2040_COEX_MGMT_SUPPORT = 0,
1291 	OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT = 79,
1292 };
1293 
1294 /**
1295  * scan_rnr_info - RNR information
1296  * @timestamp: time stamp of beacon/probe
1297  * @short_ssid: Short SSID
1298  * @bssid: BSSID
1299  */
1300 struct scan_rnr_info {
1301 	qdf_time_t timestamp;
1302 	uint32_t short_ssid;
1303 	struct qdf_mac_addr bssid;
1304 };
1305 
1306 /**
1307  * struct scan_rnr_node - Scan RNR entry node
1308  * @node: node pointers
1309  * @entry: scan RNR entry pointer
1310  */
1311 struct scan_rnr_node {
1312 	qdf_list_node_t node;
1313 	struct scan_rnr_info entry;
1314 };
1315 
1316 /**
1317  * meta_rnr_channel - Channel information for scan priority algorithm
1318  * @chan_freq: channel frequency
1319  * @bss_beacon_probe_count: Beacon and probe request count
1320  * @saved_profile_count: Saved profile count
1321  * @beacon_probe_last_time_found: Timestamp of beacon/probe observed
1322  * @rnr_list: RNR list to store RNR IE information
1323  */
1324 struct meta_rnr_channel {
1325 	uint32_t chan_freq;
1326 	uint32_t bss_beacon_probe_count;
1327 	uint32_t saved_profile_count;
1328 	qdf_time_t beacon_probe_last_time_found;
1329 	qdf_list_t rnr_list;
1330 };
1331 
1332 #define RNR_UPDATE_SCAN_CNT_THRESHOLD 2
1333 /**
1334  * channel_list_db - Database for channel information
1335  * @channel: channel meta information
1336  * @scan_count: scan count since the db was updated
1337  */
1338 struct channel_list_db {
1339 	struct meta_rnr_channel channel[NUM_6GHZ_CHANNELS];
1340 	uint8_t scan_count;
1341 };
1342 
1343 /**
1344  * rnr_chan_weight - RNR channel weightage
1345  * @chan_freq: channel frequency
1346  * @weight: weightage of the channel
1347  */
1348 struct rnr_chan_weight {
1349 	uint32_t chan_freq;
1350 	uint32_t weight;
1351 };
1352 #endif
1353