1571912c6SMartin Varghese.. SPDX-License-Identifier: GPL-2.0 2571912c6SMartin Varghese 3571912c6SMartin Varghese======================================== 4571912c6SMartin VargheseBare UDP Tunnelling Module Documentation 5571912c6SMartin Varghese======================================== 6571912c6SMartin Varghese 7571912c6SMartin VargheseThere are various L3 encapsulation standards using UDP being discussed to 8571912c6SMartin Vargheseleverage the UDP based load balancing capability of different networks. 9571912c6SMartin VargheseMPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them. 10571912c6SMartin Varghese 11571912c6SMartin VargheseThe Bareudp tunnel module provides a generic L3 encapsulation tunnelling 12571912c6SMartin Varghesesupport for tunnelling different L3 protocols like MPLS, IP, NSH etc. inside 13571912c6SMartin Varghesea UDP tunnel. 14571912c6SMartin Varghese 154b5f6723SMartin VargheseSpecial Handling 164b5f6723SMartin Varghese---------------- 174b5f6723SMartin VargheseThe bareudp device supports special handling for MPLS & IP as they can have 184b5f6723SMartin Varghesemultiple ethertypes. 194b5f6723SMartin VargheseMPLS procotcol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast). 204b5f6723SMartin VargheseIP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6). 214b5f6723SMartin VargheseThis special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC 224b5f6723SMartin Varghesewith a flag called multiproto mode. 234b5f6723SMartin Varghese 24571912c6SMartin VargheseUsage 25571912c6SMartin Varghese------ 26571912c6SMartin Varghese 27571912c6SMartin Varghese1) Device creation & deletion 28571912c6SMartin Varghese 2934b85adaSGuillaume Nault a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc 30571912c6SMartin Varghese 31571912c6SMartin Varghese This creates a bareudp tunnel device which tunnels L3 traffic with ethertype 32571912c6SMartin Varghese 0x8847 (MPLS traffic). The destination port of the UDP header will be set to 33571912c6SMartin Varghese 6635.The device will listen on UDP port 6635 to receive traffic. 34571912c6SMartin Varghese 35571912c6SMartin Varghese b) ip link delete bareudp0 36571912c6SMartin Varghese 3734b85adaSGuillaume Nault2) Device creation with multiproto mode enabled 384b5f6723SMartin Varghese 3934b85adaSGuillaume NaultThe multiproto mode allows bareudp tunnels to handle several protocols of the 4034b85adaSGuillaume Naultsame family. It is currently only available for IP and MPLS. This mode has to 4134b85adaSGuillaume Naultbe enabled explicitly with the "multiproto" flag. 424b5f6723SMartin Varghese 4334b85adaSGuillaume Nault a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto 444b5f6723SMartin Varghese 4534b85adaSGuillaume Nault For an IPv4 tunnel the multiproto mode allows the tunnel to also handle 4634b85adaSGuillaume Nault IPv6. 4734b85adaSGuillaume Nault 4834b85adaSGuillaume Nault b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto 4934b85adaSGuillaume Nault 5034b85adaSGuillaume Nault For MPLS, the multiproto mode allows the tunnel to handle both unicast 5134b85adaSGuillaume Nault and multicast MPLS packets. 524b5f6723SMartin Varghese 534b5f6723SMartin Varghese3) Device Usage 54571912c6SMartin Varghese 55571912c6SMartin VargheseThe bareudp device could be used along with OVS or flower filter in TC. 56571912c6SMartin VargheseThe OVS or TC flower layer must set the tunnel information in SKB dst field before 57571912c6SMartin Varghesesending packet buffer to the bareudp device for transmission. On reception the 58571912c6SMartin Varghesebareudp device extracts and stores the tunnel information in SKB dst field before 59571912c6SMartin Varghesepassing the packet buffer to the network stack. 60