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