[PATCH AUTOSEL 4.14 5/8] vxlan: Copy needed_tailroom from lowerdev

From: Sasha Levin
Date: Sat Dec 12 2020 - 11:18:01 EST


From: Sven Eckelmann <sven@xxxxxxxxxxxxx>

[ Upstream commit a5e74021e84bb5eadf760aaf2c583304f02269be ]

While vxlan doesn't need any extra tailroom, the lowerdev might need it. In
that case, copy it over to reduce the chance for additional (re)allocations
in the transmit path.

Signed-off-by: Sven Eckelmann <sven@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20201126125247.1047977-2-sven@xxxxxxxxxxxxx
Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/net/vxlan.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index c21f28840f05b..94a9add2fc878 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3186,6 +3186,8 @@ static void vxlan_config_apply(struct net_device *dev,
needed_headroom = lowerdev->hard_header_len;
needed_headroom += lowerdev->needed_headroom;

+ dev->needed_tailroom = lowerdev->needed_tailroom;
+
max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM :
VXLAN_HEADROOM);
if (max_mtu < ETH_MIN_MTU)
--
2.27.0