From 6b334c3ba407ab700d2bc7f1c1d76e7b7dbae8f4 Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Thu, 23 May 2019 14:35:58 +0530 Subject: [PATCH 1/2] qcacmn: Add support for WLAN thermal mitigation As a part of a new requirement, the WLAN subsystem needs to perform thermal mitigation action as per the thermal state of the device. The platform driver sends the notification with the thermal state and the host performs the required appropriate action. The actions include blocking northbound communication as a maximum power save state and throttling (via duty cycle control) as an intermediate power save action. The driver switches states and maintains the configured states across load/unload. Make changes to perform registration with the platform driver, act as per the thermal state as received by the platform driver and communicate with FW regarding the mitigation action to be performed. The communication with the FW is done via the WMI command WMI_THERM_THROT_SET_CONF_CMDID. Change-Id: Icbbfd4d75e191b2e9b523afc4806fc714a4a251e CRs-Fixed: 2468792 --- wmi/inc/wmi_unified_param.h | 2 + wmi/src/wmi_unified_tlv.c | 75 +++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index d6895160d87d..ba5539fce602 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -3964,12 +3964,14 @@ typedef struct { * @enable: Enable/Disable Thermal mitigation * @dc: DC * @dc_per_event: DC per event + * @num_thermal_conf: Number of thermal configurations to be sent * @tt_level_config: TT level config params */ struct thermal_mitigation_params { uint32_t enable; uint32_t dc; uint32_t dc_per_event; + uint8_t num_thermal_conf; tt_level_config levelconf[THERMAL_LEVELS]; }; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 953628eb479b..badc4c915480 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15110,6 +15110,77 @@ static QDF_STATUS send_btm_config_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +#ifdef FW_THERMAL_THROTTLE_SUPPORT +/** + * send_thermal_mitigation_param_cmd_tlv() - configure thermal mitigation params + * @wmi_handle: handle to WMI. + * @param: pointer to hold thermal mitigation param + * + * Return: QDF_STATUS_SUCCESS on success and appropriate error on failure. + */ +static QDF_STATUS send_thermal_mitigation_param_cmd_tlv( + wmi_unified_t wmi_handle, + struct thermal_mitigation_params *param) +{ + wmi_therm_throt_config_request_fixed_param *tt_conf; + wmi_therm_throt_level_config_info *lvl_conf = NULL; + wmi_buf_t buf = NULL; + uint8_t *buf_ptr = NULL; + QDF_STATUS error; + size_t len; + int i; + + len = sizeof(*tt_conf) + WMI_TLV_HDR_SIZE + + param->num_thermal_conf * + sizeof(wmi_therm_throt_level_config_info); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) + return QDF_STATUS_E_NOMEM; + + tt_conf = (wmi_therm_throt_config_request_fixed_param *) + wmi_buf_data(buf); + + /* init fixed params */ + WMITLV_SET_HDR( + tt_conf, + WMITLV_TAG_STRUC_wmi_therm_throt_config_request_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_therm_throt_config_request_fixed_param)); + + tt_conf->enable = param->enable; + tt_conf->dc = param->dc; + tt_conf->therm_throt_levels = param->num_thermal_conf; + + buf_ptr = (uint8_t *)(++tt_conf); + /* init TLV params */ + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + param->num_thermal_conf * + sizeof(wmi_therm_throt_level_config_info)); + + lvl_conf = (wmi_therm_throt_level_config_info *)(buf_ptr + + WMI_TLV_HDR_SIZE); + for (i = 0; i < param->num_thermal_conf; i++) { + WMITLV_SET_HDR( + &lvl_conf->tlv_header, + WMITLV_TAG_STRUC_wmi_therm_throt_level_config_info, + WMITLV_GET_STRUCT_TLVLEN( + wmi_therm_throt_level_config_info)); + lvl_conf->dc_off_percent = param->levelconf[i].dcoffpercent; + lvl_conf++; + } + + error = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_THERM_THROT_SET_CONF_CMDID); + if (QDF_IS_STATUS_ERROR(error)) { + wmi_buf_free(buf); + WMI_LOGE("Failed to send WMI_THERM_THROT_SET_CONF_CMDID cmd"); + } + + return error; +} +#endif + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -15413,6 +15484,10 @@ struct wmi_ops tlv_ops = { .send_offload_11k_cmd = send_offload_11k_cmd_tlv, .send_invoke_neighbor_report_cmd = send_invoke_neighbor_report_cmd_tlv, .send_btm_config = send_btm_config_cmd_tlv, +#ifdef FW_THERMAL_THROTTLE_SUPPORT + .send_thermal_mitigation_param_cmd = + send_thermal_mitigation_param_cmd_tlv, +#endif }; #ifdef WMI_TLV_AND_NON_TLV_SUPPORT From a4c2a161be312c852c4e0b649d6ebf731a9a6f86 Mon Sep 17 00:00:00 2001 From: Srikanth Marepalli Date: Mon, 22 Jul 2019 20:17:37 +0530 Subject: [PATCH 2/2] qcacmn: Add support for pmkid generation fallback in FIPS mode Add support to fallback the PMKID generation from firmware to wpa_supplicant. Firmware fallbacks PMKID generation to host when FIPS enabled due to the crypto library availability limitation. Once the roam candidate selection is done in the firmware, it sends the WMI_ROAM_PMKID_REQUEST_EVENTID. Once this event is received, the host driver triggers an event to wpa_supplicant for PMKID generation. Change-Id: Ica00d27ce3f9f4a8f966261b38e238c389fcf05c CRs-Fixed: 2507617 --- wmi/inc/wmi_unified_param.h | 1 + wmi/src/wmi_unified_tlv.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index ba5539fce602..940741ac8cba 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5313,6 +5313,7 @@ typedef enum { wmi_sar_get_limits_event_id, wmi_roam_scan_stats_event_id, wmi_wlan_sar2_result_event_id, + wmi_roam_pmkid_request_event_id, wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index badc4c915480..c11190dcbc56 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -15836,6 +15836,8 @@ static void populate_tlv_events_id(uint32_t *event_ids) event_ids[wmi_sar_get_limits_event_id] = WMI_SAR_GET_LIMITS_EVENTID; event_ids[wmi_roam_scan_stats_event_id] = WMI_ROAM_SCAN_STATS_EVENTID; event_ids[wmi_wlan_sar2_result_event_id] = WMI_SAR2_RESULT_EVENTID; + event_ids[wmi_roam_pmkid_request_event_id] = + WMI_ROAM_PMKID_REQUEST_EVENTID; } /**