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
committed by Madan Koyyalamudi
parent 7d79770907
commit cfbfcf3b21
7 changed files with 174 additions and 0 deletions

View File

@@ -2529,6 +2529,9 @@ more_data:
if (QDF_IS_STATUS_ERROR(status)) {
if (qdf_unlikely(rx_desc && rx_desc->nbuf)) {
qdf_assert_always(rx_desc->unmapped);
dp_ipa_reo_ctx_buf_mapping_lock(
soc,
reo_ring_num);
dp_ipa_handle_rx_buf_smmu_mapping(
soc,
rx_desc->nbuf,
@@ -2540,6 +2543,9 @@ more_data:
QDF_DMA_FROM_DEVICE,
RX_DATA_BUFFER_SIZE);
rx_desc->unmapped = 1;
dp_ipa_reo_ctx_buf_mapping_unlock(
soc,
reo_ring_num);
dp_rx_buffer_pool_nbuf_free(soc, rx_desc->nbuf,
rx_desc->pool_id);
dp_rx_add_to_free_desc_list(
@@ -2695,6 +2701,8 @@ more_data:
* in case double skb unmap happened.
*/
rx_desc_pool = &soc->rx_desc_buf[rx_desc->pool_id];
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);
@@ -2702,6 +2710,7 @@ more_data:
QDF_DMA_FROM_DEVICE,
rx_desc_pool->buf_size);
rx_desc->unmapped = 1;
dp_ipa_reo_ctx_buf_mapping_unlock(soc, reo_ring_num);
DP_RX_PROCESS_NBUF(soc, nbuf_head, nbuf_tail, ebuf_head,
ebuf_tail, rx_desc);
/*