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