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