1 /*
2  * Copyright (c) 2021-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: target_if_mlo_mgr.h
19  *
20  * This header file provide declarations required for Rx and Tx events from
21  * firmware
22  */
23 
24 #ifndef __TARGET_IF_MLO_MGR_H__
25 #define __TARGET_IF_MLO_MGR_H__
26 
27 #include <target_if.h>
28 #include <wlan_lmac_if_def.h>
29 
30 #ifdef WLAN_FEATURE_11BE_MLO
31 /**
32  * target_if_mlo_get_rx_ops() - get rx ops
33  * @psoc: pointer to soc object
34  *
35  * API to retrieve the MLO rx ops from the psoc context
36  *
37  * Return: pointer to rx ops
38  */
39 static inline struct wlan_lmac_if_mlo_rx_ops *
target_if_mlo_get_rx_ops(struct wlan_objmgr_psoc * psoc)40 target_if_mlo_get_rx_ops(struct wlan_objmgr_psoc *psoc)
41 {
42 	struct wlan_lmac_if_rx_ops *rx_ops;
43 
44 	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
45 	if (!rx_ops) {
46 		target_if_err("rx_ops is NULL");
47 		return NULL;
48 	}
49 
50 	return &rx_ops->mlo_rx_ops;
51 }
52 
53 /**
54  * target_if_mlo_get_tx_ops() - get tx ops
55  * @psoc: pointer to soc object
56  *
57  * API to retrieve the MLO tx ops from the psoc context
58  *
59  * Return: pointer to tx ops
60  */
61 static inline struct wlan_lmac_if_mlo_tx_ops *
target_if_mlo_get_tx_ops(struct wlan_objmgr_psoc * psoc)62 target_if_mlo_get_tx_ops(struct wlan_objmgr_psoc *psoc)
63 {
64 	struct wlan_lmac_if_tx_ops *tx_ops;
65 
66 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
67 	if (!tx_ops) {
68 		target_if_err("tx_ops is NULL");
69 		return NULL;
70 	}
71 
72 	return &tx_ops->mlo_ops;
73 }
74 
75 /**
76  * target_if_mlo_register_tx_ops() - lmac handler to register mlo tx ops
77  *  callback functions
78  * @tx_ops: wlan_lmac_if_tx_ops object
79  *
80  * Return: QDF_STATUS
81  */
82 QDF_STATUS
83 target_if_mlo_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
84 
85 /**
86  * target_if_mlo_send_link_removal_cmd() - Send WMI command for MLO link removal
87  * @psoc: psoc pointer
88  * @param: MLO link removal command parameters
89  *
90  * Return: QDF_STATUS of operation
91  */
92 QDF_STATUS target_if_mlo_send_link_removal_cmd(
93 		struct wlan_objmgr_psoc *psoc,
94 		const struct mlo_link_removal_cmd_params *param);
95 
96 /**
97  * target_if_mlo_send_vdev_pause() - Send WMI command for MLO vdev pause
98  * @psoc: psoc pointer
99  * @info: MLO vdev pause information
100  *
101  * Return: QDF_STATUS of operation
102  */
103 QDF_STATUS target_if_mlo_send_vdev_pause(struct wlan_objmgr_psoc *psoc,
104 					 struct mlo_vdev_pause *info);
105 
106 /**
107  * target_if_extract_mlo_link_removal_info_mgmt_rx() - Extract MLO link removal
108  * information from MGMT Rx event
109  * @wmi_handle: WMI handle
110  * @evt_buf: Event buffer
111  * @rx_event: MGMT Rx event parameters
112  *
113  * Return: QDF_STATUS of operation
114  */
115 QDF_STATUS
116 target_if_extract_mlo_link_removal_info_mgmt_rx(
117 		wmi_unified_t wmi_handle,
118 		void *evt_buf,
119 		struct mgmt_rx_event_params *rx_event);
120 
121 /**
122  * target_if_mlo_register_mlo_link_state_info_event -
123  *  Register mlo link state event
124  * @wmi_handle: WMI handle
125  */
126 void target_if_mlo_register_mlo_link_state_info_event(
127 		struct wmi_unified *wmi_handle);
128 
129 /**
130  * target_if_mlo_unregister_mlo_link_state_info_event -
131  *  Unregister mlo link state event
132  * @wmi_handle: WMI handle
133  */
134 void target_if_mlo_unregister_mlo_link_state_info_event(
135 		struct wmi_unified *wmi_handle);
136 
137 /**
138  * target_if_mlo_register_vdev_tid_to_link_map_event() - Register T2LM event
139  * handler.
140  * @wmi_handle: WMI handle
141  *
142  * Return: None
143  */
144 void target_if_mlo_register_vdev_tid_to_link_map_event(
145 		struct wmi_unified *wmi_handle);
146 
147 /**
148  * target_if_mlo_unregister_vdev_tid_to_link_map_event() - Unregister T2LM event
149  * handler.
150  * @wmi_handle: WMI handle
151  *
152  * Return: None
153  */
154 void target_if_mlo_unregister_vdev_tid_to_link_map_event(
155 		struct wmi_unified *wmi_handle);
156 #else
157 static inline QDF_STATUS
target_if_extract_mlo_link_removal_info_mgmt_rx(wmi_unified_t wmi_handle,void * evt_buf,struct mgmt_rx_event_params * rx_event)158 target_if_extract_mlo_link_removal_info_mgmt_rx(
159 		wmi_unified_t wmi_handle,
160 		void *evt_buf,
161 		struct mgmt_rx_event_params *rx_event)
162 {
163 	return QDF_STATUS_SUCCESS;
164 }
165 
166 static inline
target_if_mlo_register_vdev_tid_to_link_map_event(struct wmi_unified * wmi_handle)167 void target_if_mlo_register_vdev_tid_to_link_map_event(
168 		struct wmi_unified *wmi_handle)
169 {
170 }
171 
172 static inline
target_if_mlo_unregister_vdev_tid_to_link_map_event(struct wmi_unified * wmi_handle)173 void target_if_mlo_unregister_vdev_tid_to_link_map_event(
174 		struct wmi_unified *wmi_handle)
175 {
176 }
177 #endif
178 #endif /* __TARGET_IF_MLO_MGR_H__ */
179