xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/core/src/wlan_scan_11d.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2011-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 11d entry api
21  */
22 
23 #ifndef _WLAN_SCAN_11D_H_
24 #define _WLAN_SCAN_11D_H_
25 
26 #define SCAN_MAX_NUM_COUNTRY_CODE 100
27 #define MIN_11D_AP_COUNT 3
28 
29 /**
30  * struct scan_country_code_votes - votes to country code mapping structure
31  * @votes: votes
32  * @cc: country code
33  */
34 struct scan_country_code_votes {
35 	uint16_t votes;
36 	uint8_t cc[REG_ALPHA2_LEN + 1];
37 };
38 
39 /**
40  * struct scan_country_code_db - country code data base definition
41  * @elected_cc: elected country code
42  * @num_country_codes: number of country codes encountered
43  * @votes: votes to country code mapping array
44  */
45 struct scan_country_code_db {
46 	uint8_t elected_cc[REG_ALPHA2_LEN + 1];
47 	uint8_t num_country_codes;
48 	struct scan_country_code_votes votes[SCAN_MAX_NUM_COUNTRY_CODE];
49 };
50 
51 /**
52  * scm_11d_cc_db_init() - API to init 11d country code db
53  * @psoc: psoc object
54  *
55  * Initialize the country code database.
56  *
57  * Return: QDF_STATUS
58  */
59 QDF_STATUS scm_11d_cc_db_init(struct wlan_objmgr_psoc *psoc);
60 
61 /**
62  * scm_11d_cc_db_deinit() - API to deinit 11d country code db
63  * @psoc: psoc object
64  *
65  * free the country code database.
66  *
67  * Return: QDF_STATUS
68  */
69 QDF_STATUS scm_11d_cc_db_deinit(struct wlan_objmgr_psoc *psoc);
70 
71 /**
72  * scm_11d_handle_country_info() - API to handle 11d country info
73  * @psoc: psoc object
74  * @pdev: pdev object
75  * @scan_entry: the pointer to scan entry
76  *
77  * Update the country code database per the country code from country IE.
78  *
79  * Return: void
80  */
81 void scm_11d_handle_country_info(struct wlan_objmgr_psoc *psoc,
82 				 struct wlan_objmgr_pdev *pdev,
83 				 struct scan_cache_entry *scan_entry);
84 
85 /**
86  * scm_11d_decide_country_code() - API to decide the country code per 11d
87  * @vdev: vdev object
88  *
89  * Decide which country will be elected from the country database. If one
90  * cadidate country is found, then it set the country code.
91  *
92  * Return: void
93  */
94 void scm_11d_decide_country_code(struct wlan_objmgr_vdev *vdev);
95 #endif
96