From a47dca38720acd2e0a0e7479db742b950f075ed9 Mon Sep 17 00:00:00 2001 From: Will Huang Date: Fri, 19 Oct 2018 14:04:41 +0800 Subject: [PATCH] qcacld-3.0: Map as QDF_DMA_BIDIRECTIONAL for PMF tx frame Some target which support sending mgmt frame based on htt would DMA write this PMF tx frame buffer, it may cause smmu check permission fault, set a flag to do special DMA map. Change-Id: I3686be211374d2c316726fa3248dedce87c3faed CRs-Fixed: 2332329 --- core/dp/htt/htt_tx.c | 5 ++++- core/wma/src/wma_data.c | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/dp/htt/htt_tx.c b/core/dp/htt/htt_tx.c index c4cd40cad0cd..65008772f6ae 100644 --- a/core/dp/htt/htt_tx.c +++ b/core/dp/htt/htt_tx.c @@ -1732,6 +1732,7 @@ htt_tx_desc_init(htt_pdev_handle pdev, bool desc_ext_required = (type != EXT_HEADER_NOT_PRESENT); int channel_freq; void *qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + qdf_dma_dir_t dir; QDF_STATUS status; if (qdf_unlikely(!qdf_ctx)) { @@ -1861,7 +1862,9 @@ htt_tx_desc_init(htt_pdev_handle pdev, 0); if (QDF_NBUF_CB_PADDR(msdu) == 0) { - status = qdf_nbuf_map_single(qdf_ctx, msdu, QDF_DMA_TO_DEVICE); + dir = QDF_NBUF_CB_TX_DMA_BI_MAP(msdu) ? + QDF_DMA_BIDIRECTIONAL : QDF_DMA_TO_DEVICE; + status = qdf_nbuf_map_single(qdf_ctx, msdu, dir); if (qdf_unlikely(status != QDF_STATUS_SUCCESS)) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: nbuf map failed", __func__); diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index 99b7e887865e..7f07f986b77f 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -2549,6 +2549,13 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen, frmLen = newFrmLen; pFc = (tpSirMacFrameCtl) (qdf_nbuf_data(tx_frame)); } + /* + * Some target which support sending mgmt frame based on htt + * would DMA write this PMF tx frame buffer, it may cause smmu + * check permission fault, set a flag to do bi-direction DMA + * map, normal tx unmap is enough for this case. + */ + QDF_NBUF_CB_TX_DMA_BI_MAP((qdf_nbuf_t)tx_frame) = 1; } #endif /* WLAN_FEATURE_11W */ mHdr = (tpSirMacMgmtHdr)qdf_nbuf_data(tx_frame);