xref: /wlan-driver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 /* Restricted TWT */
254 #define WLAN_SOC_F_RESTRICTED_TWT           0x00000080
255 
256 /* Support for TDLS Concurrencies for Legacy STA & ML STA*/
257 #define WLAN_TDLS_CONCURRENCIES_SUPPORT           0x0000100
258 
259 /* 11AZ Trigger based ranging Responder support */
260 #define WLAN_RTT_11AZ_TB_RSTA_SUPPORT 0x00000200
261 
262 /* CCA busy info for each 20Mhz subband of wideband scan channel support */
263 #define WLAN_CCA_BUSY_INFO_FOREACH_20MHZ               0x00000400
264 /* ch width notify support */
265 #define WLAN_VDEV_PARAM_CHWIDTH_WITH_NOTIFY_SUPPORT    0x00000800
266 
267 /* PSOC op flags */
268 
269 	/* Invalid VHT cap */
270 #define WLAN_SOC_OP_VHT_INVALID_CAP    0x00000001
271 
272 /* enum wlan_nss_ratio - NSS ratio received from FW during service ready ext
273  *                       event.
274  * WLAN_NSS_RATIO_1BY2_NSS : Max nss of 160MHz is equals to half of the max nss
275  *                           of 80MHz
276  * WLAN_NSS_RATIO_3BY4_NSS : Max nss of 160MHz is equals to 3/4 of the max nss
277  *                           of 80MHz
278  * WLAN_NSS_RATIO_1_NSS    : Max nss of 160MHz is equals to the max nss of 80MHz
279  * WLAN_NSS_RATIO_2_NSS    : Max nss of 160MHz is equals to two times the max
280  *                           nss of 80MHz
281  * Values of this enum should be in sync with WMI_NSS_RATIO_INFO value provided
282  * in wmi_unified.h.
283  */
284 enum wlan_nss_ratio {
285 	WLAN_NSS_RATIO_1BY2_NSS = 0x0,
286 	WLAN_NSS_RATIO_3BY4_NSS = 0x1,
287 	WLAN_NSS_RATIO_1_NSS = 0x2,
288 	WLAN_NSS_RATIO_2_NSS = 0x3,
289 };
290 
291 /**
292  * struct wlan_objmgr_psoc_regulatory -  Regulatory sub structure of PSOC
293  * @country_code:  Country code
294  * @reg_dmn:       Regulatory Domain
295  * @reg_flags:     Regulatory flags
296  */
297 struct wlan_objmgr_psoc_regulatory {
298 	uint16_t country_code;
299 	uint16_t reg_dmn;
300 	uint16_t reg_flags;
301 };
302 
303 /**
304  * struct wlan_objmgr_psoc_user_config -  user configurations to
305  * be used by common modules
306  * @is_11d_support_enabled: Enable/disable 11d feature
307  * @is_11h_support_enabled: Enable/disable 11h feature
308  * @dot11_mode: Phy mode
309  * @skip_dfs_chnl_in_p2p_search: Skip Dfs Channel in case of P2P
310  *                             Search
311  * @band_capability: Preferred band (0:Both,  1:2G only,  2:5G only)
312  */
313 struct wlan_objmgr_psoc_user_config {
314 	bool is_11d_support_enabled;
315 	bool is_11h_support_enabled;
316 	uint8_t dot11_mode;
317 	uint8_t band_capability;
318 };
319 
320 /**
321  * struct wlan_objmgr_psoc_nif - HDD/OSIF specific sub structure of PSOC
322  * @phy_version:     phy version, read in device probe
323  * @phy_type:        OL/DA type
324  * @soc_fw_caps:     FW capabilities
325  * @soc_fw_ext_caps: FW ext capabilities
326  * @soc_fw_ext2_caps: FW ext2 capabilities
327  * @soc_feature_caps:Feature capabilities
328  * @soc_op_flags:    Flags to set/reset during operation
329  * @soc_hw_macaddr:  HW MAC address
330  * @user_config:     user config from OS layer
331  */
332 struct wlan_objmgr_psoc_nif {
333 	uint32_t phy_version;
334 	WLAN_DEV_TYPE phy_type;
335 	uint32_t soc_fw_caps;
336 	uint32_t soc_fw_ext_caps;
337 	uint32_t soc_fw_ext2_caps;
338 	uint32_t soc_feature_caps;
339 	uint32_t soc_op_flags;
340 	uint8_t soc_hw_macaddr[QDF_MAC_ADDR_SIZE];
341 	struct wlan_objmgr_psoc_user_config user_config;
342 };
343 
344 /**
345  * struct wlan_objmgr_psoc_objmgr - psoc object manager sub structure
346  * @psoc_id:              The PSOC's numeric Id
347  * @wlan_pdev_count:      PDEV count
348  * @wlan_pdev_id_map:     PDEV id map, to allocate free ids
349  * @wlan_vdev_count:      VDEV count
350  * @max_vdev_count:       Max no. of VDEVs supported by this PSOC
351  * @print_cnt:            Count to throttle Logical delete prints
352  * @wlan_peer_count:      PEER count
353  * @max_peer_count:       Max no. of peers supported by this PSOC
354  * @temp_peer_count:      Temporary peer count
355  * @wlan_pdev_list:       PDEV list
356  * @wlan_vdev_list:       VDEV list
357  * @wlan_vdev_id_map:     VDEV id map, to allocate free ids
358  * @peer_list:            Peer list
359  * @ref_cnt:              Ref count
360  * @ref_id_dbg:           Array to track Ref count
361  * @qdf_dev:              QDF Device
362  */
363 struct wlan_objmgr_psoc_objmgr {
364 	uint8_t psoc_id;
365 	uint8_t wlan_pdev_count;
366 	uint8_t wlan_pdev_id_map;
367 	uint16_t wlan_vdev_count;
368 	uint16_t max_vdev_count;
369 	uint8_t print_cnt;
370 	uint16_t wlan_peer_count;
371 	uint16_t max_peer_count;
372 	uint16_t temp_peer_count;
373 	struct wlan_objmgr_pdev *wlan_pdev_list[WLAN_UMAC_MAX_PDEVS];
374 	struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_PSOC_MAX_VDEVS];
375 	qdf_bitmap(wlan_vdev_id_map, WLAN_UMAC_PSOC_MAX_VDEVS);
376 	struct wlan_peer_list peer_list;
377 	qdf_atomic_t ref_cnt;
378 	qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
379 	qdf_device_t qdf_dev;
380 };
381 
382 /**
383  * struct wlan_soc_southbound_cb - Southbound callbacks
384  * @tx_ops: contains southbound tx callbacks
385  * @rx_ops: contains southbound rx callbacks
386  */
387 struct wlan_soc_southbound_cb {
388 	struct wlan_lmac_if_tx_ops *tx_ops;
389 	struct wlan_lmac_if_rx_ops *rx_ops;
390 };
391 
392 /**
393  * struct wlan_concurrency_info - structure for concurrency info
394  *
395  */
396 struct wlan_concurrency_info {
397 };
398 
399 /**
400  * struct wlan_soc_timer - structure for soc timer
401  *
402  */
403 struct wlan_soc_timer {
404 };
405 
406 /**
407  * struct wlan_objmgr_psoc - PSOC common object
408  * @soc_reg:               regulatory sub structure
409  * @soc_nif:               nif sub structure
410  * @soc_objmgr:            object manager sub structure
411  * @soc_cb:                south bound callbacks
412  * @soc_timer:             soc timer for inactivity
413  * @soc_concurrency:       concurrency info
414  * @soc_comp_priv_obj:     component private object pointers
415  * @obj_status:            component object status
416  * @obj_state:             object state
417  * @tgt_if_handle:         target interface handle
418  * @dp_handle:             DP module handle
419  * @psoc_lock:             psoc lock
420  * @skip_mlo_pumac:        skip this psoc as MLO primary umac
421  */
422 struct wlan_objmgr_psoc {
423 	struct wlan_objmgr_psoc_regulatory soc_reg;
424 	struct wlan_objmgr_psoc_nif  soc_nif;
425 	struct wlan_objmgr_psoc_objmgr soc_objmgr;
426 	struct wlan_soc_southbound_cb soc_cb;
427 	struct wlan_soc_timer soc_timer;
428 	struct wlan_concurrency_info soc_concurrency; /*TODO */
429 	void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
430 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
431 	WLAN_OBJ_STATE obj_state;
432 	struct target_psoc_info *tgt_if_handle;
433 	void *dp_handle;
434 	qdf_spinlock_t psoc_lock;
435 	bool skip_mlo_pumac;
436 };
437 
438 /**
439  * struct wlan_psoc_host_hal_reg_capabilities_ext: Below are Reg caps per PHY.
440  *                       Please note PHY ID starts with 0.
441  * @phy_id: phy id starts with 0.
442  * @eeprom_reg_domain: regdomain value specified in EEPROM
443  * @eeprom_reg_domain_ext: regdomain
444  * @regcap1: CAP1 capabilities bit map, see REGDMN_CAP1_ defines
445  * @regcap2: REGDMN EEPROM CAP, see REGDMN_EEPROM_EEREGCAP_ defines
446  * @wireless_modes: REGDMN MODE, see REGDMN_MODE_ enum
447  * @low_2ghz_chan: 2 GHz channel low
448  * @high_2ghz_chan: 2 GHz channel High
449  * @low_5ghz_chan: 5 GHz channel low
450  * @high_5ghz_chan: 5 GHz channel High
451  */
452 struct wlan_psoc_host_hal_reg_capabilities_ext {
453 	uint32_t phy_id;
454 	uint32_t eeprom_reg_domain;
455 	uint32_t eeprom_reg_domain_ext;
456 	uint32_t regcap1;
457 	uint32_t regcap2;
458 	uint64_t wireless_modes;
459 	uint32_t low_2ghz_chan;
460 	uint32_t high_2ghz_chan;
461 	uint32_t low_5ghz_chan;
462 	uint32_t high_5ghz_chan;
463 };
464 
465 /**
466  * struct wlan_psoc_host_hal_reg_capabilities_ext2 - HAL reg capabilities
467  * from service ready ext2 event.
468  * @phy_id: phy id starts with 0
469  * @wireless_modes_ext: REGDMN MODE, see REGDMN_MODE_ enum
470  * @low_2ghz_chan_ext: 2 GHz channel low
471  * @high_2ghz_chan_ext: 2 GHz channel High
472  * @low_5ghz_chan_ext: 5 GHz channel low
473  * @high_5ghz_chan_ext: 5 GHz channel High
474  */
475 struct wlan_psoc_host_hal_reg_capabilities_ext2 {
476 	uint32_t phy_id;
477 	uint64_t wireless_modes_ext;
478 	uint32_t low_2ghz_chan_ext;
479 	uint32_t high_2ghz_chan_ext;
480 	uint32_t low_5ghz_chan_ext;
481 	uint32_t high_5ghz_chan_ext;
482 };
483 
484 /*
485  * APIs to Create/Delete Global object APIs
486  */
487 /**
488  * wlan_objmgr_psoc_obj_create() - psoc object create
489  * @phy_version: device id (from probe)
490  * @dev_type: Offload/DA
491  *
492  * Creates PSOC object, initializes with default values
493  * Invokes the registered notifiers to create component object
494  *
495  * Return: Handle to struct wlan_objmgr_psoc on successful creation,
496  *         NULL on Failure (on Mem alloc failure and Component objects
497  *         Failure)
498  */
499 struct wlan_objmgr_psoc *wlan_objmgr_psoc_obj_create(uint32_t phy_version,
500 				WLAN_DEV_TYPE dev_type);
501 
502 /**
503  * wlan_objmgr_psoc_obj_delete() - psoc object delete
504  * @psoc: PSOC object
505  *
506  * Logically deletes PSOC object,
507  * Once all the references are released, object manager invokes the registered
508  * notifiers to destroy component objects
509  *
510  * Return: SUCCESS/FAILURE
511  */
512 QDF_STATUS wlan_objmgr_psoc_obj_delete(struct wlan_objmgr_psoc *psoc);
513 
514 /*
515  * APIs to attach/detach component objects
516  */
517 
518 /**
519  * wlan_objmgr_psoc_component_obj_attach() - psoc comp object attach
520  * @psoc: PSOC object
521  * @id: Component id
522  * @comp_priv_obj: component's private object pointer
523  * @status: Component's private object creation status
524  *
525  * API to be used for attaching component object with PSOC common object
526  *
527  * Return: SUCCESS on successful storing of component's object in common object
528  *         On FAILURE (appropriate failure codes are returned)
529  */
530 QDF_STATUS wlan_objmgr_psoc_component_obj_attach(
531 		struct wlan_objmgr_psoc *psoc,
532 		enum wlan_umac_comp_id id,
533 		void *comp_priv_obj,
534 		QDF_STATUS status);
535 
536 /**
537  * wlan_objmgr_psoc_component_obj_detach() - psoc comp object detach
538  * @psoc: PSOC object
539  * @id: Component id
540  * @comp_priv_obj: component's private object pointer
541  *
542  * API to be used for detaching component object with PSOC common object
543  *
544  * Return: SUCCESS on successful removal of component's object from common
545  *         object
546  *         On FAILURE (appropriate failure codes are returned)
547  */
548 QDF_STATUS wlan_objmgr_psoc_component_obj_detach(
549 		struct wlan_objmgr_psoc *psoc,
550 		enum wlan_umac_comp_id id,
551 		void *comp_priv_obj);
552 
553 /*
554  * APIs to operations on psoc objects
555  */
556 typedef void (*wlan_objmgr_op_handler)(struct wlan_objmgr_psoc *psoc,
557 					void *object,
558 					void *arg);
559 
560 /**
561  * wlan_objmgr_iterate_obj_list() - iterate through all psoc objects
562  *                                  (CREATED state)
563  * @psoc: PSOC object
564  * @obj_type: PDEV_OP/VDEV_OP/PEER_OP
565  * @handler: the handler will be called for each object of requested type
566  *            the handler should be implemented to perform required operation
567  * @arg:     arguments passed by caller
568  * @lock_free_op: its obsolete
569  * @dbg_id: id of the caller
570  *
571  * API to be used for performing the operations on all PDEV/VDEV/PEER objects
572  * of psoc
573  *
574  * Return: SUCCESS/FAILURE
575  */
576 QDF_STATUS wlan_objmgr_iterate_obj_list(
577 		struct wlan_objmgr_psoc *psoc,
578 		enum wlan_objmgr_obj_type obj_type,
579 		wlan_objmgr_op_handler handler,
580 		void *arg, uint8_t lock_free_op,
581 		wlan_objmgr_ref_dbgid dbg_id);
582 
583 /**
584  * wlan_objmgr_iterate_obj_list_all() - iterate through all psoc objects
585  * @psoc: PSOC object
586  * @obj_type: PDEV_OP/VDEV_OP/PEER_OP
587  * @handler: the handler will be called for each object of requested type
588  *            the handler should be implemented to perform required operation
589  * @arg:     arguments passed by caller
590  * @lock_free_op: its obsolete
591  * @dbg_id: id of the caller
592  *
593  * API to be used for performing the operations on all PDEV/VDEV/PEER objects
594  * of psoc
595  *
596  * Return: SUCCESS/FAILURE
597  */
598 QDF_STATUS wlan_objmgr_iterate_obj_list_all(
599 		struct wlan_objmgr_psoc *psoc,
600 		enum wlan_objmgr_obj_type obj_type,
601 		wlan_objmgr_op_handler handler,
602 		void *arg, uint8_t lock_free_op,
603 		wlan_objmgr_ref_dbgid dbg_id);
604 
605 /**
606  * wlan_objmgr_free_all_objects_per_psoc() - free all psoc objects
607  * @psoc: PSOC object
608  *
609  * API to be used free all the objects(pdev/vdev/peer) of psoc
610  *
611  * Return: SUCCESS/FAILURE
612  */
613 QDF_STATUS wlan_objmgr_free_all_objects_per_psoc(
614 		struct wlan_objmgr_psoc *psoc);
615 
616 /**
617  * wlan_objmgr_trigger_psoc_comp_priv_object_creation() - create
618  * psoc comp object
619  * @psoc: PSOC object
620  * @id: Component id
621  *
622  * API to create component private object in run time, this would
623  * be used for features which gets enabled in run time
624  *
625  * Return: SUCCESS on successful creation
626  *         On FAILURE (appropriate failure codes are returned)
627  */
628 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_creation(
629 		struct wlan_objmgr_psoc *psoc,
630 		enum wlan_umac_comp_id id);
631 
632 /**
633  * wlan_objmgr_trigger_psoc_comp_priv_object_deletion() - destroy
634  * psoc comp object
635  * @psoc: PSOC object
636  * @id: Component id
637  *
638  * API to destroy component private object in run time, this would
639  * be used for features which gets disabled in run time
640  *
641  * Return: SUCCESS on successful deletion
642  *         On FAILURE (appropriate failure codes are returned)
643  */
644 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_deletion(
645 		struct wlan_objmgr_psoc *psoc,
646 		enum wlan_umac_comp_id id);
647 
648 /**
649  * wlan_objmgr_get_peer_by_mac() - find peer from psoc's peer list
650  * @psoc: PSOC object
651  * @macaddr: MAC address
652  * @dbg_id: id of the caller
653  *
654  * API to find peer object pointer by MAC addr
655  *
656  * This API increments the ref count of the peer object internally, the
657  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
658  * ref count
659  *
660  * Return: peer pointer
661  *         NULL on FAILURE
662  */
663 #ifdef WLAN_OBJMGR_REF_ID_TRACE
664 #define wlan_objmgr_get_peer_by_mac(psoc, macaddr, dbg_id) \
665 		wlan_objmgr_get_peer_by_mac_debug(psoc, macaddr, dbg_id, \
666 		__func__, __LINE__)
667 
668 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_debug(
669 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
670 		wlan_objmgr_ref_dbgid dbg_id, const char *func, int line);
671 #else
672 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac(
673 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
674 		wlan_objmgr_ref_dbgid dbg_id);
675 #endif
676 
677 /**
678  * wlan_objmgr_get_peer() - find peer from psoc's peer list
679  * @psoc: PSOC object
680  * @pdev_id: Pdev id
681  * @macaddr: MAC address
682  * @dbg_id: id of the caller
683  *
684  * API to find peer object pointer by MAC addr and pdev id
685  *
686  * This API increments the ref count of the peer object internally, the
687  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
688  * ref count
689  *
690  * Return: peer pointer
691  *         NULL on FAILURE
692  */
693 #ifdef WLAN_OBJMGR_REF_ID_TRACE
694 #define wlan_objmgr_get_peer(psoc, pdev_id, macaddr, dbg_id) \
695 		wlan_objmgr_get_peer_debug(psoc, pdev_id, macaddr, dbg_id, \
696 		__func__, __LINE__)
697 
698 struct wlan_objmgr_peer *wlan_objmgr_get_peer_debug(
699 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
700 			const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id,
701 			const char *func, int line);
702 #else
703 struct wlan_objmgr_peer *wlan_objmgr_get_peer(
704 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
705 			const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
706 #endif
707 
708 /**
709  * wlan_objmgr_get_peer_nolock() - find peer from psoc's peer list (lock free)
710  * @psoc: PSOC object
711  * @pdev_id: Pdev id
712  * @macaddr: MAC address
713  * @dbg_id: id of the caller
714  *
715  * API to find peer object pointer by MAC addr
716  *
717  * This API increments the ref count of the peer object internally, the
718  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
719  * ref count
720  *
721  * Return: peer pointer
722  *         NULL on FAILURE
723  */
724 #ifdef WLAN_OBJMGR_REF_ID_TRACE
725 #define wlan_objmgr_get_peer_nolock(psoc, pdev_id, macaddr, dbg_id) \
726 		wlan_objmgr_get_peer_nolock_debug(psoc, pdev_id, macaddr, \
727 		dbg_id, __func__, __LINE__)
728 
729 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock_debug(
730 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
731 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id,
732 			const char *func, int line);
733 #else
734 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock(
735 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
736 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
737 #endif
738 
739 /**
740  * wlan_objmgr_get_peer_logically_deleted() - find peer
741  * from psoc's peer list
742  * @psoc: PSOC object
743  * @macaddr: MAC address
744  * @dbg_id: id of the caller
745  *
746  * API to find peer object pointer of logically deleted peer
747  *
748  * This API increments the ref count of the peer object internally, the
749  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
750  * ref count
751  *
752  * Return: peer pointer
753  *         NULL on FAILURE
754  */
755 #ifdef WLAN_OBJMGR_REF_ID_TRACE
756 #define wlan_objmgr_get_peer_logically_deleted(psoc, macaddr, dbg_id) \
757 		wlan_objmgr_get_peer_logically_deleted_debug(psoc, macaddr, \
758 		dbg_id, __func__, __LINE__)
759 
760 struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted_debug(
761 			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
762 			wlan_objmgr_ref_dbgid dbg_id,
763 			const char *func, int line);
764 #else
765 struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted(
766 			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
767 			wlan_objmgr_ref_dbgid dbg_id);
768 #endif
769 
770 /**
771  * wlan_objmgr_get_peer_no_state() - find peer from psoc's peer list
772  * @psoc: PSOC object
773  * @pdev_id: Pdev id
774  * @macaddr: MAC address
775  * @dbg_id: id of the caller
776  *
777  * API to find peer object pointer by MAC addr and pdev id,
778  * ignores the state check
779  *
780  * This API increments the ref count of the peer object internally, the
781  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
782  * ref count
783  *
784  * Return: peer pointer
785  *         NULL on FAILURE
786  */
787 #ifdef WLAN_OBJMGR_REF_ID_TRACE
788 #define wlan_objmgr_get_peer_no_state(psoc, pdev_id, macaddr, dbg_id) \
789 		wlan_objmgr_get_peer_no_state_debug(psoc, pdev_id, macaddr, \
790 		dbg_id, __func__, __LINE__)
791 
792 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state_debug(
793 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
794 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id,
795 			const char *func, int line);
796 #else
797 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
798 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
799 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
800 #endif
801 
802 #ifdef WLAN_OBJMGR_REF_ID_TRACE
803 /**
804  * wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev_debug() -
805  *                                                           get peer from psoc
806  *                                                           peer list using
807  *                                                           mac and vdev
808  *                                                           self mac
809  * @psoc: PSOC object
810  * @pdev_id: Pdev id
811  * @macaddr: MAC address
812  * @bssid: BSSID address. NULL mac means search all.
813  * @dbg_id: id of the caller
814  * @func: function name
815  * @line: line number
816  *
817  * API to finds peer object pointer by MAC addr and BSSID from
818  * peer hash list, bssid check is done on matching peer
819  *
820  * Return: list of peer pointer pointers
821  *         NULL on FAILURE
822  */
823 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev_debug(
824 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
825 			uint8_t *bssid, uint8_t *macaddr,
826 			wlan_objmgr_ref_dbgid dbg_id,
827 			const char *func, int line);
828 
829 #define wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev( \
830 	psoc, pdev_id, bssid, macaddr, dbgid) \
831 		wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev_debug( \
832 		psoc, pdev_id, bssid, macaddr, dbgid, __func__, __LINE__)
833 #else
834 /**
835  * wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev() - get peer from
836  *                                                psoc peer list using
837  *                                                mac and vdev
838  *                                                self mac
839  * @psoc: PSOC object
840  * @pdev_id: Pdev id
841  * @bssid: BSSID address
842  * @macaddr: MAC address
843  * @dbg_id: id of the caller
844  *
845  * API to find peer object pointer by MAC addr, vdev self mac
846  * address and pdev id for a node that is logically in deleted state
847  *
848  * This API increments the ref count of the peer object internally, the
849  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
850  * ref count
851  *
852  * Return: List of peer pointers
853  *         NULL on FAILURE
854  */
855 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
856 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
857 			uint8_t *bssid, uint8_t *macaddr,
858 			wlan_objmgr_ref_dbgid dbg_id);
859 #endif
860 
861 /**
862  * wlan_objmgr_get_peer_by_mac_n_vdev() - find peer from psoc's peer list
863  *                                          using mac address and bssid
864  * @psoc: PSOC object
865  * @pdev_id: Pdev id
866  * @bssid: MAC address of AP its associated
867  * @macaddr: MAC address
868  * @dbg_id: id of the caller
869  *
870  * API to find peer object pointer by MAC addr and vdev self mac address
871  * and pdev id
872  *
873  * This API increments the ref count of the peer object internally, the
874  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
875  * ref count
876  *
877  * Return: peer pointer
878  *         NULL on FAILURE
879  */
880 #ifdef WLAN_OBJMGR_REF_ID_TRACE
881 #define wlan_objmgr_get_peer_by_mac_n_vdev(psoc, pdev_id, bssid, macaddr, \
882 	dbg_id) \
883 		wlan_objmgr_get_peer_by_mac_n_vdev_debug(psoc, pdev_id, \
884 		bssid, macaddr, dbg_id, __func__, __LINE__)
885 
886 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_debug(
887 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
888 			uint8_t *bssid, uint8_t *macaddr,
889 			wlan_objmgr_ref_dbgid dbg_id,
890 			const char *func, int line);
891 #else
892 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
893 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
894 			uint8_t *bssid, uint8_t *macaddr,
895 			wlan_objmgr_ref_dbgid dbg_id);
896 #endif
897 
898 /**
899  * wlan_objmgr_get_peer_by_mac_n_vdev_no_state() - find peer from psoc's peer
900  *                                          list using mac address and bssid
901  * @psoc: PSOC object
902  * @pdev_id: Pdev id
903  * @bssid: MAC address of AP its associated
904  * @macaddr: MAC address
905  * @dbg_id: id of the caller
906  *
907  * API to find peer object pointer by MAC addr, vdev self mac address,
908  * and pdev id ,ignores the state
909  *
910  * This API increments the ref count of the peer object internally, the
911  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
912  * ref count
913  *
914  * Return: peer pointer
915  *         NULL on FAILURE
916  */
917 #ifdef WLAN_OBJMGR_REF_ID_TRACE
918 #define wlan_objmgr_get_peer_by_mac_n_vdev_no_state(psoc, pdev_id, bssid, \
919 	macaddr, dbg_id) \
920 		wlan_objmgr_get_peer_by_mac_n_vdev_no_state_debug(psoc, \
921 		pdev_id, bssid, macaddr, dbg_id, __func__, __LINE__)
922 
923 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state_debug(
924 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
925 			uint8_t *bssid,  uint8_t *macaddr,
926 			wlan_objmgr_ref_dbgid dbg_id,
927 			const char *func, int line);
928 #else
929 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state(
930 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
931 			uint8_t *bssid,  uint8_t *macaddr,
932 			wlan_objmgr_ref_dbgid dbg_id);
933 #endif
934 
935 /**
936  * wlan_objmgr_get_pdev_by_id() - retrieve pdev by id
937  * @psoc: PSOC object
938  * @id: pdev id
939  * @dbg_id: id of the caller
940  *
941  * API to find pdev object pointer by pdev id
942  *
943  * This API increments the ref count of the pdev object internally, the
944  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
945  * ref count
946  *
947  * Return: pdev pointer
948  *         NULL on FAILURE
949  */
950 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id(
951 		struct wlan_objmgr_psoc *psoc, uint8_t id,
952 		wlan_objmgr_ref_dbgid dbg_id);
953 
954 /**
955  * wlan_objmgr_get_pdev_by_id_no_state() - retrieve pdev by id
956  * @psoc: PSOC object
957  * @id: pdev id
958  * @dbg_id: id of the caller
959  *
960  * API to find pdev object pointer by pdev id, Ignores the state check
961  *
962  * This API increments the ref count of the pdev object internally, the
963  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
964  * ref count
965  *
966  * Return: pdev pointer
967  *         NULL on FAILURE
968  */
969 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id_no_state(
970 			struct wlan_objmgr_psoc *psoc, uint8_t id,
971 			wlan_objmgr_ref_dbgid dbg_id);
972 
973 /**
974  * wlan_objmgr_get_pdev_by_macaddr() - retrieve pdev by macaddr
975  * @psoc: PSOC object
976  * @macaddr: MAC address
977  * @dbg_id: id of the caller
978  *
979  * API to find pdev object pointer by pdev macaddr
980  *
981  * This API increments the ref count of the pdev object internally, the
982  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
983  * ref count
984  *
985  * Return: pdev pointer
986  *         NULL on FAILURE
987  */
988 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr(
989 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
990 		wlan_objmgr_ref_dbgid dbg_id);
991 
992 /**
993  * wlan_objmgr_get_pdev_by_macaddr_no_state() - retrieve pdev by macaddr
994  * @psoc: PSOC object
995  * @macaddr: MAC address
996  * @dbg_id: id of the caller
997  *
998  * API to find pdev object pointer by pdev macaddr, ignores the state check
999  *
1000  * This API increments the ref count of the pdev object internally, the
1001  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
1002  * ref count
1003  *
1004  * Return: pdev pointer
1005  *         NULL on FAILURE
1006  */
1007 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr_no_state(
1008 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
1009 		wlan_objmgr_ref_dbgid dbg_id);
1010 
1011 /**
1012  * wlan_objmgr_get_vdev_by_opmode_from_psoc() - retrieve vdev by opmode
1013  * @psoc: PSOC object
1014  * @opmode: vdev operating mode
1015  * @dbg_id: id of the caller
1016  *
1017  * API to find vdev object pointer by vdev operating mode from psoc
1018  *
1019  * This API increments the ref count of the vdev object internally, the
1020  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1021  * ref count
1022  *
1023  * Return: vdev pointer
1024  *         NULL on FAILURE
1025  */
1026 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1027 #define wlan_objmgr_get_vdev_by_opmode_from_psoc(psoc, opmode, dbg_id) \
1028 		wlan_objmgr_get_vdev_by_opmode_from_psoc_debug(psoc, opmode, \
1029 		dbg_id, __func__, __LINE__)
1030 
1031 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_opmode_from_psoc_debug(
1032 			struct wlan_objmgr_psoc *psoc,
1033 			enum QDF_OPMODE opmode,
1034 			wlan_objmgr_ref_dbgid dbg_id,
1035 			const char *func, int line);
1036 #else
1037 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_opmode_from_psoc(
1038 			struct wlan_objmgr_psoc *psoc,
1039 			enum QDF_OPMODE opmode,
1040 			wlan_objmgr_ref_dbgid dbg_id);
1041 #endif
1042 
1043 /**
1044  * wlan_objmgr_get_vdev_by_id_from_psoc() - retrieve vdev by id
1045  * @psoc: PSOC object
1046  * @vdev_id: vdev id
1047  * @dbg_id: id of the caller
1048  *
1049  * API to find vdev object pointer by vdev id from psoc
1050  *
1051  * This API increments the ref count of the vdev object internally, the
1052  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1053  * ref count
1054  *
1055  * Return: vdev pointer
1056  *         NULL on FAILURE
1057  */
1058 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1059 #define wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, dbg_id) \
1060 		wlan_objmgr_get_vdev_by_id_from_psoc_debug(psoc, vdev_id, \
1061 		dbg_id, __func__, __LINE__)
1062 
1063 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_debug(
1064 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1065 			wlan_objmgr_ref_dbgid dbg_id,
1066 			const char *func, int line);
1067 #else
1068 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc(
1069 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1070 			wlan_objmgr_ref_dbgid dbg_id);
1071 #endif
1072 
1073 /**
1074  * wlan_objmgr_get_vdev_by_id_from_psoc_no_state() - retrieve vdev by id
1075  * @psoc: PSOC object
1076  * @vdev_id: vdev id
1077  * @dbg_id: id of the caller
1078  *
1079  * API to find vdev object pointer by vdev id from psoc, ignores the
1080  * state check
1081  *
1082  * This API increments the ref count of the vdev object internally, the
1083  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1084  * ref count
1085  *
1086  * Return: vdev pointer
1087  *         NULL on FAILURE
1088  */
1089 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1090 #define wlan_objmgr_get_vdev_by_id_from_psoc_no_state(psoc, vdev_id, dbg_id) \
1091 		wlan_objmgr_get_vdev_by_id_from_psoc_no_state_debug(psoc, \
1092 		vdev_id, dbg_id, __func__, __LINE__)
1093 
1094 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state_debug(
1095 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1096 			wlan_objmgr_ref_dbgid dbg_id,
1097 			const char *func, int line);
1098 #else
1099 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state(
1100 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1101 			wlan_objmgr_ref_dbgid dbg_id);
1102 #endif
1103 
1104 /**
1105  * wlan_objmgr_get_vdev_by_id_from_psoc_not_log_del() - retrieve vdev by id
1106  * @psoc: PSOC object
1107  * @vdev_id: vdev id
1108  * @dbg_id: id of the caller
1109  *
1110  * API to find vdev object pointer by vdev id from psoc, ignores the
1111  * state check
1112  *
1113  * This API increments the ref count of the vdev object internally, the
1114  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1115  * ref count
1116  *
1117  * Return: vdev pointer
1118  *         NULL on FAILURE
1119  */
1120 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1121 #define wlan_objmgr_get_vdev_by_id_from_psoc_not_log_del(psoc, vdev_id, dbg_id) \
1122 		wlan_objmgr_get_vdev_by_id_from_psoc_not_log_del_debug(psoc, \
1123 		vdev_id, dbg_id, __func__, __LINE__)
1124 
1125 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_not_log_del_debug(
1126 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1127 			wlan_objmgr_ref_dbgid dbg_id,
1128 			const char *func, int line);
1129 #else
1130 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_not_log_del(
1131 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
1132 			wlan_objmgr_ref_dbgid dbg_id);
1133 #endif
1134 
1135 /**
1136  * wlan_objmgr_get_vdev_by_macaddr_from_psoc() - retrieve vdev by macaddr
1137  * @psoc: PSOC object
1138  * @pdev_id: Pdev id
1139  * @macaddr: macaddr
1140  * @dbg_id: id of the caller
1141  *
1142  * API to find vdev object pointer by vdev macaddr from pdev
1143  *
1144  * This API increments the ref count of the vdev object internally, the
1145  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1146  * ref count
1147  *
1148  * Return: vdev pointer
1149  *         NULL on FAILURE
1150  */
1151 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1152 #define wlan_objmgr_get_vdev_by_macaddr_from_psoc(psoc, pdev_id, macaddr, \
1153 	dbg_id) \
1154 		wlan_objmgr_get_vdev_by_macaddr_from_psoc_debug(psoc, pdev_id, \
1155 		macaddr, dbg_id, __func__, __LINE__)
1156 
1157 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_debug(
1158 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
1159 		const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id,
1160 		const char *func, int line);
1161 #else
1162 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc(
1163 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
1164 		const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
1165 #endif
1166 
1167 /**
1168  * wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state() - retrieve vdev by
1169  *                                                           macaddr
1170  * @psoc: PSOC object
1171  * @pdev_id: Pdev id
1172  * @macaddr: macaddr
1173  * @dbg_id: id of the caller
1174  *
1175  * API to find vdev object pointer by vdev macaddr from psoc, ignores the state
1176  * check
1177  *
1178  * This API increments the ref count of the vdev object internally, the
1179  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
1180  * ref count
1181  *
1182  * Return: vdev pointer
1183  *         NULL on FAILURE
1184  */
1185 #ifdef WLAN_OBJMGR_REF_ID_TRACE
1186 #define wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state(psoc, pdev_id, \
1187 	macaddr, dbg_id) \
1188 		wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state_debug(psoc, \
1189 		pdev_id, macaddr, dbg_id, __func__, __LINE__)
1190 
1191 struct wlan_objmgr_vdev
1192 	*wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state_debug(
1193 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
1194 		const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id,
1195 		const char *func, int line);
1196 #else
1197 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state(
1198 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
1199 		const uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
1200 #endif
1201 
1202 /**
1203  * wlan_psoc_obj_lock() - Acquire PSOC spinlock
1204  * @psoc: PSOC object
1205  *
1206  * API to acquire PSOC lock
1207  * Parent lock should not be taken in child lock context
1208  * but child lock can be taken in parent lock context
1209  * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context)
1210  *
1211  * Return: void
1212  */
wlan_psoc_obj_lock(struct wlan_objmgr_psoc * psoc)1213 static inline void wlan_psoc_obj_lock(struct wlan_objmgr_psoc *psoc)
1214 {
1215 	qdf_spin_lock_bh(&psoc->psoc_lock);
1216 }
1217 
1218 /**
1219  * wlan_psoc_obj_unlock() - Release PSOC spinlock
1220  * @psoc: PSOC object
1221  *
1222  * API to Release PSOC lock
1223  *
1224  * Return: void
1225  */
wlan_psoc_obj_unlock(struct wlan_objmgr_psoc * psoc)1226 static inline void wlan_psoc_obj_unlock(struct wlan_objmgr_psoc *psoc)
1227 {
1228 	qdf_spin_unlock_bh(&psoc->psoc_lock);
1229 }
1230 
1231 /**
1232  * wlan_psoc_set_nif_phy_version() - set nif phy version
1233  * @psoc: PSOC object
1234  * @phy_ver: phy version
1235  *
1236  * API to set nif phy version in psoc
1237  *
1238  * Return: void
1239  */
wlan_psoc_set_nif_phy_version(struct wlan_objmgr_psoc * psoc,uint32_t phy_ver)1240 static inline void wlan_psoc_set_nif_phy_version(struct wlan_objmgr_psoc *psoc,
1241 			uint32_t phy_ver)
1242 {
1243 	psoc->soc_nif.phy_version = phy_ver;
1244 }
1245 
1246 /**
1247  * wlan_psoc_get_nif_phy_version() - get nif phy version
1248  * @psoc: PSOC object
1249  *
1250  * API to set nif phy version in psoc
1251  *
1252  * Return: @phy_ver: phy version
1253  */
wlan_psoc_get_nif_phy_version(struct wlan_objmgr_psoc * psoc)1254 static inline uint32_t wlan_psoc_get_nif_phy_version(
1255 			struct wlan_objmgr_psoc *psoc)
1256 {
1257 	if (!psoc)
1258 		return (uint32_t)-1;
1259 
1260 	return psoc->soc_nif.phy_version;
1261 }
1262 
1263 /**
1264  * wlan_psoc_set_dev_type() - set dev type
1265  * @psoc: PSOC object
1266  * @phy_type: phy type (OL/DA)
1267  *
1268  * API to set dev type in psoc
1269  *
1270  * Return: void
1271  */
wlan_psoc_set_dev_type(struct wlan_objmgr_psoc * psoc,WLAN_DEV_TYPE phy_type)1272 static inline void wlan_psoc_set_dev_type(struct wlan_objmgr_psoc *psoc,
1273 				WLAN_DEV_TYPE phy_type)
1274 {
1275 	psoc->soc_nif.phy_type = phy_type;
1276 }
1277 
1278 /**
1279  * wlan_objmgr_psoc_get_dev_type - get dev type
1280  * @psoc: PSOC object
1281  *
1282  * API to get dev type in psoc
1283  *
1284  * Return: phy type (OL/DA)
1285  */
wlan_objmgr_psoc_get_dev_type(struct wlan_objmgr_psoc * psoc)1286 static inline WLAN_DEV_TYPE wlan_objmgr_psoc_get_dev_type(
1287 				struct wlan_objmgr_psoc *psoc)
1288 {
1289 	if (!psoc)
1290 		return (uint32_t)-1;
1291 
1292 	return psoc->soc_nif.phy_type;
1293 }
1294 
1295 /**
1296  * wlan_psoc_nif_fw_cap_set() - set fw caps
1297  * @psoc: PSOC object
1298  * @cap: capability flag to be set
1299  *
1300  * API to set fw caps in psoc
1301  *
1302  * Return: void
1303  */
wlan_psoc_nif_fw_cap_set(struct wlan_objmgr_psoc * psoc,uint32_t cap)1304 static inline void wlan_psoc_nif_fw_cap_set(struct wlan_objmgr_psoc *psoc,
1305 					uint32_t cap)
1306 {
1307 	psoc->soc_nif.soc_fw_caps |= cap;
1308 }
1309 
1310 /**
1311  * wlan_psoc_nif_fw_cap_clear() - clear fw caps
1312  * @psoc: PSOC object
1313  * @cap: capability flag to be cleared
1314  *
1315  * API to clear fw caps in psoc
1316  *
1317  * Return: void
1318  */
wlan_psoc_nif_fw_cap_clear(struct wlan_objmgr_psoc * psoc,uint32_t cap)1319 static inline void wlan_psoc_nif_fw_cap_clear(struct wlan_objmgr_psoc *psoc,
1320 				uint32_t cap)
1321 {
1322 	psoc->soc_nif.soc_fw_caps &= ~cap;
1323 }
1324 
1325 /**
1326  * wlan_psoc_nif_fw_cap_get() - get fw caps
1327  * @psoc: PSOC object
1328  * @cap: capability flag to be checked
1329  *
1330  * API to know, whether particular fw caps flag is set in psoc
1331  *
1332  * Return: 1 (for set) or 0 (for not set)
1333  */
wlan_psoc_nif_fw_cap_get(struct wlan_objmgr_psoc * psoc,uint32_t cap)1334 static inline uint8_t wlan_psoc_nif_fw_cap_get(struct wlan_objmgr_psoc *psoc,
1335 				uint32_t cap)
1336 {
1337 	return (psoc->soc_nif.soc_fw_caps & cap) ? 1 : 0;
1338 }
1339 
1340 /**
1341  * wlan_psoc_nif_fw_ext_cap_set() - set fw ext caps
1342  * @psoc: PSOC object
1343  * @ext_cap: capability flag to be set
1344  *
1345  * API to set fw ext caps in psoc
1346  *
1347  * Return: void
1348  */
wlan_psoc_nif_fw_ext_cap_set(struct wlan_objmgr_psoc * psoc,uint32_t ext_cap)1349 static inline void wlan_psoc_nif_fw_ext_cap_set(struct wlan_objmgr_psoc *psoc,
1350 				uint32_t ext_cap)
1351 {
1352 	psoc->soc_nif.soc_fw_ext_caps |= ext_cap;
1353 }
1354 
1355 /**
1356  * wlan_psoc_nif_fw_ext_cap_clear() - clear fw ext caps
1357  * @psoc: PSOC object
1358  * @ext_cap: capability flag to be cleared
1359  *
1360  * API to clear fw ext caps in psoc
1361  *
1362  * Return: void
1363  */
wlan_psoc_nif_fw_ext_cap_clear(struct wlan_objmgr_psoc * psoc,uint32_t ext_cap)1364 static inline void wlan_psoc_nif_fw_ext_cap_clear(struct wlan_objmgr_psoc *psoc,
1365 				uint32_t ext_cap)
1366 {
1367 	psoc->soc_nif.soc_fw_ext_caps &= ~ext_cap;
1368 }
1369 
1370 /**
1371  * wlan_psoc_nif_fw_ext_cap_get() - get fw caps
1372  * @psoc: PSOC object
1373  * @ext_cap: capability flag to be checked
1374  *
1375  * API to know, whether particular fw caps flag is set in psoc
1376  *
1377  * Return: 1 (for set) or 0 (for not set)
1378  */
wlan_psoc_nif_fw_ext_cap_get(struct wlan_objmgr_psoc * psoc,uint32_t ext_cap)1379 static inline uint8_t wlan_psoc_nif_fw_ext_cap_get(
1380 		struct wlan_objmgr_psoc *psoc, uint32_t ext_cap)
1381 {
1382 	return (psoc->soc_nif.soc_fw_ext_caps & ext_cap) ? 1 : 0;
1383 }
1384 
1385 /**
1386  * wlan_psoc_nif_fw_ext2_cap_set() - set fw ext2 caps
1387  * @psoc: PSOC object
1388  * @ext2_cap: capability flag to be set
1389  *
1390  * API to set fw ext caps in psoc
1391  *
1392  * Return: void
1393  */
wlan_psoc_nif_fw_ext2_cap_set(struct wlan_objmgr_psoc * psoc,uint32_t ext2_cap)1394 static inline void wlan_psoc_nif_fw_ext2_cap_set(struct wlan_objmgr_psoc *psoc,
1395 						 uint32_t ext2_cap)
1396 {
1397 	psoc->soc_nif.soc_fw_ext2_caps |= ext2_cap;
1398 }
1399 
1400 /**
1401  * wlan_psoc_nif_fw_ext2_cap_clear() - clear fw ext2 caps
1402  * @psoc: PSOC object
1403  * @ext2_cap: capability flag to be cleared
1404  *
1405  * API to clear fw ext caps in psoc
1406  *
1407  * Return: void
1408  */
1409 static inline void
wlan_psoc_nif_fw_ext2_cap_clear(struct wlan_objmgr_psoc * psoc,uint32_t ext2_cap)1410 wlan_psoc_nif_fw_ext2_cap_clear(struct wlan_objmgr_psoc *psoc,
1411 				uint32_t ext2_cap)
1412 {
1413 	psoc->soc_nif.soc_fw_ext2_caps &= ~ext2_cap;
1414 }
1415 
1416 /**
1417  * wlan_psoc_nif_fw_ext2_cap_get() - get fw caps
1418  * @psoc: PSOC object
1419  * @ext2_cap: capability flag to be checked
1420  *
1421  * API to know, whether particular fw caps flag is set in psoc
1422  *
1423  * Return: 1 (for set) or 0 (for not set)
1424  */
1425 static inline uint8_t
wlan_psoc_nif_fw_ext2_cap_get(struct wlan_objmgr_psoc * psoc,uint32_t ext2_cap)1426 wlan_psoc_nif_fw_ext2_cap_get(struct wlan_objmgr_psoc *psoc, uint32_t ext2_cap)
1427 {
1428 	return (psoc->soc_nif.soc_fw_ext2_caps & ext2_cap) ? 1 : 0;
1429 }
1430 
1431 /**
1432  * wlan_psoc_nif_feat_cap_set() - set feature caps
1433  * @psoc: PSOC object
1434  * @feat_cap: feature flag to be set
1435  *
1436  * API to set feature caps in psoc
1437  *
1438  * Return: void
1439  */
wlan_psoc_nif_feat_cap_set(struct wlan_objmgr_psoc * psoc,uint32_t feat_cap)1440 static inline void wlan_psoc_nif_feat_cap_set(struct wlan_objmgr_psoc *psoc,
1441 				uint32_t feat_cap)
1442 {
1443 	psoc->soc_nif.soc_feature_caps |= feat_cap;
1444 }
1445 
1446 /**
1447  * wlan_psoc_nif_feat_cap_clear() - clear feature caps
1448  * @psoc: PSOC object
1449  * @feat_cap: feature flag to be cleared
1450  *
1451  * API to clear feature caps in psoc
1452  *
1453  * Return: void
1454  */
wlan_psoc_nif_feat_cap_clear(struct wlan_objmgr_psoc * psoc,uint32_t feat_cap)1455 static inline void wlan_psoc_nif_feat_cap_clear(struct wlan_objmgr_psoc *psoc,
1456 				uint32_t feat_cap)
1457 {
1458 	psoc->soc_nif.soc_feature_caps &= ~feat_cap;
1459 }
1460 
1461 /**
1462  * wlan_psoc_nif_feat_cap_get() - get feature caps
1463  * @psoc: PSOC object
1464  * @feat_cap: feature flag to be checked
1465  *
1466  * API to know, whether particular feature cap flag is set in psoc
1467  *
1468  * Return: 1 (for set) or 0 (for not set)
1469  */
wlan_psoc_nif_feat_cap_get(struct wlan_objmgr_psoc * psoc,uint32_t feat_cap)1470 static inline uint8_t wlan_psoc_nif_feat_cap_get(struct wlan_objmgr_psoc *psoc,
1471 							uint32_t feat_cap)
1472 {
1473 	return (psoc->soc_nif.soc_feature_caps & feat_cap) ? 1 : 0;
1474 }
1475 
1476 /**
1477  * wlan_psoc_nif_op_flag_get() - get op flags
1478  * @psoc: PSOC object
1479  * @flag: op flag to be checked
1480  *
1481  * API to know, whether particular op flag is set in psoc
1482  *
1483  * Return: 1 (for set) or 0 (for not set)
1484  */
wlan_psoc_nif_op_flag_get(struct wlan_objmgr_psoc * psoc,uint32_t flag)1485 static inline uint8_t wlan_psoc_nif_op_flag_get(struct wlan_objmgr_psoc *psoc,
1486 						uint32_t flag)
1487 {
1488 	return (psoc->soc_nif.soc_op_flags & flag) ? 1 : 0;
1489 }
1490 
1491 /**
1492  * wlan_psoc_nif_op_flag_set() - set op flag
1493  * @psoc: PSOC object
1494  * @flag: op flag to be set
1495  *
1496  * API to set op flag in psoc
1497  *
1498  * Return: void
1499  */
wlan_psoc_nif_op_flag_set(struct wlan_objmgr_psoc * psoc,uint32_t flag)1500 static inline void wlan_psoc_nif_op_flag_set(struct wlan_objmgr_psoc *psoc,
1501 						uint32_t flag)
1502 {
1503 	psoc->soc_nif.soc_op_flags |= flag;
1504 }
1505 
1506 /**
1507  * wlan_psoc_nif_op_flag_clear() - clear op flag
1508  * @psoc: PSOC object
1509  * @flag: op flag to be cleared
1510  *
1511  * API to clear op flag in psoc
1512  *
1513  * Return: void
1514  */
wlan_psoc_nif_op_flag_clear(struct wlan_objmgr_psoc * psoc,uint32_t flag)1515 static inline void wlan_psoc_nif_op_flag_clear(struct wlan_objmgr_psoc *psoc,
1516 						uint32_t flag)
1517 {
1518 	psoc->soc_nif.soc_op_flags &= ~flag;
1519 }
1520 
1521 /**
1522  * wlan_psoc_set_hw_macaddr() - set hw mac addr
1523  * @psoc: PSOC object
1524  * @macaddr: hw macaddr
1525  *
1526  * API to set hw macaddr of psoc
1527  *
1528  * Caller need to acquire lock with wlan_psoc_obj_lock()
1529  *
1530  * Return: void
1531  */
wlan_psoc_set_hw_macaddr(struct wlan_objmgr_psoc * psoc,uint8_t * macaddr)1532 static inline void wlan_psoc_set_hw_macaddr(struct wlan_objmgr_psoc *psoc,
1533 					uint8_t *macaddr)
1534 {
1535 	/* This API is invoked with lock acquired, do not add log prints */
1536 	if (psoc)
1537 		WLAN_ADDR_COPY(psoc->soc_nif.soc_hw_macaddr, macaddr);
1538 }
1539 
1540 /**
1541  * wlan_psoc_get_hw_macaddr() - get hw macaddr
1542  * @psoc: PSOC object
1543  *
1544  * API to set hw macaddr of psoc
1545  *
1546  * Return: hw macaddr
1547  */
wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc * psoc)1548 static inline uint8_t *wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc *psoc)
1549 {
1550 	if (!psoc)
1551 		return NULL;
1552 
1553 	return psoc->soc_nif.soc_hw_macaddr;
1554 }
1555 
1556 /**
1557  * wlan_objmgr_psoc_get_comp_private_obj() - API to retrieve component object
1558  * @psoc: Psoc pointer
1559  * @id: component id
1560  *
1561  * This API is used to get the component private object pointer tied to the
1562  * corresponding psoc object
1563  *
1564  * Return: Component private object
1565  */
1566 void *wlan_objmgr_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc,
1567 					enum wlan_umac_comp_id id);
1568 /**
1569  * wlan_psoc_get_pdev_count() - get pdev count for psoc
1570  * @psoc: PSOC object
1571  *
1572  * API to get number of pdev's attached to the psoc
1573  *
1574  * Return: number of pdev's
1575  */
wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc * psoc)1576 static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc)
1577 {
1578 	if (!psoc)
1579 		return 0;
1580 
1581 	return psoc->soc_objmgr.wlan_pdev_count;
1582 }
1583 
1584 /**
1585  * wlan_psoc_set_lmac_if_txops() - API to set tx ops handle in psoc object
1586  * @psoc: Psoc pointer
1587  * @tx_ops: tx callbacks handle
1588  *
1589  * API to set tx callbacks handle in psoc object
1590  *
1591  * Return: None
1592  */
1593 static inline
wlan_psoc_set_lmac_if_txops(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_tx_ops * tx_ops)1594 void wlan_psoc_set_lmac_if_txops(struct wlan_objmgr_psoc *psoc,
1595 			  struct wlan_lmac_if_tx_ops *tx_ops)
1596 {
1597 	if (!psoc)
1598 		return;
1599 
1600 	psoc->soc_cb.tx_ops = tx_ops;
1601 }
1602 
1603 /**
1604  * wlan_psoc_get_lmac_if_txops() - API to get tx ops handle
1605  * @psoc: Psoc pointer
1606  *
1607  * API to get tx callbacks handle from psoc object
1608  *
1609  * Return: tx callbacks handle
1610  */
1611 static inline
wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc * psoc)1612 struct wlan_lmac_if_tx_ops *wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc *psoc)
1613 {
1614 	if (!psoc)
1615 		return NULL;
1616 
1617 	return psoc->soc_cb.tx_ops;
1618 }
1619 
1620 /**
1621  * wlan_psoc_set_lmac_if_rxops() - API to set rx ops handle in psoc object
1622  * @psoc: Psoc pointer
1623  * @rx_ops: rx callbacks handle
1624  *
1625  * API to set rx callbacks handle in psoc object
1626  *
1627  * Return: None
1628  */
1629 static inline
wlan_psoc_set_lmac_if_rxops(struct wlan_objmgr_psoc * psoc,struct wlan_lmac_if_rx_ops * rx_ops)1630 void wlan_psoc_set_lmac_if_rxops(struct wlan_objmgr_psoc *psoc,
1631 				 struct	wlan_lmac_if_rx_ops *rx_ops)
1632 {
1633 	if (!psoc)
1634 		return;
1635 
1636 	psoc->soc_cb.rx_ops = rx_ops;
1637 }
1638 
1639 /**
1640  * wlan_psoc_get_lmac_if_rxops() - API to get rx ops handle
1641  * @psoc: Psoc pointer
1642  *
1643  * API to get rx callbacks handle from psoc object
1644  *
1645  * Return: rx callbacks handle
1646  */
1647 static inline
wlan_psoc_get_lmac_if_rxops(struct wlan_objmgr_psoc * psoc)1648 struct wlan_lmac_if_rx_ops *wlan_psoc_get_lmac_if_rxops(struct wlan_objmgr_psoc *psoc)
1649 {
1650 	if (!psoc)
1651 		return NULL;
1652 
1653 	return psoc->soc_cb.rx_ops;
1654 }
1655 
1656 /**
1657  * wlan_psoc_set_tgt_if_handle() - API to set target if handle in psoc object
1658  * @psoc: Psoc pointer
1659  * @tgt_if_handle: target interface handle
1660  *
1661  * API to set target interface handle in psoc object
1662  *
1663  * Return: None
1664  */
1665 static inline
wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc * psoc,struct target_psoc_info * tgt_if_handle)1666 void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
1667 				 struct target_psoc_info *tgt_if_handle)
1668 {
1669 	if (!psoc)
1670 		return;
1671 
1672 	psoc->tgt_if_handle = tgt_if_handle;
1673 }
1674 
1675 /**
1676  * wlan_psoc_get_tgt_if_handle() - API to get target interface handle
1677  * @psoc: Psoc pointer
1678  *
1679  * API to get target interface handle from psoc object
1680  *
1681  * Return: target interface handle
1682  */
1683 static inline
wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc * psoc)1684 struct target_psoc_info *wlan_psoc_get_tgt_if_handle(
1685 				struct wlan_objmgr_psoc *psoc)
1686 {
1687 	if (!psoc)
1688 		return NULL;
1689 
1690 	return psoc->tgt_if_handle;
1691 }
1692 
1693 /**
1694  * wlan_psoc_get_qdf_dev() - API to get qdf device
1695  * @psoc: Psoc pointer
1696  *
1697  * API to get qdf device from psoc object
1698  *
1699  * Return: qdf_device_t
1700  */
wlan_psoc_get_qdf_dev(struct wlan_objmgr_psoc * psoc)1701 static inline qdf_device_t wlan_psoc_get_qdf_dev(
1702 			struct wlan_objmgr_psoc *psoc)
1703 {
1704 	if (!psoc)
1705 		return NULL;
1706 
1707 	return psoc->soc_objmgr.qdf_dev;
1708 }
1709 
1710 /**
1711  * wlan_psoc_set_qdf_dev() - API to get qdf device
1712  * @psoc: Psoc pointer
1713  * @dev: qdf device
1714  *
1715  * API to set qdf device from psoc object
1716  *
1717  * Return: None
1718  */
wlan_psoc_set_qdf_dev(struct wlan_objmgr_psoc * psoc,qdf_device_t dev)1719 static inline void wlan_psoc_set_qdf_dev(
1720 			struct wlan_objmgr_psoc *psoc,
1721 			qdf_device_t dev)
1722 {
1723 	if (!psoc)
1724 		return;
1725 
1726 	psoc->soc_objmgr.qdf_dev = dev;
1727 }
1728 
1729 /**
1730  * wlan_psoc_set_max_vdev_count() - set psoc max vdev count
1731  * @psoc: PSOC object
1732  * @max_vdev_count: Max vdev count
1733  *
1734  * API to set Max vdev count
1735  *
1736  * Return: void
1737  */
wlan_psoc_set_max_vdev_count(struct wlan_objmgr_psoc * psoc,uint16_t max_vdev_count)1738 static inline void wlan_psoc_set_max_vdev_count(struct wlan_objmgr_psoc *psoc,
1739 						uint16_t max_vdev_count)
1740 {
1741 	if (max_vdev_count > WLAN_UMAC_PSOC_MAX_VDEVS)
1742 		QDF_BUG(0);
1743 
1744 	psoc->soc_objmgr.max_vdev_count = max_vdev_count;
1745 }
1746 
1747 /**
1748  * wlan_psoc_get_max_vdev_count() - get psoc max vdev count
1749  * @psoc: PSOC object
1750  *
1751  * API to set Max vdev count
1752  *
1753  * Return: @vdev count: Max vdev count
1754  */
wlan_psoc_get_max_vdev_count(struct wlan_objmgr_psoc * psoc)1755 static inline uint16_t wlan_psoc_get_max_vdev_count(
1756 					struct wlan_objmgr_psoc *psoc)
1757 {
1758 	return psoc->soc_objmgr.max_vdev_count;
1759 }
1760 
1761 /**
1762  * wlan_psoc_set_max_peer_count() - set psoc max peer count
1763  * @psoc: PSOC object
1764  * @max_peer_count: Max peer count
1765  *
1766  * API to set Max peer count
1767  *
1768  * Return: void
1769  */
wlan_psoc_set_max_peer_count(struct wlan_objmgr_psoc * psoc,uint16_t max_peer_count)1770 static inline void wlan_psoc_set_max_peer_count(struct wlan_objmgr_psoc *psoc,
1771 						uint16_t max_peer_count)
1772 {
1773 	if (max_peer_count > WLAN_UMAC_PSOC_MAX_PEERS)
1774 		QDF_BUG(0);
1775 
1776 	psoc->soc_objmgr.max_peer_count = max_peer_count;
1777 }
1778 
1779 /**
1780  * wlan_psoc_get_max_peer_count() - get psoc max peer count
1781  * @psoc: PSOC object
1782  *
1783  * API to set Max peer count
1784  *
1785  * Return: @peer count: Max peer count
1786  */
wlan_psoc_get_max_peer_count(struct wlan_objmgr_psoc * psoc)1787 static inline uint16_t wlan_psoc_get_max_peer_count(
1788 					struct wlan_objmgr_psoc *psoc)
1789 {
1790 	return psoc->soc_objmgr.max_peer_count;
1791 }
1792 
1793 /**
1794  * wlan_psoc_get_peer_count() - get psoc peer count
1795  * @psoc: PSOC object
1796  *
1797  * API to get peer count
1798  *
1799  * Return: @peer count: peer count
1800  */
wlan_psoc_get_peer_count(struct wlan_objmgr_psoc * psoc)1801 static inline uint16_t wlan_psoc_get_peer_count(
1802 					struct wlan_objmgr_psoc *psoc)
1803 {
1804 	return psoc->soc_objmgr.wlan_peer_count;
1805 }
1806 
1807 
1808 /**
1809  * DOC: Examples to use PSOC ref count APIs
1810  *
1811  * In all the scenarios, the pair of API should be followed
1812  * other it lead to memory leak
1813  *
1814  *  scenario 1:
1815  *
1816  *     wlan_objmgr_psoc_obj_create()
1817  *     ----
1818  *     wlan_objmgr_psoc_obj_delete()
1819  *
1820  *  scenario 2:
1821  *
1822  *     wlan_objmgr_psoc_get_ref()
1823  *     ----
1824  *     the operations which are done on
1825  *     psoc object
1826  *     ----
1827  *     wlan_objmgr_psoc_release_ref()
1828  */
1829 
1830 /**
1831  * wlan_objmgr_psoc_get_ref() - increment ref count
1832  * @psoc: PSOC object
1833  * @id:   Object Manager ref debug id
1834  *
1835  * API to increment ref count of psoc
1836  *
1837  * Return: void
1838  */
1839 void wlan_objmgr_psoc_get_ref(struct wlan_objmgr_psoc *psoc,
1840 					wlan_objmgr_ref_dbgid id);
1841 
1842 /**
1843  * wlan_objmgr_psoc_try_get_ref() - increment ref count, if allowed
1844  * @psoc: PSOC object
1845  * @id:   Object Manager ref debug id
1846  *
1847  * API to increment ref count after checking valid object state
1848  *
1849  * Return: void
1850  */
1851 QDF_STATUS wlan_objmgr_psoc_try_get_ref(struct wlan_objmgr_psoc *psoc,
1852 						wlan_objmgr_ref_dbgid id);
1853 
1854 /**
1855  * wlan_objmgr_psoc_release_ref() - decrement ref count
1856  * @psoc: PSOC object
1857  * @id:   Object Manager ref debug id
1858  *
1859  * API to decrement ref count of psoc, if ref count is 1, it initiates the
1860  * PSOC deletion
1861  *
1862  * Return: void
1863  */
1864 void wlan_objmgr_psoc_release_ref(struct wlan_objmgr_psoc *psoc,
1865 						wlan_objmgr_ref_dbgid id);
1866 
1867 /**
1868  * wlan_objmgr_print_ref_all_objects_per_psoc() - print all psoc objects'
1869  *                                                ref counts
1870  * @psoc: PSOC object
1871  *
1872  * API to be used for printing all the objects(pdev/vdev/peer) ref counts
1873  *
1874  * Return: SUCCESS/FAILURE
1875  */
1876 QDF_STATUS wlan_objmgr_print_ref_all_objects_per_psoc(
1877 		struct wlan_objmgr_psoc *psoc);
1878 
1879 /**
1880 * wlan_objmgr_psoc_set_user_config () - populate user config
1881 * data in psoc
1882 * @psoc: psoc object pointer
1883 * @user_config_data: pointer to user config data filled up by os
1884 *                  dependent component
1885 * it is intended to set all elements by OSIF/HDD and it not
1886 * intended to modify a single element
1887 * Return: QDF status
1888 */
1889 QDF_STATUS wlan_objmgr_psoc_set_user_config(struct wlan_objmgr_psoc *psoc,
1890 		struct wlan_objmgr_psoc_user_config *user_config_data);
1891 
1892 /**
1893  * wlan_objmgr_psoc_check_for_pdev_leaks() - Assert no pdevs attached to @psoc
1894  * @psoc: The psoc to check
1895  *
1896  * Return: No. of psoc leaks
1897  */
1898 uint32_t wlan_objmgr_psoc_check_for_pdev_leaks(struct wlan_objmgr_psoc *psoc);
1899 
1900 /**
1901  * wlan_objmgr_psoc_check_for_vdev_leaks() - Assert no vdevs attached to @psoc
1902  * @psoc: The psoc to check
1903  *
1904  * Return: No. of vdev leaks
1905  */
1906 uint32_t wlan_objmgr_psoc_check_for_vdev_leaks(struct wlan_objmgr_psoc *psoc);
1907 
1908 /**
1909  * wlan_objmgr_psoc_check_for_peer_leaks() - Assert no peers attached to @psoc
1910  * @psoc: The psoc to check
1911  *
1912  * Return: No. of peer leaks
1913  */
1914 uint32_t wlan_objmgr_psoc_check_for_peer_leaks(struct wlan_objmgr_psoc *psoc);
1915 
1916 /**
1917  * wlan_objmgr_psoc_check_for_leaks() - Assert on leak
1918  * @psoc: The psoc to check
1919  *
1920  * Return: None
1921  */
1922 void wlan_objmgr_psoc_check_for_leaks(struct wlan_objmgr_psoc *psoc);
1923 
1924 /**
1925 * wlan_objmgr_psoc_get_band_capability () - get user config
1926 * data for band capability
1927 * @psoc: psoc object pointer
1928 *
1929 * Return: band_capability
1930 */
wlan_objmgr_psoc_get_band_capability(struct wlan_objmgr_psoc * psoc)1931 static inline uint8_t wlan_objmgr_psoc_get_band_capability(
1932 		struct wlan_objmgr_psoc *psoc)
1933 {
1934 	if (!psoc)
1935 		return 0;
1936 
1937 	return psoc->soc_nif.user_config.band_capability;
1938 }
1939 
1940 /**
1941  * wlan_psoc_set_dp_handle() - set dp handle
1942  * @psoc: psoc object pointer
1943  * @dp_handle: Data path module handle
1944  *
1945  * Return: void
1946  */
wlan_psoc_set_dp_handle(struct wlan_objmgr_psoc * psoc,void * dp_handle)1947 static inline void wlan_psoc_set_dp_handle(struct wlan_objmgr_psoc *psoc,
1948 		void *dp_handle)
1949 {
1950 	if (qdf_unlikely(!psoc)) {
1951 		QDF_BUG(0);
1952 		return;
1953 	}
1954 
1955 	psoc->dp_handle = dp_handle;
1956 }
1957 
1958 /**
1959  * wlan_psoc_get_dp_handle() - get dp handle
1960  * @psoc: psoc object pointer
1961  *
1962  * Return: dp handle
1963  */
wlan_psoc_get_dp_handle(struct wlan_objmgr_psoc * psoc)1964 static inline void *wlan_psoc_get_dp_handle(struct wlan_objmgr_psoc *psoc)
1965 {
1966 	if (qdf_unlikely(!psoc)) {
1967 		QDF_BUG(0);
1968 		return NULL;
1969 	}
1970 
1971 	return psoc->dp_handle;
1972 }
1973 
1974 /**
1975  * wlan_psoc_set_pumac_skip - set mlo primary umac skip setting
1976  * @psoc: psoc object pointer
1977  * @val: indicate support for MLO PUMAC feature on psoc
1978  *
1979  * Return: void
1980  */
wlan_psoc_set_pumac_skip(struct wlan_objmgr_psoc * psoc,bool val)1981 static inline void wlan_psoc_set_pumac_skip(
1982 			struct wlan_objmgr_psoc *psoc,
1983 			bool val)
1984 {
1985 	if (qdf_unlikely(!psoc)) {
1986 		QDF_BUG(0);
1987 		return;
1988 	}
1989 
1990 	psoc->skip_mlo_pumac = val;
1991 }
1992 
1993 /**
1994  * wlan_psoc_get_pumac_skip - get mlo primary umac skip setting
1995  * @psoc: psoc object pointer
1996  *
1997  * Return: bool (primary umac support)
1998  */
wlan_psoc_get_pumac_skip(struct wlan_objmgr_psoc * psoc)1999 static inline bool wlan_psoc_get_pumac_skip(struct wlan_objmgr_psoc *psoc)
2000 {
2001 	if (qdf_unlikely(!psoc)) {
2002 		QDF_BUG(0);
2003 		return false;
2004 	}
2005 
2006 	return psoc->skip_mlo_pumac;
2007 }
2008 
2009 struct wlan_logically_del_peer {
2010 	qdf_list_node_t list;
2011 	struct wlan_objmgr_peer *peer;
2012 };
2013 
2014 /**
2015  * wlan_psoc_get_id() - get psoc id
2016  * @psoc: PSOC object
2017  *
2018  * API to get psoc id
2019  *
2020  * Return: @psoc_id: psoc id
2021  */
wlan_psoc_get_id(struct wlan_objmgr_psoc * psoc)2022 static inline uint8_t wlan_psoc_get_id(
2023 			struct wlan_objmgr_psoc *psoc)
2024 {
2025 	if (!psoc)
2026 		return (uint8_t)-1;
2027 
2028 	return psoc->soc_objmgr.psoc_id;
2029 }
2030 
2031 /**
2032  * wlan_print_psoc_info() - print psoc members
2033  * @psoc: psoc object pointer
2034  *
2035  * Return: void
2036  */
2037 #ifdef WLAN_OBJMGR_DEBUG
2038 void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc);
2039 #else
wlan_print_psoc_info(struct wlan_objmgr_psoc * psoc)2040 static inline void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc) {}
2041 #endif
2042 
2043 #endif /* _WLAN_OBJMGR_PSOC_OBJ_H_*/
2044