xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_peer_obj.h (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * DOC: Define the peer data structure of UMAC
21  *	Public APIs to perform operations on Global objects
22  */
23 #ifndef _WLAN_OBJMGR_PEER_OBJ_H_
24 #define _WLAN_OBJMGR_PEER_OBJ_H_
25 
26 #include <qdf_types.h>
27 #include <qdf_atomic.h>
28 #include "wlan_objmgr_vdev_obj.h"
29 #ifdef WLAN_FEATURE_11BE_MLO
30 #include "wlan_mlo_mgr_public_structs.h"
31 #endif
32 
33 /* peer flags */
34 /* authorized for data */
35 #define WLAN_PEER_F_AUTH                            0x00000001
36 /* QoS enabled */
37 #define WLAN_PEER_F_QOS                             0x00000002
38 /* ERP enabled */
39 #define WLAN_PEER_F_ERP                             0x00000004
40 /* HT enabled */
41 #define WLAN_PEER_F_HT                              0x00000008
42 /* NB: tWLANhave the same value as IEEE80211_FC1_PWR_MGT */
43 /* power save mode enabled */
44 #define WLAN_PEER_F_PWR_MGT                         0x00000010
45 /* keytsc for node has already been updated */
46 #define WLAN_PEER_F_TSC_SET                         0x00000020
47 /* U-APSD power save enabled */
48 #define WLAN_PEER_F_UAPSD                           0x00000040
49 /* U-APSD triggerable state */
50 #define WLAN_PEER_F_UAPSD_TRIG                      0x00000080
51 /* U-APSD SP in progress */
52 #define WLAN_PEER_F_UAPSD_SP                        0x00000100
53 /* Atheros Owl or follow-on device */
54 #define WLAN_PEER_F_ATH                             0x00000200
55 /* Owl WDS workaround needed*/
56 #define WLAN_PEER_F_OWL_WDSWAR                      0x00000400
57 /* WDS link */
58 #define WLAN_PEER_F_WDS                             0x00000800
59 /* No AMPDU support */
60 #define WLAN_PEER_F_NOAMPDU                         0x00001000
61 /* wep/tkip aggregation support */
62 #define WLAN_PEER_F_WEPTKIPAGGR                     0x00002000
63 #define WLAN_PEER_F_WEPTKIP                         0x00004000
64 /* temp node (not in the node table) */
65 #define WLAN_PEER_F_TEMP                            0x00008000
66 /* 2.4ng VHT interop AMSDU disabled */
67 #define WLAN_PEER_F_11NG_VHT_INTEROP_AMSDU_DISABLE  0x00010000
68 /* 40 MHz Intolerant  */
69 #define WLAN_PEER_F_40MHZ_INTOLERANT                0x00020000
70 /* node is  paused*/
71 #define WLAN_PEER_F_PAUSED                          0x00040000
72 #define WLAN_PEER_F_EXTRADELIMWAR                   0x00080000
73 /* 20 MHz requesting node */
74 #define WLAN_PEER_F_REQ_20MHZ                       0x00100000
75 /* all the tid queues in ath layer are paused*/
76 #define WLAN_PEER_F_ATH_PAUSED                      0x00200000
77 /*Require credit update*/
78 #define WLAN_PEER_F_UAPSD_CREDIT_UPDATE             0x00400000
79 /*Require send deauth when h/w queue no data*/
80 #define WLAN_PEER_F_KICK_OUT_DEAUTH                 0x00800000
81 /* RRM enabled node */
82 #define WLAN_PEER_F_RRM                             0x01000000
83 /* Wakeup node */
84 #define WLAN_PEER_F_WAKEUP                          0x02000000
85 /* VHT enabled node */
86 #define WLAN_PEER_F_VHT                             0x04000000
87 /* deauth/Disassoc wait for node cleanup till frame goes on
88    air and tx feedback received */
89 #define WLAN_PEER_F_DELAYED_CLEANUP                 0x08000000
90 /* Extended stats enabled node */
91 #define WLAN_PEER_F_EXT_STATS                       0x10000000
92 /* Prevent _ieee80211_node_leave() from reentry */
93 #define WLAN_PEER_F_LEAVE_ONGOING                   0x20000000
94 /* band steering is enabled for this node */
95 #define WLAN_PEER_F_BSTEERING_CAPABLE               0x40000000
96 /* node is a local mesh peer */
97 #define WLAN_PEER_F_LOCAL_MESH_PEER                 0x80000000
98 
99 /* MLO enabled peer */
100 #define WLAN_PEER_FEXT_MLO                          0x00000001
101 
102 /**
103  * enum wlan_peer_state  - peer state
104  * @WLAN_INIT_STATE:       Default state
105  * @WLAN_JOIN_STATE:       Station mode, STA is waiting for Join
106  * @WLAN_AUTH_STATE:       AUTH in progress
107  * @WLAN_ASSOC_STATE:      ASSOC in progress
108  * @WLAN_WAITKEY_STATE:    4-way KEY handshake is in progress
109  * @WLAN_CONNECTED_STATE:  Connected state
110  * @WLAN_PREAUTH_STATE:    Station mode: Preauth
111  * @WLAN_DISCONNECT_STATE: Disconnect is in progress
112  */
113 enum wlan_peer_state {
114 	WLAN_INIT_STATE       = 1,
115 	WLAN_JOIN_STATE       = 2,
116 	WLAN_AUTH_STATE       = 3,
117 	WLAN_ASSOC_STATE      = 4,
118 	WLAN_WAITKEY_STATE    = 5,
119 	WLAN_CONNECTED_STATE  = 6,
120 	WLAN_PREAUTH_STATE    = 7,
121 	WLAN_DISCONNECT_STATE = 8,
122 };
123 
124 /**
125  * struct wlan_objmgr_peer_mlme - mlme common data of peer
126  * @peer_capinfo:    protocol cap info
127  * @peer_flags:      PEER OP flags
128  * @peer_ext_flags:  PEER OP ext flags
129  * @peer_type:       Type of PEER, (STA/AP/etc.)
130  * @phymode:         phy mode of station
131  * @max_rate:        Max Rate supported
132  * @state:           State of the peer
133  * @seq_num:         Sequence number
134  * @rssi:            Last received RSSI value
135  * @is_authenticated: true if peer is authenticated
136  * @assoc_peer:      assoc req/response is handled in this peer
137  */
138 struct wlan_objmgr_peer_mlme {
139 	uint32_t peer_capinfo;
140 	uint32_t peer_flags;
141 	uint32_t peer_ext_flags;
142 	enum wlan_peer_type peer_type;
143 	enum wlan_phymode phymode;
144 	uint32_t max_rate;
145 	enum wlan_peer_state state;
146 	uint16_t seq_num;
147 	int8_t rssi;
148 	bool is_authenticated;
149 #ifdef WLAN_FEATURE_11BE_MLO
150 	bool assoc_peer;
151 #endif
152 };
153 
154 /**
155  * struct wlan_objmgr_peer_objmgr - object manager data of peer
156  * @vdev:              VDEV pointer to which it is associated
157  * @ref_cnt:           Ref count
158  * @ref_id_dbg:        Array to track Ref count
159  * @print_cnt:         Count to throttle Logical delete prints
160  * @trace:             Trace ref and deref
161  */
162 struct wlan_objmgr_peer_objmgr {
163 	struct wlan_objmgr_vdev *vdev;
164 	qdf_atomic_t ref_cnt;
165 #ifdef WLAN_OBJMGR_REF_ID_DEBUG
166 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
167 #endif
168 	uint8_t print_cnt;
169 #ifdef WLAN_OBJMGR_REF_ID_TRACE
170 	struct wlan_objmgr_trace trace;
171 #endif
172 };
173 
174 /**
175  * struct wlan_objmgr_peer -  PEER common object
176  * @psoc_peer:        peer list node for psoc's qdf list
177  * @vdev_peer:        peer list node for vdev's qdf list
178  * @free_node:        peer list node for free in a delayed work
179  * @macaddr:          Peer MAC address
180  * @peer_mlme:	      Peer MLME common structure
181  * @peer_objmgr:      Peer Object manager common structure
182  * @peer_comp_priv_obj:  Component's private object pointers
183  * @obj_status:       status of each component object
184  * @obj_state:        Status of Peer object
185  * @pdev_id:          Pdev ID
186  * @peer_lock:        Lock for access/update peer contents
187  * @mlo_peer_ctx:     Reference to MLO Peer context
188  * @mldaddr:          Peer MLD MAC address
189  */
190 struct wlan_objmgr_peer {
191 	qdf_list_node_t psoc_peer;
192 	qdf_list_node_t vdev_peer;
193 #ifdef FEATURE_DELAYED_PEER_OBJ_DESTROY
194 	qdf_list_node_t free_node;
195 #endif
196 	uint8_t macaddr[QDF_MAC_ADDR_SIZE];
197 	uint8_t pdev_id;
198 	struct wlan_objmgr_peer_mlme peer_mlme;
199 	struct wlan_objmgr_peer_objmgr peer_objmgr;
200 	void *peer_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
201 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
202 	WLAN_OBJ_STATE obj_state;
203 	qdf_spinlock_t peer_lock;
204 #ifdef WLAN_FEATURE_11BE_MLO
205 	struct wlan_mlo_peer_context *mlo_peer_ctx;
206 	uint8_t mldaddr[QDF_MAC_ADDR_SIZE];
207 #endif
208 };
209 
210 /*
211  * APIs to Create/Delete Global object APIs
212  */
213 /**
214  * wlan_objmgr_peer_obj_create() - peer object create
215  * @vdev: VDEV object on which this peer gets created
216  * @type: peer type (AP/STA)
217  * @macaddr: MAC address
218  *
219  * Creates Peer object, initializes with default values
220  * Attaches to psoc and vdev objects
221  * Invokes the registered notifiers to create component object
222  *
223  * Return: Handle to struct wlan_objmgr_peer on successful creation,
224  *         NULL on Failure (on Mem alloc failure and Component objects
225  *         Failure)
226  */
227 struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create(
228 			struct wlan_objmgr_vdev *vdev,
229 			enum wlan_peer_type type,
230 			uint8_t macaddr[]);
231 
232 /**
233  * wlan_objmgr_peer_obj_delete() - peer object delete
234  * @peer: PEER object
235  *
236  * Deletes PEER object, removes it from PSOC's, VDEV's peer list
237  * Invokes the registered notifiers to destroy component objects
238  *
239  * Return: SUCCESS/FAILURE
240  */
241 QDF_STATUS wlan_objmgr_peer_obj_delete(struct wlan_objmgr_peer *peer);
242 
243 #ifdef FEATURE_DELAYED_PEER_OBJ_DESTROY
244 /**
245  * wlan_delayed_peer_obj_free_init() - Init for delayed peer obj freed queue
246  * @data: PDEV object
247  *
248  * Initialize main data structures to process peer obj destroy in a delayed
249  * workqueue.
250  *
251  * Return: QDF_STATUS_SUCCESS on success else a QDF error.
252  */
253 QDF_STATUS wlan_delayed_peer_obj_free_init(void *data);
254 
255 /**
256  * wlan_delayed_peer_obj_free_deinit() - De-Init delayed peer freed processing
257  * @data: PDEV object
258  *
259  * De-initialize main data structures to process peer obj freed in a delayed
260  * workqueue.
261  *
262  * Return: QDF_STATUS_SUCCESS on success else a QDF error.
263  */
264 QDF_STATUS wlan_delayed_peer_obj_free_deinit(void *data);
265 #else
266 static inline QDF_STATUS wlan_delayed_peer_obj_free_init(void *data)
267 {
268 	return QDF_STATUS_SUCCESS;
269 }
270 
271 static inline QDF_STATUS wlan_delayed_peer_obj_free_deinit(void *data)
272 {
273 	return QDF_STATUS_SUCCESS;
274 }
275 #endif
276 
277 /*
278  * APIs to attach/detach component objects
279  */
280 /**
281  * wlan_objmgr_peer_component_obj_attach() - attach comp object to peer
282  * @peer: PEER object
283  * @id: Component id
284  * @comp_priv_obj: component's private object pointer
285  * @status: Component's private object creation status
286  *
287  * API to be used for attaching component object with PEER common object
288  *
289  * Return: SUCCESS on successful storing of component's object in common object
290  *         On FAILURE (appropriate failure codes are returned)
291  */
292 QDF_STATUS wlan_objmgr_peer_component_obj_attach(
293 		struct wlan_objmgr_peer *peer,
294 		enum wlan_umac_comp_id id,
295 		void *comp_priv_obj,
296 		QDF_STATUS status);
297 
298 /**
299  * wlan_objmgr_peer_component_obj_detach() - detach comp object from peer
300  * @peer: PEER object
301  * @id: Component id
302  * @comp_priv_obj: component's private object pointer
303  *
304  * API to be used for detaching component object with PEER common object
305  *
306  * Return: SUCCESS on successful removal of component's object from common
307  *         object
308  *         On FAILURE (appropriate failure codes are returned)
309  */
310 QDF_STATUS wlan_objmgr_peer_component_obj_detach(
311 		struct wlan_objmgr_peer *peer,
312 		enum wlan_umac_comp_id id,
313 		void *comp_priv_obj);
314 
315 /*
316  * APIs to operations on peer objects
317  */
318 
319 /**
320  * wlan_objmgr_trigger_peer_comp_priv_object_creation() - create
321  * peer comp object
322  * @peer: PEER object
323  * @id: Component id
324  *
325  * API to create component private object in run time, this would
326  * be used for features which gets enabled in run time
327  *
328  * Return: SUCCESS on successful creation
329  *         On FAILURE (appropriate failure codes are returned)
330  */
331 QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_creation(
332 		struct wlan_objmgr_peer *peer,
333 		enum wlan_umac_comp_id id);
334 
335 /**
336  * wlan_objmgr_trigger_peer_comp_priv_object_deletion() - destroy
337  * peer comp object
338  * @peer: PEER object
339  * @id: Component id
340  *
341  * API to destroy component private object in run time, this would
342  * be used for features which gets disabled in run time
343  *
344  * Return: SUCCESS on successful deletion
345  *         On FAILURE (appropriate failure codes are returned)
346  */
347 QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_deletion(
348 		struct wlan_objmgr_peer *peer,
349 		enum wlan_umac_comp_id id);
350 
351 /**
352  * wlan_objmgr_peer_get_comp_private_obj() - get peer component private object
353  * @peer: PEER object
354  * @id: Component id
355  *
356  * API to get component private object
357  *
358  * Return: void *ptr on SUCCESS
359  *         NULL on Failure
360  */
361 void *wlan_objmgr_peer_get_comp_private_obj(
362 		struct wlan_objmgr_peer *peer,
363 		enum wlan_umac_comp_id id);
364 
365 /**
366  * wlan_peer_obj_lock() - Acquire PEER spinlock
367  * @peer: PEER object
368  *
369  * API to acquire PEER spin lock
370  * Parent lock should not be taken in child lock context
371  * but child lock can be taken in parent lock context
372  * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context)
373  *
374  * Return: void
375  */
376 static inline void wlan_peer_obj_lock(struct wlan_objmgr_peer *peer)
377 {
378 	qdf_spin_lock_bh(&peer->peer_lock);
379 }
380 
381 /**
382  * wlan_peer_obj_unlock() - Release PEER spinlock
383  * @peer: PEER object
384  *
385  * API to Release PEER spin lock
386  *
387  * Return: void
388  */
389 static inline void wlan_peer_obj_unlock(struct wlan_objmgr_peer *peer)
390 {
391 	qdf_spin_unlock_bh(&peer->peer_lock);
392 }
393 
394 /**
395  * DOC: Examples to use PEER ref count APIs
396  *
397  * In all the scenarios, the pair of API should be followed
398  * other it lead to memory leak
399  *
400  *  scenario 1:
401  *
402  *     wlan_objmgr_peer_obj_create()
403  *     ----
404  *     wlan_objmgr_peer_obj_delete()
405  *
406  *  scenario 2:
407  *
408  *     wlan_objmgr_peer_get_ref()
409  *     ----
410  *     the operations which are done on
411  *     peer object
412  *     ----
413  *     wlan_objmgr_peer_release_ref()
414  *
415  *  scenario 3:
416  *
417  *     API to retrieve peer (xxx_get_peer_xxx())
418  *     ----
419  *     the operations which are done on
420  *     peer object
421  *     ----
422  *     wlan_objmgr_peer_release_ref()
423  */
424 
425 /**
426  * wlan_objmgr_peer_get_ref() - increment ref count
427  * @peer: PEER object
428  * @id:   Object Manager ref debug id
429  *
430  * API to increment ref count of peer
431  *
432  * Return: void
433  */
434 #ifdef WLAN_OBJMGR_REF_ID_TRACE
435 #define wlan_objmgr_peer_get_ref(peer, id) \
436 		wlan_objmgr_peer_get_ref_debug(peer, id, __func__, __LINE__)
437 
438 void wlan_objmgr_peer_get_ref_debug(struct wlan_objmgr_peer *peer,
439 				    wlan_objmgr_ref_dbgid id,
440 				    const char *func, int line);
441 #else
442 void wlan_objmgr_peer_get_ref(struct wlan_objmgr_peer *peer,
443 					wlan_objmgr_ref_dbgid id);
444 #endif
445 
446 /**
447  * wlan_objmgr_peer_try_get_ref() - increment ref count, if allowed
448  * @peer: PEER object
449  * @id:   Object Manager ref debug id
450  *
451  * API to increment ref count of peer, if object state is valid
452  *
453  * Return: void
454  */
455 #ifdef WLAN_OBJMGR_REF_ID_TRACE
456 #define wlan_objmgr_peer_try_get_ref(peer, id) \
457 		wlan_objmgr_peer_try_get_ref_debug(peer, id, \
458 		__func__, __LINE__)
459 
460 QDF_STATUS wlan_objmgr_peer_try_get_ref_debug(struct wlan_objmgr_peer *peer,
461 					      wlan_objmgr_ref_dbgid id,
462 					      const char *func, int line);
463 #else
464 QDF_STATUS wlan_objmgr_peer_try_get_ref(struct wlan_objmgr_peer *peer,
465 						 wlan_objmgr_ref_dbgid id);
466 #endif
467 
468 /**
469  * wlan_objmgr_peer_release_ref() - decrement ref count
470  * @peer: PEER object
471  * @id:   Object Manager ref debug id
472  *
473  * API to decrement ref count of peer, if ref count is 1, it initiates the
474  * peer deletion
475  *
476  * Return: void
477  */
478 #ifdef WLAN_OBJMGR_REF_ID_TRACE
479 #define wlan_objmgr_peer_release_ref(peer, id) \
480 		wlan_objmgr_peer_release_ref_debug(peer, id, \
481 		__func__, __LINE__)
482 
483 void wlan_objmgr_peer_release_ref_debug(struct wlan_objmgr_peer *peer,
484 					wlan_objmgr_ref_dbgid id,
485 					const char *func, int line);
486 #else
487 void wlan_objmgr_peer_release_ref(struct wlan_objmgr_peer *peer,
488 						 wlan_objmgr_ref_dbgid id);
489 #endif
490 
491 /**
492  * wlan_peer_get_next_peer_of_psoc_ref() - get next peer to psoc peer list
493  *                                         with lock and ref taken
494  * @peer_list: Peer list
495  * @hash_index: peer list hash index
496  * @peer: PEER object
497  * @dbg_id: Ref count debug module id
498  *
499  * API to get the next peer of given peer (of psoc's peer list)
500  *
501  * Return: PEER object
502  */
503 #ifdef WLAN_OBJMGR_REF_ID_TRACE
504 #define wlan_peer_get_next_peer_of_psoc_ref(peer_list, hash_index, peer, \
505 	dbg_id) \
506 		wlan_peer_get_next_peer_of_psoc_ref_debug(peer_list, \
507 		hash_index, peer, dbg_id, __func__, __LINE__)
508 
509 struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_psoc_ref_debug(
510 				struct wlan_peer_list *peer_list,
511 				uint8_t hash_index,
512 				struct wlan_objmgr_peer *peer,
513 				wlan_objmgr_ref_dbgid dbg_id,
514 				const char *func, int line);
515 #else
516 struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_psoc_ref(
517 				struct wlan_peer_list *peer_list,
518 				uint8_t hash_index,
519 				struct wlan_objmgr_peer *peer,
520 				wlan_objmgr_ref_dbgid dbg_id);
521 #endif
522 
523 /**
524  * wlan_peer_get_next_active_peer_of_psoc() - get next active peer to psoc peer
525  *                                            list
526  * @peer_list: Peer list
527  * @hash_index: peer list hash index
528  * @peer: PEER object
529  * @dbg_id: Ref count debug module id
530  *
531  * API to get the next peer of given peer (of psoc's peer list)
532  *
533  * Return: PEER object
534  */
535 #ifdef WLAN_OBJMGR_REF_ID_TRACE
536 #define wlan_peer_get_next_active_peer_of_psoc(peer_list, hash_index, \
537 	peer, dbg_id) \
538 		wlan_peer_get_next_active_peer_of_psoc_debug(peer_list, \
539 		hash_index, peer, dbg_id, __func__, __LINE__)
540 
541 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_psoc_debug(
542 					struct wlan_peer_list *peer_list,
543 					uint8_t hash_index,
544 					struct wlan_objmgr_peer *peer,
545 					wlan_objmgr_ref_dbgid dbg_id,
546 					const char *func, int line);
547 #else
548 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_psoc(
549 					struct wlan_peer_list *peer_list,
550 					uint8_t hash_index,
551 					struct wlan_objmgr_peer *peer,
552 					wlan_objmgr_ref_dbgid dbg_id);
553 #endif
554 
555 /**
556  * wlan_peer_get_next_active_peer_of_vdev() - get next active_peer of vdev list
557  * @vdev: VDEV object
558  * @peer_list: Peer object list
559  * @peer: PEER object
560  * @dbg_id: Ref count debug module id
561  *
562  * API to get the next active peer of given peer (of vdev's peer list)
563  *
564  * Return: PEER object
565  */
566 #ifdef WLAN_OBJMGR_REF_ID_TRACE
567 #define wlan_peer_get_next_active_peer_of_vdev(vdev, peer_list, peer, dbg_id) \
568 		wlan_peer_get_next_active_peer_of_vdev_debug(vdev, peer_list, \
569 		peer, dbg_id, __func__, __LINE__)
570 
571 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_vdev_debug(
572 				struct wlan_objmgr_vdev *vdev,
573 				qdf_list_t *peer_list,
574 				struct wlan_objmgr_peer *peer,
575 				wlan_objmgr_ref_dbgid dbg_id,
576 				const char *func, int line);
577 #else
578 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_vdev(
579 				struct wlan_objmgr_vdev *vdev,
580 				qdf_list_t *peer_list,
581 				struct wlan_objmgr_peer *peer,
582 				wlan_objmgr_ref_dbgid dbg_id);
583 #endif
584 
585 /**
586  * wlan_vdev_peer_list_peek_active_head() - get active head of vdev peer list
587  * @vdev: VDEV object
588  * @peer_list: qdf_list_t
589  * @dbg_id: Ref count debug module id
590  *
591  * API to get the active head peer of given peer (of vdev's peer list)
592  *
593  * Return: active head peer
594  */
595 #ifdef WLAN_OBJMGR_REF_ID_TRACE
596 #define wlan_vdev_peer_list_peek_active_head(vdev, peer_list, dbg_id) \
597 		wlan_vdev_peer_list_peek_active_head_debug(vdev, peer_list, \
598 		dbg_id, __func__, __LINE__)
599 
600 struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_active_head_debug(
601 				struct wlan_objmgr_vdev *vdev,
602 				qdf_list_t *peer_list,
603 				wlan_objmgr_ref_dbgid dbg_id,
604 				const char *func, int line);
605 #else
606 struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_active_head(
607 				struct wlan_objmgr_vdev *vdev,
608 				qdf_list_t *peer_list,
609 				wlan_objmgr_ref_dbgid dbg_id);
610 #endif
611 
612 /**
613  * wlan_psoc_peer_list_peek_head_ref() - get head of psoc peer list
614  *                                            with ref and lock protected
615  * @peer_list: wlan_peer_list
616  * @hash_index: peer list hash index
617  * @dbg_id: Ref count debug module id
618  *
619  * API to get the head peer of given peer (of psoc's peer list)
620  *
621  * Return: head peer
622  */
623 #ifdef WLAN_OBJMGR_REF_ID_TRACE
624 #define wlan_psoc_peer_list_peek_head_ref(peer_list, hash_index, dbg_id) \
625 		wlan_psoc_peer_list_peek_head_ref_debug(peer_list, hash_index, \
626 		dbg_id, __func__, __LINE__)
627 
628 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_head_ref_debug(
629 					struct wlan_peer_list *peer_list,
630 					uint8_t hash_index,
631 					wlan_objmgr_ref_dbgid dbg_id,
632 					const char *func, int line);
633 
634 #else
635 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_head_ref(
636 					struct wlan_peer_list *peer_list,
637 					uint8_t hash_index,
638 					wlan_objmgr_ref_dbgid dbg_id);
639 #endif
640 
641 /**
642  * wlan_psoc_peer_list_peek_active_head() - get active head of psoc peer list
643  * @peer_list: wlan_peer_list
644  * @hash_index: peer list hash index
645  * @dbg_id: Ref count debug module id
646  *
647  * API to get the head peer of given peer (of psoc's peer list)
648  *
649  * Return: head peer
650  */
651 #ifdef WLAN_OBJMGR_REF_ID_TRACE
652 #define wlan_psoc_peer_list_peek_active_head(peer_list, hash_index, dbg_id) \
653 		wlan_psoc_peer_list_peek_active_head_debug(peer_list, \
654 		hash_index, dbg_id, __func__, __LINE__)
655 
656 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_active_head_debug(
657 					struct wlan_peer_list *peer_list,
658 					uint8_t hash_index,
659 					wlan_objmgr_ref_dbgid dbg_id,
660 					const char *func, int line);
661 #else
662 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_active_head(
663 					struct wlan_peer_list *peer_list,
664 					uint8_t hash_index,
665 					wlan_objmgr_ref_dbgid dbg_id);
666 #endif
667 
668 /**
669  * wlan_psoc_peer_list_peek_head() - get head of psoc peer list
670  * @peer_list: qdf_list_t
671  *
672  * API to get the head peer of given peer (of psoc's peer list)
673  *
674  * Caller need to acquire lock with wlan_peer_obj_lock()
675  *
676  * Return: head peer
677  */
678 static inline struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_head(
679 					qdf_list_t *peer_list)
680 {
681 	struct wlan_objmgr_peer *peer;
682 	qdf_list_node_t *psoc_node = NULL;
683 
684 	/* This API is invoked with lock acquired, do not add log prints */
685 	if (qdf_list_peek_front(peer_list, &psoc_node) != QDF_STATUS_SUCCESS)
686 		return NULL;
687 
688 	peer = qdf_container_of(psoc_node, struct wlan_objmgr_peer, psoc_peer);
689 	return peer;
690 }
691 
692 /**
693  * wlan_vdev_peer_list_peek_head() - get head of vdev peer list
694  * @peer_list: qdf_list_t
695  *
696  * API to get the head peer of given peer (of vdev's peer list)
697  *
698  * Caller need to acquire lock with wlan_peer_obj_lock()
699  *
700  * Return: head peer
701  */
702 static inline struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_head(
703 					qdf_list_t *peer_list)
704 {
705 	struct wlan_objmgr_peer *peer;
706 	qdf_list_node_t *vdev_node = NULL;
707 
708 	/* This API is invoked with lock acquired, do not add log prints */
709 	if (qdf_list_peek_front(peer_list, &vdev_node) != QDF_STATUS_SUCCESS)
710 		return NULL;
711 
712 	peer = qdf_container_of(vdev_node, struct wlan_objmgr_peer, vdev_peer);
713 	return peer;
714 }
715 
716 /**
717  * wlan_peer_get_next_peer_of_vdev() - get next peer of vdev list
718  * @peer_list: PEER object list
719  * @peer: PEER object
720  *
721  * API to get the next peer of given peer (of vdev's peer list)
722  *
723  * Caller need to acquire lock with wlan_peer_obj_lock()
724  *
725  * Return: PEER object
726  */
727 static inline struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_vdev(
728 			qdf_list_t *peer_list, struct wlan_objmgr_peer *peer)
729 {
730 	struct wlan_objmgr_peer *peer_next;
731 	qdf_list_node_t *node;
732 	qdf_list_node_t *next_node = NULL;
733 
734 	/* This API is invoked with lock acquired, do not add log prints */
735 	if (!peer)
736 		return NULL;
737 
738 	node = &peer->vdev_peer;
739 	if (qdf_list_peek_next(peer_list, node, &next_node) !=
740 						QDF_STATUS_SUCCESS)
741 		return NULL;
742 
743 	peer_next = qdf_container_of(next_node, struct wlan_objmgr_peer,
744 					vdev_peer);
745 	return peer_next;
746 }
747 
748 /**
749  * wlan_peer_set_next_peer_of_vdev() - add peer to vdev peer list
750  * @peer_list: PEER object list
751  * @new_peer: PEER object
752  *
753  * API to set as the next peer to given peer (of vdev's peer list)
754  *
755  * Caller need to acquire lock with wlan_peer_obj_lock()
756  *
757  * Return: void
758  */
759 static inline void wlan_peer_set_next_peer_of_vdev(qdf_list_t *peer_list,
760 				struct wlan_objmgr_peer *new_peer)
761 {
762 	/* This API is invoked with lock acquired, do not add log prints */
763 	/* set next peer with new peer */
764 	qdf_list_insert_back(peer_list, &new_peer->vdev_peer);
765 	return;
766 }
767 
768 /**
769  * wlan_peer_get_next_peer_of_psoc() - get next peer to psoc peer list
770  * @peer_list: Peer list
771  * @peer: PEER object
772  *
773  * API to get the next peer of given peer (of psoc's peer list)
774  *
775  * Caller need to acquire lock with wlan_peer_obj_lock()
776  *
777  * Return: PEER object
778  */
779 static inline struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_psoc(
780 			qdf_list_t *peer_list, struct wlan_objmgr_peer *peer)
781 {
782 	struct wlan_objmgr_peer *peer_next;
783 	qdf_list_node_t *node = NULL;
784 	qdf_list_node_t *next_node = NULL;
785 
786 	/* This API is invoked with lock acquired, do not add log prints */
787 	if (!peer)
788 		return NULL;
789 
790 	node = &peer->psoc_peer;
791 	if (qdf_list_peek_next(peer_list, node, &next_node) !=
792 						QDF_STATUS_SUCCESS)
793 		return NULL;
794 
795 	peer_next = qdf_container_of(next_node, struct wlan_objmgr_peer,
796 					psoc_peer);
797 	return peer_next;
798 }
799 
800 /**
801  * wlan_peer_set_next_peer_of_psoc() - add peer to psoc peer list
802  * @peer_list: PEER object list
803  * @new_peer: PEER object
804  *
805  * API to set as the next peer to given peer (of psoc's peer list)
806  *
807  * Caller need to acquire lock with wlan_peer_obj_lock()
808  *
809  * Return: void
810  */
811 static inline void wlan_peer_set_next_peer_of_psoc(qdf_list_t *peer_list,
812 					struct wlan_objmgr_peer *new_peer)
813 {
814 	/* This API is invoked with lock acquired, do not add log prints */
815 	/* set next peer with new peer */
816 	qdf_list_insert_back(peer_list, &new_peer->psoc_peer);
817 	return;
818 }
819 
820 /**
821  * wlan_peer_set_peer_type() - set peer type
822  * @peer: PEER object
823  * @type: type of PEER
824  *
825  * API to set peer type
826  *
827  * Return: void
828  */
829 static inline void wlan_peer_set_peer_type(struct wlan_objmgr_peer *peer,
830 			enum wlan_peer_type type)
831 {
832 	peer->peer_mlme.peer_type = type;
833 }
834 
835 /**
836  * wlan_peer_get_peer_type() - get peer type
837  * @peer: PEER object
838  *
839  * API to get peer type
840  *
841  * Return: type of PEER
842  */
843 static inline enum wlan_peer_type wlan_peer_get_peer_type(
844 				struct wlan_objmgr_peer *peer)
845 {
846 	return peer->peer_mlme.peer_type;
847 }
848 
849 /**
850  * wlan_peer_set_phymode() - set phymode
851  * @peer: PEER object
852  * @phymode: phymode of peer
853  *
854  * API to set phymode
855  *
856  * Return: void
857  */
858 static inline void wlan_peer_set_phymode(struct wlan_objmgr_peer *peer,
859 					 enum wlan_phymode phymode)
860 {
861 	peer->peer_mlme.phymode = phymode;
862 }
863 
864 /**
865  * wlan_peer_get_phymode() - get phymode
866  * @peer: PEER object
867  *
868  * API to get phymode
869  *
870  * Return: phymode of PEER
871  */
872 static inline enum wlan_phymode wlan_peer_get_phymode(
873 				struct wlan_objmgr_peer *peer)
874 {
875 	return peer->peer_mlme.phymode;
876 }
877 
878 /**
879  * wlan_peer_set_rssi() - set RSSI
880  * @peer: PEER object
881  * @rssi: RSSI
882  *
883  * API to set rssi
884  *
885  * Return: void
886  */
887 static inline void wlan_peer_set_rssi(struct wlan_objmgr_peer *peer,
888 				      int8_t rssi)
889 {
890 	peer->peer_mlme.rssi = rssi;
891 }
892 
893 /**
894  * wlan_peer_get_rssi() - get RSSI
895  * @peer: PEER object
896  *
897  * API to get RSSI
898  *
899  * Return: RSSI of PEER
900  */
901 static inline int8_t wlan_peer_get_rssi(
902 				struct wlan_objmgr_peer *peer)
903 {
904 	return peer->peer_mlme.rssi;
905 }
906 
907 /**
908  * wlan_peer_set_macaddr() - set mac addr
909  * @peer: PEER object
910  * @macaddr: MAC address
911  *
912  * API to set peer mac address
913  *
914  * Caller need to acquire lock with wlan_peer_obj_lock()
915  *
916  * Return: void
917  */
918 static inline void wlan_peer_set_macaddr(struct wlan_objmgr_peer *peer,
919 			uint8_t *macaddr)
920 {
921 	/* This API is invoked with lock acquired, do not add log prints */
922 	WLAN_ADDR_COPY(peer->macaddr, macaddr);
923 }
924 
925 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
926 /**
927  * wlan_peer_update_macaddr() - Update peer MAC address
928  * @peer: PEER object
929  * @new_macaddr: New MAC address
930  *
931  * API to update peer MAC address and corresponding peer hash entry in PSOC
932  * peer list.
933  *
934  * Return: SUCCESS/FAILURE
935  */
936 QDF_STATUS wlan_peer_update_macaddr(struct wlan_objmgr_peer *peer,
937 				    uint8_t *new_macaddr);
938 #endif
939 
940 /**
941  * wlan_peer_get_macaddr() - get mac addr
942  * @peer: PEER object
943  *
944  * API to get peer mac address
945  *
946  * Caller need to acquire lock with wlan_peer_obj_lock()
947  *
948  * Return: MAC address
949  */
950 static inline uint8_t *wlan_peer_get_macaddr(struct wlan_objmgr_peer *peer)
951 {
952 	/* This API is invoked with lock acquired, do not add log prints */
953 	return peer->macaddr;
954 }
955 
956 /**
957  * wlan_peer_get_vdev() - get vdev
958  * @peer: PEER object
959  *
960  * API to get peer's vdev
961  *
962  * Return: VDEV object
963  */
964 static inline struct wlan_objmgr_vdev *wlan_peer_get_vdev(
965 			struct wlan_objmgr_peer *peer)
966 {
967 	return peer->peer_objmgr.vdev;
968 }
969 
970 /**
971  * wlan_peer_set_vdev() - set vdev
972  * @peer: PEER object
973  * @vdev: VDEV object
974  *
975  * API to set peer's vdev
976  *
977  * Return: void
978  */
979 static inline void wlan_peer_set_vdev(struct wlan_objmgr_peer *peer,
980 		struct wlan_objmgr_vdev *vdev)
981 {
982 	peer->peer_objmgr.vdev = vdev;
983 }
984 
985 /**
986  * wlan_peer_mlme_flag_set() - mlme flag set
987  * @peer: PEER object
988  * @flag: flag to be set
989  *
990  * API to set flag in peer
991  *
992  * Return: void
993  */
994 static inline void wlan_peer_mlme_flag_set(struct wlan_objmgr_peer *peer,
995 					   uint32_t flag)
996 {
997 	peer->peer_mlme.peer_flags |= flag;
998 }
999 
1000 /**
1001  * wlan_peer_mlme_flag_clear() - mlme flag clear
1002  * @peer: PEER object
1003  * @flag: flag to be cleared
1004  *
1005  * API to clear flag in peer
1006  *
1007  * Return: void
1008  */
1009 static inline void wlan_peer_mlme_flag_clear(struct wlan_objmgr_peer *peer,
1010 				uint32_t flag)
1011 {
1012 	peer->peer_mlme.peer_flags &= ~flag;
1013 }
1014 
1015 /**
1016  * wlan_peer_mlme_flag_get() - mlme flag get
1017  * @peer: PEER object
1018  * @flag: flag to be checked
1019  *
1020  * API to know, whether particular flag is set in peer
1021  *
1022  * Return: 1 (for set) or 0 (for not set)
1023  */
1024 static inline uint8_t wlan_peer_mlme_flag_get(struct wlan_objmgr_peer *peer,
1025 				uint32_t flag)
1026 {
1027 	return (peer->peer_mlme.peer_flags & flag) ? 1 : 0;
1028 }
1029 
1030 /**
1031  * wlan_peer_mlme_flag_ext_set() - mlme ext flag set
1032  * @peer: PEER object
1033  * @flag: ext flag to be set
1034  *
1035  * API to set ext flag in peer
1036  *
1037  * Return: void
1038  */
1039 static inline void wlan_peer_mlme_flag_ext_set(struct wlan_objmgr_peer *peer,
1040 					       uint32_t flag)
1041 {
1042 	peer->peer_mlme.peer_ext_flags |= flag;
1043 }
1044 
1045 /**
1046  * wlan_peer_mlme_flag_ext_clear() - mlme ext flag clear
1047  * @peer: PEER object
1048  * @flag: ext flag to be cleared
1049  *
1050  * API to clear ext flag in peer
1051  *
1052  * Return: void
1053  */
1054 static inline void wlan_peer_mlme_flag_ext_clear(struct wlan_objmgr_peer *peer,
1055 						 uint32_t flag)
1056 {
1057 	peer->peer_mlme.peer_ext_flags &= ~flag;
1058 }
1059 
1060 /**
1061  * wlan_peer_mlme_flag_ext_get() - mlme ext flag get
1062  * @peer: PEER object
1063  * @flag: ext flag to be checked
1064  *
1065  * API to know, whether particular ext flag is set in peer
1066  *
1067  * Return: 1 (for set) or 0 (for not set)
1068  */
1069 static inline uint8_t wlan_peer_mlme_flag_ext_get(struct wlan_objmgr_peer *peer,
1070 						  uint32_t flag)
1071 {
1072 	return (peer->peer_mlme.peer_ext_flags & flag) ? 1 : 0;
1073 }
1074 
1075 /**
1076  * wlan_peer_mlme_set_state() - peer mlme state
1077  * @peer: PEER object
1078  * @state: enum wlan_peer_state
1079  *
1080  * API to update the current peer state
1081  *
1082  * Return: void
1083  */
1084 static inline void wlan_peer_mlme_set_state(
1085 				struct wlan_objmgr_peer *peer,
1086 				enum wlan_peer_state state)
1087 {
1088 	peer->peer_mlme.state = state;
1089 }
1090 
1091 #ifdef WLAN_FEATURE_11BE_MLO
1092 /**
1093  * wlan_peer_mlme_get_mldaddr() - get peer mldaddr
1094  * @peer: PEER object
1095  *
1096  * API to get MLD address from peer object
1097  *
1098  * Return: mld address
1099  */
1100 static inline uint8_t *wlan_peer_mlme_get_mldaddr(struct wlan_objmgr_peer *peer)
1101 {
1102 	return peer->mldaddr;
1103 }
1104 
1105 /**
1106  * wlan_peer_mlme_set_mldaddr() - set peer mldaddr
1107  * @peer: PEER object
1108  * @mldaddr: MLD address
1109  *
1110  * API to set MLD addr in peer object
1111  *
1112  * Return: void
1113  */
1114 static inline void wlan_peer_mlme_set_mldaddr(struct wlan_objmgr_peer *peer,
1115 					      uint8_t *mldaddr)
1116 {
1117 	WLAN_ADDR_COPY(peer->mldaddr, mldaddr);
1118 }
1119 
1120 /**
1121  * wlan_peer_mlme_set_assoc_peer() - assoc frames is received on this peer
1122  * @peer: PEER object
1123  * @is_assoc_link: whether assoc frames is received on this peer or not
1124  *
1125  * API to update assoc peer
1126  *
1127  * Return: void
1128  */
1129 static inline void wlan_peer_mlme_set_assoc_peer(
1130 				struct wlan_objmgr_peer *peer,
1131 				bool is_assoc_link)
1132 {
1133 	peer->peer_mlme.assoc_peer = is_assoc_link;
1134 }
1135 
1136 /**
1137  * wlan_peer_mlme_is_assoc_peer() - check peer is assoc peer or not
1138  * @peer: PEER object
1139  *
1140  * API to get assoc peer info
1141  *
1142  * Return: whether assoc frames is received on this peer or not
1143  */
1144 static inline bool wlan_peer_mlme_is_assoc_peer(
1145 				struct wlan_objmgr_peer *peer)
1146 {
1147 	return peer->peer_mlme.assoc_peer;
1148 }
1149 #else
1150 
1151 static inline uint8_t *wlan_peer_mlme_get_mldaddr(struct wlan_objmgr_peer *peer)
1152 {
1153 	return NULL;
1154 }
1155 
1156 static inline void wlan_peer_mlme_set_mldaddr(struct wlan_objmgr_peer *peer,
1157 					      uint8_t *mldaddr)
1158 {
1159 }
1160 
1161 static inline void wlan_peer_mlme_set_assoc_peer(
1162 				struct wlan_objmgr_peer *peer,
1163 				bool is_assoc_link)
1164 {
1165 }
1166 
1167 static inline bool wlan_peer_mlme_is_assoc_peer(
1168 				struct wlan_objmgr_peer *peer)
1169 {
1170 	return true;
1171 }
1172 #endif
1173 
1174 /**
1175  * wlan_peer_mlme_set_auth_state() - peer mlme auth state
1176  * @peer: PEER object
1177  * @is_authenticated: true or false
1178  *
1179  * API to update the current peer auth state
1180  *
1181  * Return: void
1182  */
1183 static inline void wlan_peer_mlme_set_auth_state(
1184 				struct wlan_objmgr_peer *peer,
1185 				bool is_authenticated)
1186 {
1187 	peer->peer_mlme.is_authenticated = is_authenticated;
1188 }
1189 
1190 /**
1191  * wlan_peer_mlme_get_state() - peer mlme state
1192  * @peer: PEER object
1193  *
1194  * API to get peer state
1195  *
1196  * Return: enum wlan_peer_state
1197  */
1198 static inline enum wlan_peer_state wlan_peer_mlme_get_state(
1199 				struct wlan_objmgr_peer *peer)
1200 {
1201 	return peer->peer_mlme.state;
1202 }
1203 
1204 /**
1205  * wlan_peer_mlme_get_auth_state() - peer mlme auth state
1206  * @peer: PEER object
1207  *
1208  * API to get peer auth state
1209  *
1210  * Return: auth state true/false
1211  */
1212 static inline bool wlan_peer_mlme_get_auth_state(
1213 				struct wlan_objmgr_peer *peer)
1214 {
1215 	return peer->peer_mlme.is_authenticated;
1216 }
1217 
1218 /**
1219  * wlan_peer_mlme_get_next_seq_num() - get peer mlme next sequence number
1220  * @peer: PEER object
1221  *
1222  * API to get mlme peer next sequence number
1223  *
1224  * Caller need to acquire lock with wlan_peer_obj_lock()
1225  *
1226  * Return: peer mlme next sequence number
1227  */
1228 static inline uint32_t wlan_peer_mlme_get_next_seq_num(
1229 				struct wlan_objmgr_peer *peer)
1230 {
1231 	/* This API is invoked with lock acquired, do not add log prints */
1232 	if (peer->peer_mlme.seq_num < WLAN_MAX_SEQ_NUM)
1233 		peer->peer_mlme.seq_num++;
1234 	else
1235 		peer->peer_mlme.seq_num = 0;
1236 
1237 	return peer->peer_mlme.seq_num;
1238 }
1239 
1240 /**
1241  * wlan_peer_mlme_get_seq_num() - get peer mlme sequence number
1242  * @peer: PEER object
1243  *
1244  * API to get mlme peer sequence number
1245  *
1246  * Caller need to acquire lock with wlan_peer_obj_lock()
1247  *
1248  * Return: peer mlme sequence number
1249  */
1250 static inline uint32_t wlan_peer_mlme_get_seq_num(
1251 				struct wlan_objmgr_peer *peer)
1252 {
1253 	/* This API is invoked with lock acquired, do not add log prints */
1254 	return peer->peer_mlme.seq_num;
1255 }
1256 
1257 /**
1258  * wlan_peer_mlme_reset_seq_num() - reset peer mlme sequence number
1259  * @peer: PEER object
1260  *
1261  * API to reset peer sequence number
1262  *
1263  * Caller need to acquire lock with wlan_peer_obj_lock()
1264  *
1265  * Return: void
1266  */
1267 static inline void wlan_peer_mlme_reset_seq_num(
1268 				struct wlan_objmgr_peer *peer)
1269 {
1270 	/* This API is invoked with lock acquired, do not add log prints */
1271 	peer->peer_mlme.seq_num = 0;
1272 }
1273 
1274 /**
1275  * wlan_peer_get_psoc() - get psoc
1276  * @peer: PEER object
1277  *
1278  * API to get peer's psoc
1279  *
1280  * Return: PSOC object or NULL if the psoc can not be found
1281  */
1282 static inline struct wlan_objmgr_psoc *wlan_peer_get_psoc(
1283 			struct wlan_objmgr_peer *peer)
1284 {
1285 	struct wlan_objmgr_vdev *vdev;
1286 	struct wlan_objmgr_psoc *psoc;
1287 
1288 	vdev = wlan_peer_get_vdev(peer);
1289 	if (!vdev)
1290 		return NULL;
1291 
1292 	psoc = wlan_vdev_get_psoc(vdev);
1293 
1294 	return psoc;
1295 }
1296 
1297 /**
1298  * wlan_peer_get_psoc_id() - get psoc id
1299  * @peer: PEER object
1300  *
1301  * API to get peer's psoc id
1302  *
1303  * Return: @psoc_id: psoc id
1304  */
1305 static inline uint8_t wlan_peer_get_psoc_id(struct wlan_objmgr_peer *peer)
1306 {
1307 	struct wlan_objmgr_psoc *psoc;
1308 
1309 	psoc = wlan_peer_get_psoc(peer);
1310 
1311 	return wlan_psoc_get_id(psoc);
1312 }
1313 
1314 /*
1315  * wlan_peer_get_pdev_id() - get pdev id
1316  * @peer: peer object pointer
1317  *
1318  * Return: pdev id
1319  */
1320 static inline uint8_t wlan_peer_get_pdev_id(struct wlan_objmgr_peer *peer)
1321 {
1322 	return peer->pdev_id;
1323 }
1324 
1325 /**
1326  * wlan_peer_set_pdev_id() - set pdev id
1327  * @peer: peer object pointer
1328  * @pdev_id: pdev id
1329  *
1330  * Return: void
1331  */
1332 static inline void wlan_peer_set_pdev_id(struct wlan_objmgr_peer *peer,
1333 					 uint8_t pdev_id)
1334 {
1335 	peer->pdev_id = pdev_id;
1336 }
1337 
1338 /**
1339  * wlan_objmgr_print_peer_ref_ids() - print peer object refs
1340  * @peer: peer object pointer
1341  * @log_level: log level
1342  *
1343  * Return: void
1344  */
1345 void wlan_objmgr_print_peer_ref_ids(struct wlan_objmgr_peer *peer,
1346 				    QDF_TRACE_LEVEL log_level);
1347 
1348 /**
1349  * wlan_objmgr_peer_get_comp_ref_cnt() - get component ref count for a peer
1350  * @peer: peer object pointer
1351  * @id: component id
1352  *
1353  * Return: uint32_t
1354  */
1355 uint32_t
1356 wlan_objmgr_peer_get_comp_ref_cnt(struct wlan_objmgr_peer *peer,
1357 				  enum wlan_umac_comp_id id);
1358 
1359 /**
1360  * wlan_objmgr_peer_trace_init_lock() - Initialize peer trace lock
1361  * @peer: peer object pointer
1362  *
1363  * Return: void
1364  */
1365 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1366 static inline void
1367 wlan_objmgr_peer_trace_init_lock(struct wlan_objmgr_peer *peer)
1368 {
1369 	wlan_objmgr_trace_init_lock(&peer->peer_objmgr.trace);
1370 }
1371 #else
1372 static inline void
1373 wlan_objmgr_peer_trace_init_lock(struct wlan_objmgr_peer *peer)
1374 {
1375 }
1376 #endif
1377 
1378 /**
1379  * wlan_objmgr_peer_trace_deinit_lock() - Deinitialize peer trace lock
1380  * @peer: peer object pointer
1381  *
1382  * Return: void
1383  */
1384 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1385 static inline void
1386 wlan_objmgr_peer_trace_deinit_lock(struct wlan_objmgr_peer *peer)
1387 {
1388 	wlan_objmgr_trace_deinit_lock(&peer->peer_objmgr.trace);
1389 }
1390 #else
1391 static inline void
1392 wlan_objmgr_peer_trace_deinit_lock(struct wlan_objmgr_peer *peer)
1393 {
1394 }
1395 #endif
1396 
1397 /**
1398  * wlan_objmgr_peer_trace_del_ref_list() - Delete peer trace reference list
1399  * @peer: peer object pointer
1400  *
1401  * Return: void
1402  */
1403 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1404 static inline void
1405 wlan_objmgr_peer_trace_del_ref_list(struct wlan_objmgr_peer *peer)
1406 {
1407 	wlan_objmgr_trace_del_ref_list(&peer->peer_objmgr.trace);
1408 }
1409 #else
1410 static inline void
1411 wlan_objmgr_peer_trace_del_ref_list(struct wlan_objmgr_peer *peer)
1412 {
1413 }
1414 #endif
1415 
1416 #endif /* _WLAN_OBJMGR_PEER_OBJ_H_*/
1417