[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220519192443.28681-1-mans@mansr.com>
Date: Thu, 19 May 2022 20:24:43 +0100
From: Mans Rullgard <mans@...sr.com>
To: Pantelis Antoniou <pantelis.antoniou@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Vitaly Bordug <vbordug@...mvista.com>,
Dan Malek <dan@...eddededge.com>,
Joakim Tjernlund <joakim.tjernlund@...entis.se>,
Christophe Leroy <christophe.leroy@....fr>,
linuxppc-dev@...ts.ozlabs.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: fs_enet: sync rx dma buffer before reading
The dma_sync_single_for_cpu() call must precede reading the received
data. Fix this.
Fixes: 070e1f01827c ("net: fs_enet: don't unmap DMA when packet len is below copybreak")
Signed-off-by: Mans Rullgard <mans@...sr.com>
---
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index b3dae17e067e..432ce10cbfd0 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -240,14 +240,14 @@ static int fs_enet_napi(struct napi_struct *napi, int budget)
/* +2 to make IP header L1 cache aligned */
skbn = netdev_alloc_skb(dev, pkt_len + 2);
if (skbn != NULL) {
+ dma_sync_single_for_cpu(fep->dev,
+ CBDR_BUFADDR(bdp),
+ L1_CACHE_ALIGN(pkt_len),
+ DMA_FROM_DEVICE);
skb_reserve(skbn, 2); /* align IP header */
skb_copy_from_linear_data(skb,
skbn->data, pkt_len);
swap(skb, skbn);
- dma_sync_single_for_cpu(fep->dev,
- CBDR_BUFADDR(bdp),
- L1_CACHE_ALIGN(pkt_len),
- DMA_FROM_DEVICE);
}
} else {
skbn = netdev_alloc_skb(dev, ENET_RX_FRSIZE);
--
2.35.1
Powered by blists - more mailing lists