xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/core/src/wlan_scan_11d.h (revision 60c5b8fe8bcadb52ff07e02b12e8b73bce30bb4a)
1 /*
2  * Copyright (c) 2011-2018, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  * DOC: contains scan 11d entry api
22  */
23 
24 #ifndef _WLAN_SCAN_11D_H_
25 #define _WLAN_SCAN_11D_H_
26 
27 #define SCAN_MAX_NUM_COUNTRY_CODE 100
28 #define MIN_11D_AP_COUNT 3
29 
30 /**
31  * struct scan_country_code_votes - votes to country code mapping structure
32  * @votes: votes
33  * @cc: country code
34  */
35 struct scan_country_code_votes {
36 	uint16_t votes;
37 	uint8_t cc[REG_ALPHA2_LEN + 1];
38 };
39 
40 /**
41  * struct scan_country_code_db - country code data base definition
42  * @elected_cc: elected country code
43  * @num_country_codes: number of country codes encountered
44  * @votes: votes to country code mapping array
45  */
46 struct scan_country_code_db {
47 	uint8_t elected_cc[REG_ALPHA2_LEN + 1];
48 	uint8_t num_country_codes;
49 	struct scan_country_code_votes votes[SCAN_MAX_NUM_COUNTRY_CODE];
50 };
51 
52 /**
53  * scm_11d_cc_db_init() - API to init 11d country code db
54  * @psoc: psoc object
55  *
56  * Initialize the country code database.
57  *
58  * Return: QDF_STATUS
59  */
60 QDF_STATUS scm_11d_cc_db_init(struct wlan_objmgr_psoc *psoc);
61 
62 /**
63  * scm_11d_cc_db_deinit() - API to deinit 11d country code db
64  * @psoc: psoc object
65  *
66  * free the country code database.
67  *
68  * Return: QDF_STATUS
69  */
70 QDF_STATUS scm_11d_cc_db_deinit(struct wlan_objmgr_psoc *psoc);
71 
72 /**
73  * scm_11d_decide_country_code() - API to decide the country code per 11d
74  * @vdev: vdev object
75  *
76  * Decide which country will be elected from the country database. If one
77  * candidate country is found, then it set the country code.
78  *
79  * Return: void
80  */
81 void scm_11d_decide_country_code(struct wlan_objmgr_vdev *vdev);
82 #endif
83