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
这个提交包含在:
@@ -182,7 +182,8 @@ QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
|
||||
* operation and nbuf has done ipa smmu map before,
|
||||
* do ipa smmu unmap as well.
|
||||
*/
|
||||
if (!qdf_atomic_read(&soc->ipa_pipes_enabled)) {
|
||||
if (!(qdf_atomic_read(&soc->ipa_pipes_enabled) &&
|
||||
qdf_atomic_read(&soc->ipa_map_allowed))) {
|
||||
if (!create && qdf_nbuf_is_rx_ipa_smmu_map(nbuf)) {
|
||||
DP_STATS_INC(soc, rx.err.ipa_unmap_no_pipe, 1);
|
||||
} else {
|
||||
@@ -382,7 +383,7 @@ QDF_STATUS dp_ipa_set_smmu_mapped(struct cdp_soc_t *soc_hdl, int val)
|
||||
{
|
||||
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
|
||||
|
||||
qdf_atomic_set(&soc->ipa_mapped, val);
|
||||
qdf_atomic_set(&soc->ipa_map_allowed, val);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -390,7 +391,7 @@ int dp_ipa_get_smmu_mapped(struct cdp_soc_t *soc_hdl)
|
||||
{
|
||||
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
|
||||
|
||||
return qdf_atomic_read(&soc->ipa_mapped);
|
||||
return qdf_atomic_read(&soc->ipa_map_allowed);
|
||||
}
|
||||
|
||||
static QDF_STATUS dp_ipa_get_shared_mem_info(qdf_device_t osdev,
|
||||
@@ -3467,9 +3468,9 @@ QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
|
||||
DP_IPA_EP_SET_TX_DB_PA(soc, ipa_res);
|
||||
|
||||
if (!ipa_config_is_opt_wifi_dp_enabled()) {
|
||||
qdf_atomic_set(&soc->ipa_map_allowed, 1);
|
||||
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, true,
|
||||
__func__, __LINE__);
|
||||
qdf_atomic_set(&soc->ipa_mapped, 1);
|
||||
}
|
||||
|
||||
result = qdf_ipa_wdi_enable_pipes(hdl);
|
||||
@@ -3479,9 +3480,11 @@ 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);
|
||||
if (qdf_atomic_read(&soc->ipa_mapped))
|
||||
if (qdf_atomic_read(&soc->ipa_map_allowed)) {
|
||||
qdf_atomic_set(&soc->ipa_map_allowed, 0);
|
||||
dp_ipa_handle_rx_buf_pool_smmu_mapping(
|
||||
soc, pdev, false, __func__, __LINE__);
|
||||
}
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
@@ -3528,9 +3531,11 @@ QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
|
||||
|
||||
qdf_atomic_set(&soc->ipa_pipes_enabled, 0);
|
||||
|
||||
if (qdf_atomic_read(&soc->ipa_mapped))
|
||||
if (!ipa_config_is_opt_wifi_dp_enabled()) {
|
||||
qdf_atomic_set(&soc->ipa_map_allowed, 0);
|
||||
dp_ipa_handle_rx_buf_pool_smmu_mapping(soc, pdev, false,
|
||||
__func__, __LINE__);
|
||||
}
|
||||
|
||||
return result ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
在新工单中引用
屏蔽一个用户