diff --git a/core/hdd/inc/hdd_config.h b/core/hdd/inc/hdd_config.h index f65626cf1564..0f1c1b595d92 100644 --- a/core/hdd/inc/hdd_config.h +++ b/core/hdd/inc/hdd_config.h @@ -1295,26 +1295,27 @@ struct dhcp_server { /* * - * gSarVersion - Used to specify SAR version + * gEnableSARV1toSARV2 - Used to Enable/Disable SAR version conversion * - * @Min: 1 - * @Max: 2 - * Default: 1 + * @Min: 0 + * @Max: 1 + * Default: 0 * - * This ini is used to specify the SAR feature version. - * If value of this ini is set to 2, SAR version 2 will - * be used. + * If user space is using SARV1 and FW is using SARV2 in BDF in that case + * this ini is used to enable conversion from user specified SARV1 command + * to FW expected SARV2 command. + * If value of this ini is set to 0, SAR version 1 will + * not be converted to SARV2 and command will be rejected. + * If value of this ini is set to 1 SAR version 1 will be converted to + * SARV2 based on FW capability * Usage: External * * */ -#define CFG_SAR_VERSION CFG_INI_UINT( \ - "gSarVersion", \ - 1, \ - 2, \ - 1, \ - CFG_VALUE_OR_DEFAULT, \ - "Specify the SAR version") +#define CFG_SAR_CONVERSION CFG_INI_BOOL( \ + "gEnableSARV1toSARV2", \ + 0, \ + "Enable/Disable conversion from SARV1 to SARV2") /* * @@ -1487,7 +1488,7 @@ enum host_log_level { CFG(CFG_TIMER_MULTIPLIER) \ CFG(CFG_HDD_DOT11_MODE) \ CFG(CFG_ENABLE_DISABLE_CHANNEL) \ - CFG(CFG_SAR_VERSION) \ + CFG(CFG_SAR_CONVERSION) \ CFG(CFG_WOW_DISABLE) \ CFG(CFG_ENABLE_HOST_MODULE_LOG_LEVEL) #endif diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 1ae6718f8b10..8e3245b72ca9 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -220,7 +220,7 @@ struct hdd_config { uint32_t provisioned_intf_pool; uint32_t derived_intf_pool; uint32_t cfg_wmi_credit_cnt; - uint32_t sar_version; + uint32_t enable_sar_conversion; bool is_wow_disabled; #ifdef WLAN_FEATURE_TSF_PLUS uint8_t tsf_ptp_options; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 626ed54ffab4..352f9370bd26 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11746,6 +11746,7 @@ hdd_convert_sarv1_to_sarv2(struct hdd_context *hdd_ctx, uint32_t bdf_index, set; struct sar_limit_cmd_row *row; + hdd_enter(); if (hdd_ctx->sar_version != SAR_VERSION_2) { hdd_debug("SAR version: %d", hdd_ctx->sar_version); return false; @@ -11791,6 +11792,7 @@ hdd_convert_sarv1_to_sarv2(struct hdd_context *hdd_ctx, row[0].validity_bitmap = WMI_SAR_CHAIN_ID_VALID_MASK; row[1].validity_bitmap = WMI_SAR_CHAIN_ID_VALID_MASK; + hdd_exit(); return true; } @@ -11990,6 +11992,7 @@ static int __wlan_hdd_set_sar_power_limits(struct wiphy *wiphy, QDF_STATUS status; uint32_t num_limit_rows = 0; struct sar_limit_cmd_row *row; + uint32_t sar_enable; hdd_enter(); @@ -12007,12 +12010,31 @@ static int __wlan_hdd_set_sar_power_limits(struct wiphy *wiphy, return -EINVAL; } + if (tb[SAR_LIMITS_SAR_ENABLE]) { + sar_enable = nla_get_u32(tb[SAR_LIMITS_SAR_ENABLE]); + + if ((sar_enable >= + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF0 && + sar_enable <= + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF4) && + hdd_ctx->sar_version == SAR_VERSION_2 && + !hdd_ctx->config->enable_sar_conversion) { + hdd_err("SARV1 to SARV2 is disabled from ini"); + return -EINVAL; + } else if (sar_enable == + QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0 && + hdd_ctx->sar_version == SAR_VERSION_1) { + hdd_err("FW expects SARV1 given command is SARV2"); + return -EINVAL; + } + } + sar_limit_cmd = qdf_mem_malloc(sizeof(struct sar_limit_cmd_params)); if (!sar_limit_cmd) return -ENOMEM; /* is special SAR V1 => SAR V2 logic enabled and applicable? */ - if (hdd_ctx->config->sar_version == 2 && + if (hdd_ctx->config->enable_sar_conversion && (hdd_convert_sarv1_to_sarv2(hdd_ctx, tb, sar_limit_cmd))) goto send_sar_limits; @@ -12020,9 +12042,9 @@ static int __wlan_hdd_set_sar_power_limits(struct wiphy *wiphy, sar_limit_cmd->commit_limits = 1; sar_limit_cmd->sar_enable = WMI_SAR_FEATURE_NO_CHANGE; if (tb[SAR_LIMITS_SAR_ENABLE]) { - uint32_t sar_enable = nla_get_u32(tb[SAR_LIMITS_SAR_ENABLE]); uint32_t *sar_ptr = &sar_limit_cmd->sar_enable; + sar_enable = nla_get_u32(tb[SAR_LIMITS_SAR_ENABLE]); ret = wlan_hdd_cfg80211_sar_convert_limit_set(sar_enable, sar_ptr); if (ret) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a3c255590c87..73d0773f8d4e 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -10276,7 +10276,7 @@ static void hdd_cfg_params_init(struct hdd_context *hdd_ctx) config->is_unit_test_framework_enabled = cfg_get(psoc, CFG_ENABLE_UNIT_TEST_FRAMEWORK); config->disable_channel = cfg_get(psoc, CFG_ENABLE_DISABLE_CHANNEL); - config->sar_version = cfg_get(psoc, CFG_SAR_VERSION); + config->enable_sar_conversion = cfg_get(psoc, CFG_SAR_CONVERSION); config->is_wow_disabled = cfg_get(psoc, CFG_WOW_DISABLE); hdd_init_vc_mode_cfg_bitmap(config, psoc);