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