Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Ashish Kumar Dhanotiya | aa9fdbb | 2018-12-14 15:29:14 +0530 | [diff] [blame^] | 2 | * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | #if !defined(__CDS_API_H) |
| 20 | #define __CDS_API_H |
| 21 | |
| 22 | /** |
| 23 | * DOC: cds_api.h |
| 24 | * |
| 25 | * Connectivity driver services public API |
| 26 | * |
| 27 | */ |
| 28 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 29 | #include <qdf_types.h> |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 30 | #include <qdf_status.h> |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 31 | #include <qdf_mem.h> |
Mahesh Kumar Kalikot Veetil | 319dbcd | 2016-10-27 15:03:48 -0700 | [diff] [blame] | 32 | #include <qdf_debugfs.h> |
Anurag Chouhan | ffb2154 | 2016-02-17 14:33:03 +0530 | [diff] [blame] | 33 | #include <qdf_list.h> |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 34 | #include <qdf_trace.h> |
Anurag Chouhan | ce0dc99 | 2016-02-16 18:18:03 +0530 | [diff] [blame] | 35 | #include <qdf_event.h> |
Anurag Chouhan | a37b5b7 | 2016-02-21 14:53:42 +0530 | [diff] [blame] | 36 | #include <qdf_lock.h> |
Ryan Hsu | d0327d5 | 2018-05-29 15:07:25 -0700 | [diff] [blame] | 37 | #include "qdf_platform.h" |
| 38 | #include "qdf_cpuhp.h" |
Ashish Kumar Dhanotiya | aa9fdbb | 2018-12-14 15:29:14 +0530 | [diff] [blame^] | 39 | #include <wlan_cmn.h> |
Amar Singhal | 5cccafe | 2017-02-15 12:42:58 -0800 | [diff] [blame] | 40 | #include "reg_services_public_struct.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | #include <cds_reg_service.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 42 | #include <cds_packet.h> |
| 43 | #include <cds_sched.h> |
Anurag Chouhan | 512c7d5 | 2016-02-19 15:49:46 +0530 | [diff] [blame] | 44 | #include <qdf_threads.h> |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 45 | #include <qdf_mc_timer.h> |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 46 | #include <wlan_objmgr_psoc_obj.h> |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 47 | #include <cdp_txrx_handle.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | |
| 49 | /* Amount of time to wait for WMA to perform an asynchronous activity. |
| 50 | * This value should be larger than the timeout used by WMI to wait for |
| 51 | * a response from target |
| 52 | */ |
| 53 | #define CDS_WMA_TIMEOUT (15000) |
| 54 | |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 55 | /** |
| 56 | * enum cds_driver_state - Driver state |
| 57 | * @CDS_DRIVER_STATE_UNINITIALIZED: Driver is in uninitialized state. |
| 58 | * CDS_DRIVER_STATE_LOADED: Driver is loaded and functional. |
| 59 | * CDS_DRIVER_STATE_LOADING: Driver probe is in progress. |
| 60 | * CDS_DRIVER_STATE_UNLOADING: Driver remove is in progress. |
| 61 | * CDS_DRIVER_STATE_RECOVERING: Recovery in progress. |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 62 | * CDS_DRIVER_STATE_BAD: Driver in bad state. |
Manjunathappa Prakash | 71c74a4 | 2017-10-19 23:28:43 -0700 | [diff] [blame] | 63 | * CDS_DRIVER_STATE_MODULE_STOPPING: Module stop in progress. |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 64 | */ |
| 65 | enum cds_driver_state { |
Manjunathappa Prakash | 71c74a4 | 2017-10-19 23:28:43 -0700 | [diff] [blame] | 66 | CDS_DRIVER_STATE_UNINITIALIZED = 0, |
| 67 | CDS_DRIVER_STATE_LOADED = BIT(0), |
| 68 | CDS_DRIVER_STATE_LOADING = BIT(1), |
| 69 | CDS_DRIVER_STATE_UNLOADING = BIT(2), |
| 70 | CDS_DRIVER_STATE_RECOVERING = BIT(3), |
| 71 | CDS_DRIVER_STATE_BAD = BIT(4), |
| 72 | CDS_DRIVER_STATE_FW_READY = BIT(5), |
| 73 | CDS_DRIVER_STATE_MODULE_STOPPING = BIT(6), |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | #define __CDS_IS_DRIVER_STATE(_state, _mask) (((_state) & (_mask)) == (_mask)) |
| 77 | |
| 78 | void cds_set_driver_state(enum cds_driver_state); |
| 79 | void cds_clear_driver_state(enum cds_driver_state); |
| 80 | enum cds_driver_state cds_get_driver_state(void); |
| 81 | |
| 82 | /** |
| 83 | * cds_is_driver_loading() - Is driver load in progress |
| 84 | * |
| 85 | * Return: true if driver is loading and false otherwise. |
| 86 | */ |
| 87 | static inline bool cds_is_driver_loading(void) |
| 88 | { |
| 89 | enum cds_driver_state state = cds_get_driver_state(); |
| 90 | |
| 91 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * cds_is_driver_unloading() - Is driver unload in progress |
| 96 | * |
| 97 | * Return: true if driver is unloading and false otherwise. |
| 98 | */ |
| 99 | static inline bool cds_is_driver_unloading(void) |
| 100 | { |
| 101 | enum cds_driver_state state = cds_get_driver_state(); |
| 102 | |
| 103 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * cds_is_driver_recovering() - Is recovery in progress |
| 108 | * |
| 109 | * Return: true if recovery in progress and false otherwise. |
| 110 | */ |
| 111 | static inline bool cds_is_driver_recovering(void) |
| 112 | { |
| 113 | enum cds_driver_state state = cds_get_driver_state(); |
| 114 | |
| 115 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_RECOVERING); |
| 116 | } |
| 117 | |
| 118 | /** |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 119 | * cds_is_driver_in_bad_state() - is driver in bad state |
| 120 | * |
| 121 | * Return: true if driver is in bad state and false otherwise. |
| 122 | */ |
| 123 | static inline bool cds_is_driver_in_bad_state(void) |
| 124 | { |
| 125 | enum cds_driver_state state = cds_get_driver_state(); |
| 126 | |
| 127 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_BAD); |
| 128 | } |
| 129 | |
| 130 | /** |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 131 | * cds_is_load_or_unload_in_progress() - Is driver load OR unload in progress |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 132 | * |
Rajeev Kumar | d8508cb | 2016-01-19 15:05:09 -0800 | [diff] [blame] | 133 | * Return: true if driver is loading OR unloading and false otherwise. |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 134 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 135 | static inline bool cds_is_load_or_unload_in_progress(void) |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 136 | { |
| 137 | enum cds_driver_state state = cds_get_driver_state(); |
| 138 | |
Rajeev Kumar | d8508cb | 2016-01-19 15:05:09 -0800 | [diff] [blame] | 139 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING) || |
| 140 | __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING); |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | /** |
Manjunathappa Prakash | 71c74a4 | 2017-10-19 23:28:43 -0700 | [diff] [blame] | 144 | * cds_is_module_stop_in_progress() - Is module stopping |
| 145 | * |
| 146 | * Return: true if module stop is in progress. |
| 147 | */ |
| 148 | static inline bool cds_is_module_stop_in_progress(void) |
| 149 | { |
| 150 | enum cds_driver_state state = cds_get_driver_state(); |
| 151 | |
| 152 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_MODULE_STOPPING); |
| 153 | } |
| 154 | |
| 155 | /** |
Govind Singh | a1f6dac | 2017-06-13 11:45:07 +0530 | [diff] [blame] | 156 | * cds_is_target_ready() - Is target is in ready state |
| 157 | * |
| 158 | * Return: true if target is in ready state and false otherwise. |
| 159 | */ |
| 160 | static inline bool cds_is_target_ready(void) |
| 161 | { |
| 162 | enum cds_driver_state state = cds_get_driver_state(); |
| 163 | |
| 164 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_FW_READY); |
| 165 | } |
| 166 | |
| 167 | /** |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 168 | * cds_set_recovery_in_progress() - Set recovery in progress |
| 169 | * @value: value to set |
| 170 | * |
| 171 | * Return: none |
| 172 | */ |
| 173 | static inline void cds_set_recovery_in_progress(uint8_t value) |
| 174 | { |
| 175 | if (value) |
| 176 | cds_set_driver_state(CDS_DRIVER_STATE_RECOVERING); |
| 177 | else |
| 178 | cds_clear_driver_state(CDS_DRIVER_STATE_RECOVERING); |
| 179 | } |
| 180 | |
| 181 | /** |
Hanumanth Reddy Pothula | 2a8a740 | 2017-07-03 14:06:11 +0530 | [diff] [blame] | 182 | * cds_set_driver_in_bad_state() - Set driver state |
| 183 | * @value: value to set |
| 184 | * |
| 185 | * Return: none |
| 186 | */ |
| 187 | static inline void cds_set_driver_in_bad_state(uint8_t value) |
| 188 | { |
| 189 | if (value) |
| 190 | cds_set_driver_state(CDS_DRIVER_STATE_BAD); |
| 191 | else |
| 192 | cds_clear_driver_state(CDS_DRIVER_STATE_BAD); |
| 193 | } |
| 194 | |
| 195 | /** |
Govind Singh | a1f6dac | 2017-06-13 11:45:07 +0530 | [diff] [blame] | 196 | * cds_set_target_ready() - Set target ready state |
| 197 | * @value: value to set |
| 198 | * |
| 199 | * Return: none |
| 200 | */ |
| 201 | static inline void cds_set_target_ready(uint8_t value) |
| 202 | { |
| 203 | if (value) |
| 204 | cds_set_driver_state(CDS_DRIVER_STATE_FW_READY); |
| 205 | else |
| 206 | cds_clear_driver_state(CDS_DRIVER_STATE_FW_READY); |
| 207 | } |
| 208 | |
| 209 | /** |
Prashanth Bhatta | 9e14305 | 2015-12-04 11:56:47 -0800 | [diff] [blame] | 210 | * cds_set_load_in_progress() - Set load in progress |
| 211 | * @value: value to set |
| 212 | * |
| 213 | * Return: none |
| 214 | */ |
| 215 | static inline void cds_set_load_in_progress(uint8_t value) |
| 216 | { |
| 217 | if (value) |
| 218 | cds_set_driver_state(CDS_DRIVER_STATE_LOADING); |
| 219 | else |
| 220 | cds_clear_driver_state(CDS_DRIVER_STATE_LOADING); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * cds_set_driver_loaded() - Set load completed |
| 225 | * @value: value to set |
| 226 | * |
| 227 | * Return: none |
| 228 | */ |
| 229 | static inline void cds_set_driver_loaded(uint8_t value) |
| 230 | { |
| 231 | if (value) |
| 232 | cds_set_driver_state(CDS_DRIVER_STATE_LOADED); |
| 233 | else |
| 234 | cds_clear_driver_state(CDS_DRIVER_STATE_LOADED); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * cds_set_unload_in_progress() - Set unload in progress |
| 239 | * @value: value to set |
| 240 | * |
| 241 | * Return: none |
| 242 | */ |
| 243 | static inline void cds_set_unload_in_progress(uint8_t value) |
| 244 | { |
| 245 | if (value) |
| 246 | cds_set_driver_state(CDS_DRIVER_STATE_UNLOADING); |
| 247 | else |
| 248 | cds_clear_driver_state(CDS_DRIVER_STATE_UNLOADING); |
| 249 | } |
| 250 | |
Sachin Ahuja | dddd263 | 2017-03-07 19:07:24 +0530 | [diff] [blame] | 251 | /** |
Manjunathappa Prakash | 71c74a4 | 2017-10-19 23:28:43 -0700 | [diff] [blame] | 252 | * cds_set_module_stop_in_progress() - Setting module stop in progress |
| 253 | * |
| 254 | * @value: value to set |
| 255 | * |
| 256 | * Return: none |
| 257 | */ |
| 258 | static inline void cds_set_module_stop_in_progress(bool value) |
| 259 | { |
| 260 | if (value) |
| 261 | cds_set_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING); |
| 262 | else |
| 263 | cds_clear_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING); |
| 264 | } |
| 265 | |
| 266 | /** |
Sachin Ahuja | dddd263 | 2017-03-07 19:07:24 +0530 | [diff] [blame] | 267 | * cds_is_driver_loaded() - Is driver loaded |
| 268 | * |
| 269 | * Return: true if driver is loaded or false otherwise. |
| 270 | */ |
| 271 | static inline bool cds_is_driver_loaded(void) |
| 272 | { |
| 273 | enum cds_driver_state state = cds_get_driver_state(); |
| 274 | |
| 275 | return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADED); |
| 276 | } |
| 277 | |
Jeff Johnson | 7aaeeea | 2017-09-26 13:16:24 -0700 | [diff] [blame] | 278 | /** |
| 279 | * cds_init() - Initialize CDS |
| 280 | * |
| 281 | * This function allocates the resource required for CDS, but does not |
| 282 | * initialize all the members. This overall initialization will happen at |
| 283 | * cds_open(). |
| 284 | * |
| 285 | * Return: QDF_STATUS_SUCCESS if CDS was initialized and an error on failure |
| 286 | */ |
| 287 | QDF_STATUS cds_init(void); |
| 288 | |
Prashanth Bhatta | 5da711e | 2015-11-30 14:28:52 -0800 | [diff] [blame] | 289 | void cds_deinit(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 290 | |
Jeff Johnson | 3a28012 | 2017-09-13 07:42:00 -0700 | [diff] [blame] | 291 | QDF_STATUS cds_pre_enable(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 292 | |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 293 | QDF_STATUS cds_open(struct wlan_objmgr_psoc *psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | |
Venkata Sharath Chandra Manchala | 4aaae0f | 2017-07-10 11:59:19 -0700 | [diff] [blame] | 295 | /** |
| 296 | * cds_dp_open() - Open datapath module |
| 297 | * @psoc - object manager soc handle |
| 298 | * |
| 299 | * API to map the datapath rings to interrupts |
| 300 | * and also open the datapath pdev module. |
| 301 | * |
| 302 | * Return: QDF status |
| 303 | */ |
| 304 | QDF_STATUS cds_dp_open(struct wlan_objmgr_psoc *psoc); |
| 305 | |
Jeff Johnson | 4ea7974 | 2018-07-21 21:57:24 -0700 | [diff] [blame] | 306 | /** |
| 307 | * cds_enable() - start/enable cds module |
| 308 | * @psoc: Psoc pointer |
| 309 | * |
| 310 | * Return: QDF status |
| 311 | */ |
Jeff Johnson | 8f9dd5f | 2017-09-13 14:16:08 -0700 | [diff] [blame] | 312 | QDF_STATUS cds_enable(struct wlan_objmgr_psoc *psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | |
Jeff Johnson | ea5c2aa1 | 2017-09-13 14:18:59 -0700 | [diff] [blame] | 314 | QDF_STATUS cds_disable(struct wlan_objmgr_psoc *psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | |
Rajeev Kumar | be02124 | 2017-02-16 16:12:23 -0800 | [diff] [blame] | 316 | QDF_STATUS cds_post_disable(void); |
Govind Singh | b048e87 | 2016-09-27 22:07:43 +0530 | [diff] [blame] | 317 | |
Jeff Johnson | e4b1459 | 2017-09-13 14:23:33 -0700 | [diff] [blame] | 318 | QDF_STATUS cds_close(struct wlan_objmgr_psoc *psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | |
Venkata Sharath Chandra Manchala | 4aaae0f | 2017-07-10 11:59:19 -0700 | [diff] [blame] | 320 | /** |
| 321 | * cds_dp_close() - Close datapath module |
| 322 | * @psoc: Object manager soc handle |
| 323 | * |
| 324 | * API used to detach interrupts assigned to service |
| 325 | * datapath rings and close pdev module |
| 326 | * |
| 327 | * Return: Status |
| 328 | */ |
| 329 | QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc); |
| 330 | |
Jeff Johnson | b3be6a6 | 2018-05-30 18:50:12 -0700 | [diff] [blame] | 331 | void *cds_get_context(QDF_MODULE_ID module_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 332 | |
Venkata Sharath Chandra Manchala | 8398563 | 2017-02-28 14:16:22 -0800 | [diff] [blame] | 333 | uint8_t cds_get_datapath_handles(void **soc, struct cdp_pdev **pdev, |
| 334 | struct cdp_vdev **vdev, uint8_t sessionId); |
Jeff Johnson | 31a6758 | 2017-09-26 14:54:28 -0700 | [diff] [blame] | 335 | void *cds_get_global_context(void); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 336 | |
Jeff Johnson | 1326996 | 2018-05-30 19:16:46 -0700 | [diff] [blame] | 337 | QDF_STATUS cds_alloc_context(QDF_MODULE_ID module_id, void **module_context, |
Jeff Johnson | adb3b1c | 2017-09-13 10:42:36 -0700 | [diff] [blame] | 338 | uint32_t size); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | |
Jeff Johnson | 1326996 | 2018-05-30 19:16:46 -0700 | [diff] [blame] | 340 | QDF_STATUS cds_free_context(QDF_MODULE_ID module_id, void *module_context); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | |
Komal Seelam | 1aac198 | 2016-03-02 15:57:26 +0530 | [diff] [blame] | 342 | QDF_STATUS cds_set_context(QDF_MODULE_ID module_id, void *context); |
Komal Seelam | ad5a90d | 2016-02-16 13:50:03 +0530 | [diff] [blame] | 343 | |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 344 | QDF_STATUS cds_get_vdev_types(enum QDF_OPMODE mode, uint32_t *type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 345 | uint32_t *subType); |
| 346 | |
| 347 | void cds_flush_work(void *work); |
| 348 | void cds_flush_delayed_work(void *dwork); |
| 349 | |
Nirav Shah | bb8e47c | 2018-05-17 16:56:41 +0530 | [diff] [blame] | 350 | #ifdef REMOVE_PKT_LOG |
| 351 | static inline |
| 352 | bool cds_is_packet_log_enabled(void) |
| 353 | { |
| 354 | return false; |
| 355 | } |
| 356 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 357 | bool cds_is_packet_log_enabled(void); |
Nirav Shah | bb8e47c | 2018-05-17 16:56:41 +0530 | [diff] [blame] | 358 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 359 | |
Anurag Chouhan | 4085ff7 | 2017-10-05 18:09:56 +0530 | [diff] [blame] | 360 | /** |
| 361 | * cds_get_recovery_reason() - get self recovery reason |
| 362 | * @reason: cds hang reason |
| 363 | * |
| 364 | * Return: None |
| 365 | */ |
| 366 | void cds_get_recovery_reason(enum qdf_hang_reason *reason); |
| 367 | |
| 368 | /** |
| 369 | * cds_reset_recovery_reason() - reset the reason to unspecified |
| 370 | * |
| 371 | * Return: None |
| 372 | */ |
| 373 | void cds_reset_recovery_reason(void); |
| 374 | |
| 375 | /** |
| 376 | * cds_trigger_recovery() - trigger self recovery |
| 377 | * @reason: recovery reason |
| 378 | * |
| 379 | * Return: none |
| 380 | */ |
Dustin Brown | 2a24d7c | 2018-08-16 10:19:10 -0700 | [diff] [blame] | 381 | #define cds_trigger_recovery(reason) \ |
| 382 | __cds_trigger_recovery(reason, __func__, __LINE__) |
| 383 | void __cds_trigger_recovery(enum qdf_hang_reason reason, const char *func, |
| 384 | const uint32_t line); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 385 | |
| 386 | void cds_set_wakelock_logging(bool value); |
| 387 | bool cds_is_wakelock_enabled(void); |
| 388 | void cds_set_ring_log_level(uint32_t ring_id, uint32_t log_level); |
| 389 | enum wifi_driver_log_level cds_get_ring_log_level(uint32_t ring_id); |
| 390 | void cds_set_multicast_logging(uint8_t value); |
| 391 | uint8_t cds_is_multicast_logging(void); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 392 | QDF_STATUS cds_set_log_completion(uint32_t is_fatal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 393 | uint32_t type, |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 394 | uint32_t sub_type, |
| 395 | bool recovery_needed); |
| 396 | void cds_get_and_reset_log_completion(uint32_t *is_fatal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | uint32_t *type, |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 398 | uint32_t *sub_type, |
| 399 | bool *recovery_needed); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 400 | bool cds_is_log_report_in_progress(void); |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 401 | bool cds_is_fatal_event_enabled(void); |
Yu Wang | 66a250b | 2017-07-19 11:46:40 +0800 | [diff] [blame] | 402 | |
| 403 | #ifdef WLAN_FEATURE_TSF_PLUS |
| 404 | bool cds_is_ptp_rx_opt_enabled(void); |
| 405 | bool cds_is_ptp_tx_opt_enabled(void); |
| 406 | #else |
| 407 | static inline bool cds_is_ptp_rx_opt_enabled(void) |
| 408 | { |
| 409 | return false; |
| 410 | } |
| 411 | |
| 412 | static inline bool cds_is_ptp_tx_opt_enabled(void) |
| 413 | { |
| 414 | return false; |
| 415 | } |
| 416 | #endif |
| 417 | |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 418 | uint32_t cds_get_log_indicator(void); |
| 419 | void cds_set_fatal_event(bool value); |
| 420 | void cds_wlan_flush_host_logs_for_fatal(void); |
| 421 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 422 | void cds_init_log_completion(void); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 423 | QDF_STATUS cds_flush_logs(uint32_t is_fatal, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 424 | uint32_t indicator, |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 425 | uint32_t reason_code, |
| 426 | bool dump_mac_trace, |
| 427 | bool recovery_needed); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | void cds_logging_set_fw_flush_complete(void); |
Komal Seelam | 78ff65a | 2016-08-18 15:25:24 +0530 | [diff] [blame] | 429 | void cds_svc_fw_shutdown_ind(struct device *dev); |
Abhishek Singh | 437606a | 2016-04-27 13:51:49 +0530 | [diff] [blame] | 430 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 431 | void cds_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx, |
| 432 | uint8_t type, uint8_t sub_type, uint8_t *peer_mac); |
| 433 | #else |
| 434 | static inline |
| 435 | void cds_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx, |
| 436 | uint8_t type, uint8_t sub_type, uint8_t *peer_mac) |
| 437 | |
| 438 | { |
| 439 | } |
| 440 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 441 | |
Ryan Hsu | ceddceb | 2016-04-28 10:20:14 -0700 | [diff] [blame] | 442 | int cds_get_radio_index(void); |
| 443 | QDF_STATUS cds_set_radio_index(int radio_index); |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 444 | void cds_init_ini_config(struct cds_config_info *cds_cfg); |
| 445 | void cds_deinit_ini_config(void); |
| 446 | struct cds_config_info *cds_get_ini_config(void); |
| 447 | |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 448 | bool cds_is_5_mhz_enabled(void); |
| 449 | bool cds_is_10_mhz_enabled(void); |
| 450 | bool cds_is_sub_20_mhz_enabled(void); |
Naveen Rawat | 91df30a | 2016-10-12 21:26:18 -0700 | [diff] [blame] | 451 | bool cds_is_self_recovery_enabled(void); |
Yuanyuan Liu | e470977 | 2018-09-05 14:57:46 -0700 | [diff] [blame] | 452 | bool cds_is_fw_down(void); |
Jeff Johnson | 876c1a6 | 2017-12-12 10:43:07 -0800 | [diff] [blame] | 453 | enum QDF_GLOBAL_MODE cds_get_conparam(void); |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 454 | |
Nirav Shah | eb017be | 2018-02-15 11:20:58 +0530 | [diff] [blame] | 455 | #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE |
| 456 | void cds_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data); |
| 457 | #else |
| 458 | static inline |
| 459 | void cds_pkt_stats_to_logger_thread(void *pl_hdr, void *pkt_dump, void *data) |
| 460 | { |
| 461 | } |
| 462 | #endif |
| 463 | |
Rachit Kankane | b103562 | 2018-01-24 18:41:35 +0530 | [diff] [blame] | 464 | #ifdef FEATURE_HTC_CREDIT_HISTORY |
| 465 | /** |
| 466 | * cds_print_htc_credit_history() - Helper function to copy HTC credit |
| 467 | * history via htc_print_credit_history() |
| 468 | * |
| 469 | * @count: Number of lines to be copied |
| 470 | * @print: Print callback to print in the buffer |
| 471 | * |
| 472 | * Return: none |
| 473 | */ |
| 474 | void cds_print_htc_credit_history(uint32_t count, |
| 475 | qdf_abstract_print * print, |
| 476 | void *print_priv); |
| 477 | #else |
Dustin Brown | 8d2d0f5 | 2017-04-03 17:02:08 -0700 | [diff] [blame] | 478 | |
Rachit Kankane | b103562 | 2018-01-24 18:41:35 +0530 | [diff] [blame] | 479 | static inline |
| 480 | void cds_print_htc_credit_history(uint32_t count, |
| 481 | qdf_abstract_print *print, |
| 482 | void *print_priv) |
| 483 | { |
| 484 | } |
| 485 | #endif |
Rajeev Kumar Sirasanagandla | 686abd9 | 2017-06-08 18:09:01 +0530 | [diff] [blame] | 486 | /** |
| 487 | * cds_is_group_addr() - checks whether addr is multi cast |
| 488 | * @mac_addr: address to be checked for multicast |
| 489 | * |
| 490 | * Check if the input mac addr is multicast addr |
| 491 | * |
| 492 | * Return: true if multicast addr else false |
| 493 | */ |
| 494 | static inline |
| 495 | bool cds_is_group_addr(uint8_t *mac_addr) |
| 496 | { |
| 497 | if (mac_addr[0] & 0x01) |
| 498 | return true; |
| 499 | else |
| 500 | return false; |
| 501 | } |
| 502 | |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 503 | /** |
| 504 | * cds_get_arp_stats_gw_ip() - get arp stats track IP |
| 505 | * @context: osif dev |
| 506 | * |
| 507 | * Return: ARP stats IP to track. |
| 508 | */ |
| 509 | uint32_t cds_get_arp_stats_gw_ip(void *context); |
Poddar, Siddarth | 3906e17 | 2018-01-09 11:24:58 +0530 | [diff] [blame] | 510 | /** |
| 511 | * cds_get_connectivity_stats_pkt_bitmap() - get pkt-type bitmap |
| 512 | * @context: osif dev context |
| 513 | * |
| 514 | * Return: pkt bitmap to track |
| 515 | */ |
| 516 | uint32_t cds_get_connectivity_stats_pkt_bitmap(void *context); |
Sravan Kumar Kairam | c1ae71c | 2017-02-24 12:27:27 +0530 | [diff] [blame] | 517 | void cds_incr_arp_stats_tx_tgt_delivered(void); |
| 518 | void cds_incr_arp_stats_tx_tgt_acked(void); |
Himanshu Agarwal | edf30dc | 2017-06-05 15:54:27 +0530 | [diff] [blame] | 519 | |
| 520 | /** |
| 521 | * cds_smmu_mem_map_setup() - Check SMMU S1 stage enable |
| 522 | * status and setup wlan driver |
| 523 | * @osdev: Parent device instance |
Yun Park | 45d3597 | 2018-03-02 09:57:54 -0800 | [diff] [blame] | 524 | * @ipa_present: IPA HW support flag |
Himanshu Agarwal | edf30dc | 2017-06-05 15:54:27 +0530 | [diff] [blame] | 525 | * |
| 526 | * This API checks if SMMU S1 translation is enabled in |
| 527 | * platform driver or not and sets it accordingly in driver. |
| 528 | * |
Himanshu Agarwal | a89ce24 | 2017-11-17 17:36:34 +0530 | [diff] [blame] | 529 | * Return: QDF_STATUS |
Himanshu Agarwal | edf30dc | 2017-06-05 15:54:27 +0530 | [diff] [blame] | 530 | */ |
Yun Park | 45d3597 | 2018-03-02 09:57:54 -0800 | [diff] [blame] | 531 | QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present); |
Himanshu Agarwal | edf30dc | 2017-06-05 15:54:27 +0530 | [diff] [blame] | 532 | |
| 533 | /** |
| 534 | * cds_smmu_map_unmap() - Map / Unmap DMA buffer to IPA UC |
| 535 | * @map: Map / unmap operation |
| 536 | * @num_buf: Number of buffers in array |
| 537 | * @buf_arr: Buffer array of DMA mem mapping info |
| 538 | * |
| 539 | * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation |
| 540 | * is enabled. |
| 541 | * |
| 542 | * Return: Status of map operation |
| 543 | */ |
| 544 | int cds_smmu_map_unmap(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 545 | #endif /* if !defined __CDS_API_H */ |