diff options
| -rw-r--r-- | core/wma/src/wma_main.c | 150 |
1 files 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 @@ -1904,6 +1904,73 @@ static void wma_register_debug_callback(void) } /** + * 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 * @wma_tgt_cfg_cb: tgt config callback fun @@ -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(); @@ -2584,73 +2656,6 @@ static int wma_log_supported_evt_handler(void *handle, } /** - * 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 * @event: Event recevied from FW @@ -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, |
