qcacmn: Fix race condition during IPA map/unmap handling

While Rx buffers are getting umapped from net rx context if IPA
pipes are enabled at same time from MC thread context this is
leading to race condition and IPA map/unmap is going out of sync.

To fix this introducing IPA mapping lock and IPA mapping need to
be handled with lock held.

Change-Id: I9fa71bdb6d4e4aa93fc795cc5dd472a181325991
CRs-Fixed: 2945063
This commit is contained in:
Karthik Kantamneni
2021-05-20 11:14:32 +05:30
committato da Madan Koyyalamudi
parent 7d79770907
commit cfbfcf3b21
7 ha cambiato i file con 174 aggiunte e 0 eliminazioni

Vedi File

@@ -294,6 +294,65 @@ QDF_STATUS dp_ipa_tx_buf_smmu_mapping(
QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(
struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
#ifndef QCA_OL_DP_SRNG_LOCK_LESS_ACCESS
static inline void
dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
{
if (soc->ipa_rx_buf_map_lock_initialized)
qdf_spin_lock_bh(&soc->ipa_rx_buf_map_lock);
}
static inline void
dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
{
if (soc->ipa_rx_buf_map_lock_initialized)
qdf_spin_unlock_bh(&soc->ipa_rx_buf_map_lock);
}
static inline void
dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
if (!soc->ipa_reo_ctx_lock_required[reo_ring_num])
return;
qdf_spin_lock_bh(&soc->ipa_rx_buf_map_lock);
}
static inline void
dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
if (!soc->ipa_reo_ctx_lock_required[reo_ring_num])
return;
qdf_spin_unlock_bh(&soc->ipa_rx_buf_map_lock);
}
#else
static inline void
dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
{
}
static inline void
dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
{
}
static inline void
dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
}
static inline void
dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
}
#endif
#else
static inline int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev)
{
@@ -319,6 +378,28 @@ static inline QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
return QDF_STATUS_SUCCESS;
}
static inline void
dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
{
}
static inline void
dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
{
}
static inline void
dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
}
static inline void
dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
uint32_t reo_ring_num)
{
}
static inline qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc,
qdf_nbuf_t nbuf)
{