xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/core/src/wlan_scan_cache_db_i.h (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2017, 2019-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * DOC: contains scan internal api
21  */
22 
23 #ifndef _WLAN_SCAN_CACHE_DB_I_H_
24 #define _WLAN_SCAN_CACHE_DB_I_H_
25 
26 /**
27  * scm_filter_match() - private API to check if entry is match to filter
28  * psoc: psoc ptr;
29  * @db_entry: db entry
30  * @filter: filter
31  * @security: negotiated security if match is found
32  *
33  * Return: true if entry match filter
34  */
35 bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
36 	struct scan_cache_entry *db_entry,
37 	struct scan_filter *filter,
38 	struct security_info *security);
39 
40 /**
41  * wlan_pdevid_get_scan_db() - private API to get scan db from pdev id
42  * @psoc: psoc object
43  * @pdev_id: Pdev_id
44  * Return: scan db for the pdev id
45  */
46 static inline struct scan_dbs *
47 wlan_pdevid_get_scan_db(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id)
48 {
49 	struct wlan_scan_obj *scan_obj = NULL;
50 
51 	if (pdev_id > WLAN_UMAC_MAX_PDEVS) {
52 		scm_err("invalid pdev_id %d", pdev_id);
53 		return NULL;
54 	}
55 	scan_obj = wlan_psoc_get_scan_obj(psoc);
56 
57 	if (!scan_obj)
58 		return NULL;
59 
60 	return &(scan_obj->scan_db[pdev_id]);
61 }
62 
63 /**
64  * wlan_pdev_get_scan_db() - private API to get scan db from pdev
65  * @psoc: psoc object
66  * @pdev: Pdev
67  *
68  * Return: scan db for the pdev
69  */
70 static inline struct scan_dbs *
71 wlan_pdev_get_scan_db(struct wlan_objmgr_psoc *psoc,
72 	struct wlan_objmgr_pdev *pdev)
73 {
74 	uint8_t pdev_id;
75 
76 	if (!pdev) {
77 		scm_err("pdev is NULL");
78 		return NULL;
79 	}
80 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
81 
82 	return wlan_pdevid_get_scan_db(psoc, pdev_id);
83 }
84 
85 #endif
86