xref: /wlan-driver/qca-wifi-host-cmn/os_if/linux/mlme/src/osif_cm_rsp.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2012-2015,2020-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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: osif_cm_rsp.h
20  *
21  * This header file maintains declarations of connect, disconnect, roam
22  * response apis.
23  */
24 
25 #ifndef __OSIF_CM_RSP_H
26 #define __OSIF_CM_RSP_H
27 
28 #include "wlan_objmgr_vdev_obj.h"
29 #include "wlan_cm_public_struct.h"
30 
31 /**
32  * osif_disconnect_handler() - Indicate disconnect to userspace
33  * @vdev: vdev pointer
34  * @rsp: Disconnect response from connection manager
35  *
36  * This function indicates disconnect to the kernel which thus indicates
37  * to the userspace.
38  *
39  * Context: Any context
40  * Return: QDF_STATUS_SUCCESS on successful indication to kernel,
41  * else QDF_STATUS with failure reason
42  */
43 QDF_STATUS osif_disconnect_handler(struct wlan_objmgr_vdev *vdev,
44 				   struct wlan_cm_discon_rsp *rsp);
45 
46 /**
47  * osif_cm_get_assoc_req_ie_data() - Get the assoc req IE offset and length
48  * if valid assoc req is present
49  * @assoc_req: assoc req info
50  * @ie_data_len: IE data length to be calculated
51  * @ie_data_ptr: IE data pointer to be calculated
52  *
53  * Return: void
54  */
55 void osif_cm_get_assoc_req_ie_data(struct element_info *assoc_req,
56 				   size_t *ie_data_len,
57 				   const uint8_t **ie_data_ptr);
58 
59 /**
60  * osif_cm_get_assoc_rsp_ie_data() - Get the assoc resp IE offset and length
61  * if valid assoc req is present
62  * @assoc_rsp: assoc response info
63  * @ie_data_len: IE data length to be calculated
64  * @ie_data_ptr: IE data pointer to be calculated
65  *
66  * Return: void
67  */
68 void osif_cm_get_assoc_rsp_ie_data(struct element_info *assoc_rsp,
69 				   size_t *ie_data_len,
70 				   const uint8_t **ie_data_ptr);
71 
72 /**
73  * osif_connect_handler() - API to send connect response to kernel
74  * @vdev: vdev pointer
75  * @rsp: Connection manager connect response
76  *
77  * The API is used to send connection response to kernel
78  *
79  * Context: Any context.
80  * Return: QDF_STATUS
81  */
82 QDF_STATUS osif_connect_handler(struct wlan_objmgr_vdev *vdev,
83 				struct wlan_cm_connect_resp *rsp);
84 
85 #ifdef CONN_MGR_ADV_FEATURE
86 /**
87  * osif_indicate_reassoc_results() - API to send reassoc response to kernel
88  * @vdev: vdev pointer
89  * @osif_priv: OS private structure of vdev
90  * @rsp: Connection manager response
91  *
92  * The API is used to send reassoc response to kernel
93  *
94  * Context: Any context.
95  * Return: QDF_STATUS
96  */
97 void osif_indicate_reassoc_results(struct wlan_objmgr_vdev *vdev,
98 				   struct vdev_osif_priv *osif_priv,
99 				   struct wlan_cm_connect_resp *rsp);
100 
101 /**
102  * osif_pmksa_candidate_notify() - Roam pmksa candidate notify callback
103  * @vdev: vdev pointer
104  * @bssid: bssid
105  * @index: index
106  * @preauth: preauth flag
107  *
108  * Return: QDF_STATUS
109  */
110 QDF_STATUS
111 osif_pmksa_candidate_notify(struct wlan_objmgr_vdev *vdev,
112 			    struct qdf_mac_addr *bssid,
113 			    int index, bool preauth);
114 #else
115 static inline void
osif_indicate_reassoc_results(struct wlan_objmgr_vdev * vdev,struct vdev_osif_priv * osif_priv,struct wlan_cm_connect_resp * rsp)116 osif_indicate_reassoc_results(struct wlan_objmgr_vdev *vdev,
117 			      struct vdev_osif_priv *osif_priv,
118 			      struct wlan_cm_connect_resp *rsp)
119 {}
120 #endif
121 
122 /**
123  * osif_failed_candidate_handler() - API to indicate individual candidate
124  * connect failure resp
125  * @vdev: vdev pointer
126  * @rsp: Connection manager connect response for the candidate
127  *
128  * The API is is used indicate individual candidate connect failure resp for
129  * for tried all but last tried candidate. The last candidate will be sent in
130  * osif_connect_handler.
131  *
132  * Context: Any context.
133  * Return: QDF_STATUS
134  */
135 QDF_STATUS osif_failed_candidate_handler(struct wlan_objmgr_vdev *vdev,
136 					 struct wlan_cm_connect_resp *rsp);
137 
138 /**
139  * osif_cm_indicate_disconnect - notify osif that connection was dropped
140  * @vdev: pointer to vdev
141  * @dev: network device
142  * @reason: reason code for the disconnection, set it to 0 if unknown
143  * @locally_generated: disconnection was requested locally
144  * @ie: information elements of the deauth/disassoc frame (may be %NULL)
145  * @ie_len: length of IEs
146  * @link_id: MLO link id needed for dynamic link removal
147  * @gfp: allocation flags
148  *
149  * After it calls this function, the driver should enter an idle state
150  * and not try to connect to any AP any more.
151  */
152 void
153 osif_cm_indicate_disconnect(struct wlan_objmgr_vdev *vdev,
154 			    struct net_device *dev,
155 			    enum ieee80211_reasoncode reason,
156 			    bool locally_generated, const u8 *ie,
157 			    size_t ie_len, int link_id,
158 			    gfp_t gfp);
159 
160 #ifdef WLAN_FEATURE_11BE_MLO
161 /**
162  * osif_get_partner_info_from_mlie() - API to get partner information
163  * from basic variant mlo ie
164  * @connect_rsp: Connection manager connect response for the candidate
165  * @partner_info: mlo partner info pointer
166  *
167  * The API is is used get partner information from basic variant ml ie.
168  *
169  * Context: Any context.
170  * Return: QDF_STATUS
171  */
172 QDF_STATUS
173 osif_get_partner_info_from_mlie(struct wlan_cm_connect_resp *connect_rsp,
174 				struct mlo_partner_info *partner_info);
175 
176 /**
177  * osif_get_link_id_from_assoc_ml_ie() - API to get link id from assoc rsp
178  * ml ie.
179  * @rsp_link_info: pointer to mlo link info
180  * @assoc_partner_info: mlo partner info pointer
181  * @link_id: Link id information
182  *
183  * The API is used to get link id from assoc response basic variant mlo ie
184  *
185  * Context: Any context.
186  * Return: QDF_STATUS
187  */
188 QDF_STATUS
189 osif_get_link_id_from_assoc_ml_ie(struct mlo_link_info *rsp_link_info,
190 				  struct mlo_partner_info *assoc_partner_info,
191 				  uint8_t *link_id);
192 
193 /**
194  * osif_get_chan_bss_from_kernel() - API to get chan bss from kernel
195  * @vdev: vdev pointer
196  * @rsp_link_info: pointer to mlo link info
197  * @rsp: Connection manager connect response for the candidate
198  *
199  * The API is used to get chan bss from kernel.
200  *
201  * Context: Any context.
202  * Return: QDF_STATUS
203  */
204 struct cfg80211_bss *
205 osif_get_chan_bss_from_kernel(struct wlan_objmgr_vdev *vdev,
206 			      struct mlo_link_info *rsp_link_info,
207 			      struct wlan_cm_connect_resp *rsp);
208 #endif
209 #endif /* __OSIF_CM_RSP_H */
210