1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: contains ll_sap_definitions specific to the ll_sap module
19  */
20 
21 #ifndef _WLAN_LL_SAP_MAIN_H_
22 #define _WLAN_LL_SAP_MAIN_H_
23 
24 #include "wlan_objmgr_psoc_obj.h"
25 #include "wlan_objmgr_vdev_obj.h"
26 #include "wlan_ll_sap_public_structs.h"
27 
28 #define ll_sap_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_LL_SAP, params)
29 #define ll_sap_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_LL_SAP, params)
30 #define ll_sap_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_LL_SAP, params)
31 
32 #define ll_sap_nofl_err(params...) \
33 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_LL_SAP, params)
34 #define ll_sap_nofl_info(params...) \
35 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_LL_SAP, params)
36 #define ll_sap_nofl_debug(params...) \
37 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_LL_SAP, params)
38 
39 /**
40  * struct ll_sap_psoc_priv_obj - ll_sap private psoc obj
41  * @tx_ops: Tx ops registered with Target IF interface
42  * @rx_ops: Rx  ops registered with Target IF interface
43  */
44 struct ll_sap_psoc_priv_obj {
45 	struct wlan_ll_sap_tx_ops tx_ops;
46 	struct wlan_ll_sap_rx_ops rx_ops;
47 };
48 
49 /**
50  * struct ll_sap_vdev_priv_obj - ll sap private vdev obj
51  * @bearer_switch_ctx: Bearer switch context
52  */
53 struct ll_sap_vdev_priv_obj {
54 	struct bearer_switch_info *bearer_switch_ctx;
55 };
56 
57 /**
58  * ll_sap_get_vdev_priv_obj: get ll_sap priv object from vdev object
59  * @vdev: pointer to vdev object
60  *
61  * Return: pointer to ll_sap vdev private object
62  */
63 static inline
ll_sap_get_vdev_priv_obj(struct wlan_objmgr_vdev * vdev)64 struct ll_sap_vdev_priv_obj *ll_sap_get_vdev_priv_obj(
65 						struct wlan_objmgr_vdev *vdev)
66 {
67 	struct ll_sap_vdev_priv_obj *obj;
68 
69 	if (!vdev) {
70 		ll_sap_err("vdev is null");
71 		return NULL;
72 	}
73 	obj = wlan_objmgr_vdev_get_comp_private_obj(vdev,
74 						    WLAN_UMAC_COMP_LL_SAP);
75 
76 	return obj;
77 }
78 
79 /**
80  * ll_sap_init() - initializes ll_sap component
81  *
82  * Return: QDF status
83  */
84 QDF_STATUS ll_sap_init(void);
85 
86 /**
87  * ll_sap_deinit() - De-initializes ll_sap component
88  *
89  * Return: QDF status
90  */
91 QDF_STATUS ll_sap_deinit(void);
92 
93 /**
94  * ll_sap_register_os_if_cb() - Register ll_sap osif callbacks
95  * @ll_sap_global_ops: Ops which needs to be registered
96  *
97  * Return: None
98  */
99 void ll_sap_register_os_if_cb(struct ll_sap_ops *ll_sap_global_ops);
100 
101 /**
102  * ll_sap_unregister_os_if_cb() - Un-register ll_sap osif callbacks
103  *
104  * Return: None
105  */
106 void ll_sap_unregister_os_if_cb(void);
107 
108 /**
109  * ll_sap_get_osif_cbk() - API to get ll_sap osif callbacks
110  *
111  * Return: global ll_sap osif callback
112  */
113 struct ll_sap_ops *ll_sap_get_osif_cbk(void);
114 
115 /**
116  * ll_sap_psoc_enable() - Enable ll_lt_sap psoc
117  * @psoc: objmgr psoc pointer
118  *
119  * Return: QDF_STATUS
120  */
121 QDF_STATUS ll_sap_psoc_enable(struct wlan_objmgr_psoc *psoc);
122 
123 /**
124  * ll_sap_psoc_disable() - Disable ll_lt_sap psoc
125  * @psoc: objmgr psoc pointer
126  *
127  * Return: None
128  */
129 QDF_STATUS ll_sap_psoc_disable(struct wlan_objmgr_psoc *psoc);
130 
131 #endif /* _WLAN_LL_SAP_MAIN_H_ */
132