xref: /wlan-driver/qca-wifi-host-cmn/umac/wifi_pos/inc/wifi_pos_pasn_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wifi_pos_pasn_api.h
19  * This file declares public APIs of wifi positioning component
20  */
21 #ifndef _WIFI_POS_PASN_API_H_
22 #define _WIFI_POS_PASN_API_H_
23 
24 /* Include files */
25 #include "wlan_objmgr_cmn.h"
26 #include "wifi_pos_utils_pub.h"
27 #include "wifi_pos_public_struct.h"
28 
29 #if defined(WIFI_POS_CONVERGED) && defined(WLAN_FEATURE_RTT_11AZ_SUPPORT)
30 /**
31  * wifi_pos_set_peer_ltf_keyseed_required() - Set LTF keyseed required
32  *                                            for the peer
33  * @peer:  Peer object
34  * @value: Value to set
35  *
36  * Return: QDF_STATUS
37  */
38 QDF_STATUS
39 wifi_pos_set_peer_ltf_keyseed_required(struct wlan_objmgr_peer *peer,
40 				       bool value);
41 /**
42  * wifi_pos_is_ltf_keyseed_required_for_peer() - Is LTF keyseed required for
43  *                                               the given peer
44  * @peer: Peer object
45  *
46  * Return: true or false
47  */
48 bool wifi_pos_is_ltf_keyseed_required_for_peer(struct wlan_objmgr_peer *peer);
49 
50 /**
51  * wifi_pos_handle_ranging_peer_create() - Handle ranging peer create
52  * @psoc: Pointer to PSOC
53  * @req: PASN request
54  * @vdev_id: vdev id
55  * @total_entries: Total entries
56  *
57  * Return: QDF_STATUS
58  */
59 QDF_STATUS wifi_pos_handle_ranging_peer_create(struct wlan_objmgr_psoc *psoc,
60 					       struct wlan_pasn_request *req,
61 					       uint8_t vdev_id,
62 					       uint8_t total_entries);
63 
64 /**
65  * wifi_pos_set_11az_failed_peers() - Update the 11az failed peers to the
66  *                                    context
67  * @vdev: Objmgr vdev pointer
68  * @mac_addr: mac address
69  */
70 void wifi_pos_set_11az_failed_peers(struct wlan_objmgr_vdev *vdev,
71 				    struct qdf_mac_addr *mac_addr);
72 
73 /**
74  * wifi_pos_add_peer_to_list() - Add the peer mac to the secure/unsecure
75  *                               peer list in the 11az context
76  * @vdev: Pointer to vdev object
77  * @req: PASN peer create request pointer
78  * @is_peer_create_required: True if we need to send peer create command to
79  *                           firmware
80  */
81 void wifi_pos_add_peer_to_list(struct wlan_objmgr_vdev *vdev,
82 			       struct wlan_pasn_request *req,
83 			       bool is_peer_create_required);
84 
85 /**
86  * wifi_pos_handle_ranging_peer_create_rsp() - Ranging peer create response
87  *                                             handler
88  * @psoc: Pointer to PSOC object
89  * @vdev_id: vdev id
90  * @peer_mac: Peer mac address
91  * @status: Status
92  *
93  * Return: QDF_STATUS
94  */
95 QDF_STATUS
96 wifi_pos_handle_ranging_peer_create_rsp(struct wlan_objmgr_psoc *psoc,
97 					uint8_t vdev_id,
98 					struct qdf_mac_addr *peer_mac,
99 					uint8_t status);
100 
101 /**
102  * wifi_pos_handle_ranging_peer_delete() - Handle ranging PASN peer delete
103  * @psoc: Pointer to PSOC object
104  * @req: PASN request
105  * @vdev_id: vdev id
106  * @total_entries: Total number of peers
107  *
108  * Return: QDF_STATUS
109  */
110 QDF_STATUS
111 wifi_pos_handle_ranging_peer_delete(struct wlan_objmgr_psoc *psoc,
112 				    struct wlan_pasn_request *req,
113 				    uint8_t vdev_id,
114 				    uint8_t total_entries);
115 
116 /**
117  * wifi_pos_send_pasn_auth_status() - Send PASN auth status to firmware
118  * @psoc: Pointer to PSOC object
119  * @data: pointer to auth status data
120  *
121  * Return: QDF_STATUS
122  */
123 QDF_STATUS
124 wifi_pos_send_pasn_auth_status(struct wlan_objmgr_psoc *psoc,
125 			       struct wlan_pasn_auth_status *data);
126 
127 /**
128  * wifi_pos_send_pasn_peer_deauth() - Send PASN peer deauth
129  * @psoc: Pointer to PSOC object
130  * @peer_mac: Peer mac address
131  *
132  * Return: QDF_STATUS
133  */
134 QDF_STATUS
135 wifi_pos_send_pasn_peer_deauth(struct wlan_objmgr_psoc *psoc,
136 			       struct qdf_mac_addr *peer_mac);
137 
138 /**
139  * wifi_pos_get_pasn_peer_count() - Wifi POS get total pasn peer count
140  * @vdev: Pointer to vdev object
141  *
142  * Return: Total number of pasn peers
143  */
144 uint8_t
145 wifi_pos_get_pasn_peer_count(struct wlan_objmgr_vdev *vdev);
146 
147 /**
148  * wifi_pos_update_pasn_peer_count() - Increment pasn peer count
149  * @vdev: Pointer to vdev object
150  * @is_increment: flag to indicate if peer count needs to be incremented
151  *
152  * Return: None
153  */
154 void wifi_pos_update_pasn_peer_count(struct wlan_objmgr_vdev *vdev,
155 				     bool is_increment);
156 
157 /**
158  * wifi_pos_cleanup_pasn_peers() - Delete all PASN peer objects for
159  *                                 given vdev
160  * @psoc: Pointer to psoc object
161  * @vdev: Pointer to vdev object
162  *
163  * Return: QDF_STATUS
164  */
165 QDF_STATUS
166 wifi_pos_cleanup_pasn_peers(struct wlan_objmgr_psoc *psoc,
167 			    struct wlan_objmgr_vdev *vdev);
168 
169 /**
170  * wifi_pos_vdev_delete_all_ranging_peers() - Delete all ranging peers
171  *                                            associated with given vdev
172  * @vdev: Vdev object pointer
173  *
174  * Return: QDF_STATUS
175  */
176 QDF_STATUS
177 wifi_pos_vdev_delete_all_ranging_peers(struct wlan_objmgr_vdev *vdev);
178 
179 /**
180  * wifi_pos_vdev_delete_all_ranging_peers_rsp() - Delete all vdev peers response
181  *                                                handler
182  * @psoc: Psoc pointer
183  * @vdev_id: vdev id
184  *
185  * Return: QDF_STATUS
186  */
187 QDF_STATUS
188 wifi_pos_vdev_delete_all_ranging_peers_rsp(struct wlan_objmgr_psoc *psoc,
189 					   uint8_t vdev_id);
190 
191 /**
192  * wifi_pos_is_delete_all_peer_in_progress() - Check if delete all pasn peers
193  *                                             command is already in progress
194  *                                             for a given vdev
195  * @vdev: Vdev object pointer
196  *
197  * Return: True if delete all pasn peer is in progress
198  */
199 bool wifi_pos_is_delete_all_peer_in_progress(struct wlan_objmgr_vdev *vdev);
200 
201 /**
202  * wifi_pos_set_delete_all_peer_in_progress() - API to set/unset delete all
203  *                                              ranging peers is in progress
204  * @vdev: Pointer to vdev object
205  * @flag: value to indicate set or unset the flag
206  *
207  * Return: None
208  */
209 void wifi_pos_set_delete_all_peer_in_progress(struct wlan_objmgr_vdev *vdev,
210 					      bool flag);
211 #else
212 static inline
wifi_pos_handle_ranging_peer_create(struct wlan_objmgr_psoc * psoc,struct wlan_pasn_request * req,uint8_t vdev_id,uint8_t total_entries)213 QDF_STATUS wifi_pos_handle_ranging_peer_create(struct wlan_objmgr_psoc *psoc,
214 					       struct wlan_pasn_request *req,
215 					       uint8_t vdev_id,
216 					       uint8_t total_entries)
217 {
218 	return QDF_STATUS_SUCCESS;
219 }
220 
221 static inline
wifi_pos_set_11az_failed_peers(struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * mac_addr)222 void wifi_pos_set_11az_failed_peers(struct wlan_objmgr_vdev *vdev,
223 				    struct qdf_mac_addr *mac_addr)
224 {}
225 
226 static inline
wifi_pos_add_peer_to_list(struct wlan_objmgr_vdev * vdev,struct wlan_pasn_request * req,bool is_peer_create_required)227 void wifi_pos_add_peer_to_list(struct wlan_objmgr_vdev *vdev,
228 			       struct wlan_pasn_request *req,
229 			       bool is_peer_create_required)
230 {}
231 
232 static inline QDF_STATUS
wifi_pos_handle_ranging_peer_create_rsp(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,struct qdf_mac_addr * peer_mac,uint8_t status)233 wifi_pos_handle_ranging_peer_create_rsp(struct wlan_objmgr_psoc *psoc,
234 					uint8_t vdev_id,
235 					struct qdf_mac_addr *peer_mac,
236 					uint8_t status)
237 {
238 	return QDF_STATUS_SUCCESS;
239 }
240 
241 static inline QDF_STATUS
wifi_pos_handle_ranging_peer_delete(struct wlan_objmgr_psoc * psoc,struct wlan_pasn_request * req,uint8_t vdev_id,uint8_t total_entries)242 wifi_pos_handle_ranging_peer_delete(struct wlan_objmgr_psoc *psoc,
243 				    struct wlan_pasn_request *req,
244 				    uint8_t vdev_id,
245 				    uint8_t total_entries)
246 {
247 	return QDF_STATUS_SUCCESS;
248 }
249 
250 static inline QDF_STATUS
wifi_pos_send_pasn_peer_deauth(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac)251 wifi_pos_send_pasn_peer_deauth(struct wlan_objmgr_psoc *psoc,
252 			       struct qdf_mac_addr *peer_mac)
253 {
254 	return QDF_STATUS_SUCCESS;
255 }
256 
257 static inline void
wifi_pos_update_pasn_peer_count(struct wlan_objmgr_vdev * vdev,bool is_increment)258 wifi_pos_update_pasn_peer_count(struct wlan_objmgr_vdev *vdev,
259 				bool is_increment)
260 {}
261 
262 static inline uint8_t
wifi_pos_get_pasn_peer_count(struct wlan_objmgr_vdev * vdev)263 wifi_pos_get_pasn_peer_count(struct wlan_objmgr_vdev *vdev)
264 {
265 	return 0;
266 }
267 
268 static inline QDF_STATUS
wifi_pos_vdev_delete_all_ranging_peers(struct wlan_objmgr_vdev * vdev)269 wifi_pos_vdev_delete_all_ranging_peers(struct wlan_objmgr_vdev *vdev)
270 {
271 	return QDF_STATUS_SUCCESS;
272 }
273 
274 static inline
wifi_pos_is_delete_all_peer_in_progress(struct wlan_objmgr_vdev * vdev)275 bool wifi_pos_is_delete_all_peer_in_progress(struct wlan_objmgr_vdev *vdev)
276 {
277 	return false;
278 }
279 
280 static inline QDF_STATUS
wifi_pos_cleanup_pasn_peers(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev)281 wifi_pos_cleanup_pasn_peers(struct wlan_objmgr_psoc *psoc,
282 			    struct wlan_objmgr_vdev *vdev)
283 {
284 	return QDF_STATUS_SUCCESS;
285 }
286 
287 static inline
wifi_pos_set_delete_all_peer_in_progress(struct wlan_objmgr_vdev * vdev,bool flag)288 void wifi_pos_set_delete_all_peer_in_progress(struct wlan_objmgr_vdev *vdev,
289 					      bool flag)
290 {}
291 #endif /* WIFI_POS_CONVERGED && WLAN_FEATURE_RTT_11AZ_SUPPORT */
292 #endif /* _WIFI_POS_PASN_API_H_ */
293