diff --git a/wmi_unified.c b/wmi_unified.c index bb2a06deaf..7a67ef08ac 100644 --- a/wmi_unified.c +++ b/wmi_unified.c @@ -1686,33 +1686,7 @@ static uint8_t *wmi_id_to_name(uint32_t wmi_command) } #endif - -/** - * wmi_is_runtime_pm_cmd() - check if a cmd is from suspend resume sequence - * @cmd: command to check - * - * Return: true if the command is part of the suspend resume sequence. - */ #ifdef CONFIG_MCL -static bool wmi_is_runtime_pm_cmd(uint32_t cmd_id) -{ - switch (cmd_id) { - case WMI_WOW_ENABLE_CMDID: - case WMI_PDEV_SUSPEND_CMDID: - case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: - case WMI_WOW_ADD_WAKE_PATTERN_CMDID: - case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: - case WMI_PDEV_RESUME_CMDID: - case WMI_WOW_DEL_WAKE_PATTERN_CMDID: - case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: - case WMI_D0_WOW_ENABLE_DISABLE_CMDID: - return true; - - default: - return false; - } -} - /** * wmi_is_pm_resume_cmd() - check if a cmd is part of the resume sequence * @cmd_id: command to check @@ -1731,10 +1705,6 @@ static bool wmi_is_pm_resume_cmd(uint32_t cmd_id) } } #else -static bool wmi_is_runtime_pm_cmd(uint32_t cmd_id) -{ - return false; -} static bool wmi_is_pm_resume_cmd(uint32_t cmd_id) { return false; @@ -1760,8 +1730,9 @@ QDF_STATUS wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint16_t htc_tag = 0; if (wmi_get_runtime_pm_inprogress(wmi_handle)) { - if (wmi_is_runtime_pm_cmd(cmd_id)) - htc_tag = HTC_TX_PACKET_TAG_AUTO_PM; + htc_tag = + (A_UINT16)wmi_handle->ops->wmi_set_htc_tx_tag( + wmi_handle, buf, cmd_id); } else if (qdf_atomic_read(&wmi_handle->is_target_suspended) && (!wmi_is_pm_resume_cmd(cmd_id))) { QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR, @@ -2506,6 +2477,26 @@ void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val) qdf_atomic_set(&wmi_handle->is_target_suspended, val); } +/** + * WMI API to set crash injection state + * @param wmi_handle: handle to WMI. + * @param val: crash injection state boolean. + */ +void wmi_tag_crash_inject(wmi_unified_t wmi_handle, A_BOOL flag) +{ + wmi_handle->tag_crash_inject = flag; +} + +/** + * WMI API to set bus suspend state + * @param wmi_handle: handle to WMI. + * @param val: suspend state boolean. + */ +void wmi_set_is_wow_bus_suspended(wmi_unified_t wmi_handle, A_BOOL val) +{ + qdf_atomic_set(&wmi_handle->is_wow_bus_suspended, val); +} + #ifndef CONFIG_MCL /** * API to flush all the previous packets associated with the wmi endpoint diff --git a/wmi_unified_non_tlv.c b/wmi_unified_non_tlv.c index 93bdcf73f5..ef6649acdf 100644 --- a/wmi_unified_non_tlv.c +++ b/wmi_unified_non_tlv.c @@ -7784,6 +7784,20 @@ static bool is_management_record_non_tlv(uint32_t cmd_id) } #endif +/** + * wmi_set_htc_tx_tag_non_tlv() - set HTC TX tag for WMI commands + * @wmi_handle: WMI handle + * @buf: WMI buffer + * @cmd_id: WMI command Id + * + * Return htc_tx_tag + */ +static uint16_t wmi_set_htc_tx_tag_non_tlv(wmi_unified_t wmi_handle, + wmi_buf_t buf, uint32_t cmd_id) +{ + return 0; +} + struct wmi_ops non_tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_non_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_non_tlv, @@ -7996,7 +8010,7 @@ struct wmi_ops non_tlv_ops = { .extract_mu_db_entry = extract_mu_db_entry_non_tlv, .extract_atf_peer_stats_ev = extract_atf_peer_stats_ev_non_tlv, .extract_atf_token_info_ev = extract_atf_token_info_ev_non_tlv, - + .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_non_tlv, }; /** diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c index a4b5ef569a..0e0c42fff6 100644 --- a/wmi_unified_tlv.c +++ b/wmi_unified_tlv.c @@ -12897,6 +12897,117 @@ static bool is_management_record_tlv(uint32_t cmd_id) } #endif +static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) +{ + wmi_vdev_set_param_cmd_fixed_param *set_cmd; + + set_cmd = (wmi_vdev_set_param_cmd_fixed_param *)wmi_buf_data(buf); + + switch (set_cmd->param_id) { + case WMI_VDEV_PARAM_LISTEN_INTERVAL: + case WMI_VDEV_PARAM_DTIM_POLICY: + return HTC_TX_PACKET_TAG_AUTO_PM; + default: + break; + } + + return 0; +} + +static uint16_t wmi_tag_sta_powersave_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf) +{ + wmi_sta_powersave_param_cmd_fixed_param *ps_cmd; + + ps_cmd = (wmi_sta_powersave_param_cmd_fixed_param *)wmi_buf_data(buf); + + switch (ps_cmd->param) { + case WMI_STA_PS_PARAM_TX_WAKE_THRESHOLD: + case WMI_STA_PS_PARAM_INACTIVITY_TIME: + case WMI_STA_PS_ENABLE_QPOWER: + return HTC_TX_PACKET_TAG_AUTO_PM; + default: + break; + } + + return 0; +} + +static uint16_t wmi_tag_common_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf, + uint32_t cmd_id) +{ + if (qdf_atomic_read(&wmi_hdl->is_wow_bus_suspended)) + return 0; + + switch (cmd_id) { + case WMI_VDEV_SET_PARAM_CMDID: + return wmi_tag_vdev_set_cmd(wmi_hdl, buf); + case WMI_STA_POWERSAVE_PARAM_CMDID: + return wmi_tag_sta_powersave_cmd(wmi_hdl, buf); + default: + break; + } + + return 0; +} + +static uint16_t wmi_tag_fw_hang_cmd(wmi_unified_t wmi_handle) +{ + uint16_t tag = 0; + + if (qdf_atomic_read(&wmi_handle->is_target_suspended)) { + pr_err("%s: Target is already suspended, Ignore FW Hang Command\n", + __func__); + return tag; + } + + if (wmi_handle->tag_crash_inject) + tag = HTC_TX_PACKET_TAG_AUTO_PM; + + wmi_handle->tag_crash_inject = false; + return tag; +} + +/** + * wmi_set_htc_tx_tag_tlv() - set HTC TX tag for WMI commands + * @wmi_handle: WMI handle + * @buf: WMI buffer + * @cmd_id: WMI command Id + * + * Return htc_tx_tag + */ +static uint16_t wmi_set_htc_tx_tag_tlv(wmi_unified_t wmi_handle, + wmi_buf_t buf, + uint32_t cmd_id) +{ + uint16_t htc_tx_tag = 0; + + switch (cmd_id) { + case WMI_WOW_ENABLE_CMDID: + case WMI_PDEV_SUSPEND_CMDID: + case WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID: + case WMI_WOW_ADD_WAKE_PATTERN_CMDID: + case WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID: + case WMI_PDEV_RESUME_CMDID: + case WMI_WOW_DEL_WAKE_PATTERN_CMDID: + case WMI_WOW_SET_ACTION_WAKE_UP_CMDID: +#ifdef FEATURE_WLAN_D0WOW + case WMI_D0_WOW_ENABLE_DISABLE_CMDID: +#endif + htc_tx_tag = HTC_TX_PACKET_TAG_AUTO_PM; + break; + case WMI_FORCE_FW_HANG_CMDID: + htc_tx_tag = wmi_tag_fw_hang_cmd(wmi_handle); + break; + case WMI_VDEV_SET_PARAM_CMDID: + case WMI_STA_POWERSAVE_PARAM_CMDID: + htc_tx_tag = wmi_tag_common_cmd(wmi_handle, buf, cmd_id); + default: + break; + } + + return htc_tx_tag; +} + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -13163,6 +13274,7 @@ struct wmi_ops tlv_ops = { extract_mac_phy_cap_service_ready_ext_tlv, .extract_reg_cap_service_ready_ext = extract_reg_cap_service_ready_ext_tlv, + .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, }; #ifndef CONFIG_MCL