diff options
| author | Jeff Johnson <jjohnson@codeaurora.org> | 2018-07-17 20:15:56 -0700 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-07-24 19:27:17 -0700 |
| commit | 899396371c4670a29928978714547d022ca237e7 (patch) | |
| tree | eca888b786969e3873865cb1007208c7c491001d | |
| parent | 1232da80dc5fff0c5e67e5393556407ac0ea54d9 (diff) | |
qcacld-3.0: Implement WLAN_FEATURE_SARV1_TO_SARV2
SARv1 to SARv2 upgrade can have the following problem:
1) Userspace application was written to use SARv1 BDF entries
2) Product is configured with SAR V2 BDF entries
So introduce WLAN_FEATURE_SARV1_TO_SARV2 which has the logic:
If this feature is enabled, and if the firmware is configured with SAR
V2 support, and if the incoming request is to enable a SAR V1 BDF
entry, then the WMI command is generated to actually configure a SAR
V2 BDF entry.
CRs-Fixed: 2282071
Change-Id: I1f4c65d0315b56af6646ca1d5491eaa9c1f732a5
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 7dbc46517f4f..d6bf72d22961 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -9996,6 +9996,96 @@ static int wlan_hdd_cfg80211_sar_convert_limit_set(u32 nl80211_value, return ret; } +#ifdef WLAN_FEATURE_SARV1_TO_SARV2 +/** + * hdd_convert_sarv1_to_sarv2() - convert SAR V1 BDF reference to SAR V2 + * @hdd_ctx: The HDD global context + * @tb: The parsed array of netlink attributes + * @sar_limit_cmd: The WMI command to be filled + * + * This feature/function is designed to solve the following problem: + * 1) Userspace application was written to use SARv1 BDF entries + * 2) Product is configured with SAR V2 BDF entries + * + * So if this feature is enabled, and if the firmware is configured + * with SAR V2 support, and if the incoming request is to enable a SAR + * V1 BDF entry, then the WMI command is generated to actually + * configure a SAR V2 BDF entry. + * + * Return: true if conversion was performed and @sar_limit_cmd is + * ready to be sent to firmware. Otherwise false in which case the + * normal parsing logic should be applied. + */ + +static bool +hdd_convert_sarv1_to_sarv2(hdd_context_t *hdd_ctx, + struct nlattr *tb[], + struct sar_limit_cmd_params *sar_limit_cmd) +{ + struct nlattr *attr; + uint32_t bdf_index, set; + struct sar_limit_cmd_row *row; + + if (hdd_ctx->sar_version != SAR_VERSION_2) { + hdd_debug("SAR version: %d", hdd_ctx->sar_version); + return false; + } + + attr = tb[QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE]; + if (!attr) + return false; + + bdf_index = nla_get_u32(attr); + + if ((bdf_index >= QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF0) && + (bdf_index <= QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF4)) { + set = QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0; + } else if (bdf_index == QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE) { + set = QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE; + bdf_index = QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF0; + } else { + return false; + } + + /* Need two rows to hold the per-chain V2 power index + * To disable SARv2 limit, send chain, num_limits_row and + * power limit set to 0 (except power index 0xff) + */ + row = qdf_mem_malloc(2 * sizeof(*row)); + if (!row) + return false; + + if (wlan_hdd_cfg80211_sar_convert_limit_set( + set, &sar_limit_cmd->sar_enable)) { + hdd_err("Failed to convert SAR limit to WMI value"); + return false; + } + + sar_limit_cmd->commit_limits = 1; + sar_limit_cmd->num_limit_rows = 2; + sar_limit_cmd->sar_limit_row_list = row; + row[0].limit_value = bdf_index; + row[1].limit_value = row[0].limit_value; + row[0].chain_id = 0; + row[1].chain_id = 1; + row[0].validity_bitmap = WMI_SAR_CHAIN_ID_VALID_MASK; + row[1].validity_bitmap = WMI_SAR_CHAIN_ID_VALID_MASK; + + return true; +} + +#else /* WLAN_FEATURE_SARV1_TO_SARV2 */ + +static bool +hdd_convert_sarv1_to_sarv2(hdd_context_t *hdd_ctx, + struct nlattr *tb[], + struct sar_limit_cmd_params *sar_limit_cmd) +{ + return false; +} + +#endif /* WLAN_FEATURE_SARV1_TO_SARV2 */ + /** * wlan_hdd_cfg80211_sar_convert_band() - Convert WLAN band value * @nl80211_value: Vendor command attribute value @@ -10393,6 +10483,10 @@ static int __wlan_hdd_set_sar_power_limits(struct wiphy *wiphy, return -EINVAL; } + /* is special SAR V1 => SAR V2 logic enabled and applicable? */ + if (hdd_convert_sarv1_to_sarv2(hdd_ctx, tb, &sar_limit_cmd)) + goto send_sar_limits; + /* Vendor command manadates all SAR Specs in single call */ sar_limit_cmd.commit_limits = 1; sar_limit_cmd.sar_enable = WMI_SAR_FEATURE_NO_CHANGE; |
