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