blob: 868ac4194f5c8dfc7248d06fe86aeb327132be43 [file] [log] [blame]
Nathan Skrzypczak55c68c92019-07-29 11:18:05 +02001.. _dev_punt:
2
3.. toctree::
Neale Ranns50f0ac02019-05-15 02:13:37 -07004
5Punting Packets
6===============
7
Neale Ranns50f0ac02019-05-15 02:13:37 -07008Overview
9________
10
11To 'punt' can mean different things to different people. In VPP the
12data-plane punts when a packet cannot be handled by any further
13nodes. Punt differs from drop, in that VPP is giving other elements of
14the system the opportunity to handle this packet.
15
16A popular meaning of punt is to send packets to the user/control-plane.
17This is specific option of the more general case above, where VPP is
Paul Vinciguerraf1589442019-10-17 21:08:17 -040018handing the packet to the control-plane for further processing.
Neale Ranns50f0ac02019-05-15 02:13:37 -070019
Nathan Skrzypczak55c68c92019-07-29 11:18:05 +020020The Punt Infrastructure
21_______________________
Neale Ranns50f0ac02019-05-15 02:13:37 -070022
23Exception packets are those that a given node cannot handle via normal
Paul Vinciguerraf1589442019-10-17 21:08:17 -040024mechanisms.
Neale Ranns50f0ac02019-05-15 02:13:37 -070025Punting of exception packets is handled via the VLIB 'punt
26infra'. There are two types of nodes; sources and sinks. Sources
Paul Vinciguerraf1589442019-10-17 21:08:17 -040027allocate a punt 'reason' from the infrastructure and load time. When
28they encounter an exception during switch time it will tag the packet
Neale Ranns50f0ac02019-05-15 02:13:37 -070029with the reason and ship the packet of the the punt-dispatch node. A
30sink will register with the punt infra at load time so it can receive
Paul Vinciguerraf1589442019-10-17 21:08:17 -040031packets that were punted for that reason. If no sinks are registered
Neale Ranns50f0ac02019-05-15 02:13:37 -070032for a given reason the packet is dropped, if multiple sinks register
33the packets are replicated.
34
35This mechanism allows us to extend the system to deal with packets
Paul Vinciguerraf1589442019-10-17 21:08:17 -040036that the source node would otherwise drop.
Neale Ranns50f0ac02019-05-15 02:13:37 -070037
38
39Punting to the Control Plane
Nathan Skrzypczak55c68c92019-07-29 11:18:05 +020040____________________________
Neale Ranns50f0ac02019-05-15 02:13:37 -070041
42Active Punt
43-----------
44
45The user/control-plane specifies that this is the type of packet I
46want to receive and this is where I want it sent.
47
48Currently there exists 3 ways to describe how to match/classify the
49packets to be punted:
Nathan Skrzypczak55c68c92019-07-29 11:18:05 +020050
511) a matching UDP port
522) a matching IP protocol (i.e. OSPF)
Paul Vinciguerraf1589442019-10-17 21:08:17 -0400533) a matching punt exception reason (see above)
Neale Ranns50f0ac02019-05-15 02:13:37 -070054
55Depending on the type/classification of the packet to be punted, that
56active punt will register itself into the VLIB graph to receive those
57packets. For example, if it's a packet matching a UDP port then it
58will hook into the UDP port dispatch functions; udp_register_port().
59
60There exists only one sink for passive punt, a unix domain socket. But
61more work is underway in this area.
62
63see the API in: vnet/ip/punt.api
64
65
66
67Passive Punt
68------------
69
70VPP input packet processing can be described as a series of
71classifiers. For example, a sequence of input classifications could
72be, is it IP? is it for-us? is it UDP? is it a known UDP-port? If at
Paul Vinciguerraf1589442019-10-17 21:08:17 -040073some point in this pipeline VPP has no further classifications to make,
Neale Ranns50f0ac02019-05-15 02:13:37 -070074then the packet can be punted, which means sent to ipX-punt node. This
75is described as passive since the control-plane is thus receiving
76every packet that VPP does not itself handle.
77For passive punt the user can specify where the packets should be
78sent and whether/how they should be policed/rate-limited.
79
80see the API in: vnet/ip/ip.api
81