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