Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vxlan: Add new UDP encapsulation offload type for VXLAN-GPE

The fact is VXLAN with Generic Protocol Extensions cannot be supported by
the same hardware parsers that support VXLAN. The protocol extensions
allow for things like a Next Protocol field which in turn allows for things
other than Ethernet to be passed over the tunnel. Most existing parsers
will not know how to interpret this.

To resolve this I am giving VXLAN-GPE its own UDP encapsulation offload
type. This way hardware that does support GPE can simply add this type to
the switch statement for VXLAN, and if they don't support it then this will
fix any issues where headers might be interpreted incorrectly.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexander Duyck and committed by
David S. Miller
b9adcd69 1938ee1f

+7
+6
drivers/net/vxlan.c
··· 998 998 spin_lock(&vn->sock_lock); 999 999 hlist_del_rcu(&vs->hlist); 1000 1000 udp_tunnel_notify_del_rx_port(vs->sock, 1001 + (vs->flags & VXLAN_F_GPE) ? 1002 + UDP_TUNNEL_TYPE_VXLAN_GPE : 1001 1003 UDP_TUNNEL_TYPE_VXLAN); 1002 1004 spin_unlock(&vn->sock_lock); 1003 1005 ··· 2490 2488 for (i = 0; i < PORT_HASH_SIZE; ++i) { 2491 2489 hlist_for_each_entry_rcu(vs, &vn->sock_list[i], hlist) 2492 2490 udp_tunnel_push_rx_port(dev, vs->sock, 2491 + (vs->flags & VXLAN_F_GPE) ? 2492 + UDP_TUNNEL_TYPE_VXLAN_GPE : 2493 2493 UDP_TUNNEL_TYPE_VXLAN); 2494 2494 } 2495 2495 spin_unlock(&vn->sock_lock); ··· 2695 2691 spin_lock(&vn->sock_lock); 2696 2692 hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); 2697 2693 udp_tunnel_notify_add_rx_port(sock, 2694 + (vs->flags & VXLAN_F_GPE) ? 2695 + UDP_TUNNEL_TYPE_VXLAN_GPE : 2698 2696 UDP_TUNNEL_TYPE_VXLAN); 2699 2697 spin_unlock(&vn->sock_lock); 2700 2698
+1
include/net/udp_tunnel.h
··· 103 103 enum udp_parsable_tunnel_type { 104 104 UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */ 105 105 UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */ 106 + UDP_TUNNEL_TYPE_VXLAN_GPE, /* draft-ietf-nvo3-vxlan-gpe */ 106 107 }; 107 108 108 109 struct udp_tunnel_info {