From 0afac9d12e58e9b18e86e6cfe25605a5c939076b Mon Sep 17 00:00:00 2001 From: Ananya Gupta Date: Thu, 10 Mar 2022 15:39:08 +0530 Subject: [PATCH] qcacmn: Enable IPA if enabled in platform driver and ini Enable IPA only if it is enabled from both platform driver and ini file. Change-Id: Ifc4bcd2c5b29b91c0eb72a844906cf11a65686e4 CRs-Fixed: 3148731 --- ipa/core/inc/wlan_ipa_main.h | 15 +++++++++++++++ ipa/core/src/wlan_ipa_main.c | 23 +++++++++++++++++++++-- ipa/dispatcher/inc/wlan_ipa_ucfg_api.h | 25 ++++++++++++++++++++++++- ipa/dispatcher/src/wlan_ipa_ucfg_api.c | 16 +++++++++++++++- wlan_cfg/wlan_cfg.c | 25 +++++++++++++++++++++---- 5 files changed, 96 insertions(+), 8 deletions(-) diff --git a/ipa/core/inc/wlan_ipa_main.h b/ipa/core/inc/wlan_ipa_main.h index 19b788204e..86988d5a06 100644 --- a/ipa/core/inc/wlan_ipa_main.h +++ b/ipa/core/inc/wlan_ipa_main.h @@ -67,6 +67,21 @@ extern uint8_t g_instances_added; #define IPA_EXIT() \ QDF_TRACE_EXIT(QDF_MODULE_ID_IPA, "exit") +/** + * ipa_set_pld_enable() - set g_ipa_pld_enable + * @flag: flag to set g_ipa_pld_enable + * + * Return: None + */ +void ipa_set_pld_enable(bool flag); + +/** + * ipa_get_pld_enable() - check if IPA is disabled in pld + * + * Return: g_ipa_pld_enable + */ +bool ipa_get_pld_enable(void); + /** * ipa_check_hw_present() - get IPA hw status * diff --git a/ipa/core/src/wlan_ipa_main.c b/ipa/core/src/wlan_ipa_main.c index 43bd774118..1db9c08794 100644 --- a/ipa/core/src/wlan_ipa_main.c +++ b/ipa/core/src/wlan_ipa_main.c @@ -29,6 +29,17 @@ static struct wlan_ipa_config *g_ipa_config; static bool g_ipa_hw_support; +static bool g_ipa_pld_enable = true; + +void ipa_set_pld_enable(bool flag) +{ + g_ipa_pld_enable = flag; +} + +bool ipa_get_pld_enable(void) +{ + return g_ipa_pld_enable; +} bool ipa_check_hw_present(void) { @@ -805,8 +816,16 @@ void ipa_component_config_update(struct wlan_objmgr_psoc *psoc) return; } - g_ipa_config->ipa_config = - cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG); + if (g_ipa_pld_enable) { + g_ipa_config->ipa_config = cfg_get(psoc, + CFG_DP_IPA_OFFLOAD_CONFIG); + ipa_info("IPA ini configuration: 0x%x", + g_ipa_config->ipa_config); + } else { + g_ipa_config->ipa_config = 0; + ipa_info("IPA disabled from platform driver"); + } + g_ipa_config->desc_size = cfg_get(psoc, CFG_DP_IPA_DESC_SIZE); g_ipa_config->txbuf_count = diff --git a/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h b/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h index e8df159600..d2e1207a1d 100644 --- a/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h +++ b/ipa/dispatcher/inc/wlan_ipa_ucfg_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -31,6 +31,21 @@ #ifdef IPA_OFFLOAD +/** + * ucfg_ipa_set_pld_enable() - set g_ipa_pld_enable + * @flag: flag to set g_ipa_pld_enable + * + * Return: None + */ +void ucfg_ipa_set_pld_enable(bool flag); + +/** + * ucfg_ipa_get_pld_enable() - check if IPA is disabled in pld + * + * Return: g_ipa_pld_enable + */ +bool ucfg_ipa_get_pld_enable(void); + /** * ucfg_ipa_is_present() - get IPA hw status * @@ -435,6 +450,14 @@ void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx, void ucfg_ipa_flush_pending_vdev_events(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id); #else +static inline void ucfg_ipa_set_pld_enable(bool flag) +{ +} + +static inline bool ucfg_ipa_get_pld_enable(void) +{ + return true; +} static inline bool ucfg_ipa_is_present(void) { diff --git a/ipa/dispatcher/src/wlan_ipa_ucfg_api.c b/ipa/dispatcher/src/wlan_ipa_ucfg_api.c index ab41b066de..aa3c910e23 100644 --- a/ipa/dispatcher/src/wlan_ipa_ucfg_api.c +++ b/ipa/dispatcher/src/wlan_ipa_ucfg_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -25,6 +25,20 @@ #include "cfg_ucfg_api.h" #include "qdf_module.h" +void ucfg_ipa_set_pld_enable(bool flag) +{ + ipa_set_pld_enable(flag); +} + +qdf_export_symbol(ucfg_ipa_set_pld_enable); + +bool ucfg_ipa_get_pld_enable(void) +{ + return ipa_get_pld_enable(); +} + +qdf_export_symbol(ucfg_ipa_get_pld_enable); + bool ucfg_ipa_is_present(void) { return ipa_is_hw_support(); diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index fd5357cea5..a3dcde6a13 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -17,6 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include "wlan_ipa_ucfg_api.h" #if defined(CONFIG_HL_SUPPORT) #include "wlan_tgt_def_config_hl.h" #else @@ -1719,8 +1720,16 @@ static void wlan_soc_ipa_cfg_attach(struct cdp_ctrl_objmgr_psoc *psoc, struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) { - wlan_cfg_ctx->ipa_enabled = (cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG) & - WLAN_CFG_IPA_ENABLE_MASK); + if (ucfg_ipa_get_pld_enable()) { + wlan_cfg_ctx->ipa_enabled = + (cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG) & + WLAN_CFG_IPA_ENABLE_MASK); + dp_info("is IPA enabled from ini: %d", + wlan_cfg_ctx->ipa_enabled); + } else { + wlan_cfg_ctx->ipa_enabled = false; + dp_info("IPA disabled from platform driver"); + } wlan_cfg_ctx->ipa_tx_ring_size = cfg_get(psoc, CFG_DP_IPA_TX_RING_SIZE); wlan_cfg_ctx->ipa_tx_comp_ring_size = @@ -1743,8 +1752,16 @@ static void wlan_soc_ipa_cfg_attach(struct cdp_ctrl_objmgr_psoc *psoc, struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) { - wlan_cfg_ctx->ipa_enabled = (cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG) & - WLAN_CFG_IPA_ENABLE_MASK); + if (ucfg_ipa_get_pld_enable()) { + wlan_cfg_ctx->ipa_enabled = + (cfg_get(psoc, CFG_DP_IPA_OFFLOAD_CONFIG) & + WLAN_CFG_IPA_ENABLE_MASK); + dp_info("is IPA enabled from ini: %d", + wlan_cfg_ctx->ipa_enabled); + } else { + wlan_cfg_ctx->ipa_enabled = false; + dp_info("IPA disabled from platform driver"); + } wlan_cfg_ctx->ipa_tx_ring_size = cfg_get(psoc, CFG_DP_IPA_TX_RING_SIZE); wlan_cfg_ctx->ipa_tx_comp_ring_size =