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