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
111ed06dbcSMartin VargheseThe Bareudp tunnel module provides a generic L3 encapsulation support for
121ed06dbcSMartin Varghesetunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel.
13571912c6SMartin Varghese
144b5f6723SMartin VargheseSpecial Handling
154b5f6723SMartin Varghese----------------
164b5f6723SMartin VargheseThe bareudp device supports special handling for MPLS & IP as they can have
174b5f6723SMartin Varghesemultiple ethertypes.
184b5f6723SMartin VargheseMPLS procotcol can have ethertypes ETH_P_MPLS_UC  (unicast) & ETH_P_MPLS_MC (multicast).
194b5f6723SMartin VargheseIP protocol can have ethertypes ETH_P_IP (v4) & ETH_P_IPV6 (v6).
204b5f6723SMartin VargheseThis special handling can be enabled only for ethertypes ETH_P_IP & ETH_P_MPLS_UC
214b5f6723SMartin Varghesewith a flag called multiproto mode.
224b5f6723SMartin Varghese
23571912c6SMartin VargheseUsage
24571912c6SMartin Varghese------
25571912c6SMartin Varghese
26571912c6SMartin Varghese1) Device creation & deletion
27571912c6SMartin Varghese
2834b85adaSGuillaume Nault    a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc
29571912c6SMartin Varghese
30571912c6SMartin Varghese       This creates a bareudp tunnel device which tunnels L3 traffic with ethertype
31571912c6SMartin Varghese       0x8847 (MPLS traffic). The destination port of the UDP header will be set to
32571912c6SMartin Varghese       6635.The device will listen on UDP port 6635 to receive traffic.
33571912c6SMartin Varghese
34571912c6SMartin Varghese    b) ip link delete bareudp0
35571912c6SMartin Varghese
3634b85adaSGuillaume Nault2) Device creation with multiproto mode enabled
374b5f6723SMartin Varghese
3834b85adaSGuillaume NaultThe multiproto mode allows bareudp tunnels to handle several protocols of the
3934b85adaSGuillaume Naultsame family. It is currently only available for IP and MPLS. This mode has to
4034b85adaSGuillaume Naultbe enabled explicitly with the "multiproto" flag.
414b5f6723SMartin Varghese
4234b85adaSGuillaume Nault    a) ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto
434b5f6723SMartin Varghese
4434b85adaSGuillaume Nault       For an IPv4 tunnel the multiproto mode allows the tunnel to also handle
4534b85adaSGuillaume Nault       IPv6.
4634b85adaSGuillaume Nault
4734b85adaSGuillaume Nault    b) ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc multiproto
4834b85adaSGuillaume Nault
4934b85adaSGuillaume Nault       For MPLS, the multiproto mode allows the tunnel to handle both unicast
5034b85adaSGuillaume Nault       and multicast MPLS packets.
514b5f6723SMartin Varghese
524b5f6723SMartin Varghese3) Device Usage
53571912c6SMartin Varghese
54571912c6SMartin VargheseThe bareudp device could be used along with OVS or flower filter in TC.
55571912c6SMartin VargheseThe OVS or TC flower layer must set the tunnel information in SKB dst field before
56571912c6SMartin Varghesesending packet buffer to the bareudp device for transmission. On reception the
57571912c6SMartin Varghesebareudp device extracts and stores the tunnel information in SKB dst field before
58571912c6SMartin Varghesepassing the packet buffer to the network stack.
59