xref: /OK3568_Linux_fs/kernel/Documentation/networking/ila.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun===================================
4*4882a593SmuzhiyunIdentifier Locator Addressing (ILA)
5*4882a593Smuzhiyun===================================
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunIntroduction
9*4882a593Smuzhiyun============
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunIdentifier-locator addressing (ILA) is a technique used with IPv6 that
12*4882a593Smuzhiyundifferentiates between location and identity of a network node. Part of an
13*4882a593Smuzhiyunaddress expresses the immutable identity of the node, and another part
14*4882a593Smuzhiyunindicates the location of the node which can be dynamic. Identifier-locator
15*4882a593Smuzhiyunaddressing can be used to efficiently implement overlay networks for
16*4882a593Smuzhiyunnetwork virtualization as well as solutions for use cases in mobility.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunILA can be thought of as means to implement an overlay network without
19*4882a593Smuzhiyunencapsulation. This is accomplished by performing network address
20*4882a593Smuzhiyuntranslation on destination addresses as a packet traverses a network. To
21*4882a593Smuzhiyunthe network, an ILA translated packet appears to be no different than any
22*4882a593Smuzhiyunother IPv6 packet. For instance, if the transport protocol is TCP then an
23*4882a593SmuzhiyunILA translated packet looks like just another TCP/IPv6 packet. The
24*4882a593Smuzhiyunadvantage of this is that ILA is transparent to the network so that
25*4882a593Smuzhiyunoptimizations in the network, such as ECMP, RSS, GRO, GSO, etc., just work.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunThe ILA protocol is described in Internet-Draft draft-herbert-intarea-ila.
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunILA terminology
31*4882a593Smuzhiyun===============
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun  - Identifier
34*4882a593Smuzhiyun		A number that identifies an addressable node in the network
35*4882a593Smuzhiyun		independent of its location. ILA identifiers are sixty-four
36*4882a593Smuzhiyun		bit values.
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun  - Locator
39*4882a593Smuzhiyun		A network prefix that routes to a physical host. Locators
40*4882a593Smuzhiyun		provide the topological location of an addressed node. ILA
41*4882a593Smuzhiyun		locators are sixty-four bit prefixes.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun  - ILA mapping
44*4882a593Smuzhiyun		A mapping of an ILA identifier to a locator (or to a
45*4882a593Smuzhiyun		locator and meta data). An ILA domain maintains a database
46*4882a593Smuzhiyun		that contains mappings for all destinations in the domain.
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun  - SIR address
49*4882a593Smuzhiyun		An IPv6 address composed of a SIR prefix (upper sixty-
50*4882a593Smuzhiyun		four bits) and an identifier (lower sixty-four bits).
51*4882a593Smuzhiyun		SIR addresses are visible to applications and provide a
52*4882a593Smuzhiyun		means for them to address nodes independent of their
53*4882a593Smuzhiyun		location.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun  - ILA address
56*4882a593Smuzhiyun		An IPv6 address composed of a locator (upper sixty-four
57*4882a593Smuzhiyun		bits) and an identifier (low order sixty-four bits). ILA
58*4882a593Smuzhiyun		addresses are never visible to an application.
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun  - ILA host
61*4882a593Smuzhiyun		An end host that is capable of performing ILA translations
62*4882a593Smuzhiyun		on transmit or receive.
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun  - ILA router
65*4882a593Smuzhiyun		A network node that performs ILA translation and forwarding
66*4882a593Smuzhiyun		of translated packets.
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun  - ILA forwarding cache
69*4882a593Smuzhiyun		A type of ILA router that only maintains a working set
70*4882a593Smuzhiyun		cache of mappings.
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun  - ILA node
73*4882a593Smuzhiyun		A network node capable of performing ILA translations. This
74*4882a593Smuzhiyun		can be an ILA router, ILA forwarding cache, or ILA host.
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunOperation
78*4882a593Smuzhiyun=========
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunThere are two fundamental operations with ILA:
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun  - Translate a SIR address to an ILA address. This is performed on ingress
83*4882a593Smuzhiyun    to an ILA overlay.
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun  - Translate an ILA address to a SIR address. This is performed on egress
86*4882a593Smuzhiyun    from the ILA overlay.
87*4882a593Smuzhiyun
88*4882a593SmuzhiyunILA can be deployed either on end hosts or intermediate devices in the
89*4882a593Smuzhiyunnetwork; these are provided by "ILA hosts" and "ILA routers" respectively.
90*4882a593SmuzhiyunConfiguration and datapath for these two points of deployment is somewhat
91*4882a593Smuzhiyundifferent.
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunThe diagram below illustrates the flow of packets through ILA as well
94*4882a593Smuzhiyunas showing ILA hosts and routers::
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun    +--------+                                                +--------+
97*4882a593Smuzhiyun    | Host A +-+                                         +--->| Host B |
98*4882a593Smuzhiyun    |        | |              (2) ILA                   (')   |        |
99*4882a593Smuzhiyun    +--------+ |            ...addressed....           (   )  +--------+
100*4882a593Smuzhiyun	       V  +---+--+  .  packet      .  +---+--+  (_)
101*4882a593Smuzhiyun   (1) SIR     |  | ILA  |----->-------->---->| ILA  |   |   (3) SIR
102*4882a593Smuzhiyun    addressed  +->|router|  .              .  |router|->-+    addressed
103*4882a593Smuzhiyun    packet        +---+--+  .     IPv6     .  +---+--+        packet
104*4882a593Smuzhiyun		   /        .    Network   .
105*4882a593Smuzhiyun		  /         .              .   +--+-++--------+
106*4882a593Smuzhiyun    +--------+   /          .              .   |ILA ||  Host  |
107*4882a593Smuzhiyun    |  Host  +--+           .              .- -|host||        |
108*4882a593Smuzhiyun    |        |              .              .   +--+-++--------+
109*4882a593Smuzhiyun    +--------+              ................
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunTransport checksum handling
113*4882a593Smuzhiyun===========================
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunWhen an address is translated by ILA, an encapsulated transport checksum
116*4882a593Smuzhiyunthat includes the translated address in a pseudo header may be rendered
117*4882a593Smuzhiyunincorrect on the wire. This is a problem for intermediate devices,
118*4882a593Smuzhiyunincluding checksum offload in NICs, that process the checksum. There are
119*4882a593Smuzhiyunthree options to deal with this:
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun- no action	Allow the checksum to be incorrect on the wire. Before
122*4882a593Smuzhiyun		a receiver verifies a checksum the ILA to SIR address
123*4882a593Smuzhiyun		translation must be done.
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun- adjust transport checksum
126*4882a593Smuzhiyun		When ILA translation is performed the packet is parsed
127*4882a593Smuzhiyun		and if a transport layer checksum is found then it is
128*4882a593Smuzhiyun		adjusted to reflect the correct checksum per the
129*4882a593Smuzhiyun		translated address.
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun- checksum neutral mapping
132*4882a593Smuzhiyun		When an address is translated the difference can be offset
133*4882a593Smuzhiyun		elsewhere in a part of the packet that is covered by
134*4882a593Smuzhiyun		the checksum. The low order sixteen bits of the identifier
135*4882a593Smuzhiyun		are used. This method is preferred since it doesn't require
136*4882a593Smuzhiyun		parsing a packet beyond the IP header and in most cases the
137*4882a593Smuzhiyun		adjustment can be precomputed and saved with the mapping.
138*4882a593Smuzhiyun
139*4882a593SmuzhiyunNote that the checksum neutral adjustment affects the low order sixteen
140*4882a593Smuzhiyunbits of the identifier. When ILA to SIR address translation is done on
141*4882a593Smuzhiyunegress the low order bits are restored to the original value which
142*4882a593Smuzhiyunrestores the identifier as it was originally sent.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun
145*4882a593SmuzhiyunIdentifier types
146*4882a593Smuzhiyun================
147*4882a593Smuzhiyun
148*4882a593SmuzhiyunILA defines different types of identifiers for different use cases.
149*4882a593Smuzhiyun
150*4882a593SmuzhiyunThe defined types are:
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun      0: interface identifier
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun      1: locally unique identifier
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun      2: virtual networking identifier for IPv4 address
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun      3: virtual networking identifier for IPv6 unicast address
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun      4: virtual networking identifier for IPv6 multicast address
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun      5: non-local address identifier
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunIn the current implementation of kernel ILA only locally unique identifiers
165*4882a593Smuzhiyun(LUID) are supported. LUID allows for a generic, unformatted 64 bit
166*4882a593Smuzhiyunidentifier.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunIdentifier formats
170*4882a593Smuzhiyun==================
171*4882a593Smuzhiyun
172*4882a593SmuzhiyunKernel ILA supports two optional fields in an identifier for formatting:
173*4882a593Smuzhiyun"C-bit" and "identifier type". The presence of these fields is determined
174*4882a593Smuzhiyunby configuration as demonstrated below.
175*4882a593Smuzhiyun
176*4882a593SmuzhiyunIf the identifier type is present it occupies the three highest order
177*4882a593Smuzhiyunbits of an identifier. The possible values are given in the above list.
178*4882a593Smuzhiyun
179*4882a593SmuzhiyunIf the C-bit is present,  this is used as an indication that checksum
180*4882a593Smuzhiyunneutral mapping has been done. The C-bit can only be set in an
181*4882a593SmuzhiyunILA address, never a SIR address.
182*4882a593Smuzhiyun
183*4882a593SmuzhiyunIn the simplest format the identifier types, C-bit, and checksum
184*4882a593Smuzhiyunadjustment value are not present so an identifier is considered an
185*4882a593Smuzhiyununstructured sixty-four bit value::
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
188*4882a593Smuzhiyun     |                            Identifier                         |
189*4882a593Smuzhiyun     +                                                               +
190*4882a593Smuzhiyun     |                                                               |
191*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
192*4882a593Smuzhiyun
193*4882a593SmuzhiyunThe checksum neutral adjustment may be configured to always be
194*4882a593Smuzhiyunpresent using neutral-map-auto. In this case there is no C-bit, but the
195*4882a593Smuzhiyunchecksum adjustment is in the low order 16 bits. The identifier is
196*4882a593Smuzhiyunstill sixty-four bits::
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
199*4882a593Smuzhiyun     |                            Identifier                         |
200*4882a593Smuzhiyun     |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
201*4882a593Smuzhiyun     |                               |  Checksum-neutral adjustment  |
202*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203*4882a593Smuzhiyun
204*4882a593SmuzhiyunThe C-bit may used to explicitly indicate that checksum neutral
205*4882a593Smuzhiyunmapping has been applied to an ILA address. The format is::
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
208*4882a593Smuzhiyun     |     |C|                    Identifier                         |
209*4882a593Smuzhiyun     |     +-+                       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
210*4882a593Smuzhiyun     |                               |  Checksum-neutral adjustment  |
211*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
212*4882a593Smuzhiyun
213*4882a593SmuzhiyunThe identifier type field may be present to indicate the identifier
214*4882a593Smuzhiyuntype. If it is not present then the type is inferred based on mapping
215*4882a593Smuzhiyunconfiguration. The checksum neutral adjustment may automatically
216*4882a593Smuzhiyunused with the identifier type as illustrated below::
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219*4882a593Smuzhiyun     | Type|                      Identifier                         |
220*4882a593Smuzhiyun     +-+-+-+                         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221*4882a593Smuzhiyun     |                               |  Checksum-neutral adjustment  |
222*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
223*4882a593Smuzhiyun
224*4882a593SmuzhiyunIf the identifier type and the C-bit can be present simultaneously so
225*4882a593Smuzhiyunthe identifier format would be::
226*4882a593Smuzhiyun
227*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
228*4882a593Smuzhiyun     | Type|C|                    Identifier                         |
229*4882a593Smuzhiyun     +-+-+-+-+                       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
230*4882a593Smuzhiyun     |                               |  Checksum-neutral adjustment  |
231*4882a593Smuzhiyun     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun
234*4882a593SmuzhiyunConfiguration
235*4882a593Smuzhiyun=============
236*4882a593Smuzhiyun
237*4882a593SmuzhiyunThere are two methods to configure ILA mappings. One is by using LWT routes
238*4882a593Smuzhiyunand the other is ila_xlat (called from NFHOOK PREROUTING hook). ila_xlat
239*4882a593Smuzhiyunis intended to be used in the receive path for ILA hosts .
240*4882a593Smuzhiyun
241*4882a593SmuzhiyunAn ILA router has also been implemented in XDP. Description of that is
242*4882a593Smuzhiyunoutside the scope of this document.
243*4882a593Smuzhiyun
244*4882a593SmuzhiyunThe usage of for ILA LWT routes is:
245*4882a593Smuzhiyun
246*4882a593Smuzhiyunip route add DEST/128 encap ila LOC csum-mode MODE ident-type TYPE via ADDR
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunDestination (DEST) can either be a SIR address (for an ILA host or ingress
249*4882a593SmuzhiyunILA router) or an ILA address (egress ILA router). LOC is the sixty-four
250*4882a593Smuzhiyunbit locator (with format W:X:Y:Z) that overwrites the upper sixty-four
251*4882a593Smuzhiyunbits of the destination address.  Checksum MODE is one of "no-action",
252*4882a593Smuzhiyun"adj-transport", "neutral-map", and "neutral-map-auto". If neutral-map is
253*4882a593Smuzhiyunset then the C-bit will be present. Identifier TYPE one of "luid" or
254*4882a593Smuzhiyun"use-format." In the case of use-format, the identifier type field is
255*4882a593Smuzhiyunpresent and the effective type is taken from that.
256*4882a593Smuzhiyun
257*4882a593SmuzhiyunThe usage of ila_xlat is:
258*4882a593Smuzhiyun
259*4882a593Smuzhiyunip ila add loc_match MATCH loc LOC csum-mode MODE ident-type TYPE
260*4882a593Smuzhiyun
261*4882a593SmuzhiyunMATCH indicates the incoming locator that must be matched to apply
262*4882a593Smuzhiyuna the translaiton. LOC is the locator that overwrites the upper
263*4882a593Smuzhiyunsixty-four bits of the destination address. MODE and TYPE have the
264*4882a593Smuzhiyunsame meanings as described above.
265*4882a593Smuzhiyun
266*4882a593Smuzhiyun
267*4882a593SmuzhiyunSome examples
268*4882a593Smuzhiyun=============
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun::
271*4882a593Smuzhiyun
272*4882a593Smuzhiyun     # Configure an ILA route that uses checksum neutral mapping as well
273*4882a593Smuzhiyun     # as type field. Note that the type field is set in the SIR address
274*4882a593Smuzhiyun     # (the 2000 implies type is 1 which is LUID).
275*4882a593Smuzhiyun     ip route add 3333:0:0:1:2000:0:1:87/128 encap ila 2001:0:87:0 \
276*4882a593Smuzhiyun	  csum-mode neutral-map ident-type use-format
277*4882a593Smuzhiyun
278*4882a593Smuzhiyun     # Configure an ILA LWT route that uses auto checksum neutral mapping
279*4882a593Smuzhiyun     # (no C-bit) and configure identifier type to be LUID so that the
280*4882a593Smuzhiyun     # identifier type field will not be present.
281*4882a593Smuzhiyun     ip route add 3333:0:0:1:2000:0:2:87/128 encap ila 2001:0:87:1 \
282*4882a593Smuzhiyun	  csum-mode neutral-map-auto ident-type luid
283*4882a593Smuzhiyun
284*4882a593Smuzhiyun     ila_xlat configuration
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun     # Configure an ILA to SIR mapping that matches a locator and overwrites
287*4882a593Smuzhiyun     # it with a SIR address (3333:0:0:1 in this example). The C-bit and
288*4882a593Smuzhiyun     # identifier field are used.
289*4882a593Smuzhiyun     ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
290*4882a593Smuzhiyun	 csum-mode neutral-map-auto ident-type use-format
291*4882a593Smuzhiyun
292*4882a593Smuzhiyun     # Configure an ILA to SIR mapping where checksum neutral is automatically
293*4882a593Smuzhiyun     # set without the C-bit and the identifier type is configured to be LUID
294*4882a593Smuzhiyun     # so that the identifier type field is not present.
295*4882a593Smuzhiyun     ip ila add loc_match 2001:0:119:0 loc 3333:0:0:1 \
296*4882a593Smuzhiyun	 csum-mode neutral-map-auto ident-type use-format
297