1 /*
2  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /*
19  * DOC: contains interface manager public api
20  */
21 
22 #ifndef _WLAN_IF_MGR_ROAM_H_
23 #define _WLAN_IF_MGR_ROAM_H_
24 
25 #include "wlan_objmgr_psoc_obj.h"
26 #include "wlan_objmgr_pdev_obj.h"
27 #include "wlan_objmgr_vdev_obj.h"
28 #include "wlan_policy_mgr_api.h"
29 #include "wlan_if_mgr_public_struct.h"
30 #include "wlan_if_mgr_roam.h"
31 
32 /**
33  * struct change_roam_state_arg - Contains roam state arguments
34  * @requestor: Driver disabled roaming requestor
35  * @curr_vdev_id: virtual device ID
36  *
37  * This structure is used to pass the roam state change information to the
38  * callback
39  */
40 struct change_roam_state_arg {
41 	enum wlan_cm_rso_control_requestor requestor;
42 	uint8_t curr_vdev_id;
43 };
44 
45 /**
46  * struct bssid_search_arg - Contains candidate validation arguments
47  * @peer_addr: MAC address of the BSS
48  * @vdev_id: virtual device ID
49  *
50  * This structure is used to pass the candidate validation information to the
51  * callback
52  */
53 struct bssid_search_arg {
54 	struct qdf_mac_addr peer_addr;
55 	uint8_t vdev_id;
56 };
57 
58 /**
59  * enum allow_mcc_go_diff_bi_definition - Defines the config values for allowing
60  * different beacon intervals between P2P-G0 and STA
61  * @ALLOW_MCC_GO_DIFF_BI_WFA_CERT: GO Beacon interval is not changed.
62  *	MCC GO doesn't work well in optimized way. In worst scenario, it may
63  *	invite STA disconnection.
64  * @ALLOW_MCC_GO_DIFF_BI_WORKAROUND: Workaround 1 disassoc all the clients and
65  *	update beacon Interval.
66  * @ALLOW_MCC_GO_DIFF_BI_TEAR_DOWN: Tear down the P2P link in
67  *	auto/Non-autonomous -GO case.
68  * @ALLOW_MCC_GO_DIFF_BI_NO_DISCONNECT: Don't disconnect the P2P client in
69  *	autonomous/Non-autonomous -GO case update the BI dynamically
70  */
71 enum allow_mcc_go_diff_bi_definition {
72 	ALLOW_MCC_GO_DIFF_BI_WFA_CERT = 1,
73 	ALLOW_MCC_GO_DIFF_BI_WORKAROUND,
74 	ALLOW_MCC_GO_DIFF_BI_TEAR_DOWN,
75 	ALLOW_MCC_GO_DIFF_BI_NO_DISCONNECT,
76 };
77 
78 /**
79  * struct beacon_interval_arg - Contains beacon interval validation arguments
80  * @curr_vdev_id: current iterator vdev ID
81  * @curr_bss_opmode: current iterator BSS's opmode
82  * @ch_freq: current operating channel frequency
83  * @bss_beacon_interval: beacon interval that can be updated by callee
84  * @status: status to be filled by callee
85  * @is_done: boolean to stop iterating
86  * @update_beacon_interval: boolean to mark beacon interval as updated by callee
87  *
88  * This structure is used to pass the candidate validation information to the
89  * callback
90  */
91 struct beacon_interval_arg {
92 	uint8_t curr_vdev_id;
93 	enum QDF_OPMODE curr_bss_opmode;
94 	qdf_freq_t ch_freq;
95 	uint16_t bss_beacon_interval;
96 	QDF_STATUS status;
97 	bool is_done;
98 	bool update_beacon_interval;
99 };
100 
101 /**
102  * if_mgr_enable_roaming() - interface manager enable roaming
103  * @pdev: pdev object
104  * @vdev: vdev object
105  * @requestor: RSO enable requestor
106  *
107  * Interface manager api to enable roaming for all other active vdev id's
108  *
109  * Context: It should run in thread context
110  *
111  * Return: QDF_STATUS
112  */
113 QDF_STATUS if_mgr_enable_roaming(struct wlan_objmgr_pdev *pdev,
114 				 struct wlan_objmgr_vdev *vdev,
115 				 enum wlan_cm_rso_control_requestor requestor);
116 
117 /**
118  * if_mgr_disable_roaming() - interface manager disable roaming
119  * @pdev: pdev object
120  * @vdev: vdev object
121  * @requestor: RSO disable requestor
122  *
123  * Interface manager api to disable roaming for all other active vdev id's
124  *
125  * Context: It should run in thread context
126  *
127  * Return: QDF_STATUS
128  */
129 QDF_STATUS if_mgr_disable_roaming(struct wlan_objmgr_pdev *pdev,
130 				  struct wlan_objmgr_vdev *vdev,
131 				  enum wlan_cm_rso_control_requestor requestor);
132 
133 /**
134  * if_mgr_enable_roaming_on_connected_sta() - interface manager disable roaming
135  * on connected STA
136  * @pdev: pdev object
137  * @vdev: vdev object
138  *
139  * Loops through connected vdevs and disables roaming if it is STA
140  *
141  * Context: It should run in thread context
142  *
143  * Return: QDF_STATUS
144  */
145 QDF_STATUS
146 if_mgr_enable_roaming_on_connected_sta(struct wlan_objmgr_pdev *pdev,
147 				       struct wlan_objmgr_vdev *vdev);
148 
149 /**
150  * if_mgr_enable_roaming_after_p2p_disconnect() - interface manager enable
151  * roaming after p2p disconnect
152  * @pdev: pdev object
153  * @vdev: vdev object
154  * @requestor: RSO enable requestor
155  *
156  * Disables roaming on p2p vdevs if the state is disconnected
157  *
158  * Context: It should run in thread context
159  *
160  * Return: QDF_STATUS
161  */
162 QDF_STATUS if_mgr_enable_roaming_after_p2p_disconnect(
163 				struct wlan_objmgr_pdev *pdev,
164 				struct wlan_objmgr_vdev *vdev,
165 				enum wlan_cm_rso_control_requestor requestor);
166 
167 /**
168  * if_mgr_is_beacon_interval_valid() - checks if the concurrent session is
169  * valid
170  * @pdev: pdev object
171  * @vdev_id: vdev ID
172  * @candidate: concurrent candidate info
173  *
174  * This function validates the beacon interval with all other active vdevs.
175  *
176  * Context: It should run in thread context
177  *
178  * Return: true if session is valid, false if not
179  */
180 bool if_mgr_is_beacon_interval_valid(struct wlan_objmgr_pdev *pdev,
181 				     uint8_t vdev_id,
182 				     struct validate_bss_data *candidate);
183 
184 /**
185  * if_mgr_validate_candidate() - validate candidate event handler
186  * @vdev: vdev object
187  * @event_data: Interface mgr event data
188  *
189  * This function will validate the candidate to see if it is a suitable option
190  * for roaming to.
191  *
192  * Context: It should run in thread context
193  *
194  * Return: QDF_STATUS
195  */
196 QDF_STATUS if_mgr_validate_candidate(struct wlan_objmgr_vdev *vdev,
197 				     struct if_mgr_event_data *event_data);
198 
199 #endif
200