diff --git a/target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h b/target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h index def95e404a..7654776fd2 100644 --- a/target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h +++ b/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_ */ diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c index e4f0f7f9d9..6f259114bf 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c +++ b/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; +} diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index 34fc90996e..7c77ea83ac 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/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); diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h index f4ea209a6f..231f7cc3c1 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.h +++ b/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; }; /** diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index dd5a6d2595..c8058498e1 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/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,