162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci======================================== 462306a36Sopenharmony_ciBare UDP Tunnelling Module Documentation 562306a36Sopenharmony_ci======================================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThere are various L3 encapsulation standards using UDP being discussed to 862306a36Sopenharmony_cileverage the UDP based load balancing capability of different networks. 962306a36Sopenharmony_ciMPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them. 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciThe Bareudp tunnel module provides a generic L3 encapsulation support for 1262306a36Sopenharmony_citunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel. 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciSpecial Handling 1562306a36Sopenharmony_ci---------------- 1662306a36Sopenharmony_ciThe bareudp device supports special handling for MPLS & IP as they can have 1762306a36Sopenharmony_cimultiple ethertypes. 1862306a36Sopenharmony_ciMPLS procotcol can have ethertypes ETH_P_MPLS_UC (unicast) & ETH_P_MPLS_MC (multicast). 1962306a36Sopenharmony_ciIP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6). 2062306a36Sopenharmony_ciThis special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC 2162306a36Sopenharmony_ciwith a flag called multiproto mode. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciUsage 2462306a36Sopenharmony_ci------ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci1) Device creation & deletion 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci This creates a bareudp tunnel device which tunnels L3 traffic with ethertype 3162306a36Sopenharmony_ci 0x8847 (MPLS traffic). The destination port of the UDP header will be set to 3262306a36Sopenharmony_ci 6635.The device will listen on UDP port 6635 to receive traffic. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci b) ip link delete bareudp0 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci2) Device creation with multiproto mode enabled 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciThe multiproto mode allows bareudp tunnels to handle several protocols of the 3962306a36Sopenharmony_cisame family. It is currently only available for IP and MPLS. This mode has to 4062306a36Sopenharmony_cibe enabled explicitly with the "multiproto" flag. 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci For an IPv4 tunnel the multiproto mode allows the tunnel to also handle 4562306a36Sopenharmony_ci IPv6. 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci For MPLS, the multiproto mode allows the tunnel to handle both unicast 5062306a36Sopenharmony_ci and multicast MPLS packets. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci3) Device Usage 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciThe bareudp device could be used along with OVS or flower filter in TC. 5562306a36Sopenharmony_ciThe OVS or TC flower layer must set the tunnel information in SKB dst field before 5662306a36Sopenharmony_cisending packet buffer to the bareudp device for transmission. On reception the 5762306a36Sopenharmony_cibareudp device extracts and stores the tunnel information in SKB dst field before 5862306a36Sopenharmony_cipassing the packet buffer to the network stack. 59