From 721fccdad5f505333ab68554e3e35be70c7278fd Mon Sep 17 00:00:00 2001 From: Debasis Das Date: Tue, 1 Sep 2020 12:25:12 +0530 Subject: [PATCH] qcacmn: For me pkts, unmap buffer that holds dest mac Before freeing me packets, the buffer holding the dest mac address must be unmapped. Change-Id: I551666efb0a17245d7d654cdf362a470410ceda4 --- dp/wifi3.0/dp_tx_desc.h | 17 ++++++++++++++++- dp/wifi3.0/dp_types.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h index a4263c6da95b..cdc1f4c25e32 100644 --- a/dp/wifi3.0/dp_tx_desc.h +++ b/dp/wifi3.0/dp_tx_desc.h @@ -988,7 +988,8 @@ dp_tx_me_alloc_buf(struct dp_pdev *pdev) } /* - * dp_tx_me_free_buf() - Free me descriptor and add it to pool + * dp_tx_me_free_buf() - Unmap the buffer holding the dest + * address, free me descriptor and add it to the free-pool * @pdev: DP_PDEV handle for datapath * @buf : Allocated ME BUF * @@ -997,6 +998,20 @@ dp_tx_me_alloc_buf(struct dp_pdev *pdev) static inline void dp_tx_me_free_buf(struct dp_pdev *pdev, struct dp_tx_me_buf_t *buf) { + /* + * If the buf containing mac address was mapped, + * it must be unmapped before freeing the me_buf. + * The "paddr_macbuf" member in the me_buf structure + * holds the mapped physical address and it must be + * set to 0 after unmapping. + */ + if (buf->paddr_macbuf) { + qdf_mem_unmap_nbytes_single(pdev->soc->osdev, + buf->paddr_macbuf, + QDF_DMA_TO_DEVICE, + QDF_MAC_ADDR_SIZE); + buf->paddr_macbuf = 0; + } qdf_spin_lock_bh(&pdev->tx_mutex); buf->next = pdev->me_buf.freelist; pdev->me_buf.freelist = buf; diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 78ac9e43ab0c..da81133a784a 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2781,12 +2781,14 @@ struct dp_invalid_peer_msg { * dp_tx_me_buf_t: ME buffer * next: pointer to next buffer * data: Destination Mac address + * paddr_macbuf: physical address for dest_mac */ struct dp_tx_me_buf_t { /* Note: ME buf pool initialization logic expects next pointer to * be the first element. Dont add anything before next */ struct dp_tx_me_buf_t *next; uint8_t data[QDF_MAC_ADDR_SIZE]; + qdf_dma_addr_t paddr_macbuf; }; #if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)