qcacmn: Debug framework for SMMU buffer tracker for IPA offload

Debug framework for tracking the SMMU mapping and unmapping of
skb buffer when IPA offload is enable and IPA_SMMU_NBUF_TRACKER
is define.

CRs-Fixed: 3255423
change-Id: I8966097945b33cb866f4642b98b3d1a4beabfad7
This commit is contained in:
Devender Kumar
2022-08-12 13:26:42 +05:30
committed by Madan Koyyalamudi
parent c84505ec7b
commit a85ce1152c
8 changed files with 110 additions and 63 deletions

View File

@@ -684,13 +684,16 @@ cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
* buffers allocated to IPA
* @soc: data path soc handle
* @pdev_id: device instance id
* @line: line number
* @func: function name
*
* Create SMMU mappings for Tx buffers allocated to IPA
*
* return QDF_STATUS_SUCCESS
*/
static inline QDF_STATUS
cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id,
const char *func, uint32_t line)
{
if (!soc || !soc->ops || !soc->ops->ipa_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -699,7 +702,9 @@ cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
}
if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping)
return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id);
return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id,
func,
line);
return QDF_STATUS_SUCCESS;
}
@@ -709,13 +714,16 @@ cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
* buffers allocated to IPA
* @soc: data path soc handle
* @pdev_id: device instance id
* @line: line number
* @func: function name
*
* Release SMMU mappings for Tx buffers allocated to IPA
*
* return QDF_STATUS_SUCCESS
*/
static inline QDF_STATUS
cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id,
const char *func, uint32_t line)
{
if (!soc || !soc->ops || !soc->ops->ipa_ops) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
@@ -725,7 +733,9 @@ cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping)
return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc,
pdev_id);
pdev_id,
func,
line);
return QDF_STATUS_SUCCESS;
}

View File

@@ -1965,9 +1965,13 @@ struct cdp_ipa_ops {
bool (*ipa_rx_intrabss_fwd)(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
qdf_nbuf_t nbuf, bool *fwd_success);
QDF_STATUS (*ipa_tx_buf_smmu_mapping)(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
uint8_t pdev_id,
const char *func,
uint32_t line);
QDF_STATUS (*ipa_tx_buf_smmu_unmapping)(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id);
uint8_t pdev_id,
const char *func,
uint32_t line);
#ifdef IPA_WDS_EASYMESH_FEATURE
QDF_STATUS (*ipa_ast_create)(struct cdp_soc_t *soc_hdl,
qdf_ipa_ast_info_type_t *data);

View File

@@ -110,7 +110,9 @@ static void dp_ipa_reo_remap_history_add(uint32_t ix0_val, uint32_t ix2_val,
static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_t nbuf,
uint32_t size,
bool create)
bool create,
const char *func,
uint32_t line)
{
qdf_mem_info_t mem_map_table = {0};
QDF_STATUS ret = QDF_STATUS_SUCCESS;
@@ -133,11 +135,11 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
/* Assert if PA is zero */
qdf_assert_always(mem_map_table.pa);
ret = qdf_ipa_wdi_create_smmu_mapping(hdl, 1,
&mem_map_table);
ret = qdf_nbuf_smmu_map_debug(nbuf, hdl, 1, &mem_map_table,
func, line);
} else {
ret = qdf_ipa_wdi_release_smmu_mapping(hdl, 1,
&mem_map_table);
ret = qdf_nbuf_smmu_unmap_debug(nbuf, hdl, 1, &mem_map_table,
func, line);
}
qdf_assert_always(!ret);
@@ -156,7 +158,8 @@ static QDF_STATUS __dp_ipa_handle_buf_smmu_mapping(struct dp_soc *soc,
QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_t nbuf,
uint32_t size,
bool create)
bool create, const char *func,
uint32_t line)
{
struct dp_pdev *pdev;
int i;
@@ -195,13 +198,16 @@ QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_set_rx_ipa_smmu_map(nbuf, create);
return __dp_ipa_handle_buf_smmu_mapping(soc, nbuf, size, create);
return __dp_ipa_handle_buf_smmu_mapping(soc, nbuf, size, create,
func, line);
}
static QDF_STATUS __dp_ipa_tx_buf_smmu_mapping(
struct dp_soc *soc,
struct dp_pdev *pdev,
bool create)
bool create,
const char *func,
uint32_t line)
{
uint32_t index;
QDF_STATUS ret = QDF_STATUS_SUCCESS;
@@ -221,7 +227,7 @@ static QDF_STATUS __dp_ipa_tx_buf_smmu_mapping(
continue;
buf_len = qdf_nbuf_get_data_len(nbuf);
ret = __dp_ipa_handle_buf_smmu_mapping(soc, nbuf, buf_len,
create);
create, func, line);
}
return ret;
@@ -252,7 +258,9 @@ static void dp_ipa_set_reo_ctx_mapping_lock_required(struct dp_soc *soc,
#ifdef RX_DESC_MULTI_PAGE_ALLOC
static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(struct dp_soc *soc,
struct dp_pdev *pdev,
bool create)
bool create,
const char *func,
uint32_t line)
{
struct rx_desc_pool *rx_pool;
uint8_t pdev_id;
@@ -301,8 +309,9 @@ static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(struct dp_soc *soc,
}
qdf_nbuf_set_rx_ipa_smmu_map(nbuf, create);
ret = __dp_ipa_handle_buf_smmu_mapping(
soc, nbuf, rx_pool->buf_size, create);
ret = __dp_ipa_handle_buf_smmu_mapping(soc, nbuf,
rx_pool->buf_size,
create, func, line);
}
dp_ipa_rx_buf_smmu_mapping_unlock(soc);
qdf_spin_unlock_bh(&rx_pool->lock);
@@ -311,9 +320,12 @@ static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(struct dp_soc *soc,
return ret;
}
#else
static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(struct dp_soc *soc,
static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(
struct dp_soc *soc,
struct dp_pdev *pdev,
bool create)
bool create,
const char *func,
uint32_t line)
{
struct rx_desc_pool *rx_pool;
uint8_t pdev_id;
@@ -352,8 +364,8 @@ static QDF_STATUS dp_ipa_handle_rx_buf_pool_smmu_mapping(struct dp_soc *soc,
}
qdf_nbuf_set_rx_ipa_smmu_map(nbuf, create);
__dp_ipa_handle_buf_smmu_mapping(soc, nbuf,
rx_pool->buf_size, create);
__dp_ipa_handle_buf_smmu_mapping(soc, nbuf, rx_pool->buf_size,
create, func, line);
}
dp_ipa_rx_buf_smmu_mapping_unlock(soc);
qdf_spin_unlock_bh(&rx_pool->lock);
@@ -711,7 +723,8 @@ static void dp_ipa_unmap_ring_doorbell_paddr(struct dp_pdev *pdev)
static QDF_STATUS dp_ipa_tx_alt_buf_smmu_mapping(struct dp_soc *soc,
struct dp_pdev *pdev,
bool create)
bool create, const char *func,
uint32_t line)
{
QDF_STATUS ret = QDF_STATUS_SUCCESS;
struct ipa_dp_tx_rsc *rsc;
@@ -734,8 +747,8 @@ static QDF_STATUS dp_ipa_tx_alt_buf_smmu_mapping(struct dp_soc *soc,
continue;
buf_len = qdf_nbuf_get_data_len(nbuf);
ret = __dp_ipa_handle_buf_smmu_mapping(
soc, nbuf, buf_len, create);
ret = __dp_ipa_handle_buf_smmu_mapping(soc, nbuf, buf_len,
create, func, line);
}
return ret;
@@ -1017,7 +1030,9 @@ static inline void dp_ipa_unmap_ring_doorbell_paddr(struct dp_pdev *pdev)
static inline QDF_STATUS dp_ipa_tx_alt_buf_smmu_mapping(struct dp_soc *soc,
struct dp_pdev *pdev,
bool create)
bool create,
const char *func,
uint32_t line)
{
return QDF_STATUS_SUCCESS;
}
@@ -3204,7 +3219,8 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
qdf_atomic_set(&soc->ipa_pipes_enabled, 1);
DP_IPA_EP_SET_TX_DB_PA(soc, ipa_res);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true,
__func__, __LINE__);
result = qdf_ipa_wdi_enable_pipes(hdl);
if (result) {
@@ -3213,7 +3229,8 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
__func__, result);
qdf_atomic_set(&soc->ipa_pipes_enabled, 0);
DP_IPA_RESET_TX_DB_PA(soc, ipa_res);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, false);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, false,
__func__, __LINE__);
return QDF_STATUS_E_FAILURE;
}
@@ -3259,7 +3276,8 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
}
qdf_atomic_set(&soc->ipa_pipes_enabled, 0);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, false);
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, false,
__func__, __LINE__);
return result ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
}
@@ -3566,7 +3584,8 @@ qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc, qdf_nbuf_t nbuf)
}
QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
const char *func, uint32_t line)
{
QDF_STATUS ret;
@@ -3583,19 +3602,19 @@ QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
dp_debug("SMMU S1 disabled");
return QDF_STATUS_SUCCESS;
}
ret = __dp_ipa_tx_buf_smmu_mapping(soc, pdev, true);
ret = __dp_ipa_tx_buf_smmu_mapping(soc, pdev, true, func, line);
if (ret)
return ret;
ret = dp_ipa_tx_alt_buf_smmu_mapping(soc, pdev, true);
ret = dp_ipa_tx_alt_buf_smmu_mapping(soc, pdev, true, func, line);
if (ret)
__dp_ipa_tx_buf_smmu_mapping(soc, pdev, false);
__dp_ipa_tx_buf_smmu_mapping(soc, pdev, false, func, line);
return ret;
}
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
struct cdp_soc_t *soc_hdl, uint8_t pdev_id, const char *func,
uint32_t line)
{
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_pdev *pdev =
@@ -3611,8 +3630,8 @@ QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
return QDF_STATUS_SUCCESS;
}
if (__dp_ipa_tx_buf_smmu_mapping(soc, pdev, false) ||
dp_ipa_tx_alt_buf_smmu_mapping(soc, pdev, false))
if (__dp_ipa_tx_buf_smmu_mapping(soc, pdev, false, func, line) ||
dp_ipa_tx_alt_buf_smmu_mapping(soc, pdev, false, func, line))
return QDF_STATUS_E_FAILURE;
return QDF_STATUS_SUCCESS;

View File

@@ -333,38 +333,46 @@ int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev);
int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev);
int dp_ipa_ring_resource_setup(struct dp_soc *soc,
struct dp_pdev *pdev);
QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_t nbuf,
uint32_t size,
bool create);
bool dp_reo_remap_config(struct dp_soc *soc, uint32_t *remap0,
uint32_t *remap1, uint32_t *remap2);
bool dp_ipa_is_mdm_platform(void);
qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc, qdf_nbuf_t nbuf);
QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_t nbuf,
uint32_t size,
bool create,
const char *func,
uint32_t line);
/**
* dp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for IPA
* allocated TX buffers
* @soc_hdl: handle to the soc
* @pdev_id: pdev id number, to get the handle
* @func: caller function
* @line: line number
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
QDF_STATUS dp_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id, const char *func,
uint32_t line);
/**
* dp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for IPA
* allocated TX buffers
* @soc_hdl: handle to the soc
* @pdev_id: pdev id number, to get the handle
* @func: caller function
* @line: line number
*
* Return: QDF_STATUS
*/
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id, const char *func,
uint32_t line);
#ifndef QCA_OL_DP_SRNG_LOCK_LESS_ACCESS
static inline void
@@ -480,7 +488,9 @@ static inline int dp_ipa_ring_resource_setup(struct dp_soc *soc,
static inline QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
qdf_nbuf_t nbuf,
uint32_t size,
bool create)
bool create,
const char *func,
uint32_t line)
{
return QDF_STATUS_SUCCESS;
}
@@ -514,13 +524,17 @@ static inline qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc,
}
static inline QDF_STATUS dp_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id)
uint8_t pdev_id,
const char *func,
uint32_t line)
{
return QDF_STATUS_SUCCESS;
}
static inline QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
uint8_t pdev_id)
uint8_t pdev_id,
const char *func,
uint32_t line)
{
return QDF_STATUS_SUCCESS;
}

View File

@@ -253,11 +253,10 @@ dp_pdev_nbuf_alloc_and_map_replenish(struct dp_soc *dp_soc,
nbuf_frag_info_t->paddr =
qdf_nbuf_get_frag_paddr((nbuf_frag_info_t->virt_addr).nbuf, 0);
dp_ipa_handle_rx_buf_smmu_mapping(dp_soc,
(qdf_nbuf_t)((nbuf_frag_info_t->virt_addr).nbuf),
rx_desc_pool->buf_size,
true);
dp_ipa_handle_rx_buf_smmu_mapping(dp_soc, (qdf_nbuf_t)(
(nbuf_frag_info_t->virt_addr).nbuf),
rx_desc_pool->buf_size,
true, __func__, __LINE__);
ret = dp_check_paddr(dp_soc, &((nbuf_frag_info_t->virt_addr).nbuf),
&nbuf_frag_info_t->paddr,
@@ -3010,10 +3009,11 @@ dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
hal_rxdma_buff_addr_info_set(dp_soc->hal_soc ,rxdma_ring_entry, paddr,
desc_list->rx_desc.cookie,
rx_desc_pool->owner);
dp_ipa_handle_rx_buf_smmu_mapping(
dp_soc, nbuf,
rx_desc_pool->buf_size,
true);
dp_soc, nbuf,
rx_desc_pool->buf_size, true,
__func__, __LINE__);
desc_list = next;
}

View File

@@ -2544,7 +2544,7 @@ void dp_rx_nbuf_unmap(struct dp_soc *soc,
dp_ipa_reo_ctx_buf_mapping_lock(soc, reo_ring_num);
dp_ipa_handle_rx_buf_smmu_mapping(soc, rx_desc->nbuf,
rx_desc_pool->buf_size,
false);
false, __func__, __LINE__);
qdf_nbuf_unmap_nbytes_single(soc->osdev, rx_desc->nbuf,
QDF_DMA_FROM_DEVICE,
@@ -2559,7 +2559,7 @@ void dp_rx_nbuf_unmap_pool(struct dp_soc *soc,
qdf_nbuf_t nbuf)
{
dp_ipa_handle_rx_buf_smmu_mapping(soc, nbuf, rx_desc_pool->buf_size,
false);
false, __func__, __LINE__);
qdf_nbuf_unmap_nbytes_single(soc->osdev, nbuf, QDF_DMA_FROM_DEVICE,
rx_desc_pool->buf_size);
}

View File

@@ -1336,9 +1336,8 @@ static QDF_STATUS dp_rx_defrag_reo_reinject(struct dp_txrx_peer *txrx_peer,
return QDF_STATUS_E_FAILURE;
}
dp_ipa_handle_rx_buf_smmu_mapping(soc, head,
rx_desc_pool->buf_size,
true);
dp_ipa_handle_rx_buf_smmu_mapping(soc, head, rx_desc_pool->buf_size,
true, __func__, __LINE__);
/*
* As part of rx frag handler bufffer was unmapped and rx desc

View File

@@ -217,8 +217,9 @@ static void dp_rx_desc_nbuf_cleanup(struct dp_soc *soc,
while (nbuf) {
next = nbuf->next;
if (dp_ipa_handle_rx_buf_smmu_mapping(soc, nbuf, buf_size,
false))
false, __func__, __LINE__))
dp_info_rl("Unable to unmap nbuf: %pK", nbuf);
qdf_nbuf_unmap_nbytes_single(soc->osdev, nbuf,
QDF_DMA_BIDIRECTIONAL, buf_size);