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