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 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 /* dupie (ANA,pre ANA ) */ 83 /*#define WLAN_PDEV_F_DUPIE 0x00200000*/ 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 * @scn: os private object 277 * 278 * Creates PDEV object, intializes 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 * @psoc: 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 * @psoc: 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 * @psoc: 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: agruments 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 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev_debug( 417 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 418 wlan_objmgr_ref_dbgid dbg_id, 419 const char *func, int line); 420 421 #define wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id, dbgid) \ 422 wlan_objmgr_get_vdev_by_id_from_pdev_debug(pdev, \ 423 vdev_id, dbgid, __func__, __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 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_pdev_no_state_debug( 448 struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 449 wlan_objmgr_ref_dbgid dbg_id, 450 const char *func, int line); 451 452 #define wlan_objmgr_get_vdev_by_id_from_pdev_no_state(pdev, \ 453 vdev_id, dbgid) \ 454 wlan_objmgr_get_vdev_by_id_from_pdev_no_state_debug(pdev, \ 455 vdev_id, dbgid, __func__, __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 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_pdev_debug( 479 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 480 wlan_objmgr_ref_dbgid dbg_id, 481 const char *fnc, int ln); 482 483 #define wlan_objmgr_get_vdev_by_macaddr_from_pdev(pdev, macaddr, dbgid) \ 484 wlan_objmgr_get_vdev_by_macaddr_from_pdev_debug(pdev, macaddr, \ 485 dbgid, __func__, __LINE__) 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 struct wlan_objmgr_vdev 510 *wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state_debug( 511 struct wlan_objmgr_pdev *pdev, const uint8_t *macaddr, 512 wlan_objmgr_ref_dbgid dbg_id, 513 const char *func, int line); 514 515 #define wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state(pdev, macaddr, \ 516 dbgid) \ 517 wlan_objmgr_get_vdev_by_macaddr_from_pdev_no_state_debug(pdev, \ 518 macaddr, dbgid, __func__, __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 struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev_debug( 536 struct wlan_objmgr_pdev *pdev, 537 wlan_objmgr_ref_dbgid dbg_id, 538 const char *func, int line); 539 540 #define wlan_objmgr_pdev_get_first_vdev(pdev, dbgid) \ 541 wlan_objmgr_pdev_get_first_vdev_debug(pdev, dbgid, \ 542 __func__, __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: 599 * @psoc: PSOC object 600 */ 601 static inline struct wlan_objmgr_psoc *wlan_pdev_get_psoc( 602 struct wlan_objmgr_pdev *pdev) 603 { 604 return pdev->pdev_objmgr.wlan_psoc; 605 } 606 607 /** 608 * wlan_pdev_set_psoc() - set psoc 609 * @pdev: PDEV object 610 * @psoc: PSOC object 611 * 612 * API to set the psoc object from PDEV 613 * 614 * Return: void 615 */ 616 static inline void wlan_pdev_set_psoc(struct wlan_objmgr_pdev *pdev, 617 struct wlan_objmgr_psoc *psoc) 618 { 619 pdev->pdev_objmgr.wlan_psoc = psoc; 620 } 621 622 /** 623 * wlan_pdev_nif_fw_cap_set() - set fw caps 624 * @pdev: PDEV object 625 * @cap: capability flag to be set 626 * 627 * API to set fw caps in pdev 628 * 629 * Return: void 630 */ 631 static inline void wlan_pdev_nif_fw_cap_set(struct wlan_objmgr_pdev *pdev, 632 uint32_t cap) 633 { 634 pdev->pdev_nif.pdev_fw_caps |= cap; 635 } 636 637 /** 638 * wlan_pdev_nif_fw_cap_clear() - clear fw cap 639 * @pdev: PDEV object 640 * @cap: capability flag to be cleared 641 * 642 * API to clear fw caps in pdev 643 * 644 * Return: void 645 */ 646 static inline void wlan_pdev_nif_fw_cap_clear(struct wlan_objmgr_pdev *pdev, 647 uint32_t cap) 648 { 649 pdev->pdev_nif.pdev_fw_caps &= ~cap; 650 } 651 652 /** 653 * wlan_pdev_nif_fw_cap_get() - get fw caps 654 * @pdev: PDEV object 655 * @cap: capability flag to be checked 656 * 657 * API to know, whether particular fw caps flag is set in pdev 658 * 659 * Return: 1 (for set) or 0 (for not set) 660 */ 661 static inline uint8_t wlan_pdev_nif_fw_cap_get(struct wlan_objmgr_pdev *pdev, 662 uint32_t cap) 663 { 664 return (pdev->pdev_nif.pdev_fw_caps & cap) ? 1 : 0; 665 } 666 667 /** 668 * wlan_pdev_nif_feat_cap_set() - set feature caps 669 * @pdev: PDEV object 670 * @cap: capability flag to be set 671 * 672 * API to set feat caps in pdev 673 * 674 * Return: void 675 */ 676 static inline void wlan_pdev_nif_feat_cap_set(struct wlan_objmgr_pdev *pdev, 677 uint32_t cap) 678 { 679 pdev->pdev_nif.pdev_feature_caps |= cap; 680 } 681 682 /** 683 * wlan_pdev_nif_feat_cap_clear() - clear feature caps 684 * @pdev: PDEV object 685 * @cap: capability flag to be cleared 686 * 687 * API to clear feat caps in pdev 688 * 689 * Return: void 690 */ 691 static inline void wlan_pdev_nif_feat_cap_clear(struct wlan_objmgr_pdev *pdev, 692 uint32_t cap) 693 { 694 pdev->pdev_nif.pdev_feature_caps &= ~cap; 695 } 696 697 /** 698 * wlan_pdev_nif_feat_cap_get() - get feature caps 699 * @pdev: PDEV object 700 * @cap: capability flag to be checked 701 * 702 * API to know, whether particular feat caps flag is set in pdev 703 * 704 * Return: 1 (for set) or 0 (for not set) 705 */ 706 static inline uint8_t wlan_pdev_nif_feat_cap_get(struct wlan_objmgr_pdev *pdev, 707 uint32_t cap) 708 { 709 return (pdev->pdev_nif.pdev_feature_caps & cap) ? 1 : 0; 710 } 711 712 /** 713 * wlan_pdev_nif_feat_ext_cap_set() - set feature ext caps 714 * @pdev: PDEV object 715 * @cap: capability flag to be set 716 * 717 * API to set feat ext caps in pdev 718 * 719 * Return: void 720 */ 721 static inline 722 void wlan_pdev_nif_feat_ext_cap_set(struct wlan_objmgr_pdev *pdev, 723 uint32_t cap) 724 { 725 pdev->pdev_nif.pdev_feature_ext_caps |= cap; 726 } 727 728 /** 729 * wlan_pdev_nif_feat_ext_cap_clear() - clear feature ext caps 730 * @pdev: PDEV object 731 * @cap: capability flag to be cleared 732 * 733 * API to clear feat ext caps in pdev 734 * 735 * Return: void 736 */ 737 static inline 738 void wlan_pdev_nif_feat_ext_cap_clear(struct wlan_objmgr_pdev *pdev, 739 uint32_t cap) 740 { 741 pdev->pdev_nif.pdev_feature_ext_caps &= ~cap; 742 } 743 744 /** 745 * wlan_pdev_nif_feat_ext_cap_get() - get feature ext caps 746 * @pdev: PDEV object 747 * @cap: capability flag to be checked 748 * 749 * API to know, whether particular feat ext caps flag is set in pdev 750 * 751 * Return: 1 (for set) or 0 (for not set) 752 */ 753 static inline 754 uint8_t wlan_pdev_nif_feat_ext_cap_get(struct wlan_objmgr_pdev *pdev, 755 uint32_t cap) 756 { 757 return (pdev->pdev_nif.pdev_feature_ext_caps & cap) ? 1 : 0; 758 } 759 760 /** 761 * wlan_pdev_mlme_op_set() - set operation flags 762 * @pdev: PDEV object 763 * @op: Operation flag to be set 764 * 765 * API to set operation flag in pdev 766 * 767 * Return: void 768 */ 769 static inline void wlan_pdev_mlme_op_set(struct wlan_objmgr_pdev *pdev, 770 uint32_t op) 771 { 772 pdev->pdev_mlme.pdev_op_flags |= op; 773 } 774 775 /** 776 * wlan_pdev_mlme_op_clear() - clear op flags 777 * @pdev: PDEV object 778 * @op: Operation flag to be cleared 779 * 780 * API to clear op flag in pdev 781 * 782 * Return: void 783 */ 784 static inline void wlan_pdev_mlme_op_clear(struct wlan_objmgr_pdev *pdev, 785 uint32_t op) 786 { 787 pdev->pdev_mlme.pdev_op_flags &= ~op; 788 } 789 790 /** 791 * wlan_pdev_mlme_op_get() - get op flag 792 * @pdev: PDEV object 793 * @op: Operation flag to be checked 794 * 795 * API to know, whether particular operation flag is set in pdev 796 * 797 * Return: 1 (for set) or 0 (for not set) 798 */ 799 static inline uint8_t wlan_pdev_mlme_op_get(struct wlan_objmgr_pdev *pdev, 800 uint32_t op) 801 { 802 return (pdev->pdev_mlme.pdev_op_flags & op) ? 1 : 0; 803 } 804 805 /** 806 * wlan_pdev_get_hw_macaddr() - get hw macaddr 807 * @pdev: PDEV object 808 * 809 * API to get HW MAC address form PDEV 810 * 811 * Caller need to acquire lock with wlan_pdev_obj_lock() 812 * 813 * Return: @macaddr -MAC address 814 */ 815 static inline uint8_t *wlan_pdev_get_hw_macaddr(struct wlan_objmgr_pdev *pdev) 816 { 817 if (!pdev) 818 return NULL; 819 820 /* This API is invoked with lock acquired, do not add log prints */ 821 return pdev->pdev_nif.macaddr; 822 } 823 824 /** 825 * wlan_pdev_set_hw_macaddr() - set hw macaddr 826 * @pdev: PDEV object 827 * @macaddr: MAC address 828 * 829 * API to set HW MAC address form PDEV 830 * 831 * Caller need to acquire lock with wlan_pdev_obj_lock() 832 * 833 * Return: void 834 */ 835 static inline void wlan_pdev_set_hw_macaddr(struct wlan_objmgr_pdev *pdev, 836 uint8_t *macaddr) 837 { 838 /* This API is invoked with lock acquired, do not add log prints */ 839 WLAN_ADDR_COPY(pdev->pdev_nif.macaddr, macaddr); 840 } 841 842 /** 843 * wlan_pdev_get_ospriv() - get os priv pointer 844 * @pdev: PDEV object 845 * 846 * API to get OS private pointer from PDEV 847 * 848 * Return: ospriv - private pointer 849 */ 850 static inline struct pdev_osif_priv *wlan_pdev_get_ospriv( 851 struct wlan_objmgr_pdev *pdev) 852 { 853 return pdev->pdev_nif.pdev_ospriv; 854 } 855 856 /** 857 * wlan_pdev_reset_ospriv() - reset os priv pointer 858 * @pdev: PDEV object 859 * 860 * API to reset OS private pointer in PDEV 861 * 862 * Return: void 863 */ 864 static inline void wlan_pdev_reset_ospriv(struct wlan_objmgr_pdev *pdev) 865 { 866 pdev->pdev_nif.pdev_ospriv = NULL; 867 } 868 869 /** 870 * wlan_pdev_set_max_vdev_count() - set pdev max vdev count 871 * @pdev: PDEV object 872 * @vdev count: Max vdev count 873 * 874 * API to set Max vdev count 875 * 876 * Return: void 877 */ 878 static inline void wlan_pdev_set_max_vdev_count(struct wlan_objmgr_pdev *pdev, 879 uint8_t max_vdev_count) 880 { 881 if (max_vdev_count > WLAN_UMAC_PDEV_MAX_VDEVS) 882 QDF_BUG(0); 883 884 pdev->pdev_objmgr.max_vdev_count = max_vdev_count; 885 } 886 887 /** 888 * wlan_pdev_get_max_vdev_count() - get pdev max vdev count 889 * @pdev: PDEV object 890 * 891 * API to set Max vdev count 892 * 893 * Return: @vdev count: Max vdev count 894 */ 895 static inline uint8_t wlan_pdev_get_max_vdev_count( 896 struct wlan_objmgr_pdev *pdev) 897 { 898 return pdev->pdev_objmgr.max_vdev_count; 899 } 900 901 /** 902 * DOC: Examples to use PDEV ref count APIs 903 * 904 * In all the scenarios, the pair of API should be followed 905 * otherwise it lead to memory leak 906 * 907 * scenario 1: 908 * 909 * wlan_objmgr_pdev_obj_create() 910 * ---- 911 * wlan_objmgr_pdev_obj_delete() 912 * 913 * scenario 2: 914 * 915 * wlan_objmgr_pdev_get_ref() 916 * ---- 917 * the operations which are done on 918 * pdev object 919 * ---- 920 * wlan_objmgr_pdev_release_ref() 921 * 922 * scenario 3: 923 * 924 * wlan_objmgr_get_pdev_by_id[_no_state]() 925 * ---- 926 * the operations which are done on 927 * pdev object 928 * ---- 929 * wlan_objmgr_pdev_release_ref() 930 * 931 * scenario 4: 932 * 933 * wlan_objmgr_get_pdev_by_macaddr[_no_state]() 934 * ---- 935 * the operations which are done on 936 * pdev object 937 * ---- 938 * wlan_objmgr_pdev_release_ref() 939 */ 940 941 /** 942 * wlan_objmgr_pdev_get_ref() - increment ref count 943 * @pdev: PDEV object 944 * @id: Object Manager ref debug id 945 * 946 * API to increment ref count of pdev 947 * 948 * Return: void 949 */ 950 void wlan_objmgr_pdev_get_ref(struct wlan_objmgr_pdev *pdev, 951 wlan_objmgr_ref_dbgid id); 952 953 /** 954 * wlan_objmgr_pdev_try_get_ref() - increment ref count, if allowed 955 * @pdev: PDEV object 956 * @id: Object Manager ref debug id 957 * 958 * API to increment ref count of pdev after checking valid object state 959 * 960 * Return: void 961 */ 962 QDF_STATUS wlan_objmgr_pdev_try_get_ref(struct wlan_objmgr_pdev *pdev, 963 wlan_objmgr_ref_dbgid id); 964 965 /** 966 * wlan_objmgr_pdev_release_ref() - decrement ref count 967 * @pdev: PDEV object 968 * @id: Object Manager ref debug id 969 * 970 * API to decrement ref count of pdev, if ref count is 1, it initiates the 971 * PDEV deletion 972 * 973 * Return: void 974 */ 975 void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev, 976 wlan_objmgr_ref_dbgid id); 977 978 /** 979 * wlan_objmgr_pdev_get_pdev_id() - get pdev id 980 * @pdev: PDEV object 981 * 982 * API to get pdev id from pdev object 983 * 984 * Return: @pdev id 985 */ 986 static inline 987 uint8_t wlan_objmgr_pdev_get_pdev_id(struct wlan_objmgr_pdev *pdev) 988 { 989 return pdev->pdev_objmgr.wlan_pdev_id; 990 } 991 992 /** 993 * wlan_pdev_set_tgt_if_handle(): API to set target if handle in pdev object 994 * @pdev: Pdev pointer 995 * @tgt_if_handle: target interface handle 996 * 997 * API to set target interface handle in pdev object 998 * 999 * Caller needs to acquire lock with wlan_pdev_obj_lock() 1000 * 1001 * Return: None 1002 */ 1003 static inline 1004 void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev, 1005 target_pdev_info_t *tgt_if_handle) 1006 { 1007 /* This API is invoked with lock acquired, do not add log prints */ 1008 if (!pdev) 1009 return; 1010 1011 pdev->tgt_if_handle = tgt_if_handle; 1012 } 1013 1014 /** 1015 * wlan_pdev_get_tgt_if_handle(): API to get target interface handle 1016 * @pdev: Pdev pointer 1017 * 1018 * API to get target interface handle from pdev object 1019 * 1020 * Return: target interface handle 1021 */ 1022 static inline 1023 target_pdev_info_t *wlan_pdev_get_tgt_if_handle(struct wlan_objmgr_pdev *pdev) 1024 { 1025 if (!pdev) 1026 return NULL; 1027 1028 return pdev->tgt_if_handle; 1029 } 1030 1031 /** 1032 * wlan_pdev_set_max_peer_count() - set max peer count 1033 * @vdev: PDEV object 1034 * @count: Max peer count 1035 * 1036 * API to set max peer count of PDEV 1037 * 1038 * Return: void 1039 */ 1040 static inline void wlan_pdev_set_max_peer_count(struct wlan_objmgr_pdev *pdev, 1041 uint16_t count) 1042 { 1043 pdev->pdev_objmgr.max_peer_count = count; 1044 } 1045 1046 /** 1047 * wlan_pdev_get_max_peer_count() - get max peer count 1048 * @pdev: PDEV object 1049 * 1050 * API to get max peer count of PDEV 1051 * 1052 * Return: max peer count 1053 */ 1054 static inline uint16_t wlan_pdev_get_max_peer_count( 1055 struct wlan_objmgr_pdev *pdev) 1056 { 1057 return pdev->pdev_objmgr.max_peer_count; 1058 } 1059 1060 /** 1061 * wlan_pdev_set_max_beacon_count() - set max beacon count 1062 * @pdev: pdev object 1063 * @count: Max beacon count 1064 * 1065 * API to set max beacon count of pdev 1066 * 1067 * Return: void 1068 */ 1069 static inline void wlan_pdev_set_max_beacon_count( 1070 struct wlan_objmgr_pdev *pdev, 1071 uint64_t count) 1072 { 1073 pdev->pdev_objmgr.bcn.max_beacon_count = count; 1074 } 1075 1076 /** 1077 * wlan_pdev_get_max_beacon_count() - get max beacon count 1078 * @pdev: pdev object 1079 * 1080 * API to get max beacon count of pdev 1081 * 1082 * Return: max beacon count 1083 */ 1084 static inline uint64_t wlan_pdev_get_max_beacon_count( 1085 struct wlan_objmgr_pdev *pdev) 1086 { 1087 return pdev->pdev_objmgr.bcn.max_beacon_count; 1088 } 1089 1090 /** 1091 * wlan_pdev_incr_beacon_count() - incr beacon count for rx beacon frames 1092 * @pdev: pdev object 1093 * 1094 * API to incr beacon count of pdev 1095 * 1096 * Return: void 1097 */ 1098 static inline void wlan_pdev_incr_wlan_beacon_count( 1099 struct wlan_objmgr_pdev *pdev) 1100 { 1101 pdev->pdev_objmgr.bcn.wlan_beacon_count++; 1102 } 1103 1104 /** 1105 * wlan_pdev_get_wlan_beacon_count() - set wlan beacon count 1106 * @pdev: pdev object 1107 * @count: count to reset beacon count 1108 * 1109 * API to get wlan beacon count of pdev 1110 * 1111 */ 1112 static inline void wlan_pdev_set_wlan_beacon_count( 1113 struct wlan_objmgr_pdev *pdev, 1114 uint64_t count) 1115 { 1116 pdev->pdev_objmgr.bcn.wlan_beacon_count = count; 1117 } 1118 1119 /** 1120 * wlan_pdev_get_wlan_beacon_limit() - get wlan beacon limit 1121 * @pdev: pdev object 1122 * 1123 * API to get wlan beacon limit of pdev 1124 * 1125 * Return: beacon limit 1126 */ 1127 static inline uint64_t wlan_pdev_get_wlan_beacon_count( 1128 struct wlan_objmgr_pdev *pdev) 1129 { 1130 return pdev->pdev_objmgr.bcn.wlan_beacon_count; 1131 } 1132 1133 /** 1134 * wlan_pdev_set_wlan_beacon_count() - set wlan beacon limit 1135 * @pdev: pdev object 1136 * @limit: limit for thresholding 1137 * 1138 * API to set wlan beacon limit of pdev 1139 * 1140 */ 1141 static inline void wlan_pdev_set_max_beacon_limit( 1142 struct wlan_objmgr_pdev *pdev, 1143 uint64_t limit) 1144 { 1145 pdev->pdev_objmgr.bcn.max_beacon_limit = limit; 1146 } 1147 1148 /** 1149 * wlan_pdev_get_wlan_beacon_limit() - get wlan beacon limit 1150 * @pdev: pdev object 1151 * 1152 * API to get wlan beacon limit of pdev 1153 * 1154 * Return: beacon limit 1155 */ 1156 static inline uint64_t wlan_pdev_get_max_beacon_limit( 1157 struct wlan_objmgr_pdev *pdev) 1158 { 1159 return pdev->pdev_objmgr.bcn.max_beacon_limit; 1160 } 1161 1162 /** 1163 * wlan_pdev_incr_dropped_beacon_count() - increment dropped bcn cnt 1164 * @pdev: pdev object 1165 * 1166 * API to increment dropped beacon count 1167 * 1168 * Return: beacon limit 1169 */ 1170 static inline void wlan_pdev_incr_dropped_beacon_count( 1171 struct wlan_objmgr_pdev *pdev) 1172 { 1173 pdev->pdev_objmgr.bcn.dropped_beacon++; 1174 } 1175 1176 /** 1177 * wlan_pdev_set_dropped_beacon_count() - reset dropped beacon count 1178 * @pdev: pdev object 1179 * @count: count value 1180 * 1181 * API to set beacon drop count 1182 * 1183 */ 1184 static inline void wlan_pdev_set_dropped_beacon_count( 1185 struct wlan_objmgr_pdev *pdev, 1186 uint64_t count) 1187 { 1188 pdev->pdev_objmgr.bcn.dropped_beacon = count; 1189 } 1190 1191 /** 1192 * wlan_pdev_get_dropped_beacon_count() - get drop beacon count 1193 * @pdev: pdev object 1194 * 1195 * API to get dropped beacon count 1196 * 1197 * Return: beacon limit 1198 */ 1199 static inline uint64_t wlan_pdev_get_dropped_beacon_count( 1200 struct wlan_objmgr_pdev *pdev) 1201 { 1202 return pdev->pdev_objmgr.bcn.dropped_beacon; 1203 } 1204 1205 /** 1206 * wlan_pdev_set_max_monitor_vdev_count() - set max monitor vdev count 1207 * @pdev: PDEV object 1208 * @count: Max monitor vdev count 1209 * 1210 * API to set max monitor vdev count of PDEV 1211 * 1212 * Return: void 1213 */ 1214 static inline void wlan_pdev_set_max_monitor_vdev_count( 1215 struct wlan_objmgr_pdev *pdev, 1216 uint16_t count) 1217 { 1218 pdev->pdev_objmgr.max_monitor_vdev_count = count; 1219 } 1220 1221 /** 1222 * wlan_pdev_get_max_monitor_vdev_count() - get max monitor vdev count 1223 * @pdev: PDEV object 1224 * 1225 * API to get max monitor vdev count of PDEV 1226 * 1227 * Return: max monitor vdev count 1228 */ 1229 static inline uint16_t wlan_pdev_get_max_monitor_vdev_count( 1230 struct wlan_objmgr_pdev *pdev) 1231 { 1232 return pdev->pdev_objmgr.max_monitor_vdev_count; 1233 } 1234 1235 /** 1236 * wlan_pdev_get_peer_count() - get pdev peer count 1237 * @pdev: PDEV object 1238 * 1239 * API to get peer count from PDEV 1240 * 1241 * Return: peer_count - pdev's peer count 1242 */ 1243 static inline uint16_t wlan_pdev_get_peer_count(struct wlan_objmgr_pdev *pdev) 1244 { 1245 return pdev->pdev_objmgr.wlan_peer_count; 1246 } 1247 1248 /** 1249 * wlan_pdev_get_temp_peer_count() - get pdev temporary peer count 1250 * @pdev: PDEV object 1251 * 1252 * API to get temporary peer count from PDEV 1253 * 1254 * Return: temp_peer_count - pdev's temporary peer count 1255 */ 1256 static inline uint16_t wlan_pdev_get_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1257 { 1258 return pdev->pdev_objmgr.temp_peer_count; 1259 } 1260 1261 1262 /** 1263 * wlan_pdev_incr_peer_count() - increment pdev peer count 1264 * @pdev: PDEV object 1265 * 1266 * API to increment peer count of PDEV by 1 1267 * 1268 * Return: void 1269 */ 1270 static inline void wlan_pdev_incr_peer_count(struct wlan_objmgr_pdev *pdev) 1271 { 1272 pdev->pdev_objmgr.wlan_peer_count++; 1273 } 1274 1275 /** 1276 * wlan_pdev_decr_peer_count() - decrement pdev peer count 1277 * @pdev: PDEV object 1278 * 1279 * API to decrement peer count of PDEV by 1 1280 * 1281 * Return: void 1282 */ 1283 static inline void wlan_pdev_decr_peer_count(struct wlan_objmgr_pdev *pdev) 1284 { 1285 pdev->pdev_objmgr.wlan_peer_count--; 1286 } 1287 1288 /** 1289 * wlan_pdev_incr_temp_peer_count() - increment temporary pdev peer count 1290 * @pdev: PDEV object 1291 * 1292 * API to increment temporary peer count of PDEV by 1 1293 * 1294 * Return: void 1295 */ 1296 static inline void wlan_pdev_incr_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1297 { 1298 pdev->pdev_objmgr.temp_peer_count++; 1299 } 1300 1301 /** 1302 * wlan_pdev_decr_temp_peer_count() - decrement pdev temporary peer count 1303 * @pdev: PDEV object 1304 * 1305 * API to decrement temporary peer count of PDEV by 1 1306 * 1307 * Return: void 1308 */ 1309 static inline void wlan_pdev_decr_temp_peer_count(struct wlan_objmgr_pdev *pdev) 1310 { 1311 pdev->pdev_objmgr.temp_peer_count--; 1312 } 1313 1314 /** 1315 * wlan_pdev_get_vdev_count() - get PDEV vdev count 1316 * @pdev: PDEV object 1317 * 1318 * API to get vdev count from PDEV 1319 * 1320 * Return: vdev_count - pdev's vdev count 1321 */ 1322 static inline uint8_t wlan_pdev_get_vdev_count(struct wlan_objmgr_pdev *pdev) 1323 { 1324 return pdev->pdev_objmgr.wlan_vdev_count; 1325 } 1326 1327 #ifdef WLAN_FEATURE_11BE_MLO 1328 /** 1329 * wlan_pdev_init_mlo_vdev_count() - Initialize PDEV MLO vdev count 1330 * @pdev: PDEV object 1331 * 1332 * API to initialize MLO vdev count from PDEV 1333 * 1334 * Return: void 1335 */ 1336 static inline 1337 void wlan_pdev_init_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1338 { 1339 qdf_atomic_init(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1340 } 1341 1342 /** 1343 * wlan_pdev_get_mlo_vdev_count() - get PDEV MLO vdev count 1344 * @pdev: PDEV object 1345 * 1346 * API to get MLO vdev count from PDEV 1347 * 1348 * Return: MLO vdev_count - pdev's MLO vdev count 1349 */ 1350 static inline 1351 uint32_t wlan_pdev_get_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1352 { 1353 return qdf_atomic_read(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1354 } 1355 1356 /** 1357 * wlan_pdev_inc_mlo_vdev_count() - Increment PDEV MLO vdev count 1358 * @pdev: PDEV object 1359 * 1360 * API to increment MLO vdev count from PDEV 1361 * 1362 * Return: void 1363 */ 1364 static inline 1365 void wlan_pdev_inc_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1366 { 1367 qdf_atomic_inc(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1368 } 1369 1370 /** 1371 * wlan_pdev_dec_mlo_vdev_count() - Decrement PDEV MLO vdev count 1372 * @pdev: PDEV object 1373 * 1374 * API to decrement MLO vdev count from PDEV 1375 * 1376 * Return: void 1377 */ 1378 static inline 1379 void wlan_pdev_dec_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1380 { 1381 qdf_assert_always 1382 (qdf_atomic_read(&pdev->pdev_objmgr.wlan_mlo_vdev_count)); 1383 1384 qdf_atomic_dec(&pdev->pdev_objmgr.wlan_mlo_vdev_count); 1385 } 1386 #else 1387 static inline 1388 void wlan_pdev_init_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1389 { 1390 } 1391 1392 static inline 1393 uint32_t wlan_pdev_get_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1394 { 1395 return 0; 1396 } 1397 1398 static inline 1399 void wlan_pdev_inc_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1400 { 1401 } 1402 1403 static inline 1404 void wlan_pdev_dec_mlo_vdev_count(struct wlan_objmgr_pdev *pdev) 1405 { 1406 } 1407 #endif /* WLAN_FEATURE_11BE_MLO */ 1408 1409 /** 1410 * wlan_print_pdev_info() - print pdev members 1411 * @pdev: pdev object pointer 1412 * 1413 * Return: void 1414 */ 1415 #ifdef WLAN_OBJMGR_DEBUG 1416 void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev); 1417 #else 1418 static inline void wlan_print_pdev_info(struct wlan_objmgr_pdev *pdev) {} 1419 #endif 1420 1421 #endif /* _WLAN_OBJMGR_PDEV_H_*/ 1422