xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/inc/wlan_scan_public_structs.h (revision 06d0b5348967845f004ebe7c2348bf8f467ad2f9)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  * DOC: contains scan structure definitions
22  */
23 
24 #ifndef _WLAN_SCAN_STRUCTS_H_
25 #define _WLAN_SCAN_STRUCTS_H_
26 #include <wlan_cmn.h>
27 #include <qdf_time.h>
28 #include <qdf_list.h>
29 #include <qdf_atomic.h>
30 #include <wlan_cmn_ieee80211.h>
31 #include <wlan_mgmt_txrx_utils_api.h>
32 #include <reg_services_public_struct.h>
33 #ifdef WLAN_FEATURE_11BE_MLO
34 #include "wlan_mlo_mgr_public_structs.h"
35 #endif
36 
37 typedef uint16_t wlan_scan_requester;
38 typedef uint32_t wlan_scan_id;
39 
40 #define WLAN_SCAN_MAX_HINT_S_SSID        10
41 #define WLAN_SCAN_MAX_HINT_BSSID         10
42 #define MAX_RNR_BSS                      16
43 #define WLAN_SCAN_MAX_NUM_SSID          16
44 #define WLAN_SCAN_MAX_NUM_BSSID         4
45 
46 #define SCM_CANCEL_SCAN_WAIT_TIME 50
47 #define SCM_CANCEL_SCAN_WAIT_ITERATION 600
48 
49 #define INVAL_SCAN_ID        0xFFFFFFFF
50 #define CANCEL_HOST_SCAN_ID  0xFFFFFFFE
51 #define INVAL_VDEV_ID        0xFFFFFFFF
52 #define INVAL_PDEV_ID        0xFFFFFFFF
53 
54 #define USER_SCAN_REQUESTOR_ID  0xA0000
55 #define PREAUTH_REQUESTOR_ID    0xC0000
56 
57 #define BURST_SCAN_MAX_NUM_OFFCHANNELS 3
58 #define P2P_SCAN_MAX_BURST_DURATION 180
59 /* Increase dwell time for P2P search in ms */
60 #define P2P_SEARCH_DWELL_TIME_INC 20
61 
62 #define PROBE_REQ_BITMAP_LEN 8
63 #define MAX_PROBE_REQ_OUIS 16
64 
65 #define TBTT_INFO_COUNT 16
66 
67 /**
68  * IE Field nomenclature
69  * @MBSSID_INDICATOR_POS: Position of MaxBSSID indicator inside MBSSID tag
70  * @MIN_IE_LEN: 2bytes, which includes Tag Number and Tag length field
71  * @TAG_LEN_POS: Position of tag length field in MBSSID tag
72  * @VALID_ELEM_LEAST_LEN: Minimum fields required after tag length to call
73  * a MBSSID tag valid. (MaxBSSID Indicator + subelement ID + Subelement length
74  * atleast 1 byte of payload from subelement)
75  * @SUBELEMENT_START_POS: Starting position of 1st subelement in MBSSID tag
76  * @MAX_SUBELEM_LEN: Maximum length of a subelement
77  * @PAYLOAD_START_POS: Payload start position of a non tx bssid profile
78  * @FIXED_LENGTH: Length which includes header, timestamp, interval and
79  * capability
80  * @CAP_INFO_POS: Position of capability information in a non tx bssid profile
81  * @CAP_INFO_LEN: Length of capability information
82  * @SUBELEM_DATA_POS_FROM_MBSSID: Position of first byte of subelement payload
83  * from MBSSID Tag
84  * @ID_POS: Position of subelement ID in a non tx BSSID profile
85  * @NONTX_BSSID_CAP_TAG_LEN_POS: Position of tag length field of nontx bssid
86  * capability tag from starting of nontx bssid profile
87  * @VALID_BSS_PROF_LEAST_LEN: At least one tag should present to call it a valid
88  * non tx bssid profile and that is nothing but nontx bssid capability tag which
89  * is of 4 bytes
90  * @SPLIT_PROF_DATA_LEAST_LEN: Least possible length of second part of a split
91  * profile, which includes at least one tag, which may have tag number + tag
92  * length + atleast 1 byte of datai
93  * @BSS_INDEX_POS: Position of BSSID index field in Multiple BSSID index tag
94  * @MIN_VENDOR_TAG_LEN: Minimum length of a vendor specific tag
95  * @OUI_LEN: OUI + OUI Type + Min DATA
96  * @ELEM_ID_EXTN_POS: Position of element ID extension in an extension element
97  * @ELEM_ID_LIST_LEN_POS: Position of length field in list of element IDs
98  * @ELEM_ID_LIST_POS: Position to the start of element ID list
99  */
100 #define MBSSID_INDICATOR_POS 2
101 #define MIN_IE_LEN 2
102 #define TAG_LEN_POS 1
103 #define VALID_ELEM_LEAST_LEN 4
104 #define SUBELEMENT_START_POS 3
105 #define MAX_SUBELEM_LEN 252
106 #define PAYLOAD_START_POS 2
107 #define FIXED_LENGTH 36
108 #define CAP_INFO_POS 4
109 #define CAP_INFO_LEN 2
110 #define SUBELEM_DATA_POS_FROM_MBSSID 5
111 #define ID_POS 0
112 #define NONTX_BSSID_CAP_TAG_LEN_POS 3
113 #define VALID_BSS_PROF_LEAST_LEN 4
114 #define SPLIT_PROF_DATA_LEAST_LEN 3
115 #define BSS_INDEX_POS 2
116 #define MIN_VENDOR_TAG_LEN 7
117 #define OUI_LEN 5
118 #define ELEM_ID_EXTN_POS 2
119 #define ELEM_ID_LIST_LEN_POS 3
120 #define ELEM_ID_LIST_POS 4
121 
122 /* Active dwell time in low span scan mode(NL80211_SCAN_FLAG_LOW_SPAN)
123  * in msec
124  */
125 #define LOW_SPAN_ACTIVE_DWELL_TIME 40
126 /* passive dwell time in low span scan mode (NL80211_SCAN_FLAG_LOW_SPAN)
127  * in msec
128  */
129 #define LOW_SPAN_PASSIVE_DWELL_TIME 110
130 
131 /* Min & Max offset from TBTT, after which Scan can start */
132 #define SCAN_START_OFFSET_MIN 26 /* msec */
133 #define SCAN_START_OFFSET_MAX 90 /* msec */
134 
135 /* forward declaration */
136 struct wlan_objmgr_vdev;
137 struct wlan_objmgr_pdev;
138 struct wlan_objmgr_psoc;
139 
140 /**
141  * struct channel_info - BSS channel information
142  * @chan_freq: channel frequency
143  * @cfreq0: channel frequency index0
144  * @cfreq1: channel frequency index1
145  * @puncture_bitmap: puncture bitmap advertised in beacon
146  * @priv: channel private information
147  */
148 struct channel_info {
149 	uint32_t chan_freq;
150 	uint32_t cfreq0;
151 	uint32_t cfreq1;
152 #ifdef WLAN_FEATURE_11BE
153 	uint16_t puncture_bitmap;
154 #endif
155 	void *priv;
156 };
157 
158 /**
159  * struct ie_list - pointers to various IEs
160  * @tim:        pointer to tim ie
161  * @country:    pointer to country ie
162  * @ssid:       pointer to ssid ie
163  * @rates:      pointer to supported rates ie
164  * @xrates:     pointer to extended supported rate ie
165  * @ds_param:   pointer to ds params
166  * @csa:        pointer to csa ie
167  * @xcsa:       pointer to extended csa ie
168  * @mcst:       pointer to maximum channel switch time ie
169  * @wpa:        pointer to wpa ie
170  * @wcn:        pointer to wcn ie
171  * @rsn:        pointer to rsn ie
172  * @wps:        pointer to wps ie
173  * @wmeinfo:    pointer to wmeinfo ie
174  * @wmeparam:   pointer to wmeparam ie
175  * @quiet:      pointer to quiet ie
176  * @htcap:      pointer to htcap ie
177  * @htinfo:     pointer to htinfo ie
178  * @athcaps:    pointer to athcaps ie
179  * @athextcaps: pointer to extended athcaps ie
180  * @sfa:        pointer to sfa ie
181  * @vendor:     pointer to vendor ie
182  * @qbssload:   pointer to qbssload ie
183  * @wapi:       pointer to wapi ie
184  * @p2p:        pointer to p2p ie
185  * @alt_wcn:    pointer to alternate wcn ie
186  * @extcaps:    pointer to extended caps ie
187  * @ibssdfs:    pointer to ibssdfs ie
188  * @sonadv:     pointer to wifi son ie
189  * @vhtcap:     pointer to vhtcap ie
190  * @vhtop:      pointer to vhtop ie
191  * @opmode:     pointer to opmode ie
192  * @tpe:        array of pointers to transmit power envelope ie
193  * @cswrp:      pointer to channel switch announcement wrapper ie
194  * @widebw:     pointer to wide band channel switch sub ie
195  * @txpwrenvlp: pointer to tx power envelop sub ie
196  * @hecap:      pointer to hecap ie
197  * @hecap_6g:   pointer to he 6ghz cap ie
198  * @srp: pointer to spatial reuse parameter sub extended ie
199  * @fils_indication: pointer to FILS indication ie
200  * @esp: pointer to ESP indication ie
201  * @mbo_oce: pointer to mbo/oce indication ie
202  * @rnrie: reduced neighbor report IE
203  * @adaptive_11r: pointer to adaptive 11r IE
204  * @single_pmk: Pointer to sae single pmk IE
205  * @rsnxe: Pointer to rsnxe IE
206  * @ehtcap: pointer to ehtcap ie
207  * @ehtop: pointer to eht op ie
208  * @multi_link_bv: pointer to multi link basic variant IE
209  * @multi_link_rv: pointer to multi link reconfig IE
210  * @t2lm: array of pointers to t2lm op ie
211  * @bwnss_map: pointer to NSS map IE
212  * @secchanoff: pointer to secondary chan IE
213  * @mdie: pointer to md IE
214  * @heop: pointer to HE op IE
215  * @muedca: pointer to muedca IE
216  * @extender: pointer to extended IE
217  * @qcn: pointer to QCN IE
218  */
219 struct ie_list {
220 	uint8_t *tim;
221 	uint8_t *country;
222 	uint8_t *ssid;
223 	uint8_t *rates;
224 	uint8_t *xrates;
225 	uint8_t *ds_param;
226 	uint8_t *csa;
227 	uint8_t *xcsa;
228 	uint8_t *mcst;
229 	uint8_t *wpa;
230 	uint8_t *wcn;
231 	uint8_t *rsn;
232 	uint8_t *wps;
233 	uint8_t *wmeinfo;
234 	uint8_t *wmeparam;
235 	uint8_t *quiet;
236 	uint8_t *htcap;
237 	uint8_t *htinfo;
238 	uint8_t *athcaps;
239 	uint8_t *athextcaps;
240 	uint8_t *sfa;
241 	uint8_t *vendor;
242 	uint8_t *qbssload;
243 	uint8_t *wapi;
244 	uint8_t *p2p;
245 	uint8_t *alt_wcn;
246 	uint8_t *extcaps;
247 	uint8_t *ibssdfs;
248 	uint8_t *sonadv;
249 	uint8_t *vhtcap;
250 	uint8_t *vhtop;
251 	uint8_t *opmode;
252 	uint8_t *tpe[WLAN_MAX_NUM_TPE_IE];
253 	uint8_t *cswrp;
254 	uint8_t *widebw;
255 	uint8_t *txpwrenvlp;
256 	uint8_t *bwnss_map;
257 	uint8_t *secchanoff;
258 	uint8_t *mdie;
259 	uint8_t *hecap;
260 	uint8_t *hecap_6g;
261 	uint8_t *heop;
262 	uint8_t *srp;
263 	uint8_t *fils_indication;
264 	uint8_t *esp;
265 	uint8_t *mbo_oce;
266 	uint8_t *muedca;
267 	uint8_t *rnrie;
268 	uint8_t *extender;
269 	uint8_t *adaptive_11r;
270 	uint8_t *single_pmk;
271 	uint8_t *rsnxe;
272 #ifdef WLAN_FEATURE_11BE
273 	uint8_t *ehtcap;
274 	uint8_t *ehtop;
275 #endif
276 #ifdef WLAN_FEATURE_11BE_MLO
277 	uint8_t *multi_link_bv;
278 	uint8_t *multi_link_rv;
279 	uint8_t *t2lm[WLAN_MAX_T2LM_IE];
280 #endif
281 	uint8_t *qcn;
282 
283 /**
284  * For any new IEs in this structure, add handling in
285  * util_scan_copy_beacon_data API.
286  */
287 };
288 
289 enum scan_entry_connection_state {
290 	SCAN_ENTRY_CON_STATE_NONE,
291 	SCAN_ENTRY_CON_STATE_AUTH,
292 	SCAN_ENTRY_CON_STATE_ASSOC
293 };
294 
295 /**
296  * struct mlme_info - mlme specific info
297  * temporarily maintained in scan cache for backward compatibility.
298  * must be removed as part of umac convergence.
299  * @bad_ap_time: time when this ap was marked bad
300  * @status: status
301  * @rank: rank
302  * @utility: utility
303  * @assoc_state: association state
304  * @chanload: channel load
305  */
306 struct mlme_info {
307 	qdf_time_t bad_ap_time;
308 	uint32_t status;
309 	uint32_t rank;
310 	uint32_t utility;
311 	uint32_t assoc_state;
312 	uint32_t chanload;
313 };
314 
315 /**
316  * struct bss_info - information required to uniquely define a bss
317  * @freq: freq of operating primary channel
318  * @ssid: ssid of bss
319  * @bssid: bssid of bss
320  */
321 struct bss_info {
322 	uint32_t freq;
323 	struct wlan_ssid ssid;
324 	struct qdf_mac_addr bssid;
325 };
326 
327 #define SCAN_NODE_ACTIVE_COOKIE 0x1248F842
328 /**
329  * struct scan_cache_node - Scan cache entry node
330  * @node: node pointers
331  * @ref_cnt: ref count if in use
332  * @cookie: cookie to check if entry is logically active
333  * @entry: scan entry pointer
334  */
335 struct scan_cache_node {
336 	qdf_list_node_t node;
337 	qdf_atomic_t ref_cnt;
338 	uint32_t cookie;
339 	struct scan_cache_entry *entry;
340 };
341 
342 /**
343  * struct security_info - Scan cache security info
344  * @authmodeset: auth mode
345  * @key_mgmt: key management
346  * @ucastcipherset: unicast cipher set
347  * @mcastcipherset: multicast cipher set
348  * @mgmtcipherset: mgmt cipher set
349  * @rsn_caps: rsn caps of scan entry
350  */
351 struct security_info {
352 	uint32_t authmodeset;
353 	uint32_t key_mgmt;
354 	uint32_t ucastcipherset;
355 	uint32_t mcastcipherset;
356 	uint32_t mgmtcipherset;
357 	uint16_t rsn_caps;
358 };
359 
360 /**
361  * struct scan_mbssid_info - Scan mbssid information
362  * @profile_num: profile number
363  * @profile_count: total profile count
364  * @trans_bssid: TX BSSID address
365  * @split_profile: Indicates if next MBSSID tag has the other part
366  *                 of the non tx profile
367  * @prof_residue: Set prof_residue to true, if the first non TX
368  *                     profile of the subsequent MBSSID IE does not contain
369  *                     nontx BSSID Capability as the 1st tag of the payload
370  *                     of nontx profile
371  * @split_prof_continue: Indicates if we are evaluating the fragmented part
372  *                      present in the subsequent MBSSID tag
373  * @skip_bssid_copy: For the 2nd fragmented part of the split profile
374  *                  skip copying bssid if BSSID index is already found
375  *                  in the previous part of split profile
376  */
377 struct scan_mbssid_info {
378 	uint8_t profile_num;
379 	uint8_t profile_count;
380 	uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
381 	bool split_profile;
382 	bool prof_residue;
383 	bool split_prof_continue;
384 	bool skip_bssid_copy;
385 };
386 
387 /**
388  * enum nontx_profile_reasoncode - Reason codes based on which the decision
389  * needs to be taken whether to continue with the on going nontx profile or
390  * move to the next one
391  * @VALID_NONTX_PROF: Continue with the on-going profile
392  * @INVALID_SPLIT_PROF: Invalid data seen in the split profile
393  * @INVALID_NONTX_PROF: Invalid data in a non split profile
394  */
395 enum nontx_profile_reasoncode {
396 	VALID_NONTX_PROF = 0,
397 	INVALID_SPLIT_PROF = 0x1,
398 	INVALID_NONTX_PROF = 0x2
399 };
400 
401 /**
402  * struct non_inheritance_ie - Non inheritance tag information
403  * @list_len: Length of element ID list
404  * @extn_len: Length of element ID extension list
405  * @non_inherit: Flag to indicate if any noninheritance tag present
406  *              in the non tx BSSID profile
407  * @non_inh_ie_found: Flag to indicate if the noninheritance tag found
408  *                   from non tx BSSID profile present in the tx profile
409  *                   so that the copy of that IE can be skipped.
410  */
411 struct non_inheritance_ie {
412 	uint8_t list_len;
413 	uint8_t extn_len;
414 	bool non_inherit;
415 	bool non_inh_ie_found;
416 };
417 
418 /**
419  * struct rnr_bss_info - Reduced Neighbor Report BSS information
420  * @neighbor_ap_tbtt_offset: Neighbor AP TBTT offset
421  * @channel_number: channel number
422  * @operating_class: operting class
423  * @bssid: BSS MAC address
424  * @short_ssid: short ssid
425  * @bss_params: BSS parameters
426  * @psd_20mhz: 20MHz power spectral density
427  * @mld_info_valid: valid MLD info
428  * @mld_info: MLD information
429  */
430 struct rnr_bss_info {
431 	uint8_t neighbor_ap_tbtt_offset;
432 	uint32_t channel_number;
433 	uint32_t operating_class;
434 	struct qdf_mac_addr bssid;
435 	uint32_t short_ssid;
436 	uint8_t bss_params;
437 	uint8_t psd_20mhz;
438 #ifdef WLAN_FEATURE_11BE_MLO
439 	bool mld_info_valid;
440 	struct rnr_mld_info mld_info;
441 #endif
442 };
443 
444 /**
445  * struct neighbor_ap_info_field - Neighbor information field
446  * @tbtt_info_header: TBTT information header
447  * @operting_class: operating class
448  * @channel_number: channel number
449  */
450 struct neighbor_ap_info_field {
451 	struct tbtt_information_header tbtt_header;
452 	uint8_t operting_class;
453 	uint8_t channel_number;
454 };
455 
456 /**
457  * enum tbtt_information_field - TBTT information field
458  * @TBTT_NEIGHBOR_AP_OFFSET_ONLY: TBTT information field type
459  * @TBTT_NEIGHBOR_AP_BSS_PARAM: neighbor AP and bss param
460  * @TBTT_NEIGHBOR_AP_SHORTSSID: neighbor AP and Short ssid
461  * @TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM: neighbor AP, short ssid and bss param
462  * @TBTT_NEIGHBOR_AP_BSSID: neighbor AP and bssid
463  * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM: neighbor AP, bssid and bss param
464  * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid and bss
465  * param and 20MHz PSD
466  * @TBTT_NEIGHBOR_AP_BSSSID_S_SSID: neighbor AP, bssid and short ssid
467  * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM: neighbor AP, bssid, short ssid
468  * and bss params
469  * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid,
470  * short ssid, bss params and 20MHz PSD
471  * bssid, short ssid, bss params, 20MHz PSD and MLD param
472  */
473 enum tbtt_information_field {
474 	TBTT_NEIGHBOR_AP_OFFSET_ONLY = 1,
475 	TBTT_NEIGHBOR_AP_BSS_PARAM = 2,
476 	TBTT_NEIGHBOR_AP_SHORTSSID = 5,
477 	TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM = 6,
478 	TBTT_NEIGHBOR_AP_BSSID = 7,
479 	TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM = 8,
480 	TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD = 9,
481 	TBTT_NEIGHBOR_AP_BSSSID_S_SSID = 11,
482 	TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM = 12,
483 	TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD = 13,
484 	TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD_MLD_PARAM = 16
485 };
486 
487 /**
488  * struct reduced_neighbor_report - Reduced Neighbor Report
489  * @count: number of RNR info
490  * @bss_info: RNR BSS Information
491  */
492 struct reduced_neighbor_report {
493 	uint8_t count;
494 	struct rnr_bss_info bss_info[MAX_RNR_BSS];
495 };
496 
497 #define SCAN_SECURITY_TYPE_WEP 0x01
498 #define SCAN_SECURITY_TYPE_WPA 0x02
499 #define SCAN_SECURITY_TYPE_WAPI 0x04
500 #define SCAN_SECURITY_TYPE_RSN 0x08
501 
502 #ifdef WLAN_FEATURE_11BE_MLO
503 #define MLD_MAX_LINKS 3
504 
505 /**
506  * struct partner_link_info: Partner link information of an ML
507  * @link_addr: BSSID of the link
508  * @freq: center frequency in MHz
509  * @cfreq2: center frequency of the secondary channel in MHz
510  * @link_id: Link id advertised by the AP
511  * @csa_ie: Pointer to CSA IE
512  * @ecsa_ie: Pointer to eCSA IE
513  * @max_cst_ie: Pointer to Max Channel Switch Time IE
514  * @is_valid_link: The partner link can be used if true
515  * @op_class: Operating class
516  */
517 struct partner_link_info {
518 	struct qdf_mac_addr link_addr;
519 	uint16_t freq;
520 	uint16_t cfreq2;
521 	uint8_t link_id;
522 	const uint8_t *csa_ie;
523 	const uint8_t *ecsa_ie;
524 	const uint8_t *max_cst_ie;
525 	uint8_t  is_valid_link;
526 	uint8_t op_class;
527 };
528 
529 /**
530  * struct ml_info: Multi link formation of a 11be beacon
531  * @mld_mac_addr: MLD mac address
532  * @num_links: Number of links supported by ML AP
533  * @self_link_id: Link id of the scan entry
534  * @link_info: Array containing partner links information
535  * @ml_bss_score: Multi link BSS score
536  */
537 struct ml_info {
538 	struct qdf_mac_addr mld_mac_addr;
539 	uint8_t num_links;
540 	uint8_t self_link_id;
541 	struct partner_link_info link_info[MLD_MAX_LINKS - 1];
542 	uint16_t ml_bss_score;
543 };
544 #endif
545 
546 /**
547  * struct scan_cache_entry: structure containing scan entry
548  * @frm_subtype: updated from beacon/probe
549  * @bssid: bssid
550  * @mac_addr: mac address
551  * @ssid: ssid
552  * @is_hidden_ssid: is AP having hidden ssid.
553  * @security_type: security supported
554  * @seq_num: sequence number
555  * @phy_mode: Phy mode of the AP
556  * @avg_rssi: Average RSSI of the AP
557  * @rssi_raw: The rssi of the last beacon/probe received
558  * @snr: The snr of the last beacon/probe received
559  * @avg_snr: Average SNR of the AP
560  * @bcn_int: Beacon interval of the AP
561  * @cap_info: Capability of the AP
562  * @tsf_info: TSF info
563  * @erp: erp info
564  * @dtim_period: dtime period
565  * @air_time_fraction: Air time fraction from ESP param
566  * @qbss_chan_load: Qbss channel load
567  * @nss: supported NSS information
568  * @is_p2p_ssid: is P2P entry
569  * @adaptive_11r_ap: flag to check if AP supports adaptive 11r
570  * @scan_entry_time: boottime in microsec when last beacon/probe is received
571  * @rssi_timestamp: boottime in microsec when RSSI was updated
572  * @hidden_ssid_timestamp: boottime in microsec when hidden
573  *                         ssid was received
574  * @mbssid_info: Multi bssid information
575  * @rnr: Reduced neighbor report information
576  * @channel: channel info on which AP is present
577  * @channel_mismatch: if channel received in metadata
578  *                    doesn't match the one in beacon
579  * @tsf_delta: TSF delta
580  * @bss_score: bss score calculated on basis of RSSI/caps etc.
581  * @neg_sec_info: negotiated security info
582  * @per_chain_rssi: per chain RSSI value received.
583  * boottime_ns: boottime in ns.
584  * @rrm_parent_tsf: RRM parent tsf
585  * @mlme_info: Mlme info, this will be updated by MLME for the scan entry
586  * @alt_wcn_ie: alternate WCN IE
587  * @ie_list: IE list pointers
588  * @raw_frame: contain raw frame and the length of the raw frame
589  * @pdev_id: pdev id
590  * @ml_info: Multi link information
591  */
592 struct scan_cache_entry {
593 	uint8_t frm_subtype;
594 	struct qdf_mac_addr bssid;
595 	struct qdf_mac_addr mac_addr;
596 	struct wlan_ssid ssid;
597 	bool is_hidden_ssid;
598 	uint8_t security_type;
599 	uint16_t seq_num;
600 	enum wlan_phymode phy_mode;
601 	int32_t avg_rssi;
602 	int8_t rssi_raw;
603 	uint8_t snr;
604 	uint32_t avg_snr;
605 	uint16_t bcn_int;
606 	union wlan_capability cap_info;
607 	union {
608 		uint8_t data[8];
609 		uint64_t tsf;
610 	} tsf_info;
611 	uint8_t erp;
612 	uint8_t dtim_period;
613 	uint8_t air_time_fraction;
614 	uint8_t qbss_chan_load;
615 	uint8_t nss;
616 	bool is_p2p;
617 	bool adaptive_11r_ap;
618 	qdf_time_t scan_entry_time;
619 	qdf_time_t rssi_timestamp;
620 	qdf_time_t hidden_ssid_timestamp;
621 	struct scan_mbssid_info mbssid_info;
622 	struct reduced_neighbor_report rnr;
623 	struct channel_info channel;
624 	bool channel_mismatch;
625 	struct mlme_info mlme_info;
626 	uint32_t tsf_delta;
627 	uint32_t bss_score;
628 	struct security_info neg_sec_info;
629 	uint8_t per_chain_rssi[WLAN_MGMT_TXRX_HOST_MAX_ANTENNA];
630 	uint64_t boottime_ns;
631 	uint32_t rrm_parent_tsf;
632 	struct element_info alt_wcn_ie;
633 	struct ie_list ie_list;
634 	struct element_info raw_frame;
635 	/*
636 	 * This is added temporarily for 6GHz channel to freq conversion
637 	 * to get pdev wherever it requores to convert frequency to
638 	 * channel as regulatory apis requires pdev as argument
639 	 */
640 	uint8_t pdev_id;
641 #ifdef WLAN_FEATURE_11BE_MLO
642 	struct ml_info ml_info;
643 #endif
644 };
645 
646 #define MAX_FAVORED_BSSID 16
647 #define MAX_ALLOWED_SSID_LIST 4
648 
649 #define WLAN_SCAN_FILTER_NUM_SSID 5
650 #define WLAN_SCAN_FILTER_NUM_BSSID 5
651 
652 #define REALM_HASH_LEN 2
653 #define CACHE_IDENTIFIER_LEN 2
654 #define HESSID_LEN 6
655 
656 #ifdef WLAN_FEATURE_FILS_SK
657 /**
658  * struct fils_filter_info: FILS info present in scan filter
659  * @realm_check: whether realm check is required
660  * @fils_realm: realm hash value
661  * @security_type: type of security supported
662  */
663 struct fils_filter_info {
664 	bool realm_check;
665 	uint8_t fils_realm[REALM_HASH_LEN];
666 	uint8_t security_type;
667 };
668 #endif
669 
670 /*
671  * struct filter_arg: Opaque pointer for the filter arguments
672  */
673 struct filter_arg;
674 typedef struct filter_arg *bss_filter_arg_t;
675 
676 /**
677  * enum dot11_mode_filter - Filter APs according to dot11mode
678  * @ALLOW_ALL: ignore check
679  * @ALLOW_11N_ONLY: allow only 11n AP
680  * @ALLOW_11AC_ONLY: allow only 11ac AP
681  * @ALLOW_11AX_ONLY: allow only 11ax AP
682  * @ALLOW_11BE_ONLY: allow only 11be AP
683  */
684 enum dot11_mode_filter {
685 	ALLOW_ALL,
686 	ALLOW_11N_ONLY,
687 	ALLOW_11AC_ONLY,
688 	ALLOW_11AX_ONLY,
689 	ALLOW_11BE_ONLY,
690 };
691 
692 /**
693  * struct scan_filter: scan filter
694  * @enable_adaptive_11r:    flag to check if adaptive 11r ini is enabled
695  * @rrm_measurement_filter: For measurement reports.if set, only SSID, BSSID
696  *                          and channel is considered for filtering.
697  * @ignore_pmf_cap: Ignore pmf capability match
698  * @ignore_auth_enc_type: Ignore enc type if
699  *                        this is set (For WPS/OSEN connection)
700  * @ignore_nol_chan: Ignore entry with channel in the NOL list
701  * @ignore_6ghz_channel: ignore 6Ghz channels
702  * @age_threshold: If set return entry which are newer than the age_threshold
703  * @num_of_bssid: number of bssid passed
704  * @num_of_ssid: number of ssid
705  * @num_of_channels: number of  channels
706  * @bss_type: bss type IBSS or BSS or ANY
707  * @pmf_cap: Pmf capability
708  * @dot11mode: Filter APs based upon dot11mode
709  * @rssi_threshold: AP having RSSI greater than
710  *                  rssi threasholed (ignored if set 0)
711  * @mobility_domain: Mobility domain for 11r
712  * @authmodeset: auth mode
713  * @key_mgmt: key management
714  * @ucastcipherset: unicast cipher set
715  * @mcastcipherset: multicast cipher set
716  * @mgmtcipherset: mgmt cipher set
717  * @fils_scan_filter: FILS info
718  * @bssid_hint: Mac address of bssid_hint
719  * @bssid_list: bssid list
720  * @ssid_list: ssid list
721  * @chan_freq_list: channel frequency list, frequency unit: MHz
722  * @match_security_func: Function pointer to custom security filter
723  * @match_security_func_arg: Function argument to custom security filter
724  * @ccx_validate_bss: Function pointer to custom bssid filter
725  * @ccx_validate_bss_arg: Function argument to custom bssid filter
726  * @band_bitmap: Allowed band bit map, BIT0: 2G, BIT1: 5G, BIT2: 6G
727  */
728 struct scan_filter {
729 	uint8_t enable_adaptive_11r:1,
730 		rrm_measurement_filter:1,
731 		ignore_pmf_cap:1,
732 		ignore_auth_enc_type:1,
733 		ignore_nol_chan:1,
734 		ignore_6ghz_channel:1;
735 	qdf_time_t age_threshold;
736 	uint8_t num_of_bssid;
737 	uint8_t num_of_ssid;
738 	uint16_t num_of_channels;
739 	enum wlan_bss_type bss_type;
740 	enum wlan_pmf_cap pmf_cap;
741 	enum dot11_mode_filter dot11mode;
742 	uint8_t rssi_threshold;
743 	uint32_t mobility_domain;
744 	uint32_t authmodeset;
745 	uint32_t key_mgmt;
746 	uint32_t ucastcipherset;
747 	uint32_t mcastcipherset;
748 	uint32_t mgmtcipherset;
749 #ifdef WLAN_FEATURE_FILS_SK
750 	struct fils_filter_info fils_scan_filter;
751 #endif
752 	struct qdf_mac_addr bssid_hint;
753 	/* Variable params list */
754 	struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID];
755 	struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID];
756 	qdf_freq_t chan_freq_list[NUM_CHANNELS];
757 	bool (*match_security_func)(void *, struct scan_cache_entry *);
758 	bss_filter_arg_t match_security_func_arg;
759 	bool (*ccx_validate_bss)(void *, struct scan_cache_entry *, int);
760 	bss_filter_arg_t ccx_validate_bss_arg;
761 #ifdef WLAN_FEATURE_11BE_MLO
762 	uint32_t band_bitmap;
763 #endif
764 };
765 
766 /**
767  * enum scan_disable_reason - scan enable/disable reason
768  * @REASON_SUSPEND: reason is suspend
769  * @REASON_SYSTEM_DOWN: reason is system going down
770  * @REASON_USER_SPACE: reason is user space initiated
771  * @REASON_VDEV_DOWN: reason is vdev going down
772  */
773 enum scan_disable_reason {
774 	REASON_SUSPEND  = 0x1,
775 	REASON_SYSTEM_DOWN = 0x2,
776 	REASON_USER_SPACE = 0x4,
777 	REASON_VDEV_DOWN = 0x8,
778 };
779 
780 /**
781  * enum scan_priority - scan priority definitions
782  * @SCAN_PRIORITY_VERY_LOW: very low priority
783  * @SCAN_PRIORITY_LOW: low scan priority
784  * @SCAN_PRIORITY_MEDIUM: medium priority
785  * @SCAN_PRIORITY_HIGH: high priority
786  * @SCAN_PRIORITY_VERY_HIGH: very high priority
787  * @SCAN_PRIORITY_COUNT: number of priorities supported
788  */
789 enum scan_priority {
790 	SCAN_PRIORITY_VERY_LOW,
791 	SCAN_PRIORITY_LOW,
792 	SCAN_PRIORITY_MEDIUM,
793 	SCAN_PRIORITY_HIGH,
794 	SCAN_PRIORITY_VERY_HIGH,
795 	SCAN_PRIORITY_COUNT,
796 };
797 
798 /**
799  * enum scan_phy_mode - phymode used for scan
800  * @SCAN_PHY_MODE_11A: 11a mode
801  * @SCAN_PHY_MODE_11G: 11g mode
802  * @SCAN_PHY_MODE_11B: 11b mode
803  * @SCAN_PHY_MODE_11GONLY: 11g only mode
804  * @SCAN_PHY_MODE_11NA_HT20: 11na ht20 mode
805  * @SCAN_PHY_MODE_11NG_HT20: 11ng ht20 mode
806  * @SCAN_PHY_MODE_11NA_HT40: 11na ht40 mode
807  * @SCAN_PHY_MODE_11NG_HT40: 11ng ht40 mode
808  * @SCAN_PHY_MODE_11AC_VHT20: 11ac vht20 mode
809  * @SCAN_PHY_MODE_11AC_VHT40: 11ac vht40 mode
810  * @SCAN_PHY_MODE_11AC_VHT80: 11ac vht80 mode
811  * @SCAN_PHY_MODE_11AC_VHT20_2G: 2GHz 11ac vht20 mode
812  * @SCAN_PHY_MODE_11AC_VHT40_2G: 2GHz 11ac vht40 mode
813  * @SCAN_PHY_MODE_11AC_VHT80_2G: 2GHz 11ac vht80 mode
814  * @SCAN_PHY_MODE_11AC_VHT80_80: 11ac vht 80+80 mode
815  * @SCAN_PHY_MODE_11AC_VHT160: 11ac vht160 mode
816  * @SCAN_PHY_MODE_11AX_HE20: 11ax he20 mode
817  * @SCAN_PHY_MODE_11AX_HE40: 11ax he40 mode
818  * @SCAN_PHY_MODE_11AX_HE80: 11ax he80 mode
819  * @SCAN_PHY_MODE_11AX_HE80_80: 11ax he80+80 mode
820  * @SCAN_PHY_MODE_11AX_HE160: 11ax he160 mode
821  * @SCAN_PHY_MODE_11AX_HE20_2G: 2GHz 11ax he20 mode
822  * @SCAN_PHY_MODE_11AX_HE40_2G: 2GHz 11ax he40 mode
823  * @SCAN_PHY_MODE_11AX_HE80_2G: 2GHz 11ax he80 mode
824  * @SCAN_PHY_MODE_UNKNOWN: unknown phy mode
825  * @SCAN_PHY_MODE_MAX: max valid phymode
826  */
827 enum scan_phy_mode {
828 	SCAN_PHY_MODE_11A = 0,
829 	SCAN_PHY_MODE_11G = 1,
830 	SCAN_PHY_MODE_11B = 2,
831 	SCAN_PHY_MODE_11GONLY = 3,
832 	SCAN_PHY_MODE_11NA_HT20 = 4,
833 	SCAN_PHY_MODE_11NG_HT20 = 5,
834 	SCAN_PHY_MODE_11NA_HT40 = 6,
835 	SCAN_PHY_MODE_11NG_HT40 = 7,
836 	SCAN_PHY_MODE_11AC_VHT20 = 8,
837 	SCAN_PHY_MODE_11AC_VHT40 = 9,
838 	SCAN_PHY_MODE_11AC_VHT80 = 10,
839 	SCAN_PHY_MODE_11AC_VHT20_2G = 11,
840 	SCAN_PHY_MODE_11AC_VHT40_2G = 12,
841 	SCAN_PHY_MODE_11AC_VHT80_2G = 13,
842 	SCAN_PHY_MODE_11AC_VHT80_80 = 14,
843 	SCAN_PHY_MODE_11AC_VHT160 = 15,
844 	SCAN_PHY_MODE_11AX_HE20 = 16,
845 	SCAN_PHY_MODE_11AX_HE40 = 17,
846 	SCAN_PHY_MODE_11AX_HE80 = 18,
847 	SCAN_PHY_MODE_11AX_HE80_80 = 19,
848 	SCAN_PHY_MODE_11AX_HE160 = 20,
849 	SCAN_PHY_MODE_11AX_HE20_2G = 21,
850 	SCAN_PHY_MODE_11AX_HE40_2G = 22,
851 	SCAN_PHY_MODE_11AX_HE80_2G = 23,
852 	SCAN_PHY_MODE_UNKNOWN = 24,
853 	SCAN_PHY_MODE_MAX = 24
854 };
855 
856 /**
857  * enum scan_dwelltime_adaptive_mode: dwelltime_mode
858  * @SCAN_DWELL_MODE_DEFAULT: Use firmware default mode
859  * @SCAN_DWELL_MODE_CONSERVATIVE: Conservative adaptive mode
860  * @SCAN_DWELL_MODE_MODERATE: Moderate adaptive mode
861  * @SCAN_DWELL_MODE_AGGRESSIVE: Aggressive adaptive mode
862  * @SCAN_DWELL_MODE_STATIC: static adaptive mode
863  */
864 enum scan_dwelltime_adaptive_mode {
865 	SCAN_DWELL_MODE_DEFAULT = 0,
866 	SCAN_DWELL_MODE_CONSERVATIVE = 1,
867 	SCAN_DWELL_MODE_MODERATE = 2,
868 	SCAN_DWELL_MODE_AGGRESSIVE = 3,
869 	SCAN_DWELL_MODE_STATIC = 4
870 };
871 
872 /**
873  * struct scan_random_attr - holds scan randomization attrs
874  * @randomize: set to true for scan randomization
875  * @mac_addr: mac addr to be randomized
876  * @mac_mask: used to represent bits in mac_addr for randomization
877  */
878 struct scan_random_attr {
879 	bool randomize;
880 	uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
881 	uint8_t mac_mask[QDF_MAC_ADDR_SIZE];
882 };
883 
884 /**
885  * struct probe_req_allowlist_attr - holds probe req ie allowlist attrs
886  * @allow_list: enable/disable allowlist
887  * @ie_bitmap: bitmap of IEs to be enabled
888  * @num_vendor_oui: number of vendor OUIs
889  * @voui: vendor oui buffer
890  */
891 struct probe_req_allowlist_attr {
892 	bool allow_list;
893 	uint32_t ie_bitmap[PROBE_REQ_BITMAP_LEN];
894 	uint32_t num_vendor_oui;
895 	uint32_t voui[MAX_PROBE_REQ_OUIS];
896 };
897 
898 /**
899  * enum scan_flags: scan flags
900  * @FLAG_SCAN_ONLY_IF_RNR_FOUND: Set this flag for a 6g channel to scan it only
901  *  if an RNR IE is found with that channel while scanning 2g/5g bands.
902  */
903 enum scan_flags {
904 	FLAG_SCAN_ONLY_IF_RNR_FOUND = 0x1,
905 };
906 
907 /**
908  * struct chan_info - channel information
909  * @freq: frequency to scan
910  * @phymode: phymode in which @frequency should be scanned
911  * @flags: Flags to define channel property as defined @enum scan_flags.
912  *  Firmware can use this info for different operations, e.g.: scan
913  */
914 struct chan_info {
915 	qdf_freq_t freq;
916 	enum scan_phy_mode phymode;
917 	enum scan_flags flags;
918 };
919 
920 struct chan_list_info {
921 	qdf_freq_t freq;
922 	uint32_t last_scan_time;
923 };
924 
925 struct chan_list_scan_info {
926 	uint8_t num_chan;
927 	struct chan_list_info ch_scan_info[NUM_CHANNELS];
928 };
929 
930 /**
931  * struct chan_list - list of frequencies to be scanned
932  *  and their phymode
933  * @num_chan: number of channels to scan
934  * @chan: channel parameters used for this scan
935  */
936 struct chan_list {
937 	uint8_t num_chan;
938 	struct chan_info chan[NUM_CHANNELS];
939 };
940 
941 /**
942  * struct hint_short_ssid - short SSID hint
943  *  and their phymode
944  * @freq_flags: freq unit: MHz (upper 16bits)
945  *              flags (lower 16bits)
946  * @short_ssid: short SSID
947  */
948 struct hint_short_ssid {
949 	uint32_t freq_flags;
950 	uint32_t short_ssid;
951 };
952 
953 /**
954  * struct hint_bssid - BSSID hint
955  *  and their phymode
956  * @freq_flags: freq unit: MHz (upper 16bits)
957  *              flags (lower 16bits)
958  * @bssid: BSSID
959  */
960 struct hint_bssid {
961 	uint32_t freq_flags;
962 	struct qdf_mac_addr bssid;
963 };
964 
965 /**
966  * enum scan_request_type: scan type
967  * @SCAN_TYPE_DEFAULT: Def scan
968  * @SCAN_TYPE_P2P_SEARCH: P2P Search
969  * @SCAN_TYPE_P2P_LISTEN: P2P listed
970  * @SCAN_TYPE_RRM: RRM scan request
971  * @SCAN_TYPE_SCAN_FOR_CONNECT : Scan for connect
972  */
973 enum scan_request_type {
974 	SCAN_TYPE_DEFAULT = 0,
975 	SCAN_TYPE_P2P_SEARCH = 1,
976 	SCAN_TYPE_P2P_LISTEN = 2,
977 	SCAN_TYPE_RRM = 3,
978 	SCAN_TYPE_SCAN_FOR_CONNECT = 4
979 };
980 
981 /**
982  * struct scan_req_params - start scan request parameter
983  * @scan_id: scan id
984  * @scan_req_id: scan requester id
985  * @vdev_id: vdev id where scan was originated
986  * @pdev_id: pdev id of parent pdev
987  * @scan_priority: scan priority
988  * @scan_ev_started: notify scan started event
989  * @scan_ev_completed: notify scan completed event
990  * @scan_ev_bss_chan: notify bss chan event
991  * @scan_ev_foreign_chan: notify foreign chan event
992  * @scan_ev_dequeued: notify scan request dequeued event
993  * @scan_ev_preempted: notify scan preempted event
994  * @scan_ev_start_failed: notify scan start failed event
995  * @scan_ev_restarted: notify scan restarted event
996  * @scan_ev_foreign_chn_exit: notify foreign chan exit event
997  * @scan_ev_invalid: notify invalid scan request event
998  * @scan_ev_gpio_timeout: notify gpio timeout event
999  * @scan_ev_suspended: notify scan suspend event
1000  * @scan_ev_resumed: notify scan resumed event
1001  * @scan_events: variable to read and set scan_ev_* flags in one shot
1002  *               can be used to dump all scan_ev_* flags for debug
1003  * @dwell_time_active: active dwell time
1004  * @dwell_time_active_2g: active dwell time for 2G channels, if it's not zero
1005  * @dwell_time_passive: passive dwell time
1006  * @min_dwell_time_6g: 6Ghz min dwell time
1007  * @dwell_time_active_6g: 6Ghz active dwell time
1008  * @dwell_time_passive_6g: 6Ghz passive dwell time
1009  * @min_rest_time: min rest time
1010  * @max_rest_time: max rest time
1011  * @repeat_probe_time: repeat probe time
1012  * @probe_spacing_time: probe spacing time
1013  * @idle_time: idle time
1014  * @max_scan_time: max scan time
1015  * @probe_delay: probe delay
1016  * @scan_offset_time: Support split scanning on the
1017  *                    same channel for CBS feature.
1018  * @scan_f_passive: passively scan all channels including active channels
1019  * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
1020  * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req
1021  * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req
1022  * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor
1023  * @scan_f_filter_prb_req: filter Probe request frames
1024  * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels
1025  * @scan_f_continue_on_err:continue scan even if few certain errors have occurred
1026  * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan
1027  * @scan_f_offchan_data_tx: allow data transmission during off channel scan
1028  * @scan_f_promisc_mode: scan with promiscuous mode
1029  * @scan_f_capture_phy_err: enable capture ppdu with phy errors
1030  * @scan_f_strict_passive_pch: do passive scan on passive channels
1031  * @scan_f_half_rate: enable HALF (10MHz) rate support
1032  * @scan_f_quarter_rate: set Quarter (5MHz) rate support
1033  * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel
1034  * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame
1035  * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame
1036  * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe
1037  * @scan_f_add_rand_seq_in_probe: use random sequence number in probe
1038  * @scan_f_en_ie_allowlist_in_probe: enable ie allowlist in probe
1039  * @scan_f_forced: force scan even in presence of data traffic
1040  * @scan_f_2ghz: scan 2.4 GHz channels
1041  * @scan_f_5ghz: scan 5 GHz channels
1042  * @scan_f_wide_band: scan in 40 MHz or higher bandwidth
1043  * @scan_flags: variable to read and set scan_f_* flags in one shot
1044  *              can be used to dump all scan_f_* flags for debug
1045  * @burst_duration: burst duration
1046  * @num_bssid: no of bssid
1047  * @num_ssids: no of ssid
1048  * @n_probes: no of probe
1049  * @chan_list: channel list
1050  * @ssid: ssid list
1051  * @bssid_list: Lisst of bssid to scan
1052  * @scan_random: scan randomization params
1053  * @ie_allowlist: probe req IE allowlist attrs
1054  * @extraie: list of optional/vendor specific ie's to be added in probe requests
1055  * @htcap: htcap ie
1056  * @vhtcap: vhtcap ie
1057  * @scan_ctrl_flags_ext: scan control flag extended
1058  * @num_hint_s_ssid: number of short SSID hints
1059  * @num_hint_bssid: number of BSSID hints
1060  * @hint_s_ssid: short SSID hints
1061  * @hint_bssid: BSSID hints
1062  */
1063 
1064 struct scan_req_params {
1065 	uint32_t scan_id;
1066 	uint32_t scan_req_id;
1067 	uint32_t vdev_id;
1068 	uint32_t pdev_id;
1069 	enum scan_priority scan_priority;
1070 	enum scan_request_type scan_type;
1071 	union {
1072 		struct {
1073 			uint32_t scan_ev_started:1,
1074 				 scan_ev_completed:1,
1075 				 scan_ev_bss_chan:1,
1076 				 scan_ev_foreign_chan:1,
1077 				 scan_ev_dequeued:1,
1078 				 scan_ev_preempted:1,
1079 				 scan_ev_start_failed:1,
1080 				 scan_ev_restarted:1,
1081 				 scan_ev_foreign_chn_exit:1,
1082 				 scan_ev_invalid:1,
1083 				 scan_ev_gpio_timeout:1,
1084 				 scan_ev_suspended:1,
1085 				 scan_ev_resumed:1;
1086 		};
1087 		uint32_t scan_events;
1088 	};
1089 	uint32_t dwell_time_active;
1090 	uint32_t dwell_time_active_2g;
1091 	uint32_t dwell_time_passive;
1092 	uint32_t min_dwell_time_6g;
1093 	uint32_t dwell_time_active_6g;
1094 	uint32_t dwell_time_passive_6g;
1095 	uint32_t min_rest_time;
1096 	uint32_t max_rest_time;
1097 	uint32_t repeat_probe_time;
1098 	uint32_t probe_spacing_time;
1099 	uint32_t idle_time;
1100 	uint32_t max_scan_time;
1101 	uint32_t probe_delay;
1102 	uint32_t scan_offset_time;
1103 	union {
1104 		struct {
1105 			uint32_t scan_f_passive:1,
1106 				 scan_f_bcast_probe:1,
1107 				 scan_f_cck_rates:1,
1108 				 scan_f_ofdm_rates:1,
1109 				 scan_f_chan_stat_evnt:1,
1110 				 scan_f_filter_prb_req:1,
1111 				 scan_f_bypass_dfs_chn:1,
1112 				 scan_f_continue_on_err:1,
1113 				 scan_f_offchan_mgmt_tx:1,
1114 				 scan_f_offchan_data_tx:1,
1115 				 scan_f_promisc_mode:1,
1116 				 scan_f_capture_phy_err:1,
1117 				 scan_f_strict_passive_pch:1,
1118 				 scan_f_half_rate:1,
1119 				 scan_f_quarter_rate:1,
1120 				 scan_f_force_active_dfs_chn:1,
1121 				 scan_f_add_tpc_ie_in_probe:1,
1122 				 scan_f_add_ds_ie_in_probe:1,
1123 				 scan_f_add_spoofed_mac_in_probe:1,
1124 				 scan_f_add_rand_seq_in_probe:1,
1125 				 scan_f_en_ie_allowlist_in_probe:1,
1126 				 scan_f_forced:1,
1127 				 scan_f_2ghz:1,
1128 				 scan_f_5ghz:1,
1129 				 scan_f_wide_band:1;
1130 		};
1131 		uint32_t scan_flags;
1132 	};
1133 	union {
1134 		struct {
1135 			uint32_t scan_policy_high_accuracy:1,
1136 				 scan_policy_low_span:1,
1137 				 scan_policy_low_power:1,
1138 				 scan_policy_colocated_6ghz:1;
1139 		};
1140 		uint32_t scan_policy_type;
1141 	};
1142 
1143 	enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode;
1144 	uint32_t burst_duration;
1145 	uint32_t num_bssid;
1146 	uint32_t num_ssids;
1147 	uint32_t n_probes;
1148 	struct chan_list chan_list;
1149 	struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID];
1150 	struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID];
1151 	struct scan_random_attr scan_random;
1152 	struct probe_req_allowlist_attr ie_allowlist;
1153 	struct element_info extraie;
1154 	struct element_info htcap;
1155 	struct element_info vhtcap;
1156 	uint32_t scan_ctrl_flags_ext;
1157 	uint32_t num_hint_s_ssid;
1158 	uint32_t num_hint_bssid;
1159 	struct hint_short_ssid hint_s_ssid[WLAN_SCAN_MAX_HINT_S_SSID];
1160 	struct hint_bssid hint_bssid[WLAN_SCAN_MAX_HINT_BSSID];
1161 };
1162 
1163 /**
1164  * struct scan_start_request - scan request config
1165  * @vdev: vdev
1166  * @scan_req: common scan start request parameters
1167  */
1168 struct scan_start_request {
1169 	struct wlan_objmgr_vdev *vdev;
1170 	struct scan_req_params scan_req;
1171 };
1172 
1173 /**
1174  * enum scan_cancel_type - type specifiers for cancel scan request
1175  * @WLAN_SCAN_CANCEL_SINGLE: cancel particular scan specified by scan_id
1176  * @WLAN_SCAN_CANCEL_VAP_ALL: cancel all scans running on a particular vdevid
1177  * @WLAN_SCAN_CANCEL_PDEV_ALL: cancel all scans running on parent pdev of vdevid
1178  * @WLAN_SCAN_CANCEL_HOST_VDEV_ALL: Cancel all host triggered scans alone on
1179  * vdev
1180  */
1181 enum scan_cancel_req_type {
1182 	WLAN_SCAN_CANCEL_SINGLE = 1,
1183 	WLAN_SCAN_CANCEL_VDEV_ALL,
1184 	WLAN_SCAN_CANCEL_PDEV_ALL,
1185 	WLAN_SCAN_CANCEL_HOST_VDEV_ALL,
1186 };
1187 
1188 /**
1189  * struct scan_cancel_param - stop scan cmd parameter
1190  * @requester: scan requester
1191  * @scan_id: scan id
1192  * @req_type: scan request type
1193  * @vdev_id: vdev id
1194  * @pdev_id: pdev id of parent pdev
1195  */
1196 struct scan_cancel_param {
1197 	uint32_t requester;
1198 	uint32_t scan_id;
1199 	enum scan_cancel_req_type req_type;
1200 	uint32_t vdev_id;
1201 	uint32_t pdev_id;
1202 };
1203 
1204 /**
1205  * struct scan_cancel_request - stop scan cmd
1206  * @vdev: vdev object
1207  * @wait_tgt_cancel: wait for target to cancel scan
1208  * @cancel_req: stop scan cmd parameter
1209  */
1210 struct scan_cancel_request {
1211 	/* Extra parameters consumed by scan module or serialization */
1212 	struct wlan_objmgr_vdev *vdev;
1213 	bool wait_tgt_cancel;
1214 	/* Actual scan cancel request parameters */
1215 	struct scan_cancel_param cancel_req;
1216 };
1217 
1218 /**
1219  * enum scan_event_type - scan event types
1220  * @SCAN_EVENT_TYPE_STARTED: scan started
1221  * @SCAN_EVENT_TYPE_COMPLETED: scan completed
1222  * @SCAN_EVENT_TYPE_BSS_CHANNEL: HW came back to home channel
1223  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL: HW moved to foreign channel
1224  * @SCAN_EVENT_TYPE_DEQUEUED: scan request dequeued
1225  * @SCAN_EVENT_TYPE_PREEMPTED: scan got preempted
1226  * @SCAN_EVENT_TYPE_START_FAILED: couldn't start scan
1227  * @SCAN_EVENT_TYPE_RESTARTED: scan restarted
1228  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT: HW exited foreign channel
1229  * @SCAN_EVENT_TYPE_SUSPENDED: scan got suspended
1230  * @SCAN_EVENT_TYPE_RESUMED: scan resumed
1231  * @SCAN_EVENT_TYPE_NLO_COMPLETE: NLO completed
1232  * @SCAN_EVENT_TYPE_NLO_MATCH: NLO match event
1233  * @SCAN_EVENT_TYPE_INVALID: invalid request
1234  * @SCAN_EVENT_TYPE_GPIO_TIMEOUT: gpio timeout
1235  * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START: radio measurement start
1236  * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END: radio measurement end
1237  * @SCAN_EVENT_TYPE_BSSID_MATCH: bssid match found
1238  * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF: foreign channel noise floor
1239  * @SCAN_EVENT_TYPE_MAX: marker for invalid event
1240  */
1241 enum scan_event_type {
1242 	SCAN_EVENT_TYPE_STARTED,
1243 	SCAN_EVENT_TYPE_COMPLETED,
1244 	SCAN_EVENT_TYPE_BSS_CHANNEL,
1245 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL,
1246 	SCAN_EVENT_TYPE_DEQUEUED,
1247 	SCAN_EVENT_TYPE_PREEMPTED,
1248 	SCAN_EVENT_TYPE_START_FAILED,
1249 	SCAN_EVENT_TYPE_RESTARTED,
1250 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT,
1251 	SCAN_EVENT_TYPE_SUSPENDED,
1252 	SCAN_EVENT_TYPE_RESUMED,
1253 	SCAN_EVENT_TYPE_NLO_COMPLETE,
1254 	SCAN_EVENT_TYPE_NLO_MATCH,
1255 	SCAN_EVENT_TYPE_INVALID,
1256 	SCAN_EVENT_TYPE_GPIO_TIMEOUT,
1257 	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START,
1258 	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END,
1259 	SCAN_EVENT_TYPE_BSSID_MATCH,
1260 	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF,
1261 	SCAN_EVENT_TYPE_MAX,
1262 };
1263 
1264 /**
1265  * enum scan_completion_reason - scan completion reason
1266  * @SCAN_REASON_NONE: un specified reason
1267  * @SCAN_REASON_COMPLETED: scan successfully completed
1268  * @SCAN_REASON_CANCELLED: scan got cancelled
1269  * @SCAN_REASON_PREEMPTED: scan got preempted
1270  * @SCAN_REASON_TIMEDOUT: couldn't complete within specified time
1271  * @SCAN_REASON_INTERNAL_FAILURE: cancelled because of some failure
1272  * @SCAN_REASON_SUSPENDED: scan suspended
1273  * @SCAN_REASON_RUN_FAILED: run failed
1274  * @SCAN_REASON_TERMINATION_FUNCTION: termination function
1275  * @SCAN_REASON_MAX_OFFCHAN_RETRIES: max retries exceeded threshold
1276  * @SCAN_REASON_DFS_VIOLATION: Scan start failure due to DFS violation.
1277  * @SCAN_REASON_MAX: invalid completion reason marker
1278  */
1279 enum scan_completion_reason {
1280 	SCAN_REASON_NONE,
1281 	SCAN_REASON_COMPLETED,
1282 	SCAN_REASON_CANCELLED,
1283 	SCAN_REASON_PREEMPTED,
1284 	SCAN_REASON_TIMEDOUT,
1285 	SCAN_REASON_INTERNAL_FAILURE,
1286 	SCAN_REASON_SUSPENDED,
1287 	SCAN_REASON_RUN_FAILED,
1288 	SCAN_REASON_TERMINATION_FUNCTION,
1289 	SCAN_REASON_MAX_OFFCHAN_RETRIES,
1290 	SCAN_REASON_DFS_VIOLATION,
1291 	SCAN_REASON_MAX,
1292 };
1293 
1294 /**
1295  * struct scan_event - scan event definition
1296  * @vdev_id: vdev where scan was run
1297  * @type: type of scan event
1298  * @reason: completion reason
1299  * @chan_freq: channel centre frequency
1300  * @requester: requester id
1301  * @scan_id: scan id
1302  * @timestamp: timestamp in microsec recorded by target for the scan event
1303  * @scan_start_req: scan request object used to start this scan
1304  */
1305 struct scan_event {
1306 	uint32_t vdev_id;
1307 	enum scan_event_type type;
1308 	enum scan_completion_reason reason;
1309 	uint32_t chan_freq;
1310 	uint32_t requester;
1311 	uint32_t scan_id;
1312 	uint32_t timestamp;
1313 	struct scan_start_request *scan_start_req;
1314 };
1315 
1316 /**
1317  * struct scan_event_info - scan event information
1318  * @vdev: vdev object
1319  * @event: scan event
1320  */
1321 struct scan_event_info {
1322 	struct wlan_objmgr_vdev *vdev;
1323 	struct scan_event event;
1324 };
1325 
1326 /**
1327  * enum scm_scan_status - scan status
1328  * @SCAN_NOT_IN_PROGRESS: Neither active nor pending scan in progress
1329  * @SCAN_IS_ACTIVE: scan request is present only in active list
1330  * @SCAN_IS_PENDING: scan request is present only in pending list
1331  * @SCAN_IS_ACTIVE_AND_PENDING: scan request is present in active
1332  *                               and pending both lists
1333  */
1334 enum scm_scan_status {
1335 	SCAN_NOT_IN_PROGRESS = 0, /* Must be 0 */
1336 	SCAN_IS_ACTIVE,
1337 	SCAN_IS_PENDING,
1338 	SCAN_IS_ACTIVE_AND_PENDING,
1339 };
1340 
1341 /**
1342  * scan_event_handler() - function prototype of scan event handlers
1343  * @vdev: vdev object
1344  * @event: scan event
1345  * @arg: argument
1346  *
1347  * PROTO TYPE, scan event handler call back function prototype
1348  *
1349  * @Return: void
1350  */
1351 typedef void (*scan_event_handler) (struct wlan_objmgr_vdev *vdev,
1352 	struct scan_event *event, void *arg);
1353 
1354 /**
1355  * enum scan_cb_type - update beacon cb type
1356  * @SCAN_CB_TYPE_INFORM_BCN: Callback to indicate beacon to OS
1357  * @SCAN_CB_TYPE_UPDATE_BCN: Callback to indicate beacon
1358  * @SCAN_CB_TYPE_UNLINK_BSS: cb to unlink bss entry
1359  *                    to MLME and update MLME info
1360  *
1361  */
1362 enum scan_cb_type {
1363 	SCAN_CB_TYPE_INFORM_BCN,
1364 	SCAN_CB_TYPE_UPDATE_BCN,
1365 	SCAN_CB_TYPE_UNLINK_BSS,
1366 };
1367 
1368 /* Set PNO */
1369 #define SCAN_PNO_MAX_PLAN_REQUEST   2
1370 #define SCAN_PNO_MAX_NETW_CHANNELS_EX  (NUM_CHANNELS)
1371 #define SCAN_PNO_MAX_SUPP_NETWORKS  16
1372 #define SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER 6
1373 #define SCAN_PNO_DEF_SCAN_TIMER_REPEAT 20
1374 #define SCAN_PNO_MATCH_WAKE_LOCK_TIMEOUT         (5 * 1000)     /* in msec */
1375 #define SCAN_MAX_IE_LENGTH 255
1376 #ifdef CONFIG_SLUB_DEBUG_ON
1377 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (2 * 1000)     /* in msec */
1378 #else
1379 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (1 * 1000)     /* in msec */
1380 #endif /* CONFIG_SLUB_DEBUG_ON */
1381 
1382 /**
1383  * enum ssid_bc_type - SSID broadcast type
1384  * @SSID_BC_TYPE_UNKNOWN: Broadcast unknown
1385  * @SSID_BC_TYPE_NORMAL: Broadcast normal
1386  * @SSID_BC_TYPE_HIDDEN: Broadcast hidden
1387  */
1388 enum ssid_bc_type {
1389 	SSID_BC_TYPE_UNKNOWN = 0,
1390 	SSID_BC_TYPE_NORMAL = 1,
1391 	SSID_BC_TYPE_HIDDEN = 2,
1392 };
1393 
1394 /**
1395  * struct pno_nw_type - pno nw type
1396  * @ssid: ssid
1397  * @authentication: authentication type
1398  * @encryption: encryption type
1399  * @bc_new_type: broadcast nw type
1400  * @pno_chan_list: pno channel list info
1401  * @rssi_thresh: rssi threshold
1402  */
1403 struct pno_nw_type {
1404 	struct wlan_ssid ssid;
1405 	uint32_t authentication;
1406 	uint32_t encryption;
1407 	uint32_t bc_new_type;
1408 	struct chan_list pno_chan_list;
1409 	int32_t rssi_thresh;
1410 };
1411 
1412 /**
1413  * struct connected_pno_band_rssi_pref - BSS preference based on band
1414  * and RSSI
1415  * @band: band preference
1416  * @rssi_pref: RSSI preference
1417  */
1418 struct cpno_band_rssi_pref {
1419 	int8_t band;
1420 	int8_t rssi;
1421 };
1422 
1423 /**
1424  * struct nlo_mawc_params - Motion Aided Wireless Connectivity based
1425  *                          Network List Offload configuration
1426  * @vdev_id: VDEV ID on which the configuration needs to be applied
1427  * @enable: flag to enable or disable
1428  * @exp_backoff_ratio: ratio of exponential backoff
1429  * @init_scan_interval: initial scan interval(msec)
1430  * @max_scan_interval:  max scan interval(msec)
1431  */
1432 struct nlo_mawc_params {
1433 	uint8_t vdev_id;
1434 	bool enable;
1435 	uint32_t exp_backoff_ratio;
1436 	uint32_t init_scan_interval;
1437 	uint32_t max_scan_interval;
1438 };
1439 
1440 /**
1441  * struct pno_scan_req_params - PNO Scan request structure
1442  * @vdev: vdev object
1443  * @networks_cnt: Number of networks
1444  * @do_passive_scan: Flag to request passive scan to fw
1445  * @vdev_id: vdev id
1446  * @fast_scan_period: Fast Scan period
1447  * @slow_scan_period: Slow scan period
1448  * @delay_start_time: delay in seconds to use before starting the first scan
1449  * @fast_scan_max_cycles: Fast scan max cycles
1450  * @scan_backoff_multiplier: multiply fast scan period by this after max cycles
1451  * @pno_channel_prediction: PNO channel prediction feature status
1452  * @uint32_t active_dwell_time: active dwell time
1453  * @uint32_t passive_dwell_time: passive dwell time
1454  * @top_k_num_of_channels: top K number of channels are used for tanimoto
1455  * distance calculation.
1456  * @stationary_thresh: threshold value to determine that the STA is stationary.
1457  * @adaptive_dwell_mode: adaptive dwelltime mode for pno scan
1458  * @channel_prediction_full_scan: periodic timer upon which a full scan needs
1459  * to be triggered.
1460  * @networks_list: Preferred network list
1461  * @scan_random: scan randomization params
1462  * @ie_allowlist: probe req IE allowlist attrs
1463  * @relative_rssi_set: Flag to check whether realtive_rssi is set or not
1464  * @relative_rssi: Relative rssi threshold, used for connected pno
1465  * @band_rssi_pref: Band and RSSI preference that can be given to one BSS
1466  *     over the other BSS
1467  *
1468  * E.g.
1469  *	{ fast_scan_period=120, fast_scan_max_cycles=2,
1470  *	  slow_scan_period=1800, scan_backoff_multiplier=2 }
1471  *	Result: 120s x2, 240s x2, 480s x2, 960s x2, 1800s xN
1472  * @mawc_params: Configuration parameters for NLO MAWC.
1473  * @scan_policy_colocated_6ghz: colocated_6ghz flag is set in pno scan req
1474  */
1475 struct pno_scan_req_params {
1476 	struct wlan_objmgr_vdev *vdev;
1477 	uint32_t networks_cnt;
1478 	bool     do_passive_scan;
1479 	uint32_t vdev_id;
1480 	uint32_t fast_scan_period;
1481 	uint32_t slow_scan_period;
1482 	uint32_t delay_start_time;
1483 	uint32_t fast_scan_max_cycles;
1484 	uint8_t scan_backoff_multiplier;
1485 	uint32_t active_dwell_time;
1486 	uint32_t passive_dwell_time;
1487 	uint32_t pno_channel_prediction;
1488 	uint32_t top_k_num_of_channels;
1489 	uint32_t stationary_thresh;
1490 	enum scan_dwelltime_adaptive_mode adaptive_dwell_mode;
1491 	uint32_t channel_prediction_full_scan;
1492 	struct pno_nw_type networks_list[SCAN_PNO_MAX_SUPP_NETWORKS];
1493 	struct scan_random_attr scan_random;
1494 	struct probe_req_allowlist_attr ie_allowlist;
1495 	bool relative_rssi_set;
1496 	int8_t relative_rssi;
1497 	struct cpno_band_rssi_pref band_rssi_pref;
1498 	struct nlo_mawc_params mawc_params;
1499 	bool scan_policy_colocated_6ghz;
1500 };
1501 
1502 /**
1503  * struct scan_user_cfg - user configuration required for for scan
1504  * @ie_allowlist: probe req IE allowlist attrs
1505  * @sta_miracast_mcc_rest_time: sta miracast mcc rest time
1506  */
1507 struct scan_user_cfg {
1508 	struct probe_req_allowlist_attr ie_allowlist;
1509 	uint32_t sta_miracast_mcc_rest_time;
1510 };
1511 
1512 /**
1513  * update_beacon_cb() - cb to inform/update beacon
1514  * @psoc: psoc pointer
1515  * @scan_params:  scan entry to inform/update
1516  *
1517  * @Return: void
1518  */
1519 typedef void (*update_beacon_cb) (struct wlan_objmgr_pdev *pdev,
1520 	struct scan_cache_entry *scan_entry);
1521 
1522 /**
1523  * scan_iterator_func() - function prototype of scan iterator function
1524  * @scan_entry: scan entry object
1525  * @arg: extra argument
1526  *
1527  * PROTO TYPE, scan iterator function prototype
1528  *
1529  * @Return: QDF_STATUS
1530  */
1531 typedef QDF_STATUS (*scan_iterator_func) (void *arg,
1532 	struct scan_cache_entry *scan_entry);
1533 
1534 /**
1535  * enum scan_priority - scan priority definitions
1536  * @SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT: disable scan command timeout
1537  * @SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH: config to drop beacon/probe
1538  *  response frames if received channel and IE channels do not match
1539  */
1540 enum scan_config {
1541 	SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT,
1542 	SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH,
1543 };
1544 
1545 /**
1546  * enum ext_cap_bit_field - Extended capabilities bit field
1547  * @BSS_2040_COEX_MGMT_SUPPORT: 20/40 BSS Coexistence Management Support field
1548  * @OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT: OBSS Narrow  Bandwidth RU
1549  *     in UL OFDMA  Tolerance Support
1550  */
1551 enum ext_cap_bit_field {
1552 	BSS_2040_COEX_MGMT_SUPPORT = 0,
1553 	OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT = 79,
1554 };
1555 
1556 /**
1557  * scan_rnr_info - RNR information
1558  * @timestamp: time stamp of beacon/probe
1559  * @short_ssid: Short SSID
1560  * @bssid: BSSID
1561  * @bss_params: bss params present in RNR IE
1562  */
1563 struct scan_rnr_info {
1564 	qdf_time_t timestamp;
1565 	uint32_t short_ssid;
1566 	struct qdf_mac_addr bssid;
1567 	uint8_t bss_params;
1568 };
1569 
1570 /**
1571  * struct scan_rnr_node - Scan RNR entry node
1572  * @node: node pointers
1573  * @entry: scan RNR entry pointer
1574  */
1575 struct scan_rnr_node {
1576 	qdf_list_node_t node;
1577 	struct scan_rnr_info entry;
1578 };
1579 
1580 /**
1581  * meta_rnr_channel - Channel information for scan priority algorithm
1582  * @chan_freq: channel frequency
1583  * @bss_beacon_probe_count: Beacon and probe request count
1584  * @saved_profile_count: Saved profile count
1585  * @beacon_probe_last_time_found: Timestamp of beacon/probe observed
1586  * @rnr_list: RNR list to store RNR IE information
1587  */
1588 struct meta_rnr_channel {
1589 	uint32_t chan_freq;
1590 	uint32_t bss_beacon_probe_count;
1591 	uint32_t saved_profile_count;
1592 	qdf_time_t beacon_probe_last_time_found;
1593 	qdf_list_t rnr_list;
1594 };
1595 
1596 #define RNR_UPDATE_SCAN_CNT_THRESHOLD 2
1597 /**
1598  * channel_list_db - Database for channel information
1599  * @channel: channel meta information
1600  * @scan_count: scan count since the db was updated
1601  */
1602 struct channel_list_db {
1603 	struct meta_rnr_channel channel[NUM_6GHZ_CHANNELS];
1604 	uint8_t scan_count;
1605 };
1606 
1607 /**
1608  * rnr_chan_weight - RNR channel weightage
1609  * @chan_freq: channel frequency
1610  * @weight: weightage of the channel
1611  * @phymode: phymode in which @frequency should be scanned
1612  * @flags: Flags to define channel property as defined @enum scan_flags.
1613  *  Firmware can use this info for different operations, e.g.: scan
1614  */
1615 struct rnr_chan_weight {
1616 	uint32_t chan_freq;
1617 	uint32_t weight;
1618 	enum scan_phy_mode phymode;
1619 	enum scan_flags flags;
1620 };
1621 
1622 /**
1623  * trim_channel_list - which channel list need trim
1624  * @TRIM_CHANNEL_LIST_NONE: no channel need trim
1625  * @TRIM_CHANNEL_LIST_5G: 5G channel need trim
1626  * @TRIM_CHANNEL_LIST_24G: 2.4G channel need trim
1627  */
1628 enum trim_channel_list {
1629 	TRIM_CHANNEL_LIST_NONE,
1630 	TRIM_CHANNEL_LIST_5G,
1631 	TRIM_CHANNEL_LIST_24G,
1632 };
1633 
1634 #ifdef FEATURE_SET
1635 /**
1636  * wlan_scan_features - Scan feature set structure
1637  * @pno_in_unassoc_state: is pno supported in unassoc state
1638  * @pno_in_assoc_state: is pno supported in assoc state
1639  */
1640 struct wlan_scan_features {
1641 	bool pno_in_unassoc_state;
1642 	bool pno_in_assoc_state;
1643 };
1644 #endif
1645 #endif
1646