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