mvneta: MVNETA_SKB_HEADROOM set last 3 bits to zero
authorSven Auhagen <sven.auhagen@voleatech.de>
Sat, 23 May 2020 10:14:08 +0000 (12:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 May 2020 00:50:01 +0000 (17:50 -0700)
For XDP the MVNETA_SKB_HEADROOM is used as an offset for
the received data.
The MVNETA manual states that the last 3 bits assumed to be 0.

This is currently the case but lets make it explicit in the definition
to prevent future problems.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvneta.c

index 37947949345c710abcc03a199fcfe86370c7aad4..15e42a7f8a86d17a5bf15407fbf46416f6e9666c 100644 (file)
              ETH_HLEN + ETH_FCS_LEN,                        \
              cache_line_size())
 
-#define MVNETA_SKB_HEADROOM    max(XDP_PACKET_HEADROOM, NET_SKB_PAD)
+/* Driver assumes that the last 3 bits are 0 */
+#define MVNETA_SKB_HEADROOM    (max(XDP_PACKET_HEADROOM, NET_SKB_PAD) & ~0x7)
 #define MVNETA_SKB_PAD (SKB_DATA_ALIGN(sizeof(struct skb_shared_info) + \
                         MVNETA_SKB_HEADROOM))
 #define MVNETA_SKB_SIZE(len)   (SKB_DATA_ALIGN(len) + MVNETA_SKB_PAD)