Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] MVNETA_SKB_HEADROOM set last 3 bits to zero
@ 2020-05-23 10:14 Sven Auhagen
  2020-05-26  0:46 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Auhagen @ 2020-05-23 10:14 UTC (permalink / raw)
  To: netdev
  Cc: thomas.petazzoni, brouer, ilias.apalodimas, matteo.croce, mw,
	jakub.kicinski

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>
---
 drivers/net/ethernet/marvell/mvneta.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 51889770958d..a4a2e0340737 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -324,7 +324,8 @@
 	      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)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] MVNETA_SKB_HEADROOM set last 3 bits to zero
  2020-05-23 10:14 [PATCH 1/1] MVNETA_SKB_HEADROOM set last 3 bits to zero Sven Auhagen
@ 2020-05-26  0:46 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-26  0:46 UTC (permalink / raw)
  To: sven.auhagen
  Cc: netdev, thomas.petazzoni, brouer, ilias.apalodimas, matteo.croce,
	mw, jakub.kicinski

From: Sven Auhagen <sven.auhagen@voleatech.de>
Date: Sat, 23 May 2020 12:14:08 +0200

> 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>

Applied with "mvneta: " added to the Subject line as a proper prefix.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 10:14 [PATCH 1/1] MVNETA_SKB_HEADROOM set last 3 bits to zero Sven Auhagen
2020-05-26  0:46 ` David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git