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