[Differential] D19422: if_vxlan(4) Allow set MTU more than 1500 bytes.
aleksandr.fedorov_itglobal.com (Aleksandr Fedorov)
phabric-noreply at FreeBSD.org
Mon Jul 15 08:42:31 UTC 2019
aleksandr.fedorov_itglobal.com updated this revision to Diff 59753.
aleksandr.fedorov_itglobal.com added a comment.
VXLAN encapsulate ethernet frames within UDP/IP packets. So, we can calculate maximum overhead for IPv4:
- IP_MAXPACKET = 65K - constant from netinet/ip.h.
- Maximum IP header length IP_MAX_HDR_LEN (There is no suitable constant for it.) = 60 as the Internet Header Length field is the unsigned 4-bit number of 32-bit words - 15 * 32 = 480 bit = 60 bytes.
- sizeof(struct udphdr) = 8 bytes.
- sizeof(struct vxlan_header) = 8 bytes.
- Inner frame ETHER_HDR_LEN = 14 bytes.
- Inner frame ETHER_CRC_LEN = 4 bytes.
- Inner frame ETHER_VLAN_ENCAP_LEN = 4 bytes.
The result VXLAN_MAX_MTU = IP_MAXPACKET - IP_MAX_HDR_LEN - sizeof(struct udphdr) - sizeof(struct vxlan_header) - ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN = 65535 - 60 - 8 - 8 - 14 - 4 - 4 = 65437
So overhead is 98 bytes.
Unfortunately for IPv6, the maximum header length is not fixed and can be extended in the future. It is usually 40 bytes.
Revision changes:
- Calculate VXLAN_MAX_MTU using existing constants.
CHANGES SINCE LAST UPDATE
https://reviews.freebsd.org/D19422?vs=59684&id=59753
CHANGES SINCE LAST ACTION
https://reviews.freebsd.org/D19422/new/
REVISION DETAIL
https://reviews.freebsd.org/D19422
AFFECTED FILES
sys/net/if_vxlan.c
EMAIL PREFERENCES
https://reviews.freebsd.org/settings/panel/emailpreferences/
To: aleksandr.fedorov_itglobal.com, bryanv, hrs, #network, rgrimes, krion, jhb
Cc: evgueni.gavrilov_itglobal.com, olevole_olevole.ru, ae, freebsd-net-list, krzysztof.galazka_intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19422.59753.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20190715/0310c853/attachment.bin>
More information about the freebsd-net
mailing list