Poddar, Siddarth | 3487278 | 2017-08-10 14:08:51 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 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: wlan_hdd_data_stall_detection.c |
| 21 | * |
| 22 | * WLAN Host Device Driver Data Stall detection API implementation |
| 23 | */ |
| 24 | |
| 25 | #include "wlan_hdd_data_stall_detection.h" |
| 26 | #include "cdp_txrx_cmn.h" |
| 27 | #include "cdp_txrx_misc.h" |
| 28 | #include "ol_txrx_types.h" |
| 29 | |
Poddar, Siddarth | 1b27cd0 | 2017-09-04 15:46:43 +0530 | [diff] [blame] | 30 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 31 | |
| 32 | /** |
| 33 | * hdd_data_stall_send_event()- send data stall information |
| 34 | * @reason: data stall event subtype |
| 35 | * This Function sends data stall status diag event |
| 36 | * |
| 37 | * Return: void. |
| 38 | */ |
| 39 | static void hdd_data_stall_send_event(uint32_t reason) |
| 40 | { |
| 41 | WLAN_HOST_DIAG_EVENT_DEF(sta_data_stall, |
| 42 | struct host_event_wlan_datastall); |
| 43 | qdf_mem_zero(&sta_data_stall, sizeof(sta_data_stall)); |
| 44 | sta_data_stall.reason = reason; |
| 45 | WLAN_HOST_DIAG_EVENT_REPORT(&sta_data_stall, EVENT_WLAN_STA_DATASTALL); |
| 46 | } |
| 47 | #else |
| 48 | static inline void hdd_data_stall_send_event(uint32_t reason) |
| 49 | { |
| 50 | } |
| 51 | #endif |
| 52 | |
Poddar, Siddarth | 3487278 | 2017-08-10 14:08:51 +0530 | [diff] [blame] | 53 | /** |
| 54 | * hdd_data_stall_process_cb() - Process data stall message |
| 55 | * @message: data stall message |
| 56 | * |
| 57 | * Process data stall message |
| 58 | * |
| 59 | * Return: void |
| 60 | */ |
| 61 | static void hdd_data_stall_process_cb( |
| 62 | struct data_stall_event_info *data_stall_info) |
| 63 | { |
Poddar, Siddarth | 1b27cd0 | 2017-09-04 15:46:43 +0530 | [diff] [blame] | 64 | hdd_data_stall_send_event(data_stall_info->data_stall_type); |
Poddar, Siddarth | 3487278 | 2017-08-10 14:08:51 +0530 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | int hdd_register_data_stall_detect_cb(void) |
| 68 | { |
| 69 | QDF_STATUS status; |
| 70 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 71 | |
| 72 | /* Register the data stall callback */ |
| 73 | status = cdp_data_stall_cb_register(soc, hdd_data_stall_process_cb); |
| 74 | return qdf_status_to_os_return(status); |
| 75 | } |
| 76 | |
| 77 | int hdd_deregister_data_stall_detect_cb(void) |
| 78 | { |
| 79 | QDF_STATUS status; |
| 80 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 81 | |
| 82 | /* De-Register the data stall callback */ |
| 83 | status = cdp_data_stall_cb_deregister(soc, hdd_data_stall_process_cb); |
| 84 | return qdf_status_to_os_return(status); |
| 85 | } |