xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_peer_ops.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 /**
28  * @file cdp_txrx_peer.h
29  * @brief Define the host data path peer API functions
30  * called by the host control SW and the OS interface module
31  */
32 #ifndef _CDP_TXRX_PEER_H_
33 #define _CDP_TXRX_PEER_H_
34 #include <cdp_txrx_ops.h>
35 #include "cdp_txrx_handle.h"
36 
37 /**
38  * cdp_peer_register() - Register peer into physical device
39  * @soc - data path soc handle
40  * @pdev - data path device instance
41  * @sta_desc - peer description
42  *
43  * Register peer into physical device
44  *
45  * Return: QDF_STATUS_SUCCESS registration success
46  *         QDF_STATUS_E_NOSUPPORT not support this feature
47  */
48 static inline QDF_STATUS
49 cdp_peer_register(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
50 		struct ol_txrx_desc_type *sta_desc)
51 {
52 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
53 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
54 			"%s invalid instance", __func__);
55 		return QDF_STATUS_E_INVAL;
56 	}
57 
58 	if (soc->ops->peer_ops->register_peer)
59 		return soc->ops->peer_ops->register_peer(pdev, sta_desc);
60 
61 	return QDF_STATUS_E_NOSUPPORT;
62 }
63 
64 /**
65  * cdp_clear_peer() - remove peer from physical device
66  * @soc - data path soc handle
67  * @pdev - data path device instance
68  * @sta_id - local peer id
69  *
70  * remove peer from physical device
71  *
72  * Return: QDF_STATUS_SUCCESS registration success
73  *         QDF_STATUS_E_NOSUPPORT not support this feature
74  */
75 static inline QDF_STATUS
76 cdp_clear_peer(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, uint8_t sta_id)
77 {
78 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
79 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
80 			"%s invalid instance", __func__);
81 		return QDF_STATUS_E_INVAL;
82 	}
83 
84 	if (soc->ops->peer_ops->clear_peer)
85 		return soc->ops->peer_ops->clear_peer(pdev, sta_id);
86 
87 	return QDF_STATUS_E_NOSUPPORT;
88 }
89 
90 /**
91  * cdp_peer_register_ocb_peer() - register ocb peer from physical device
92  * @soc - data path soc handle
93  * @cds_ctx - cds void context
94  * @mac_addr - mac address for ocb self peer
95  * @peer_id - local peer id
96  *
97  * register ocb peer from physical device
98  *
99  * Return: QDF_STATUS_SUCCESS registration success
100  *         QDF_STATUS_E_NOSUPPORT not support this feature
101  */
102 static inline QDF_STATUS
103 cdp_peer_register_ocb_peer(ol_txrx_soc_handle soc,
104 		uint8_t *mac_addr, uint8_t *peer_id)
105 {
106 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
107 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
108 			"%s invalid instance", __func__);
109 		return QDF_STATUS_E_INVAL;
110 	}
111 
112 	if (soc->ops->peer_ops->register_ocb_peer)
113 		return soc->ops->peer_ops->register_ocb_peer(mac_addr, peer_id);
114 
115 	return QDF_STATUS_E_NOSUPPORT;
116 }
117 
118 /**
119  * cdp_peer_remove_for_vdev() - remove peer instance from virtual interface
120  * @soc - data path soc handle
121  * @vdev - virtual interface instance
122  * @callback - remove done notification callback function pointer
123  * @callback_context - callback caller context
124  * @remove_last_peer - removed peer is last peer or not
125  *
126  * remove peer instance from virtual interface
127  *
128  * Return: NONE
129  */
130 static inline void
131 cdp_peer_remove_for_vdev(ol_txrx_soc_handle soc,
132 		struct cdp_vdev *vdev, ol_txrx_vdev_peer_remove_cb callback,
133 		void *callback_context, bool remove_last_peer)
134 {
135 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
136 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
137 			"%s invalid instance", __func__);
138 		return;
139 	}
140 
141 	if (soc->ops->peer_ops->remove_peers_for_vdev)
142 		return soc->ops->peer_ops->remove_peers_for_vdev(
143 			vdev, callback, callback_context, remove_last_peer);
144 
145 	return;
146 }
147 
148 /**
149  * cdp_peer_remove_for_vdev_no_lock() - remove peer instance from vdev
150  * @soc - data path soc handle
151  * @vdev - virtual interface instance
152  * @callback - remove done notification callback function pointer
153  * @callback_context - callback caller context
154  *
155  * remove peer instance from virtual interface without lock
156  *
157  * Return: NONE
158  */
159 static inline void
160 cdp_peer_remove_for_vdev_no_lock(ol_txrx_soc_handle soc,
161 				 struct cdp_vdev *vdev,
162 				 ol_txrx_vdev_peer_remove_cb callback,
163 				 void *callback_context)
164 {
165 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
166 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
167 			  "%s invalid instance", __func__);
168 		return;
169 	}
170 
171 	if (soc->ops->peer_ops->remove_peers_for_vdev_no_lock)
172 		return soc->ops->peer_ops->remove_peers_for_vdev_no_lock(
173 			vdev, callback, callback_context);
174 }
175 
176 /**
177  * cdp_peer_get_ref_by_addr() - Find peer by peer mac address and inc peer ref
178  * @soc - data path soc handle
179  * @pdev - data path device instance
180  * @peer_addr - peer mac address
181  * @peer_id - local peer id with target mac address
182  * @debug_id - debug_id to track caller
183  *
184  * To release the peer ref, cdp_peer_release_ref needs to be called.
185  *
186  * Return: peer instance void pointer
187  *         NULL cannot find target peer
188  */
189 static inline void
190 *cdp_peer_get_ref_by_addr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
191 			  u8 *peer_addr, u8 *peer_id,
192 			  enum peer_debug_id_type debug_id)
193 {
194 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
195 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
196 			  "%s invalid instance", __func__);
197 		return NULL;
198 	}
199 
200 	if (soc->ops->peer_ops->peer_get_ref_by_addr)
201 		return soc->ops->peer_ops->peer_get_ref_by_addr(
202 			pdev, peer_addr, peer_id, debug_id);
203 
204 	return NULL;
205 }
206 
207 /**
208  * cdp_peer_release_ref() - Release peer reference
209  * @soc - data path soc handle
210  * @peer - peer pointer
211  * @debug_id - debug_id to track caller
212  *
213  * Return:void
214  */
215 static inline void
216 cdp_peer_release_ref(ol_txrx_soc_handle soc, void *peer,
217 		     enum peer_debug_id_type debug_id)
218 {
219 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
220 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
221 			  "%s invalid instance", __func__);
222 		return;
223 	}
224 
225 	if (soc->ops->peer_ops->peer_release_ref)
226 		soc->ops->peer_ops->peer_release_ref(peer, debug_id);
227 }
228 
229 /**
230  * cdp_peer_find_by_addr() - Find peer by peer mac address
231  * @soc - data path soc handle
232  * @pdev - data path device instance
233  * @peer_addr - peer mac address
234  * @peer_id - local peer id with target mac address
235  *
236  * Find peer and local peer id by peer mac address
237  *
238  * Return: peer instance void pointer
239  *         NULL cannot find target peer
240  */
241 static inline void
242 *cdp_peer_find_by_addr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
243 		uint8_t *peer_addr, uint8_t *peer_id)
244 {
245 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
246 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
247 			"%s invalid instance", __func__);
248 		return NULL;
249 	}
250 
251 	if (soc->ops->peer_ops->find_peer_by_addr)
252 		return soc->ops->peer_ops->find_peer_by_addr(
253 			pdev, peer_addr, peer_id);
254 
255 	return NULL;
256 }
257 
258 /**
259  * cdp_peer_find_by_addr_and_vdev() - Find peer by peer mac address within vdev
260  * @soc - data path soc handle
261  * @pdev - data path device instance
262  * @vdev - virtual interface instance
263  * @peer_addr - peer mac address
264  * @peer_id - local peer id with target mac address
265  *
266  * Find peer by peer mac address within vdev
267  *
268  * Return: peer instance void pointer
269  *         NULL cannot find target peer
270  */
271 static inline void
272 *cdp_peer_find_by_addr_and_vdev(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
273 		struct cdp_vdev *vdev, uint8_t *peer_addr, uint8_t *peer_id)
274 {
275 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
276 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
277 			"%s invalid instance", __func__);
278 		return NULL;
279 	}
280 
281 	if (soc->ops->peer_ops->find_peer_by_addr_and_vdev)
282 		return soc->ops->peer_ops->find_peer_by_addr_and_vdev(
283 			pdev, vdev, peer_addr, peer_id);
284 
285 	return NULL;
286 }
287 
288 /**
289  * cdp_peer_find_by_local_id() - Find peer by local peer id
290  * @soc - data path soc handle
291  * @pdev - data path device instance
292  * @local_peer_id - local peer id want to find
293  *
294  * Find peer by local peer id within physical device
295  *
296  * Return: peer instance void pointer
297  *         NULL cannot find target peer
298  */
299 static inline void
300 *cdp_peer_find_by_local_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
301 		uint8_t local_peer_id)
302 {
303 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
304 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
305 			"%s invalid instance", __func__);
306 		return NULL;
307 	}
308 
309 	if (soc->ops->peer_ops->peer_find_by_local_id)
310 		return soc->ops->peer_ops->peer_find_by_local_id(
311 			pdev, local_peer_id);
312 
313 	return NULL;
314 }
315 
316 /**
317  * cdp_peer_state_update() - update peer local state
318  * @soc - data path soc handle
319  * @pdev - data path device instance
320  * @peer_addr - peer mac address
321  * @state - new peer local state
322  *
323  * update peer local state
324  *
325  * Return: QDF_STATUS_SUCCESS registration success
326  *         QDF_STATUS_E_NOSUPPORT not support this feature
327  */
328 static inline QDF_STATUS
329 cdp_peer_state_update(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
330 		uint8_t *peer_addr, enum ol_txrx_peer_state state)
331 {
332 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
333 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
334 			"%s invalid instance", __func__);
335 		return QDF_STATUS_E_INVAL;
336 	}
337 
338 	if (soc->ops->peer_ops->peer_state_update)
339 		return soc->ops->peer_ops->peer_state_update(
340 			pdev, peer_addr, state);
341 
342 	return QDF_STATUS_E_NOSUPPORT;
343 }
344 
345 /**
346  * cdp_peer_state_get() - Get local peer state
347  * @soc - data path soc handle
348  * @peer - peer instance
349  *
350  * Get local peer state
351  *
352  * Return: peer status
353  */
354 static inline int
355 cdp_peer_state_get(ol_txrx_soc_handle soc, void *peer)
356 {
357 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
358 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
359 			"%s invalid instance", __func__);
360 		return 0;
361 	}
362 
363 	if (soc->ops->peer_ops->get_peer_state)
364 		return soc->ops->peer_ops->get_peer_state(peer);
365 
366 	return 0;
367 }
368 
369 /**
370  * cdp_peer_get_local_peer_id() - Find local peer id within peer instance
371  * @soc - data path soc handle
372  * @peer - peer instance
373  *
374  * Find local peer id within peer instance
375  *
376  * Return: local peer id
377  *         HTT_INVALID_PEER Invalid peer
378  */
379 static inline uint16_t
380 cdp_peer_get_local_peer_id(ol_txrx_soc_handle soc, void *peer)
381 {
382 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
383 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
384 			"%s invalid instance", __func__);
385 		return HTT_INVALID_PEER;
386 	}
387 
388 	if (soc->ops->peer_ops->local_peer_id)
389 		return soc->ops->peer_ops->local_peer_id(peer);
390 
391 	return HTT_INVALID_PEER;
392 }
393 
394 /**
395  * cdp_peer_get_vdevid() - Get virtaul interface id which peer registered
396  * @soc - data path soc handle
397  * @peer - peer instance
398  * @vdev_id - virtaul interface id which peer registered
399  *
400  * Get virtaul interface id which peer registered
401  *
402  * Return: QDF_STATUS_SUCCESS registration success
403  *         QDF_STATUS_E_NOSUPPORT not support this feature
404  */
405 static inline QDF_STATUS
406 cdp_peer_get_vdevid(ol_txrx_soc_handle soc, void *peer, uint8_t *vdev_id)
407 {
408 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
409 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
410 			"%s invalid instance", __func__);
411 		return QDF_STATUS_E_INVAL;
412 	}
413 
414 	if (soc->ops->peer_ops->get_vdevid)
415 		return soc->ops->peer_ops->get_vdevid(peer, vdev_id);
416 
417 	return QDF_STATUS_E_NOSUPPORT;
418 }
419 
420 /**
421  * cdp_peer_get_vdev_by_sta_id() - Get vdev instance by local peer id
422  * @soc - data path soc handle
423  * @pdev - data path device instance
424  * @sta_id - local peer id
425  *
426  * Get virtaul interface id by local peer id
427  *
428  * Return: Virtual interface instance
429  *         NULL in case cannot find
430  */
431 static inline struct cdp_vdev
432 *cdp_peer_get_vdev_by_sta_id(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
433 			     uint8_t sta_id)
434 {
435 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
436 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
437 			"%s invalid instance", __func__);
438 		return NULL;
439 	}
440 
441 	if (soc->ops->peer_ops->get_vdev_by_sta_id)
442 		return soc->ops->peer_ops->get_vdev_by_sta_id(pdev, sta_id);
443 
444 	return NULL;
445 }
446 
447 /**
448  * cdp_peer_get_peer_mac_addr() - Get peer mac address
449  * @soc - data path soc handle
450  * @peer - peer instance
451  *
452  * Get peer mac address
453  *
454  * Return: peer mac address pointer
455  *         NULL in case cannot find
456  */
457 static inline uint8_t
458 *cdp_peer_get_peer_mac_addr(ol_txrx_soc_handle soc, void *peer)
459 {
460 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
461 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
462 			"%s invalid instance", __func__);
463 		return NULL;
464 	}
465 
466 	if (soc->ops->peer_ops->peer_get_peer_mac_addr)
467 		return soc->ops->peer_ops->peer_get_peer_mac_addr(peer);
468 
469 	return NULL;
470 }
471 
472 /**
473  * cdp_peer_get_vdev() - Get virtual interface instance which peer belongs
474  * @soc - data path soc handle
475  * @peer - peer instance
476  *
477  * Get virtual interface instance which peer belongs
478  *
479  * Return: virtual interface instance pointer
480  *         NULL in case cannot find
481  */
482 static inline struct cdp_vdev
483 *cdp_peer_get_vdev(ol_txrx_soc_handle soc, void *peer)
484 {
485 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
486 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
487 			"%s invalid instance", __func__);
488 		return NULL;
489 	}
490 
491 	if (soc->ops->peer_ops->get_vdev_for_peer)
492 		return soc->ops->peer_ops->get_vdev_for_peer(peer);
493 
494 	return NULL;
495 }
496 
497 /**
498  * cdp_peer_update_ibss_add_peer_num_of_vdev() - update number of peer
499  * @soc - data path soc handle
500  * @vdev - virtual interface instance
501  * @peer_num_delta - number of peer should be updated
502  *
503  * update number of peer
504  *
505  * Return: updated number of peer
506  *         0 fail
507  */
508 static inline int16_t
509 cdp_peer_update_ibss_add_peer_num_of_vdev(ol_txrx_soc_handle soc,
510 		struct cdp_vdev *vdev, int16_t peer_num_delta)
511 {
512 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
513 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
514 			"%s invalid instance", __func__);
515 		return 0;
516 	}
517 
518 	if (soc->ops->peer_ops->update_ibss_add_peer_num_of_vdev)
519 		return soc->ops->peer_ops->update_ibss_add_peer_num_of_vdev(
520 			vdev, peer_num_delta);
521 
522 	return 0;
523 }
524 
525 /**
526  * cdp_peer_copy_mac_addr_raw() - copy peer mac address
527  * @soc - data path soc handle
528  * @vdev - virtual interface instance
529  * @bss_addr - mac address should be copied
530  *
531  * copy peer mac address
532  *
533  * Return: none
534  */
535 static inline void
536 cdp_peer_copy_mac_addr_raw(ol_txrx_soc_handle soc,
537 		struct cdp_vdev *vdev, uint8_t *bss_addr)
538 {
539 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
540 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
541 			"%s invalid instance", __func__);
542 		return;
543 	}
544 
545 	if (soc->ops->peer_ops->copy_mac_addr_raw)
546 		return soc->ops->peer_ops->copy_mac_addr_raw(vdev, bss_addr);
547 
548 	return;
549 }
550 
551 /**
552  * cdp_peer_add_last_real_peer() - Add peer with last peer marking
553  * @soc - data path soc handle
554  * @pdev - data path device instance
555  * @vdev - virtual interface instance
556  * @peer_id - local peer id
557  *
558  * copy peer mac address
559  *
560  * Return: none
561  */
562 static inline void
563 cdp_peer_add_last_real_peer(ol_txrx_soc_handle soc,
564 		struct cdp_pdev *pdev, struct cdp_vdev *vdev, uint8_t *peer_id)
565 {
566 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
567 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
568 			"%s invalid instance", __func__);
569 		return;
570 	}
571 
572 	if (soc->ops->peer_ops->add_last_real_peer)
573 		return soc->ops->peer_ops->add_last_real_peer(
574 			pdev, vdev, peer_id);
575 	return;
576 }
577 
578 /**
579  * cdp_peer_last_assoc_received() - last assoc received peer
580  * @soc - data path soc handle
581  * @peer - peer instance pointer
582  *
583  * !!! This should be implemented on legacy also
584  * last assoc received peer
585  *
586  * Return: pointer
587  */
588 static inline qdf_time_t *
589 cdp_peer_last_assoc_received(ol_txrx_soc_handle soc, void *peer)
590 {
591 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
592 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
593 			"%s invalid instance", __func__);
594 		return NULL;
595 	}
596 
597 	if (soc->ops->peer_ops->last_assoc_received)
598 		return soc->ops->peer_ops->last_assoc_received(peer);
599 
600 	return NULL;
601 }
602 
603 /**
604  * cdp_peer_last_disassoc_received() - last disassoc received peer
605  * @soc - data path soc handle
606  * @peer - peer instance pointer
607  *
608  * !!! This should be implemented on legacy also
609  * last disassoc received peer
610  *
611  * Return: pointer
612  */
613 static inline qdf_time_t *
614 cdp_peer_last_disassoc_received(ol_txrx_soc_handle soc, void *peer)
615 {
616 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
617 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
618 			"%s invalid instance", __func__);
619 		return NULL;
620 	}
621 
622 	if (soc->ops->peer_ops->last_disassoc_received)
623 		return soc->ops->peer_ops->last_disassoc_received(peer);
624 
625 	return NULL;
626 }
627 
628 /**
629  * cdp_peer_last_deauth_received() - last deauth received peer
630  * @soc - data path soc handle
631  * @peer - peer instance pointer
632  *
633  * !!! This should be implemented on legacy also
634  * last deauth received peer
635  *
636  * Return: pointer
637  */
638 static inline qdf_time_t *
639 cdp_peer_last_deauth_received(ol_txrx_soc_handle soc, void *peer)
640 {
641 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
642 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
643 			"%s invalid instance", __func__);
644 		return NULL;
645 	}
646 
647 	if (soc->ops->peer_ops->last_deauth_received)
648 		return soc->ops->peer_ops->last_deauth_received(peer);
649 
650 	return NULL;
651 }
652 
653 /**
654  * cdp_peer_is_vdev_restore_last_peer() - restore last peer
655  * @soc - data path soc handle
656  * @peer - peer instance pointer
657  *
658  * restore last peer
659  *
660  * Return: true, restore success
661  *         fasle, restore fail
662  */
663 static inline bool
664 cdp_peer_is_vdev_restore_last_peer(ol_txrx_soc_handle soc, void *peer)
665 {
666 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
667 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
668 			"%s invalid instance", __func__);
669 		return false;
670 	}
671 
672 	if (soc->ops->peer_ops->is_vdev_restore_last_peer)
673 		return soc->ops->peer_ops->is_vdev_restore_last_peer(peer);
674 
675 	return false;
676 }
677 
678 /**
679  * cdp_peer_update_last_real_peer() - update last real peer
680  * @soc - data path soc handle
681  * @pdev - data path device instance
682  * @peer - peer instance pointer
683  * @peer_id - local peer id
684  * @restore_last_peer - restore last peer or not
685  *
686  * update last real peer
687  *
688  * Return: none
689  */
690 static inline void
691 cdp_peer_update_last_real_peer(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
692 		void *peer, uint8_t *peer_id, bool restore_last_peer)
693 {
694 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
695 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
696 			"%s invalid instance", __func__);
697 		return;
698 	}
699 
700 	if (soc->ops->peer_ops->update_last_real_peer)
701 		return soc->ops->peer_ops->update_last_real_peer(pdev, peer,
702 			peer_id, restore_last_peer);
703 
704 	return;
705 }
706 
707 /**
708  * ol_txrx_peer_detach_force_delete() - Detach and delete a peer's data object
709  * @peer - the object to detach
710  *
711  * Detach a peer and force the peer object to be removed. It is called during
712  * roaming scenario when the firmware has already deleted a peer.
713  * Peer object is freed immediately to avoid duplicate peers during roam sync
714  * indication processing.
715  *
716  * Return: None
717  */
718 static inline void cdp_peer_detach_force_delete(ol_txrx_soc_handle soc,
719 		void *peer)
720 {
721 	if (!soc || !soc->ops || !soc->ops->peer_ops) {
722 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
723 			"%s invalid instance", __func__);
724 		return;
725 	}
726 
727 	if (soc->ops->peer_ops->peer_detach_force_delete)
728 		return soc->ops->peer_ops->peer_detach_force_delete(peer);
729 
730 	return;
731 }
732 #endif /* _CDP_TXRX_PEER_H_ */
733