xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h (revision a175314c51a4ce5cec2835cc8a8c7dc0c1810915)
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: its obsolete
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: its obsolete
468  * @dbg_id: id of the caller
469  *
470  * API to be used for performing the operations on all PDEV/VDEV/PEER objects
471  * of psoc
472  *
473  * Return: SUCCESS/FAILURE
474  */
475 QDF_STATUS wlan_objmgr_iterate_obj_list_all(
476 		struct wlan_objmgr_psoc *psoc,
477 		enum wlan_objmgr_obj_type obj_type,
478 		wlan_objmgr_op_handler handler,
479 		void *arg, uint8_t lock_free_op,
480 		wlan_objmgr_ref_dbgid dbg_id);
481 
482 /**
483  * wlan_objmgr_free_all_objects_per_psoc() - free all psoc objects
484  * @psoc: PSOC object
485  *
486  * API to be used free all the objects(pdev/vdev/peer) of psoc
487  *
488  * Return: SUCCESS/FAILURE
489  */
490 QDF_STATUS wlan_objmgr_free_all_objects_per_psoc(
491 		struct wlan_objmgr_psoc *psoc);
492 
493 /**
494  * wlan_objmgr_trigger_psoc_comp_priv_object_creation() - create
495  * psoc comp object
496  * @psoc: PSOC object
497  * @id: Component id
498  *
499  * API to create component private object in run time, this would
500  * be used for features which gets enabled in run time
501  *
502  * Return: SUCCESS on successful creation
503  *         On FAILURE (appropriate failure codes are returned)
504  */
505 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_creation(
506 		struct wlan_objmgr_psoc *psoc,
507 		enum wlan_umac_comp_id id);
508 
509 /**
510  * wlan_objmgr_trigger_psoc_comp_priv_object_deletion() - destroy
511  * psoc comp object
512  * @psoc: PSOC object
513  * @id: Component id
514  *
515  * API to destroy component private object in run time, this would
516  * be used for features which gets disabled in run time
517  *
518  * Return: SUCCESS on successful deletion
519  *         On FAILURE (appropriate failure codes are returned)
520  */
521 QDF_STATUS wlan_objmgr_trigger_psoc_comp_priv_object_deletion(
522 		struct wlan_objmgr_psoc *psoc,
523 		enum wlan_umac_comp_id id);
524 
525 /**
526  * wlan_objmgr_get_peer_by_mac() - find peer from psoc's peer list
527  * @psoc: PSOC object
528  * @macaddr: MAC address
529  * @dbg_id: id of the caller
530  *
531  * API to find peer object pointer by MAC addr
532  *
533  * This API increments the ref count of the peer object internally, the
534  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
535  * ref count
536  *
537  * Return: peer pointer
538  *         NULL on FAILURE
539  */
540 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac(
541 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
542 		wlan_objmgr_ref_dbgid dbg_id);
543 
544 /**
545  * wlan_objmgr_get_peer() - find peer from psoc's peer list
546  * @psoc: PSOC object
547  * @pdev_id: Pdev id
548  * @macaddr: MAC address
549  * @dbg_id: id of the caller
550  *
551  * API to find peer object pointer by MAC addr and pdev id
552  *
553  * This API increments the ref count of the peer object internally, the
554  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
555  * ref count
556  *
557  * Return: peer pointer
558  *         NULL on FAILURE
559  */
560 struct wlan_objmgr_peer *wlan_objmgr_get_peer(
561 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
562 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
563 
564 /**
565  * wlan_objmgr_get_peer_nolock() - find peer from psoc's peer list (lock free)
566  * @psoc: PSOC object
567  * @pdev_id: Pdev id
568  * @macaddr: MAC address
569  * @dbg_id: id of the caller
570  *
571  * API to find peer object pointer by MAC addr
572  *
573  * This API increments the ref count of the peer object internally, the
574  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
575  * ref count
576  *
577  * Return: peer pointer
578  *         NULL on FAILURE
579  */
580 struct wlan_objmgr_peer *wlan_objmgr_get_peer_nolock(
581 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
582 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
583 
584 /**
585  * wlan_objmgr_get_peer_logically_deleted() - find peer
586  * from psoc's peer list
587  * @psoc: PSOC object
588  * @macaddr: MAC address
589  * @dbg_id: id of the caller
590  *
591  * API to find peer object pointer of logically deleted peer
592  *
593  * This API increments the ref count of the peer object internally, the
594  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
595  * ref count
596  *
597  * Return: peer pointer
598  *         NULL on FAILURE
599  */
600 struct wlan_objmgr_peer *wlan_objmgr_get_peer_logically_deleted(
601 			struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
602 			wlan_objmgr_ref_dbgid dbg_id);
603 
604 /**
605  * wlan_objmgr_get_peer_no_state() - find peer from psoc's peer list
606  * @psoc: PSOC object
607  * @pdev_id: Pdev id
608  * @macaddr: MAC address
609  * @dbg_id: id of the caller
610  *
611  * API to find peer object pointer by MAC addr and pdev id,
612  * ignores the state check
613  *
614  * This API increments the ref count of the peer object internally, the
615  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
616  * ref count
617  *
618  * Return: peer pointer
619  *         NULL on FAILURE
620  */
621 struct wlan_objmgr_peer *wlan_objmgr_get_peer_no_state(
622 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
623 			uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
624 
625 /**
626  * wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev() - get peer from
627  *                                                psoc peer list using
628  *                                                mac and vdev
629  *                                                self mac
630  * @psoc: PSOC object
631  * @pdev_id: Pdev id
632  * @bssid: BSSID address
633  * @macaddr: MAC address
634  * @dbg_id: id of the caller
635  *
636  * API to find peer object pointer by MAC addr, vdev self mac
637  * address and pdev id for a node that is logically in deleted state
638  *
639  * This API increments the ref count of the peer object internally, the
640  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
641  * ref count
642  *
643  * Return: List of peer pointers
644  *         NULL on FAILURE
645  */
646 qdf_list_t *wlan_objmgr_populate_logically_deleted_peerlist_by_mac_n_vdev(
647 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
648 			uint8_t *bssid, uint8_t *macaddr,
649 			wlan_objmgr_ref_dbgid dbg_id);
650 
651 /**
652  * wlan_objmgr_get_peer_by_mac_n_vdev() - find peer from psoc's peer list
653  *                                          using mac address and bssid
654  * @psoc: PSOC object
655  * @pdev_id: Pdev id
656  * @bssid: MAC address of AP its associated
657  * @macaddr: MAC address
658  * @dbg_id: id of the caller
659  *
660  * API to find peer object pointer by MAC addr and vdev self mac address
661  * and pdev id
662  *
663  * This API increments the ref count of the peer object internally, the
664  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
665  * ref count
666  *
667  * Return: peer pointer
668  *         NULL on FAILURE
669  */
670 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev(
671 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
672 			uint8_t *bssid, uint8_t *macaddr,
673 			wlan_objmgr_ref_dbgid dbg_id);
674 
675 /**
676  * wlan_objmgr_get_peer_by_mac_n_vdev_no_state() - find peer from psoc's peer
677  *                                          list using mac address and bssid
678  * @psoc: PSOC object
679  * @pdev_id: Pdev id
680  * @bssid: MAC address of AP its associated
681  * @macaddr: MAC address
682  * @dbg_id: id of the caller
683  *
684  * API to find peer object pointer by MAC addr, vdev self mac address,
685  * and pdev id ,ignores the state
686  *
687  * This API increments the ref count of the peer object internally, the
688  * caller has to invoke the wlan_objmgr_peer_release_ref() to decrement
689  * ref count
690  *
691  * Return: peer pointer
692  *         NULL on FAILURE
693  */
694 struct wlan_objmgr_peer *wlan_objmgr_get_peer_by_mac_n_vdev_no_state(
695 			struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
696 			uint8_t *bssid,  uint8_t *macaddr,
697 			wlan_objmgr_ref_dbgid dbg_id);
698 
699 /**
700  * wlan_objmgr_get_pdev_by_id() - retrieve pdev by id
701  * @psoc: PSOC object
702  * @id: pdev id
703  * @dbg_id: id of the caller
704  *
705  * API to find pdev object pointer by pdev id
706  *
707  * This API increments the ref count of the pdev object internally, the
708  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
709  * ref count
710  *
711  * Return: pdev pointer
712  *         NULL on FAILURE
713  */
714 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id(
715 		struct wlan_objmgr_psoc *psoc, uint8_t id,
716 		wlan_objmgr_ref_dbgid dbg_id);
717 
718 /**
719  * wlan_objmgr_get_pdev_by_id_no_state() - retrieve pdev by id
720  * @psoc: PSOC object
721  * @id: pdev id
722  * @dbg_id: id of the caller
723  *
724  * API to find pdev object pointer by pdev id, Ignores the state check
725  *
726  * This API increments the ref count of the pdev object internally, the
727  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
728  * ref count
729  *
730  * Return: pdev pointer
731  *         NULL on FAILURE
732  */
733 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_id_no_state(
734 			struct wlan_objmgr_psoc *psoc, uint8_t id,
735 			wlan_objmgr_ref_dbgid dbg_id);
736 
737 /**
738  * wlan_objmgr_get_pdev_by_macaddr() - retrieve pdev by macaddr
739  * @psoc: PSOC object
740  * @macaddr: MAC address
741  * @dbg_id: id of the caller
742  *
743  * API to find pdev object pointer by pdev macaddr
744  *
745  * This API increments the ref count of the pdev object internally, the
746  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
747  * ref count
748  *
749  * Return: pdev pointer
750  *         NULL on FAILURE
751  */
752 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr(
753 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
754 		wlan_objmgr_ref_dbgid dbg_id);
755 
756 /**
757  * wlan_objmgr_get_pdev_by_macaddr_no_state() - retrieve pdev by macaddr
758  * @psoc: PSOC object
759  * @macaddr: MAC address
760  * @dbg_id: id of the caller
761  *
762  * API to find pdev object pointer by pdev macaddr, ignores the state check
763  *
764  * This API increments the ref count of the pdev object internally, the
765  * caller has to invoke the wlan_objmgr_pdev_release_ref() to decrement
766  * ref count
767  *
768  * Return: pdev pointer
769  *         NULL on FAILURE
770  */
771 struct wlan_objmgr_pdev *wlan_objmgr_get_pdev_by_macaddr_no_state(
772 		struct wlan_objmgr_psoc *psoc, uint8_t *macaddr,
773 		wlan_objmgr_ref_dbgid dbg_id);
774 
775 /**
776  * wlan_objmgr_get_vdev_by_opmode_from_psoc() - retrieve vdev by opmode
777  * @psoc: PSOC object
778  * @opmode: vdev operating mode
779  * @dbg_id: id of the caller
780  *
781  * API to find vdev object pointer by vdev operating mode from psoc
782  *
783  * This API increments the ref count of the vdev object internally, the
784  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
785  * ref count
786  *
787  * Return: vdev pointer
788  *         NULL on FAILURE
789  */
790 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_opmode_from_psoc(
791 			struct wlan_objmgr_psoc *psoc,
792 			enum QDF_OPMODE opmode,
793 			wlan_objmgr_ref_dbgid dbg_id);
794 
795 /**
796  * wlan_objmgr_get_vdev_by_id_from_psoc() - retrieve vdev by id
797  * @psoc: PSOC object
798  * @id: vdev id
799  * @dbg_id: id of the caller
800  *
801  * API to find vdev object pointer by vdev id from psoc
802  *
803  * This API increments the ref count of the vdev object internally, the
804  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
805  * ref count
806  *
807  * Return: vdev pointer
808  *         NULL on FAILURE
809  */
810 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc(
811 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
812 			wlan_objmgr_ref_dbgid dbg_id);
813 
814 /**
815  * wlan_objmgr_get_vdev_by_id_from_psoc_no_state() - retrieve vdev by id
816  * @psoc: PSOC object
817  * @id: vdev id
818  * @dbg_id: id of the caller
819  *
820  * API to find vdev object pointer by vdev id from psoc, ignores the
821  * state check
822  *
823  * This API increments the ref count of the vdev object internally, the
824  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
825  * ref count
826  *
827  * Return: vdev pointer
828  *         NULL on FAILURE
829  */
830 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_id_from_psoc_no_state(
831 			struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
832 			wlan_objmgr_ref_dbgid dbg_id);
833 
834 /**
835  * wlan_objmgr_get_vdev_by_macaddr_from_psoc() - retrieve vdev by macaddr
836  * @psoc: PSOC object
837  * @pdev_id: Pdev id
838  * @macaddr: macaddr
839  * @dbg_id: id of the caller
840  *
841  * API to find vdev object pointer by vdev macaddr from pdev
842  *
843  * This API increments the ref count of the vdev object internally, the
844  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
845  * ref count
846  *
847  * Return: vdev pointer
848  *         NULL on FAILURE
849  */
850 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc(
851 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
852 		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
853 
854 /**
855  * wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state() - retrieve vdev by
856  *                                                           macaddr
857  * @psoc: PSOC object
858  * @pdev_id: Pdev id
859  * @macaddr: macaddr
860  * @dbg_id: id of the caller
861  *
862  * API to find vdev object pointer by vdev macaddr from psoc, ignores the state
863  * check
864  *
865  * This API increments the ref count of the vdev object internally, the
866  * caller has to invoke the wlan_objmgr_vdev_release_ref() to decrement
867  * ref count
868  *
869  * Return: vdev pointer
870  *         NULL on FAILURE
871  */
872 struct wlan_objmgr_vdev *wlan_objmgr_get_vdev_by_macaddr_from_psoc_no_state(
873 		struct wlan_objmgr_psoc *psoc, uint8_t pdev_id,
874 		uint8_t *macaddr, wlan_objmgr_ref_dbgid dbg_id);
875 
876 /**
877  * wlan_psoc_obj_lock() - Acquire PSOC spinlock
878  * @psoc: PSOC object
879  *
880  * API to acquire PSOC lock
881  * Parent lock should not be taken in child lock context
882  * but child lock can be taken in parent lock context
883  * (for ex: psoc lock can't be invoked in pdev/vdev/peer lock context)
884  *
885  * Return: void
886  */
887 static inline void wlan_psoc_obj_lock(struct wlan_objmgr_psoc *psoc)
888 {
889 	qdf_spin_lock_bh(&psoc->psoc_lock);
890 }
891 
892 /**
893  * wlan_psoc_obj_unlock() - Release PSOC spinlock
894  * @psoc: PSOC object
895  *
896  * API to Release PSOC lock
897  *
898  * Return: void
899  */
900 static inline void wlan_psoc_obj_unlock(struct wlan_objmgr_psoc *psoc)
901 {
902 	qdf_spin_unlock_bh(&psoc->psoc_lock);
903 }
904 
905 /**
906  * wlan_psoc_set_nif_phy_version() - set nif phy version
907  * @psoc: PSOC object
908  * @phy_ver: phy version
909  *
910  * API to set nif phy version in psoc
911  *
912  * Return: void
913  */
914 static inline void wlan_psoc_set_nif_phy_version(struct wlan_objmgr_psoc *psoc,
915 			uint32_t phy_ver)
916 {
917 	psoc->soc_nif.phy_version = phy_ver;
918 }
919 
920 /**
921  * wlan_psoc_get_nif_phy_version() - get nif phy version
922  * @psoc: PSOC object
923  *
924  * API to set nif phy version in psoc
925  *
926  * Return: @phy_ver: phy version
927  */
928 static inline uint32_t wlan_psoc_get_nif_phy_version(
929 			struct wlan_objmgr_psoc *psoc)
930 {
931 	if (psoc == NULL)
932 		return (uint32_t)-1;
933 
934 	return psoc->soc_nif.phy_version;
935 }
936 
937 /**
938  * wlan_psoc_set_dev_type() - set dev type
939  * @psoc: PSOC object
940  * @phy_type: phy type (OL/DA)
941  *
942  * API to set dev type in psoc
943  *
944  * Return: void
945  */
946 static inline void wlan_psoc_set_dev_type(struct wlan_objmgr_psoc *psoc,
947 				WLAN_DEV_TYPE phy_type)
948 {
949 	psoc->soc_nif.phy_type = phy_type;
950 }
951 
952 /**
953  * wlan_objmgr_psoc_get_dev_type - get dev type
954  * @psoc: PSOC object
955  *
956  * API to get dev type in psoc
957  *
958  * Return: phy type (OL/DA)
959  */
960 static inline WLAN_DEV_TYPE wlan_objmgr_psoc_get_dev_type(
961 				struct wlan_objmgr_psoc *psoc)
962 {
963 	if (psoc == NULL)
964 		return (uint32_t)-1;
965 
966 	return psoc->soc_nif.phy_type;
967 }
968 
969 /**
970  * wlan_psoc_nif_fw_cap_set() - set fw caps
971  * @psoc: PSOC object
972  * @cap: capability flag to be set
973  *
974  * API to set fw caps in psoc
975  *
976  * Return: void
977  */
978 static inline void wlan_psoc_nif_fw_cap_set(struct wlan_objmgr_psoc *psoc,
979 					uint32_t cap)
980 {
981 	psoc->soc_nif.soc_fw_caps |= cap;
982 }
983 
984 /**
985  * wlan_psoc_nif_fw_cap_clear() - clear fw caps
986  * @psoc: PSOC object
987  * @cap: capability flag to be cleared
988  *
989  * API to clear fw caps in psoc
990  *
991  * Return: void
992  */
993 static inline void wlan_psoc_nif_fw_cap_clear(struct wlan_objmgr_psoc *psoc,
994 				uint32_t cap)
995 {
996 	psoc->soc_nif.soc_fw_caps &= ~cap;
997 }
998 
999 /**
1000  * wlan_psoc_nif_fw_cap_get() - get fw caps
1001  * @psoc: PSOC object
1002  * @cap: capability flag to be checked
1003  *
1004  * API to know, whether particular fw caps flag is set in psoc
1005  *
1006  * Return: 1 (for set) or 0 (for not set)
1007  */
1008 static inline uint8_t wlan_psoc_nif_fw_cap_get(struct wlan_objmgr_psoc *psoc,
1009 				uint32_t cap)
1010 {
1011 	return (psoc->soc_nif.soc_fw_caps & cap) ? 1 : 0;
1012 }
1013 
1014 /**
1015  * wlan_psoc_nif_fw_ext_cap_set() - set fw ext caps
1016  * @psoc: PSOC object
1017  * @ext_cap: capability flag to be set
1018  *
1019  * API to set fw ext caps in psoc
1020  *
1021  * Return: void
1022  */
1023 static inline void wlan_psoc_nif_fw_ext_cap_set(struct wlan_objmgr_psoc *psoc,
1024 				uint32_t ext_cap)
1025 {
1026 	psoc->soc_nif.soc_fw_ext_caps |= ext_cap;
1027 }
1028 
1029 /**
1030  * wlan_psoc_nif_fw_ext_cap_clear() - clear fw ext caps
1031  * @psoc: PSOC object
1032  * @ext_cap: capability flag to be cleared
1033  *
1034  * API to clear fw ext caps in psoc
1035  *
1036  * Return: void
1037  */
1038 static inline void wlan_psoc_nif_fw_ext_cap_clear(struct wlan_objmgr_psoc *psoc,
1039 				uint32_t ext_cap)
1040 {
1041 	psoc->soc_nif.soc_fw_ext_caps &= ~ext_cap;
1042 }
1043 
1044 /**
1045  * wlan_psoc_nif_fw_ext_cap_get() - get fw caps
1046  * @psoc: PSOC object
1047  * @ext_cap: capability flag to be checked
1048  *
1049  * API to know, whether particular fw caps flag is set in psoc
1050  *
1051  * Return: 1 (for set) or 0 (for not set)
1052  */
1053 static inline uint8_t wlan_psoc_nif_fw_ext_cap_get(
1054 		struct wlan_objmgr_psoc *psoc, uint32_t ext_cap)
1055 {
1056 	return (psoc->soc_nif.soc_fw_ext_caps & ext_cap) ? 1 : 0;
1057 }
1058 
1059 /**
1060  * wlan_psoc_nif_feat_cap_set() - set feature caps
1061  * @psoc: PSOC object
1062  * @cap: feature flag to be set
1063  *
1064  * API to set feature caps in psoc
1065  *
1066  * Return: void
1067  */
1068 static inline void wlan_psoc_nif_feat_cap_set(struct wlan_objmgr_psoc *psoc,
1069 				uint32_t feat_cap)
1070 {
1071 	psoc->soc_nif.soc_feature_caps |= feat_cap;
1072 }
1073 
1074 /**
1075  * wlan_psoc_nif_feat_cap_clear() - clear feature caps
1076  * @psoc: PSOC object
1077  * @cap: feature flag to be cleared
1078  *
1079  * API to clear feature caps in psoc
1080  *
1081  * Return: void
1082  */
1083 static inline void wlan_psoc_nif_feat_cap_clear(struct wlan_objmgr_psoc *psoc,
1084 				uint32_t feat_cap)
1085 {
1086 	psoc->soc_nif.soc_feature_caps &= ~feat_cap;
1087 }
1088 
1089 /**
1090  * wlan_psoc_nif_feat_cap_get() - get feature caps
1091  * @psoc: PSOC object
1092  * @cap: feature flag to be checked
1093  *
1094  * API to know, whether particular feature cap flag is set in psoc
1095  *
1096  * Return: 1 (for set) or 0 (for not set)
1097  */
1098 static inline uint8_t wlan_psoc_nif_feat_cap_get(struct wlan_objmgr_psoc *psoc,
1099 							uint32_t feat_cap)
1100 {
1101 	return (psoc->soc_nif.soc_feature_caps & feat_cap) ? 1 : 0;
1102 }
1103 
1104 /**
1105  * wlan_psoc_nif_op_flag_get() - get op flags
1106  * @psoc: PSOC object
1107  * @flag: op flag to be checked
1108  *
1109  * API to know, whether particular op flag is set in psoc
1110  *
1111  * Return: 1 (for set) or 0 (for not set)
1112  */
1113 static inline uint8_t wlan_psoc_nif_op_flag_get(struct wlan_objmgr_psoc *psoc,
1114 						uint32_t flag)
1115 {
1116 	return (psoc->soc_nif.soc_op_flags & flag) ? 1 : 0;
1117 }
1118 
1119 /**
1120  * wlan_psoc_nif_op_flag_set() - set op flag
1121  * @psoc: PSOC object
1122  * @flag: op flag to be set
1123  *
1124  * API to set op flag in psoc
1125  *
1126  * Return: void
1127  */
1128 static inline void wlan_psoc_nif_op_flag_set(struct wlan_objmgr_psoc *psoc,
1129 						uint32_t flag)
1130 {
1131 	psoc->soc_nif.soc_op_flags |= flag;
1132 }
1133 
1134 /**
1135  * wlan_psoc_nif_op_flag_clear() - clear op flag
1136  * @psoc: PSOC object
1137  * @flag: op flag to be cleared
1138  *
1139  * API to clear op flag in psoc
1140  *
1141  * Return: void
1142  */
1143 static inline void wlan_psoc_nif_op_flag_clear(struct wlan_objmgr_psoc *psoc,
1144 						uint32_t flag)
1145 {
1146 	psoc->soc_nif.soc_op_flags &= ~flag;
1147 }
1148 
1149 /**
1150  * wlan_psoc_set_hw_macaddr() - set hw mac addr
1151  * @psoc: PSOC object
1152  * @macaddr: hw macaddr
1153  *
1154  * API to set hw macaddr of psoc
1155  *
1156  * Caller need to acquire lock with wlan_psoc_obj_lock()
1157  *
1158  * Return: void
1159  */
1160 static inline void wlan_psoc_set_hw_macaddr(struct wlan_objmgr_psoc *psoc,
1161 					uint8_t *macaddr)
1162 {
1163 	/* This API is invoked with lock acquired, do not add log prints */
1164 	if (psoc != NULL)
1165 		WLAN_ADDR_COPY(psoc->soc_nif.soc_hw_macaddr, macaddr);
1166 }
1167 
1168 /**
1169  * wlan_psoc_get_hw_macaddr() - get hw macaddr
1170  * @psoc: PSOC object
1171  *
1172  * API to set hw macaddr of psoc
1173  *
1174  * Return: hw macaddr
1175  */
1176 static inline uint8_t *wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc *psoc)
1177 {
1178 	if (psoc == NULL)
1179 		return NULL;
1180 
1181 	return psoc->soc_nif.soc_hw_macaddr;
1182 }
1183 
1184 /**
1185  * wlan_objmgr_psoc_get_comp_private_obj(): API to retrieve component object
1186  * @psoc: Psoc pointer
1187  * @id: component id
1188  *
1189  * This API is used to get the component private object pointer tied to the
1190  * corresponding psoc object
1191  *
1192  * Return: Component private object
1193  */
1194 void *wlan_objmgr_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc,
1195 					enum wlan_umac_comp_id id);
1196 /**
1197  * wlan_psoc_get_pdev_count() - get pdev count for psoc
1198  * @psoc: PSOC object
1199  *
1200  * API to get number of pdev's attached to the psoc
1201  *
1202  * Return: number of pdev's
1203  */
1204 static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc)
1205 {
1206 	if (psoc == NULL)
1207 		return 0;
1208 
1209 	return psoc->soc_objmgr.wlan_pdev_count;
1210 }
1211 
1212 /**
1213  * wlan_psoc_set_tgt_if_handle(): API to set target if handle in psoc object
1214  * @psoc: Psoc pointer
1215  * @tgt_if_handle: target interface handle
1216  *
1217  * API to set target interface handle in psoc object
1218  *
1219  * Return: None
1220  */
1221 static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
1222 			void *tgt_if_handle)
1223 {
1224 	if (psoc == NULL)
1225 		return;
1226 
1227 	psoc->tgt_if_handle = tgt_if_handle;
1228 }
1229 
1230 /**
1231  * wlan_psoc_get_tgt_if_handle(): API to get target interface handle
1232  * @psoc: Psoc pointer
1233  *
1234  * API to get target interface handle from psoc object
1235  *
1236  * Return: target interface handle
1237  */
1238 static inline void *wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc *psoc)
1239 {
1240 	if (psoc == NULL)
1241 		return NULL;
1242 
1243 	return psoc->tgt_if_handle;
1244 }
1245 
1246 /**
1247  * wlan_psoc_get_qdf_dev(): API to get qdf device
1248  * @psoc: Psoc pointer
1249  *
1250  * API to get qdf device from psoc object
1251  *
1252  * Return: qdf_device_t
1253  */
1254 static inline qdf_device_t wlan_psoc_get_qdf_dev(
1255 			struct wlan_objmgr_psoc *psoc)
1256 {
1257 	if (psoc == NULL)
1258 		return NULL;
1259 
1260 	return psoc->soc_objmgr.qdf_dev;
1261 }
1262 
1263 /**
1264  * wlan_psoc_set_qdf_dev(): API to get qdf device
1265  * @psoc: Psoc pointer
1266  * dev: qdf device
1267  *
1268  * API to set qdf device from psoc object
1269  *
1270  * Return: None
1271  */
1272 static inline void wlan_psoc_set_qdf_dev(
1273 			struct wlan_objmgr_psoc *psoc,
1274 			qdf_device_t dev)
1275 {
1276 	if (psoc == NULL)
1277 		return;
1278 
1279 	psoc->soc_objmgr.qdf_dev = dev;
1280 }
1281 
1282 /**
1283  * wlan_psoc_set_max_vdev_count() - set psoc max vdev count
1284  * @psoc: PSOC object
1285  * @vdev count: Max vdev count
1286  *
1287  * API to set Max vdev count
1288  *
1289  * Return: void
1290  */
1291 static inline void wlan_psoc_set_max_vdev_count(struct wlan_objmgr_psoc *psoc,
1292 						uint8_t max_vdev_count)
1293 {
1294 	psoc->soc_objmgr.max_vdev_count = max_vdev_count;
1295 }
1296 
1297 /**
1298  * wlan_psoc_get_max_vdev_count() - get psoc max vdev count
1299  * @psoc: PSOC object
1300  *
1301  * API to set Max vdev count
1302  *
1303  * Return: @vdev count: Max vdev count
1304  */
1305 static inline uint8_t wlan_psoc_get_max_vdev_count(
1306 					struct wlan_objmgr_psoc *psoc)
1307 {
1308 	return psoc->soc_objmgr.max_vdev_count;
1309 }
1310 
1311 /**
1312  * wlan_psoc_set_max_peer_count() - set psoc max peer count
1313  * @psoc: PSOC object
1314  * @peer count: Max peer count
1315  *
1316  * API to set Max peer count
1317  *
1318  * Return: void
1319  */
1320 static inline void wlan_psoc_set_max_peer_count(struct wlan_objmgr_psoc *psoc,
1321 						uint16_t max_peer_count)
1322 {
1323 	psoc->soc_objmgr.max_peer_count = max_peer_count;
1324 }
1325 
1326 /**
1327  * wlan_psoc_get_max_peer_count() - get psoc max peer count
1328  * @psoc: PSOC object
1329  *
1330  * API to set Max peer count
1331  *
1332  * Return: @peer count: Max peer count
1333  */
1334 static inline uint16_t wlan_psoc_get_max_peer_count(
1335 					struct wlan_objmgr_psoc *psoc)
1336 {
1337 	return psoc->soc_objmgr.max_peer_count;
1338 }
1339 
1340 /**
1341  * wlan_psoc_get_peer_count() - get psoc peer count
1342  * @psoc: PSOC object
1343  *
1344  * API to get peer count
1345  *
1346  * Return: @peer count: peer count
1347  */
1348 static inline uint16_t wlan_psoc_get_peer_count(
1349 					struct wlan_objmgr_psoc *psoc)
1350 {
1351 	return psoc->soc_objmgr.wlan_peer_count;
1352 }
1353 
1354 
1355 /**
1356  * DOC: Examples to use PSOC ref count APIs
1357  *
1358  * In all the scenarios, the pair of API should be followed
1359  * other it lead to memory leak
1360  *
1361  *  scenario 1:
1362  *
1363  *     wlan_objmgr_psoc_obj_create()
1364  *     ----
1365  *     wlan_objmgr_psoc_obj_delete()
1366  *
1367  *  scenario 2:
1368  *
1369  *     wlan_objmgr_psoc_get_ref()
1370  *     ----
1371  *     the operations which are done on
1372  *     psoc object
1373  *     ----
1374  *     wlan_objmgr_psoc_release_ref()
1375  */
1376 
1377 /**
1378  * wlan_objmgr_psoc_get_ref() - increment ref count
1379  * @psoc: PSOC object
1380  * @id:   Object Manager ref debug id
1381  *
1382  * API to increment ref count of psoc
1383  *
1384  * Return: void
1385  */
1386 void wlan_objmgr_psoc_get_ref(struct wlan_objmgr_psoc *psoc,
1387 					wlan_objmgr_ref_dbgid id);
1388 
1389 /**
1390  * wlan_objmgr_psoc_try_get_ref() - increment ref count, if allowed
1391  * @psoc: PSOC object
1392  * @id:   Object Manager ref debug id
1393  *
1394  * API to increment ref count after checking valid object state
1395  *
1396  * Return: void
1397  */
1398 QDF_STATUS wlan_objmgr_psoc_try_get_ref(struct wlan_objmgr_psoc *psoc,
1399 						wlan_objmgr_ref_dbgid id);
1400 
1401 /**
1402  * wlan_objmgr_psoc_release_ref() - decrement ref count
1403  * @psoc: PSOC object
1404  * @id:   Object Manager ref debug id
1405  *
1406  * API to decrement ref count of psoc, if ref count is 1, it initiates the
1407  * PSOC deletion
1408  *
1409  * Return: void
1410  */
1411 void wlan_objmgr_psoc_release_ref(struct wlan_objmgr_psoc *psoc,
1412 						wlan_objmgr_ref_dbgid id);
1413 
1414 /**
1415  * wlan_objmgr_print_ref_all_objects_per_psoc() - print all psoc objects'
1416  *                                                ref counts
1417  * @psoc: PSOC object
1418  *
1419  * API to be used for printing all the objects(pdev/vdev/peer) ref counts
1420  *
1421  * Return: SUCCESS/FAILURE
1422  */
1423 QDF_STATUS wlan_objmgr_print_ref_all_objects_per_psoc(
1424 		struct wlan_objmgr_psoc *psoc);
1425 
1426 /**
1427 * wlan_objmgr_psoc_set_user_config () - populate user config
1428 * data in psoc
1429 * @psoc: psoc object pointer
1430 * @user_config_data: pointer to user config data filled up by os
1431 *                  dependent component
1432 * it is intended to set all elements by OSIF/HDD and it not
1433 * intended to modify a single element
1434 * Return: QDF status
1435 */
1436 QDF_STATUS wlan_objmgr_psoc_set_user_config(struct wlan_objmgr_psoc *psoc,
1437 		struct wlan_objmgr_psoc_user_config *user_config_data);
1438 
1439 /**
1440  * wlan_objmgr_psoc_check_for_pdev_leaks() - Assert no pdevs attached to @psoc
1441  * @psoc: The psoc to check
1442  *
1443  * Return: None
1444  */
1445 void wlan_objmgr_psoc_check_for_pdev_leaks(struct wlan_objmgr_psoc *psoc);
1446 
1447 /**
1448  * wlan_objmgr_psoc_check_for_vdev_leaks() - Assert no vdevs attached to @psoc
1449  * @psoc: The psoc to check
1450  *
1451  * Return: None
1452  */
1453 void wlan_objmgr_psoc_check_for_vdev_leaks(struct wlan_objmgr_psoc *psoc);
1454 
1455 /**
1456 * wlan_objmgr_psoc_get_dual_mac_disable () - get user config
1457 * data for DBS disable
1458 * @psoc: psoc object pointer
1459 *
1460 * Return: Disable or Enable
1461 */
1462 static inline uint32_t wlan_objmgr_psoc_get_dual_mac_disable(
1463 		struct wlan_objmgr_psoc *psoc)
1464 {
1465 	if (psoc == NULL)
1466 		return 0;
1467 	return psoc->soc_nif.user_config.dual_mac_feature_disable;
1468 }
1469 
1470 /**
1471 * wlan_objmgr_psoc_get_band_capability () - get user config
1472 * data for band capability
1473 * @psoc: psoc object pointer
1474 *
1475 * Return: band_capability
1476 */
1477 static inline uint8_t wlan_objmgr_psoc_get_band_capability(
1478 		struct wlan_objmgr_psoc *psoc)
1479 {
1480 	if (psoc == NULL)
1481 		return 0;
1482 
1483 	return psoc->soc_nif.user_config.band_capability;
1484 }
1485 
1486 /**
1487  * wlan_psoc_set_dp_handle() - set dp handle
1488  * @psoc: psoc object pointer
1489  * @dp_handle: Data path module handle
1490  *
1491  * Return: void
1492  */
1493 static inline void wlan_psoc_set_dp_handle(struct wlan_objmgr_psoc *psoc,
1494 		void *dp_handle)
1495 {
1496 	if (qdf_unlikely(!psoc)) {
1497 		QDF_BUG(0);
1498 		return;
1499 	}
1500 
1501 	psoc->dp_handle = dp_handle;
1502 }
1503 
1504 /**
1505  * wlan_psoc_get_dp_handle() - get dp handle
1506  * @psoc: psoc object pointer
1507  *
1508  * Return: dp handle
1509  */
1510 static inline void *wlan_psoc_get_dp_handle(struct wlan_objmgr_psoc *psoc)
1511 {
1512 	if (qdf_unlikely(!psoc)) {
1513 		QDF_BUG(0);
1514 		return NULL;
1515 	}
1516 
1517 	return psoc->dp_handle;
1518 }
1519 
1520 struct wlan_logically_del_peer {
1521 	qdf_list_node_t list;
1522 	struct wlan_objmgr_peer *peer;
1523 };
1524 
1525 /**
1526  * wlan_psoc_get_lmac_if_txops() - get lmac if txops for the psoc
1527  * @psoc: psoc object pointer
1528  *
1529  * Return: Pointer to wlan_lmac_if_tx_ops
1530  */
1531 static inline struct wlan_lmac_if_tx_ops *
1532 wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc *psoc)
1533 {
1534 	return &((psoc->soc_cb.tx_ops));
1535 }
1536 #endif /* _WLAN_OBJMGR_PSOC_OBJ_H_*/
1537