Răsfoiți Sursa

qcacmn: Handle ipa_init when opt_ipa_wifi is not supported

Handle ipa_init when opt_ipa_wifi capability is not supported
by IPA subsystem.

Change-Id: I6a120589b4ba6b60a1c15420c545f4768cff047b
CRs-Fixed: 3695354
Karthik Kantamneni 1 an în urmă
părinte
comite
29002e8730

+ 9 - 1
ipa/core/inc/wlan_ipa_main.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 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
@@ -73,6 +73,14 @@ extern uint8_t g_instances_added;
 #define IPA_EXIT() \
 	QDF_TRACE_EXIT(QDF_MODULE_ID_IPA, "exit")
 
+/**
+ * ipa_set_cap_offload() - set IPA capability offload support
+ * @flag: flag to set
+ *
+ * Return: None
+ */
+void ipa_set_cap_offload(bool flag);
+
 /**
  * ipa_set_pld_enable() - set g_ipa_pld_enable
  * @flag: flag to set g_ipa_pld_enable

+ 29 - 7
ipa/core/src/wlan_ipa_core.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 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
@@ -655,14 +655,26 @@ static inline void wlan_ipa_wdi_init_metering(struct wlan_ipa_priv *ipa_ctxt,
  * @ipa_ctxt: IPA context
  * @out: IPA WDI out param
  *
- * Return: void
+ * Return: QDF_STATUS
  */
-static inline void wlan_ipa_wdi_init_set_opt_wifi_dp(
+static inline QDF_STATUS wlan_ipa_wdi_init_set_opt_wifi_dp(
 					     struct wlan_ipa_priv *ipa_ctxt,
 					     qdf_ipa_wdi_init_out_params_t *out)
 {
+	uint32_t val;
+		val = cfg_get(ipa_ctxt->pdev->pdev_objmgr.wlan_psoc,
+			      CFG_DP_IPA_OFFLOAD_CONFIG);
+
 	ipa_ctxt->opt_wifi_datapath =
 				QDF_IPA_WDI_INIT_OUT_PARAMS_OPT_WIFI_DP(out);
+	if (!ipa_ctxt->opt_wifi_datapath &&
+	    !(val & WLAN_IPA_ENABLE_MASK) &&
+	    (ipa_ctxt->config->ipa_config == INTRL_MODE_ENABLE)) {
+		ipa_err(" opt_wifi_datapath not support by IPA");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
 }
 
 /**
@@ -675,10 +687,11 @@ static inline bool wlan_ipa_opt_wifi_dp_enabled(void)
 	return true;
 }
 #else
-static inline void wlan_ipa_wdi_init_set_opt_wifi_dp(
+static inline QDF_STATUS wlan_ipa_wdi_init_set_opt_wifi_dp(
 					     struct wlan_ipa_priv *ipa_ctxt,
 					     qdf_ipa_wdi_init_out_params_t *out)
 {
+	return QDF_STATUS_SUCCESS;
 }
 
 static inline bool wlan_ipa_opt_wifi_dp_enabled(void)
@@ -739,6 +752,7 @@ static inline QDF_STATUS wlan_ipa_wdi_init(struct wlan_ipa_priv *ipa_ctx)
 {
 	qdf_ipa_wdi_init_in_params_t in;
 	qdf_ipa_wdi_init_out_params_t out;
+	QDF_STATUS status;
 	int ret;
 
 	ipa_ctx->uc_loaded = false;
@@ -763,12 +777,9 @@ static inline QDF_STATUS wlan_ipa_wdi_init(struct wlan_ipa_priv *ipa_ctx)
 	ipa_ctx->is_smmu_enabled =
 		QDF_IPA_WDI_INIT_OUT_PARAMS_IS_SMMU_ENABLED(&out);
 	ipa_ctx->hdl = QDF_IPA_WDI_INIT_OUT_PARAMS_HANDLE(&out);
-	wlan_ipa_wdi_init_set_opt_wifi_dp(ipa_ctx, &out);
 
 	ipa_info("ipa_over_gsi: %d, is_smmu_enabled: %d, handle: %d",
 		 ipa_ctx->over_gsi, ipa_ctx->is_smmu_enabled, ipa_ctx->hdl);
-	ipa_debug("opt_dp: enabled from IPA : %d",
-		  ipa_ctx->opt_wifi_datapath);
 
 	if (QDF_IPA_WDI_INIT_OUT_PARAMS_IS_UC_READY(&out)) {
 		ipa_debug("IPA uC READY");
@@ -778,6 +789,17 @@ static inline QDF_STATUS wlan_ipa_wdi_init(struct wlan_ipa_priv *ipa_ctx)
 		return QDF_STATUS_E_BUSY;
 	}
 
+	status = wlan_ipa_wdi_init_set_opt_wifi_dp(ipa_ctx, &out);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		ret = qdf_ipa_wdi_cleanup(ipa_ctx->hdl);
+		if (ret)
+			ipa_info("ipa_wdi_cleanup failed ret=%d", ret);
+		ipa_set_cap_offload(false);
+		return status;
+	}
+	ipa_debug("opt_dp: enabled from IPA : %d",
+		  ipa_ctx->opt_wifi_datapath);
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 9 - 3
ipa/core/src/wlan_ipa_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 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
@@ -30,6 +30,12 @@
 static struct wlan_ipa_config *g_ipa_config;
 static bool g_ipa_hw_support;
 static bool g_ipa_pld_enable = true;
+static bool g_ipa_cap_offload = true;
+
+void ipa_set_cap_offload(bool flag)
+{
+	g_ipa_cap_offload = flag;
+}
 
 void ipa_set_pld_enable(bool flag)
 {
@@ -38,7 +44,7 @@ void ipa_set_pld_enable(bool flag)
 
 bool ipa_get_pld_enable(void)
 {
-	return g_ipa_pld_enable;
+	return (g_ipa_pld_enable && g_ipa_cap_offload);
 }
 
 bool ipa_check_hw_present(void)
@@ -860,7 +866,7 @@ void ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
 		return;
 	}
 
-	if (g_ipa_pld_enable) {
+	if (g_ipa_pld_enable && g_ipa_cap_offload) {
 		g_ipa_config->ipa_config = get_ipa_config(psoc);
 		ipa_debug("IPA ini configuration: 0x%x",
 			  g_ipa_config->ipa_config);

+ 4 - 10
ipa/dispatcher/src/wlan_ipa_obj_mgmt_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2018, 2020-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 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
@@ -213,15 +213,14 @@ static void ipa_register_ready_cb(void *user_data)
 
 	status = ipa_obj_setup(ipa_obj);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		ipa_err("Failed to setup ipa component");
-		wlan_objmgr_pdev_component_obj_detach(pdev, WLAN_UMAC_COMP_IPA,
-						      ipa_obj);
-		qdf_mem_free(ipa_obj);
+		g_ipa_is_ready = false;
+		ipa_err("Failed to ipa_obj_setup");
 		goto out;
 	}
 	if (ucfg_ipa_uc_ol_init(pdev, qdf_dev)) {
 		ipa_err("IPA ucfg_ipa_uc_ol_init failed");
 		ipa_obj_cleanup(ipa_obj);
+		g_ipa_is_ready = false;
 		goto out;
 	}
 
@@ -318,11 +317,6 @@ QDF_STATUS ipa_deinit(void)
 		return status;
 	}
 
-	if (!ipa_config_is_enabled()) {
-		ipa_info("ipa is disabled");
-		return status;
-	}
-
 	qdf_mutex_destroy(&g_init_deinit_lock);
 
 	status = wlan_objmgr_unregister_pdev_destroy_handler(WLAN_UMAC_COMP_IPA,