From 87ef1a93d35016feb60ff0edbf181da66e13711d Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Tue, 14 Feb 2017 15:49:14 -0800 Subject: qcacld-3.0: Move wma log flush event registration to wma_open wma flush log event handler is registered during wma_start which is not done until interface is up. This leads to excessive logging from WMI layer because event handler is not registered. Move wma flush log event handler registration to wma_open such that after driver load FW log flush events are handled properly. Change-Id: I5a76bbc7d53dacfd2c9bf7f15b73b46e0df85289 CRs-Fixed: 2006818 --- core/wma/src/wma_main.c | 150 +++++++++++++++++++++++------------------------- 1 file changed, 72 insertions(+), 78 deletions(-) diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 4524a95c81f5..461b9b51d00e 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -1903,6 +1903,73 @@ static void wma_register_debug_callback(void) qdf_register_debug_callback(QDF_MODULE_ID_WMA, &wma_state_info_dump); } +/** + * wma_flush_complete_evt_handler() - FW log flush complete event handler + * @handle: WMI handle + * @event: Event recevied from FW + * @len: Length of the event + * + */ +static int wma_flush_complete_evt_handler(void *handle, + u_int8_t *event, + u_int32_t len) +{ + QDF_STATUS status; + tp_wma_handle wma = (tp_wma_handle) handle; + + WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *param_buf; + wmi_debug_mesg_flush_complete_fixed_param *wmi_event; + uint32_t reason_code; + + param_buf = (WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *) event; + if (!param_buf) { + WMA_LOGE("Invalid log flush complete event buffer"); + return QDF_STATUS_E_FAILURE; + } + + wmi_event = param_buf->fixed_param; + reason_code = wmi_event->reserved0; + + /* + * reason_code = 0; Flush event in response to flush command + * reason_code = other value; Asynchronous flush event for fatal events + */ + if (!reason_code && (cds_is_log_report_in_progress() == false)) { + WMA_LOGE("Received WMI flush event without sending CMD"); + return -EINVAL; + } else if (!reason_code && cds_is_log_report_in_progress() == true) { + /* Flush event in response to flush command */ + WMA_LOGI("Received WMI flush event in response to flush CMD"); + status = qdf_mc_timer_stop(&wma->log_completion_timer); + if (status != QDF_STATUS_SUCCESS) + WMA_LOGE("Failed to stop the log completion timeout"); + cds_logging_set_fw_flush_complete(); + } else if (reason_code && cds_is_log_report_in_progress() == false) { + /* Asynchronous flush event for fatal events */ + WMA_LOGE("Received asynchronous WMI flush event: reason=%d", + reason_code); + status = cds_set_log_completion(WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_FIRMWARE, + reason_code, false); + if (QDF_STATUS_SUCCESS != status) { + WMA_LOGE("%s: Failed to set log trigger params", + __func__); + return QDF_STATUS_E_FAILURE; + } + cds_logging_set_fw_flush_complete(); + return status; + } else { + /* Asynchronous flush event for fatal event, + * but, report in progress already + */ + WMA_LOGI("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", + __func__, WLAN_LOG_TYPE_FATAL, + WLAN_LOG_INDICATOR_FIRMWARE, reason_code); + return QDF_STATUS_E_FAILURE; + } + return 0; +} + /** * wma_open() - Allocate wma context and initialize it. * @cds_context: cds context @@ -2407,6 +2474,11 @@ QDF_STATUS wma_open(void *cds_context, WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID, wma_encrypt_decrypt_msg_handler, WMA_RX_SERIALIZER_CTX); + wmi_unified_register_event_handler(wma_handle->wmi_handle, + WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID, + wma_flush_complete_evt_handler, + WMA_RX_SERIALIZER_CTX); + wma_ndp_register_all_event_handlers(wma_handle); wma_register_debug_callback(); @@ -2583,73 +2655,6 @@ static int wma_log_supported_evt_handler(void *handle, return 0; } -/** - * wma_flush_complete_evt_handler() - FW log flush complete event handler - * @handle: WMI handle - * @event: Event recevied from FW - * @len: Length of the event - * - */ -static int wma_flush_complete_evt_handler(void *handle, - u_int8_t *event, - u_int32_t len) -{ - QDF_STATUS status; - tp_wma_handle wma = (tp_wma_handle) handle; - - WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *param_buf; - wmi_debug_mesg_flush_complete_fixed_param *wmi_event; - uint32_t reason_code; - - param_buf = (WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID_param_tlvs *) event; - if (!param_buf) { - WMA_LOGE("Invalid log flush complete event buffer"); - return QDF_STATUS_E_FAILURE; - } - - wmi_event = param_buf->fixed_param; - reason_code = wmi_event->reserved0; - - /* - * reason_code = 0; Flush event in response to flush command - * reason_code = other value; Asynchronous flush event for fatal events - */ - if (!reason_code && (cds_is_log_report_in_progress() == false)) { - WMA_LOGE("Received WMI flush event without sending CMD"); - return -EINVAL; - } else if (!reason_code && cds_is_log_report_in_progress() == true) { - /* Flush event in response to flush command */ - WMA_LOGI("Received WMI flush event in response to flush CMD"); - status = qdf_mc_timer_stop(&wma->log_completion_timer); - if (status != QDF_STATUS_SUCCESS) - WMA_LOGE("Failed to stop the log completion timeout"); - cds_logging_set_fw_flush_complete(); - } else if (reason_code && cds_is_log_report_in_progress() == false) { - /* Asynchronous flush event for fatal events */ - WMA_LOGE("Received asynchronous WMI flush event: reason=%d", - reason_code); - status = cds_set_log_completion(WLAN_LOG_TYPE_FATAL, - WLAN_LOG_INDICATOR_FIRMWARE, - reason_code, false); - if (QDF_STATUS_SUCCESS != status) { - WMA_LOGE("%s: Failed to set log trigger params", - __func__); - return QDF_STATUS_E_FAILURE; - } - cds_logging_set_fw_flush_complete(); - return status; - } else { - /* Asynchronous flush event for fatal event, - * but, report in progress already - */ - WMA_LOGI("%s: Bug report already in progress - dropping! type:%d, indicator=%d reason_code=%d", - __func__, WLAN_LOG_TYPE_FATAL, - WLAN_LOG_INDICATOR_FIRMWARE, reason_code); - return QDF_STATUS_E_FAILURE; - } - return 0; -} - /** * wma_pdev_set_hw_mode_resp_evt_handler() - Set HW mode resp evt handler * @handle: WMI handle @@ -3173,17 +3178,6 @@ QDF_STATUS wma_start(void *cds_ctx) goto end; } - /* Initialize the log flush complete event handler */ - status = wmi_unified_register_event_handler(wma_handle->wmi_handle, - WMI_DEBUG_MESG_FLUSH_COMPLETE_EVENTID, - wma_flush_complete_evt_handler, - WMA_RX_SERIALIZER_CTX); - if (status != QDF_STATUS_SUCCESS) { - WMA_LOGE("Failed to register log flush complete event cb"); - qdf_status = QDF_STATUS_E_FAILURE; - goto end; - } - /* Initialize the wma_pdev_set_hw_mode_resp_evt_handler event handler */ status = wmi_unified_register_event_handler(wma_handle->wmi_handle, WMI_PDEV_SET_HW_MODE_RESP_EVENTID, -- cgit v1.2.3