macvlan: inherit needed_headroom/needed_tailroom from lower device
Subsystems (2)
PATCH 1/1 macvlan: inherit needed_headroom/needed_tailroom from lower device
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.
--- drivers/net/macvlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/macvlan.c +2 -0
@@ -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);
Signature · 1 line
2.34.1
Quoted 29 lines · 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 copiesneeded_headroomorneeded_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: Addneeded_headroomfor lower device")):
copyneeded_headroomandneeded_tailroomfrom the lower device inmacvlan_init(), alongside the existinghard_header_lencopy.Signed-off-by Mohammed Hashil M <[email protected]>--- drivers/net/macvlan.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/macvlan.c +0
-0
drivers/net/macvlan.c static int macvlan_init(struct net_device *dev) · line 960
Quoted 7 lines
drivers/net/macvlan.c +2
-0@@ -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);
Is it related to my ongoing work ?
It seems you are trying to take ownership of the discoveries made earlier today.
Please don't do that, especially for your first linux contribution, this is not how things work.
--
pw-bot: cr
Hi,
Sorry for the misunderstanding. That was not my intention.
I worked on this change a few weeks ago as part of my work while investigating the macvlan code. Since this was going to be my first Linux kernel contribution, I ended up holding onto the patch longer than I should have because I was unfamiliar with the submission process.
When I finally sent it, I wasn't aware of the discussion from earlier that day. My patch was not based on that discussion, and I certainly wasn't trying to claim ownership of anyone else's work or discoveries.
I understand that, given the timing, it could have appeared that way, and I apologize for creating that impression.
Thank you for pointing it out. I'll be more careful in the future to check for ongoing discussions before submitting a patch.
Regards,
Mohammed Hashil M