qcacmn: Modify IPA object cleanup path

Currently ipa object cleanup is happening as part of pdev destroy.
Move it to deinit API of IPA

Change-Id: Id36648397102fa47ad1d29f99f2f152f40663f36
This commit is contained in:
Himanshu Batra 2021-09-30 13:06:39 +05:30 committed by Madan Koyyalamudi
parent 78fb9d70d7
commit a83d7d4111
8 changed files with 73 additions and 4 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021 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
@ -81,6 +82,31 @@ cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
return QDF_STATUS_SUCCESS;
}
/**
* cdp_ipa_iounmap_doorbell_vaddr() - unmap IPA RX db vaddr
* @soc - data path soc handle
* @pdev_id - device instance id
*
* Unmap IPA RX db vaddr
*
* return QDF_STATUS_SUCCESS
*/
static inline QDF_STATUS
cdp_ipa_iounmap_doorbell_vaddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
{
if (!soc || !soc->ops || !soc->ops->ipa_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
"%s invalid instance", __func__);
return QDF_STATUS_E_FAILURE;
}
if (soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr)
return soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr(
soc, pdev_id);
return QDF_STATUS_SUCCESS;
}
/**
* cdp_ipa_set_active() - activate/de-ctivate IPA offload path
* @soc - data path soc handle

View File

@ -1665,6 +1665,7 @@ struct cdp_throttle_ops {
* struct cdp_ipa_ops - mcl ipa data path ops
* @ipa_get_resource:
* @ipa_set_doorbell_paddr:
* @ipa_iounmap_doorbell_vaddr: I/O unmap ipa doorbell vaddr
* @ipa_set_active:
* @ipa_op_response:
* @ipa_register_op_cb:
@ -1679,6 +1680,8 @@ struct cdp_ipa_ops {
uint8_t pdev_id);
QDF_STATUS (*ipa_set_doorbell_paddr)(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
QDF_STATUS (*ipa_iounmap_doorbell_vaddr)(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
QDF_STATUS (*ipa_set_active)(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
bool uc_active, bool is_tx);
QDF_STATUS (*ipa_op_response)(struct cdp_soc_t *soc_hdl,

View File

@ -1137,8 +1137,6 @@ static void dp_tx_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev)
soc->ipa_uc_tx_rsc.tx_buf_pool_vaddr_unaligned = NULL;
ipa_res = &pdev->ipa_resource;
if (!ipa_res->is_db_ddr_mapped)
iounmap(ipa_res->tx_comp_doorbell_vaddr);
qdf_mem_free_sgtable(&ipa_res->tx_ring.sgtable);
qdf_mem_free_sgtable(&ipa_res->tx_comp_ring.sgtable);
@ -1603,6 +1601,29 @@ QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
return QDF_STATUS_SUCCESS;
}
QDF_STATUS dp_ipa_iounmap_doorbell_vaddr(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id)
{
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_pdev *pdev =
dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
struct dp_ipa_resources *ipa_res;
if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx))
return QDF_STATUS_SUCCESS;
if (!pdev) {
dp_err("Invalid instance");
return QDF_STATUS_E_FAILURE;
}
ipa_res = &pdev->ipa_resource;
if (!ipa_res->is_db_ddr_mapped)
iounmap(ipa_res->tx_comp_doorbell_vaddr);
return QDF_STATUS_SUCCESS;
}
QDF_STATUS dp_ipa_op_response(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
uint8_t *op_msg)
{

View File

@ -86,6 +86,17 @@ QDF_STATUS dp_ipa_get_resource(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
*/
QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
/**
* dp_ipa_iounmap_doorbell_vaddr() - unmap ipa RX db vaddr
* @soc_hdl - data path soc handle
* @pdev_id - device instance id
*
* Return: none
*/
QDF_STATUS dp_ipa_iounmap_doorbell_vaddr(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
QDF_STATUS dp_ipa_uc_set_active(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
bool uc_active, bool is_tx);

View File

@ -12518,6 +12518,7 @@ static struct cdp_lflowctl_ops dp_ops_l_flowctl = {
static struct cdp_ipa_ops dp_ops_ipa = {
.ipa_get_resource = dp_ipa_get_resource,
.ipa_set_doorbell_paddr = dp_ipa_set_doorbell_paddr,
.ipa_iounmap_doorbell_vaddr = dp_ipa_iounmap_doorbell_vaddr,
.ipa_op_response = dp_ipa_op_response,
.ipa_register_op_cb = dp_ipa_register_op_cb,
.ipa_deregister_op_cb = dp_ipa_deregister_op_cb,

View File

@ -3705,6 +3705,7 @@ QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx)
if (!ipa_cb_is_ready())
return QDF_STATUS_SUCCESS;
qdf_event_destroy(&ipa_ctx->ipa_resource_comp);
if (!wlan_ipa_uc_is_enabled(ipa_ctx->config))
wlan_ipa_teardown_sys_pipe(ipa_ctx);
@ -3722,6 +3723,7 @@ QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx)
qdf_spinlock_destroy(&ipa_ctx->pm_lock);
qdf_spinlock_destroy(&ipa_ctx->q_lock);
qdf_spinlock_destroy(&ipa_ctx->enable_disable_lock);
qdf_destroy_work(0, &ipa_ctx->pm_work);
/* destroy the interface lock */
for (i = 0; i < WLAN_IPA_MAX_IFACE; i++) {
@ -4174,6 +4176,9 @@ QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx)
ipa_ctx->uc_op_work[i].msg = NULL;
}
cdp_ipa_iounmap_doorbell_vaddr(ipa_ctx->dp_soc,
ipa_ctx->dp_pdev_id);
if (true == ipa_ctx->uc_loaded) {
cdp_ipa_tx_buf_smmu_unmapping(ipa_ctx->dp_soc,
ipa_ctx->dp_pdev_id);

View File

@ -25,6 +25,7 @@
#include "wlan_ipa_core.h"
#include "wlan_ipa_tgt_api.h"
#include "cfg_ucfg_api.h"
#include "wlan_ipa_obj_mgmt_api.h"
static struct wlan_ipa_config *g_ipa_config;
static bool g_ipa_hw_support;
@ -619,6 +620,8 @@ QDF_STATUS ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
}
status = wlan_ipa_uc_ol_deinit(ipa_obj);
ipa_obj_cleanup(ipa_obj);
ipa_disable_register_cb();
out:
ipa_init_deinit_unlock();

View File

@ -67,6 +67,7 @@ ipa_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
QDF_STATUS status;
struct wlan_ipa_priv *ipa_obj;
ipa_debug("ipa pdev destroyed");
if (!ipa_config_is_enabled()) {
ipa_debug("IPA is disabled");
return QDF_STATUS_SUCCESS;
@ -85,9 +86,7 @@ ipa_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
if (QDF_IS_STATUS_ERROR(status))
ipa_err("Failed to detatch ipa pdev object");
ipa_obj_cleanup(ipa_obj);
qdf_mem_free(ipa_obj);
ipa_disable_register_cb();
return status;
}