xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/inc/wlan_scan_utils_api.h (revision a175314c51a4ce5cec2835cc8a8c7dc0c1810915)
1 /*
2  * Copyright (c) 2017-2018 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 public utility functions
21  */
22 
23 #ifndef _WLAN_SCAN_UTILS_H_
24 #define _WLAN_SCAN_UTILS_H_
25 
26 #include <wlan_objmgr_cmn.h>
27 #include <qdf_mc_timer.h>
28 #include <wlan_objmgr_psoc_obj.h>
29 #include <wlan_objmgr_pdev_obj.h>
30 #include <wlan_objmgr_vdev_obj.h>
31 #include <wlan_scan_public_structs.h>
32 #include<wlan_mgmt_txrx_utils_api.h>
33 
34 /**
35  * util_is_scan_entry_match() - func to check if both scan entry
36  * are from same AP
37  * @entry1: scan entry 1
38  * @entry2: scan entry 2
39  *
40  * match the two scan entries
41  *
42  * Return: true if entry match else false.
43  */
44 bool util_is_scan_entry_match(
45 	struct scan_cache_entry *entry1,
46 	struct scan_cache_entry *entry2);
47 
48 /**
49  * util_scan_unpack_beacon_frame() - func to unpack beacon frame to scan entry
50  * @pdev: pdev pointer
51  * @frame: beacon/probe frame
52  * @frame_len: beacon frame len
53  * @frm_subtype: beacon or probe
54  * @rx_param: rx meta data
55  *
56  * get the defaults scan params
57  *
58  * Return: unpacked list of scan entries.
59  */
60 qdf_list_t *util_scan_unpack_beacon_frame(
61 	struct wlan_objmgr_pdev *pdev,
62 	uint8_t *frame, qdf_size_t frame_len, uint32_t frm_subtype,
63 	struct mgmt_rx_event_params *rx_param);
64 
65 /**
66  * util_scan_get_ev_type_name() - converts enum event to printable string
67  * @event:      event of type scan_event_type
68  *
69  * API, converts enum event to printable character string
70  *
71  * Return:      pointer to printable string
72  */
73 const char *util_scan_get_ev_type_name(enum scan_event_type event);
74 
75 /**
76  * util_scan_get_ev_reason_name() - converts enum reason to printable string
77  * @reason      enum of scan completion reason
78  *
79  * API, converts enum event to printable character string
80  *
81  * Return:      pointer to printable string
82  */
83 const char *util_scan_get_ev_reason_name(enum scan_completion_reason reason);
84 
85 /**
86  * util_scan_entry_macaddr() - function to read transmitter address
87  * @scan_entry: scan entry
88  *
89  * API, function to read transmitter address of scan entry
90  *
91  * Return:      pointer to mac address
92  */
93 static inline uint8_t*
94 util_scan_entry_macaddr(struct scan_cache_entry *scan_entry)
95 {
96 	return &(scan_entry->mac_addr.bytes[0]);
97 }
98 
99 /**
100  * util_scan_entry_bssid() - function to read bssid
101  * @scan_entry: scan entry
102  *
103  * API, function to read bssid of scan entry
104  *
105  * Return: pointer to mac address
106  */
107 static inline uint8_t*
108 util_scan_entry_bssid(struct scan_cache_entry *scan_entry)
109 {
110 	return &(scan_entry->bssid.bytes[0]);
111 }
112 
113 /**
114  * util_scan_entry_capinfo() - function to read capibility info
115  * @scan_entry: scan entry
116  *
117  * API, function to read capibility info of scan entry
118  *
119  * Return: capability info
120  */
121 static inline union wlan_capability
122 util_scan_entry_capinfo(struct scan_cache_entry *scan_entry)
123 {
124 	return scan_entry->cap_info;
125 }
126 
127 /**
128  * util_scan_entry_beacon_interval() - function to read beacon interval
129  * @scan_entry: scan entry
130  *
131  * API, function to read beacon interval of scan entry
132  *
133  * Return: beacon interval
134  */
135 static inline uint16_t
136 util_scan_entry_beacon_interval(struct scan_cache_entry *scan_entry)
137 {
138 	return scan_entry->bcn_int;
139 }
140 
141 /**
142  * util_scan_entry_sequence_number() - function to read sequence number
143  * @scan_entry: scan entry
144  *
145  * API, function to read sequence number of scan entry
146  *
147  * Return: sequence number
148  */
149 static inline uint16_t
150 util_scan_entry_sequence_number(struct scan_cache_entry *scan_entry)
151 {
152 	return scan_entry->seq_num;
153 }
154 
155 /**
156  * util_scan_entry_tsf() - function to read tsf
157  * @scan_entry: scan entry
158  *
159  * API, function to read tsf of scan entry
160  *
161  * Return: tsf
162  */
163 static inline uint8_t*
164 util_scan_entry_tsf(struct scan_cache_entry *scan_entry)
165 {
166 	return scan_entry->tsf_info.data;
167 }
168 
169 /**
170  * util_scan_entry_reset_timestamp() - function to reset bcn receive timestamp
171  * @scan_entry: scan entry
172  *
173  * API, function to reset bcn receive timestamp of scan entry
174  *
175  * Return: void
176  */
177 static inline void
178 util_scan_entry_reset_timestamp(struct scan_cache_entry *scan_entry)
179 {
180 	scan_entry->scan_entry_time = 0;
181 }
182 
183 /*
184  * Macros used for RSSI calculation.
185  */
186 #define WLAN_RSSI_AVERAGING_TIME (5 * 1000) /* 5 seconds */
187 
188 #define WLAN_RSSI_EP_MULTIPLIER (1<<7)  /* pow2 to optimize out * and / */
189 
190 #define WLAN_RSSI_LPF_LEN       10
191 #define WLAN_RSSI_DUMMY_MARKER  0x127
192 
193 #define WLAN_EP_MUL(x, mul) ((x) * (mul))
194 
195 #define WLAN_EP_RND(x, mul) ((((x)%(mul)) >= ((mul)/2)) ?\
196 	((x) + ((mul) - 1)) / (mul) : (x)/(mul))
197 
198 #define WLAN_RSSI_GET(x) WLAN_EP_RND(x, WLAN_RSSI_EP_MULTIPLIER)
199 
200 #define RSSI_LPF_THRESHOLD      -20
201 
202 
203 #define WLAN_RSSI_OUT(x) (((x) != WLAN_RSSI_DUMMY_MARKER) ?     \
204 	(WLAN_EP_RND((x), WLAN_RSSI_EP_MULTIPLIER)) :  WLAN_RSSI_DUMMY_MARKER)
205 
206 
207 #define WLAN_RSSI_IN(x)         (WLAN_EP_MUL((x), WLAN_RSSI_EP_MULTIPLIER))
208 
209 #define WLAN_LPF_RSSI(x, y, len) \
210 	((x != WLAN_RSSI_DUMMY_MARKER) ? ((((x) << 3) + (y) - (x)) >> 3) : (y))
211 
212 #define WLAN_RSSI_LPF(x, y) do { \
213 	if ((y) >= RSSI_LPF_THRESHOLD) \
214 		x = WLAN_LPF_RSSI((x), WLAN_RSSI_IN((y)), WLAN_RSSI_LPF_LEN); \
215 	} while (0)
216 
217 #define WLAN_ABS_RSSI_LPF(x, y) do { \
218 	if ((y) >= (RSSI_LPF_THRESHOLD + WLAN_DEFAULT_NOISE_FLOOR)) \
219 		x = WLAN_LPF_RSSI((x), WLAN_RSSI_IN((y)), WLAN_RSSI_LPF_LEN); \
220 	} while (0)
221 
222 /**
223  * util_scan_entry_rssi() - function to read rssi of scan entry
224  * @scan_entry: scan entry
225  *
226  * API, function to read rssi value of scan entry
227  *
228  * Return: rssi
229  */
230 static inline uint8_t
231 util_scan_entry_rssi(struct scan_cache_entry *scan_entry)
232 {
233 	uint32_t rssi = WLAN_RSSI_OUT(scan_entry->avg_rssi);
234 	/*
235 	 * An entry is in the BSS list means we've received at least one beacon
236 	 * from the corresponding AP, so the rssi must be initialized.
237 	 *
238 	 * If the RSSI is not initialized, return 0 (i.e. RSSI == Noise Floor).
239 	 * Once se_avgrssi field has been initialized, ATH_RSSI_OUT always
240 	 * returns values that fit in an 8-bit variable
241 	 * (RSSI values are typically 0-90).
242 	 */
243 	return (rssi >= WLAN_RSSI_DUMMY_MARKER) ? 0 : (uint8_t) rssi;
244 }
245 
246 /**
247  * util_scan_entry_phymode() - function to read phymode of scan entry
248  * @scan_entry: scan entry
249  *
250  * API, function to read phymode of scan entry
251  *
252  * Return: phymode
253  */
254 static inline enum wlan_phymode
255 util_scan_entry_phymode(struct scan_cache_entry *scan_entry)
256 {
257 	return scan_entry->phy_mode;
258 }
259 
260 /**
261  * util_is_ssid_match() - to check if ssid match
262  * @ssid1: ssid 1
263  * @ssid2: ssid 2
264  *
265  * Return: true if ssid match
266  */
267 static inline bool
268 util_is_ssid_match(struct wlan_ssid *ssid1,
269 		struct wlan_ssid *ssid2)
270 {
271 
272 	if (ssid1->length == 0)
273 		return true;
274 
275 	if (ssid1->length != ssid2->length)
276 		return false;
277 
278 	if (!qdf_mem_cmp(ssid1->ssid,
279 	   ssid2->ssid, ssid1->length))
280 		return true;
281 
282 	return false;
283 }
284 
285 /**
286  * util_is_bssid_match() - to check if bssid match
287  * @bssid1: bssid 1
288  * @bssid2: bssid 2
289  *
290  * Return: true if bssid match
291  */
292 static inline bool util_is_bssid_match(struct qdf_mac_addr *bssid1,
293 	struct qdf_mac_addr *bssid2)
294 {
295 
296 	if (qdf_is_macaddr_zero(bssid1) ||
297 	   qdf_is_macaddr_broadcast(bssid1))
298 		return true;
299 
300 	if (qdf_is_macaddr_equal(bssid1, bssid2))
301 		return true;
302 
303 	return false;
304 }
305 
306 /**
307  * util_is_bss_type_match() - to check if bss type
308  * @bss_type: bss type
309  * @cap: capability
310  *
311  * Return: true if bss type match
312  */
313 static inline bool util_is_bss_type_match(enum wlan_bss_type bss_type,
314 	union wlan_capability cap)
315 {
316 	bool match = true;
317 
318 	switch (bss_type) {
319 	case WLAN_TYPE_ANY:
320 		break;
321 	case WLAN_TYPE_IBSS:
322 		if (!cap.wlan_caps.ibss)
323 			match = false;
324 		break;
325 	case WLAN_TYPE_BSS:
326 		if (!cap.wlan_caps.ess)
327 			match = false;
328 		break;
329 	default:
330 		match = false;
331 	}
332 
333 	return match;
334 }
335 
336 /**
337  * util_country_code_match() - to check if country match
338  * @country: country code pointer
339  * @country_ie: country IE in beacon
340  *
341  * Return: true if country match
342  */
343 static inline bool util_country_code_match(uint8_t *country,
344 					   struct wlan_country_ie *cc)
345 {
346 	if (!country || !country[0])
347 		return true;
348 
349 	if (!cc)
350 		return false;
351 
352 	if (cc->cc[0] == country[0] &&
353 	    cc->cc[1] == country[1])
354 		return true;
355 
356 	return false;
357 }
358 
359 /**
360  * util_mdie_match() - to check if mdie match
361  * @mobility_domain: mobility domain
362  * @mdie: mobility domain ie
363  *
364  * Return: true if country match
365  */
366 static inline bool util_mdie_match(uint16_t mobility_domain,
367 	struct rsn_mdie *mdie)
368 {
369 	uint16_t md;
370 
371 	if (!mobility_domain)
372 		return true;
373 
374 	if (!mdie)
375 		return false;
376 
377 	md =
378 	  (mdie->mobility_domain[1] << 8) |
379 	   mdie->mobility_domain[0];
380 
381 	if (md == mobility_domain)
382 		return true;
383 
384 	return false;
385 }
386 
387 /**
388  * util_scan_entry_ssid() - function to read ssid of scan entry
389  * @scan_entry: scan entry
390  *
391  * API, function to read ssid of scan entry
392  *
393  * Return: ssid
394  */
395 static inline struct wlan_ssid*
396 util_scan_entry_ssid(struct scan_cache_entry *scan_entry)
397 {
398 	return &(scan_entry->ssid);
399 }
400 
401 /**
402  * util_scan_entry_dtimperiod() - function to read dtim period of scan entry
403  * @scan_entry: scan entry
404  *
405  * API, function to read dtim period of scan entry
406  *
407  * Return: dtim period
408  */
409 static inline uint8_t
410 util_scan_entry_dtimperiod(struct scan_cache_entry *scan_entry)
411 {
412 	return scan_entry->dtim_period;
413 }
414 
415 /**
416  * util_scan_entry_tim() - function to read tim ie of scan entry
417  * @scan_entry: scan entry
418  *
419  * API, function to read tim ie of scan entry
420  *
421  * Return: timie or NULL if ie is not present
422  */
423 static inline uint8_t*
424 util_scan_entry_tim(struct scan_cache_entry *scan_entry)
425 {
426 	return scan_entry->ie_list.tim;
427 }
428 
429 /**
430  * util_scan_entry_beacon_frame() - function to read full beacon or
431  * probe resp frame
432  * @scan_entry: scan entry
433  *
434  * API, function to read full beacon or probe resp frame including frame header
435  *
436  * Return: beacon/probe resp frame
437  */
438 static inline struct element_info
439 util_scan_entry_beacon_frame(struct scan_cache_entry *scan_entry)
440 {
441 	/* util_scan_entry_beacon_data */
442 	return scan_entry->raw_frame;
443 }
444 
445 /**
446  * util_scan_entry_ie_data() - function to read tagged IEs
447  * @scan_entry: scan entry
448  *
449  * API, function to read beacon/probe response frames starting from tagged IEs
450  * (excluding frame header and fixed parameters)
451  *
452  * Return: tagged IES of beacon/probe resp frame
453  */
454 static inline uint8_t*
455 util_scan_entry_ie_data(struct scan_cache_entry *scan_entry)
456 {
457 	struct element_info bcn_frm;
458 	uint8_t *ie_data = NULL;
459 
460 	bcn_frm = util_scan_entry_beacon_frame(scan_entry);
461 	ie_data = (uint8_t *) (bcn_frm.ptr +
462 		 sizeof(struct wlan_frame_hdr) +
463 		 offsetof(struct wlan_bcn_frame, ie));
464 	return ie_data;
465 }
466 
467 /**
468  * util_scan_entry_ie_len() - function to read length of all tagged IEs
469  * @scan_entry: scan entry
470  *
471  * API, function to read length of all tagged IEs
472  *
473  * Return: length of all tagged IEs
474  */
475 static inline uint16_t
476 util_scan_entry_ie_len(struct scan_cache_entry *scan_entry)
477 {
478 	struct element_info bcn_frm;
479 	uint16_t ie_len = 0;
480 
481 	bcn_frm = util_scan_entry_beacon_frame(scan_entry);
482 	ie_len = (uint16_t) (bcn_frm.len -
483 		sizeof(struct wlan_frame_hdr) -
484 		offsetof(struct wlan_bcn_frame, ie));
485 	return ie_len;
486 }
487 
488 /**
489  * util_scan_entry_frame_len() - function to frame length
490  * @scan_entry: scan entry
491  *
492  * API, function to read frame length
493  *
494  * Return: frame length
495  */
496 static inline uint32_t
497 util_scan_entry_frame_len(struct scan_cache_entry *scan_entry)
498 {
499 	return scan_entry->raw_frame.len;
500 }
501 
502 /**
503  * util_scan_entry_frame_ptr() - function to get frame ptr
504  * @scan_entry: scan entry
505  *
506  * API, function to read frame ptr
507  *
508  * Return: frame ptr
509  */
510 static inline uint8_t*
511 util_scan_entry_frame_ptr(struct scan_cache_entry *scan_entry)
512 {
513 	return scan_entry->raw_frame.ptr;
514 }
515 
516 /**
517  * util_scan_entry_copy_ie_data() - function to get a copy of all tagged IEs
518  * @scan_entry: scan entry
519  *
520  * API, function to get a copy of all tagged IEs in passed memory
521  *
522  * Return: QDF_STATUS_SUCCESS if tagged IEs copied successfully
523  *         QDF_STATUS_E_NOMEM if passed memory/length can't hold all tagged IEs
524  */
525 static inline QDF_STATUS
526 util_scan_entry_copy_ie_data(struct scan_cache_entry *scan_entry,
527 	uint8_t *iebuf, uint16_t *ie_len)
528 {
529 	u_int8_t     *buff;
530 	u_int16_t    buff_len;
531 
532 	/* iebuf can be NULL, ie_len must be a valid pointer. */
533 	QDF_ASSERT(ie_len != NULL);
534 	if (!ie_len)
535 		return QDF_STATUS_E_NULL_VALUE;
536 
537 	buff = util_scan_entry_ie_data(scan_entry);
538 	buff_len = util_scan_entry_ie_len(scan_entry);
539 	/*
540 	 * If caller passed a buffer, check the length to make sure
541 	 * it's large enough.
542 	 * If no buffer is passed, just return the length of the IE blob.
543 	 */
544 	if (iebuf != NULL) {
545 		if (*ie_len >= buff_len) {
546 			qdf_mem_copy(iebuf, buff, buff_len);
547 			*ie_len = buff_len;
548 			return QDF_STATUS_SUCCESS;
549 		}
550 	}
551 
552 	*ie_len = buff_len;
553 	return QDF_STATUS_E_NOMEM;
554 }
555 
556 /**
557  * util_scan_free_cache_entry() - function to free scan
558  * cache entry
559  * @scan_entry: scan entry
560  *
561  * API, function to free scan cache entry
562  *
563  * Return: void
564  */
565 static inline void
566 util_scan_free_cache_entry(struct scan_cache_entry *scan_entry)
567 {
568 	if (!scan_entry)
569 		return;
570 	if (scan_entry->alt_wcn_ie.ptr)
571 		qdf_mem_free(scan_entry->alt_wcn_ie.ptr);
572 	if (scan_entry->raw_frame.ptr)
573 		qdf_mem_free(scan_entry->raw_frame.ptr);
574 	qdf_mem_free(scan_entry);
575 }
576 
577 #define conv_ptr(_address, _base1, _base2) \
578 	((_address != NULL) ? (((u_int8_t *) (_address) - \
579 	(u_int8_t *) (_base1)) + (u_int8_t *) (_base2)) : NULL)
580 
581 /**
582  * util_scan_copy_beacon_data() - copy beacon and update ie ptrs
583  * cache entry
584  * @new_entry: new scan entry
585  * @scan_entry: entry from where data is copied
586  *
587  * API, function to copy beacon and update ie ptrs
588  *
589  * Return: QDF_STATUS
590  */
591 static inline QDF_STATUS
592 util_scan_copy_beacon_data(struct scan_cache_entry *new_entry,
593 	struct scan_cache_entry *scan_entry)
594 {
595 	u_int8_t *new_ptr, *old_ptr;
596 	struct ie_list *ie_lst;
597 
598 	new_entry->raw_frame.ptr =
599 		qdf_mem_malloc_atomic(scan_entry->raw_frame.len);
600 	if (!new_entry->raw_frame.ptr)
601 		return QDF_STATUS_E_NOMEM;
602 
603 	qdf_mem_copy(new_entry->raw_frame.ptr,
604 		scan_entry->raw_frame.ptr,
605 		scan_entry->raw_frame.len);
606 	new_entry->raw_frame.len = scan_entry->raw_frame.len;
607 	new_ptr = new_entry->raw_frame.ptr;
608 	old_ptr = scan_entry->raw_frame.ptr;
609 
610 	new_entry->ie_list = scan_entry->ie_list;
611 
612 	ie_lst = &new_entry->ie_list;
613 
614 	/* New info_element needs also be added in ieee80211_parse_beacon */
615 	ie_lst->tim = conv_ptr(ie_lst->tim, old_ptr, new_ptr);
616 	ie_lst->country = conv_ptr(ie_lst->country, old_ptr, new_ptr);
617 	ie_lst->ssid = conv_ptr(ie_lst->ssid, old_ptr, new_ptr);
618 	ie_lst->rates = conv_ptr(ie_lst->rates, old_ptr, new_ptr);
619 	ie_lst->xrates = conv_ptr(ie_lst->xrates, old_ptr, new_ptr);
620 	ie_lst->ds_param = conv_ptr(ie_lst->ds_param, old_ptr, new_ptr);
621 	ie_lst->csa = conv_ptr(ie_lst->csa, old_ptr, new_ptr);
622 	ie_lst->xcsa = conv_ptr(ie_lst->xcsa, old_ptr, new_ptr);
623 	ie_lst->secchanoff = conv_ptr(ie_lst->secchanoff, old_ptr, new_ptr);
624 	ie_lst->wpa = conv_ptr(ie_lst->wpa, old_ptr, new_ptr);
625 	ie_lst->wcn = conv_ptr(ie_lst->wcn, old_ptr, new_ptr);
626 	ie_lst->rsn = conv_ptr(ie_lst->rsn, old_ptr, new_ptr);
627 	ie_lst->wps = conv_ptr(ie_lst->wps, old_ptr, new_ptr);
628 	ie_lst->wmeinfo = conv_ptr(ie_lst->wmeinfo, old_ptr, new_ptr);
629 	ie_lst->wmeparam = conv_ptr(ie_lst->wmeparam, old_ptr, new_ptr);
630 	ie_lst->quiet = conv_ptr(ie_lst->quiet, old_ptr, new_ptr);
631 	ie_lst->htcap = conv_ptr(ie_lst->htcap, old_ptr, new_ptr);
632 	ie_lst->htinfo = conv_ptr(ie_lst->htinfo, old_ptr, new_ptr);
633 	ie_lst->athcaps = conv_ptr(ie_lst->athcaps, old_ptr, new_ptr);
634 	ie_lst->athextcaps = conv_ptr(ie_lst->athextcaps, old_ptr, new_ptr);
635 	ie_lst->sfa = conv_ptr(ie_lst->sfa, old_ptr, new_ptr);
636 	ie_lst->vendor = conv_ptr(ie_lst->vendor, old_ptr, new_ptr);
637 	ie_lst->qbssload = conv_ptr(ie_lst->qbssload, old_ptr, new_ptr);
638 	ie_lst->wapi = conv_ptr(ie_lst->wapi, old_ptr, new_ptr);
639 	ie_lst->p2p = conv_ptr(ie_lst->p2p, old_ptr, new_ptr);
640 	ie_lst->alt_wcn = conv_ptr(ie_lst->alt_wcn, old_ptr, new_ptr);
641 	ie_lst->extcaps = conv_ptr(ie_lst->extcaps, old_ptr, new_ptr);
642 	ie_lst->ibssdfs = conv_ptr(ie_lst->ibssdfs, old_ptr, new_ptr);
643 	ie_lst->sonadv = conv_ptr(ie_lst->sonadv, old_ptr, new_ptr);
644 	ie_lst->vhtcap = conv_ptr(ie_lst->vhtcap, old_ptr, new_ptr);
645 	ie_lst->vhtop = conv_ptr(ie_lst->vhtop, old_ptr, new_ptr);
646 	ie_lst->opmode = conv_ptr(ie_lst->opmode, old_ptr, new_ptr);
647 	ie_lst->cswrp = conv_ptr(ie_lst->cswrp, old_ptr, new_ptr);
648 	ie_lst->widebw = conv_ptr(ie_lst->widebw, old_ptr, new_ptr);
649 	ie_lst->txpwrenvlp = conv_ptr(ie_lst->txpwrenvlp, old_ptr, new_ptr);
650 	ie_lst->bwnss_map = conv_ptr(ie_lst->bwnss_map, old_ptr, new_ptr);
651 	ie_lst->mdie = conv_ptr(ie_lst->mdie, old_ptr, new_ptr);
652 	ie_lst->hecap = conv_ptr(ie_lst->hecap, old_ptr, new_ptr);
653 	ie_lst->heop = conv_ptr(ie_lst->heop, old_ptr, new_ptr);
654 	ie_lst->fils_indication = conv_ptr(ie_lst->fils_indication,
655 					   old_ptr, new_ptr);
656 	ie_lst->esp = conv_ptr(ie_lst->esp, old_ptr, new_ptr);
657 	ie_lst->mbo_oce = conv_ptr(ie_lst->mbo_oce, old_ptr, new_ptr);
658 	ie_lst->extender = conv_ptr(ie_lst->extender, old_ptr, new_ptr);
659 
660 	return QDF_STATUS_SUCCESS;
661 }
662 /**
663  * util_scan_copy_cache_entry() - function to create a copy
664  * of scan cache entry
665  * @scan_entry: scan entry
666  *
667  * API, function to create a copy of scan cache entry
668  *
669  * Return: copy of scan_entry
670  */
671 static inline struct scan_cache_entry *
672 util_scan_copy_cache_entry(struct scan_cache_entry *scan_entry)
673 {
674 	struct scan_cache_entry *new_entry;
675 	QDF_STATUS status;
676 
677 	if (!scan_entry)
678 		return NULL;
679 
680 	new_entry =
681 	   qdf_mem_malloc_atomic(sizeof(*scan_entry));
682 	if (!new_entry)
683 		return NULL;
684 
685 	qdf_mem_copy(new_entry,
686 		scan_entry, sizeof(*scan_entry));
687 
688 	if (scan_entry->alt_wcn_ie.ptr) {
689 		new_entry->alt_wcn_ie.ptr =
690 		    qdf_mem_malloc_atomic(scan_entry->alt_wcn_ie.len);
691 		if (!new_entry->alt_wcn_ie.ptr) {
692 			qdf_mem_free(new_entry);
693 			return NULL;
694 		}
695 		qdf_mem_copy(new_entry->alt_wcn_ie.ptr,
696 		   scan_entry->alt_wcn_ie.ptr,
697 		   scan_entry->alt_wcn_ie.len);
698 		new_entry->alt_wcn_ie.len =
699 			scan_entry->alt_wcn_ie.len;
700 	}
701 
702 	status = util_scan_copy_beacon_data(new_entry, scan_entry);
703 	if (QDF_IS_STATUS_ERROR(status)) {
704 		util_scan_free_cache_entry(new_entry);
705 		return NULL;
706 	}
707 
708 	return new_entry;
709 }
710 
711 /**
712  * util_scan_entry_channel() - function to read channel info
713  * @scan_entry: scan entry
714  *
715  * API, function to read channel info
716  *
717  * Return: channel info
718  */
719 static inline struct channel_info*
720 util_scan_entry_channel(struct scan_cache_entry *scan_entry)
721 {
722 	return &(scan_entry->channel);
723 }
724 
725 /**
726  * util_scan_entry_channel_num() - function to read channel number
727  * @scan_entry: scan entry
728  *
729  * API, function to read channel number
730  *
731  * Return: channel number
732  */
733 static inline uint8_t
734 util_scan_entry_channel_num(struct scan_cache_entry *scan_entry)
735 {
736 	return scan_entry->channel.chan_idx;
737 }
738 
739 /**
740  * util_scan_entry_erpinfo() - function to read erp info
741  * @scan_entry: scan entry
742  *
743  * API, function to read erp info
744  *
745  * Return: erp info
746  */
747 static inline uint8_t
748 util_scan_entry_erpinfo(struct scan_cache_entry *scan_entry)
749 {
750 	return scan_entry->erp;
751 }
752 
753 /**
754  * util_scan_entry_rates() - function to read supported rates IE
755  * @scan_entry: scan entry
756  *
757  * API, function to read supported rates IE
758  *
759  * Return: basic ratesie or NULL if ie is not present
760  */
761 static inline uint8_t*
762 util_scan_entry_rates(struct scan_cache_entry *scan_entry)
763 {
764 	return scan_entry->ie_list.rates;
765 }
766 
767 /**
768  * util_scan_entry_xrates()- function to read extended supported rates IE
769  * @scan_entry: scan entry
770  *
771  * API, function to read extended supported rates IE
772  *
773  * Return: extended supported ratesie or NULL if ie is not present
774  */
775 static inline uint8_t*
776 util_scan_entry_xrates(struct scan_cache_entry *scan_entry)
777 {
778 	return scan_entry->ie_list.xrates;
779 }
780 
781 /**
782  * util_scan_entry_rsn()- function to read rsn IE
783  * @scan_entry: scan entry
784  *
785  * API, function to read rsn IE
786  *
787  * Return: rsnie or NULL if ie is not present
788  */
789 static inline uint8_t*
790 util_scan_entry_rsn(struct scan_cache_entry *scan_entry)
791 {
792 	return scan_entry->ie_list.rsn;
793 }
794 
795 /**
796  * util_scan_get_rsn_len()- function to read rsn IE length if present
797  * @scan_entry: scan entry
798  *
799  * API, function to read rsn length if present
800  *
801  * Return: rsnie length
802  */
803 static inline uint8_t
804 util_scan_get_rsn_len(struct scan_cache_entry *scan_entry)
805 {
806 	if (scan_entry && scan_entry->ie_list.rsn)
807 		return scan_entry->ie_list.rsn[1] + 2;
808 	else
809 		return 0;
810 }
811 
812 
813 /**
814  * util_scan_entry_wpa() - function to read wpa IE
815  * @scan_entry: scan entry
816  *
817  * API, function to read wpa IE
818  *
819  * Return: wpaie or NULL if ie is not present
820  */
821 static inline uint8_t*
822 util_scan_entry_wpa(struct scan_cache_entry *scan_entry)
823 {
824 	return scan_entry->ie_list.wpa;
825 }
826 
827 /**
828  * util_scan_get_wpa_len()- function to read wpa IE length if present
829  * @scan_entry: scan entry
830  *
831  * API, function to read wpa ie length if present
832  *
833  * Return: wpa ie length
834  */
835 static inline uint8_t
836 util_scan_get_wpa_len(struct scan_cache_entry *scan_entry)
837 {
838 	if (scan_entry && scan_entry->ie_list.wpa)
839 		return scan_entry->ie_list.wpa[1] + 2;
840 	else
841 		return 0;
842 }
843 
844 
845 /**
846  * util_scan_entry_wapi() - function to read wapi IE
847  * @scan_entry: scan entry
848  *
849  * API, function to read wapi IE
850  *
851  * Return: wapiie or NULL if ie is not present
852  */
853 static inline uint8_t*
854 util_scan_entry_wapi(struct scan_cache_entry *scan_entry)
855 {
856 	return scan_entry->ie_list.wapi;
857 }
858 
859 /**
860  * util_scan_entry_wps() - function to read wps IE
861  * @scan_entry: scan entry
862  *
863  * API, function to read wps IE
864  *
865  * Return: wpsie or NULL if ie is not present
866  */
867 static inline uint8_t*
868 util_scan_entry_wps(struct scan_cache_entry *scan_entry)
869 {
870 	return scan_entry->ie_list.wps;
871 }
872 
873 /**
874  * util_scan_entry_sfa() - function to read sfa IE
875  * @scan_entry: scan entry
876  *
877  * API, function to read sfa IE
878  *
879  * Return: sfaie or NULL if ie is not present
880  */
881 static inline uint8_t*
882 util_scan_entry_sfa(struct scan_cache_entry *scan_entry)
883 {
884 	return scan_entry->ie_list.sfa;
885 }
886 
887 /**
888  * util_scan_entry_ds_param() - function to read ds params
889  * @scan_entry: scan entry
890  *
891  * API, function to read ds params
892  *
893  * Return: ds params or NULL if ie is not present
894  */
895 static inline uint8_t*
896 util_scan_entry_ds_param(struct scan_cache_entry *scan_entry)
897 {
898 	if (scan_entry)
899 		return scan_entry->ie_list.ds_param;
900 	else
901 		return NULL;
902 }
903 
904 /**
905  * util_scan_entry_csa() - function to read csa IE
906  * @scan_entry: scan entry
907  *
908  * API, function to read csa IE
909  *
910  * Return: csaie or NULL if ie is not present
911  */
912 static inline uint8_t*
913 util_scan_entry_csa(struct scan_cache_entry *scan_entry)
914 {
915 	return scan_entry->ie_list.csa;
916 }
917 
918 /**
919  * util_scan_entry_xcsa() - function to read extended csa IE
920  * @scan_entry: scan entry
921  *
922  * API, function to read extended csa IE
923  *
924  * Return: extended csaie or NULL if ie is not present
925  */
926 static inline uint8_t*
927 util_scan_entry_xcsa(struct scan_cache_entry *scan_entry)
928 {
929 	return scan_entry->ie_list.xcsa;
930 }
931 
932 /**
933  * util_scan_entry_htinfo() - function to read htinfo IE
934  * @scan_entry: scan entry
935  *
936  * API, function to read htinfo IE
937  *
938  * Return: htinfoie or NULL if ie is not present
939  */
940 static inline uint8_t*
941 util_scan_entry_htinfo(struct scan_cache_entry *scan_entry)
942 {
943 	return scan_entry->ie_list.htinfo;
944 }
945 
946 
947 /**
948  * util_scan_entry_htcap() - function to read htcap IE
949  * @scan_entry: scan entry
950  *
951  * API, function to read htcap IE
952  *
953  * Return: htcapie or NULL if ie is not present
954  */
955 static inline uint8_t*
956 util_scan_entry_htcap(struct scan_cache_entry *scan_entry)
957 {
958 	return scan_entry->ie_list.htcap;
959 }
960 
961 /**
962  * util_scan_entry_vhtcap() - function to read vhtcap IE
963  * @scan_entry: scan entry
964  *
965  * API, function to read vhtcap IE
966  *
967  * Return: vhtcapie or NULL if ie is not present
968  */
969 static inline uint8_t*
970 util_scan_entry_vhtcap(struct scan_cache_entry *scan_entry)
971 {
972 	return scan_entry->ie_list.vhtcap;
973 }
974 
975 /**
976  * util_scan_entry_vhtop() - function to read vhtop IE
977  * @scan_entry: scan entry
978  *
979  * API, function to read vhtop IE
980  *
981  * Return: vhtopie or NULL if ie is not present
982  */
983 static inline uint8_t*
984 util_scan_entry_vhtop(struct scan_cache_entry *scan_entry)
985 {
986 	return scan_entry->ie_list.vhtop;
987 }
988 
989 /**
990  * util_scan_entry_quiet() - function to read quiet IE
991  * @scan_entry: scan entry
992  *
993  * API, function to read quiet IE
994  *
995  * Return: quietie or NULL if ie is not present
996  */
997 static inline uint8_t*
998 util_scan_entry_quiet(struct scan_cache_entry *scan_entry)
999 {
1000 	return scan_entry->ie_list.quiet;
1001 }
1002 
1003 /**
1004  * util_scan_entry_qbssload() - function to read qbss load IE
1005  * @scan_entry: scan entry
1006  *
1007  * API, function to read qbss load IE
1008  *
1009  * Return: qbss loadie or NULL if ie is not present
1010  */
1011 static inline uint8_t*
1012 util_scan_entry_qbssload(struct scan_cache_entry *scan_entry)
1013 {
1014 	return scan_entry->ie_list.qbssload;
1015 }
1016 
1017 /**
1018  * util_scan_entry_vendor() - function to read vendor IE
1019  * @scan_entry: scan entry
1020  *
1021  * API, function to read vendor IE
1022  *
1023  * Return: vendorie or NULL if ie is not present
1024  */
1025 static inline uint8_t*
1026 util_scan_entry_vendor(struct scan_cache_entry *scan_entry)
1027 {
1028 	return scan_entry->ie_list.vendor;
1029 }
1030 
1031 /**
1032  * util_scan_entry_country() - function to read country IE
1033  * @scan_entry: scan entry
1034  *
1035  * API, function to read country IE
1036  *
1037  * Return: countryie or NULL if ie is not present
1038  */
1039 static inline struct wlan_country_ie*
1040 util_scan_entry_country(struct scan_cache_entry *scan_entry)
1041 {
1042 	return (struct wlan_country_ie *)scan_entry->ie_list.country;
1043 }
1044 
1045 /**
1046  * util_scan_entry_copy_country() - function to copy country name
1047  * @scan_entry: scan entry
1048  * @cntry:      out buffer
1049  *
1050  * API, function to copy country name code string in given memory @centry
1051  *
1052  * Return: QDF_STATUS_SUCCESS if successfully copied country name
1053  *         QDF_STATUS_E_INVAL if passed buffer is null
1054  *         QDF_STATUS_E_NOMEM if scan entry dont have country IE
1055  */
1056 static inline QDF_STATUS
1057 util_scan_entry_copy_country(struct scan_cache_entry *scan_entry,
1058 	uint8_t *cntry)
1059 {
1060 	struct wlan_country_ie *country_ie;
1061 
1062 	if (!cntry)
1063 		return QDF_STATUS_E_INVAL;
1064 
1065 	country_ie = util_scan_entry_country(scan_entry);
1066 
1067 	if (!country_ie)
1068 		return QDF_STATUS_E_NOMEM;
1069 
1070 	qdf_mem_copy(cntry, country_ie->cc, 3);
1071 
1072 	return QDF_STATUS_SUCCESS;
1073 }
1074 
1075 /**
1076  * util_scan_entry_wmeinfo() - function to read wme info ie
1077  * @scan_entry: scan entry
1078  *
1079  * API, function to read wme info ie
1080  *
1081  * Return: wme infoie or NULL if ie is not present
1082  */
1083 static inline uint8_t*
1084 util_scan_entry_wmeinfo(struct scan_cache_entry *scan_entry)
1085 {
1086 	return scan_entry->ie_list.wmeinfo;
1087 }
1088 
1089 /**
1090  * util_scan_entry_wmeparam() - function to read wme param ie
1091  * @scan_entry: scan entry
1092  *
1093  * API, function to read wme param ie
1094  *
1095  * Return: wme paramie or NULL if ie is not present
1096  */
1097 static inline uint8_t*
1098 util_scan_entry_wmeparam(struct scan_cache_entry *scan_entry)
1099 {
1100 	return scan_entry->ie_list.wmeparam;
1101 }
1102 
1103 /**
1104  * util_scan_entry_age() - function to read age of scan entry
1105  * @scan_entry: scan entry
1106  *
1107  * API, function to read age of scan entry
1108  *
1109  * Return: age in ms
1110  */
1111 static inline uint32_t
1112 util_scan_entry_age(struct scan_cache_entry *scan_entry)
1113 {
1114 	unsigned long ts = scan_entry->scan_entry_time;
1115 
1116 	return qdf_mc_timer_get_system_time() - ts;
1117 }
1118 
1119 /**
1120  * util_scan_mlme_info() - function to read mlme info struct
1121  * @scan_entry: scan entry
1122  *
1123  * API, function to read mlme info struct
1124  *
1125  * Return: mlme info
1126  */
1127 static inline struct mlme_info*
1128 util_scan_mlme_info(struct scan_cache_entry *scan_entry)
1129 {
1130 	return &scan_entry->mlme_info;
1131 }
1132 
1133 /**
1134  * util_scan_entry_bss_type() - function to read bss type
1135  * @scan_entry: scan entry
1136  *
1137  * API, function to read bss type
1138  *
1139  * Return: bss type
1140  */
1141 static inline enum wlan_bss_type
1142 util_scan_entry_bss_type(struct scan_cache_entry *scan_entry)
1143 {
1144 	if (scan_entry->cap_info.value & WLAN_CAPINFO_ESS)
1145 		return WLAN_TYPE_BSS;
1146 	else if (scan_entry->cap_info.value & WLAN_CAPINFO_IBSS)
1147 		return WLAN_TYPE_IBSS;
1148 	else
1149 		return WLAN_TYPE_ANY;
1150 }
1151 
1152 /**
1153  * util_scan_entry_privacy() - function to check if privacy is enebled
1154  * @scan_entry: scan entry
1155  *
1156  * API, function to check if privacy is enebled
1157  *
1158  * Return: true if privacy is enabled, false other wise
1159  */
1160 static inline bool
1161 util_scan_entry_privacy(struct scan_cache_entry *scan_entry)
1162 {
1163 	return (scan_entry->cap_info.value &
1164 		WLAN_CAPINFO_PRIVACY) ? true : false;
1165 }
1166 
1167 /**
1168  * util_scan_entry_athcaps() - function to read ath caps vendor ie
1169  * @scan_entry: scan entry
1170  *
1171  * API, function to read ath caps vendor ie
1172  *
1173  * Return: ath caps vendorie or NULL if ie is not present
1174  */
1175 static inline uint8_t*
1176 util_scan_entry_athcaps(struct scan_cache_entry *scan_entry)
1177 {
1178 	return scan_entry->ie_list.athcaps;
1179 }
1180 
1181 /**
1182  * util_scan_entry_athextcaps() - function to read ath extcaps vendor ie
1183  * @scan_entry: scan entry
1184  *
1185  * API, function to read ath extcaps vendor ie
1186  *
1187  * Return: ath extcaps vendorie or NULL if ie is not present
1188  */
1189 static inline uint8_t*
1190 util_scan_entry_athextcaps(struct scan_cache_entry *scan_entry)
1191 {
1192 	return scan_entry->ie_list.athextcaps;
1193 }
1194 
1195 /**
1196  * util_scan_entry_bwnss_map() - function to read bwnss_map ie
1197  * @scan_entry: scan entry
1198  *
1199  * API, function to read bwnss_map ie
1200  *
1201  * Return: bwnss_map ie or NULL if ie is not present
1202  */
1203 static inline uint8_t*
1204 util_scan_entry_bwnss_map(struct scan_cache_entry *scan_entry)
1205 {
1206 	return scan_entry->ie_list.bwnss_map;
1207 }
1208 
1209 /**
1210  * util_scan_entry_sonie() - function to read son ie
1211  * @scan_entry: scan entry
1212  *
1213  * API, function to read son ie
1214  *
1215  * Return: son ie or NULL if ie is not present
1216  */
1217 static inline uint8_t*
1218 util_scan_entry_sonie(struct scan_cache_entry *scan_entry)
1219 {
1220 	return scan_entry->ie_list.sonadv;
1221 }
1222 
1223 /**
1224  * util_scan_entry_widebw() - function to read wide band chan switch sub elem ie
1225  * @scan_entry: scan entry
1226  *
1227  * API, function to read wide band chan switch sub elem ie
1228  *
1229  * Return: wide band chan switch sub elem or NULL if ie is not present
1230  */
1231 static inline uint8_t*
1232 util_scan_entry_widebw(struct scan_cache_entry *scan_entry)
1233 {
1234 	return scan_entry->ie_list.widebw;
1235 }
1236 
1237 /**
1238  * util_scan_entry_secchanoff() - function to read secondary channel offset ie
1239  * @scan_entry: scan entry
1240  *
1241  * API, function to read secondary channel offset ie
1242  *
1243  * Return: secondary channel offset element or NULL if ie is not present
1244  */
1245 static inline uint8_t*
1246 util_scan_entry_secchanoff(struct scan_cache_entry *scan_entry)
1247 {
1248 	return scan_entry->ie_list.secchanoff;
1249 }
1250 
1251 /**
1252  * util_scan_entry_cswrp() - function to read channel switch wrapper ie
1253  * @scan_entry: scan entry
1254  *
1255  * API, function to read channel switch wrapper ie
1256  *
1257  * Return: channel switch wrapper element or NULL if ie is not present
1258  */
1259 static inline uint8_t*
1260 util_scan_entry_cswrp(struct scan_cache_entry *scan_entry)
1261 {
1262 	return scan_entry->ie_list.cswrp;
1263 }
1264 
1265 /**
1266  * util_scan_entry_omn() - function to read operating mode notification ie
1267  * @scan_entry: scan entry
1268  *
1269  * API, function to read operating mode notification
1270  *
1271  * Return: operating mode notification element or NULL if ie is not present
1272  */
1273 static inline uint8_t*
1274 util_scan_entry_omn(struct scan_cache_entry *scan_entry)
1275 {
1276 	return scan_entry->ie_list.opmode;
1277 }
1278 
1279 /**
1280  * util_scan_entry_extcaps() - function to read extcap ie
1281  * @scan_entry: scan entry
1282  *
1283  * API, function to read extcap ie
1284  *
1285  * Return: extcap element or NULL if ie is not present
1286  */
1287 static inline uint8_t*
1288 util_scan_entry_extcaps(struct scan_cache_entry *scan_entry)
1289 {
1290 	return scan_entry->ie_list.extcaps;
1291 }
1292 
1293 /**
1294  * util_scan_entry_athcaps() - function to read ath caps vendor ie
1295  * @scan_entry: scan entry
1296  *
1297  * API, function to read ath caps vendor ie
1298  *
1299  * Return: ath caps vendorie or NULL if ie is not present
1300  */
1301 static inline struct mlme_info*
1302 util_scan_entry_mlme_info(struct scan_cache_entry *scan_entry)
1303 {
1304 	return &(scan_entry->mlme_info);
1305 }
1306 
1307 /**
1308  * util_scan_entry_hecap() - function to read he caps vendor ie
1309  * @scan_entry: scan entry
1310  *
1311  * API, function to read he caps vendor ie
1312  *
1313  * Return: he caps vendorie or NULL if ie is not present
1314  */
1315 static inline uint8_t*
1316 util_scan_entry_hecap(struct scan_cache_entry *scan_entry)
1317 {
1318 	return scan_entry->ie_list.hecap;
1319 }
1320 
1321 
1322 /**
1323  * util_scan_entry_heop() - function to read heop vendor ie
1324  * @scan_entry: scan entry
1325  *
1326  * API, function to read heop vendor ie
1327  *
1328  * Return, heop vendorie or NULL if ie is not present
1329  */
1330 static inline uint8_t*
1331 util_scan_entry_heop(struct scan_cache_entry *scan_entry)
1332 {
1333 	return scan_entry->ie_list.heop;
1334 }
1335 
1336 /**
1337  * util_scan_entry_muedca() - function to read MU-EDCA IE
1338  * @scan_entry: scan entry
1339  *
1340  * API, function to read MU-EDCA IE
1341  *
1342  * Return, MUEDCA IE or NULL if IE is not present
1343  */
1344 static inline uint8_t*
1345 util_scan_entry_muedca(struct scan_cache_entry *scan_entry)
1346 {
1347 	return scan_entry->ie_list.muedca;
1348 }
1349 
1350 /**
1351  * util_scan_entry_spatial_reuse_parameter() - function to read spatial reuse
1352  *                                             parameter ie
1353  * @scan_entry: scan entry
1354  *
1355  * API, function to read scan_entry reuse parameter ie
1356  *
1357  * Return, spatial reuse parameter ie or NULL if ie is not present
1358  */
1359 static inline uint8_t*
1360 util_scan_entry_spatial_reuse_parameter(struct scan_cache_entry *scan_entry)
1361 {
1362 	return scan_entry->ie_list.srp;
1363 }
1364 
1365 /**
1366  * util_scan_entry_fils_indication() - function to read FILS indication ie
1367  * @scan_entry: scan entry
1368  *
1369  * API, function to read FILS indication ie
1370  *
1371  * Return, FILS indication ie or NULL if ie is not present
1372  */
1373 static inline uint8_t*
1374 util_scan_entry_fils_indication(struct scan_cache_entry *scan_entry)
1375 {
1376 	return scan_entry->ie_list.fils_indication;
1377 }
1378 
1379 /**
1380  * util_get_last_scan_time() - function to get last scan time on this pdev
1381  * @vdev: vdev object
1382  *
1383  * API, function to read last scan time on this pdev
1384  *
1385  * Return: qdf_time_t
1386  */
1387 qdf_time_t
1388 util_get_last_scan_time(struct wlan_objmgr_vdev *vdev);
1389 
1390 /**
1391  * util_scan_entry_update_mlme_info() - function to update mlme info
1392  * @scan_entry: scan entry object
1393  *
1394  * API, function to update mlme info in scan DB
1395  *
1396  * Return: QDF_STATUS
1397  */
1398 QDF_STATUS
1399 util_scan_entry_update_mlme_info(struct wlan_objmgr_pdev *pdev,
1400 	struct scan_cache_entry *scan_entry);
1401 
1402 /**
1403  * util_scan_is_hidden_ssid() - function to check if ssid is hidden
1404  * @ssid: struct ie_ssid object
1405  *
1406  * API, function to check if ssid is hidden
1407  *
1408  * Return: true if ap is hidden, false otherwise
1409  */
1410 bool
1411 util_scan_is_hidden_ssid(struct ie_ssid *ssid);
1412 
1413 /**
1414  * util_scan_entry_is_hidden_ap() - function to check if ap is hidden
1415  * @scan_entry: scan entry
1416  *
1417  * API, function to check if ap is hidden
1418  *
1419  * Return: true if ap is hidden, false otherwise
1420  */
1421 static inline bool
1422 util_scan_entry_is_hidden_ap(struct scan_cache_entry *scan_entry)
1423 {
1424     return util_scan_is_hidden_ssid(
1425 			(struct ie_ssid *)scan_entry->ie_list.ssid);
1426 }
1427 
1428 /**
1429  * util_scan_entry_espinfo() - function to read ESP info
1430  * @scan_entry: scan entry
1431  *
1432  * API, function to read ESP info
1433  *
1434  * Return: erp info
1435  */
1436 static inline uint8_t *
1437 util_scan_entry_esp_info(struct scan_cache_entry *scan_entry)
1438 {
1439 	return scan_entry->ie_list.esp;
1440 }
1441 
1442 /**
1443  * util_scan_entry_mbo_oce() - function to read MBO/OCE ie
1444  * @scan_entry: scan entry
1445  *
1446  * API, function to read MBO/OCE ie
1447  *
1448  * Return: MBO/OCE ie
1449  */
1450 static inline uint8_t *
1451 util_scan_entry_mbo_oce(struct scan_cache_entry *scan_entry)
1452 {
1453 	return scan_entry->ie_list.mbo_oce;
1454 }
1455 
1456 /**
1457  * util_scan_scm_chan_to_band() - function to tell band for channel number
1458  * @chan: Channel number
1459  *
1460  * Return: Band information as per channel
1461  */
1462 enum wlan_band util_scan_scm_chan_to_band(uint32_t chan);
1463 
1464 /**
1465  * util_scan_scm_freq_to_band() - API to get band from frequency
1466  * @freq: Channel frequency
1467  *
1468  * Return: Band information as per frequency
1469  */
1470 enum wlan_band util_scan_scm_freq_to_band(uint16_t freq);
1471 
1472 /**
1473  * util_is_scan_completed() - function to get scan complete status
1474  * @event: scan event
1475  * @success: true if scan complete success, false otherwise
1476  *
1477  * API, function to get the scan result
1478  *
1479  * Return: true if scan complete, false otherwise
1480  */
1481 bool util_is_scan_completed(struct scan_event *event, bool *success);
1482 
1483 /**
1484  * util_scan_entry_extenderie() - function to read extender IE
1485  * @scan_entry: scan entry
1486  *
1487  * API, function to read extender IE
1488  *
1489  * Return: extenderie or NULL if ie is not present
1490  */
1491 static inline uint8_t*
1492 util_scan_entry_extenderie(struct scan_cache_entry *scan_entry)
1493 {
1494 	return scan_entry->ie_list.extender;
1495 }
1496 
1497 #endif
1498