Skip to content

Commit 3b60400

Browse files
Eugeniy PaltsevZhengShunQian
authored andcommitted
NET: stmmac: align DMA stuff to largest cache line length
[ Upstream commit 9939a46 ] As for today STMMAC_ALIGN macro (which is used to align DMA stuff) relies on L1 line length (L1_CACHE_BYTES). This isn't correct in case of system with several cache levels which might have L1 cache line length smaller than L2 line. This can lead to sharing one cache line between DMA buffer and other data, so we can lose this data while invalidate DMA buffer before DMA transaction. Fix that by using SMP_CACHE_BYTES instead of L1_CACHE_BYTES for aligning. Signed-off-by: Eugeniy Paltsev <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f603701 commit 3b60400

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include <linux/reset.h>
5555
#include <linux/of_mdio.h>
5656

57-
#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
57+
#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES)
5858

5959
/* Module parameters */
6060
#define TX_TIMEO 5000

0 commit comments

Comments
 (0)