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 any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /** 19 * DOC: Define the pdev data structure of UMAC 20 * Public APIs to perform operations on Global objects 21 */ 22 23 #ifndef _WLAN_OBJMGR_PDEV_OBJ_H_ 24 #define _WLAN_OBJMGR_PDEV_OBJ_H_ 25 26 #include <wlan_objmgr_cmn.h> 27 #include "wlan_objmgr_psoc_obj.h" 28 #include <target_if_pub.h> 29 #include <qdf_defer.h> 30 31 /* STATUS: scanning */ 32 #define WLAN_PDEV_F_SCAN 0x00000001 33 /* STATUS: use short slot time*/ 34 #define WLAN_PDEV_F_SHSLOT 0x00000002 35 /* STATUS: channel switch event pending after DFS RADAR */ 36 #define WLAN_PDEV_F_DFS_CHANSWITCH_PENDING 0x00000004 37 /* TX Power: fixed rate */ 38 #define WLAN_PDEV_F_TXPOW_FIXED 0x00000008 39 /* STATUS: use short preamble */ 40 #define WLAN_PDEV_F_SHPREAMBLE 0x00000010 41 /* CONF: do alignment pad */ 42 #define WLAN_PDEV_F_DATAPAD 0x00000020 43 /* STATUS: protection enabled */ 44 #define WLAN_PDEV_F_USEPROT 0x00000040 45 /* STATUS: use barker preamble*/ 46 #define WLAN_PDEV_F_USEBARKER 0x00000080 47 /* CONF: DISABLE 2040 coexistence */ 48 #define WLAN_PDEV_F_COEXT_DISABLE 0x00000100 49 /* STATE: scan pending */ 50 #define WLAN_PDEV_F_SCAN_PENDING 0x00000200 51 /* CONF: send regclassids in country ie */ 52 #define WLAN_PDEV_F_REGCLASS 0x00000400 53 /* CONF: block the use of DFS channels */ 54 #define WLAN_PDEV_F_BLKDFSCHAN 0x00000800 55 /* STATUS: 11D in used */ 56 #define WLAN_PDEV_F_DOT11D 0x00001000 57 /* STATUS: 11D channel-switch detected */ 58 #define WLAN_PDEV_F_RADAR 0x00002000 59 /* CONF: A-MPDU supported */ 60 #define WLAN_PDEV_F_AMPDU 0x00004000 61 /* CONF: A-MSDU supported */ 62 #define WLAN_PDEV_F_AMSDU 0x00008000 63 /* CONF: HT traffic protected */ 64 #define WLAN_PDEV_F_HTPROT 0x00010000 65 /* CONF: Reset once */ 66 #define WLAN_PDEV_F_RESET 0x00020000 67 /* CONF: ignore 11d beacon */ 68 #define WLAN_PDEV_F_IGNORE_11D_BEACON 0x00040000 69 /* HT CAP IE present */ 70 #define WLAN_PDEV_F_HTVIE 0x00080000 71 /* radio in middle of CSA */ 72 #define WLAN_PDEV_F_CSA_WAIT 0x00100000 73 /* wnm support flag */ 74 #define WLAN_PDEV_F_WNM 0x00200000 75 #define WLAN_PDEV_F_2G_CSA 0x00400000 76 /* enhanced independent repeater */ 77 #define WLAN_PDEV_F_ENH_REP_IND 0x00800000 78 /* Disable Tx AMSDU for station vap */ 79 #define WLAN_PDEV_F_STA_AMPDU_DIS 0x01000000 80 /* do not send probe request in passive channel */ 81 #define WLAN_PDEV_F_STRICT_PSCAN_EN 0x02000000 82 /* Multivdev restart enabled with Bitmap */ 83 #define WLAN_PDEV_F_MULTIVDEV_RESTART_BMAP 0x04000000 84 /* Chan concurrency enabled */ 85 #define WLAN_PDEV_F_CHAN_CONCURRENCY 0x08000000 86 /* Multivdev restart enabled */ 87 #define WLAN_PDEV_F_MULTIVDEV_RESTART 0x10000000 88 /* MBSS IE enable */ 89 #define WLAN_PDEV_F_MBSS_IE_ENABLE 0x20000000 90 /* VDEV Peer delete all */ 91 #define WLAN_PDEV_F_DELETE_ALL_PEER 0x40000000 92 /* PDEV BEacon Protection */ 93 #define WLAN_PDEV_F_BEACON_PROTECTION 0x80000000 94 95 /* PDEV ext flags */ 96 /* CFR support enabled */ 97 #define WLAN_PDEV_FEXT_CFR_EN 0x00000001 98 /* EMA AP support enable */ 99 #define WLAN_PDEV_FEXT_EMA_AP_ENABLE 0x00000002 100 /* scan radio support */ 101 #define WLAN_PDEV_FEXT_SCAN_RADIO 0x00000004 102 /* DFS disable, valid only for scan radio supported pdevs */ 103 #define WLAN_PDEV_FEXT_SCAN_RADIO_DFS_DIS 0x00000008 104 /* normal Spectral scan support disable */ 105 #define WLAN_PDEV_FEXT_NORMAL_SPECTRAL_SCAN_DIS 0x00000010 106 /* agile Spectral scan support disable for 20/40/80 MHz */ 107 #define WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_DIS 0x00000020 108 /* agile Spectral scan support disable for 160 MHz */ 109 #define WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_160_DIS 0x00000040 110 /* agile Spectral scan support disable for 80+80 MHz */ 111 #define WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_80P80_DIS 0x00000080 112 /* agile Spectral scan support disable for 320 MHz */ 113 #define WLAN_PDEV_FEXT_AGILE_SPECTRAL_SCAN_320_DIS 0x00000100 114 /* WiFi Radar support enabled */ 115 #define WLAN_PDEV_FEXT_WIFI_RADAR_ENABLE 0x00000200 116 117 /* PDEV op flags */ 118 /* Enable htrate for wep and tkip */ 119 #define WLAN_PDEV_OP_WEP_TKIP_HTRATE 0x00000001 120 /* non HT AP found flag */ 121 #define WLAN_PDEV_OP_NON_HT_AP 0x00000002 122 /* block the use of DFS channels flag */ 123 #define WLAN_PDEV_OP_BLK_DFS_CHAN 0x00000004 124 /* 11.h flag */ 125 #define WLAN_PDEV_OP_DOTH 0x00000008 126 /* Off-channel support enabled */ 127 #define WLAN_PDEV_OP_OFFCHAN 0x00000010 128 #define WLAN_PDEV_OP_HT20ADHOC 0x00000020 129 #define WLAN_PDEV_OP_HT40ADHOC 0x00000040 130 #define WLAN_PDEV_OP_HTADHOC_AGGR 0x00000080 131 /* disallow CC change when assoc completes */ 132 #define WLAN_PDEV_OP_DISALLOW_AUTO_CC 0x00000100 133 /* Is P2P Enabled? */ 134 #define WLAN_PDEV_OP_P2P 0x00000200 135 /* disallowed */ 136 #define WLAN_PDEV_OP_IGNORE_DYNHALT 0x00000400 137 /* overwrite probe response IE with beacon IE */ 138 #define WLAN_PDEV_OP_OVERRIDE_PROBERESP 0x00000800 139 #define WLAN_PDEV_OP_DROPSTA_QUERY 0x00001000 140 #define WLAN_PDEV_OP_BLK_REPORT_FLOOD 0x00002000 141 /* Offchan scan */ 142 #define WLAN_PDEV_OP_OFFCHAN_SCAN 0x00004000 143 /*Consider OBSS non-erp to change to long slot*/ 144 #define WLAN_PDEV_OP_OBSS_LONGSLOT 0x00008000 145 /* enable/disable min rssi cli block */ 146 #define WLAN_PDEV_OP_MIN_RSSI_ENABLE 0x00010000 147 /* PDEV VDEV restart is in progress */ 148 #define WLAN_PDEV_OP_RESTART_INPROGRESS 0x00020000 149 /* PDEV MBSSID VDEV restart trigger */ 150 #define WLAN_PDEV_OP_MBSSID_RESTART 0x00040000 151 /* RADAR DETECT Defer */ 152 #define WLAN_PDEV_OP_RADAR_DETECT_DEFER 0x00080000 153 154 155 struct osif_pdev_priv; 156 157 /** 158 * struct wlan_objmgr_pdev_nif - pdev object nif structure 159 * @pdev_fw_caps: radio specific FW capabilities 160 * @pdev_feature_caps: radio specific feature capabilities 161 * @pdev_feature_ext_caps: radio specific feature capabilities extended 162 * @pdev_ospriv: OS specific pointer 163 * @macaddr: MAC address 164 * @notified_ap_vdev: ap vdev 165 */ 166 struct wlan_objmgr_pdev_nif { 167 uint32_t pdev_fw_caps; 168 uint32_t pdev_feature_caps; 169 uint32_t pdev_feature_ext_caps; 170 struct pdev_osif_priv *pdev_ospriv; 171 uint8_t macaddr[QDF_MAC_ADDR_SIZE]; 172 uint8_t notified_ap_vdev; 173 }; 174 175 /** 176 * struct wlan_objmgr_pdev_mlme - pdev object mlme structure 177 * @pdev_op_flags: PDEV operation flags, can be used to know the 178 * operation status (deletion progress, etc) 179 */ 180 struct wlan_objmgr_pdev_mlme { 181 uint32_t pdev_op_flags; 182 }; 183 184 /** 185 * struct wlan_beacon_process - wlan beacon structure 186 * @bcn_rate_limit: To indicate if beacon ratelimiting is enabled or not 187 * @wlan_beacon_count: Per pdev beacon count received 188 * @max_beacon_count: Per vdev max beacon count, defaults to 100 189 * @max_beacon_limit: Limit of beacons to be processed 190 * @dropped_beacon: Dropped beacons 191 */ 192 struct wlan_beacon_process { 193 bool bcn_rate_limit; 194 uint64_t wlan_beacon_count; 195 uint64_t max_beacon_count; 196 uint8_t max_beacon_limit; 197 uint64_t dropped_beacon; 198 }; 199 200 /** 201 * struct wlan_objmgr_pdev_objmgr - pdev object object manager structure 202 * @wlan_pdev_id: PDEV id 203 * @wlan_vdev_count: VDEVs count 204 * @max_vdev_count: Max no. of VDEVs supported by this PDEV 205 * @print_cnt: Count to throttle Logical delete prints 206 * @wlan_vdev_list: List maintains the VDEVs created on this PDEV 207 * @wlan_peer_count: Peer count 208 * @max_peer_count: Max Peer count 209 * @temp_peer_count: Temporary peer count 210 * @max_monitor_vdev_count: Max monitor vdev count 211 * @wlan_psoc: back pointer to PSOC, its attached to 212 * @ref_cnt: Ref count 213 * @ref_id_dbg: Array to track Ref count 214 * @wlan_mlo_vdev_count: MLO VDEVs count 215 * @bcn: Struct to keep track of beacon count 216 */ 217 struct wlan_objmgr_pdev_objmgr { 218 uint8_t wlan_pdev_id; 219 uint8_t wlan_vdev_count; 220 uint8_t max_vdev_count; 221 uint8_t print_cnt; 222 qdf_list_t wlan_vdev_list; 223 uint16_t wlan_peer_count; 224 uint16_t max_peer_count; 225 uint16_t temp_peer_count; 226 uint8_t max_monitor_vdev_count; 227 struct wlan_objmgr_psoc *wlan_psoc; 228 qdf_atomic_t ref_cnt; 229 qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX]; 230 #ifdef WLAN_FEATURE_11BE_MLO 231 qdf_atomic_t wlan_mlo_vdev_count; 232 #endif 233 struct wlan_beacon_process bcn; 234 }; 235 236 /** 237 * struct wlan_objmgr_pdev - PDEV common object 238 * @current_chan_list: Active/current Channel list of the radio 239 * @pdev_nif: pdev nif structure 240 * @pdev_objmgr: pdev object manager structure 241 * @pdev_mlme: pdev MLME structure 242 * @pdev_comp_priv_obj: component's private object array 243 * @obj_status: object status of each component object 244 * @obj_state: object state 245 * @tgt_if_handle: Target interface handle 246 * @pdev_lock: lock to protect object 247 * @peer_free_lock: lock to protect peer object free 248 * @peer_free_list: list to hold freed peer 249 * @peer_obj_free_work:delayed work to be queued into workqueue 250 * @active_work_cnt: active work counts 251 */ 252 struct wlan_objmgr_pdev { 253 struct wlan_chan_list *current_chan_list; 254 struct wlan_objmgr_pdev_nif pdev_nif; 255 struct wlan_objmgr_pdev_objmgr pdev_objmgr; 256 struct wlan_objmgr_pdev_mlme pdev_mlme; 257 void *pdev_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS]; 258 QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS]; 259 WLAN_OBJ_STATE obj_state; 260 target_pdev_info_t *tgt_if_handle; 261 qdf_spinlock_t pdev_lock; 262 #ifdef FEATURE_DELAYED_PEER_OBJ_DESTROY 263 qdf_spinlock_t peer_free_lock; 264 qdf_list_t peer_free_list; 265 qdf_work_t peer_obj_free_work; 266 uint32_t active_work_cnt; 267 #endif 268 }; 269 270 /* 271 * APIs to Create/Delete Global object APIs 272 */ 273 /** 274 * wlan_objmgr_pdev_obj_create() - pdev create 275 * @psoc: PSOC object 276 * @osif_priv: os private object 277 * 278 * Creates PDEV object, initializes with default values 279 * Invokes the registered notifiers to create component object 280 * 281 * Return: Handle to struct wlan_objmgr_psoc on successful creation, 282 * NULL on Failure (on Mem alloc failure and Component objects 283 * Failure) 284 */ 285 struct wlan_objmgr_pdev *wlan_objmgr_pdev_obj_create( 286 struct wlan_objmgr_psoc *psoc, struct pdev_osif_priv *osif_priv); 287 288 /** 289 * wlan_objmgr_pdev_obj_delete() - pdev delete 290 * @pdev: PDEV object 291 * 292 * Logically deletes PDEV object, 293 * Once all the references are released, object manager invokes the registered 294 * notifiers to destroy component objects 295 * 296 * Return: SUCCESS/FAILURE 297 */ 298 QDF_STATUS wlan_objmgr_pdev_obj_delete(struct wlan_objmgr_pdev *pdev); 299 300 /* 301 * APIs to attach/detach component objects 302 */ 303 /** 304 * wlan_objmgr_pdev_component_obj_attach() - pdev comp object attach 305 * @pdev: PDEV object 306 * @id: Component id 307 * @comp_priv_obj: component's private object pointer 308 * @status: Component's private object creation status 309 * 310 * API to be used for attaching component object with PDEV common object 311 * 312 * Return: SUCCESS on successful storing of component's object in common object 313 * On FAILURE (appropriate failure codes are returned) 314 */ 315 QDF_STATUS wlan_objmgr_pdev_component_obj_attach( 316 struct wlan_objmgr_pdev *pdev, 317 enum wlan_umac_comp_id id, 318 void *comp_priv_obj, 319 QDF_STATUS status); 320 321 /** 322 * wlan_objmgr_pdev_component_obj_detach() - pdev comp object detach 323 * @pdev: PDEV object 324 * @id: Component id 325 * @comp_priv_obj: component's private object pointer 326 * 327 * API to be used for detaching component object with PDEV common object 328 * 329 * Return: SUCCESS on successful removal of component's object from common 330 * object 331 * On FAILURE (appropriate failure codes are returned) 332 */ 333 QDF_STATUS wlan_objmgr_pdev_component_obj_detach( 334 struct wlan_objmgr_pdev *pdev, 335 enum wlan_umac_comp_id id, 336 void *comp_priv_obj); 337 338 /* 339 * APIs to operations on pdev objects 340 */ 341 342 typedef void (*wlan_objmgr_pdev_op_handler)(struct wlan_objmgr_pdev *pdev, 343 void *object, 344 void *arg); 345 346 /** 347 * wlan_objmgr_pdev_iterate_obj_list() - operate on all objects of pdev 348 * @pdev: PDEV object 349 * @obj_type: VDEV_OP/PEER_OP 350 * @handler: the handler will be called for each object of requested type 351 * the handler should be implemented to perform required operation 352 * @arg: arguments passed by caller 353 * @lock_free_op: its obsolete 354 * @dbg_id: id of the caller 355 * 356 * API to be used for performing the operations on all VDEV/PEER objects 357 * of pdev 358 * 359 * Return: SUCCESS/FAILURE 360 */ 361 QDF_STATUS wlan_objmgr_pdev_iterate_obj_list( 362 struct wlan_objmgr_pdev *pdev, 363 enum wlan_objmgr_obj_type obj_type, 364 wlan_objmgr_pdev_op_handler handler, 365 void *arg, uint8_t lock_free_op, 366 wlan_objmgr_ref_dbgid dbg_id); 367 368 /** 369 * wlan_objmgr_trigger_pdev_comp_priv_object_creation() - create 370 * comp object of pdev 371 * @pdev: PDEV object 372 * @id: Component id 373 * 374 * API to create component private object in run time, this would be 375 * used for features which gets enabled in run time 376 * 377 * Return: SUCCESS on successful creation 378 * On FAILURE (appropriate failure codes are returned) 379 */ 380 QDF_STATUS wlan_objmgr_trigger_pdev_comp_priv_object_creation( 381 struct wlan_objmgr_pdev *pdev, 382 enum wlan_umac_comp_id id); 383 384 /** 385 * wlan_objmgr_trigger_pdev_comp_priv_object_deletion() - destroy 386 * comp object of pdev 387 * @pdev: PDEV object 388 * @id: Component id 389 * 390 * API to destroy component private object in run time, this would 391 * be used for features which gets disabled in run time 392 * 393 * Return: SUCCESS on successful deletion 394 * On FAILURE (appropriate failure codes are returned) 395 */ 396 QDF_STATUS wlan_objmgr_trigger_pdev_comp_priv_object_deletion( 397 struct wlan_objmgr_pdev *pdev, 398 enum wlan_umac_comp_id id); 399 400 /** 401 * wlan_objmgr_get_vdev_by_id_from_pdev() - find vdev using id from pdev 402 * @pdev: PDEV object 403 * @vdev_id: vdev id 404 * @dbg_id: id of the caller 405 * 406 * API to find vdev object pointer by vdev id from pdev's vdev list 407 * 408 * This API increments the ref count of the vdev object internally, the 409 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 410 * ref count 411 * 412 * Return: vdev pointer 413 * NULL on FAILURE 414 */ 415 #ifdef WLAN_OBJMGR_REF_ID_TRACE 416 #define wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id, dbg_id) \ 417 wlan_objmgr_get_vdev_by_id_from_pdev_debug(pdev, \ 418 vdev_id, dbg_id, __func__, __LINE__) 419 420 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev_debug( 421 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 422 wlan_objmgr_ref_dbgid dbg_id, 423 const char *func, int line); 424 #else 425 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev( 426 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 427 wlan_objmgr_ref_dbgid dbg_id); 428 #endif 429 430 /** 431 * wlan_objmgr_get_vdev_by_id_from_pdev_no_state() - find vdev using id 432 * from pdev 433 * @pdev: PDEV object 434 * @vdev_id: vdev id 435 * @dbg_id: id of the caller 436 * 437 * API to find vdev object pointer by vdev id from pdev's vdev list 438 * 439 * This API increments the ref count of the vdev object internally, the 440 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 441 * ref count 442 * 443 * Return: vdev pointer 444 * NULL on FAILURE 445 */ 446 #ifdef WLAN_OBJMGR_REF_ID_TRACE 447 #define wlan_objmgr_get_vdev_by_id_from_pdev_no_state(pdev, \ 448 vdev_id, dbg_id) \ 449 wlan_objmgr_get_vdev_by_id_from_pdev_no_state_debug(pdev, \ 450 vdev_id, dbg_id, __func__, __LINE__) 451 452 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev_no_state_debug( 453 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 454 wlan_objmgr_ref_dbgid dbg_id, 455 const char *func, int line); 456 #else 457 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev_no_state( 458 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 459 wlan_objmgr_ref_dbgid dbg_id); 460 #endif 461 462 /** 463 * wlan_objmgr_get_vdev_by_macaddr_from_pdev() - find vdev using macaddr 464 * @pdev: PDEV object 465 * @macaddr: MAC address 466 * @dbg_id: id of the caller 467 * 468 * API to find vdev object pointer by vdev mac addr from pdev's vdev list 469 * 470 * This API increments the ref count of the vdev object internally, the 471 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 472 * ref count 473 * 474 * Return: vdev pointer 475 * NULL on FAILURE 476 */ 477 #ifdef WLAN_OBJMGR_REF_ID_TRACE 478 #define wlan_objmgr_get_vdev_by_macaddr_from_pdev(pdev, macaddr, dbg_id) \ 479 wlan_objmgr_get_vdev_by_macaddr_from_pdev_debug(pdev, macaddr, \ 480 dbg_id, __func__, __LINE__) 481 482 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_pdev_debug( 483 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 484 wlan_objmgr_ref_dbgid dbg_id, 485 const char *fnc, int ln); 486 #else 487 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_pdev( 488 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 489 wlan_objmgr_ref_dbgid dbg_id); 490 #endif 491 492 /** 493 * wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state() - find vdev using 494 * macaddr 495 * @pdev: PDEV object 496 * @macaddr: MAC address 497 * @dbg_id: id of the caller 498 * 499 * API to find vdev object pointer by vdev mac addr from pdev's vdev list 500 * 501 * This API increments the ref count of the vdev object internally, the 502 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 503 * ref count 504 * 505 * Return: vdev pointer 506 * NULL on FAILURE 507 */ 508 #ifdef WLAN_OBJMGR_REF_ID_TRACE 509 #define wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state(pdev, macaddr, \ 510 dbg_id) \ 511 wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state_debug(pdev, \ 512 macaddr, dbg_id, __func__, __LINE__) 513 514 struct wlan_objmgr_vdev 515 *wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state_debug( 516 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 517 wlan_objmgr_ref_dbgid dbg_id, 518 const char *func, int line); 519 #else 520 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state( 521 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 522 wlan_objmgr_ref_dbgid dbg_id); 523 #endif 524 525 /** 526 * wlan_objmgr_pdev_get_first_vdev() - Get first vdev of pdev 527 * @pdev: PDEV object 528 * @dbg_id: Object Manager ref debug id 529 * 530 * API to get reference to first vdev of pdev. 531 * 532 * Return: reference to first vdev 533 */ 534 #ifdef WLAN_OBJMGR_REF_ID_TRACE 535 #define wlan_objmgr_pdev_get_first_vdev(pdev, dbg_id) \ 536 wlan_objmgr_pdev_get_first_vdev_debug(pdev, dbg_id, \ 537 __func__, __LINE__) 538 539 struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev_debug( 540 struct wlan_objmgr_pdev *pdev, 541 wlan_objmgr_ref_dbgid dbg_id, 542 const char *func, int line); 543 #else 544 struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev( 545 struct wlan_objmgr_pdev *pdev, 546 wlan_objmgr_ref_dbgid dbg_id); 547 #endif 548 549 /** 550 * wlan_objmgr_pdev_get_comp_private_obj() - get pdev component private object 551 * @pdev: PDEV object 552 * @id: Component id 553 * 554 * API to get component private object 555 * 556 * Return: void *ptr on SUCCESS 557 * NULL on Failure 558 */ 559 void *wlan_objmgr_pdev_get_comp_private_obj( 560 struct wlan_objmgr_pdev *pdev, 561 enum wlan_umac_comp_id id); 562 563 /** 564 * wlan_pdev_obj_lock() - Acquire PDEV spinlock 565 * @pdev: PDEV object 566 * 567 * API to acquire PDEV lock 568 * Parent lock should not be taken in child lock context 569 * but child lock can be taken in parent lock context 570 * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context) 571 * 572 * Return: void 573 */ 574 static inline void wlan_pdev_obj_lock(struct wlan_objmgr_pdev *pdev) 575 { 576 qdf_spin_lock_bh(&pdev->pdev_lock); 577 } 578 579 /** 580 * wlan_pdev_obj_unlock() - Release PDEV spinlock 581 * @pdev: PDEV object 582 * 583 * API to Release PDEV lock 584 * 585 * Return: void 586 */ 587 static inline void wlan_pdev_obj_unlock(struct wlan_objmgr_pdev *pdev) 588 { 589 qdf_spin_unlock_bh(&pdev->pdev_lock); 590 } 591 592 /** 593 * wlan_pdev_get_psoc() - get psoc 594 * @pdev: PDEV object 595 * 596 * API to get the psoc object from PDEV 597 * 598 * Return: PSOC object 599 */ 600 static inline struct wlan_objmgr_psoc *wlan_pdev_get_psoc( 601 struct wlan_objmgr_pdev *pdev) 602 { 603 return pdev->pdev_objmgr.wlan_psoc; 604 } 605 606 /** 607 * wlan_pdev_set_psoc() - set psoc 608 * @pdev: PDEV object 609 * @psoc: PSOC object 610 * 611 * API to set the psoc object from PDEV 612 * 613 * Return: void 614 */ 615 static inline void wlan_pdev_set_psoc(struct wlan_objmgr_pdev *pdev, 616 struct wlan_objmgr_psoc *psoc) 617 { 618 pdev->pdev_objmgr.wlan_psoc = psoc; 619 } 620 621 /** 622 * wlan_pdev_nif_fw_cap_set() - set fw caps 623 * @pdev: PDEV object 624 * @cap: capability flag to be set 625 * 626 * API to set fw caps in pdev 627 * 628 * Return: void 629 */ 630 static inline void wlan_pdev_nif_fw_cap_set(struct wlan_objmgr_pdev *pdev, 631 uint32_t cap) 632 { 633 pdev->pdev_nif.pdev_fw_caps |= cap; 634 } 635 636 /** 637 * wlan_pdev_nif_fw_cap_clear() - clear fw cap 638 * @pdev: PDEV object 639 * @cap: capability flag to be cleared 640 * 641 * API to clear fw caps in pdev 642 * 643 * Return: void 644 */ 645 static inline void wlan_pdev_nif_fw_cap_clear(struct wlan_objmgr_pdev *pdev, 646 uint32_t cap) 647 { 648 pdev->pdev_nif.pdev_fw_caps &= ~cap; 649 } 650 651 /** 652 * wlan_pdev_nif_fw_cap_get() - get fw caps 653 * @pdev: PDEV object 654 * @cap: capability flag to be checked 655 * 656 * API to know, whether particular fw caps flag is set in pdev 657 * 658 * Return: 1 (for set) or 0 (for not set) 659 */ 660 static inline uint8_t wlan_pdev_nif_fw_cap_get(struct wlan_objmgr_pdev *pdev, 661 uint32_t cap) 662 { 663 return (pdev->pdev_nif.pdev_fw_caps & cap) ? 1 : 0; 664 } 665 666 /** 667 * wlan_pdev_nif_feat_cap_set() - set feature caps 668 * @pdev: PDEV object 669 * @cap: capability flag to be set 670 * 671 * API to set feat caps in pdev 672 * 673 * Return: void 674 */ 675 static inline void wlan_pdev_nif_feat_cap_set(struct wlan_objmgr_pdev *pdev, 676 uint32_t cap) 677 { 678 pdev->pdev_nif.pdev_feature_caps |= cap; 679 } 680 681 /** 682 * wlan_pdev_nif_feat_cap_clear() - clear feature caps 683 * @pdev: PDEV object 684 * @cap: capability flag to be cleared 685 * 686 * API to clear feat caps in pdev 687 * 688 * Return: void 689 */ 690 static inline void wlan_pdev_nif_feat_cap_clear(struct wlan_objmgr_pdev *pdev, 691 uint32_t cap) 692 { 693 pdev->pdev_nif.pdev_feature_caps &= ~cap; 694 } 695 696 /** 697 * wlan_pdev_nif_feat_cap_get() - get feature caps 698 * @pdev: PDEV object 699 * @cap: capability flag to be checked 700 * 701 * API to know, whether particular feat caps flag is set in pdev 702 * 703 * Return: 1 (for set) or 0 (for not set) 704 */ 705 static inline uint8_t wlan_pdev_nif_feat_cap_get(struct wlan_objmgr_pdev *pdev, 706 uint32_t cap) 707 { 708 return (pdev->pdev_nif.pdev_feature_caps & cap) ? 1 : 0; 709 } 710 711 /** 712 * wlan_pdev_nif_feat_ext_cap_set() - set feature ext caps 713 * @pdev: PDEV object 714 * @cap: capability flag to be set 715 * 716 * API to set feat ext caps in pdev 717 * 718 * Return: void 719 */ 720 static inline 721 void wlan_pdev_nif_feat_ext_cap_set(struct wlan_objmgr_pdev *pdev, 722 uint32_t cap) 723 { 724 pdev->pdev_nif.pdev_feature_ext_caps |= cap; 725 } 726 727 /** 728 * wlan_pdev_nif_feat_ext_cap_clear() - clear feature ext caps 729 * @pdev: PDEV object 730 * @cap: capability flag to be cleared 731 * 732 * API to clear feat ext caps in pdev 733 * 734 * Return: void 735 */ 736 static inline 737 void wlan_pdev_nif_feat_ext_cap_clear(struct wlan_objmgr_pdev *pdev, 738 uint32_t cap) 739 { 740 pdev->pdev_nif.pdev_feature_ext_caps &= ~cap; 741 } 742 743 /** 744 * wlan_pdev_nif_feat_ext_cap_get() - get feature ext caps 745 * @pdev: PDEV object 746 * @cap: capability flag to be checked 747 * 748 * API to know, whether particular feat ext caps flag is set in pdev 749 * 750 * Return: 1 (for set) or 0 (for not set) 751 */ 752 static inline 753 uint8_t wlan_pdev_nif_feat_ext_cap_get(struct wlan_objmgr_pdev *pdev, 754 uint32_t cap) 755 { 756 return (pdev->pdev_nif.pdev_feature_ext_caps & cap) ? 1 : 0; 757 } 758 759 /** 760 * wlan_pdev_mlme_op_set() - set operation flags 761 * @pdev: PDEV object 762 * @op: Operation flag to be set 763 * 764 * API to set operation flag in pdev 765 * 766 * Return: void 767 */ 768 static inline void wlan_pdev_mlme_op_set(struct wlan_objmgr_pdev *pdev, 769 uint32_t op) 770 { 771 pdev->pdev_mlme.pdev_op_flags |= op; 772 } 773 774 /** 775 * wlan_pdev_mlme_op_clear() - clear op flags 776 * @pdev: PDEV object 777 * @op: Operation flag to be cleared 778 * 779 * API to clear op flag in pdev 780 * 781 * Return: void 782 */ 783 static inline void wlan_pdev_mlme_op_clear(struct wlan_objmgr_pdev *pdev, 784 uint32_t op) 785 { 786 pdev->pdev_mlme.pdev_op_flags &= ~op; 787 } 788 789 /** 790 * wlan_pdev_mlme_op_get() - get op flag 791 * @pdev: PDEV object 792 * @op: Operation flag to be checked 793 * 794 * API to know, whether particular operation flag is set in pdev 795 * 796 * Return: 1 (for set) or 0 (for not set) 797 */ 798 static inline uint8_t wlan_pdev_mlme_op_get(struct wlan_objmgr_pdev *pdev, 799 uint32_t op) 800 { 801 return (pdev->pdev_mlme.pdev_op_flags & op) ? 1 : 0; 802 } 803 804 /** 805 * wlan_pdev_get_hw_macaddr() - get hw macaddr 806 * @pdev: PDEV object 807 * 808 * API to get HW MAC address form PDEV 809 * 810 * Caller need to acquire lock with wlan_pdev_obj_lock() 811 * 812 * Return: @macaddr -MAC address 813 */ 814 static inline uint8_t *wlan_pdev_get_hw_macaddr(struct wlan_objmgr_pdev *pdev) 815 { 816 if (!pdev) 817 return NULL; 818 819 /* This API is invoked with lock acquired, do not add log prints */ 820 return pdev->pdev_nif.macaddr; 821 } 822 823 /** 824 * wlan_pdev_set_hw_macaddr() - set hw macaddr 825 * @pdev: PDEV object 826 * @macaddr: MAC address 827 * 828 * API to set HW MAC address form PDEV 829 * 830 * Caller need to acquire lock with wlan_pdev_obj_lock() 831 * 832 * Return: void 833 */ 834 static inline void wlan_pdev_set_hw_macaddr(struct wlan_objmgr_pdev *pdev, 835 uint8_t *macaddr) 836 { 837 /* This API is invoked with lock acquired, do not add log prints */ 838 WLAN_ADDR_COPY(pdev->pdev_nif.macaddr, macaddr); 839 } 840 841 /** 842 * wlan_pdev_get_ospriv() - get os priv pointer 843 * @pdev: PDEV object 844 * 845 * API to get OS private pointer from PDEV 846 * 847 * Return: ospriv - private pointer 848 */ 849 static inline struct pdev_osif_priv *wlan_pdev_get_ospriv( 850 struct wlan_objmgr_pdev *pdev) 851 { 852 return pdev->pdev_nif.pdev_ospriv; 853 } 854 855 /** 856 * wlan_pdev_reset_ospriv() - reset os priv pointer 857 * @pdev: PDEV object 858 * 859 * API to reset OS private pointer in PDEV 860 * 861 * Return: void 862 */ 863 static inline void wlan_pdev_reset_ospriv(struct wlan_objmgr_pdev *pdev) 864 { 865 pdev->pdev_nif.pdev_ospriv = NULL; 866 } 867 868 /** 869 * wlan_pdev_set_max_vdev_count() - set pdev max vdev count 870 * @pdev: PDEV object 871 * @max_vdev_count: Max vdev count 872 * 873 * API to set Max vdev count 874 * 875 * Return: void 876 */ 877 static inline void wlan_pdev_set_max_vdev_count(struct wlan_objmgr_pdev *pdev, 878 uint8_t max_vdev_count) 879 { 880 if (max_vdev_count > WLAN_UMAC_PDEV_MAX_VDEVS) 881 QDF_BUG(0); 882 883 pdev->pdev_objmgr.max_vdev_count = max_vdev_count; 884 } 885 886 /** 887 * wlan_pdev_get_max_vdev_count() - get pdev max vdev count 888 * @pdev: PDEV object 889 * 890 * API to set Max vdev count 891 * 892 * Return: @vdev count: Max vdev count 893 */ 894 static inline uint8_t wlan_pdev_get_max_vdev_count( 895 struct wlan_objmgr_pdev *pdev) 896 { 897 return pdev->pdev_objmgr.max_vdev_count; 898 } 899 900 /** 901 * DOC: Examples to use PDEV ref count APIs 902 * 903 * In all the scenarios, the pair of API should be followed 904 * otherwise it lead to memory leak 905 * 906 * scenario 1: 907 * 908 * wlan_objmgr_pdev_obj_create() 909 * ---- 910 * wlan_objmgr_pdev_obj_delete() 911 * 912 * scenario 2: 913 * 914 * wlan_objmgr_pdev_get_ref() 915 * ---- 916 * the operations which are done on 917 * pdev object 918 * ---- 919 * wlan_objmgr_pdev_release_ref() 920 * 921 * scenario 3: 922 * 923 * wlan_objmgr_get_pdev_by_id[_no_state]() 924 * ---- 925 * the operations which are done on 926 * pdev object 927 * ---- 928 * wlan_objmgr_pdev_release_ref() 929 * 930 * scenario 4: 931 * 932 * wlan_objmgr_get_pdev_by_macaddr[_no_state]() 933 * ---- 934 * the operations which are done on 935 * pdev object 936 * ---- 937 * wlan_objmgr_pdev_release_ref() 938 */ 939 940 /** 941 * wlan_objmgr_pdev_get_ref() - increment ref count 942 * @pdev: PDEV object 943 * @id: Object Manager ref debug id 944 * 945 * API to increment ref count of pdev 946 * 947 * Return: void 948 */ 949 void wlan_objmgr_pdev_get_ref(struct wlan_objmgr_pdev *pdev, 950 wlan_objmgr_ref_dbgid id); 951 952 /** 953 * wlan_objmgr_pdev_try_get_ref() - increment ref count, if allowed 954 * @pdev: PDEV object 955 * @id: Object Manager ref debug id 956 * 957 * API to increment ref count of pdev after checking valid object state 958 * 959 * Return: void 960 */ 961 QDF_STATUS wlan_objmgr_pdev_try_get_ref(struct wlan_objmgr_pdev *pdev, 962 wlan_objmgr_ref_dbgid id); 963 964 /** 965 * wlan_objmgr_pdev_release_ref() - decrement ref count 966 * @pdev: PDEV object 967 * @id: Object Manager ref debug id 968 * 969 * API to decrement ref count of pdev, if ref count is 1, it initiates the 970 * PDEV deletion 971 * 972 * Return: void 973 */ 974 void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev, 975 wlan_objmgr_ref_dbgid id); 976 977 /** 978 * wlan_objmgr_pdev_get_pdev_id() - get pdev id 979 * @pdev: PDEV object 980 * 981 * API to get pdev id from pdev object 982 * 983 * Return: @pdev id 984 */ 985 static inline 986 uint8_t wlan_objmgr_pdev_get_pdev_id(struct wlan_objmgr_pdev *pdev) 987 { 988 return pdev->pdev_objmgr.wlan_pdev_id; 989 } 990 991 /** 992 * wlan_pdev_set_tgt_if_handle(): API to set target if handle in pdev object 993 * @pdev: Pdev pointer 994 * @tgt_if_handle: target interface handle 995 * 996 * API to set target interface handle in pdev object 997 * 998 * Caller needs to acquire lock with wlan_pdev_obj_lock() 999 * 1000 * Return: None 1001 */ 1002 static inline 1003 void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev, 1004 target_pdev_info_t *tgt_if_handle) 1005 { 1006 /* This API is invoked with lock acquired, do not add log prints */ 1007 if (!pdev) 1008 return; 1009 1010 pdev->tgt_if_handle = tgt_if_handle; 1011 } 1012 1013 /** 1014 * wlan_pdev_get_tgt_if_handle(): API to get target interface handle 1015 * @pdev: Pdev pointer 1016 * 1017 * API to get target interface handle from pdev object 1018 * 1019 * Return: target interface handle 1020 */ 1021 static inline 1022 target_pdev_info_t *wlan_pdev_get_tgt_if_handle(struct wlan_objmgr_pdev *pdev) 1023 { 1024 if (!pdev) 1025 return NULL; 1026 1027 return pdev->tgt_if_handle; 1028 } 1029 1030 /** 1031 * wlan_pdev_set_max_peer_count() - set max peer count 1032 * @pdev: PDEV object 1033 * @count: Max peer count 1034 * 1035 * API to set max peer count of PDEV 1036 * 1037 * Return: void 1038 */ 1039 static inline void wlan_pdev_set_max_peer_count(struct wlan_objmgr_pdev *pdev, 1040 uint16_t count) 1041 { 1042 pdev->pdev_objmgr.max_peer_count = count; 1043 } 1044 1045 /** 1046 * wlan_pdev_get_max_peer_count() - get max peer count 1047 * @pdev: PDEV object 1048 * 1049 * API to get max peer count of PDEV 1050 * 1051 * Return: max peer count 1052 */ 1053 static inline uint16_t wlan_pdev_get_max_peer_count( 1054 struct wlan_objmgr_pdev *pdev) 1055 { 1056 return pdev->pdev_objmgr.max_peer_count; 1057 } 1058 1059 /** 1060 * wlan_pdev_set_max_beacon_count() - set max beacon count 1061 * @pdev: pdev object 1062 * @count: Max beacon count 1063 * 1064 * API to set max beacon count of pdev 1065 * 1066 * Return: void 1067 */ 1068 static inline void wlan_pdev_set_max_beacon_count( 1069 struct wlan_objmgr_pdev *pdev, 1070 uint64_t count) 1071 { 1072 pdev->pdev_objmgr.bcn.max_beacon_count = count; 1073 } 1074 1075 /** 1076 * wlan_pdev_get_max_beacon_count() - get max beacon count 1077 * @pdev: pdev object 1078 * 1079 * API to get max beacon count of pdev 1080 * 1081 * Return: max beacon count 1082 */ 1083 static inline uint64_t wlan_pdev_get_max_beacon_count( 1084 struct wlan_objmgr_pdev *pdev) 1085 { 1086 return pdev->pdev_objmgr.bcn.max_beacon_count; 1087 } 1088 1089 /** 1090 * wlan_pdev_incr_wlan_beacon_count() - incr beacon count for rx beacon frames 1091 * @pdev: pdev object 1092 * 1093 * API to incr beacon count of pdev 1094 * 1095 * Return: void 1096 */ 1097 static inline void wlan_pdev_incr_wlan_beacon_count( 1098 struct wlan_objmgr_pdev *pdev) 1099 { 1100 pdev->pdev_objmgr.bcn.wlan_beacon_count++; 1101 } 1102 1103 /** 1104 * wlan_pdev_set_wlan_beacon_count() - set wlan beacon count 1105 * @pdev: pdev object 1106 * @count: count to reset beacon count 1107 * 1108 * API to get wlan beacon count of pdev 1109 * 1110 */ 1111 static inline void wlan_pdev_set_wlan_beacon_count( 1112 struct wlan_objmgr_pdev *pdev, 1113 uint64_t count) 1114 { 1115 pdev->pdev_objmgr.bcn.wlan_beacon_count = count; 1116 } 1117 1118 /** 1119 * wlan_pdev_get_wlan_beacon_count() - get wlan beacon count 1120 * @pdev: pdev object 1121 * 1122 * API to get wlan beacon count of pdev 1123 * 1124 * Return: beacon count 1125 */ 1126 static inline uint64_t wlan_pdev_get_wlan_beacon_count( 1127 struct wlan_objmgr_pdev *pdev) 1128 { 1129 return pdev->pdev_objmgr.bcn.wlan_beacon_count; 1130 } 1131 1132 /** 1133 * wlan_pdev_set_max_beacon_limit() - set max beacon limit 1134 * @pdev: pdev object 1135 * @limit: limit for thresholding 1136 * 1137 * API to set wlan beacon limit of pdev 1138 * 1139 */ 1140 static inline void wlan_pdev_set_max_beacon_limit( 1141 struct wlan_objmgr_pdev *pdev, 1142 uint64_t limit) 1143 { 1144 pdev->pdev_objmgr.bcn.max_beacon_limit = limit; 1145 } 1146 1147 /** 1148 * wlan_pdev_get_max_beacon_limit() - get max beacon limit 1149 * @pdev: pdev object 1150 * 1151 * API to get wlan beacon limit of pdev 1152 * 1153 * Return: beacon limit 1154 */ 1155 static inline uint64_t wlan_pdev_get_max_beacon_limit( 1156 struct wlan_objmgr_pdev *pdev) 1157 { 1158 return pdev->pdev_objmgr.bcn.max_beacon_limit; 1159 } 1160 1161 /** 1162 * wlan_pdev_incr_dropped_beacon_count() - increment dropped bcn cnt 1163 * @pdev: pdev object 1164 * 1165 * API to increment dropped beacon count 1166 * 1167 * Return: beacon limit 1168 */ 1169 static inline void wlan_pdev_incr_dropped_beacon_count( 1170 struct wlan_objmgr_pdev *pdev) 1171 { 1172 pdev->pdev_objmgr.bcn.dropped_beacon++; 1173 } 1174 1175 /** 1176 * wlan_pdev_set_dropped_beacon_count() - reset dropped beacon count 1177 * @pdev: pdev object 1178 * @count: count value 1179 * 1180 * API to set beacon drop count 1181 * 1182 */ 1183 static inline void wlan_pdev_set_dropped_beacon_count( 1184 struct wlan_objmgr_pdev *pdev, 1185 uint64_t count) 1186 { 1187 pdev->pdev_objmgr.bcn.dropped_beacon = count; 1188 } 1189 1190 /** 1191 * wlan_pdev_get_dropped_beacon_count() - get drop beacon count 1192 * @pdev: pdev object 1193 * 1194 * API to get dropped beacon count 1195 * 1196 * Return: beacon limit 1197 */ 1198 static inline uint64_t wlan_pdev_get_dropped_beacon_count( 1199 struct wlan_objmgr_pdev *pdev) 1200 { 1201 return pdev->pdev_objmgr.bcn.dropped_beacon; 1202 } 1203 1204 /** 1205 * wlan_pdev_set_max_monitor_vdev_count() - set max monitor vdev count 1206 * @pdev: PDEV object 1207 * @count: Max monitor vdev count 1208 * 1209 * API to set max monitor vdev count of PDEV 1210 * 1211 * Return: void 1212 */ 1213 static inline void wlan_pdev_set_max_monitor_vdev_count( 1214 struct wlan_objmgr_pdev *pdev, 1215 uint16_t count) 1216 { 1217 pdev->pdev_objmgr.max_monitor_vdev_count = count; 1218 } 1219 1220 /** 1221 * wlan_pdev_get_max_monitor_vdev_count() - get max monitor vdev count 1222 * @pdev: PDEV object 1223 * 1224 * API to get max monitor vdev count of PDEV 1225 * 1226 * Return: max monitor vdev count 1227 */ 1228 static inline uint16_t wlan_pdev_get_max_monitor_vdev_count( 1229 struct wlan_objmgr_pdev *pdev) 1230 { 1231 return pdev->pdev_objmgr.max_monitor_vdev_count; 1232 } 1233 1234 /** 1235 * wlan_pdev_get_peer_count() - get pdev peer count 1236 * @pdev: PDEV object 1237 * 1238 * API to get peer count from PDEV 1239 * 1240 * Return: peer_count - pdev's peer count 1241 */ 1242 static inline uint16_t wlan_pdev_get_peer_count(struct wlan_objmgr_pdev *pdev) 1243 { 1244 return pdev->pdev_objmgr.wlan_peer_count; 1245 } 1246 1247 /** 1248 * wlan_pdev_get_temp_peer_count() - get pdev temporary peer count 1249 * @pdev: PDEV object 1250 * 1251 * API to get temporary peer count from PDEV 1252 * 1253 * Return: temp_peer_count - pdev's temporary peer count 1254 */ 1255 static inline uint16_t wlan_pdev_get_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1256 { 1257 return pdev->pdev_objmgr.temp_peer_count; 1258 } 1259 1260 1261 /** 1262 * wlan_pdev_incr_peer_count() - increment pdev peer count 1263 * @pdev: PDEV object 1264 * 1265 * API to increment peer count of PDEV by 1 1266 * 1267 * Return: void 1268 */ 1269 static inline void wlan_pdev_incr_peer_count(struct wlan_objmgr_pdev *pdev) 1270 { 1271 pdev->pdev_objmgr.wlan_peer_count++; 1272 } 1273 1274 /** 1275 * wlan_pdev_decr_peer_count() - decrement pdev peer count 1276 * @pdev: PDEV object 1277 * 1278 * API to decrement peer count of PDEV by 1 1279 * 1280 * Return: void 1281 */ 1282 static inline void wlan_pdev_decr_peer_count(struct wlan_objmgr_pdev *pdev) 1283 { 1284 pdev->pdev_objmgr.wlan_peer_count--; 1285 } 1286 1287 /** 1288 * wlan_pdev_incr_temp_peer_count() - increment temporary pdev peer count 1289 * @pdev: PDEV object 1290 * 1291 * API to increment temporary peer count of PDEV by 1 1292 * 1293 * Return: void 1294 */ 1295 static inline void wlan_pdev_incr_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1296 { 1297 pdev->pdev_objmgr.temp_peer_count++; 1298 } 1299 1300 /** 1301 * wlan_pdev_decr_temp_peer_count() - decrement pdev temporary peer count 1302 * @pdev: PDEV object 1303 * 1304 * API to decrement temporary peer count of PDEV by 1 1305 * 1306 * Return: void 1307 */ 1308 static inline void wlan_pdev_decr_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1309 { 1310 pdev->pdev_objmgr.temp_peer_count--; 1311 } 1312 1313 /** 1314 * wlan_pdev_get_vdev_count() - get PDEV vdev count 1315 * @pdev: PDEV object 1316 * 1317 * API to get vdev count from PDEV 1318 * 1319 * Return: vdev_count - pdev's vdev count 1320 */ 1321 static inline uint8_t wlan_pdev_get_vdev_count(struct wlan_objmgr_pdev *pdev) 1322 { 1323 return pdev->pdev_objmgr.wlan_vdev_count; 1324 } 1325 1326 #ifdef WLAN_FEATURE_11BE_MLO 1327 /** 1328 * wlan_pdev_init_mlo_vdev_count() - Initialize PDEV MLO vdev count 1329 * @pdev: PDEV object 1330 * 1331 * API to initialize MLO vdev count from PDEV 1332 * 1333 * Return: void 1334 */ 1335 static inline 1336 void wlan_pdev_init_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1337 { 1338 qdf_atomic_init(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1339 } 1340 1341 /** 1342 * wlan_pdev_get_mlo_vdev_count() - get PDEV MLO vdev count 1343 * @pdev: PDEV object 1344 * 1345 * API to get MLO vdev count from PDEV 1346 * 1347 * Return: MLO vdev_count - pdev's MLO vdev count 1348 */ 1349 static inline 1350 uint32_t wlan_pdev_get_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1351 { 1352 return qdf_atomic_read(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1353 } 1354 1355 /** 1356 * wlan_pdev_inc_mlo_vdev_count() - Increment PDEV MLO vdev count 1357 * @pdev: PDEV object 1358 * 1359 * API to increment MLO vdev count from PDEV 1360 * 1361 * Return: void 1362 */ 1363 static inline 1364 void wlan_pdev_inc_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1365 { 1366 qdf_atomic_inc(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1367 } 1368 1369 /** 1370 * wlan_pdev_dec_mlo_vdev_count() - Decrement PDEV MLO vdev count 1371 * @pdev: PDEV object 1372 * 1373 * API to decrement MLO vdev count from PDEV 1374 * 1375 * Return: void 1376 */ 1377 static inline 1378 void wlan_pdev_dec_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1379 { 1380 qdf_assert_always 1381 (qdf_atomic_read(&pdev->pdev_objmgr.wlan_mlo_vdev_count)); 1382 1383 qdf_atomic_dec(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1384 } 1385 #else 1386 static inline 1387 void wlan_pdev_init_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1388 { 1389 } 1390 1391 static inline 1392 uint32_t wlan_pdev_get_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1393 { 1394 return 0; 1395 } 1396 1397 static inline 1398 void wlan_pdev_inc_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1399 { 1400 } 1401 1402 static inline 1403 void wlan_pdev_dec_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1404 { 1405 } 1406 #endif /* WLAN_FEATURE_11BE_MLO */ 1407 1408 /** 1409 * wlan_print_pdev_info() - print pdev members 1410 * @pdev: pdev object pointer 1411 * 1412 * Return: void 1413 */ 1414 #ifdef WLAN_OBJMGR_DEBUG 1415 void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev); 1416 #else 1417 static inline void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev) {} 1418 #endif 1419 1420 #endif /* _WLAN_OBJMGR_PDEV_H_*/ 1421