162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci===================================
462306a36Sopenharmony_ciIdentifier Locator Addressing (ILA)
562306a36Sopenharmony_ci===================================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciIntroduction
962306a36Sopenharmony_ci============
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciIdentifier-locator addressing (ILA) is a technique used with IPv6 that
1262306a36Sopenharmony_cidifferentiates between location and identity of a network node. Part of an
1362306a36Sopenharmony_ciaddress expresses the immutable identity of the node, and another part
1462306a36Sopenharmony_ciindicates the location of the node which can be dynamic. Identifier-locator
1562306a36Sopenharmony_ciaddressing can be used to efficiently implement overlay networks for
1662306a36Sopenharmony_cinetwork virtualization as well as solutions for use cases in mobility.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciILA can be thought of as means to implement an overlay network without
1962306a36Sopenharmony_ciencapsulation. This is accomplished by performing network address
2062306a36Sopenharmony_citranslation on destination addresses as a packet traverses a network. To
2162306a36Sopenharmony_cithe network, an ILA translated packet appears to be no different than any
2262306a36Sopenharmony_ciother IPv6 packet. For instance, if the transport protocol is TCP then an
2362306a36Sopenharmony_ciILA translated packet looks like just another TCP/IPv6 packet. The
2462306a36Sopenharmony_ciadvantage of this is that ILA is transparent to the network so that
2562306a36Sopenharmony_cioptimizations in the network, such as ECMP, RSS, GRO, GSO, etc., just work.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciThe ILA protocol is described in Internet-Draft draft-herbert-intarea-ila.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciILA terminology
3162306a36Sopenharmony_ci===============
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci  - Identifier
3462306a36Sopenharmony_ci		A number that identifies an addressable node in the network
3562306a36Sopenharmony_ci		independent of its location. ILA identifiers are sixty-four
3662306a36Sopenharmony_ci		bit values.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci  - Locator
3962306a36Sopenharmony_ci		A network prefix that routes to a physical host. Locators
4062306a36Sopenharmony_ci		provide the topological location of an addressed node. ILA
4162306a36Sopenharmony_ci		locators are sixty-four bit prefixes.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci  - ILA mapping
4462306a36Sopenharmony_ci		A mapping of an ILA identifier to a locator (or to a
4562306a36Sopenharmony_ci		locator and meta data). An ILA domain maintains a database
4662306a36Sopenharmony_ci		that contains mappings for all destinations in the domain.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci  - SIR address
4962306a36Sopenharmony_ci		An IPv6 address composed of a SIR prefix (upper sixty-
5062306a36Sopenharmony_ci		four bits) and an identifier (lower sixty-four bits).
5162306a36Sopenharmony_ci		SIR addresses are visible to applications and provide a
5262306a36Sopenharmony_ci		means for them to address nodes independent of their
5362306a36Sopenharmony_ci		location.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci  - ILA address
5662306a36Sopenharmony_ci		An IPv6 address composed of a locator (upper sixty-four
5762306a36Sopenharmony_ci		bits) and an identifier (low order sixty-four bits). ILA
5862306a36Sopenharmony_ci		addresses are never visible to an application.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci  - ILA host
6162306a36Sopenharmony_ci		An end host that is capable of performing ILA translations
6262306a36Sopenharmony_ci		on transmit or receive.
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci  - ILA router
6562306a36Sopenharmony_ci		A network node that performs ILA translation and forwarding
6662306a36Sopenharmony_ci		of translated packets.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci  - ILA forwarding cache
6962306a36Sopenharmony_ci		A type of ILA router that only maintains a working set
7062306a36Sopenharmony_ci		cache of mappings.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci  - ILA node
7362306a36Sopenharmony_ci		A network node capable of performing ILA translations. This
7462306a36Sopenharmony_ci		can be an ILA router, ILA forwarding cache, or ILA host.
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciOperation
7862306a36Sopenharmony_ci=========
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciThere are two fundamental operations with ILA:
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci  - Translate a SIR address to an ILA address. This is performed on ingress
8362306a36Sopenharmony_ci    to an ILA overlay.
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci  - Translate an ILA address to a SIR address. This is performed on egress
8662306a36Sopenharmony_ci    from the ILA overlay.
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciILA can be deployed either on end hosts or intermediate devices in the
8962306a36Sopenharmony_cinetwork; these are provided by "ILA hosts" and "ILA routers" respectively.
9062306a36Sopenharmony_ciConfiguration and datapath for these two points of deployment is somewhat
9162306a36Sopenharmony_cidifferent.
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciThe diagram below illustrates the flow of packets through ILA as well
9462306a36Sopenharmony_cias showing ILA hosts and routers::
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci    +--------+                                                +--------+
9762306a36Sopenharmony_ci    | Host A +-+                                         +--->| Host B |
9862306a36Sopenharmony_ci    |        | |              (2) ILA                   (')   |        |
9962306a36Sopenharmony_ci    +--------+ |            ...addressed....           (   )  +--------+
10062306a36Sopenharmony_ci	       V  +---+--+  .  packet      .  +---+--+  (_)
10162306a36Sopenharmony_ci   (1) SIR     |  | ILA  |----->-------->---->| ILA  |   |   (3) SIR
10262306a36Sopenharmony_ci    addressed  +->|router|  .              .  |router|->-+    addressed
10362306a36Sopenharmony_ci    packet        +---+--+  .     IPv6     .  +---+--+        packet
10462306a36Sopenharmony_ci		   /        .    Network   .
10562306a36Sopenharmony_ci		  /         .              .   +--+-++--------+
10662306a36Sopenharmony_ci    +--------+   /          .              .   |ILA ||  Host  |
10762306a36Sopenharmony_ci    |  Host  +--+           .              .- -|host||        |
10862306a36Sopenharmony_ci    |        |              .              .   +--+-++--------+
10962306a36Sopenharmony_ci    +--------+              ................
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciTransport checksum handling
11362306a36Sopenharmony_ci===========================
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ciWhen an address is translated by ILA, an encapsulated transport checksum
11662306a36Sopenharmony_cithat includes the translated address in a pseudo header may be rendered
11762306a36Sopenharmony_ciincorrect on the wire. This is a problem for intermediate devices,
11862306a36Sopenharmony_ciincluding checksum offload in NICs, that process the checksum. There are
11962306a36Sopenharmony_cithree options to deal with this:
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci- no action	Allow the checksum to be incorrect on the wire. Before
12262306a36Sopenharmony_ci		a receiver verifies a checksum the ILA to SIR address
12362306a36Sopenharmony_ci		translation must be done.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci- adjust transport checksum
12662306a36Sopenharmony_ci		When ILA translation is performed the packet is parsed
12762306a36Sopenharmony_ci		and if a transport layer checksum is found then it is
12862306a36Sopenharmony_ci		adjusted to reflect the correct checksum per the
12962306a36Sopenharmony_ci		translated address.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci- checksum neutral mapping
13262306a36Sopenharmony_ci		When an address is translated the difference can be offset
13362306a36Sopenharmony_ci		elsewhere in a part of the packet that is covered by
13462306a36Sopenharmony_ci		the checksum. The low order sixteen bits of the identifier
13562306a36Sopenharmony_ci		are used. This method is preferred since it doesn't require
13662306a36Sopenharmony_ci		parsing a packet beyond the IP header and in most cases the
13762306a36Sopenharmony_ci		adjustment can be precomputed and saved with the mapping.
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ciNote that the checksum neutral adjustment affects the low order sixteen
14062306a36Sopenharmony_cibits of the identifier. When ILA to SIR address translation is done on
14162306a36Sopenharmony_ciegress the low order bits are restored to the original value which
14262306a36Sopenharmony_cirestores the identifier as it was originally sent.
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ciIdentifier types
14662306a36Sopenharmony_ci================
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciILA defines different types of identifiers for different use cases.
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ciThe defined types are:
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci      0: interface identifier
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci      1: locally unique identifier
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci      2: virtual networking identifier for IPv4 address
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci      3: virtual networking identifier for IPv6 unicast address
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci      4: virtual networking identifier for IPv6 multicast address
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci      5: non-local address identifier
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ciIn the current implementation of kernel ILA only locally unique identifiers
16562306a36Sopenharmony_ci(LUID) are supported. LUID allows for a generic, unformatted 64 bit
16662306a36Sopenharmony_ciidentifier.
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ciIdentifier formats
17062306a36Sopenharmony_ci==================
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ciKernel ILA supports two optional fields in an identifier for formatting:
17362306a36Sopenharmony_ci"C-bit" and "identifier type". The presence of these fields is determined
17462306a36Sopenharmony_ciby configuration as demonstrated below.
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ciIf the identifier type is present it occupies the three highest order
17762306a36Sopenharmony_cibits of an identifier. The possible values are given in the above list.
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ciIf the C-bit is present,  this is used as an indication that checksum
18062306a36Sopenharmony_cineutral mapping has been done. The C-bit can only be set in an
18162306a36Sopenharmony_ciILA address, never a SIR address.
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ciIn the simplest format the identifier types, C-bit, and checksum
18462306a36Sopenharmony_ciadjustment value are not present so an identifier is considered an
18562306a36Sopenharmony_ciunstructured sixty-four bit value::
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18862306a36Sopenharmony_ci     |                            Identifier                         |
18962306a36Sopenharmony_ci     +                                                               +
19062306a36Sopenharmony_ci     |                                                               |
19162306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ciThe checksum neutral adjustment may be configured to always be
19462306a36Sopenharmony_cipresent using neutral-map-auto. In this case there is no C-bit, but the
19562306a36Sopenharmony_cichecksum adjustment is in the low order 16 bits. The identifier is
19662306a36Sopenharmony_cistill sixty-four bits::
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19962306a36Sopenharmony_ci     |                            Identifier                         |
20062306a36Sopenharmony_ci     |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20162306a36Sopenharmony_ci     |                               |  Checksum-neutral adjustment  |
20262306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ciThe C-bit may used to explicitly indicate that checksum neutral
20562306a36Sopenharmony_cimapping has been applied to an ILA address. The format is::
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20862306a36Sopenharmony_ci     |     |C|                    Identifier                         |
20962306a36Sopenharmony_ci     |     +-+                       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21062306a36Sopenharmony_ci     |                               |  Checksum-neutral adjustment  |
21162306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ciThe identifier type field may be present to indicate the identifier
21462306a36Sopenharmony_citype. If it is not present then the type is inferred based on mapping
21562306a36Sopenharmony_ciconfiguration. The checksum neutral adjustment may automatically
21662306a36Sopenharmony_ciused with the identifier type as illustrated below::
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21962306a36Sopenharmony_ci     | Type|                      Identifier                         |
22062306a36Sopenharmony_ci     +-+-+-+                         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22162306a36Sopenharmony_ci     |                               |  Checksum-neutral adjustment  |
22262306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ciIf the identifier type and the C-bit can be present simultaneously so
22562306a36Sopenharmony_cithe identifier format would be::
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22862306a36Sopenharmony_ci     | Type|C|                    Identifier                         |
22962306a36Sopenharmony_ci     +-+-+-+-+                       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23062306a36Sopenharmony_ci     |                               |  Checksum-neutral adjustment  |
23162306a36Sopenharmony_ci     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ciConfiguration
23562306a36Sopenharmony_ci=============
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ciThere are two methods to configure ILA mappings. One is by using LWT routes
23862306a36Sopenharmony_ciand the other is ila_xlat (called from NFHOOK PREROUTING hook). ila_xlat
23962306a36Sopenharmony_ciis intended to be used in the receive path for ILA hosts .
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ciAn ILA router has also been implemented in XDP. Description of that is
24262306a36Sopenharmony_cioutside the scope of this document.
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ciThe usage of for ILA LWT routes is:
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ciip route add DEST/128 encap ila LOC csum-mode MODE ident-type TYPE via ADDR
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ciDestination (DEST) can either be a SIR address (for an ILA host or ingress
24962306a36Sopenharmony_ciILA router) or an ILA address (egress ILA router). LOC is the sixty-four
25062306a36Sopenharmony_cibit locator (with format W:X:Y:Z) that overwrites the upper sixty-four
25162306a36Sopenharmony_cibits of the destination address.  Checksum MODE is one of "no-action",
25262306a36Sopenharmony_ci"adj-transport", "neutral-map", and "neutral-map-auto". If neutral-map is
25362306a36Sopenharmony_ciset then the C-bit will be present. Identifier TYPE one of "luid" or
25462306a36Sopenharmony_ci"use-format." In the case of use-format, the identifier type field is
25562306a36Sopenharmony_cipresent and the effective type is taken from that.
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ciThe usage of ila_xlat is:
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ciip ila add loc_match MATCH loc LOC csum-mode MODE ident-type TYPE
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ciMATCH indicates the incoming locator that must be matched to apply
26262306a36Sopenharmony_cia the translaiton. LOC is the locator that overwrites the upper
26362306a36Sopenharmony_cisixty-four bits of the destination address. MODE and TYPE have the
26462306a36Sopenharmony_cisame meanings as described above.
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ciSome examples
26862306a36Sopenharmony_ci=============
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci::
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci     # Configure an ILA route that uses checksum neutral mapping as well
27362306a36Sopenharmony_ci     # as type field. Note that the type field is set in the SIR address
27462306a36Sopenharmony_ci     # (the 2000 implies type is 1 which is LUID).
27562306a36Sopenharmony_ci     ip route add 3333:0:0:1:2000:0:1:87/128 encap ila 2001:0:87:0 \
27662306a36Sopenharmony_ci	  csum-mode neutral-map ident-type use-format
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci     # Configure an ILA LWT route that uses auto checksum neutral mapping
27962306a36Sopenharmony_ci     # (no C-bit) and configure identifier type to be LUID so that the
28062306a36Sopenharmony_ci     # identifier type field will not be present.
28162306a36Sopenharmony_ci     ip route add 3333:0:0:1:2000:0:2:87/128 encap ila 2001:0:87:1 \
28262306a36Sopenharmony_ci	  csum-mode neutral-map-auto ident-type luid
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci     ila_xlat configuration
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci     # Configure an ILA to SIR mapping that matches a locator and overwrites
28762306a36Sopenharmony_ci     # it with a SIR address (3333:0:0:1 in this example). The C-bit and
28862306a36Sopenharmony_ci     # identifier field are used.
28962306a36Sopenharmony_ci     ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
29062306a36Sopenharmony_ci	 csum-mode neutral-map-auto ident-type use-format
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci     # Configure an ILA to SIR mapping where checksum neutral is automatically
29362306a36Sopenharmony_ci     # set without the C-bit and the identifier type is configured to be LUID
29462306a36Sopenharmony_ci     # so that the identifier type field is not present.
29562306a36Sopenharmony_ci     ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
29662306a36Sopenharmony_ci	 csum-mode neutral-map-auto ident-type use-format
297