diff options
| author | Sarada Prasanna Garnayak <sgarna@codeaurora.org> | 2016-12-29 13:21:32 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-01-12 05:26:05 -0800 |
| commit | 3eafda7b198feecdeb556dc9a0439eab2d5d58d4 (patch) | |
| tree | a7bb38edd0898ab8c37ac4aea926c700eba48f88 | |
| parent | 7436ec41c80cb6dcbb7292a6db8c883eb33b0647 (diff) | |
qcacmn: Runtime PM packets tagging after wow suspend
qcacld-2.0 to qcacmn propagation.
Don't Tag Non-WoW packets as Runtime PM packets after
wow suspend. Some WMI Commands can be send in Runtime
PM context and MC thread context. Packets coming via
MC Thread Context can be tagged as Runtime PM packets
when runtime pm in progress.
Packets should be tagged in the same caller context to
avoid any race condition. Being stability issue, addressing
this issue by not tagging any non-wow commands as runtime pm
after wow suspend. This will ensure all the non-wow packets
coming after wow_suspend flag is set as non runtime pm packets
and will trigger a runtime resume.
Git-commit: 4a396d80c5cc2ded75098c61426521b9b2762c17
Git-commit: 2ee4bf4791cc5db30ec03eceaf591367deffe39a
CRs-Fixed: 1106496
Change-Id: I4e55733ad8403581aca0b49ce9442fc5591335c0
| -rw-r--r-- | hif/src/pcie/if_pci.c | 4 | ||||
| -rw-r--r-- | wmi/inc/wmi_unified_api.h | 15 | ||||
| -rw-r--r-- | wmi/inc/wmi_unified_priv.h | 5 | ||||
| -rw-r--r-- | wmi/src/wmi_unified.c | 54 | ||||
| -rw-r--r-- | wmi/src/wmi_unified_non_tlv.c | 17 | ||||
| -rw-r--r-- | wmi/src/wmi_unified_tlv.c | 112 |
6 files changed, 171 insertions, 36 deletions
diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 58fab197dc52..022b0c552fa0 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -924,7 +924,7 @@ static const char *hif_pm_runtime_state_to_string(uint32_t state) * * Return: void */ -void hif_pci_runtime_pm_warn(struct hif_pci_softc *sc, const char *msg) +static void hif_pci_runtime_pm_warn(struct hif_pci_softc *sc, const char *msg) { struct hif_pm_runtime_lock *ctx; diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index d4508c6829e2..7fbac7e04497 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -242,6 +242,20 @@ int wmi_get_pending_cmds(wmi_unified_t wmi_handle); void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val); /** + * 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); + +/** + * 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); + +/** * generic function to block unified WMI command * @param wmi_handle : handle to WMI. * @return 0 on success and -ve on failure. @@ -281,7 +295,6 @@ static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle) } #endif - /** * UMAC Callback to process fw event. * @param wmi_handle : handle to WMI. diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index cd206cbb1142..e91d5c66a5bf 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1145,6 +1145,8 @@ QDF_STATUS (*send_encrypt_decrypt_send_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_sar_limit_cmd)(wmi_unified_t wmi_handle, struct sar_limit_cmd_params *params); +uint16_t (*wmi_set_htc_tx_tag)(wmi_unified_t wmi_handle, + wmi_buf_t buf, uint32_t cmd_id); }; struct target_abi_version { @@ -1209,7 +1211,8 @@ struct wmi_unified { #ifdef FEATURE_RUNTIME_PM qdf_atomic_t runtime_pm_inprogress; #endif - + qdf_atomic_t is_wow_bus_suspended; + bool tag_crash_inject; enum wmi_target_type target_type; struct wmi_rx_ops rx_ops; struct wmi_ops *ops; diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c index cd0f1b156d60..352959b582c1 100644 --- a/wmi/src/wmi_unified.c +++ b/wmi/src/wmi_unified.c @@ -1670,32 +1670,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. - */ #ifndef WMI_NON_TLV_SUPPORT -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 @@ -1714,10 +1689,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; @@ -1743,8 +1714,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, @@ -2484,6 +2456,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); +} + #ifdef WMI_NON_TLV_SUPPORT /** * API to flush all the previous packets associated with the wmi endpoint diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index 85c799b91a0b..f28f87ce0f0c 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -7235,6 +7235,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, @@ -7425,6 +7439,7 @@ struct wmi_ops non_tlv_ops = { .extract_fips_event_data = extract_fips_event_data_non_tlv, .extract_fips_event_error_status = extract_fips_event_error_status_non_tlv, + .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_non_tlv, }; /** diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 50aeb4c7fb6f..200449eb9a9f 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -12313,6 +12313,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() - 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, @@ -12569,6 +12680,7 @@ struct wmi_ops tlv_ops = { send_encrypt_decrypt_send_cmd_tlv, .send_sar_limit_cmd = send_sar_limit_cmd_tlv, .send_per_roam_config_cmd = send_per_roam_config_cmd_tlv, + .wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_tlv, }; #ifdef WMI_TLV_AND_NON_TLV_SUPPORT |
