Netdev List
 help / color / mirror / Atom feed
From: Mohammed Hashil M <mohammedhashil786@gmail.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mohammed Hashil M <mohammed.hashil@dicortech.com>
Subject: [PATCH] macvlan: inherit needed_headroom/needed_tailroom from lower device
Date: Fri, 24 Jul 2026 15:38:32 +0530	[thread overview]
Message-ID: <20260724100832.59153-1-mohammed.hashil@dicortech.com> (raw)

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


             reply	other threads:[~2026-07-24 10:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 10:08 Mohammed Hashil M [this message]
2026-07-24 10:53 ` [PATCH] macvlan: inherit needed_headroom/needed_tailroom from lower device Eric Dumazet
2026-07-24 13:02   ` Mohammed Hashil M

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260724100832.59153-1-mohammed.hashil@dicortech.com \
    --to=mohammedhashil786@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohammed.hashil@dicortech.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox