qcacmn: Handle ipa_mapped flag correctly to prevent race

Currently soc->ipa_mapped flag is set to true only after all
the buffers are SMMU mapped to IPA. This leads to a race
window where Rx buffers routed to WLAN HOST in the replenish
path are not mapped to IPA, as the ipa_mapped flag is still
set to 0. The fix is to set the ipa_mapped flag to 1, right when
the IPA pipes are enabled, before waiting for the complete
buffer pool to be IPA SMMU mapped.
With this fix, RX buffers can be unmapped and mapped to IPA
domain in dp_pdev_rx_buffers_attach() and
dp_pdev_nbuf_alloc_and_map_replenish() in WLAN host RX path when
ipa pipes are enabled.

This change also renames ipa_mapped flag to ipa_map_allowed.

Change-Id: Ibbe50cb211f858a3372e31644df2f5e98f99a292
CRs-Fixed: 3569745
This commit is contained in:
Namita Nair
2023-07-20 15:31:59 -07:00
committed by Rahul Choudhary
parent 1f2104b733
commit 8de279eab8
7 changed files with 41 additions and 37 deletions

View File

@@ -2763,11 +2763,9 @@ void dp_rx_nbuf_unmap(struct dp_soc *soc,
QDF_NBUF_CB_PADDR(rx_desc->nbuf),
rx_desc_pool->buf_size);
if (qdf_atomic_read(&soc->ipa_mapped))
dp_ipa_handle_rx_buf_smmu_mapping(soc, rx_desc->nbuf,
rx_desc_pool->buf_size,
false, __func__, __LINE__);
dp_ipa_handle_rx_buf_smmu_mapping(soc, rx_desc->nbuf,
rx_desc_pool->buf_size,
false, __func__, __LINE__);
qdf_nbuf_unmap_nbytes_single(soc->osdev, rx_desc->nbuf,
QDF_DMA_FROM_DEVICE,
rx_desc_pool->buf_size);
@@ -2782,10 +2780,9 @@ void dp_rx_nbuf_unmap_pool(struct dp_soc *soc,
{
dp_audio_smmu_unmap(soc->osdev, QDF_NBUF_CB_PADDR(nbuf),
rx_desc_pool->buf_size);
if (qdf_atomic_read(&soc->ipa_mapped))
dp_ipa_handle_rx_buf_smmu_mapping(soc, nbuf,
rx_desc_pool->buf_size,
false, __func__, __LINE__);
dp_ipa_handle_rx_buf_smmu_mapping(soc, nbuf,
rx_desc_pool->buf_size,
false, __func__, __LINE__);
qdf_nbuf_unmap_nbytes_single(soc->osdev, nbuf, QDF_DMA_FROM_DEVICE,
rx_desc_pool->buf_size);
}