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