1 /* 2 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 /** 19 * DOC: Define the pSoc data structure of UMAC 20 * Public APIs to perform operations on Global objects 21 */ 22 #ifndef _WLAN_OBJMGR_PSOC_OBJ_H_ 23 #define _WLAN_OBJMGR_PSOC_OBJ_H_ 24 25 #include "wlan_objmgr_cmn.h" 26 #include "wlan_objmgr_debug.h" 27 #include "wlan_lmac_if_def.h" 28 29 #define REG_DMN_CH144 0x0001 30 #define REG_DMN_ENTREPRISE 0x0002 31 32 33 /* fw_caps */ 34 /* CAPABILITY: WEP available */ 35 #define WLAN_SOC_C_WEP 0x00000001 36 /* CAPABILITY: TKIP available */ 37 #define WLAN_SOC_C_TKIP 0x00000002 38 /* CAPABILITY: AES OCB avail */ 39 #define WLAN_SOC_C_AES 0x00000004 40 /* CAPABILITY: AES CCM avail */ 41 #define WLAN_SOC_C_AES_CCM 0x00000008 42 /* CAPABILITY: 11n HT available */ 43 #define WLAN_SOC_C_HT 0x00000010 44 /* CAPABILITY: CKIP available */ 45 #define WLAN_SOC_C_CKIP 0x00000020 46 /* CAPABILITY: ATH FF avail */ 47 #define WLAN_SOC_C_FF 0x00000040 48 /* CAPABILITY: ATH Turbo avail*/ 49 #define WLAN_SOC_C_TURBOP 0x00000080 50 /* CAPABILITY: IBSS available */ 51 #define WLAN_SOC_C_IBSS 0x00000100 52 /* CAPABILITY: Power mgmt */ 53 #define WLAN_SOC_C_PMGT 0x00000200 54 /* CAPABILITY: HOSTAP avail */ 55 #define WLAN_SOC_C_HOSTAP 0x00000400 56 /* CAPABILITY: Old Adhoc Demo */ 57 #define WLAN_SOC_C_AHDEMO 0x00000800 58 /* CAPABILITY: tx power mgmt */ 59 #define WLAN_SOC_C_TXPMGT 0x00001000 60 /* CAPABILITY: short slottime */ 61 #define WLAN_SOC_C_SHSLOT 0x00002000 62 /* CAPABILITY: short preamble */ 63 #define WLAN_SOC_C_SHPREAMBLE 0x00004000 64 /* CAPABILITY: monitor mode */ 65 #define WLAN_SOC_C_MONITOR 0x00008000 66 /* CAPABILITY: TKIP MIC avail */ 67 #define WLAN_SOC_C_TKIPMIC 0x00010000 68 /* CAPABILITY: ATH WAPI avail */ 69 #define WLAN_SOC_C_WAPI 0x00020000 70 /* CONF: WDS auto Detect/DELBA */ 71 #define WLAN_SOC_C_WDS_AUTODETECT 0x00040000 72 /* CAPABILITY: WPA1 avail */ 73 #define WLAN_SOC_C_WPA1 0x00080000 74 /* CAPABILITY: WPA2 avail */ 75 #define WLAN_SOC_C_WPA2 0x00100000 76 /* CAPABILITY: WPA1+WPA2 avail*/ 77 #define WLAN_SOC_C_WPA 0x00180000 78 /* CAPABILITY: frame bursting */ 79 #define WLAN_SOC_C_BURST 0x00200000 80 /* CAPABILITY: WME avail */ 81 #define WLAN_SOC_C_WME 0x00400000 82 /* CAPABILITY: 4-addr support */ 83 #define WLAN_SOC_C_WDS 0x00800000 84 /* CAPABILITY: TKIP MIC for QoS frame */ 85 #define WLAN_SOC_C_WME_TKIPMIC 0x01000000 86 /* CAPABILITY: bg scanning */ 87 #define WLAN_SOC_C_BGSCAN 0x02000000 88 /* CAPABILITY: UAPSD */ 89 #define WLAN_SOC_C_UAPSD 0x04000000 90 /* CAPABILITY: enabled 11.h */ 91 #define WLAN_SOC_C_DOTH 0x08000000 92 93 /* XXX protection/barker? */ 94 /* CAPABILITY: crypto alg's */ 95 #define WLAN_SOC_C_CRYPTO 0x0000002f 96 97 /* fw_caps_ext */ 98 /* CAPABILITY: fast channel change */ 99 #define WLAN_SOC_CEXT_FASTCC 0x00000001 100 /* CAPABILITY: P2P */ 101 #define WLAN_SOC_CEXT_P2P 0x00000002 102 /* CAPABILITY: Multi-Channel Operations */ 103 #define WLAN_SOC_CEXT_MULTICHAN 0x00000004 104 /* CAPABILITY: the device supports perf and power offload */ 105 #define WLAN_SOC_CEXT_PERF_PWR_OFLD 0x00000008 106 /* CAPABILITY: the device supports 11ac */ 107 #define WLAN_SOC_CEXT_11AC 0x00000010 108 /* CAPABILITY: the device support acs channel hopping */ 109 #define WLAN_SOC_CEXT_ACS_CHAN_HOP 0x00000020 110 /* CAPABILITY: the device support STA DFS */ 111 #define WLAN_SOC_CEXT_STADFS 0x00000040 112 /* NSS offload capability */ 113 #define WLAN_SOC_CEXT_NSS_OFFLOAD 0x00000080 114 /* SW cal support capability */ 115 #define WLAN_SOC_CEXT_SW_CAL 0x00000100 116 /* Hybrid mode */ 117 #define WLAN_SOC_CEXT_HYBRID_MODE 0x00000200 118 /* TT support */ 119 #define WLAN_SOC_CEXT_TT_SUPPORT 0x00000400 120 /* WMI MGMT REF */ 121 #define WLAN_SOC_CEXT_WMI_MGMT_REF 0x00000800 122 /* Wideband scan */ 123 #define WLAN_SOC_CEXT_WIDEBAND_SCAN 0x00001000 124 /* TWT Requester capable */ 125 #define WLAN_SOC_CEXT_TWT_REQUESTER 0x00002000 126 /* TWT Responder capable */ 127 #define WLAN_SOC_CEXT_TWT_RESPONDER 0x00004000 128 /* HW DB2DBM CAPABLE */ 129 #define WLAN_SOC_CEXT_HW_DB2DBM 0x00008000 130 131 /* feature_flags */ 132 /* CONF: ATH FF enabled */ 133 #define WLAN_SOC_F_FF 0x00000001 134 /* CONF: ATH Turbo enabled*/ 135 #define WLAN_SOC_F_TURBOP 0x00000002 136 /* STATUS: promiscuous mode */ 137 #define WLAN_SOC_F_PROMISC 0x00000004 138 /* STATUS: all multicast mode */ 139 #define WLAN_SOC_F_ALLMULTI 0x00000008 140 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */ 141 /* STATUS: start IBSS */ 142 #define WLAN_SOC_F_SIBSS 0x00000010 143 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */ 144 /* CONF: Power mgmt enable */ 145 #define WLAN_SOC_F_PMGTON 0x00000020 146 /* CONF: IBSS creation enable */ 147 #define WLAN_SOC_F_IBSSON 0x00000040 148 /* force chanswitch */ 149 #define WLAN_SOC_F_CHANSWITCH 0x00000080 150 151 /* ic_flags_ext and/or iv_flags_ext */ 152 /* CONF: enable country IE */ 153 #define WLAN_SOC_F_COUNTRYIE 0x00000100 154 /* STATE: enable full bgscan completion */ 155 #define WLAN_SOC_F_BGSCAN 0x00000200 156 /* CONF: enable U-APSD */ 157 #define WLAN_SOC_F_UAPSD 0x00000400 158 /* STATUS: sleeping */ 159 #define WLAN_SOC_F_SLEEP 0x00000800 160 /* Enable marking of dfs interfernce */ 161 #define WLAN_SOC_F_MARKDFS 0x00001000 162 /* enable or disable s/w ccmp encrypt decrypt support */ 163 #define WLAN_SOC_F_CCMPSW_ENCDEC 0x00002000 164 /* STATE: hibernating */ 165 #define WLAN_SOC_F_HIBERNATION 0x00004000 166 /* CONF: desired country has been set */ 167 #define WLAN_SOC_F_DESCOUNTRY 0x00008000 168 /* CONF: enable power capability or contraint IE */ 169 #define WLAN_SOC_F_PWRCNSTRIE 0x00010000 170 /* STATUS: 11D in used */ 171 #define WLAN_SOC_F_DOT11D 0x00020000 172 /* Beacon offload */ 173 #define WLAN_SOC_F_BCN_OFFLOAD 0x00040000 174 /* QWRAP enable */ 175 #define WLAN_SOC_F_QWRAP_ENABLE 0x00080000 176 /* LTEU support */ 177 #define WLAN_SOC_F_LTEU_SUPPORT 0x00100000 178 /* BT coext support */ 179 #define WLAN_SOC_F_BTCOEX_SUPPORT 0x00200000 180 /* HOST 80211 enable*/ 181 #define WLAN_SOC_F_HOST_80211_ENABLE 0x00400000 182 /* MBSS IE enable */ 183 #define WLAN_SOC_F_MBSS_IE_ENABLE 0x00800000 184 /* Spectral disable */ 185 #define WLAN_SOC_F_SPECTRAL_DISABLE 0x01000000 186 187 /* PSOC op flags */ 188 189 /* Invalid VHT cap */ 190 #define WLAN_SOC_OP_VHT_INVALID_CAP 0x00000001 191 /** 192 * struct wlan_objmgr_psoc_regulatory - Regulatory sub structure of PSOC 193 * @country_code: Country code 194 * @reg_dmn: Regulatory Domain 195 * @reg_flags: Regulatory flags 196 */ 197 struct wlan_objmgr_psoc_regulatory { 198 uint16_t country_code; 199 uint16_t reg_dmn; 200 uint16_t reg_flags; 201 }; 202 203 /** 204 * struct wlan_objmgr_psoc_user_config - user configurations to 205 * be used by common modules 206 * @is_11d_support_enabled: Enable/disable 11d feature 207 * @is_11h_support_enabled: Enable/disable 11h feature 208 * @dot11_mode: Phy mode 209 * @skip_dfs_chnl_in_p2p_search: Skip Dfs Channel in case of P2P 210 * Search 211 * @band_capability: Preferred band (0:Both, 1:2G only, 2:5G only) 212 */ 213 struct wlan_objmgr_psoc_user_config { 214 bool is_11d_support_enabled; 215 bool is_11h_support_enabled; 216 uint8_t dot11_mode; 217 bool skip_dfs_chnl_in_p2p_search; 218 uint8_t band_capability; 219 }; 220 221 /** 222 * struct wlan_objmgr_psoc_nif - HDD/OSIF specific sub structure of PSOC 223 * @phy_version: phy version, read in device probe 224 * @phy_type: OL/DA type 225 * @soc_fw_caps: FW capabilities 226 * @soc_fw_ext_caps: FW ext capabilities 227 * @soc_feature_caps:Feature capabilities 228 * @soc_op_flags: Flags to set/reset during operation 229 * @soc_hw_macaddr[]:HW MAC address 230 * @user_config: user config from OS layer 231 */ 232 struct wlan_objmgr_psoc_nif { 233 uint32_t phy_version; 234 WLAN_DEV_TYPE phy_type; 235 uint32_t soc_fw_caps; 236 uint32_t soc_fw_ext_caps; 237 uint32_t soc_feature_caps; 238 uint32_t soc_op_flags; 239 uint8_t soc_hw_macaddr[QDF_MAC_ADDR_SIZE]; 240 struct wlan_objmgr_psoc_user_config user_config; 241 }; 242 243 /** 244 * struct wlan_objmgr_psoc_objmgr - psoc object manager sub structure 245 * @psoc_id: The PSOC's numeric Id 246 * @wlan_pdev_count: PDEV count 247 * @wlan_pdev_id_map: PDEV id map, to allocate free ids 248 * @wlan_vdev_count: VDEV count 249 * @max_vdev_count: Max no. of VDEVs supported by this PSOC 250 * @print_cnt: Count to throttle Logical delete prints 251 * @wlan_peer_count: PEER count 252 * @max_peer_count: Max no. of peers supported by this PSOC 253 * @temp_peer_count: Temporary peer count 254 * @wlan_pdev_list[]: PDEV list 255 * @wlan_vdev_list[]: VDEV list 256 * @wlan_vdev_id_map[]: VDEV id map, to allocate free ids 257 * @peer_list: Peer list 258 * @ref_cnt: Ref count 259 * @ref_id_dbg: Array to track Ref count 260 * @qdf_dev: QDF Device 261 */ 262 struct wlan_objmgr_psoc_objmgr { 263 uint8_t psoc_id; 264 uint8_t wlan_pdev_count; 265 uint8_t wlan_pdev_id_map; 266 uint8_t wlan_vdev_count; 267 uint8_t max_vdev_count; 268 uint8_t print_cnt; 269 uint16_t wlan_peer_count; 270 uint16_t max_peer_count; 271 uint16_t temp_peer_count; 272 struct wlan_objmgr_pdev *wlan_pdev_list[WLAN_UMAC_MAX_PDEVS]; 273 struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_PSOC_MAX_VDEVS]; 274 uint32_t wlan_vdev_id_map[2]; 275 struct wlan_peer_list peer_list; 276 qdf_atomic_t ref_cnt; 277 qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX]; 278 qdf_device_t qdf_dev; 279 }; 280 281 /** 282 * struct wlan_soc_southbound_cb - Southbound callbacks 283 * @tx_ops: contains southbound tx callbacks 284 * @rx_ops: contains southbound rx callbacks 285 */ 286 struct wlan_soc_southbound_cb { 287 struct wlan_lmac_if_tx_ops tx_ops; 288 struct wlan_lmac_if_rx_ops rx_ops; 289 }; 290 291 /** 292 * struct wlan_concurrency_info - structure for concurrency info 293 * 294 */ 295 struct wlan_concurrency_info { 296 }; 297 298 /** 299 * struct wlan_soc_timer - structure for soc timer 300 * 301 */ 302 struct wlan_soc_timer { 303 }; 304 305 /** 306 * struct wlan_objmgr_psoc - PSOC common object 307 * @soc_reg: regulatory sub structure 308 * @soc_nif: nif sub strucutre 309 * @soc_objmgr: object manager sub structure 310 * @soc_cb: south bound callbacks 311 * @soc_timer: soc timer for inactivity 312 * @soc_concurrency: concurrency info 313 * @wlan_active_vdevs[]: List of active VDEVs 314 * @soc_comp_priv_obj[]: component private object pointers 315 * @obj_status[]: component object status 316 * @obj_state: object state 317 * @tgt_if_handle: target interface handle 318 * @dp_handle: DP module handle 319 * @psoc_lock: psoc lock 320 */ 321 struct wlan_objmgr_psoc { 322 struct wlan_objmgr_psoc_regulatory soc_reg; 323 struct wlan_objmgr_psoc_nif soc_nif; 324 struct wlan_objmgr_psoc_objmgr soc_objmgr; 325 struct wlan_soc_southbound_cb soc_cb; 326 struct wlan_soc_timer soc_timer; 327 struct wlan_concurrency_info soc_concurrency; /*TODO */ 328 uint8_t wlan_active_vdevs[WLAN_UMAC_PSOC_MAX_VDEVS]; 329 void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS]; 330 QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS]; 331 WLAN_OBJ_STATE obj_state; 332 void *tgt_if_handle; 333 void *dp_handle; 334 qdf_spinlock_t psoc_lock; 335 }; 336 337 /** 338 * struct wlan_psoc_host_hal_reg_capabilities_ext: Below are Reg caps per PHY. 339 * Please note PHY ID starts with 0. 340 * @phy_id: phy id starts with 0. 341 * @eeprom_reg_domain: regdomain value specified in EEPROM 342 * @eeprom_reg_domain_ext: regdomain 343 * @regcap1: CAP1 capabilities bit map, see REGDMN_CAP1_ defines 344 * @regcap2: REGDMN EEPROM CAP, see REGDMN_EEPROM_EEREGCAP_ defines 345 * @wireless_modes: REGDMN MODE, see REGDMN_MODE_ enum 346 * @low_2ghz_chan: 2G channel low 347 * @high_2ghz_chan: 2G channel High 348 * @low_5ghz_chan: 5G channel low 349 * @high_5ghz_chan: 5G channel High 350 */ 351 struct wlan_psoc_host_hal_reg_capabilities_ext { 352 uint32_t phy_id; 353 uint32_t eeprom_reg_domain; 354 uint32_t eeprom_reg_domain_ext; 355 uint32_t regcap1; 356 uint32_t regcap2; 357 uint32_t wireless_modes; 358 uint32_t low_2ghz_chan; 359 uint32_t high_2ghz_chan; 360 uint32_t low_5ghz_chan; 361 uint32_t high_5ghz_chan; 362 }; 363 364 /** 365 ** APIs to Create/Delete Global object APIs 366 */ 367 /** 368 * wlan_objmgr_psoc_obj_create() - psoc object create 369 * @phy_version: device id (from probe) 370 * @dev_type: Offload/DA 371 * 372 * Creates PSOC object, intializes with default values 373 * Invokes the registered notifiers to create component object 374 * 375 * Return: Handle to struct wlan_objmgr_psoc on successful creation, 376 * NULL on Failure (on Mem alloc failure and Component objects 377 * Failure) 378 */ 379 struct wlan_objmgr_psoc *wlan_objmgr_psoc_obj_create(uint32_t phy_version, 380 WLAN_DEV_TYPE dev_type); 381 382 /** 383 * wlan_objmgr_psoc_obj_delete() - psoc object delete 384 * @psoc: PSOC object 385 * 386 * Logically deletes PSOC object, 387 * Once all the references are released, object manager invokes the registered 388 * notifiers to destroy component objects 389 * 390 * Return: SUCCESS/FAILURE 391 */ 392 QDF_STATUS wlan_objmgr_psoc_obj_delete(struct wlan_objmgr_psoc *psoc); 393 394 /** 395 ** APIs to attach/detach component objects 396 */ 397 398 /** 399 * wlan_objmgr_psoc_component_obj_attach() - psoc comp object attach 400 * @psoc: PSOC object 401 * @id: Component id 402 * @comp_priv_obj: component's private object pointer 403 * @status: Component's private object creation status 404 * 405 * API to be used for attaching component object with PSOC common object 406 * 407 * Return: SUCCESS on successful storing of component's object in common object 408 * On FAILURE (appropriate failure codes are returned) 409 */ 410 QDF_STATUS wlan_objmgr_psoc_component_obj_attach( 411 struct wlan_objmgr_psoc *psoc, 412 enum wlan_umac_comp_id id, 413 void *comp_priv_obj, 414 QDF_STATUS status); 415 416 /** 417 * wlan_objmgr_psoc_component_obj_detach() - psoc comp object detach 418 * @psoc: PSOC object 419 * @id: Component id 420 * @comp_priv_obj: component's private object pointer 421 * 422 * API to be used for detaching component object with PSOC common object 423 * 424 * Return: SUCCESS on successful removal of component's object from common 425 * object 426 * On FAILURE (appropriate failure codes are returned) 427 */ 428 QDF_STATUS wlan_objmgr_psoc_component_obj_detach( 429 struct wlan_objmgr_psoc *psoc, 430 enum wlan_umac_comp_id id, 431 void *comp_priv_obj); 432 433 /** 434 ** APIs to operations on psoc objects 435 */ 436 typedef void (*wlan_objmgr_op_handler)(struct wlan_objmgr_psoc *psoc, 437 void *object, 438 void *arg); 439 440 /** 441 * wlan_objmgr_iterate_obj_list() - iterate through all psoc objects 442 * (CREATED state) 443 * @psoc: PSOC object 444 * @obj_type: PDEV_OP/VDEV_OP/PEER_OP 445 * @handler: the handler will be called for each object of requested type 446 * the handler should be implemented to perform required operation 447 * @arg: agruments passed by caller 448 * @lock_free_op: its obsolete 449 * @dbg_id: id of the caller 450 * 451 * API to be used for performing the operations on all PDEV/VDEV/PEER objects 452 * of psoc 453 * 454 * Return: SUCCESS/FAILURE 455 */ 456 QDF_STATUS wlan_objmgr_iterate_obj_list( 457 struct wlan_objmgr_psoc *psoc, 458 enum wlan_objmgr_obj_type obj_type, 459 wlan_objmgr_op_handler handler, 460 void *arg, uint8_t lock_free_op, 461 wlan_objmgr_ref_dbgid dbg_id); 462 463 /** 464 * wlan_objmgr_iterate_obj_list_all() - iterate through all psoc objects 465 * @psoc: PSOC object 466 * @obj_type: PDEV_OP/VDEV_OP/PEER_OP 467 * @handler: the handler will be called for each object of requested type 468 * the handler should be implemented to perform required operation 469 * @arg: agruments passed by caller 470 * @lock_free_op: its obsolete 471 * @dbg_id: id of the caller 472 * 473 * API to be used for performing the operations on all PDEV/VDEV/PEER objects 474 * of psoc 475 * 476 * Return: SUCCESS/FAILURE 477 */ 478 QDF_STATUS wlan_objmgr_iterate_obj_list_all( 479 struct wlan_objmgr_psoc *psoc, 480 enum wlan_objmgr_obj_type obj_type, 481 wlan_objmgr_op_handler handler, 482 void *arg, uint8_t lock_free_op, 483 wlan_objmgr_ref_dbgid dbg_id); 484 485 /** 486 * wlan_objmgr_free_all_objects_per_psoc() - free all psoc objects 487 * @psoc: PSOC object 488 * 489 * API to be used free all the objects(pdev/vdev/peer) of psoc 490 * 491 * Return: SUCCESS/FAILURE 492 */ 493 QDF_STATUS wlan_objmgr_free_all_objects_per_psoc( 494 struct wlan_objmgr_psoc *psoc); 495 496 /** 497 * wlan_objmgr_trigger_psoc_comp_priv_object_creation() - create 498 * psoc comp object 499 * @psoc: PSOC object 500 * @id: Component id 501 * 502 * API to create component private object in run time, this would 503 * be used for features which gets enabled in run time 504 * 505 * Return: SUCCESS on successful creation 506 * On FAILURE (appropriate failure codes are returned) 507 */ 508 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_creation( 509 struct wlan_objmgr_psoc *psoc, 510 enum wlan_umac_comp_id id); 511 512 /** 513 * wlan_objmgr_trigger_psoc_comp_priv_object_deletion() - destroy 514 * psoc comp object 515 * @psoc: PSOC object 516 * @id: Component id 517 * 518 * API to destroy component private object in run time, this would 519 * be used for features which gets disabled in run time 520 * 521 * Return: SUCCESS on successful deletion 522 * On FAILURE (appropriate failure codes are returned) 523 */ 524 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_deletion( 525 struct wlan_objmgr_psoc *psoc, 526 enum wlan_umac_comp_id id); 527 528 /** 529 * wlan_objmgr_get_peer_by_mac() - find peer from psoc's peer list 530 * @psoc: PSOC object 531 * @macaddr: MAC address 532 * @dbg_id: id of the caller 533 * 534 * API to find peer object pointer by MAC addr 535 * 536 * This API increments the ref count of the peer object internally, the 537 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 538 * ref count 539 * 540 * Return: peer pointer 541 * NULL on FAILURE 542 */ 543 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac( 544 struct wlan_objmgr_psoc *psoc, uint8_t *macaddr, 545 wlan_objmgr_ref_dbgid dbg_id); 546 547 /** 548 * wlan_objmgr_get_peer() - find peer from psoc's peer list 549 * @psoc: PSOC object 550 * @pdev_id: Pdev id 551 * @macaddr: MAC address 552 * @dbg_id: id of the caller 553 * 554 * API to find peer object pointer by MAC addr and pdev id 555 * 556 * This API increments the ref count of the peer object internally, the 557 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 558 * ref count 559 * 560 * Return: peer pointer 561 * NULL on FAILURE 562 */ 563 struct wlan_objmgr_peer *wlan_objmgr_get_peer( 564 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 565 uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id); 566 567 /** 568 * wlan_objmgr_get_peer_nolock() - find peer from psoc's peer list (lock free) 569 * @psoc: PSOC object 570 * @pdev_id: Pdev id 571 * @macaddr: MAC address 572 * @dbg_id: id of the caller 573 * 574 * API to find peer object pointer by MAC addr 575 * 576 * This API increments the ref count of the peer object internally, the 577 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 578 * ref count 579 * 580 * Return: peer pointer 581 * NULL on FAILURE 582 */ 583 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock( 584 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 585 uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id); 586 587 /** 588 * wlan_objmgr_get_peer_logically_deleted() - find peer 589 * from psoc's peer list 590 * @psoc: PSOC object 591 * @macaddr: MAC address 592 * @dbg_id: id of the caller 593 * 594 * API to find peer object pointer of logically deleted peer 595 * 596 * This API increments the ref count of the peer object internally, the 597 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 598 * ref count 599 * 600 * Return: peer pointer 601 * NULL on FAILURE 602 */ 603 struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted( 604 struct wlan_objmgr_psoc *psoc, uint8_t *macaddr, 605 wlan_objmgr_ref_dbgid dbg_id); 606 607 /** 608 * wlan_objmgr_get_peer_no_state() - find peer from psoc's peer list 609 * @psoc: PSOC object 610 * @pdev_id: Pdev id 611 * @macaddr: MAC address 612 * @dbg_id: id of the caller 613 * 614 * API to find peer object pointer by MAC addr and pdev id, 615 * ignores the state check 616 * 617 * This API increments the ref count of the peer object internally, the 618 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 619 * ref count 620 * 621 * Return: peer pointer 622 * NULL on FAILURE 623 */ 624 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state( 625 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 626 uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id); 627 628 /** 629 * wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev() - get peer from 630 * psoc peer list using 631 * mac and vdev 632 * self mac 633 * @psoc: PSOC object 634 * @pdev_id: Pdev id 635 * @bssid: BSSID address 636 * @macaddr: MAC address 637 * @dbg_id: id of the caller 638 * 639 * API to find peer object pointer by MAC addr, vdev self mac 640 * address and pdev id for a node that is logically in deleted state 641 * 642 * This API increments the ref count of the peer object internally, the 643 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 644 * ref count 645 * 646 * Return: List of peer pointers 647 * NULL on FAILURE 648 */ 649 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev( 650 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 651 uint8_t *bssid, uint8_t *macaddr, 652 wlan_objmgr_ref_dbgid dbg_id); 653 654 /** 655 * wlan_objmgr_get_peer_by_mac_n_vdev() - find peer from psoc's peer list 656 * using mac address and bssid 657 * @psoc: PSOC object 658 * @pdev_id: Pdev id 659 * @bssid: MAC address of AP its associated 660 * @macaddr: MAC address 661 * @dbg_id: id of the caller 662 * 663 * API to find peer object pointer by MAC addr and vdev self mac address 664 * and pdev id 665 * 666 * This API increments the ref count of the peer object internally, the 667 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 668 * ref count 669 * 670 * Return: peer pointer 671 * NULL on FAILURE 672 */ 673 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev( 674 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 675 uint8_t *bssid, uint8_t *macaddr, 676 wlan_objmgr_ref_dbgid dbg_id); 677 678 /** 679 * wlan_objmgr_get_peer_by_mac_n_vdev_no_state() - find peer from psoc's peer 680 * list using mac address and bssid 681 * @psoc: PSOC object 682 * @pdev_id: Pdev id 683 * @bssid: MAC address of AP its associated 684 * @macaddr: MAC address 685 * @dbg_id: id of the caller 686 * 687 * API to find peer object pointer by MAC addr, vdev self mac address, 688 * and pdev id ,ignores the state 689 * 690 * This API increments the ref count of the peer object internally, the 691 * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement 692 * ref count 693 * 694 * Return: peer pointer 695 * NULL on FAILURE 696 */ 697 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state( 698 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 699 uint8_t *bssid, uint8_t *macaddr, 700 wlan_objmgr_ref_dbgid dbg_id); 701 702 /** 703 * wlan_objmgr_get_pdev_by_id() - retrieve pdev by id 704 * @psoc: PSOC object 705 * @id: pdev id 706 * @dbg_id: id of the caller 707 * 708 * API to find pdev object pointer by pdev id 709 * 710 * This API increments the ref count of the pdev object internally, the 711 * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement 712 * ref count 713 * 714 * Return: pdev pointer 715 * NULL on FAILURE 716 */ 717 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id( 718 struct wlan_objmgr_psoc *psoc, uint8_t id, 719 wlan_objmgr_ref_dbgid dbg_id); 720 721 /** 722 * wlan_objmgr_get_pdev_by_id_no_state() - retrieve pdev by id 723 * @psoc: PSOC object 724 * @id: pdev id 725 * @dbg_id: id of the caller 726 * 727 * API to find pdev object pointer by pdev id, Ignores the state check 728 * 729 * This API increments the ref count of the pdev object internally, the 730 * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement 731 * ref count 732 * 733 * Return: pdev pointer 734 * NULL on FAILURE 735 */ 736 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id_no_state( 737 struct wlan_objmgr_psoc *psoc, uint8_t id, 738 wlan_objmgr_ref_dbgid dbg_id); 739 740 /** 741 * wlan_objmgr_get_pdev_by_macaddr() - retrieve pdev by macaddr 742 * @psoc: PSOC object 743 * @macaddr: MAC address 744 * @dbg_id: id of the caller 745 * 746 * API to find pdev object pointer by pdev macaddr 747 * 748 * This API increments the ref count of the pdev object internally, the 749 * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement 750 * ref count 751 * 752 * Return: pdev pointer 753 * NULL on FAILURE 754 */ 755 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr( 756 struct wlan_objmgr_psoc *psoc, uint8_t *macaddr, 757 wlan_objmgr_ref_dbgid dbg_id); 758 759 /** 760 * wlan_objmgr_get_pdev_by_macaddr_no_state() - retrieve pdev by macaddr 761 * @psoc: PSOC object 762 * @macaddr: MAC address 763 * @dbg_id: id of the caller 764 * 765 * API to find pdev object pointer by pdev macaddr, ignores the state check 766 * 767 * This API increments the ref count of the pdev object internally, the 768 * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement 769 * ref count 770 * 771 * Return: pdev pointer 772 * NULL on FAILURE 773 */ 774 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr_no_state( 775 struct wlan_objmgr_psoc *psoc, uint8_t *macaddr, 776 wlan_objmgr_ref_dbgid dbg_id); 777 778 /** 779 * wlan_objmgr_get_vdev_by_opmode_from_psoc() - retrieve vdev by opmode 780 * @psoc: PSOC object 781 * @opmode: vdev operating mode 782 * @dbg_id: id of the caller 783 * 784 * API to find vdev object pointer by vdev operating mode from psoc 785 * 786 * This API increments the ref count of the vdev object internally, the 787 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 788 * ref count 789 * 790 * Return: vdev pointer 791 * NULL on FAILURE 792 */ 793 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_opmode_from_psoc( 794 struct wlan_objmgr_psoc *psoc, 795 enum QDF_OPMODE opmode, 796 wlan_objmgr_ref_dbgid dbg_id); 797 798 /** 799 * wlan_objmgr_get_vdev_by_id_from_psoc() - retrieve vdev by id 800 * @psoc: PSOC object 801 * @id: vdev id 802 * @dbg_id: id of the caller 803 * 804 * API to find vdev object pointer by vdev id from psoc 805 * 806 * This API increments the ref count of the vdev object internally, the 807 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 808 * ref count 809 * 810 * Return: vdev pointer 811 * NULL on FAILURE 812 */ 813 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc( 814 struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, 815 wlan_objmgr_ref_dbgid dbg_id); 816 817 /** 818 * wlan_objmgr_get_vdev_by_id_from_psoc_no_state() - retrieve vdev by id 819 * @psoc: PSOC object 820 * @id: vdev id 821 * @dbg_id: id of the caller 822 * 823 * API to find vdev object pointer by vdev id from psoc, ignores the 824 * state check 825 * 826 * This API increments the ref count of the vdev object internally, the 827 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 828 * ref count 829 * 830 * Return: vdev pointer 831 * NULL on FAILURE 832 */ 833 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state( 834 struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, 835 wlan_objmgr_ref_dbgid dbg_id); 836 837 /** 838 * wlan_objmgr_get_vdev_by_macaddr_from_psoc() - retrieve vdev by macaddr 839 * @psoc: PSOC object 840 * @pdev_id: Pdev id 841 * @macaddr: macaddr 842 * @dbg_id: id of the caller 843 * 844 * API to find vdev object pointer by vdev macaddr from pdev 845 * 846 * This API increments the ref count of the vdev object internally, the 847 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 848 * ref count 849 * 850 * Return: vdev pointer 851 * NULL on FAILURE 852 */ 853 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc( 854 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 855 uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id); 856 857 /** 858 * wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state() - retrieve vdev by 859 * macaddr 860 * @psoc: PSOC object 861 * @pdev_id: Pdev id 862 * @macaddr: macaddr 863 * @dbg_id: id of the caller 864 * 865 * API to find vdev object pointer by vdev macaddr from psoc, ignores the state 866 * check 867 * 868 * This API increments the ref count of the vdev object internally, the 869 * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement 870 * ref count 871 * 872 * Return: vdev pointer 873 * NULL on FAILURE 874 */ 875 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state( 876 struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 877 uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id); 878 879 /** 880 * wlan_psoc_obj_lock() - Acquire PSOC spinlock 881 * @psoc: PSOC object 882 * 883 * API to acquire PSOC lock 884 * Parent lock should not be taken in child lock context 885 * but child lock can be taken in parent lock context 886 * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context) 887 * 888 * Return: void 889 */ 890 static inline void wlan_psoc_obj_lock(struct wlan_objmgr_psoc *psoc) 891 { 892 qdf_spin_lock_bh(&psoc->psoc_lock); 893 } 894 895 /** 896 * wlan_psoc_obj_unlock() - Release PSOC spinlock 897 * @psoc: PSOC object 898 * 899 * API to Release PSOC lock 900 * 901 * Return: void 902 */ 903 static inline void wlan_psoc_obj_unlock(struct wlan_objmgr_psoc *psoc) 904 { 905 qdf_spin_unlock_bh(&psoc->psoc_lock); 906 } 907 908 /** 909 * wlan_psoc_set_nif_phy_version() - set nif phy version 910 * @psoc: PSOC object 911 * @phy_ver: phy version 912 * 913 * API to set nif phy version in psoc 914 * 915 * Return: void 916 */ 917 static inline void wlan_psoc_set_nif_phy_version(struct wlan_objmgr_psoc *psoc, 918 uint32_t phy_ver) 919 { 920 psoc->soc_nif.phy_version = phy_ver; 921 } 922 923 /** 924 * wlan_psoc_get_nif_phy_version() - get nif phy version 925 * @psoc: PSOC object 926 * 927 * API to set nif phy version in psoc 928 * 929 * Return: @phy_ver: phy version 930 */ 931 static inline uint32_t wlan_psoc_get_nif_phy_version( 932 struct wlan_objmgr_psoc *psoc) 933 { 934 if (psoc == NULL) 935 return (uint32_t)-1; 936 937 return psoc->soc_nif.phy_version; 938 } 939 940 /** 941 * wlan_psoc_set_dev_type() - set dev type 942 * @psoc: PSOC object 943 * @phy_type: phy type (OL/DA) 944 * 945 * API to set dev type in psoc 946 * 947 * Return: void 948 */ 949 static inline void wlan_psoc_set_dev_type(struct wlan_objmgr_psoc *psoc, 950 WLAN_DEV_TYPE phy_type) 951 { 952 psoc->soc_nif.phy_type = phy_type; 953 } 954 955 /** 956 * wlan_objmgr_psoc_get_dev_type - get dev type 957 * @psoc: PSOC object 958 * 959 * API to get dev type in psoc 960 * 961 * Return: phy type (OL/DA) 962 */ 963 static inline WLAN_DEV_TYPE wlan_objmgr_psoc_get_dev_type( 964 struct wlan_objmgr_psoc *psoc) 965 { 966 if (psoc == NULL) 967 return (uint32_t)-1; 968 969 return psoc->soc_nif.phy_type; 970 } 971 972 /** 973 * wlan_psoc_nif_fw_cap_set() - set fw caps 974 * @psoc: PSOC object 975 * @cap: capability flag to be set 976 * 977 * API to set fw caps in psoc 978 * 979 * Return: void 980 */ 981 static inline void wlan_psoc_nif_fw_cap_set(struct wlan_objmgr_psoc *psoc, 982 uint32_t cap) 983 { 984 psoc->soc_nif.soc_fw_caps |= cap; 985 } 986 987 /** 988 * wlan_psoc_nif_fw_cap_clear() - clear fw caps 989 * @psoc: PSOC object 990 * @cap: capability flag to be cleared 991 * 992 * API to clear fw caps in psoc 993 * 994 * Return: void 995 */ 996 static inline void wlan_psoc_nif_fw_cap_clear(struct wlan_objmgr_psoc *psoc, 997 uint32_t cap) 998 { 999 psoc->soc_nif.soc_fw_caps &= ~cap; 1000 } 1001 1002 /** 1003 * wlan_psoc_nif_fw_cap_get() - get fw caps 1004 * @psoc: PSOC object 1005 * @cap: capability flag to be checked 1006 * 1007 * API to know, whether particular fw caps flag is set in psoc 1008 * 1009 * Return: 1 (for set) or 0 (for not set) 1010 */ 1011 static inline uint8_t wlan_psoc_nif_fw_cap_get(struct wlan_objmgr_psoc *psoc, 1012 uint32_t cap) 1013 { 1014 return (psoc->soc_nif.soc_fw_caps & cap) ? 1 : 0; 1015 } 1016 1017 /** 1018 * wlan_psoc_nif_fw_ext_cap_set() - set fw ext caps 1019 * @psoc: PSOC object 1020 * @ext_cap: capability flag to be set 1021 * 1022 * API to set fw ext caps in psoc 1023 * 1024 * Return: void 1025 */ 1026 static inline void wlan_psoc_nif_fw_ext_cap_set(struct wlan_objmgr_psoc *psoc, 1027 uint32_t ext_cap) 1028 { 1029 psoc->soc_nif.soc_fw_ext_caps |= ext_cap; 1030 } 1031 1032 /** 1033 * wlan_psoc_nif_fw_ext_cap_clear() - clear fw ext caps 1034 * @psoc: PSOC object 1035 * @ext_cap: capability flag to be cleared 1036 * 1037 * API to clear fw ext caps in psoc 1038 * 1039 * Return: void 1040 */ 1041 static inline void wlan_psoc_nif_fw_ext_cap_clear(struct wlan_objmgr_psoc *psoc, 1042 uint32_t ext_cap) 1043 { 1044 psoc->soc_nif.soc_fw_ext_caps &= ~ext_cap; 1045 } 1046 1047 /** 1048 * wlan_psoc_nif_fw_ext_cap_get() - get fw caps 1049 * @psoc: PSOC object 1050 * @ext_cap: capability flag to be checked 1051 * 1052 * API to know, whether particular fw caps flag is set in psoc 1053 * 1054 * Return: 1 (for set) or 0 (for not set) 1055 */ 1056 static inline uint8_t wlan_psoc_nif_fw_ext_cap_get( 1057 struct wlan_objmgr_psoc *psoc, uint32_t ext_cap) 1058 { 1059 return (psoc->soc_nif.soc_fw_ext_caps & ext_cap) ? 1 : 0; 1060 } 1061 1062 /** 1063 * wlan_psoc_nif_feat_cap_set() - set feature caps 1064 * @psoc: PSOC object 1065 * @cap: feature flag to be set 1066 * 1067 * API to set feature caps in psoc 1068 * 1069 * Return: void 1070 */ 1071 static inline void wlan_psoc_nif_feat_cap_set(struct wlan_objmgr_psoc *psoc, 1072 uint32_t feat_cap) 1073 { 1074 psoc->soc_nif.soc_feature_caps |= feat_cap; 1075 } 1076 1077 /** 1078 * wlan_psoc_nif_feat_cap_clear() - clear feature caps 1079 * @psoc: PSOC object 1080 * @cap: feature flag to be cleared 1081 * 1082 * API to clear feature caps in psoc 1083 * 1084 * Return: void 1085 */ 1086 static inline void wlan_psoc_nif_feat_cap_clear(struct wlan_objmgr_psoc *psoc, 1087 uint32_t feat_cap) 1088 { 1089 psoc->soc_nif.soc_feature_caps &= ~feat_cap; 1090 } 1091 1092 /** 1093 * wlan_psoc_nif_feat_cap_get() - get feature caps 1094 * @psoc: PSOC object 1095 * @cap: feature flag to be checked 1096 * 1097 * API to know, whether particular feature cap flag is set in psoc 1098 * 1099 * Return: 1 (for set) or 0 (for not set) 1100 */ 1101 static inline uint8_t wlan_psoc_nif_feat_cap_get(struct wlan_objmgr_psoc *psoc, 1102 uint32_t feat_cap) 1103 { 1104 return (psoc->soc_nif.soc_feature_caps & feat_cap) ? 1 : 0; 1105 } 1106 1107 /** 1108 * wlan_psoc_nif_op_flag_get() - get op flags 1109 * @psoc: PSOC object 1110 * @flag: op flag to be checked 1111 * 1112 * API to know, whether particular op flag is set in psoc 1113 * 1114 * Return: 1 (for set) or 0 (for not set) 1115 */ 1116 static inline uint8_t wlan_psoc_nif_op_flag_get(struct wlan_objmgr_psoc *psoc, 1117 uint32_t flag) 1118 { 1119 return (psoc->soc_nif.soc_op_flags & flag) ? 1 : 0; 1120 } 1121 1122 /** 1123 * wlan_psoc_nif_op_flag_set() - set op flag 1124 * @psoc: PSOC object 1125 * @flag: op flag to be set 1126 * 1127 * API to set op flag in psoc 1128 * 1129 * Return: void 1130 */ 1131 static inline void wlan_psoc_nif_op_flag_set(struct wlan_objmgr_psoc *psoc, 1132 uint32_t flag) 1133 { 1134 psoc->soc_nif.soc_op_flags |= flag; 1135 } 1136 1137 /** 1138 * wlan_psoc_nif_op_flag_clear() - clear op flag 1139 * @psoc: PSOC object 1140 * @flag: op flag to be cleared 1141 * 1142 * API to clear op flag in psoc 1143 * 1144 * Return: void 1145 */ 1146 static inline void wlan_psoc_nif_op_flag_clear(struct wlan_objmgr_psoc *psoc, 1147 uint32_t flag) 1148 { 1149 psoc->soc_nif.soc_op_flags &= ~flag; 1150 } 1151 1152 /** 1153 * wlan_psoc_set_hw_macaddr() - set hw mac addr 1154 * @psoc: PSOC object 1155 * @macaddr: hw macaddr 1156 * 1157 * API to set hw macaddr of psoc 1158 * 1159 * Caller need to acquire lock with wlan_psoc_obj_lock() 1160 * 1161 * Return: void 1162 */ 1163 static inline void wlan_psoc_set_hw_macaddr(struct wlan_objmgr_psoc *psoc, 1164 uint8_t *macaddr) 1165 { 1166 /* This API is invoked with lock acquired, do not add log prints */ 1167 if (psoc != NULL) 1168 WLAN_ADDR_COPY(psoc->soc_nif.soc_hw_macaddr, macaddr); 1169 } 1170 1171 /** 1172 * wlan_psoc_get_hw_macaddr() - get hw macaddr 1173 * @psoc: PSOC object 1174 * 1175 * API to set hw macaddr of psoc 1176 * 1177 * Return: hw macaddr 1178 */ 1179 static inline uint8_t *wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc *psoc) 1180 { 1181 if (psoc == NULL) 1182 return NULL; 1183 1184 return psoc->soc_nif.soc_hw_macaddr; 1185 } 1186 1187 /** 1188 * wlan_objmgr_psoc_get_comp_private_obj(): API to retrieve component object 1189 * @psoc: Psoc pointer 1190 * @id: component id 1191 * 1192 * This API is used to get the component private object pointer tied to the 1193 * corresponding psoc object 1194 * 1195 * Return: Component private object 1196 */ 1197 void *wlan_objmgr_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc, 1198 enum wlan_umac_comp_id id); 1199 /** 1200 * wlan_psoc_get_pdev_count() - get pdev count for psoc 1201 * @psoc: PSOC object 1202 * 1203 * API to get number of pdev's attached to the psoc 1204 * 1205 * Return: number of pdev's 1206 */ 1207 static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc) 1208 { 1209 if (psoc == NULL) 1210 return 0; 1211 1212 return psoc->soc_objmgr.wlan_pdev_count; 1213 } 1214 1215 /** 1216 * wlan_psoc_set_tgt_if_handle(): API to set target if handle in psoc object 1217 * @psoc: Psoc pointer 1218 * @tgt_if_handle: target interface handle 1219 * 1220 * API to set target interface handle in psoc object 1221 * 1222 * Return: None 1223 */ 1224 static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc, 1225 void *tgt_if_handle) 1226 { 1227 if (psoc == NULL) 1228 return; 1229 1230 psoc->tgt_if_handle = tgt_if_handle; 1231 } 1232 1233 /** 1234 * wlan_psoc_get_tgt_if_handle(): API to get target interface handle 1235 * @psoc: Psoc pointer 1236 * 1237 * API to get target interface handle from psoc object 1238 * 1239 * Return: target interface handle 1240 */ 1241 static inline void *wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc *psoc) 1242 { 1243 if (psoc == NULL) 1244 return NULL; 1245 1246 return psoc->tgt_if_handle; 1247 } 1248 1249 /** 1250 * wlan_psoc_get_qdf_dev(): API to get qdf device 1251 * @psoc: Psoc pointer 1252 * 1253 * API to get qdf device from psoc object 1254 * 1255 * Return: qdf_device_t 1256 */ 1257 static inline qdf_device_t wlan_psoc_get_qdf_dev( 1258 struct wlan_objmgr_psoc *psoc) 1259 { 1260 if (psoc == NULL) 1261 return NULL; 1262 1263 return psoc->soc_objmgr.qdf_dev; 1264 } 1265 1266 /** 1267 * wlan_psoc_set_qdf_dev(): API to get qdf device 1268 * @psoc: Psoc pointer 1269 * dev: qdf device 1270 * 1271 * API to set qdf device from psoc object 1272 * 1273 * Return: None 1274 */ 1275 static inline void wlan_psoc_set_qdf_dev( 1276 struct wlan_objmgr_psoc *psoc, 1277 qdf_device_t dev) 1278 { 1279 if (psoc == NULL) 1280 return; 1281 1282 psoc->soc_objmgr.qdf_dev = dev; 1283 } 1284 1285 /** 1286 * wlan_psoc_set_max_vdev_count() - set psoc max vdev count 1287 * @psoc: PSOC object 1288 * @vdev count: Max vdev count 1289 * 1290 * API to set Max vdev count 1291 * 1292 * Return: void 1293 */ 1294 static inline void wlan_psoc_set_max_vdev_count(struct wlan_objmgr_psoc *psoc, 1295 uint8_t max_vdev_count) 1296 { 1297 psoc->soc_objmgr.max_vdev_count = max_vdev_count; 1298 } 1299 1300 /** 1301 * wlan_psoc_get_max_vdev_count() - get psoc max vdev count 1302 * @psoc: PSOC object 1303 * 1304 * API to set Max vdev count 1305 * 1306 * Return: @vdev count: Max vdev count 1307 */ 1308 static inline uint8_t wlan_psoc_get_max_vdev_count( 1309 struct wlan_objmgr_psoc *psoc) 1310 { 1311 return psoc->soc_objmgr.max_vdev_count; 1312 } 1313 1314 /** 1315 * wlan_psoc_set_max_peer_count() - set psoc max peer count 1316 * @psoc: PSOC object 1317 * @peer count: Max peer count 1318 * 1319 * API to set Max peer count 1320 * 1321 * Return: void 1322 */ 1323 static inline void wlan_psoc_set_max_peer_count(struct wlan_objmgr_psoc *psoc, 1324 uint16_t max_peer_count) 1325 { 1326 psoc->soc_objmgr.max_peer_count = max_peer_count; 1327 } 1328 1329 /** 1330 * wlan_psoc_get_max_peer_count() - get psoc max peer count 1331 * @psoc: PSOC object 1332 * 1333 * API to set Max peer count 1334 * 1335 * Return: @peer count: Max peer count 1336 */ 1337 static inline uint16_t wlan_psoc_get_max_peer_count( 1338 struct wlan_objmgr_psoc *psoc) 1339 { 1340 return psoc->soc_objmgr.max_peer_count; 1341 } 1342 1343 /** 1344 * wlan_psoc_get_peer_count() - get psoc peer count 1345 * @psoc: PSOC object 1346 * 1347 * API to get peer count 1348 * 1349 * Return: @peer count: peer count 1350 */ 1351 static inline uint16_t wlan_psoc_get_peer_count( 1352 struct wlan_objmgr_psoc *psoc) 1353 { 1354 return psoc->soc_objmgr.wlan_peer_count; 1355 } 1356 1357 1358 /** 1359 * DOC: Examples to use PSOC ref count APIs 1360 * 1361 * In all the scenarios, the pair of API should be followed 1362 * other it lead to memory leak 1363 * 1364 * scenario 1: 1365 * 1366 * wlan_objmgr_psoc_obj_create() 1367 * ---- 1368 * wlan_objmgr_psoc_obj_delete() 1369 * 1370 * scenario 2: 1371 * 1372 * wlan_objmgr_psoc_get_ref() 1373 * ---- 1374 * the operations which are done on 1375 * psoc object 1376 * ---- 1377 * wlan_objmgr_psoc_release_ref() 1378 */ 1379 1380 /** 1381 * wlan_objmgr_psoc_get_ref() - increment ref count 1382 * @psoc: PSOC object 1383 * @id: Object Manager ref debug id 1384 * 1385 * API to increment ref count of psoc 1386 * 1387 * Return: void 1388 */ 1389 void wlan_objmgr_psoc_get_ref(struct wlan_objmgr_psoc *psoc, 1390 wlan_objmgr_ref_dbgid id); 1391 1392 /** 1393 * wlan_objmgr_psoc_try_get_ref() - increment ref count, if allowed 1394 * @psoc: PSOC object 1395 * @id: Object Manager ref debug id 1396 * 1397 * API to increment ref count after checking valid object state 1398 * 1399 * Return: void 1400 */ 1401 QDF_STATUS wlan_objmgr_psoc_try_get_ref(struct wlan_objmgr_psoc *psoc, 1402 wlan_objmgr_ref_dbgid id); 1403 1404 /** 1405 * wlan_objmgr_psoc_release_ref() - decrement ref count 1406 * @psoc: PSOC object 1407 * @id: Object Manager ref debug id 1408 * 1409 * API to decrement ref count of psoc, if ref count is 1, it initiates the 1410 * PSOC deletion 1411 * 1412 * Return: void 1413 */ 1414 void wlan_objmgr_psoc_release_ref(struct wlan_objmgr_psoc *psoc, 1415 wlan_objmgr_ref_dbgid id); 1416 1417 /** 1418 * wlan_objmgr_print_ref_all_objects_per_psoc() - print all psoc objects' 1419 * ref counts 1420 * @psoc: PSOC object 1421 * 1422 * API to be used for printing all the objects(pdev/vdev/peer) ref counts 1423 * 1424 * Return: SUCCESS/FAILURE 1425 */ 1426 QDF_STATUS wlan_objmgr_print_ref_all_objects_per_psoc( 1427 struct wlan_objmgr_psoc *psoc); 1428 1429 /** 1430 * wlan_objmgr_psoc_set_user_config () - populate user config 1431 * data in psoc 1432 * @psoc: psoc object pointer 1433 * @user_config_data: pointer to user config data filled up by os 1434 * dependent component 1435 * it is intended to set all elements by OSIF/HDD and it not 1436 * intended to modify a single element 1437 * Return: QDF status 1438 */ 1439 QDF_STATUS wlan_objmgr_psoc_set_user_config(struct wlan_objmgr_psoc *psoc, 1440 struct wlan_objmgr_psoc_user_config *user_config_data); 1441 1442 /** 1443 * wlan_objmgr_psoc_check_for_pdev_leaks() - Assert no pdevs attached to @psoc 1444 * @psoc: The psoc to check 1445 * 1446 * Return: None 1447 */ 1448 void wlan_objmgr_psoc_check_for_pdev_leaks(struct wlan_objmgr_psoc *psoc); 1449 1450 /** 1451 * wlan_objmgr_psoc_check_for_vdev_leaks() - Assert no vdevs attached to @psoc 1452 * @psoc: The psoc to check 1453 * 1454 * Return: None 1455 */ 1456 void wlan_objmgr_psoc_check_for_vdev_leaks(struct wlan_objmgr_psoc *psoc); 1457 1458 /** 1459 * wlan_objmgr_psoc_check_for_peer_leaks() - Assert no peers attached to @psoc 1460 * @psoc: The psoc to check 1461 * 1462 * Return: None 1463 */ 1464 void wlan_objmgr_psoc_check_for_peer_leaks(struct wlan_objmgr_psoc *psoc); 1465 1466 /** 1467 * wlan_objmgr_psoc_get_band_capability () - get user config 1468 * data for band capability 1469 * @psoc: psoc object pointer 1470 * 1471 * Return: band_capability 1472 */ 1473 static inline uint8_t wlan_objmgr_psoc_get_band_capability( 1474 struct wlan_objmgr_psoc *psoc) 1475 { 1476 if (psoc == NULL) 1477 return 0; 1478 1479 return psoc->soc_nif.user_config.band_capability; 1480 } 1481 1482 /** 1483 * wlan_psoc_set_dp_handle() - set dp handle 1484 * @psoc: psoc object pointer 1485 * @dp_handle: Data path module handle 1486 * 1487 * Return: void 1488 */ 1489 static inline void wlan_psoc_set_dp_handle(struct wlan_objmgr_psoc *psoc, 1490 void *dp_handle) 1491 { 1492 if (qdf_unlikely(!psoc)) { 1493 QDF_BUG(0); 1494 return; 1495 } 1496 1497 psoc->dp_handle = dp_handle; 1498 } 1499 1500 /** 1501 * wlan_psoc_get_dp_handle() - get dp handle 1502 * @psoc: psoc object pointer 1503 * 1504 * Return: dp handle 1505 */ 1506 static inline void *wlan_psoc_get_dp_handle(struct wlan_objmgr_psoc *psoc) 1507 { 1508 if (qdf_unlikely(!psoc)) { 1509 QDF_BUG(0); 1510 return NULL; 1511 } 1512 1513 return psoc->dp_handle; 1514 } 1515 1516 struct wlan_logically_del_peer { 1517 qdf_list_node_t list; 1518 struct wlan_objmgr_peer *peer; 1519 }; 1520 1521 /** 1522 * wlan_psoc_get_lmac_if_txops() - get lmac if txops for the psoc 1523 * @psoc: psoc object pointer 1524 * 1525 * Return: Pointer to wlan_lmac_if_tx_ops 1526 */ 1527 static inline struct wlan_lmac_if_tx_ops * 1528 wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc *psoc) 1529 { 1530 return &((psoc->soc_cb.tx_ops)); 1531 } 1532 #endif /* _WLAN_OBJMGR_PSOC_OBJ_H_*/ 1533