Pārlūkot izejas kodu

qcacmn: Add support to process direct DMA event in the configured context

In the current implementation, the Direct DMA completion event is getting
processed in the tasklet context. When the Direct DMA events land on the
same processor core as the one used by the WLAN data path events, the
Direct DMA events can pre-empt the data path events as the datapath
events usually run in NAPI context. This could impact the data path
throughput when there is a high volume of frequent Direct DMA events. To
fix this, Direct DMA events can be run in work queue context based on
user configuration. Add support for the same.

Change-Id: I1a89b185c6765addc7ee725e9324025f0318d9ed
CRs-Fixed: 3276157
Shubham Pawar 2 gadi atpakaļ
vecāks
revīzija
1ac8aa1bd9

+ 21 - 0
target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-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
@@ -179,6 +180,18 @@ QDF_STATUS target_if_dbr_buf_release(struct wlan_objmgr_pdev *pdev,
  */
 QDF_STATUS target_if_dbr_update_pdev_for_hw_mode_change(
 		struct wlan_objmgr_pdev *pdev, int phy_idx);
+
+/**
+ * target_if_dbr_set_event_handler_ctx() - Set the context for
+ *                                         DBR event execution
+ * @psoc: Pointer to psoc object
+ * @dbr_handler_ctx: DBR event handler context
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS target_if_dbr_set_event_handler_ctx(
+		struct wlan_objmgr_psoc *psoc,
+		enum wmi_rx_exec_ctx dbr_handler_ctx);
 #else /* DIRECT_BUF_RX_ENABLE*/
 
 static inline QDF_STATUS
@@ -203,5 +216,13 @@ target_if_dbr_update_pdev_for_hw_mode_change(
 {
 	return QDF_STATUS_SUCCESS;
 }
+
+static inline QDF_STATUS
+target_if_dbr_set_event_handler_ctx(
+		struct wlan_objmgr_psoc *psoc,
+		enum wmi_rx_exec_ctx dbr_handler_ctx)
+{
+	return QDF_STATUS_SUCCESS;
+}
 #endif /* DIRECT_BUF_RX_ENABLE */
 #endif /* _TARGET_IF_DIRECT_BUF_RX_API_H_ */

+ 33 - 0
target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017-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
@@ -266,3 +267,35 @@ QDF_STATUS target_if_dbr_update_pdev_for_hw_mode_change(
 
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS target_if_dbr_set_event_handler_ctx(
+		struct wlan_objmgr_psoc *psoc,
+		enum wmi_rx_exec_ctx event_handler_ctx)
+{
+	struct direct_buf_rx_psoc_obj *dbr_psoc_obj;
+
+	if (!psoc) {
+		direct_buf_rx_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (event_handler_ctx != WMI_RX_UMAC_CTX &&
+	    event_handler_ctx != WMI_RX_WORK_CTX) {
+		qdf_err("DBR handler context: Invalid context");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	dbr_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(
+			psoc, WLAN_TARGET_IF_COMP_DIRECT_BUF_RX);
+	if (!dbr_psoc_obj) {
+		direct_buf_rx_err("dir buf rx psoc object is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	dbr_psoc_obj->handler_ctx = event_handler_ctx;
+
+	direct_buf_rx_info("DBR handler context: %d",
+			   dbr_psoc_obj->handler_ctx);
+
+	return QDF_STATUS_SUCCESS;
+}

+ 13 - 1
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

@@ -823,6 +823,8 @@ QDF_STATUS target_if_direct_buf_rx_psoc_create_handler(
 		goto attach_error;
 	}
 
+	dbr_psoc_obj->handler_ctx = WMI_RX_UMAC_CTX;
+
 	return status;
 
 attach_error:
@@ -2358,18 +2360,28 @@ QDF_STATUS target_if_direct_buf_rx_register_events(
 				struct wlan_objmgr_psoc *psoc)
 {
 	QDF_STATUS ret;
+	struct direct_buf_rx_psoc_obj *dbr_psoc_obj;
 
 	if (!psoc || !GET_WMI_HDL_FROM_PSOC(psoc)) {
 		direct_buf_rx_err("psoc or psoc->tgt_if_handle is null");
 		return QDF_STATUS_E_INVAL;
 	}
+	dbr_psoc_obj = wlan_objmgr_psoc_get_comp_private_obj(
+			psoc,
+			WLAN_TARGET_IF_COMP_DIRECT_BUF_RX);
+
+	if (!dbr_psoc_obj) {
+		direct_buf_rx_err("dir buf rx psoc object is null");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	ret = wmi_unified_register_event_handler(
 			get_wmi_unified_hdl_from_psoc(psoc),
 			wmi_dma_buf_release_event_id,
 			target_if_direct_buf_rx_rsp_event_handler,
-			WMI_RX_UMAC_CTX);
+			dbr_psoc_obj->handler_ctx);
 
+	direct_buf_rx_info("DBR Handler Context %d", dbr_psoc_obj->handler_ctx);
 	if (QDF_IS_STATUS_ERROR(ret))
 		direct_buf_rx_debug("event handler not supported, ret=%d", ret);
 

+ 2 - 0
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h

@@ -218,6 +218,7 @@ struct direct_buf_rx_pdev_obj {
  * @mem_list: list for holding the large memories during the entire
  *  PSOC lifetime
  * @mem_list_lock: spin lock for the memory list
+ * handler_ctx: Direct DMA event handler context
  */
 struct direct_buf_rx_psoc_obj {
 	void *hal_soc;
@@ -227,6 +228,7 @@ struct direct_buf_rx_psoc_obj {
 	qdf_list_t mem_list[WLAN_UMAC_MAX_PDEVS];
 	qdf_spinlock_t mem_list_lock;
 #endif
+	enum wmi_rx_exec_ctx handler_ctx;
 };
 
 /**

+ 0 - 1
wmi/inc/wmi_unified_api.h

@@ -156,7 +156,6 @@ enum wmi_target_type {
  * @WMI_RX_UMAC_CTX: execution context provided by umac layer
  * @WMI_RX_SERIALIZER_CTX: Execution context is serialized thread context
  * @WMI_RX_DIAG_WORK_CTX: work queue execution context for FW diag events
- *
  */
 enum wmi_rx_exec_ctx {
 	WMI_RX_WORK_CTX,