Эх сурвалжийг харах

qcacmn: Separate global shmem generic APIs from REO

Changes to move the global shared memory arena init deinit
APIs from MGMT RX REO cmponent to MLO component.

CRs-Fixed: 3121467
Change-Id: Ie5ca50780ffb3343d225b6cf6acfa569463d5a3e
Shwetha G K 3 жил өмнө
parent
commit
5b9b6ffee5

+ 50 - 0
target_if/global_shmem/inc/target_if_global_shmem.h

@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 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 above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ *  DOC: target_if_global_shmem.h
+ *  This file contains declarations of global shared memory access related APIs.
+ */
+
+#ifndef _TARGET_IF_GLOBAL_SHMEM_H_
+#define _TARGET_IF_GLOBAL_SHMEM_H_
+
+#include <qdf_types.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_lmac_if_def.h>
+#include <wmi_unified_param.h>
+
+#ifdef WLAN_MLO_GLOBAL_SHMEM_SUPPORT
+static inline struct wlan_lmac_if_global_shmem_local_ops *
+target_if_get_global_shmem_local_ops(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_lmac_if_tx_ops *tx_ops;
+
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return NULL;
+	}
+
+	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
+	if (!tx_ops) {
+		target_if_err("tx_ops is NULL");
+		return NULL;
+	}
+
+	return &tx_ops->mlo_ops.shmem_local_ops;
+}
+#endif /* WLAN_MLO_GLOBAL_SHMEM_SUPPORT */
+#endif /* _TARGET_IF_GLOBAL_SHMEM_H_ */

+ 5 - 0
target_if/init_deinit/inc/mlo_global_h_shmem_arena.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 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 above
@@ -78,6 +79,7 @@ struct wlan_host_mlo_glb_h_shmem_arena_ctx {
 	qdf_atomic_t init_count;
 };
 
+#ifdef WLAN_MLO_GLOBAL_SHMEM_SUPPORT
 /**
  * mlo_glb_h_shmem_arena_ctx_init() - Initialize MLO Global shared memory arena
  * context on Host
@@ -96,7 +98,9 @@ QDF_STATUS mlo_glb_h_shmem_arena_ctx_init(void *arena_vaddr,
  * Return: QDF_STATUS of operation
  */
 QDF_STATUS mlo_glb_h_shmem_arena_ctx_deinit(void);
+#endif
 
+#ifdef WLAN_MGMT_RX_REO_SUPPORT
 /**
  * mgmt_rx_reo_get_num_links() - Get number of links to be used by MGMT Rx REO
  *
@@ -113,4 +117,5 @@ int mgmt_rx_reo_get_num_links(void);
  */
 void *mgmt_rx_reo_get_snapshot_address(
 	uint8_t link_id, enum mgmt_rx_reo_shared_snapshot_id snapshot_id);
+#endif /* WLAN_MGMT_RX_REO_SUPPORT */
 #endif

+ 16 - 1
target_if/init_deinit/inc/mlo_global_h_shmem_arena_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 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 above
@@ -26,6 +27,18 @@
 #include<qdf_types.h>
 #include<wlan_lmac_if_def.h>
 
+#ifdef WLAN_MLO_GLOBAL_SHMEM_SUPPORT
+/**
+ * global_shmem_register_wifi3_0_ops() - Register wifi3.0 operations of
+ * global shared memory access module
+ * @shmem_tx_ops: Pointer to the local ops table of global shared mem module.
+ *
+ * Return: QDF_STATUS of operation
+ */
+QDF_STATUS global_shmem_register_wifi3_0_ops(
+		struct wlan_lmac_if_global_shmem_local_ops *shmem_local_ops);
+
+#ifdef WLAN_MGMT_RX_REO_SUPPORT
 /**
  * mgmt_rx_reo_register_wifi3_0_ops() - Register wifi3.0 operations of MGMT Rx
  * REO module
@@ -38,4 +51,6 @@
  */
 QDF_STATUS mgmt_rx_reo_register_wifi3_0_ops(
 	struct wlan_lmac_if_mgmt_rx_reo_low_level_ops *reo_low_level_ops);
-#endif
+#endif /* WLAN_MGMT_RX_REO_SUPPORT */
+#endif /* WLAN_MLO_GLOBAL_SHMEM_SUPPORT */
+#endif /* _MLO_GLOBAL_H_SHMEM_ARENA_API_H_ */

+ 3 - 0
target_if/init_deinit/src/mlo_global_h_shmem_arena.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 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 above
@@ -493,6 +494,7 @@ success:
 
 qdf_export_symbol(mlo_glb_h_shmem_arena_ctx_deinit);
 
+#ifdef WLAN_MGMT_RX_REO_SUPPORT
 int mgmt_rx_reo_get_num_links(void)
 {
 	struct wlan_host_mlo_glb_h_shmem_arena_ctx *shmem_arena_ctx;
@@ -556,3 +558,4 @@ void *mgmt_rx_reo_get_snapshot_address(
 
 	return NULL;
 }
+#endif

+ 21 - 4
target_if/init_deinit/src/mlo_global_h_shmem_arena_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 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 above
@@ -21,6 +22,7 @@
  */
 #include <mlo_global_h_shmem_arena.h>
 
+#ifdef WLAN_MGMT_RX_REO_SUPPORT
 /**
  * mgmt_rx_reo_snapshot_is_valid() - Check if an MGMT Rx REO snapshot is valid
  * @snapshot_low: lower 32-bits of the snapshot
@@ -97,10 +99,6 @@ QDF_STATUS mgmt_rx_reo_register_wifi3_0_ops(
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	reo_low_level_ops->init_shmem_arena_ctx =
-		mlo_glb_h_shmem_arena_ctx_init;
-	reo_low_level_ops->deinit_shmem_arena_ctx =
-		mlo_glb_h_shmem_arena_ctx_deinit;
 	reo_low_level_ops->get_num_links = mgmt_rx_reo_get_num_links;
 	reo_low_level_ops->get_snapshot_address =
 		mgmt_rx_reo_get_snapshot_address;
@@ -119,3 +117,22 @@ QDF_STATUS mgmt_rx_reo_register_wifi3_0_ops(
 
 	return QDF_STATUS_SUCCESS;
 }
+#endif
+
+QDF_STATUS global_shmem_register_wifi3_0_ops(
+	struct wlan_lmac_if_global_shmem_local_ops *shmem_local_ops)
+{
+	if (!shmem_local_ops) {
+		target_if_err("Low level ops of global shmem is NULL");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	shmem_local_ops->init_shmem_arena_ctx =
+		mlo_glb_h_shmem_arena_ctx_init;
+	shmem_local_ops->deinit_shmem_arena_ctx =
+		mlo_glb_h_shmem_arena_ctx_deinit;
+
+	shmem_local_ops->implemented = true;
+
+	return QDF_STATUS_SUCCESS;
+}