xref: /wlan-dirver/qca-wifi-host-cmn/target_if/cfr/inc/target_if_cfr.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
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 #ifndef _TARGET_IF_CFR_H_
20 #define _TARGET_IF_CFR_H_
21 
22 #include <wlan_objmgr_cmn.h>
23 #include <wlan_objmgr_psoc_obj.h>
24 #include <wlan_objmgr_pdev_obj.h>
25 #include <wlan_objmgr_vdev_obj.h>
26 #include <wlan_objmgr_peer_obj.h>
27 
28 #include "wmi_unified_cfr_api.h"
29 #include "wmi_unified_param.h"
30 #include "wmi_unified_cfr_param.h"
31 #define PEER_CFR_CAPTURE_ENABLE   1
32 #define PEER_CFR_CAPTURE_DISABLE  0
33 
34 #define PEER_CFR_CAPTURE_EVT_STATUS_MASK 0x80000000
35 #define PEER_CFR_CAPTURE_EVT_PS_STATUS_MASK 0x40000000
36 #define CFR_TX_EVT_STATUS_MASK           0x00000003
37 
38 /* Status codes used by correlate and relay function */
39 #define STATUS_STREAM_AND_RELEASE 0
40 #define STATUS_HOLD               1
41 #define STATUS_ERROR             -1
42 
43 /* Module IDs using corrlation function */
44 #define CORRELATE_DBR_MODULE_ID   0
45 /*
46  * HKV2 - Tx completion event for one-shot capture
47  * Cypress - Tx completion event for one-shot capture (or) RXTLV event for RCC
48  */
49 #define CORRELATE_TX_EV_MODULE_ID 1
50 
51 /**
52  * target_if_cfr_init_pdev() - Inits cfr pdev and registers necessary handlers.
53  * @psoc: pointer to psoc object
54  * @pdev: pointer to pdev object
55  *
56  * Return: Registration status for necessary handlers
57  */
58 int target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
59 			    struct wlan_objmgr_pdev *pdev);
60 
61 /**
62  * target_if_cfr_deinit_pdev() - De-inits corresponding pdev and handlers.
63  * @psoc: pointer to psoc object
64  * @pdev: pointer to pdev object
65  *
66  * Return: De-registration status for necessary handlers
67  */
68 int target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
69 			      struct wlan_objmgr_pdev *pdev);
70 
71 /**
72  * target_if_cfr_tx_ops_register() - Registers tx ops for cfr module
73  * @tx_ops - pointer to tx_ops structure.
74  */
75 void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops);
76 
77 /**
78  * target_if_cfr_enable_cfr_timer() - Enables cfr timer
79  * @pdev: pointer to pdev object
80  * @cfr_timer: Amount of time this timer has to run
81  *
82  * Return: status of timer
83  */
84 int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev,
85 				   uint32_t cfr_timer);
86 
87 /**
88  * target_if_cfr_pdev_set_param() - Function to set params for cfr config
89  * @pdev: pointer to pdev object
90  * @param_id: param id which has to be set
91  * @param_value: value of param being set
92  *
93  * Return: success/failure of setting param
94  */
95 int target_if_cfr_pdev_set_param(struct wlan_objmgr_pdev *pdev,
96 				 uint32_t param_id, uint32_t param_value);
97 /**
98  * target_if_cfr_start_capture() - Function to start cfr capture for a peer
99  * @pdev: pointer to pdev object
100  * @peer: pointer to peer object
101  * @cfr_params: capture parameters for this peer
102  *
103  * Return: success/failure status of start capture
104  */
105 int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
106 				struct wlan_objmgr_peer *peer,
107 				struct cfr_capture_params *cfr_params);
108 /**
109  * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer
110  * @pdev: pointer to pdev object
111  * @peer: pointer to peer object
112  *
113  * Return: success/failure status of stop capture
114  */
115 int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
116 			       struct wlan_objmgr_peer *peer);
117 
118 /**
119  * target_if_cfr_get_target_type() - Function to get target type
120  * @psoc: pointer to psoc object
121  *
122  * Return: target type of target
123  */
124 int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc);
125 
126 /**
127  * target_if_cfr_set_cfr_support() - Function to set cfr support
128  * @psoc: pointer to psoc object
129  * @value: value to be set
130  */
131 void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
132 				   uint8_t value);
133 
134 /**
135  * target_if_cfr_set_capture_count_support() - Function to set capture count
136  *					       support.
137  * @psoc: pointer to psoc object
138  * @value: value to be set
139  *
140  * Return: success/failure
141  */
142 QDF_STATUS
143 target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc,
144 					uint8_t value);
145 
146 /**
147  * target_if_cfr_set_mo_marking_support() - Function to set MO marking support
148  * @psoc: pointer to psoc object
149  * @value: value to be set
150  *
151  * Return: success/failure
152  */
153 QDF_STATUS
154 target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc,
155 				     uint8_t value);
156 
157 /**
158  * target_if_cfr_info_send() - Function to send cfr info to upper layers
159  * @pdev: pointer to pdev object
160  * @head: pointer to cfr info head
161  * @hlen: head len
162  * @data: pointer to cfr info data
163  * @dlen: data len
164  * @tail: pointer to cfr info tail
165  * @tlen: tail len
166  */
167 void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
168 			     size_t hlen, void *data, size_t dlen, void *tail,
169 			     size_t tlen);
170 
171 #ifdef WIFI_TARGET_TYPE_2_0
172 /**
173  * cfr_wifi2_0_init_pdev() - Function to init legacy pdev
174  * @psoc: pointer to psoc object
175  * @pdev: pointer to pdev object
176  *
177  * Return: success/failure status of init
178  */
179 QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc,
180 				 struct wlan_objmgr_pdev *pdev);
181 
182 /**
183  * cfr_wifi2_0_deinit_pdev() - Function to deinit legacy pdev
184  * @psoc: pointer to psoc object
185  * @pdev: pointer to pdev object
186  *
187  * Return: success/failure status of deinit
188  */
189 QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc,
190 				   struct wlan_objmgr_pdev *pdev);
191 
192 #else
193 #ifndef CFR_USE_FIXED_FOLDER
194 static QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc,
195 					struct wlan_objmgr_pdev *pdev)
196 {
197 	return QDF_STATUS_SUCCESS;
198 }
199 
200 static QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc,
201 					  struct wlan_objmgr_pdev *pdev)
202 {
203 	return QDF_STATUS_SUCCESS;
204 }
205 #endif
206 #endif
207 #endif
208