xref: /wlan-driver/qcacld-3.0/components/interop_issues_ap/core/inc/wlan_interop_issues_ap_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: wlan_interop_issues_ap_api.h
22  *
23  * This header file provide API declarations required for interop issues
24  * ap global context specific to offload
25  */
26 
27 #ifndef __WLAN_INTEROP_ISSUES_AP_API_H__
28 #define __WLAN_INTEROP_ISSUES_AP_API_H__
29 
30 #ifdef WLAN_FEATURE_INTEROP_ISSUES_AP
31 #include <qdf_types.h>
32 #include <wlan_objmgr_cmn.h>
33 #include <wlan_objmgr_global_obj.h>
34 #include <wlan_objmgr_psoc_obj.h>
35 #include <wlan_interop_issues_ap_public_structs.h>
36 
37 #define interop_issues_ap_debug(args ...) \
38 	QDF_TRACE_DEBUG(QDF_MODULE_ID_INTEROP_ISSUES_AP, ## args)
39 #define interop_issues_ap_err(args ...) \
40 	QDF_TRACE_ERROR(QDF_MODULE_ID_INTEROP_ISSUES_AP, ## args)
41 
42 /**
43  * struct interop_issues_ap_psoc_priv_obj - psoc private object
44  * @lock: qdf spin lock
45  * @soc: pointer to psoc object
46  * @cbs: interop issues ap ps event callbacks
47  * @tx_ops: interop issues ap ps tx ops
48  */
49 struct interop_issues_ap_psoc_priv_obj {
50 	qdf_spinlock_t lock;
51 	struct wlan_objmgr_psoc *soc;
52 	struct wlan_interop_issues_ap_callbacks cbs;
53 	struct wlan_interop_issues_ap_tx_ops tx_ops;
54 };
55 
56 /**
57  * wlan_interop_issues_ap_psoc_enable() - interop issues ap psoc enable
58  * @psoc: the pointer to psoc object
59  *
60  * Return: QDF_STATUS
61  */
62 QDF_STATUS wlan_interop_issues_ap_psoc_enable(struct wlan_objmgr_psoc *psoc);
63 
64 /**
65  * wlan_interop_issues_ap_psoc_disable() - interop issues ap psoc disable
66  * @psoc: the pointer to psoc object
67  *
68  * Return: QDF_STATUS
69  */
70 QDF_STATUS wlan_interop_issues_ap_psoc_disable(struct wlan_objmgr_psoc *psoc);
71 
72 /**
73  * wlan_interop_issues_ap_init() - API to init component
74  *
75  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
76  */
77 QDF_STATUS wlan_interop_issues_ap_init(void);
78 
79 /**
80  * wlan_interop_issues_ap_deinit() - API to deinit component
81  *
82  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
83  */
84 QDF_STATUS wlan_interop_issues_ap_deinit(void);
85 
86 /**
87  * interop_issues_ap_get_psoc_priv_obj() - get priv object from psoc object
88  * @psoc: pointer to psoc object
89  *
90  * Return: pointer to interop issues ap psoc private object
91  */
92 static inline
interop_issues_ap_get_psoc_priv_obj(struct wlan_objmgr_psoc * psoc)93 struct interop_issues_ap_psoc_priv_obj *interop_issues_ap_get_psoc_priv_obj(
94 						struct wlan_objmgr_psoc *psoc)
95 {
96 	struct interop_issues_ap_psoc_priv_obj *obj;
97 
98 	if (!psoc)
99 		return NULL;
100 
101 	obj = wlan_objmgr_psoc_get_comp_private_obj(psoc,
102 					WLAN_UMAC_COMP_INTEROP_ISSUES_AP);
103 
104 	return obj;
105 }
106 
107 /**
108  * interop_issues_ap_psoc_get_tx_ops() - get TX ops from the private object
109  * @psoc: pointer to psoc object
110  *
111  * Return: pointer to TX op callback
112  */
113 static inline
interop_issues_ap_psoc_get_tx_ops(struct wlan_objmgr_psoc * psoc)114 struct wlan_interop_issues_ap_tx_ops *interop_issues_ap_psoc_get_tx_ops(
115 						struct wlan_objmgr_psoc *psoc)
116 {
117 	struct interop_issues_ap_psoc_priv_obj *interop_issues_ap_priv;
118 
119 	if (!psoc)
120 		return NULL;
121 
122 	interop_issues_ap_priv = interop_issues_ap_get_psoc_priv_obj(psoc);
123 	if (!interop_issues_ap_priv) {
124 		interop_issues_ap_err("psoc private object is null");
125 		return NULL;
126 	}
127 
128 	return &interop_issues_ap_priv->tx_ops;
129 }
130 
131 /**
132  * interop_issues_ap_psoc_get_cbs() - get RX ops from private object
133  * @psoc: pointer to psoc object
134  *
135  * Return: pointer to RX op callback
136  */
137 static inline
interop_issues_ap_psoc_get_cbs(struct wlan_objmgr_psoc * psoc)138 struct wlan_interop_issues_ap_callbacks *interop_issues_ap_psoc_get_cbs(
139 						struct wlan_objmgr_psoc *psoc)
140 {
141 	struct interop_issues_ap_psoc_priv_obj *interop_issues_ap_priv;
142 
143 	if (!psoc)
144 		return NULL;
145 
146 	interop_issues_ap_priv = interop_issues_ap_get_psoc_priv_obj(psoc);
147 	if (!interop_issues_ap_priv) {
148 		interop_issues_ap_err("psoc private object is null");
149 		return NULL;
150 	}
151 
152 	return &interop_issues_ap_priv->cbs;
153 }
154 #endif
155 #endif
156