From de4c6e68ce9aa672ae4aa9b043a7c784572aaa4d Mon Sep 17 00:00:00 2001 From: Praveen Kurapati Date: Thu, 10 Jun 2021 20:21:12 +0530 Subject: [PATCH] msm: ipa3: Add proper check for FNR stats query In some targets, FnR tethering stats query support is not present. Add changes to check for support present or not before query. Change-Id: I415e019ff0cb01cf09c8ba6cd9fef44ae815c11b Signed-off-by: Praveen Kurapati --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 9 +++++++++ drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 2 ++ drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 1e109bb5e60d..07c2d2f61964 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -7150,6 +7150,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p, ipa3_ctx->manual_fw_load = resource_p->manual_fw_load; ipa3_ctx->max_num_smmu_cb = resource_p->max_num_smmu_cb; ipa3_ctx->hw_type_index = ipa3_get_hw_type_index(); + ipa3_ctx->fnr_stats_not_supported = resource_p->fnr_stats_not_supported; if (resource_p->gsi_fw_file_name) { ipa3_ctx->gsi_fw_file_name = @@ -7961,6 +7962,7 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, ipa_drv_res->is_eth_bridging_supported = false; ipa_drv_res->is_bw_monitor_supported = false; ipa_drv_res->modem_load_ipa_fw = false; + ipa_drv_res->fnr_stats_not_supported = false; /* Get IPA HW Version */ result = of_property_read_u32(pdev->dev.of_node, "qcom,ipa-hw-ver", @@ -8255,6 +8257,13 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, ipa_drv_res->modem_load_ipa_fw ? "True" : "False"); + ipa_drv_res->fnr_stats_not_supported = + of_property_read_bool(pdev->dev.of_node, + "qcom,fnr-stats-not-supported"); + IPADBG(": FnR stats not supported = %s\n", + ipa_drv_res->fnr_stats_not_supported + ? "True" : "False"); + result = of_property_read_string(pdev->dev.of_node, "qcom,use-gsi-ipa-fw", &ipa_drv_res->gsi_fw_file_name); if (!result) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 3bf3fa267327..2bc0d82040b3 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -2153,6 +2153,7 @@ struct ipa3_context { bool is_eth_bridging_supported; bool is_bw_monitor_supported; bool modem_load_ipa_fw; + bool fnr_stats_not_supported; }; struct ipa3_plat_drv_res { @@ -2225,6 +2226,7 @@ struct ipa3_plat_drv_res { bool is_eth_bridging_supported; bool is_bw_monitor_supported; bool modem_load_ipa_fw; + bool fnr_stats_not_supported; }; /** diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c index 3eb145ba5162..231a9e11c50b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c @@ -4169,7 +4169,8 @@ int rmnet_ipa3_query_tethering_stats_all( } else if (upstream_type == IPA_UPSTEAM_WLAN) { IPAWANDBG_LOW(" query wifi-backhaul stats\n"); if (ipa3_ctx_get_type(IPA_HW_TYPE) < IPA_HW_v4_5 || - !ipa3_ctx_get_flag(IPA_HW_STATS_EN)) { + !ipa3_ctx_get_flag(IPA_HW_STATS_EN) || + ipa3_ctx->fnr_stats_not_supported) { IPAWANDBG("hw version %d,hw_stats.enabled %d\n", ipa3_ctx_get_type(IPA_HW_TYPE), ipa3_ctx_get_flag(IPA_HW_STATS_EN));