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