Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 1 | /* |
Vevek Venkatesan | 78f7f09 | 2019-05-23 17:16:28 +0530 | [diff] [blame] | 2 | * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 3 | * |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [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 | |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 19 | #ifndef _WLAN_IPA_CORE_H_ |
| 20 | #define _WLAN_IPA_CORE_H_ |
| 21 | |
| 22 | #ifdef IPA_OFFLOAD |
| 23 | |
| 24 | #include "wlan_ipa_priv.h" |
| 25 | #include "wlan_ipa_public_struct.h" |
| 26 | |
| 27 | /** |
| 28 | * wlan_ipa_is_enabled() - Is IPA enabled? |
| 29 | * @ipa_cfg: IPA config |
| 30 | * |
| 31 | * Return: true if IPA is enabled, false otherwise |
| 32 | */ |
| 33 | static inline bool wlan_ipa_is_enabled(struct wlan_ipa_config *ipa_cfg) |
| 34 | { |
| 35 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_ENABLE_MASK); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * wlan_ipa_uc_is_enabled() - Is IPA UC enabled? |
| 40 | * @ipa_cfg: IPA config |
| 41 | * |
| 42 | * Return: true if IPA UC is enabled, false otherwise |
| 43 | */ |
| 44 | static inline bool wlan_ipa_uc_is_enabled(struct wlan_ipa_config *ipa_cfg) |
| 45 | { |
| 46 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_UC_ENABLE_MASK); |
| 47 | } |
| 48 | |
| 49 | /** |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 50 | * wlan_ipa_is_rt_debugging_enabled() - Is IPA RT debugging enabled? |
| 51 | * @ipa_cfg: IPA config |
| 52 | * |
| 53 | * Return: true if IPA RT debugging is enabled, false otherwise |
| 54 | */ |
| 55 | static inline |
| 56 | bool wlan_ipa_is_rt_debugging_enabled(struct wlan_ipa_config *ipa_cfg) |
| 57 | { |
| 58 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, |
| 59 | WLAN_IPA_REAL_TIME_DEBUGGING); |
| 60 | } |
| 61 | |
| 62 | /** |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 63 | * wlan_ipa_setup - IPA initialize and setup |
| 64 | * @ipa_ctx: IPA priv obj |
| 65 | * @ipa_cfg: IPA config |
| 66 | * |
| 67 | * Return: QDF_STATUS |
| 68 | */ |
| 69 | QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx, |
| 70 | struct wlan_ipa_config *ipa_cfg); |
| 71 | |
| 72 | /** |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 73 | * wlan_ipa_get_obj_context - Get IPA OBJ context |
| 74 | * |
| 75 | * Return: IPA context |
| 76 | */ |
| 77 | struct wlan_ipa_priv *wlan_ipa_get_obj_context(void); |
| 78 | |
| 79 | /** |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 80 | * wlan_ipa_cleanup - IPA cleanup |
| 81 | * @ipa_ctx: IPA priv obj |
| 82 | * |
| 83 | * Return: QDF_STATUS |
| 84 | */ |
| 85 | QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx); |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * wlan_ipa_uc_enable_pipes() - Enable IPA uC pipes |
| 89 | * @ipa_ctx: IPA context |
| 90 | * |
| 91 | * Return: QDF_STATUS |
| 92 | */ |
| 93 | QDF_STATUS wlan_ipa_uc_enable_pipes(struct wlan_ipa_priv *ipa_ctx); |
| 94 | |
| 95 | /** |
| 96 | * wlan_ipa_uc_disable_pipes() - Disable IPA uC pipes |
| 97 | * @ipa_ctx: IPA context |
| 98 | * |
| 99 | * Return: QDF_STATUS |
| 100 | */ |
| 101 | QDF_STATUS wlan_ipa_uc_disable_pipes(struct wlan_ipa_priv *ipa_ctx); |
| 102 | |
Sravan Kumar Kairam | 9e99e9a | 2018-03-12 19:09:45 +0530 | [diff] [blame] | 103 | /** |
Sravan Kumar Kairam | c056d99 | 2018-03-22 12:35:37 +0530 | [diff] [blame] | 104 | * wlan_ipa_set_perf_level() - Set IPA performance level |
| 105 | * @ipa_ctx: IPA context |
| 106 | * @tx_packets: Number of packets transmitted in the last sample period |
| 107 | * @rx_packets: Number of packets received in the last sample period |
| 108 | * |
| 109 | * Return: QDF STATUS |
| 110 | */ |
| 111 | QDF_STATUS wlan_ipa_set_perf_level(struct wlan_ipa_priv *ipa_ctx, |
| 112 | uint64_t tx_packets, uint64_t rx_packets); |
| 113 | |
| 114 | /** |
jiad | f977118 | 2018-06-12 12:43:40 +0800 | [diff] [blame] | 115 | * wlan_ipa_init_perf_level() - Initialize IPA performance level |
| 116 | * @ipa_ctx: IPA context |
| 117 | * |
| 118 | * If IPA clock scaling is disabled, initialize perf level to maximum. |
| 119 | * Else set the lowest level to start with. |
| 120 | * |
| 121 | * Return: QDF STATUS |
| 122 | */ |
| 123 | QDF_STATUS wlan_ipa_init_perf_level(struct wlan_ipa_priv *ipa_ctx); |
| 124 | |
| 125 | /** |
Sravan Kumar Kairam | fbc87b7 | 2018-04-09 14:09:52 +0530 | [diff] [blame] | 126 | * wlan_ipa_get_iface() - Get IPA interface |
| 127 | * @ipa_ctx: IPA context |
| 128 | * @mode: Interface device mode |
| 129 | * |
| 130 | * Return: IPA interface address |
| 131 | */ |
| 132 | struct wlan_ipa_iface_context |
| 133 | *wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode); |
| 134 | |
| 135 | #ifndef CONFIG_IPA_WDI_UNIFIED_API |
jiad | ad913c7 | 2018-06-12 10:48:07 +0800 | [diff] [blame] | 136 | |
| 137 | /** |
jiad | 9d613a2 | 2018-11-09 13:45:54 +0800 | [diff] [blame] | 138 | * wlan_ipa_is_rm_enabled() - Is IPA RM enabled? |
| 139 | * @ipa_cfg: IPA config |
| 140 | * |
| 141 | * Return: true if IPA RM is enabled, false otherwise |
| 142 | */ |
| 143 | static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg) |
| 144 | { |
| 145 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_RM_ENABLE_MASK); |
| 146 | } |
| 147 | |
| 148 | /** |
jiad | ad913c7 | 2018-06-12 10:48:07 +0800 | [diff] [blame] | 149 | * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled? |
| 150 | * @ipa_cfg: IPA config |
| 151 | * |
| 152 | * Return: true if IPA clock scaling is enabled, false otherwise |
| 153 | */ |
| 154 | static inline |
| 155 | bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg) |
| 156 | { |
| 157 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, |
| 158 | WLAN_IPA_CLK_SCALING_ENABLE_MASK | |
| 159 | WLAN_IPA_RM_ENABLE_MASK); |
| 160 | } |
| 161 | |
Sravan Kumar Kairam | fbc87b7 | 2018-04-09 14:09:52 +0530 | [diff] [blame] | 162 | /** |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 163 | * wlan_ipa_wdi_rm_request_resource() - IPA WDI request resource |
| 164 | * @ipa_ctx: IPA context |
| 165 | * @res_name: IPA RM resource name |
| 166 | * |
| 167 | * Return: 0 on success, negative errno on error |
| 168 | */ |
| 169 | static inline |
| 170 | int wlan_ipa_wdi_rm_request_resource(struct wlan_ipa_priv *ipa_ctx, |
| 171 | qdf_ipa_rm_resource_name_t res_name) |
| 172 | { |
| 173 | return qdf_ipa_rm_request_resource(res_name); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * wlan_ipa_wdi_rm_release_resource() - IPA WDI release resource |
| 178 | * @ipa_ctx: IPA context |
| 179 | * @res_name: IPA RM resource name |
| 180 | * |
| 181 | * Return: 0 on success, negative errno on error |
| 182 | */ |
| 183 | static inline |
| 184 | int wlan_ipa_wdi_rm_release_resource(struct wlan_ipa_priv *ipa_ctx, |
| 185 | qdf_ipa_rm_resource_name_t res_name) |
| 186 | { |
| 187 | return qdf_ipa_rm_release_resource(res_name); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * wlan_ipa_wdi_rm_request() - Request resource from IPA |
| 192 | * @ipa_ctx: IPA context |
| 193 | * |
| 194 | * Return: QDF_STATUS |
| 195 | */ |
| 196 | QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx); |
| 197 | |
| 198 | /** |
| 199 | * wlan_ipa_wdi_rm_try_release() - Attempt to release IPA resource |
| 200 | * @ipa_ctx: IPA context |
| 201 | * |
| 202 | * Return: QDF_STATUS |
| 203 | */ |
| 204 | QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv *ipa_ctx); |
| 205 | |
| 206 | /** |
| 207 | * wlan_ipa_wdi_setup_rm() - Setup IPA resource management |
| 208 | * @ipa_ctx: IPA context |
| 209 | * |
| 210 | * Return: QDF_STATUS |
| 211 | */ |
| 212 | QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx); |
| 213 | |
| 214 | /** |
| 215 | * wlan_ipa_wdi_destroy_rm() - Destroy IPA resources |
| 216 | * @ipa_ctx: IPA context |
| 217 | * |
| 218 | * Destroys all resources associated with the IPA resource manager |
| 219 | * |
| 220 | * Return: None |
| 221 | */ |
| 222 | void wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx); |
| 223 | |
Yun Park | e114fbf | 2018-04-05 20:02:12 -0700 | [diff] [blame] | 224 | static inline |
| 225 | int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event, |
| 226 | qdf_ipa_rm_resource_name_t res_name) |
| 227 | { |
| 228 | return qdf_ipa_rm_notify_completion(event, res_name); |
| 229 | } |
| 230 | |
| 231 | static inline |
| 232 | int wlan_ipa_wdi_rm_inactivity_timer_destroy( |
| 233 | qdf_ipa_rm_resource_name_t res_name) |
| 234 | { |
| 235 | return qdf_ipa_rm_inactivity_timer_destroy(res_name); |
| 236 | } |
| 237 | |
Yun Park | e74e609 | 2018-04-27 11:36:34 -0700 | [diff] [blame] | 238 | bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx); |
| 239 | |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 240 | #else /* CONFIG_IPA_WDI_UNIFIED_API */ |
| 241 | |
jiad | ad913c7 | 2018-06-12 10:48:07 +0800 | [diff] [blame] | 242 | /** |
jiad | 9d613a2 | 2018-11-09 13:45:54 +0800 | [diff] [blame] | 243 | * wlan_ipa_is_rm_enabled() - Is IPA RM enabled? |
| 244 | * @ipa_cfg: IPA config |
| 245 | * |
| 246 | * IPA RM is deprecated and IPA PM is involved. WLAN driver |
| 247 | * has no control over IPA PM and thus we could regard IPA |
| 248 | * RM as always enabled for power efficiency. |
| 249 | * |
| 250 | * Return: true |
| 251 | */ |
| 252 | static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg) |
| 253 | { |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | /** |
jiad | ad913c7 | 2018-06-12 10:48:07 +0800 | [diff] [blame] | 258 | * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled? |
| 259 | * @ipa_cfg: IPA config |
| 260 | * |
| 261 | * Return: true if IPA clock scaling is enabled, false otherwise |
| 262 | */ |
| 263 | static inline |
| 264 | bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg) |
| 265 | { |
| 266 | return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, |
| 267 | WLAN_IPA_CLK_SCALING_ENABLE_MASK); |
| 268 | } |
| 269 | |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 270 | static inline int wlan_ipa_wdi_rm_request_resource( |
| 271 | struct wlan_ipa_priv *ipa_ctx, |
| 272 | qdf_ipa_rm_resource_name_t res_name) |
| 273 | { |
| 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | static inline int wlan_ipa_wdi_rm_release_resource( |
| 278 | struct wlan_ipa_priv *ipa_ctx, |
| 279 | qdf_ipa_rm_resource_name_t res_name) |
| 280 | { |
| 281 | return 0; |
| 282 | } |
| 283 | |
| 284 | static inline QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx) |
| 285 | { |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | static inline int wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx) |
| 290 | { |
| 291 | return 0; |
| 292 | } |
| 293 | |
| 294 | static inline QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx) |
| 295 | { |
| 296 | return QDF_STATUS_SUCCESS; |
| 297 | } |
| 298 | |
| 299 | static inline QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv |
| 300 | *ipa_ctx) |
| 301 | { |
| 302 | return QDF_STATUS_SUCCESS; |
| 303 | } |
| 304 | |
Yun Park | e114fbf | 2018-04-05 20:02:12 -0700 | [diff] [blame] | 305 | static inline |
| 306 | int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event, |
| 307 | qdf_ipa_rm_resource_name_t res_name) |
| 308 | { |
| 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | static inline |
| 313 | int wlan_ipa_wdi_rm_inactivity_timer_destroy( |
| 314 | qdf_ipa_rm_resource_name_t res_name) |
| 315 | { |
| 316 | return 0; |
| 317 | } |
| 318 | |
Yun Park | e74e609 | 2018-04-27 11:36:34 -0700 | [diff] [blame] | 319 | static inline |
| 320 | bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx) |
| 321 | { |
| 322 | return true; |
| 323 | } |
| 324 | |
Sravan Kumar Kairam | 2e7aae9 | 2018-03-06 19:32:49 +0530 | [diff] [blame] | 325 | #endif /* CONFIG_IPA_WDI_UNIFIED_API */ |
| 326 | |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 327 | #ifdef FEATURE_METERING |
| 328 | |
Sravan Kumar Kairam | 3bc886d | 2019-08-22 23:46:27 +0530 | [diff] [blame^] | 329 | #ifndef WDI3_STATS_UPDATE |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 330 | /** |
| 331 | * wlan_ipa_uc_op_metering() - IPA uC operation for stats and quota limit |
| 332 | * @ipa_ctx: IPA context |
| 333 | * @op_msg: operation message received from firmware |
| 334 | * |
| 335 | * Return: QDF_STATUS enumeration |
| 336 | */ |
| 337 | QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, |
Sravan Kumar Kairam | 3bc886d | 2019-08-22 23:46:27 +0530 | [diff] [blame^] | 338 | struct op_msg_type *op_msg); |
| 339 | #else |
| 340 | static inline |
| 341 | QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, |
| 342 | struct op_msg_type *op_msg) |
| 343 | { |
| 344 | return QDF_STATUS_SUCCESS; |
| 345 | } |
| 346 | #endif |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 347 | |
| 348 | /** |
jitiphil | fdcaaba | 2018-09-03 16:19:52 +0530 | [diff] [blame] | 349 | * wlan_ipa_wdi_meter_notifier_cb() - SSR wrapper for |
| 350 | * __wlan_ipa_wdi_meter_notifier_cb |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 351 | * @priv: pointer to private data registered with IPA (we register a |
| 352 | * pointer to the global IPA context) |
| 353 | * @evt: the IPA event which triggered the callback |
| 354 | * @data: data associated with the event |
| 355 | * |
| 356 | * Return: None |
| 357 | */ |
| 358 | void wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt, |
jitiphil | fdcaaba | 2018-09-03 16:19:52 +0530 | [diff] [blame] | 359 | void *data); |
Sravan Kumar Kairam | 1309e7e | 2018-03-13 09:29:52 +0530 | [diff] [blame] | 360 | |
| 361 | /** |
| 362 | * wlan_ipa_init_metering() - IPA metering stats completion event reset |
| 363 | * @ipa_ctx: IPA context |
| 364 | * |
| 365 | * Return: QDF_STATUS enumeration |
| 366 | */ |
| 367 | void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx); |
Sravan Kumar Kairam | 3bc886d | 2019-08-22 23:46:27 +0530 | [diff] [blame^] | 368 | |
| 369 | #ifdef WDI3_STATS_UPDATE |
| 370 | /** |
| 371 | * wlan_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA |
| 372 | * @ipa_ctx: IPA context |
| 373 | * @sta_tx: tx in bytes on sta interface |
| 374 | * @sap_tx: tx in bytes on sap interface |
| 375 | * |
| 376 | * Return: void |
| 377 | */ |
| 378 | void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, uint64_t sta_tx, |
| 379 | uint64_t sap_tx); |
| 380 | #else |
| 381 | static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, |
| 382 | uint64_t sta_tx, uint64_t sap_tx) |
| 383 | { |
| 384 | } |
| 385 | #endif /* WDI3_STATS_UPDATE */ |
| 386 | |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 387 | #else |
| 388 | |
| 389 | static inline |
| 390 | QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx, |
| 391 | struct op_msg_type *op_msg) |
| 392 | { |
| 393 | return QDF_STATUS_SUCCESS; |
| 394 | } |
| 395 | |
| 396 | static inline void wlan_ipa_wdi_meter_notifier_cb(void) |
| 397 | { |
| 398 | } |
Sravan Kumar Kairam | 1309e7e | 2018-03-13 09:29:52 +0530 | [diff] [blame] | 399 | |
| 400 | static inline void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx) |
| 401 | { |
| 402 | } |
Sravan Kumar Kairam | 3bc886d | 2019-08-22 23:46:27 +0530 | [diff] [blame^] | 403 | |
| 404 | static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, |
| 405 | uint64_t sta_tx, uint64_t sap_tx) |
| 406 | { |
| 407 | } |
Sravan Kumar Kairam | 271fab2 | 2018-03-07 18:57:41 +0530 | [diff] [blame] | 408 | #endif /* FEATURE_METERING */ |
| 409 | |
| 410 | /** |
| 411 | * wlan_ipa_uc_stat() - Print IPA uC stats |
| 412 | * @ipa_ctx: IPA context |
| 413 | * |
| 414 | * Return: None |
| 415 | */ |
| 416 | void wlan_ipa_uc_stat(struct wlan_ipa_priv *ipa_ctx); |
| 417 | |
| 418 | /** |
| 419 | * wlan_ipa_uc_info() - Print IPA uC resource and session information |
| 420 | * @ipa_ctx: IPA context |
| 421 | * |
| 422 | * Return: None |
| 423 | */ |
| 424 | void wlan_ipa_uc_info(struct wlan_ipa_priv *ipa_ctx); |
| 425 | |
| 426 | /** |
| 427 | * wlan_ipa_print_fw_wdi_stats() - Print FW IPA WDI stats |
| 428 | * @ipa_ctx: IPA context |
| 429 | * |
| 430 | * Return: None |
| 431 | */ |
| 432 | void wlan_ipa_print_fw_wdi_stats(struct wlan_ipa_priv *ipa_ctx, |
| 433 | struct ipa_uc_fw_stats *uc_fw_stat); |
| 434 | |
| 435 | /** |
| 436 | * wlan_ipa_uc_stat_request() - Get IPA stats from IPA |
| 437 | * @ipa_ctx: IPA context |
| 438 | * @reason: STAT REQ Reason |
| 439 | * |
| 440 | * Return: None |
| 441 | */ |
| 442 | void wlan_ipa_uc_stat_request(struct wlan_ipa_priv *ipa_ctx, uint8_t reason); |
| 443 | |
| 444 | /** |
| 445 | * wlan_ipa_uc_stat_query() - Query the IPA stats |
| 446 | * @ipa_ctx: IPA context |
| 447 | * @ipa_tx_diff: tx packet count diff from previous tx packet count |
| 448 | * @ipa_rx_diff: rx packet count diff from previous rx packet count |
| 449 | * |
| 450 | * Return: None |
| 451 | */ |
| 452 | void wlan_ipa_uc_stat_query(struct wlan_ipa_priv *ipa_ctx, |
| 453 | uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff); |
| 454 | |
| 455 | /** |
| 456 | * wlan_ipa_dump_info() - dump IPA IPA struct |
| 457 | * @ipa_ctx: IPA context |
| 458 | * |
| 459 | * Dump entire struct ipa_ctx |
| 460 | * |
| 461 | * Return: none |
| 462 | */ |
| 463 | void wlan_ipa_dump_info(struct wlan_ipa_priv *ipa_ctx); |
| 464 | |
| 465 | /** |
| 466 | * wlan_ipa_uc_rt_debug_host_dump - dump rt debug buffer |
| 467 | * @ipa_ctx: IPA context |
| 468 | * |
| 469 | * If rt debug enabled, dump debug buffer contents based on requirement |
| 470 | * |
| 471 | * Return: none |
| 472 | */ |
| 473 | void wlan_ipa_uc_rt_debug_host_dump(struct wlan_ipa_priv *ipa_ctx); |
| 474 | |
| 475 | /** |
| 476 | * wlan_ipa_uc_rt_debug_destructor() - called by data packet free |
| 477 | * @nbuff: packet pinter |
| 478 | * |
| 479 | * when free data packet, will be invoked by wlan client and will increase |
| 480 | * free counter |
| 481 | * |
| 482 | * Return: none |
| 483 | */ |
| 484 | void wlan_ipa_uc_rt_debug_destructor(qdf_nbuf_t nbuff); |
| 485 | |
| 486 | /** |
| 487 | * wlan_ipa_uc_rt_debug_deinit() - remove resources to handle rt debugging |
| 488 | * @ipa_ctx: IPA context |
| 489 | * |
| 490 | * free all rt debugging resources |
| 491 | * |
| 492 | * Return: none |
| 493 | */ |
| 494 | void wlan_ipa_uc_rt_debug_deinit(struct wlan_ipa_priv *ipa_ctx); |
| 495 | |
| 496 | /** |
| 497 | * wlan_ipa_uc_rt_debug_init() - initialize resources to handle rt debugging |
| 498 | * @ipa_ctx: IPA context |
| 499 | * |
| 500 | * alloc and initialize all rt debugging resources |
| 501 | * |
| 502 | * Return: none |
| 503 | */ |
| 504 | void wlan_ipa_uc_rt_debug_init(struct wlan_ipa_priv *ipa_ctx); |
| 505 | |
Sravan Kumar Kairam | 858073b | 2018-03-13 09:03:32 +0530 | [diff] [blame] | 506 | /** |
| 507 | * wlan_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit |
| 508 | * @ipa_ctx: IPA context |
| 509 | * @cb: callback |
| 510 | * |
| 511 | * Return: None |
| 512 | */ |
| 513 | static inline |
Vevek Venkatesan | 78f7f09 | 2019-05-23 17:16:28 +0530 | [diff] [blame] | 514 | void wlan_ipa_reg_sap_xmit_cb(struct wlan_ipa_priv *ipa_ctx, |
| 515 | wlan_ipa_softap_xmit cb) |
Sravan Kumar Kairam | 858073b | 2018-03-13 09:03:32 +0530 | [diff] [blame] | 516 | { |
| 517 | ipa_ctx->softap_xmit = cb; |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * wlan_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network |
| 522 | * @ipa_ctx: IPA context |
| 523 | * @cb: callback |
| 524 | * |
| 525 | * Return: None |
| 526 | */ |
| 527 | static inline |
Vevek Venkatesan | 3b6be82 | 2019-05-28 18:19:15 +0530 | [diff] [blame] | 528 | void wlan_ipa_reg_send_to_nw_cb(struct wlan_ipa_priv *ipa_ctx, |
| 529 | wlan_ipa_send_to_nw cb) |
Sravan Kumar Kairam | 858073b | 2018-03-13 09:03:32 +0530 | [diff] [blame] | 530 | { |
| 531 | ipa_ctx->send_to_nw = cb; |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * wlan_ipa_set_mcc_mode() - Set MCC mode |
| 536 | * @ipa_ctx: IPA context |
jiad | bb47e13 | 2018-03-30 16:28:30 +0800 | [diff] [blame] | 537 | * @mcc_mode: 1=MCC/0=SCC |
Sravan Kumar Kairam | 858073b | 2018-03-13 09:03:32 +0530 | [diff] [blame] | 538 | * |
| 539 | * Return: void |
| 540 | */ |
jiad | bb47e13 | 2018-03-30 16:28:30 +0800 | [diff] [blame] | 541 | void wlan_ipa_set_mcc_mode(struct wlan_ipa_priv *ipa_ctx, bool mcc_mode); |
Sravan Kumar Kairam | 858073b | 2018-03-13 09:03:32 +0530 | [diff] [blame] | 542 | |
| 543 | /** |
| 544 | * wlan_ipa_set_dfs_cac_tx() - Set DFS cac tx block |
| 545 | * @ipa_ctx: IPA context |
| 546 | * @tx_block: dfs cac tx block |
| 547 | * |
| 548 | * Return: void |
| 549 | */ |
| 550 | static inline |
| 551 | void wlan_ipa_set_dfs_cac_tx(struct wlan_ipa_priv *ipa_ctx, bool tx_block) |
| 552 | { |
| 553 | ipa_ctx->dfs_cac_block_tx = tx_block; |
| 554 | } |
| 555 | |
| 556 | /** |
| 557 | * wlan_ipa_set_ap_ibss_fwd() - Set AP intra bss forward |
| 558 | * @ipa_ctx: IPA context |
| 559 | * @intra_bss: enable or disable ap intra bss forward |
| 560 | * |
| 561 | * Return: void |
| 562 | */ |
| 563 | static inline |
| 564 | void wlan_ipa_set_ap_ibss_fwd(struct wlan_ipa_priv *ipa_ctx, bool intra_bss) |
| 565 | { |
| 566 | ipa_ctx->ap_intrabss_fwd = intra_bss; |
| 567 | } |
| 568 | |
Sravan Kumar Kairam | 1309e7e | 2018-03-13 09:29:52 +0530 | [diff] [blame] | 569 | /** |
| 570 | * wlan_ipa_uc_ol_init() - Initialize IPA uC offload |
| 571 | * @ipa_ctx: IPA context |
| 572 | * @osdev: Parent device instance |
| 573 | * |
| 574 | * This function is called to update IPA pipe configuration with resources |
| 575 | * allocated by wlan driver (cds_pre_enable) before enabling it in FW |
| 576 | * |
| 577 | * Return: QDF_STATUS |
| 578 | */ |
| 579 | QDF_STATUS wlan_ipa_uc_ol_init(struct wlan_ipa_priv *ipa_ctx, |
| 580 | qdf_device_t osdev); |
| 581 | |
| 582 | /** |
| 583 | * wlan_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes |
| 584 | * @ipa_ctx: IPA context |
| 585 | * |
| 586 | * Return: QDF_STATUS |
| 587 | */ |
| 588 | QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx); |
| 589 | |
| 590 | /** |
| 591 | * wlan_ipa_flush() - flush IPA exception path SKB's |
| 592 | * @ipa_ctx: IPA context |
| 593 | * |
| 594 | * Return: None |
| 595 | */ |
| 596 | void wlan_ipa_flush(struct wlan_ipa_priv *ipa_ctx); |
| 597 | |
| 598 | /** |
| 599 | * wlan_ipa_suspend() - Suspend IPA |
| 600 | * @ipa_ctx: IPA context |
| 601 | * |
| 602 | * Return: QDF STATUS |
| 603 | */ |
| 604 | QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx); |
| 605 | |
| 606 | /** |
| 607 | * wlan_ipa_resume() - Resume IPA |
| 608 | * @ipa_ctx: IPA context |
| 609 | * |
| 610 | * Return: QDF STATUS |
| 611 | */ |
| 612 | QDF_STATUS wlan_ipa_resume(struct wlan_ipa_priv *ipa_ctx); |
| 613 | |
Sravan Kumar Kairam | 7d931ff | 2018-03-13 09:42:02 +0530 | [diff] [blame] | 614 | #ifndef QCA_LL_TX_FLOW_CONTROL_V2 |
| 615 | /** |
| 616 | * wlan_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message |
| 617 | * @ipa_ctx: IPA context |
| 618 | * @mcc_mode: 0=MCC/1=SCC |
| 619 | * |
| 620 | * Return: QDF STATUS |
| 621 | */ |
| 622 | QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx, |
| 623 | bool mcc_mode); |
| 624 | #else |
| 625 | static inline |
| 626 | QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx, |
| 627 | bool mcc_mode) |
| 628 | { |
| 629 | return QDF_STATUS_SUCCESS; |
| 630 | } |
jiad | bb47e13 | 2018-03-30 16:28:30 +0800 | [diff] [blame] | 631 | |
| 632 | static inline void wlan_ipa_mcc_work_handler(void *data) |
| 633 | { |
| 634 | } |
Sravan Kumar Kairam | 7d931ff | 2018-03-13 09:42:02 +0530 | [diff] [blame] | 635 | #endif |
| 636 | |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 637 | /** |
| 638 | * wlan_ipa_wlan_evt() - IPA event handler |
| 639 | * @net_dev: Interface net device |
| 640 | * @device_mode: Net interface device mode |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 641 | * @session_id: session id for the event |
| 642 | * @type: event enum of type ipa_wlan_event |
| 643 | * @mac_address: MAC address associated with the event |
| 644 | * |
| 645 | * Return: QDF_STATUS |
| 646 | */ |
| 647 | QDF_STATUS wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, |
Rakshith Suresh Patkar | 96703f6 | 2019-08-06 14:34:36 +0530 | [diff] [blame] | 648 | uint8_t session_id, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 649 | enum wlan_ipa_wlan_event ipa_event_type, |
| 650 | uint8_t *mac_addr); |
| 651 | |
Sravan Kumar Kairam | 983a445 | 2018-03-20 13:30:22 +0530 | [diff] [blame] | 652 | /** |
| 653 | * wlan_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC |
| 654 | * @map: Map / unmap operation |
| 655 | * @num_buf: Number of buffers in array |
| 656 | * @buf_arr: Buffer array of DMA mem mapping info |
| 657 | * |
| 658 | * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation |
| 659 | * is enabled. |
| 660 | * |
| 661 | * Return: Status of map operation |
| 662 | */ |
| 663 | int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr); |
| 664 | |
Yun Park | a29974a | 2018-04-09 12:05:49 -0700 | [diff] [blame] | 665 | /** |
| 666 | * wlan_ipa_is_fw_wdi_activated() - Is FW WDI actived? |
| 667 | * @ipa_ctx: IPA contex |
| 668 | * |
| 669 | * Return: true if FW WDI actived, false otherwise |
| 670 | */ |
| 671 | bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx); |
Sravan Kumar Kairam | ce792eb | 2018-06-15 15:07:11 +0530 | [diff] [blame] | 672 | |
| 673 | /** |
Vevek Venkatesan | e81bca8 | 2019-08-12 22:25:15 +0530 | [diff] [blame] | 674 | * wlan_ipa_uc_cleanup_sta - disconnect and cleanup sta iface |
| 675 | * @ipa_ctx: IPA context |
| 676 | * @net_dev: Interface net device |
| 677 | * |
| 678 | * Send disconnect sta event to IPA driver and cleanup IPA iface |
| 679 | * if not yet done |
| 680 | * |
| 681 | * Return: void |
| 682 | */ |
| 683 | void wlan_ipa_uc_cleanup_sta(struct wlan_ipa_priv *ipa_ctx, |
| 684 | qdf_netdev_t net_dev); |
| 685 | |
| 686 | /** |
Sravan Kumar Kairam | ce792eb | 2018-06-15 15:07:11 +0530 | [diff] [blame] | 687 | * wlan_ipa_uc_disconnect_ap() - send ap disconnect event |
| 688 | * @ipa_ctx: IPA context |
| 689 | * @net_dev: Interface net device |
| 690 | * |
| 691 | * Send disconnect ap event to IPA driver |
| 692 | * |
| 693 | * Return: QDF_STATUS |
| 694 | */ |
| 695 | QDF_STATUS wlan_ipa_uc_disconnect_ap(struct wlan_ipa_priv *ipa_ctx, |
| 696 | qdf_netdev_t net_dev); |
| 697 | |
| 698 | /** |
| 699 | * wlan_ipa_cleanup_dev_iface() - Clean up net dev IPA interface |
| 700 | * @ipa_ctx: IPA context |
| 701 | * @net_dev: Interface net device |
| 702 | * |
| 703 | * Return: None |
| 704 | */ |
| 705 | void wlan_ipa_cleanup_dev_iface(struct wlan_ipa_priv *ipa_ctx, |
| 706 | qdf_netdev_t net_dev); |
Sravan Kumar Kairam | 657f89e | 2018-09-18 10:13:37 +0530 | [diff] [blame] | 707 | |
| 708 | /** |
| 709 | * wlan_ipa_uc_ssr_cleanup() - handle IPA UC clean up during SSR |
| 710 | * @ipa_ctx: IPA context |
| 711 | * |
| 712 | * Return: None |
| 713 | */ |
| 714 | void wlan_ipa_uc_ssr_cleanup(struct wlan_ipa_priv *ipa_ctx); |
jitiphil | 0e3b592 | 2018-07-24 18:43:50 +0530 | [diff] [blame] | 715 | |
| 716 | /** |
| 717 | * wlan_ipa_fw_rejuvenate_send_msg() - send fw rejuvenate message to IPA driver |
| 718 | * @ipa_ctx: IPA context |
| 719 | * |
| 720 | * Return: void |
| 721 | */ |
| 722 | void wlan_ipa_fw_rejuvenate_send_msg(struct wlan_ipa_priv *ipa_ctx); |
| 723 | |
Sravan Kumar Kairam | d01b445 | 2018-03-07 17:37:09 +0530 | [diff] [blame] | 724 | #endif /* IPA_OFFLOAD */ |
| 725 | #endif /* _WLAN_IPA_CORE_H_ */ |