linux-cp: Linux Interface Mirroring for Control Plane Integration
[vpp.git] / src / plugins / linux-cp / lcp.rst
1 .. _Linux_control_plane:
2
3 .. toctree::
4
5 Linux Control Plane Integration
6 ===============================
7
8 Overview
9 ________
10
11 This plugin allows VPP to integrate with the Linux. The
12 general model is that Linux is the network stack, i.e. it has the
13 control plane protocols, like ARP, IPv6 ND/MLD, Ping, etc, and VPP
14 provides a SW based ASIC for forwarding.
15
16 Interfaces
17 __________
18
19 VPP owns the interfaces in the system; physical (.e.g PCI), quasi
20 physical (e.g. vhost), or virtual (e.g. tunnel). However,
21 for the Linux networking stack to function it needs a representation
22 of these interfaces; it needs a mirror image in the kernel. For this
23 mirror we use a Tap interface, if the VPP interface is multi-point, a
24 Tun if it's point-to-point. A physical and its mirror form an
25 interface 'pair'.
26
27 The host interface has two identities; the sw_if_index of the Tap and
28 the virtual interface index in the kernel. It may be in a Linux namespace.
29
30 The creation of the interface pairs is required from the control
31 plane. It can be statically configured in the VPP startup
32 configuration file. The intent here was to make the pair creation
33 explicit, rather than have VPP guess which of the interfaces it owns
34 require a mirror.
35
36 Configuration
37 _____________
38
39 Linux will send and receive packets on the mirrored tap/tun
40 interfaces. Any configuration that is made on these Linux interfaces,
41 also needs to be applied on the corresponding physical interface in
42 VPP.
43
44 This is functionality is not provided in this plugin, but it can be
45 achieved in various ways, for example by listening to the netlink
46 messages and applying the config. As a result all e.g. routes
47 programmed in Linux, will also be present in VPP's FIB.
48
49 Linux will own the [ARP/ND] nieghbor tables (which will be copied via
50 netlink to VPP also). This means that Linux will send packets with the
51 peer's MAC address in the rewrite to VPP. The receiving TAP interface
52 must therefore be in promiscuous mode.
53
54
55 Forwarding
56 __________
57
58 The basic principle is to x-connect traffic from a Linux host interface
59 (received on the Tap/Tun) to its paired the physical, and vice-versa.
60
61 Host to Physical
62 ^^^^^^^^^^^^^^^^
63
64 All packets sent by the host, and received by VPP on a Tap/Tun should
65 be sent to its paired physical interface. However, they should be sent
66 with the same consequences as if they had originated from VPP,
67 i.e. they should be subject to all output features on the physical
68 interface. To achieve this there is a per-IP-address-family (AF) node
69 inserted in the per-AF input feature arc. The node must be per-AF,
70 since it must be a sibling of a start node for the ipX-output feature
71 arc. This node uses the packet's L2 rewrite to search for the
72 adjacency that VPP would have used to send this packet; this adjacency
73 is stored in the buffer's meta data so that it is available to all
74 output features. Then the packet is sent through the physical
75 interface's IP output feature arc.
76 All ARP packets are x-connected from the tap to the physical.
77
78 Physical to Host
79 ^^^^^^^^^^^^^^^^
80
81 All ARP packets received on the physical are sent to the paired
82 Tap. This allows the Linux network stack to build the nieghbour table.
83
84 IP packets that are punted are sent to the host. They are sent on the
85 tap that is paired with the physical on which they were originally
86 received. The packet is sent on the Tap/Tun 'exactly' as it was
87 received (i.e. with the L2 rewrite) but post any translations that
88 input features may have made.
89
90
91 Recommendations
92 ^^^^^^^^^^^^^^^
93
94 When using this plugin disable the ARP, ND, IGMP plugins; this is the
95 task for Linux.
96 Disable ping plugin, since Linux will now respond.