From bdecef61b5c0047ba206258e3e79d54d7883b516 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Mon, 13 Jul 2020 13:06:08 +0530 Subject: [PATCH] qcacmn: Add wrapper functions to get the correct pdev_id Add wrapper functions to get the host pdev id from target pdev id and vice versa. Change-Id: Ib10f6f5625b4a9e1f44a13e9185de75f6df88b3c CRs-Fixed: 2711423 --- target_if/wifi_pos/inc/target_if_wifi_pos.h | 48 ++++++++++++++++++++- target_if/wifi_pos/src/target_if_wifi_pos.c | 39 ++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/target_if/wifi_pos/inc/target_if_wifi_pos.h b/target_if/wifi_pos/inc/target_if_wifi_pos.h index 093a2211ea..ee1ca3cdf9 100644 --- a/target_if/wifi_pos/inc/target_if_wifi_pos.h +++ b/target_if/wifi_pos/inc/target_if_wifi_pos.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017, 2019-2020 The Linux Foundation. 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 @@ -119,4 +119,50 @@ static inline QDF_STATUS target_if_wifi_pos_deinit_dma_rings( } #endif +#ifndef CNSS_GENL +/** + * target_if_wifi_pos_convert_pdev_id_host_to_target: function to get target + * pdev_id from host pdev_id + * @psoc: pointer to psoc object + * @host_pdev_id: host pdev id + * @target_pdev_id: target pdev id + * + * Return: QDF_STATUS_SUCCESS in case of success, error codes in + * case of failure + */ +QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target( + struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id, + uint32_t *target_pdev_id); + +/** + * target_if_wifi_pos_convert_pdev_id_target_to_host: function to get host + * pdev_id from target pdev_id + * @psoc: pointer to psoc object + * @target_pdev_id: target pdev id + * @host_pdev_id: host pdev id + * + * Return: QDF_STATUS_SUCCESS in case of success, error codes in + * case of failure + */ +QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host( + struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id, + uint32_t *host_pdev_id); + +#else + +static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target( + struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id, + uint32_t *target_pdev_id) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host( + struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id, + uint32_t *host_pdev_id) +{ + return QDF_STATUS_SUCCESS; +} +#endif /* CNSS_GENL */ + #endif /* _WIFI_POS_TGT_IF_H_ */ diff --git a/target_if/wifi_pos/src/target_if_wifi_pos.c b/target_if/wifi_pos/src/target_if_wifi_pos.c index 83d35e113f..0ccc0d3ea8 100644 --- a/target_if/wifi_pos/src/target_if_wifi_pos.c +++ b/target_if/wifi_pos/src/target_if_wifi_pos.c @@ -176,7 +176,7 @@ static int target_if_wifi_pos_oem_rsp_ev_handler(ol_scn_t scn, return QDF_STATUS_NOT_INITIALIZED; } - priv_obj = wifi_pos_get_psoc_priv_obj(psoc); + priv_obj = wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc()); if (!priv_obj) { target_if_err("priv_obj is null"); wlan_objmgr_psoc_release_ref(psoc, WLAN_WIFI_POS_TGT_IF_ID); @@ -316,6 +316,11 @@ void target_if_wifi_pos_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_wifi_pos_register_events; wifi_pos_tx_ops->wifi_pos_deregister_events = target_if_wifi_pos_deregister_events; + wifi_pos_tx_ops->wifi_pos_convert_pdev_id_host_to_target = + target_if_wifi_pos_convert_pdev_id_host_to_target; + wifi_pos_tx_ops->wifi_pos_convert_pdev_id_target_to_host = + target_if_wifi_pos_convert_pdev_id_target_to_host; + } inline struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops( @@ -411,6 +416,38 @@ QDF_STATUS target_if_wifi_pos_deregister_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } +#ifndef CNSS_GENL +QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target( + struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id, + uint32_t *target_pdev_id) +{ + wmi_unified_t wmi_hdl = GET_WMI_HDL_FROM_PSOC(psoc); + + if (!wmi_hdl) { + target_if_err("null wmi_hdl"); + return QDF_STATUS_E_NULL_VALUE; + } + + return wmi_convert_pdev_id_host_to_target(wmi_hdl, host_pdev_id, + target_pdev_id); +} + +QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host( + struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id, + uint32_t *host_pdev_id) +{ + wmi_unified_t wmi_hdl = GET_WMI_HDL_FROM_PSOC(psoc); + + if (!wmi_hdl) { + target_if_err("null wmi_hdl"); + return QDF_STATUS_E_NULL_VALUE; + } + + return wmi_convert_pdev_id_target_to_host(wmi_hdl, target_pdev_id, + host_pdev_id); +} +#endif /* CNSS_GENL */ + #ifdef WLAN_FEATURE_CIF_CFR static QDF_STATUS target_if_wifi_pos_fill_ring(uint8_t ring_idx, struct hal_srng *srng,