1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2022 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 * @assoc_peer: assoc req/response is handled in this peer 136 */ 137 struct wlan_objmgr_peer_mlme { 138 uint32_t peer_capinfo; 139 uint32_t peer_flags; 140 uint32_t peer_ext_flags; 141 enum wlan_peer_type peer_type; 142 enum wlan_phymode phymode; 143 uint32_t max_rate; 144 enum wlan_peer_state state; 145 uint16_t seq_num; 146 int8_t rssi; 147 bool is_authenticated; 148 #ifdef WLAN_FEATURE_11BE_MLO 149 bool assoc_peer; 150 #endif 151 }; 152 153 /** 154 * struct wlan_objmgr_peer_objmgr - object manager data of peer 155 * @vdev: VDEV pointer to which it is associated 156 * @ref_cnt: Ref count 157 * @ref_id_dbg: Array to track Ref count 158 * @print_cnt: Count to throttle Logical delete prints 159 * @wlan_objmgr_trace: Trace ref and deref 160 */ 161 struct wlan_objmgr_peer_objmgr { 162 struct wlan_objmgr_vdev *vdev; 163 qdf_atomic_t ref_cnt; 164 #ifdef WLAN_OBJMGR_REF_ID_DEBUG 165 qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX]; 166 #endif 167 uint8_t print_cnt; 168 #ifdef WLAN_OBJMGR_REF_ID_TRACE 169 struct wlan_objmgr_trace trace; 170 #endif 171 }; 172 173 /** 174 * struct wlan_objmgr_peer - PEER common object 175 * @psoc_peer: peer list node for psoc's qdf list 176 * @vdev_peer: peer list node for vdev's qdf list 177 * @free_node: peer list node for free in a delayed work 178 * @macaddr[]: Peer MAC address 179 * @peer_mlme: Peer MLME common structure 180 * @peer_objmgr: Peer Object manager common structure 181 * @peer_comp_priv_obj[]: Component's private object pointers 182 * @obj_status[]: status of each component object 183 * @obj_state: Status of Peer object 184 * @pdev_id: Pdev ID 185 * @peer_lock: Lock for access/update peer contents 186 * @mlo_peer_ctx: Reference to MLO Peer context 187 * @mldaddr: Peer MLD MAC address 188 */ 189 struct wlan_objmgr_peer { 190 qdf_list_node_t psoc_peer; 191 qdf_list_node_t vdev_peer; 192 #ifdef FEATURE_DELAYED_PEER_OBJ_DESTROY 193 qdf_list_node_t free_node; 194 #endif 195 uint8_t macaddr[QDF_MAC_ADDR_SIZE]; 196 uint8_t pdev_id; 197 struct wlan_objmgr_peer_mlme peer_mlme; 198 struct wlan_objmgr_peer_objmgr peer_objmgr; 199 void *peer_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS]; 200 QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS]; 201 WLAN_OBJ_STATE obj_state; 202 qdf_spinlock_t peer_lock; 203 #ifdef WLAN_FEATURE_11BE_MLO 204 struct wlan_mlo_peer_context *mlo_peer_ctx; 205 uint8_t mldaddr[QDF_MAC_ADDR_SIZE]; 206 #endif 207 }; 208 209 /** 210 ** APIs to Create/Delete Global object APIs 211 */ 212 /** 213 * wlan_objmgr_peer_obj_create() - peer object create 214 * @vdev: VDEV object on which this peer gets created 215 * @peer_type: peer type (AP/STA) 216 * @macaddr: MAC address 217 * 218 * Creates Peer object, initializes with default values 219 * Attaches to psoc and vdev objects 220 * Invokes the registered notifiers to create component object 221 * 222 * Return: Handle to struct wlan_objmgr_peer on successful creation, 223 * NULL on Failure (on Mem alloc failure and Component objects 224 * Failure) 225 */ 226 struct wlan_objmgr_peer *wlan_objmgr_peer_obj_create( 227 struct wlan_objmgr_vdev *vdev, 228 enum wlan_peer_type type, 229 uint8_t macaddr[]); 230 231 /** 232 * wlan_objmgr_peer_obj_delete() - peer object delete 233 * @peer: PEER object 234 * 235 * Deletes PEER object, removes it from PSOC's, VDEV's peer list 236 * Invokes the registered notifiers to destroy component objects 237 * 238 * Return: SUCCESS/FAILURE 239 */ 240 QDF_STATUS wlan_objmgr_peer_obj_delete(struct wlan_objmgr_peer *peer); 241 242 #ifdef FEATURE_DELAYED_PEER_OBJ_DESTROY 243 /** 244 * wlan_delayed_peer_obj_free_init() - Init for delayed peer obj freed queue 245 * @data: PDEV object 246 * 247 * Initialize main data structures to process peer obj destroy in a delayed 248 * workqueue. 249 * 250 * Return: QDF_STATUS_SUCCESS on success else a QDF error. 251 */ 252 QDF_STATUS wlan_delayed_peer_obj_free_init(void *data); 253 254 /** 255 * wlan_delayed_peer_obj_free_deinit() - De-Init delayed peer freed processing 256 * @data: PDEV object 257 * 258 * De-initialize main data structures to process peer obj freed in a delayed 259 * workqueue. 260 * 261 * Return: QDF_STATUS_SUCCESS on success else a QDF error. 262 */ 263 QDF_STATUS wlan_delayed_peer_obj_free_deinit(void *data); 264 #else 265 static inline QDF_STATUS wlan_delayed_peer_obj_free_init(void *data) 266 { 267 return QDF_STATUS_SUCCESS; 268 } 269 270 static inline QDF_STATUS wlan_delayed_peer_obj_free_deinit(void *data) 271 { 272 return QDF_STATUS_SUCCESS; 273 } 274 #endif 275 276 /** 277 ** APIs to attach/detach component objects 278 */ 279 /** 280 * wlan_objmgr_peer_component_obj_attach() - attach comp object to peer 281 * @peer: PEER object 282 * @id: Component id 283 * @comp_priv_obj: component's private object pointer 284 * @status: Component's private object creation status 285 * 286 * API to be used for attaching component object with PEER common object 287 * 288 * Return: SUCCESS on successful storing of component's object in common object 289 * On FAILURE (appropriate failure codes are returned) 290 */ 291 QDF_STATUS wlan_objmgr_peer_component_obj_attach( 292 struct wlan_objmgr_peer *peer, 293 enum wlan_umac_comp_id id, 294 void *comp_priv_obj, 295 QDF_STATUS status); 296 297 /** 298 * wlan_objmgr_peer_component_obj_detach() - detach comp object from peer 299 * @peer: PEER object 300 * @id: Component id 301 * @comp_priv_obj: component's private object pointer 302 * 303 * API to be used for detaching component object with PEER common object 304 * 305 * Return: SUCCESS on successful removal of component's object from common 306 * object 307 * On FAILURE (appropriate failure codes are returned) 308 */ 309 QDF_STATUS wlan_objmgr_peer_component_obj_detach( 310 struct wlan_objmgr_peer *peer, 311 enum wlan_umac_comp_id id, 312 void *comp_priv_obj); 313 314 /** 315 ** APIs to operations on peer objects 316 */ 317 318 /** 319 * wlan_objmgr_trigger_peer_comp_priv_object_creation() - create 320 * peer comp object 321 * @peer: PEER object 322 * @id: Component id 323 * 324 * API to create component private object in run time, this would 325 * be used for features which gets enabled in run time 326 * 327 * Return: SUCCESS on successful creation 328 * On FAILURE (appropriate failure codes are returned) 329 */ 330 QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_creation( 331 struct wlan_objmgr_peer *peer, 332 enum wlan_umac_comp_id id); 333 334 /** 335 * wlan_objmgr_trigger_peer_comp_priv_object_deletion() - destroy 336 * peer comp object 337 * @peer: PEER object 338 * @id: Component id 339 * 340 * API to destroy component private object in run time, this would 341 * be used for features which gets disabled in run time 342 * 343 * Return: SUCCESS on successful deletion 344 * On FAILURE (appropriate failure codes are returned) 345 */ 346 QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_deletion( 347 struct wlan_objmgr_peer *peer, 348 enum wlan_umac_comp_id id); 349 350 /** 351 * wlan_objmgr_peer_get_comp_private_obj() - get peer component private object 352 * @peer: PEER object 353 * @id: Component id 354 * 355 * API to get component private object 356 * 357 * Return: void *ptr on SUCCESS 358 * NULL on Failure 359 */ 360 void *wlan_objmgr_peer_get_comp_private_obj( 361 struct wlan_objmgr_peer *peer, 362 enum wlan_umac_comp_id id); 363 364 /** 365 * wlan_peer_obj_lock() - Acquire PEER spinlock 366 * @psoc: PEER object 367 * 368 * API to acquire PEER spin lock 369 * Parent lock should not be taken in child lock context 370 * but child lock can be taken in parent lock context 371 * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context) 372 * 373 * Return: void 374 */ 375 static inline void wlan_peer_obj_lock(struct wlan_objmgr_peer *peer) 376 { 377 qdf_spin_lock_bh(&peer->peer_lock); 378 } 379 380 /** 381 * wlan_peer_obj_unlock() - Release PEER spinlock 382 * @peer: PEER object 383 * 384 * API to Release PEER spin lock 385 * 386 * Return: void 387 */ 388 static inline void wlan_peer_obj_unlock(struct wlan_objmgr_peer *peer) 389 { 390 qdf_spin_unlock_bh(&peer->peer_lock); 391 } 392 393 /** 394 * DOC: Examples to use PEER ref count APIs 395 * 396 * In all the scenarios, the pair of API should be followed 397 * other it lead to memory leak 398 * 399 * scenario 1: 400 * 401 * wlan_objmgr_peer_obj_create() 402 * ---- 403 * wlan_objmgr_peer_obj_delete() 404 * 405 * scenario 2: 406 * 407 * wlan_objmgr_peer_get_ref() 408 * ---- 409 * the operations which are done on 410 * peer object 411 * ---- 412 * wlan_objmgr_peer_release_ref() 413 * 414 * scenario 3: 415 * 416 * API to retrieve peer (xxx_get_peer_xxx()) 417 * ---- 418 * the operations which are done on 419 * peer object 420 * ---- 421 * wlan_objmgr_peer_release_ref() 422 */ 423 424 /** 425 * wlan_objmgr_peer_get_ref() - increment ref count 426 * @peer: PEER object 427 * @id: Object Manager ref debug id 428 * 429 * API to increment ref count of peer 430 * 431 * Return: void 432 */ 433 #ifdef WLAN_OBJMGR_REF_ID_TRACE 434 void wlan_objmgr_peer_get_ref_debug(struct wlan_objmgr_peer *peer, 435 wlan_objmgr_ref_dbgid id, 436 const char *func, int line); 437 438 #define wlan_objmgr_peer_get_ref(peer, dbgid) \ 439 wlan_objmgr_peer_get_ref_debug(peer, dbgid, __func__, __LINE__) 440 #else 441 void wlan_objmgr_peer_get_ref(struct wlan_objmgr_peer *peer, 442 wlan_objmgr_ref_dbgid id); 443 #endif 444 445 /** 446 * wlan_objmgr_peer_try_get_ref() - increment ref count, if allowed 447 * @peer: PEER object 448 * @id: Object Manager ref debug id 449 * 450 * API to increment ref count of peer, if object state is valid 451 * 452 * Return: void 453 */ 454 #ifdef WLAN_OBJMGR_REF_ID_TRACE 455 QDF_STATUS wlan_objmgr_peer_try_get_ref_debug(struct wlan_objmgr_peer *peer, 456 wlan_objmgr_ref_dbgid id, 457 const char *func, int line); 458 459 #define wlan_objmgr_peer_try_get_ref(peer, dbgid) \ 460 wlan_objmgr_peer_try_get_ref_debug(peer, dbgid, \ 461 __func__, __LINE__) 462 #else 463 QDF_STATUS wlan_objmgr_peer_try_get_ref(struct wlan_objmgr_peer *peer, 464 wlan_objmgr_ref_dbgid id); 465 #endif 466 467 /** 468 * wlan_objmgr_peer_release_ref() - decrement ref count 469 * @peer: PEER object 470 * @id: Object Manager ref debug id 471 * 472 * API to decrement ref count of peer, if ref count is 1, it initiates the 473 * peer deletion 474 * 475 * Return: void 476 */ 477 #ifdef WLAN_OBJMGR_REF_ID_TRACE 478 void wlan_objmgr_peer_release_ref_debug(struct wlan_objmgr_peer *peer, 479 wlan_objmgr_ref_dbgid id, 480 const char *func, int line); 481 482 #define wlan_objmgr_peer_release_ref(peer, dbgid) \ 483 wlan_objmgr_peer_release_ref_debug(peer, dbgid, \ 484 __func__, __LINE__) 485 #else 486 void wlan_objmgr_peer_release_ref(struct wlan_objmgr_peer *peer, 487 wlan_objmgr_ref_dbgid id); 488 #endif 489 490 /** 491 * wlan_peer_get_next_peer_of_psoc_ref() - get next peer to psoc peer list 492 * with lock and ref taken 493 * @peer_list: Peer list 494 * @hash_index: peer list hash index 495 * @peer: PEER object 496 * @dbg_id: Ref count debug module id 497 * 498 * API to get the next peer of given peer (of psoc's peer list) 499 * 500 * Return: 501 * @next_peer: PEER object 502 */ 503 #ifdef WLAN_OBJMGR_REF_ID_TRACE 504 struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_psoc_ref_debug( 505 struct wlan_peer_list *peer_list, 506 uint8_t hash_index, 507 struct wlan_objmgr_peer *peer, 508 wlan_objmgr_ref_dbgid dbg_id, 509 const char *func, int line); 510 511 #define wlan_peer_get_next_peer_of_psoc_ref(peer_list, hash_index, peer, \ 512 dbgid) \ 513 wlan_peer_get_next_peer_of_psoc_ref_debug(peer_list, \ 514 hash_index, peer, dbgid, __func__, __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: 534 * @next_peer: PEER object 535 */ 536 #ifdef WLAN_OBJMGR_REF_ID_TRACE 537 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_psoc_debug( 538 struct wlan_peer_list *peer_list, 539 uint8_t hash_index, 540 struct wlan_objmgr_peer *peer, 541 wlan_objmgr_ref_dbgid dbg_id, 542 const char *func, int line); 543 544 #define wlan_peer_get_next_active_peer_of_psoc(peer_list, hash_index, \ 545 peer, dbgid) \ 546 wlan_peer_get_next_active_peer_of_psoc_debug(peer_list, \ 547 hash_index, peer, dbgid, __func__, __LINE__) 548 #else 549 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_psoc( 550 struct wlan_peer_list *peer_list, 551 uint8_t hash_index, 552 struct wlan_objmgr_peer *peer, 553 wlan_objmgr_ref_dbgid dbg_id); 554 #endif 555 556 /** 557 * wlan_peer_get_next_active_peer_of_vdev() - get next active_peer of vdev list 558 * @vdev: VDEV object 559 * @peer_list: Peer object list 560 * @peer: PEER object 561 * @dbg_id: Ref count debug module id 562 * 563 * API to get the next active peer of given peer (of vdev's peer list) 564 * 565 * Return: 566 * @next_peer: PEER object 567 */ 568 #ifdef WLAN_OBJMGR_REF_ID_TRACE 569 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_vdev_debug( 570 struct wlan_objmgr_vdev *vdev, 571 qdf_list_t *peer_list, 572 struct wlan_objmgr_peer *peer, 573 wlan_objmgr_ref_dbgid dbg_id, 574 const char *func, int line); 575 576 #define wlan_peer_get_next_active_peer_of_vdev(vdev, peer_list, peer, dbgid) \ 577 wlan_peer_get_next_active_peer_of_vdev_debug(vdev, peer_list, \ 578 peer, dbgid, __func__, __LINE__) 579 #else 580 struct wlan_objmgr_peer *wlan_peer_get_next_active_peer_of_vdev( 581 struct wlan_objmgr_vdev *vdev, 582 qdf_list_t *peer_list, 583 struct wlan_objmgr_peer *peer, 584 wlan_objmgr_ref_dbgid dbg_id); 585 #endif 586 587 /** 588 * wlan_vdev_peer_list_peek_active_head() - get active head of vdev peer list 589 * @vdev: VDEV object 590 * @peer_list: qdf_list_t 591 * @dbg_id: Ref count debug module id 592 * 593 * API to get the active head peer of given peer (of vdev's peer list) 594 * 595 * Return: 596 * @peer: active head peer 597 */ 598 #ifdef WLAN_OBJMGR_REF_ID_TRACE 599 struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_active_head_debug( 600 struct wlan_objmgr_vdev *vdev, 601 qdf_list_t *peer_list, 602 wlan_objmgr_ref_dbgid dbg_id, 603 const char *func, int line); 604 605 #define wlan_vdev_peer_list_peek_active_head(vdev, peer_list, dbgid) \ 606 wlan_vdev_peer_list_peek_active_head_debug(vdev, peer_list, \ 607 dbgid, __func__, __LINE__) 608 #else 609 struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_active_head( 610 struct wlan_objmgr_vdev *vdev, 611 qdf_list_t *peer_list, 612 wlan_objmgr_ref_dbgid dbg_id); 613 #endif 614 615 /** 616 * wlan_psoc_peer_list_peek_head_ref() - get head of psoc peer list 617 * with ref and lock protected 618 * @peer_list: wlan_peer_list 619 * @hash_index: peer list hash index 620 * @dbg_id: Ref count debug module id 621 * 622 * API to get the head peer of given peer (of psoc's peer list) 623 * 624 * Return: 625 * @peer: head peer 626 */ 627 #ifdef WLAN_OBJMGR_REF_ID_TRACE 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 #define wlan_psoc_peer_list_peek_head_ref(peer_list, hash_index, dbgid) \ 635 wlan_psoc_peer_list_peek_head_ref_debug(peer_list, hash_index, \ 636 dbgid, __func__, __LINE__) 637 #else 638 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_head_ref( 639 struct wlan_peer_list *peer_list, 640 uint8_t hash_index, 641 wlan_objmgr_ref_dbgid dbg_id); 642 #endif 643 644 /** 645 * wlan_psoc_peer_list_peek_active_head() - get active head of psoc peer list 646 * @peer_list: wlan_peer_list 647 * @hash_index: peer list hash index 648 * @dbg_id: Ref count debug module id 649 * 650 * API to get the head peer of given peer (of psoc's peer list) 651 * 652 * Return: 653 * @peer: head peer 654 */ 655 #ifdef WLAN_OBJMGR_REF_ID_TRACE 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 662 #define wlan_psoc_peer_list_peek_active_head(peer_list, hash_index, dbgid) \ 663 wlan_psoc_peer_list_peek_active_head_debug(peer_list, \ 664 hash_index, dbgid, __func__, __LINE__) 665 #else 666 struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_active_head( 667 struct wlan_peer_list *peer_list, 668 uint8_t hash_index, 669 wlan_objmgr_ref_dbgid dbg_id); 670 #endif 671 672 /** 673 * wlan_psoc_peer_list_peek_head() - get head of psoc peer list 674 * @peer_list: qdf_list_t 675 * 676 * API to get the head peer of given peer (of psoc's peer list) 677 * 678 * Caller need to acquire lock with wlan_peer_obj_lock() 679 * 680 * Return: 681 * @peer: head peer 682 */ 683 static inline struct wlan_objmgr_peer *wlan_psoc_peer_list_peek_head( 684 qdf_list_t *peer_list) 685 { 686 struct wlan_objmgr_peer *peer; 687 qdf_list_node_t *psoc_node = NULL; 688 689 /* This API is invoked with lock acquired, do not add log prints */ 690 if (qdf_list_peek_front(peer_list, &psoc_node) != QDF_STATUS_SUCCESS) 691 return NULL; 692 693 peer = qdf_container_of(psoc_node, struct wlan_objmgr_peer, psoc_peer); 694 return peer; 695 } 696 697 /** 698 * wlan_vdev_peer_list_peek_head() - get head of vdev peer list 699 * @peer_list: qdf_list_t 700 * 701 * API to get the head peer of given peer (of vdev's peer list) 702 * 703 * Caller need to acquire lock with wlan_peer_obj_lock() 704 * 705 * Return: 706 * @peer: head peer 707 */ 708 static inline struct wlan_objmgr_peer *wlan_vdev_peer_list_peek_head( 709 qdf_list_t *peer_list) 710 { 711 struct wlan_objmgr_peer *peer; 712 qdf_list_node_t *vdev_node = NULL; 713 714 /* This API is invoked with lock acquired, do not add log prints */ 715 if (qdf_list_peek_front(peer_list, &vdev_node) != QDF_STATUS_SUCCESS) 716 return NULL; 717 718 peer = qdf_container_of(vdev_node, struct wlan_objmgr_peer, vdev_peer); 719 return peer; 720 } 721 722 /** 723 * wlan_peer_get_next_peer_of_vdev() - get next peer of vdev list 724 * @peer: PEER object 725 * 726 * API to get the next peer of given peer (of vdev's peer list) 727 * 728 * Caller need to acquire lock with wlan_peer_obj_lock() 729 * 730 * Return: 731 * @next_peer: PEER object 732 */ 733 static inline struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_vdev( 734 qdf_list_t *peer_list, struct wlan_objmgr_peer *peer) 735 { 736 struct wlan_objmgr_peer *peer_next; 737 qdf_list_node_t *node; 738 qdf_list_node_t *next_node = NULL; 739 740 /* This API is invoked with lock acquired, do not add log prints */ 741 if (!peer) 742 return NULL; 743 744 node = &peer->vdev_peer; 745 if (qdf_list_peek_next(peer_list, node, &next_node) != 746 QDF_STATUS_SUCCESS) 747 return NULL; 748 749 peer_next = qdf_container_of(next_node, struct wlan_objmgr_peer, 750 vdev_peer); 751 return peer_next; 752 } 753 754 /** 755 * wlan_peer_set_next_peer_of_vdev() - add peer to vdev peer list 756 * @peer: PEER object 757 * @new_peer: PEER object 758 * 759 * API to set as the next peer to given peer (of vdev's peer list) 760 * 761 * Caller need to acquire lock with wlan_peer_obj_lock() 762 * 763 * Return: void 764 */ 765 static inline void wlan_peer_set_next_peer_of_vdev(qdf_list_t *peer_list, 766 struct wlan_objmgr_peer *new_peer) 767 { 768 /* This API is invoked with lock acquired, do not add log prints */ 769 /* set next peer with new peer */ 770 qdf_list_insert_back(peer_list, &new_peer->vdev_peer); 771 return; 772 } 773 774 /** 775 * wlan_peer_get_next_peer_of_psoc() - get next peer to psoc peer list 776 * @peer_list: Peer list 777 * @peer: PEER object 778 * 779 * API to get the next peer of given peer (of psoc's peer list) 780 * 781 * Caller need to acquire lock with wlan_peer_obj_lock() 782 * 783 * Return: 784 * @next_peer: PEER object 785 */ 786 static inline struct wlan_objmgr_peer *wlan_peer_get_next_peer_of_psoc( 787 qdf_list_t *peer_list, struct wlan_objmgr_peer *peer) 788 { 789 struct wlan_objmgr_peer *peer_next; 790 qdf_list_node_t *node = NULL; 791 qdf_list_node_t *next_node = NULL; 792 793 /* This API is invoked with lock acquired, do not add log prints */ 794 if (!peer) 795 return NULL; 796 797 node = &peer->psoc_peer; 798 if (qdf_list_peek_next(peer_list, node, &next_node) != 799 QDF_STATUS_SUCCESS) 800 return NULL; 801 802 peer_next = qdf_container_of(next_node, struct wlan_objmgr_peer, 803 psoc_peer); 804 return peer_next; 805 } 806 807 /** 808 * wlan_peer_set_next_peer_of_psoc() - add peer to psoc peer list 809 * @peer: PEER object 810 * @new_peer: PEER object 811 * 812 * API to set as the next peer to given peer (of psoc's peer list) 813 * 814 * Caller need to acquire lock with wlan_peer_obj_lock() 815 * 816 * Return: void 817 */ 818 static inline void wlan_peer_set_next_peer_of_psoc(qdf_list_t *peer_list, 819 struct wlan_objmgr_peer *new_peer) 820 { 821 /* This API is invoked with lock acquired, do not add log prints */ 822 /* set next peer with new peer */ 823 qdf_list_insert_back(peer_list, &new_peer->psoc_peer); 824 return; 825 } 826 827 /** 828 * wlan_peer_set_peer_type() - set peer type 829 * @peer: PEER object 830 * @peer_type: type of PEER 831 * 832 * API to set peer type 833 * 834 * Return: void 835 */ 836 static inline void wlan_peer_set_peer_type(struct wlan_objmgr_peer *peer, 837 enum wlan_peer_type type) 838 { 839 peer->peer_mlme.peer_type = type; 840 } 841 842 /** 843 * wlan_peer_get_peer_type() - get peer type 844 * @peer: PEER object 845 * 846 * API to get peer type 847 * 848 * Return: 849 * @peer_type: type of PEER 850 */ 851 static inline enum wlan_peer_type wlan_peer_get_peer_type( 852 struct wlan_objmgr_peer *peer) 853 { 854 return peer->peer_mlme.peer_type; 855 } 856 857 /** 858 * wlan_peer_set_phymode() - set phymode 859 * @peer: PEER object 860 * @phymode: phymode of peer 861 * 862 * API to set phymode 863 * 864 * Return: void 865 */ 866 static inline void wlan_peer_set_phymode(struct wlan_objmgr_peer *peer, 867 enum wlan_phymode phymode) 868 { 869 peer->peer_mlme.phymode = phymode; 870 } 871 872 /** 873 * wlan_peer_get_phymode() - get phymode 874 * @peer: PEER object 875 * 876 * API to get phymode 877 * 878 * Return: 879 * @phymode: phymode of PEER 880 */ 881 static inline enum wlan_phymode wlan_peer_get_phymode( 882 struct wlan_objmgr_peer *peer) 883 { 884 return peer->peer_mlme.phymode; 885 } 886 887 /** 888 * wlan_peer_set_rssi() - set RSSI 889 * @peer: PEER object 890 * @rssi: RSSI 891 * 892 * API to set rssi 893 * 894 * Return: void 895 */ 896 static inline void wlan_peer_set_rssi(struct wlan_objmgr_peer *peer, 897 int8_t rssi) 898 { 899 peer->peer_mlme.rssi = rssi; 900 } 901 902 /** 903 * wlan_peer_get_rssi() - get RSSI 904 * @peer: PEER object 905 * 906 * API to get RSSI 907 * 908 * Return: 909 * @rssi: RSSI of PEER 910 */ 911 static inline int8_t wlan_peer_get_rssi( 912 struct wlan_objmgr_peer *peer) 913 { 914 return peer->peer_mlme.rssi; 915 } 916 917 /** 918 * wlan_peer_set_macaddr() - set mac addr 919 * @peer: PEER object 920 * @macaddr: MAC address 921 * 922 * API to set peer mac address 923 * 924 * Caller need to acquire lock with wlan_peer_obj_lock() 925 * 926 * Return: void 927 */ 928 static inline void wlan_peer_set_macaddr(struct wlan_objmgr_peer *peer, 929 uint8_t *macaddr) 930 { 931 /* This API is invoked with lock acquired, do not add log prints */ 932 WLAN_ADDR_COPY(peer->macaddr, macaddr); 933 } 934 935 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE 936 /** 937 * wlan_peer_update_macaddr() - Update peer MAC address 938 * @peer: PEER object 939 * @new_macaddr: New MAC address 940 * 941 * API to update peer MAC address and corresponding peer hash entry in PSOC 942 * peer list. 943 * 944 * Return: SUCCESS/FAILURE 945 */ 946 QDF_STATUS wlan_peer_update_macaddr(struct wlan_objmgr_peer *peer, 947 uint8_t *new_macaddr); 948 #endif 949 950 /** 951 * wlan_peer_get_macaddr() - get mac addr 952 * @peer: PEER object 953 * 954 * API to get peer mac address 955 * 956 * Caller need to acquire lock with wlan_peer_obj_lock() 957 * 958 * Return: 959 * @macaddr: MAC address 960 */ 961 static inline uint8_t *wlan_peer_get_macaddr(struct wlan_objmgr_peer *peer) 962 { 963 /* This API is invoked with lock acquired, do not add log prints */ 964 return peer->macaddr; 965 } 966 967 /** 968 * wlan_peer_get_vdev() - get vdev 969 * @peer: PEER object 970 * 971 * API to get peer's vdev 972 * 973 * Return: 974 * @vdev: VDEV object 975 */ 976 static inline struct wlan_objmgr_vdev *wlan_peer_get_vdev( 977 struct wlan_objmgr_peer *peer) 978 { 979 return peer->peer_objmgr.vdev; 980 } 981 982 /** 983 * wlan_peer_set_vdev() - set vdev 984 * @peer: PEER object 985 * @vdev: VDEV object 986 * 987 * API to set peer's vdev 988 * 989 * Return: void 990 */ 991 static inline void wlan_peer_set_vdev(struct wlan_objmgr_peer *peer, 992 struct wlan_objmgr_vdev *vdev) 993 { 994 peer->peer_objmgr.vdev = vdev; 995 } 996 997 /** 998 * wlan_peer_mlme_flag_set() - mlme flag set 999 * @peer: PEER object 1000 * @flag: flag to be set 1001 * 1002 * API to set flag in peer 1003 * 1004 * Return: void 1005 */ 1006 static inline void wlan_peer_mlme_flag_set(struct wlan_objmgr_peer *peer, 1007 uint32_t flag) 1008 { 1009 peer->peer_mlme.peer_flags |= flag; 1010 } 1011 1012 /** 1013 * wlan_peer_mlme_flag_clear() - mlme flag clear 1014 * @peer: PEER object 1015 * @flag: flag to be cleared 1016 * 1017 * API to clear flag in peer 1018 * 1019 * Return: void 1020 */ 1021 static inline void wlan_peer_mlme_flag_clear(struct wlan_objmgr_peer *peer, 1022 uint32_t flag) 1023 { 1024 peer->peer_mlme.peer_flags &= ~flag; 1025 } 1026 1027 /** 1028 * wlan_peer_mlme_flag_get() - mlme flag get 1029 * @peer: PEER object 1030 * @flag: flag to be checked 1031 * 1032 * API to know, whether particular flag is set in peer 1033 * 1034 * Return: 1 (for set) or 0 (for not set) 1035 */ 1036 static inline uint8_t wlan_peer_mlme_flag_get(struct wlan_objmgr_peer *peer, 1037 uint32_t flag) 1038 { 1039 return (peer->peer_mlme.peer_flags & flag) ? 1 : 0; 1040 } 1041 1042 /** 1043 * wlan_peer_mlme_flag_ext_set() - mlme ext flag set 1044 * @peer: PEER object 1045 * @flag: ext flag to be set 1046 * 1047 * API to set ext flag in peer 1048 * 1049 * Return: void 1050 */ 1051 static inline void wlan_peer_mlme_flag_ext_set(struct wlan_objmgr_peer *peer, 1052 uint32_t flag) 1053 { 1054 peer->peer_mlme.peer_ext_flags |= flag; 1055 } 1056 1057 /** 1058 * wlan_peer_mlme_flag_clear() - mlme ext flag clear 1059 * @peer: PEER object 1060 * @flag: ext flag to be cleared 1061 * 1062 * API to clear ext flag in peer 1063 * 1064 * Return: void 1065 */ 1066 static inline void wlan_peer_mlme_flag_ext_clear(struct wlan_objmgr_peer *peer, 1067 uint32_t flag) 1068 { 1069 peer->peer_mlme.peer_ext_flags &= ~flag; 1070 } 1071 1072 /** 1073 * wlan_peer_mlme_flag_ext_get() - mlme ext flag get 1074 * @peer: PEER object 1075 * @flag: ext flag to be checked 1076 * 1077 * API to know, whether particular ext flag is set in peer 1078 * 1079 * Return: 1 (for set) or 0 (for not set) 1080 */ 1081 static inline uint8_t wlan_peer_mlme_flag_ext_get(struct wlan_objmgr_peer *peer, 1082 uint32_t flag) 1083 { 1084 return (peer->peer_mlme.peer_ext_flags & flag) ? 1 : 0; 1085 } 1086 1087 /** 1088 * wlan_peer_mlme_set_state() - peer mlme state 1089 * @peer: PEER object 1090 * @state: enum wlan_peer_state 1091 * 1092 * API to update the current peer state 1093 * 1094 * Return: void 1095 */ 1096 static inline void wlan_peer_mlme_set_state( 1097 struct wlan_objmgr_peer *peer, 1098 enum wlan_peer_state state) 1099 { 1100 peer->peer_mlme.state = state; 1101 } 1102 1103 #ifdef WLAN_FEATURE_11BE_MLO 1104 /** 1105 * wlan_peer_mlme_get_mldaddr() - get peer mldaddr 1106 * @peer: PEER object 1107 * 1108 * API to get MLD address from peer object 1109 * 1110 * Return: mld address 1111 */ 1112 static inline uint8_t *wlan_peer_mlme_get_mldaddr(struct wlan_objmgr_peer *peer) 1113 { 1114 return peer->mldaddr; 1115 } 1116 1117 /** 1118 * wlan_peer_mlme_set_mldaddr() - set peer mldaddr 1119 * @peer: PEER object 1120 * @mldaddr: MLD address 1121 * 1122 * API to set MLD addr in peer object 1123 * 1124 * Return: void 1125 */ 1126 static inline void wlan_peer_mlme_set_mldaddr(struct wlan_objmgr_peer *peer, 1127 uint8_t *mldaddr) 1128 { 1129 WLAN_ADDR_COPY(peer->mldaddr, mldaddr); 1130 } 1131 1132 /** 1133 * wlan_peer_mlme_set_assoc_peer() - assoc frames is received on this peer 1134 * @peer: PEER object 1135 * @is_assoc_link: whether assoc frames is received on this peer or not 1136 * 1137 * API to update assoc peer 1138 * 1139 * Return: void 1140 */ 1141 static inline void wlan_peer_mlme_set_assoc_peer( 1142 struct wlan_objmgr_peer *peer, 1143 bool is_assoc_link) 1144 { 1145 peer->peer_mlme.assoc_peer = is_assoc_link; 1146 } 1147 1148 /** 1149 * wlan_peer_mlme_is_assoc_peer() - check peer is assoc peer or not 1150 * @peer: PEER object 1151 * 1152 * API to get assoc peer info 1153 * 1154 * Return: whether assoc frames is received on this peer or not 1155 */ 1156 static inline bool wlan_peer_mlme_is_assoc_peer( 1157 struct wlan_objmgr_peer *peer) 1158 { 1159 return peer->peer_mlme.assoc_peer; 1160 } 1161 #else 1162 1163 static inline uint8_t *wlan_peer_mlme_get_mldaddr(struct wlan_objmgr_peer *peer) 1164 { 1165 return NULL; 1166 } 1167 1168 static inline void wlan_peer_mlme_set_mldaddr(struct wlan_objmgr_peer *peer, 1169 uint8_t *mldaddr) 1170 { 1171 } 1172 1173 static inline void wlan_peer_mlme_set_assoc_peer( 1174 struct wlan_objmgr_peer *peer, 1175 bool is_assoc_link) 1176 { 1177 } 1178 1179 static inline bool wlan_peer_mlme_is_assoc_peer( 1180 struct wlan_objmgr_peer *peer) 1181 { 1182 return true; 1183 } 1184 #endif 1185 1186 /** 1187 * wlan_peer_mlme_set_auth_state() - peer mlme auth state 1188 * @peer: PEER object 1189 * @is_authenticated: true or false 1190 * 1191 * API to update the current peer auth state 1192 * 1193 * Return: void 1194 */ 1195 static inline void wlan_peer_mlme_set_auth_state( 1196 struct wlan_objmgr_peer *peer, 1197 bool is_authenticated) 1198 { 1199 peer->peer_mlme.is_authenticated = is_authenticated; 1200 } 1201 1202 /** 1203 * wlan_peer_mlme_get_state() - peer mlme state 1204 * @peer: PEER object 1205 * 1206 * API to get peer state 1207 * 1208 * Return: enum wlan_peer_state 1209 */ 1210 static inline enum wlan_peer_state wlan_peer_mlme_get_state( 1211 struct wlan_objmgr_peer *peer) 1212 { 1213 return peer->peer_mlme.state; 1214 } 1215 1216 /** 1217 * wlan_peer_mlme_get_auth_state() - peer mlme auth state 1218 * @peer: PEER object 1219 * 1220 * API to get peer auth state 1221 * 1222 * Return: auth state true/false 1223 */ 1224 static inline bool wlan_peer_mlme_get_auth_state( 1225 struct wlan_objmgr_peer *peer) 1226 { 1227 return peer->peer_mlme.is_authenticated; 1228 } 1229 1230 /** 1231 * wlan_peer_mlme_get_next_seq_num() - get peer mlme next sequence number 1232 * @peer: PEER object 1233 * 1234 * API to get mlme peer next sequence number 1235 * 1236 * Caller need to acquire lock with wlan_peer_obj_lock() 1237 * 1238 * Return: peer mlme next sequence number 1239 */ 1240 static inline uint32_t wlan_peer_mlme_get_next_seq_num( 1241 struct wlan_objmgr_peer *peer) 1242 { 1243 /* This API is invoked with lock acquired, do not add log prints */ 1244 if (peer->peer_mlme.seq_num < WLAN_MAX_SEQ_NUM) 1245 peer->peer_mlme.seq_num++; 1246 else 1247 peer->peer_mlme.seq_num = 0; 1248 1249 return peer->peer_mlme.seq_num; 1250 } 1251 1252 /** 1253 * wlan_peer_mlme_get_seq_num() - get peer mlme sequence number 1254 * @peer: PEER object 1255 * 1256 * API to get mlme peer sequence number 1257 * 1258 * Caller need to acquire lock with wlan_peer_obj_lock() 1259 * 1260 * Return: peer mlme sequence number 1261 */ 1262 static inline uint32_t wlan_peer_mlme_get_seq_num( 1263 struct wlan_objmgr_peer *peer) 1264 { 1265 /* This API is invoked with lock acquired, do not add log prints */ 1266 return peer->peer_mlme.seq_num; 1267 } 1268 1269 /** 1270 * wlan_peer_mlme_reset_seq_num() - reset peer mlme sequence number 1271 * @peer: PEER object 1272 * 1273 * API to reset peer sequence number 1274 * 1275 * Caller need to acquire lock with wlan_peer_obj_lock() 1276 * 1277 * Return: void 1278 */ 1279 static inline void wlan_peer_mlme_reset_seq_num( 1280 struct wlan_objmgr_peer *peer) 1281 { 1282 /* This API is invoked with lock acquired, do not add log prints */ 1283 peer->peer_mlme.seq_num = 0; 1284 } 1285 1286 /** 1287 * wlan_peer_get_psoc() - get psoc 1288 * @peer: PEER object 1289 * 1290 * API to get peer's psoc 1291 * 1292 * Return: PSOC object or NULL if the psoc can not be found 1293 */ 1294 static inline struct wlan_objmgr_psoc *wlan_peer_get_psoc( 1295 struct wlan_objmgr_peer *peer) 1296 { 1297 struct wlan_objmgr_vdev *vdev; 1298 struct wlan_objmgr_psoc *psoc; 1299 1300 vdev = wlan_peer_get_vdev(peer); 1301 if (!vdev) 1302 return NULL; 1303 1304 psoc = wlan_vdev_get_psoc(vdev); 1305 1306 return psoc; 1307 } 1308 1309 /** 1310 * wlan_peer_get_psoc_id() - get psoc id 1311 * @peer: PEER object 1312 * 1313 * API to get peer's psoc id 1314 * 1315 * Return: @psoc_id: psoc id 1316 */ 1317 static inline uint8_t wlan_peer_get_psoc_id(struct wlan_objmgr_peer *peer) 1318 { 1319 struct wlan_objmgr_psoc *psoc; 1320 1321 psoc = wlan_peer_get_psoc(peer); 1322 1323 return wlan_psoc_get_id(psoc); 1324 } 1325 1326 /* 1327 * wlan_peer_get_pdev_id() - get pdev id 1328 * @peer: peer object pointer 1329 * 1330 * Return: pdev id 1331 */ 1332 static inline uint8_t wlan_peer_get_pdev_id(struct wlan_objmgr_peer *peer) 1333 { 1334 return peer->pdev_id; 1335 } 1336 1337 /** 1338 * wlan_peer_set_pdev_id() - set pdev id 1339 * @peer: peer object pointer 1340 * @pdev_id: pdev id 1341 * 1342 * Return: void 1343 */ 1344 static inline void wlan_peer_set_pdev_id(struct wlan_objmgr_peer *peer, 1345 uint8_t pdev_id) 1346 { 1347 peer->pdev_id = pdev_id; 1348 } 1349 1350 /** 1351 * wlan_objmgr_print_peer_ref_ids() - print peer object refs 1352 * @peer: peer object pointer 1353 * @log_level: log level 1354 * 1355 * Return: void 1356 */ 1357 void wlan_objmgr_print_peer_ref_ids(struct wlan_objmgr_peer *peer, 1358 QDF_TRACE_LEVEL log_level); 1359 1360 /** 1361 * wlan_objmgr_peer_get_comp_ref_cnt() - get component ref count for a peer 1362 * @peer: peer object pointer 1363 * @id: component id 1364 * 1365 * Return: uint32_t 1366 */ 1367 uint32_t 1368 wlan_objmgr_peer_get_comp_ref_cnt(struct wlan_objmgr_peer *peer, 1369 enum wlan_umac_comp_id id); 1370 1371 /** 1372 * wlan_objmgr_peer_trace_init_lock() - Initialize peer trace lock 1373 * @peer: peer object pointer 1374 * 1375 * Return: void 1376 */ 1377 #ifdef WLAN_OBJMGR_REF_ID_TRACE 1378 static inline void 1379 wlan_objmgr_peer_trace_init_lock(struct wlan_objmgr_peer *peer) 1380 { 1381 wlan_objmgr_trace_init_lock(&peer->peer_objmgr.trace); 1382 } 1383 #else 1384 static inline void 1385 wlan_objmgr_peer_trace_init_lock(struct wlan_objmgr_peer *peer) 1386 { 1387 } 1388 #endif 1389 1390 /** 1391 * wlan_objmgr_peer_trace_deinit_lock() - Deinitialize peer trace lock 1392 * @peer: peer object pointer 1393 * 1394 * Return: void 1395 */ 1396 #ifdef WLAN_OBJMGR_REF_ID_TRACE 1397 static inline void 1398 wlan_objmgr_peer_trace_deinit_lock(struct wlan_objmgr_peer *peer) 1399 { 1400 wlan_objmgr_trace_deinit_lock(&peer->peer_objmgr.trace); 1401 } 1402 #else 1403 static inline void 1404 wlan_objmgr_peer_trace_deinit_lock(struct wlan_objmgr_peer *peer) 1405 { 1406 } 1407 #endif 1408 1409 /** 1410 * wlan_objmgr_peer_trace_del_ref_list() - Delete peer trace reference list 1411 * @peer: peer object pointer 1412 * 1413 * Return: void 1414 */ 1415 #ifdef WLAN_OBJMGR_REF_ID_TRACE 1416 static inline void 1417 wlan_objmgr_peer_trace_del_ref_list(struct wlan_objmgr_peer *peer) 1418 { 1419 wlan_objmgr_trace_del_ref_list(&peer->peer_objmgr.trace); 1420 } 1421 #else 1422 static inline void 1423 wlan_objmgr_peer_trace_del_ref_list(struct wlan_objmgr_peer *peer) 1424 { 1425 } 1426 #endif 1427 1428 #endif /* _WLAN_OBJMGR_PEER_OBJ_H_*/ 1429