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