Skip to contentSkip to conversation

vxlan: Fix error that was resulting in VXLAN MTU size being 10 bytes too large

PATCH Applied Alexander Duyck 5 participants 12 messages Nov 9, 2012 – Dec 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vxlan: Fix error that was resulting in VXLAN MTU size being 10 bytes too large

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

---

 drivers/net/vxlan.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/vxlan.c +2 -2
index 410ebc8..0b75c19 100644
@@ -51,8 +51,8 @@
 
 #define VXLAN_N_VID	(1u << 24)
 #define VXLAN_VID_MASK	(VXLAN_N_VID - 1)
-/* VLAN + IP header + UDP + VXLAN */
-#define VXLAN_HEADROOM (4 + 20 + 8 + 8)
+/* IP header + UDP + VXLAN + Ethernet header */
+#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
 
 #define VXLAN_FLAGS 0x08000000	/* struct vxlanhdr.vx_flags required value. */
 
maintainer Applied
#1 lore raw

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 8 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Applied, thanks for the detailed commit message.

#2 lore raw
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

#3 lore raw

PATCH 1/1 vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN

In the event of a VXLAN device being linked to a device that has a hard_header_len greater than that of standard ethernet we could end up with the hard_header_len not being large enough for outgoing frames. In order to prevent this we should update the length when a lowerdev is provided.

---

 drivers/net/vxlan.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/vxlan.c +4 -0
index 44bcc20..6b666eb 100644
@@ -1110,6 +1110,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
 		if (!tb[IFLA_MTU])
 			dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
+
+		/* update header length based on lower device */
+		dev->hard_header_len = lowerdev->hard_header_len +
+				       VXLAN_HEADROOM;
 	}
 
 	if (data[IFLA_VXLAN_TOS])
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH] vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN

Quoted 17 lines · On Tue, 13 Nov 2012 15:10:59 -0800 Alexander Duyck…

In the event of a VXLAN device being linked to a device that has a hard_header_len greater than that of standard ethernet we could end up with the hard_header_len not being large enough for outgoing frames. In order to prevent this we should update the length when a lowerdev is provided.

---

 drivers/net/vxlan.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/vxlan.c +0 -0
index 44bcc20..6b666eb 100644

drivers/net/vxlan.c static int vxlan_newlink(struct net *net, struct net_device *dev, · line 1119

Quoted 10 lines
drivers/net/vxlan.c +4 -0
@@ -1110,6 +1110,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
 		if (!tb[IFLA_MTU])
 			dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
+
+		/* update header length based on lower device */
+		dev->hard_header_len = lowerdev->hard_header_len +
+				       VXLAN_HEADROOM;
 	}
 
 	if (data[IFLA_VXLAN_TOS])
maintainer Applied
#5 lore raw

Re: [PATCH] vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN

From: Stephen Hemminger <[email protected]>
Date: Tue, 13 Nov 2012 15:12:00 -0800

Quoted 9 lines
Quoted 6 lines · On Tue, 13 Nov 2012 15:10:59 -0800 Alexander Duyck…

In the event of a VXLAN device being linked to a device that has a hard_header_len greater than that of standard ethernet we could end up with the hard_header_len not being large enough for outgoing frames. In order to prevent this we should update the length when a lowerdev is provided.

...

Quoted 1 line

Applied, thanks.

#6 lore raw
In reply to Stephen Hemminger
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

Forgive my ignorance but why would running VXLAN on IPoIB require special header handling? (and would it work or behave strangely?)

I was planning on giving this a go when 3.7 is released but I might do that sooner if problems are anticipated.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Joseph.

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
#7 lore raw
Quoted 28 lines · On Mon, 19 Nov 2012 22:33:50 +1100 Joseph Glanville…
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

Forgive my ignorance but why would running VXLAN on IPoIB require special header handling? (and would it work or behave strangely?)

I was planning on giving this a go when 3.7 is released but I might do that sooner if problems are anticipated.

Quoted 7 lines
Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Joseph.

Some lower layers require bigger (or smaller headers). As it was, vxlan was only allocating skb with a fixed amount of headroom. This would lead to lower layers having to copy the skb.

My suggestion has already been addressed by a later patch.

#8 lore raw
Quoted 36 lines · Stephen Hemminger
Quoted 33 lines · On Mon, 19 Nov 2012 22:33:50 +1100 Joseph Glanville…
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

Forgive my ignorance but why would running VXLAN on IPoIB require special header handling? (and would it work or behave strangely?)

I was planning on giving this a go when 3.7 is released but I might do that sooner if problems are anticipated.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines
Quoted 2 lines

Joseph.

Some lower layers require bigger (or smaller headers). As it was, vxlan was only allocating skb with a fixed amount of headroom. This would lead to lower layers having to copy the skb.

My suggestion has already been addressed by a later patch.

Thankyou for the clarification, I found the patch about the lower_dev hard_header_len!

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
#9 lore raw
In reply to Stephen Hemminger
Quoted 36 lines · Stephen Hemminger
Quoted 33 lines · On Mon, 19 Nov 2012 22:33:50 +1100 Joseph Glanville…
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

Forgive my ignorance but why would running VXLAN on IPoIB require special header handling? (and would it work or behave strangely?)

I was planning on giving this a go when 3.7 is released but I might do that sooner if problems are anticipated.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines
Quoted 2 lines

Joseph.

Some lower layers require bigger (or smaller headers). As it was, vxlan was only allocating skb with a fixed amount of headroom. This would lead to lower layers having to copy the skb.

My suggestion has already been addressed by a later patch.

Hi,

I have tested VXLAN on IPoIB and it works perfectly. :)

Joseph.

Signature · 2 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
#10 lore raw

Hi all

Sharing my testlab resut for you ;-)

A First Look At VXLAN over Infiniband Network On Linux 3.7-rc7
http://slidesha.re/TsCKWc

plz enjyoi it.

--
Naoto

Quoted 60 lines · On Tue, 4 Dec 2012 02:26:18 +1100 Joseph Glanville…
Quoted 36 lines · Stephen Hemminger
Quoted 33 lines · On Mon, 19 Nov 2012 22:33:50 +1100 Joseph Glanville…
Quoted 13 lines · Stephen Hemminger
Quoted 10 lines · On Tue, 13 Nov 2012 14:37:19 -0500 (EST) David Miller <[email protected]>…

From: Alexander Duyck <[email protected]>
Date: Fri, 09 Nov 2012 15:35:24 -0800

Quoted 7 lines

This change fixes an issue I found where VXLAN frames were fragmented when they were up to the VXLAN MTU size. I root caused the issue to the fact that the headroom was 4 + 20 + 8 + 8. This math doesn't appear to be correct because we are not inserting a VLAN header, but instead a 2nd Ethernet header. As such the math for the overhead should be 20 + 8 + 8 + 14 to account for the extra headers that are inserted for VXLAN.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied, thanks for the detailed commit message.

Probably need smarter code there to look at header length requirement of underlying device as well, maybe someone will be perverse and runn vxlan over a tunnel or IPoIB.

Forgive my ignorance but why would running VXLAN on IPoIB require special header handling? (and would it work or behave strangely?)

I was planning on giving this a go when 3.7 is released but I might do that sooner if problems are anticipated.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines
Quoted 2 lines

Joseph.

Some lower layers require bigger (or smaller headers). As it was, vxlan was only allocating skb with a fixed amount of headroom. This would lead to lower layers having to copy the skb.

My suggestion has already been addressed by a later patch.

Hi,

I have tested VXLAN on IPoIB and it works perfectly. :)

Joseph.

Signature · 6 lines
CTO | Orion Virtualisation Solutions | www.orionvm.com.au
Phone: 1300 56 99 52 | Mobile: 0428 754 846
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
SAKURA Internet Inc. / Senior Researcher
Naoto MATSUMOTO <[email protected]>
SAKURA Research Center <http://research.sakura.ad.jp/>
#11 lore raw
Quoted 5 lines · Naoto MATSUMOTO

Hi all

Sharing my testlab resut for you ;-)

Quoted 7 lines

A First Look At VXLAN over Infiniband Network On Linux 3.7-rc7
http://slidesha.re/TsCKWc

plz enjyoi it.

--
Naoto

What was the MTU for the underlying IPoIB devices in your test? Just wondering because the MTU on the VXLAN is showing as 65470 which would imply the IPoIB devices should have a 65520 MTU and I just wanted to confirm that.

Thanks,

Alex