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