1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun======================================== 4*4882a593SmuzhiyunBare UDP Tunnelling Module Documentation 5*4882a593Smuzhiyun======================================== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunThere are various L3 encapsulation standards using UDP being discussed to 8*4882a593Smuzhiyunleverage the UDP based load balancing capability of different networks. 9*4882a593SmuzhiyunMPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them. 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunThe Bareudp tunnel module provides a generic L3 encapsulation support for 12*4882a593Smuzhiyuntunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel. 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunSpecial Handling 15*4882a593Smuzhiyun---------------- 16*4882a593SmuzhiyunThe bareudp device supports special handling for MPLS & IP as they can have 17*4882a593Smuzhiyunmultiple ethertypes. 18*4882a593SmuzhiyunMPLS procotcol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast). 19*4882a593SmuzhiyunIP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6). 20*4882a593SmuzhiyunThis special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC 21*4882a593Smuzhiyunwith a flag called multiproto mode. 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunUsage 24*4882a593Smuzhiyun------ 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun1) Device creation & deletion 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun This creates a bareudp tunnel device which tunnels L3 traffic with ethertype 31*4882a593Smuzhiyun 0x8847 (MPLS traffic). The destination port of the UDP header will be set to 32*4882a593Smuzhiyun 6635.The device will listen on UDP port 6635 to receive traffic. 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun b) ip link delete bareudp0 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun2) Device creation with multiproto mode enabled 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunThe multiproto mode allows bareudp tunnels to handle several protocols of the 39*4882a593Smuzhiyunsame family. It is currently only available for IP and MPLS. This mode has to 40*4882a593Smuzhiyunbe enabled explicitly with the "multiproto" flag. 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun For an IPv4 tunnel the multiproto mode allows the tunnel to also handle 45*4882a593Smuzhiyun IPv6. 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun For MPLS, the multiproto mode allows the tunnel to handle both unicast 50*4882a593Smuzhiyun and multicast MPLS packets. 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun3) Device Usage 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunThe bareudp device could be used along with OVS or flower filter in TC. 55*4882a593SmuzhiyunThe OVS or TC flower layer must set the tunnel information in SKB dst field before 56*4882a593Smuzhiyunsending packet buffer to the bareudp device for transmission. On reception the 57*4882a593Smuzhiyunbareudp device extracts and stores the tunnel information in SKB dst field before 58*4882a593Smuzhiyunpassing the packet buffer to the network stack. 59