1 /*
2 * Copyright (c) 2019-2020 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 /**
20 * DOC: target_if_vdev_mgr_rx_ops.h
21 *
22 * This file provides declarations for APIs registered for wmi events
23 */
24
25 #ifndef __TARGET_IF_VDEV_MGR_RX_OPS_H__
26 #define __TARGET_IF_VDEV_MGR_RX_OPS_H__
27
28 #include <wmi_unified_param.h>
29 #include <wlan_objmgr_psoc_obj.h>
30 #include <wlan_lmac_if_def.h>
31 #include <qdf_platform.h>
32
33 /**
34 * target_if_vdev_mgr_is_panic_allowed: API to get if panic is allowed on
35 * timeout
36 *
37 * Return: TRUE or FALSE when VDEV_ASSERT_MANAGEMENT is disabled else FALSE
38 */
39 #ifdef VDEV_ASSERT_MANAGEMENT
target_if_vdev_mgr_is_panic_allowed(void)40 static inline bool target_if_vdev_mgr_is_panic_allowed(void)
41 {
42 return false;
43 }
44 #else
target_if_vdev_mgr_is_panic_allowed(void)45 static inline bool target_if_vdev_mgr_is_panic_allowed(void)
46 {
47 if (qdf_is_recovering() || qdf_is_fw_down())
48 return false;
49
50 return true;
51 }
52 #endif
53
54
55 /**
56 * target_if_vdev_mgr_offload_bcn_tx_status_handler() - API to handle beacon
57 * tx status event
58 * @scn: pointer to scan object
59 * @data: pointer to data
60 * @datalen: length of data
61 *
62 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
63 */
64 int target_if_vdev_mgr_offload_bcn_tx_status_handler(ol_scn_t scn,
65 uint8_t *data,
66 uint32_t datalen);
67
68 /**
69 * target_if_vdev_mgr_tbttoffset_update_handler() - API to handle tbtt offset
70 * update event
71 * @scn: pointer to scan object
72 * @data: pointer to data
73 * @datalen: length of data
74 *
75 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
76 */
77 int target_if_vdev_mgr_tbttoffset_update_handler(ol_scn_t scn,
78 uint8_t *data,
79 uint32_t datalen);
80
81 /**
82 * target_if_vdev_mgr_ext_tbttoffset_update_handler() - API to handle ext tbtt
83 * offset update event
84 * @scn: pointer to scan object
85 * @data: pointer to data
86 * @datalen: length of data
87 *
88 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
89 */
90 int target_if_vdev_mgr_ext_tbttoffset_update_handler(ol_scn_t scn,
91 uint8_t *data,
92 uint32_t datalen);
93
94 /**
95 * target_if_vdev_mgr_is_panic_on_bug: API to get panic on bug
96 *
97 * Return: TRUE or FALSE
98 */
target_if_vdev_mgr_is_panic_on_bug(void)99 static inline bool target_if_vdev_mgr_is_panic_on_bug(void)
100 {
101 #ifdef PANIC_ON_BUG
102 return true;
103 #else
104 return false;
105 #endif
106 }
107
108 /**
109 * target_if_vdev_mgr_get_rx_ops() - get rx ops
110 * @psoc: pointer to psoc object
111 *
112 * Return: pointer to rx ops
113 */
114 static inline struct wlan_lmac_if_mlme_rx_ops *
target_if_vdev_mgr_get_rx_ops(struct wlan_objmgr_psoc * psoc)115 target_if_vdev_mgr_get_rx_ops(struct wlan_objmgr_psoc *psoc)
116 {
117 struct wlan_lmac_if_rx_ops *rx_ops;
118
119 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
120 if (!rx_ops) {
121 qdf_err("rx_ops is NULL");
122 return NULL;
123 }
124
125 return &rx_ops->mops;
126 }
127
128 /**
129 * target_if_vdev_mgr_rsp_timer_mgmt_cb() - function to handle response timer
130 * @arg: pointer to argument
131 *
132 * Callback timer triggered when response timer expires which pass
133 * vdev as argument
134 *
135 * Return: status of operation.
136 */
137 void target_if_vdev_mgr_rsp_timer_mgmt_cb(void *arg);
138
139 /**
140 * target_if_vdev_mgr_wmi_event_register() - function to handle register
141 * events from WMI
142 * @psoc: pointer to psoc object
143 *
144 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
145 */
146 QDF_STATUS target_if_vdev_mgr_wmi_event_register(
147 struct wlan_objmgr_psoc *psoc);
148
149 /**
150 * target_if_vdev_mgr_wmi_event_unregister() - function to handle unregister
151 * events from WMI
152 * @psoc: pointer to psoc object
153 *
154 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
155 */
156 QDF_STATUS target_if_vdev_mgr_wmi_event_unregister(
157 struct wlan_objmgr_psoc *psoc);
158
159 /**
160 * target_if_vdev_mgr_rsp_timer_cb() - function to handle vdev related timeouts
161 * @arg: pointer to argument
162 *
163 * Return: none
164 */
165 void target_if_vdev_mgr_rsp_timer_cb(void *arg);
166
167 #endif /* __TARGET_IF_VDEV_MGR_RX_OPS_H__ */
168