Netdev List
 help / color / mirror / Atom feed
* [PATCH] macvlan: inherit needed_headroom/needed_tailroom from lower device
@ 2026-07-24 10:08 Mohammed Hashil M
  2026-07-24 10:53 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Hashil M @ 2026-07-24 10:08 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Mohammed Hashil M

macvlan_init() copies several properties from the lower device onto
the macvlan netdev (dev->features, dev->vlan_features,
dev->hard_header_len, TSO limits) but never copies needed_headroom
or needed_tailroom.

When the lower device declares extra needed_headroom/needed_tailroom
(e.g. because it must prepend/append its own hardware encapsulation
before a packet reaches the wire), a macvlan built on top of it does
not reserve that space. Depending on the lower driver, this can cause
outgoing packets to be silently dropped instead of forwarded, since
the driver xmit path finds insufficient headroom and has no fallback
to reallocate.

Fix this the same way vxlan already does for the same class of issue
(commit 0a35dc41fea6 ("vxlan: Add needed_headroom for lower device")):
copy needed_headroom and needed_tailroom from the lower device in
macvlan_init(), alongside the existing hard_header_len copy.

Signed-off-by: Mohammed Hashil M <mohammed.hashil@dicortech.com>
---
 drivers/net/macvlan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 9a4bc99dbf53..70219011fcb2 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -954,6 +954,8 @@ static int macvlan_init(struct net_device *dev)
 	dev->lltx		= true;
 	netif_inherit_tso_max(dev, lowerdev);
 	dev->hard_header_len	= lowerdev->hard_header_len;
+	dev->needed_headroom	= lowerdev->needed_headroom;
+	dev->needed_tailroom	= lowerdev->needed_tailroom;
 	macvlan_set_lockdep_class(dev);
 
 	vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
-- 
2.34.1


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

end of thread, other threads:[~2026-07-24 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-24 10:08 [PATCH] macvlan: inherit needed_headroom/needed_tailroom from lower device Mohammed Hashil M
2026-07-24 10:53 ` Eric Dumazet
2026-07-24 13:02   ` Mohammed Hashil M

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox