summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2022-05-22 15:52:51 +0300
committerXiaobo Xie <xiaobo.xie@nxp.com>2022-05-26 08:18:26 +0200
commit0f79a180f4273c225defddfc145bfc84ef841844 (patch)
tree470a91f0f6f07fccd3cdf41f24e169f969ccab15 /drivers
parentf25c6abbe19e23357d4a800d1a52485df6eb19e6 (diff)
dpaa2-eth: unmap the SGT buffer before accessing its contents
DMA unmap the Scatter/Gather table before going through the array to unmap and free each of the header and data chunks. This is so we do not touch the data between the dma_map and dma_unmap calls. Fixes: 3dc709e0cd47 ("dpaa2-eth: add support for software TSO") Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit 0a09c5b8cb8f75344da7d90c771b84f7cdeaea04) Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index e9cefdd72ede..d818d23d2ce5 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -1156,6 +1156,10 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv,
sgt = (struct dpaa2_sg_entry *)(buffer_start +
priv->tx_data_offset);
+ /* Unmap the SGT buffer */
+ dma_unmap_single(dev, fd_addr, swa->tso.sgt_size,
+ DMA_BIDIRECTIONAL);
+
/* Unmap and free the header */
tso_hdr = dpaa2_iova_to_virt(priv->iommu_domain, dpaa2_sg_get_addr(sgt));
dma_unmap_single(dev, dpaa2_sg_get_addr(sgt), TSO_HEADER_SIZE,
@@ -1167,10 +1171,6 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv,
dma_unmap_single(dev, dpaa2_sg_get_addr(&sgt[i]),
dpaa2_sg_get_len(&sgt[i]), DMA_TO_DEVICE);
- /* Unmap the SGT buffer */
- dma_unmap_single(dev, fd_addr, swa->tso.sgt_size,
- DMA_BIDIRECTIONAL);
-
if (!swa->tso.is_last_fd)
should_free_skb = 0;
} else {