diff --git a/core/hdd/inc/qc_sap_ioctl.h b/core/hdd/inc/qc_sap_ioctl.h index 557cc41b73bd..c222ba4e6e1e 100644 --- a/core/hdd/inc/qc_sap_ioctl.h +++ b/core/hdd/inc/qc_sap_ioctl.h @@ -91,6 +91,8 @@ struct channel_list_info { */ #define WE_SET_CHAN_AVOID 21 +#define WE_SET_THERMAL_THROTTLE_CFG 27 + #define WE_P2P_NOA_CMD 2 #define QCSAP_IOCTL_MODIFY_ACL (SIOCIWFIRSTPRIV + 18) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index fd06722dbfc3..2324c2ca1b9a 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -3041,6 +3041,14 @@ static const struct iw_priv_args hostapd_private_args[] = { } #endif , +#ifdef FW_THERMAL_THROTTLE_SUPPORT + { + WE_SET_THERMAL_THROTTLE_CFG, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, "setThermalCfg" + } + , +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ /* handlers for main ioctl */ { QCSAP_IOCTL_MODIFY_ACL, diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index e6956aee99b1..59aa19c1af0d 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -2554,10 +2554,11 @@ #ifdef WLAN_FEATURE_MOTION_DETECTION #undef MAX_VAR_ARGS #define MAX_VAR_ARGS 15 +#endif /* WLAN_FEATURE_MOTION_DETECTION */ #define WE_MOTION_DET_CONFIG_PARAM 25 #define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26 -#endif /* WLAN_FEATURE_MOTION_DETECTION */ +#define WE_SET_THERMAL_THROTTLE_CFG 27 /* * * fips_test - Perform a FIPS test @@ -3291,7 +3292,7 @@ int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value) case CDP_NAPI_STATS: if (hdd_display_napi_stats()) { hdd_err("error displaying napi stats"); - ret = EFAULT; + ret = -EFAULT; } break; case CDP_DP_RX_THREAD_STATS: @@ -3308,7 +3309,7 @@ int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value) QDF_STATS_VERBOSITY_LEVEL_HIGH); if (status == QDF_STATUS_E_INVAL) { hdd_display_stats_help(); - ret = EINVAL; + ret = -EINVAL; } break; } @@ -7750,6 +7751,43 @@ static int __iw_set_var_ints_getnone(struct net_device *dev, } break; #endif /* WLAN_FEATURE_MOTION_DETECTION */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT + case WE_SET_THERMAL_THROTTLE_CFG: + { + QDF_STATUS status; + + if (num_args != 7) { + hdd_err("set_thermal_cfg: Invalid no of args"); + return -EINVAL; + } + + /* Check for valid inputs */ + if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 || + apps_args[2] < 0 || apps_args[2] > 100 || + apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 || + apps_args[5] < 0 || apps_args[6] < 0 || + apps_args[5] <= apps_args[4]) + return -EINVAL; + + status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle, + apps_args[0], + apps_args[1], + apps_args[2], + apps_args[3], + apps_args[6]); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); + + if (!apps_args[6]) { + status = sme_set_thermal_mgmt(hdd_ctx->mac_handle, + apps_args[4], + apps_args[5]); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); + } + break; + } +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ default: { hdd_err("Invalid IOCTL command %d", sub_cmd); @@ -9755,6 +9793,7 @@ static const struct iw_priv_args we_private_args[] = { IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dl_type"}, + {WE_DBGLOG_REPORT_ENABLE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, @@ -9770,7 +9809,12 @@ static const struct iw_priv_args we_private_args[] = { IW_PRIV_TYPE_INT | MAX_VAR_ARGS, 0, "txrx_stats"}, - +#ifdef FW_THERMAL_THROTTLE_SUPPORT + {WE_SET_THERMAL_THROTTLE_CFG, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, + "set_thermal_cfg"}, +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ {WE_TXRX_FWSTATS_RESET, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, @@ -9928,8 +9972,8 @@ static const struct iw_priv_args we_private_args[] = { "getMaxAssoc"}, {WE_GET_SAP_AUTO_CHANNEL_SELECTION, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "getAutoChannel" }, + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "getAutoChannel"}, {WE_GET_CONCURRENCY_MODE, 0, @@ -10150,14 +10194,17 @@ static const struct iw_priv_args we_private_args[] = { 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_temp"}, + {WE_GET_DCM, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_dcm"}, + {WE_GET_RANGE_EXT, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_range_ext"}, + /* handlers for main ioctl */ {WLAN_PRIV_SET_CHAR_GET_NONE, IW_PRIV_TYPE_CHAR | 512, @@ -10226,11 +10273,12 @@ static const struct iw_priv_args we_private_args[] = { {WLAN_PRIV_SET_NONE_GET_THREE_INT, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, - "" }, + ""}, + {WE_GET_TSF, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, - "get_tsf" }, + "get_tsf"}, {WE_SET_DUAL_MAC_SCAN_CONFIG, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, @@ -10248,69 +10296,68 @@ static const struct iw_priv_args we_private_args[] = { 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "version"}, + {WE_GET_STATS, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getStats"}, + {WE_GET_SUSPEND_RESUME_STATS, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getSuspendStats"}, + {WE_LIST_FW_PROFILE, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "listProfile"}, + {WE_GET_STATES, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getHostStates"}, + {WE_GET_CFG, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getConfig"}, + {WE_GET_RSSI, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getRSSI"}, + {WE_GET_WMM_STATUS, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, "getWmmStatus"}, - { - WE_GET_CHANNEL_LIST, - 0, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - "getChannelList" - }, + + {WE_GET_CHANNEL_LIST, + 0, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + "getChannelList"}, #ifdef FEATURE_WLAN_TDLS - { - WE_GET_TDLS_PEERS, - 0, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - "getTdlsPeers" - }, + {WE_GET_TDLS_PEERS, + 0, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + "getTdlsPeers"}, #endif #ifdef WLAN_FEATURE_11W - { - WE_GET_11W_INFO, - 0, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - "getPMFInfo" - }, + {WE_GET_11W_INFO, + 0, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + "getPMFInfo"}, #endif - { - WE_GET_STA_CXN_INFO, - 0, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - "get_cxn_info" - }, + {WE_GET_STA_CXN_INFO, + 0, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + "get_cxn_info" }, + + {WE_GET_IBSS_STA_INFO, + 0, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + "getIbssSTAs"}, - { - WE_GET_IBSS_STA_INFO, - 0, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - "getIbssSTAs" - }, {WE_GET_PHYMODE, 0, IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, @@ -10338,12 +10385,11 @@ static const struct iw_priv_args we_private_args[] = { ""}, /* handlers for sub-ioctl */ - { - WE_IBSS_GET_PEER_INFO_ALL, - 0, - 0, - "ibssPeerInfoAll" - }, + {WE_IBSS_GET_PEER_INFO_ALL, + 0, + 0, + "ibssPeerInfoAll"}, + {WE_GET_RECOVERY_STAT, 0, 0, @@ -10439,19 +10485,15 @@ static const struct iw_priv_args we_private_args[] = { 0, "pm_set_hw_mode"}, #endif - { - WE_UNIT_TEST_CMD, - IW_PRIV_TYPE_INT | MAX_VAR_ARGS, - 0, - "setUnitTestCmd" - }, - { - WE_MAC_PWR_DEBUG_CMD, - IW_PRIV_TYPE_INT | MAX_VAR_ARGS, - 0, - "halPwrDebug" - }, + {WE_UNIT_TEST_CMD, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, + "setUnitTestCmd"}, + {WE_MAC_PWR_DEBUG_CMD, + IW_PRIV_TYPE_INT | MAX_VAR_ARGS, + 0, + "halPwrDebug"}, #ifdef WLAN_FEATURE_GPIO_LED_FLASHING {WE_LED_FLASHING_PARAM, IW_PRIV_TYPE_INT | MAX_VAR_ARGS, @@ -10489,181 +10531,154 @@ static const struct iw_priv_args we_private_args[] = { "getTspec"}, /* handlers for main ioctl - host offload */ - { - WLAN_PRIV_SET_HOST_OFFLOAD, - IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req), - 0, - "setHostOffload" - } - , + {WLAN_PRIV_SET_HOST_OFFLOAD, + IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req), + 0, + "setHostOffload"}, - { - WLAN_GET_WLAN_STATISTICS, - 0, - IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, - "getWlanStats" - } - , + {WLAN_GET_WLAN_STATISTICS, + 0, + IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, + "getWlanStats"}, - { - WLAN_SET_KEEPALIVE_PARAMS, - IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | - IW_PRIV_SIZE_FIXED, - 0, - "setKeepAlive" - } - , + {WLAN_SET_KEEPALIVE_PARAMS, + IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) | + IW_PRIV_SIZE_FIXED, + 0, + "setKeepAlive"}, #ifdef WLAN_FEATURE_PACKET_FILTERING - { - WLAN_SET_PACKET_FILTER_PARAMS, - IW_PRIV_TYPE_BYTE | - sizeof(struct pkt_filter_cfg), - 0, - "setPktFilter" - } - , + {WLAN_SET_PACKET_FILTER_PARAMS, + IW_PRIV_TYPE_BYTE | + sizeof(struct pkt_filter_cfg), + 0, + "setPktFilter"}, #endif #ifdef FEATURE_WLAN_SCAN_PNO - { - WLAN_SET_PNO, - IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, - 0, - "setpno" - } - , + {WLAN_SET_PNO, + IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN, + 0, + "setpno"}, #endif - { - WLAN_SET_BAND_CONFIG, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - 0, - "SETBAND" - } - , - { - WLAN_PRIV_SET_MCBC_FILTER, - 0, - 0, - "setMCBCFilter" - } - , + {WLAN_SET_BAND_CONFIG, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, + "SETBAND"}, - { - WLAN_GET_LINK_SPEED, - IW_PRIV_TYPE_CHAR | 18, - IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" - } - , + {WLAN_PRIV_SET_MCBC_FILTER, + 0, + 0, + "setMCBCFilter"}, + + {WLAN_GET_LINK_SPEED, + IW_PRIV_TYPE_CHAR | 18, + IW_PRIV_TYPE_CHAR | 5, + "getLinkSpeed"}, /* handlers for main ioctl */ {WLAN_PRIV_SET_TWO_INT_GET_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, - ""} - , + ""}, + {WE_SET_SMPS_PARAM, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "set_smps_param"} - , + 0, "set_smps_param"}, + {WLAN_SET_DOT11P_CHANNEL_SCHED, IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched), - 0, "set_dot11p" } - , + 0, "set_dot11p" }, + #ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT {WE_SET_FW_CRASH_INJECT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "crash_inject"} - , + 0, "crash_inject"}, + #endif #if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY) {WE_LOG_BUFFER, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "log_buffer"} - , + 0, "log_buffer"}, + #endif {WE_SET_BA_AGEING_TIMEOUT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "set_ba_timeout"} - , + 0, "set_ba_timeout"}, + #ifdef WLAN_SUSPEND_RESUME_TEST {WE_SET_WLAN_SUSPEND, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "wlan_suspend"} - , + 0, "wlan_suspend"}, + {WE_SET_WLAN_RESUME, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "wlan_resume"} - , + 0, "wlan_resume"}, #endif {WE_ENABLE_FW_PROFILE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "enableProfile"} - , + 0, "enableProfile"}, + {WE_SET_FW_PROFILE_HIST_INTVL, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "set_hist_intvl"} - , + 0, "set_hist_intvl"}, + {WE_SET_DUAL_MAC_FW_MODE_CONFIG, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "set_fw_mode_cfg"} - , + 0, "set_fw_mode_cfg"}, #ifdef CONFIG_DP_TRACE {WE_DUMP_DP_TRACE_LEVEL, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "dump_dp_trace"} - , + 0, "dump_dp_trace"}, #endif #ifdef FEATURE_MONITOR_MODE_SUPPORT {WE_SET_MON_MODE_CHAN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, - 0, "setMonChan"} - , + 0, "setMonChan"}, #endif {WE_GET_ROAM_SYNCH_DELAY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "hostroamdelay"} - , + "hostroamdelay"}, + {WE_SET_11AX_RATE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "set_11ax_rate"} - , + "set_11ax_rate"}, + {WE_SET_DCM, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "enable_dcm"} - , + "enable_dcm"}, + {WE_SET_RANGE_EXT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "range_ext"} - , + "range_ext"}, + {WLAN_PRIV_SET_FTIES, IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE, 0, - "set_ft_ies"} - , + "set_ft_ies"}, + #ifdef WLAN_FEATURE_MOTION_DETECTION {WE_MOTION_DET_START_STOP, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "mt_start"} - , + "mt_start"}, + {WE_MOTION_DET_BASE_LINE_START_STOP, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "mt_bl_start"} - , + "mt_bl_start"}, + {WE_MOTION_DET_CONFIG_PARAM, IW_PRIV_TYPE_INT | MAX_VAR_ARGS, 0, - "mt_config"} - , + "mt_config"}, + {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM, IW_PRIV_TYPE_INT | MAX_VAR_ARGS, 0, - "mt_bl_config"} - , + "mt_bl_config"}, #endif /* WLAN_FEATURE_MOTION_DETECTION */ }; diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 0fd1e5d2d8a6..361458317f92 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -659,6 +659,11 @@ struct sir_cfg_action_frm_tb_ppdu { #define SIR_HAL_SET_MOTION_DET_BASE_LINE_ENABLE \ (SIR_HAL_ITC_MSG_TYPES_BEGIN + 408) #endif /* WLAN_FEATURE_MOTION_DETECTION */ + +#ifdef FW_THERMAL_THROTTLE_SUPPORT +#define SIR_HAL_SET_THERMAL_THROTTLE_CFG (SIR_HAL_ITC_MSG_TYPES_BEGIN + 409) +#define SIR_HAL_SET_THERMAL_MGMT (SIR_HAL_ITC_MSG_TYPES_BEGIN + 410) +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) /* CFG message types */ diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index 8b43b18a9169..7e66e1a2a100 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -646,6 +646,10 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_GET_RCPI_REQ); CASE_RETURN_STRING(WMA_SET_DBS_SCAN_SEL_CONF_PARAMS); CASE_RETURN_STRING(WMA_GET_ROAM_SCAN_STATS); +#ifdef FW_THERMAL_THROTTLE_SUPPORT + CASE_RETURN_STRING(WMA_SET_THERMAL_THROTTLE_CFG); + CASE_RETURN_STRING(WMA_SET_THERMAL_MGMT); +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ default: return (uint8_t *) "UNKNOWN"; break; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 88e3f6ec6b84..d3f7041f9451 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -3147,5 +3147,34 @@ QDF_STATUS sme_set_md_host_evt_cb void *hdd_ctx ); #endif /* WLAN_FEATURE_MOTION_DETECTION */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT +/** + * sme_set_thermal_throttle_cfg() - SME API to set the thermal throttle + * configuration parameters + * @mac_handle: Opaque handle to the global MAC context + * @enable: Enable Throttle + * @dc: duty cycle in msecs + * @dc_off_percent: duty cycle off percentage + * @prio: Disables the transmit queues in fw that have lower priority + * than value defined by prio + * @target_temp: Target temperature + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_thermal_throttle_cfg(mac_handle_t mac_handle, bool enable, + uint32_t dc, uint32_t dc_off_percent, + uint32_t prio, uint32_t target_temp); +/** + * sme_set_thermal_mgmt() - SME API to set the thermal management params + * @mac_handle: Opaque handle to the global MAC context + * @lower_thresh_deg: Lower threshold value of Temperature + * @higher_thresh_deg: Higher threshold value of Temperature + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_thermal_mgmt(mac_handle_t mac_handle, + uint16_t lower_thresh_deg, + uint16_t higher_thresh_deg); +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 4e138a5f3864..d933e2ee0a58 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -14921,7 +14921,7 @@ QDF_STATUS sme_set_md_host_evt_cb( QDF_STATUS sme_motion_det_config(mac_handle_t mac_handle, struct sme_motion_det_cfg *motion_det_config) { - struct scheduler_msg msg = {0}; + struct scheduler_msg msg; struct sme_motion_det_cfg *motion_det_cfg; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac = MAC_CONTEXT(mac_handle); @@ -14964,7 +14964,7 @@ QDF_STATUS sme_motion_det_config(mac_handle_t mac_handle, QDF_STATUS sme_motion_det_enable(mac_handle_t mac_handle, struct sme_motion_det_en *motion_det_enable) { - struct scheduler_msg msg = {0}; + struct scheduler_msg msg; struct sme_motion_det_en *motion_det_en; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac = MAC_CONTEXT(mac_handle); @@ -15007,7 +15007,7 @@ QDF_STATUS sme_motion_det_base_line_config( mac_handle_t mac_handle, struct sme_motion_det_base_line_cfg *motion_det_base_line_config) { - struct scheduler_msg msg = {0}; + struct scheduler_msg msg; struct sme_motion_det_base_line_cfg *motion_det_base_line_cfg; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac = MAC_CONTEXT(mac_handle); @@ -15024,7 +15024,7 @@ QDF_STATUS sme_motion_det_base_line_config( *motion_det_base_line_cfg = *motion_det_base_line_config; - qdf_mem_set(&msg, sizeof(msg), 0); + qdf_mem_set(&msg, sizeof(msg), 0); msg.type = WMA_SET_MOTION_DET_BASE_LINE_CONFIG; msg.bodyptr = motion_det_base_line_cfg; @@ -15052,7 +15052,7 @@ QDF_STATUS sme_motion_det_base_line_enable( mac_handle_t mac_handle, struct sme_motion_det_base_line_en *motion_det_base_line_enable) { - struct scheduler_msg msg = {0}; + struct scheduler_msg msg; struct sme_motion_det_base_line_en *motion_det_base_line_en; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; struct mac_context *mac = MAC_CONTEXT(mac_handle); @@ -15069,7 +15069,7 @@ QDF_STATUS sme_motion_det_base_line_enable( *motion_det_base_line_en = *motion_det_base_line_enable; - qdf_mem_set(&msg, sizeof(msg), 0); + qdf_mem_set(&msg, sizeof(msg), 0); msg.type = WMA_SET_MOTION_DET_BASE_LINE_ENABLE; msg.bodyptr = motion_det_base_line_en; @@ -15086,3 +15086,103 @@ QDF_STATUS sme_motion_det_base_line_enable( return qdf_status; } #endif /* WLAN_FEATURE_MOTION_DETECTION */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT +/** + * sme_set_thermal_throttle_cfg() - SME API to set the thermal throttle + * configuration parameters + * @mac_handle: Opaque handle to the global MAC context + * @enable: Enable Throttle + * @dc: duty cycle in msecs + * @dc_off_percent: duty cycle off percentage + * @prio: Disables the transmit queues in fw that have lower priority + * than value defined by prio + * @target_temp: Target temperature + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_thermal_throttle_cfg(mac_handle_t mac_handle, bool enable, + uint32_t dc, uint32_t dc_off_percent, + uint32_t prio, uint32_t target_temp) +{ + struct scheduler_msg msg; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + struct thermal_mitigation_params *therm_cfg_params; + + qdf_status = sme_acquire_global_lock(&mac->sme); + if (QDF_STATUS_SUCCESS == qdf_status) { + therm_cfg_params = qdf_mem_malloc(sizeof(*therm_cfg_params)); + if (!therm_cfg_params) { + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_NOMEM; + } + + therm_cfg_params->enable = enable; + therm_cfg_params->dc = dc; + therm_cfg_params->levelconf[0].dcoffpercent = dc_off_percent; + therm_cfg_params->levelconf[0].priority = prio; + therm_cfg_params->levelconf[0].tmplwm = target_temp; + + qdf_mem_set(&msg, sizeof(msg), 0); + msg.type = WMA_SET_THERMAL_THROTTLE_CFG; + msg.reserved = 0; + msg.bodyptr = therm_cfg_params; + + qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, + QDF_MODULE_ID_WMA, + QDF_MODULE_ID_WMA, &msg); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + qdf_mem_free(therm_cfg_params); + qdf_status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac->sme); + } + return qdf_status; +} + +/** + * sme_set_thermal_mgmt() - SME API to set the thermal management params + * @mac_handle: Opaque handle to the global MAC context + * @lower_thresh_deg: Lower threshold value of Temperature + * @higher_thresh_deg: Higher threshold value of Temperature + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_thermal_mgmt(mac_handle_t mac_handle, + uint16_t lower_thresh_deg, + uint16_t higher_thresh_deg) +{ + struct scheduler_msg msg; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; + t_thermal_cmd_params *therm_mgmt_cmd; + + qdf_status = sme_acquire_global_lock(&mac->sme); + if (QDF_STATUS_SUCCESS == qdf_status) { + therm_mgmt_cmd = qdf_mem_malloc(sizeof(*therm_mgmt_cmd)); + if (!therm_mgmt_cmd) { + sme_release_global_lock(&mac->sme); + return QDF_STATUS_E_NOMEM; + } + + therm_mgmt_cmd->minTemp = lower_thresh_deg; + therm_mgmt_cmd->maxTemp = higher_thresh_deg; + therm_mgmt_cmd->thermalEnable = 1; + + qdf_mem_set(&msg, sizeof(msg), 0); + msg.type = WMA_SET_THERMAL_MGMT; + msg.reserved = 0; + msg.bodyptr = therm_mgmt_cmd; + + qdf_status = scheduler_post_message(QDF_MODULE_ID_SME, + QDF_MODULE_ID_WMA, + QDF_MODULE_ID_WMA, &msg); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + qdf_mem_free(therm_mgmt_cmd); + qdf_status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac->sme); + } + return qdf_status; +} +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 2940ac503c0a..055bf9b597c8 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1088,6 +1088,7 @@ struct wma_valid_channels { * @wma_fw_time_sync_timer: timer used for firmware time sync * @critical_events_in_flight: number of suspend-preventing events * in flight + * * @fw_therm_throt_support: FW Supports thermal throttling? * * This structure is the global wma context. It contains global wma * module parameters and handles of other modules. @@ -1222,6 +1223,7 @@ typedef struct { uint8_t ito_repeat_count; qdf_mc_timer_t wma_fw_time_sync_timer; qdf_atomic_t critical_events_in_flight; + bool fw_therm_throt_support; } t_wma_handle, *tp_wma_handle; extern void cds_wma_complete_cback(void); diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 6956043d4e41..d376f0d36f58 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -466,6 +466,11 @@ SIR_HAL_SET_MOTION_DET_BASE_LINE_ENABLE #endif /* WLAN_FEATURE_MOTION_DETECTION */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT +#define WMA_SET_THERMAL_THROTTLE_CFG SIR_HAL_SET_THERMAL_THROTTLE_CFG +#define WMA_SET_THERMAL_MGMT SIR_HAL_SET_THERMAL_MGMT +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ + /* Bit 6 will be used to control BD rate for Management frames */ #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index 73294e4874bd..f46406dda8c6 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -891,17 +891,14 @@ wma_data_tx_ack_comp_hdlr(void *wma_context, qdf_nbuf_t netbuf, int32_t status) void *pdev; tp_wma_handle wma_handle = (tp_wma_handle) wma_context; - if (NULL == wma_handle) { + if (!wma_handle) { WMA_LOGE("%s: Invalid WMA Handle", __func__); return; } pdev = cds_get_context(QDF_MODULE_ID_TXRX); - - if (NULL == pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); + if (!pdev) return; - } /* * if netBuf does not match with pending nbuf then just free the @@ -990,7 +987,7 @@ int wma_peer_state_change_event_handler(void *handle, event = param_buf->fixed_param; vdev = wma_find_vdev_by_id(wma_handle, event->vdev_id); - if (NULL == vdev) { + if (!vdev) { WMA_LOGD("%s: Couldn't find vdev for vdev_id: %d", __func__, event->vdev_id); return -EINVAL; @@ -1032,10 +1029,8 @@ QDF_STATUS wma_set_enable_disable_mcc_adaptive_scheduler(uint32_t uint32_t pdev_id; wma = cds_get_context(QDF_MODULE_ID_WMA); - if (NULL == wma) { - WMA_LOGE("%s : Failed to get wma", __func__); + if (!wma) return QDF_STATUS_E_FAULT; - } /* * Since there could be up to two instances of OCS in FW (one per MAC), @@ -1080,7 +1075,6 @@ QDF_STATUS wma_set_mcc_channel_time_latency(tp_wma_handle wma, } mac = cds_get_context(QDF_MODULE_ID_PE); if (!mac) { - WMA_LOGE("%s:NULL mac ptr. Exiting", __func__); QDF_ASSERT(0); return QDF_STATUS_E_FAILURE; } @@ -1145,7 +1139,6 @@ QDF_STATUS wma_set_mcc_channel_time_quota(tp_wma_handle wma, } mac = cds_get_context(QDF_MODULE_ID_PE); if (!mac) { - WMA_LOGE("%s:NULL mac ptr. Exiting", __func__); QDF_ASSERT(0); return QDF_STATUS_E_FAILURE; } @@ -1209,9 +1202,7 @@ void wma_set_linkstate(tp_wma_handle wma, tpLinkStateParams params) } pdev = cds_get_context(QDF_MODULE_ID_TXRX); - - if (NULL == pdev) { - WMA_LOGE("%s: Unable to get TXRX context", __func__); + if (!pdev) { params->status = false; goto out; } @@ -1676,16 +1667,14 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma, struct cdp_pdev *curr_pdev; void *soc = cds_get_context(QDF_MODULE_ID_SOC); - if (NULL == wma || NULL == config) { + if (!wma || !config) { WMA_LOGE("%s Invalid input\n", __func__); return QDF_STATUS_E_FAILURE; } curr_pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == curr_pdev) { - WMA_LOGE("%s: Failed to get pdev\n", __func__); + if (!curr_pdev) return QDF_STATUS_E_FAILURE; - } WMA_LOGE("%s enable %d period %d txq limit %d\n", __func__, config->enable, @@ -1721,6 +1710,75 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma, } #endif /* defined(CONFIG_HL_SUPPORT) && defined(QCA_BAD_PEER_TX_FLOW_CL) */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT +/** + * wma_update_thermal_mitigation_to_fw - update thermal mitigation to fw + * @wma: wma handle + * @thermal_level: thermal level + * + * This function sends down thermal mitigation params to the fw + * + * Returns: QDF_STATUS_SUCCESS for success otherwise failure + */ +static QDF_STATUS wma_update_thermal_mitigation_to_fw(tp_wma_handle wma, + u_int8_t thermal_level) +{ + struct thermal_mitigation_params therm_data; + + /* Check if vdev is in mcc, if in mcc set dc value as 10, else 100 */ + therm_data.dc = 100; + therm_data.enable = 1; + therm_data.levelconf[0].dcoffpercent = + wma->thermal_mgmt_info.throttle_duty_cycle_tbl[thermal_level]; + therm_data.levelconf[0].priority = 0; + + return wmi_unified_thermal_mitigation_param_cmd_send(wma, &therm_data); +} +#else /* FW_THERMAL_THROTTLE_SUPPORT */ +/** + * wma_update_thermal_mitigation_to_fw - update thermal mitigation to fw + * @wma: wma handle + * @thermal_level: thermal level + * + * This function sends down thermal mitigation params to the fw + * + * Returns: QDF_STATUS_SUCCESS for success otherwise failure + */ +static QDF_STATUS wma_update_thermal_mitigation_to_fw(tp_wma_handle wma, + u_int8_t thermal_level) +{ + return QDF_STATUS_SUCCESS; +} +#endif + +/** + * wma_update_thermal_cfg_to_fw() - update thermal configuration to FW + * @wma: Pointer to WMA handle + * + * This function update thermal configuration to FW + * + * Returns: QDF_STATUS_SUCCESS for success otherwise failure + */ +static QDF_STATUS wma_update_thermal_cfg_to_fw(tp_wma_handle wma) +{ + t_thermal_cmd_params thermal_params; + + /* Get the temperature thresholds to set in firmware */ + thermal_params.minTemp = + wma->thermal_mgmt_info.thermalLevels[WLAN_WMA_THERMAL_LEVEL_0]. + minTempThreshold; + thermal_params.maxTemp = + wma->thermal_mgmt_info.thermalLevels[WLAN_WMA_THERMAL_LEVEL_0]. + maxTempThreshold; + thermal_params.thermalEnable = + wma->thermal_mgmt_info.thermalMgmtEnabled; + + WMA_LOGE("TM sending to fw: min_temp %d max_temp %d enable %d", + thermal_params.minTemp, thermal_params.maxTemp, + thermal_params.thermalEnable); + + return wma_set_thermal_mgmt(wma, thermal_params); +} /** * wma_process_init_thermal_info() - initialize thermal info @@ -1736,19 +1794,20 @@ QDF_STATUS wma_process_init_bad_peer_tx_ctl_info(tp_wma_handle wma, QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma, t_thermal_mgmt *pThermalParams) { - t_thermal_cmd_params thermal_params; struct cdp_pdev *curr_pdev; + QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; +#ifdef FW_THERMAL_THROTTLE_SUPPORT + int i = 0; +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ - if (NULL == wma || NULL == pThermalParams) { + if (!wma || !pThermalParams) { WMA_LOGE("TM Invalid input"); return QDF_STATUS_E_FAILURE; } curr_pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == curr_pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); + if (!curr_pdev) return QDF_STATUS_E_FAILURE; - } WMA_LOGD("TM enable %d period %d", pThermalParams->thermalMgmtEnabled, pThermalParams->throttlePeriod); @@ -1797,30 +1856,27 @@ QDF_STATUS wma_process_init_thermal_info(tp_wma_handle wma, wma->thermal_mgmt_info.thermalLevels[3].minTempThreshold, wma->thermal_mgmt_info.thermalLevels[3].maxTempThreshold); +#ifdef FW_THERMAL_THROTTLE_SUPPORT + for (i = 0; i < THROTTLE_LEVEL_MAX; i++) + wma->thermal_mgmt_info.throttle_duty_cycle_tbl[i] = + pThermalParams->throttle_duty_cycle_tbl[i]; +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ + if (wma->thermal_mgmt_info.thermalMgmtEnabled) { - cdp_throttle_init_period(cds_get_context(QDF_MODULE_ID_SOC), - curr_pdev, - pThermalParams->throttlePeriod, + if (!wma->fw_therm_throt_support) { + cdp_throttle_init_period( + cds_get_context(QDF_MODULE_ID_SOC), + curr_pdev, pThermalParams->throttlePeriod, &pThermalParams->throttle_duty_cycle_tbl[0]); - - /* Get the temperature thresholds to set in firmware */ - thermal_params.minTemp = - wma->thermal_mgmt_info.thermalLevels[WLAN_WMA_THERMAL_LEVEL_0].minTempThreshold; - thermal_params.maxTemp = - wma->thermal_mgmt_info.thermalLevels[WLAN_WMA_THERMAL_LEVEL_0].maxTempThreshold; - thermal_params.thermalEnable = - wma->thermal_mgmt_info.thermalMgmtEnabled; - - WMA_LOGE("TM sending the following to firmware: min %d max %d enable %d", - thermal_params.minTemp, thermal_params.maxTemp, - thermal_params.thermalEnable); - - if (QDF_STATUS_SUCCESS != - wma_set_thermal_mgmt(wma, thermal_params)) { - WMA_LOGE("Could not send thermal mgmt command to the firmware!"); + } else { + qdf_status = wma_update_thermal_mitigation_to_fw( + wma, WLAN_WMA_THERMAL_LEVEL_0); + if (QDF_STATUS_SUCCESS != qdf_status) + return qdf_status; } + qdf_status = wma_update_thermal_cfg_to_fw(wma); } - return QDF_STATUS_SUCCESS; + return qdf_status; } /** @@ -1866,16 +1922,14 @@ QDF_STATUS wma_process_set_thermal_level(tp_wma_handle wma, { struct cdp_pdev *curr_pdev; - if (NULL == wma) { + if (!wma) { WMA_LOGE("TM Invalid input"); return QDF_STATUS_E_FAILURE; } curr_pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == curr_pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); + if (!curr_pdev) return QDF_STATUS_E_FAILURE; - } WMA_LOGE("TM set level %d", thermal_level); @@ -1899,8 +1953,7 @@ QDF_STATUS wma_process_set_thermal_level(tp_wma_handle wma, wma->thermal_mgmt_info.thermalCurrLevel = thermal_level; cdp_throttle_set_level(cds_get_context(QDF_MODULE_ID_SOC), - curr_pdev, - thermal_level); + curr_pdev, thermal_level); /* Send SME SET_THERMAL_LEVEL_IND message */ wma_set_thermal_level_ind(thermal_level); @@ -1978,13 +2031,13 @@ static uint8_t wma_thermal_mgmt_get_level(void *handle, uint32_t temp) * wma_thermal_mgmt_evt_handler() - thermal mgmt event handler * @wma_handle: Pointer to WMA handle * @event: Thermal event information + * @len: length of the event * - * This function handles the thermal mgmt event from the firmware len + * This function handles the thermal mgmt event from the firmware * * Return: 0 for success otherwise failure */ -int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, - uint32_t len) +int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, uint32_t len) { tp_wma_handle wma; wmi_thermal_mgmt_event_fixed_param *tm_event; @@ -1993,14 +2046,14 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, WMI_THERMAL_MGMT_EVENTID_param_tlvs *param_buf; struct cdp_pdev *curr_pdev; - if (NULL == event || NULL == handle) { + if (!event || !handle) { WMA_LOGE("Invalid thermal mitigation event buffer"); return -EINVAL; } wma = (tp_wma_handle) handle; - if (NULL == wma) { + if (!wma) { WMA_LOGE("%s: Failed to get wma handle", __func__); return -EINVAL; } @@ -2008,10 +2061,8 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, param_buf = (WMI_THERMAL_MGMT_EVENTID_param_tlvs *) event; curr_pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == curr_pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); + if (!curr_pdev) return -EINVAL; - } /* Check if thermal mitigation is enabled */ if (!wma->thermal_mgmt_info.thermalMgmtEnabled) { @@ -2036,14 +2087,22 @@ int wma_thermal_mgmt_evt_handler(void *handle, uint8_t *event, wma->thermal_mgmt_info.thermalCurrLevel = thermal_level; - /* Inform txrx */ - cdp_throttle_set_level(cds_get_context(QDF_MODULE_ID_SOC), - curr_pdev, - thermal_level); + if (!wma->fw_therm_throt_support) { + /* Inform txrx */ + cdp_throttle_set_level(cds_get_context(QDF_MODULE_ID_SOC), + curr_pdev, thermal_level); + } /* Send SME SET_THERMAL_LEVEL_IND message */ wma_set_thermal_level_ind(thermal_level); + if (wma->fw_therm_throt_support) { + /* Send duty cycle info to firmware for fw to throttle */ + if (QDF_STATUS_SUCCESS != + wma_update_thermal_mitigation_to_fw(wma, thermal_level)) + return QDF_STATUS_E_FAILURE; + } + /* Get the temperature thresholds to set in firmware */ thermal_params.minTemp = wma->thermal_mgmt_info.thermalLevels[thermal_level]. @@ -2092,10 +2151,8 @@ int wma_ibss_peer_info_event_handler(void *handle, uint8_t *data, } pdev = cds_get_context(QDF_MODULE_ID_TXRX); - if (NULL == pdev) { - WMA_LOGE("%s: could not get pdev context", __func__); + if (!pdev) return 0; - } param_tlvs = (WMI_PEER_INFO_EVENTID_param_tlvs *) data; fix_param = param_tlvs->fixed_param; @@ -2284,7 +2341,7 @@ static void wma_decap_to_8023(qdf_nbuf_t msdu, struct wma_decap_info_t *info) break; } - if (llc_hdr == NULL) { + if (!llc_hdr) { ethr_hdr->ethertype[0] = (ether_type >> 8) & 0xff; ethr_hdr->ethertype[1] = (ether_type) & 0xff; } else { @@ -2430,7 +2487,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, uint8_t *igtk; uint16_t key_len; - if (NULL == wma_handle) { + if (!wma_handle) { WMA_LOGE("wma_handle is NULL"); cds_packet_free((void *)tx_frame); return QDF_STATUS_E_FAILURE; @@ -2460,7 +2517,6 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, mac = cds_get_context(QDF_MODULE_ID_PE); if (!mac) { - WMA_LOGE("mac Handle is NULL"); cds_packet_free((void *)tx_frame); return QDF_STATUS_E_FAILURE; } @@ -2610,8 +2666,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, (struct ieee80211_frame *)qdf_nbuf_data(skb); unsigned long curr_timestamp = qdf_mc_timer_get_system_ticks(); - if (pdev == NULL) { - WMA_LOGE("%s: pdev pointer is not available", __func__); + if (!pdev) { cds_packet_free((void *)tx_frame); return QDF_STATUS_E_FAULT; } @@ -2705,7 +2760,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, ctrl_pdev = cdp_get_ctrl_pdev_from_vdev(soc, txrx_vdev); - if (ctrl_pdev == NULL) { + if (!ctrl_pdev) { WMA_LOGE("ol_pdev_handle is NULL\n"); cds_packet_free((void *)tx_frame); return QDF_STATUS_E_FAILURE; @@ -2919,7 +2974,7 @@ QDF_STATUS wma_ds_peek_rx_packet_info(cds_pkt_t *pkt, void **pkt_meta, bool bSwap) { /* Sanity Check */ - if (pkt == NULL) { + if (!pkt) { WMA_LOGE("wma:Invalid parameter sent on wma_peek_rx_pkt_info"); return QDF_STATUS_E_FAULT; } @@ -2995,10 +3050,8 @@ void ol_rx_err(void *pdev, uint8_t vdev_id, struct ether_header *eth_hdr; struct scheduler_msg cds_msg = {0}; - if (NULL == wma) { - WMA_LOGE("%s: Failed to get wma", __func__); + if (!wma) return; - } if (err_type != OL_RX_ERR_TKIP_MIC) return; @@ -3061,10 +3114,8 @@ void wma_tx_abort(uint8_t vdev_id) struct peer_flush_params param = {0}; wma = cds_get_context(QDF_MODULE_ID_WMA); - if (NULL == wma) { - WMA_LOGE("%s: wma is NULL", __func__); + if (!wma) return; - } iface = &wma->interfaces[vdev_id]; if (!iface->handle) { @@ -3103,7 +3154,7 @@ QDF_STATUS wma_lro_config_cmd(void *handle, struct wmi_lro_config_cmd_t wmi_lro_cmd = {0}; tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); - if (NULL == wma || NULL == wma_lro_cmd) { + if (!wma || !wma_lro_cmd) { wma_err("Invalid input!"); return QDF_STATUS_E_FAILURE; } @@ -3145,7 +3196,7 @@ wma_indicate_err( struct scheduler_msg cds_msg = {0}; uint8_t vdev_id; - if (NULL == wma) { + if (!wma) { WMA_LOGE("%s: Failed to get wma context", __func__); return; diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index c88193fed0d7..368bed33bb87 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -6080,14 +6080,18 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, cdp_mark_first_wakeup_packet(soc, wmi_service_enabled(wmi_handle, - wmi_service_mark_first_wakeup_packet)); + wmi_service_mark_first_wakeup_packet)); wma_handle->is_dfs_offloaded = wmi_service_enabled(wmi_handle, - wmi_service_dfs_phyerr_offload); + wmi_service_dfs_phyerr_offload); wma_handle->nan_datapath_enabled = wmi_service_enabled(wma_handle->wmi_handle, - wmi_service_nan_data); + wmi_service_nan_data); + + wma_handle->fw_therm_throt_support = + wmi_service_enabled(wma_handle->wmi_handle, + wmi_service_tt); wma_set_component_caps(wma_handle->psoc); @@ -9002,6 +9006,25 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) qdf_mem_free(msg->bodyptr); break; #endif /* WLAN_FEATURE_MOTION_DETECTION */ +#ifdef FW_THERMAL_THROTTLE_SUPPORT + case WMA_SET_THERMAL_THROTTLE_CFG: + if (!wma_handle->thermal_mgmt_info.thermalMgmtEnabled) + wmi_unified_thermal_mitigation_param_cmd_send( + wma_handle->wmi_handle, msg->bodyptr); + else + qdf_status = QDF_STATUS_E_INVAL; + qdf_mem_free(msg->bodyptr); + break; + case WMA_SET_THERMAL_MGMT: + if (!wma_handle->thermal_mgmt_info.thermalMgmtEnabled) + wma_set_thermal_mgmt( + wma_handle, + *((t_thermal_cmd_params *)msg->bodyptr)); + else + qdf_status = QDF_STATUS_E_INVAL; + qdf_mem_free(msg->bodyptr); + break; +#endif /* FW_THERMAL_THROTTLE_SUPPORT */ default: WMA_LOGD("Unhandled WMA message of type %d", msg->type); if (msg->bodyptr)