2 * Copyright (c) 2017 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_PACKET_H_
17 #define PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_PACKET_H_
19 #include <vppinfra/clib.h>
20 #include <vnet/ip/ip6_hop_by_hop_packet.h>
21 #include <vnet/udp/udp_packet.h>
23 #define UDP_PING_PROBE 1
24 #define UDP_PING_REPLY 2
26 #define UDP_PING_PROBE_MARKER1 0xDEAD
27 #define UDP_PING_PROBE_MARKER2 0xBEEF
31 * https://tools.ietf.org/html/draft-lapukhov-dataplane-probe-01
33 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
34 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 | Version | Message Type | Flags |
40 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 | Telemetry Request Vector |
42 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 | Hop Limit | Hop Count | Must Be Zero |
44 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 | Maximum Length | Current Length |
46 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 | Sender's Handle | Sequence Number |
48 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50 * (1) The "Probe Marker" fields are arbitrary 32-bit values generally
51 used by the network elements to identify the packet as a probe
52 packet. These fields should be interpreted as unsigned integer
53 values, stored in network byte order. For example, a network
54 element may be configured to recognize a UDP packet destined to
55 port 31337 and having 0xDEAD 0xBEEF as the values in "Probe
56 Marker" field as an active probe, and treat it respectively.
58 (2) "Version Number" is currently set to 1.
60 (3) The "Message Type" field value could be either "1" - "Probe" or
63 (4) The "Flags" field is 8 bits, and defines the following flags:
66 (1) "Overflow" (O-bit) (least significant bit). This bit is
67 set by the network element if the number of records on the
68 packet is at the maximum limit as specified by the packet:
69 i.e. the packet is already "full" of telemetry
72 (6) "Telemetry Request Vector" is a 32-bit long field that requests
73 well-known inband telemetry information from the network
74 elements on the path. A bit set in this vector translates to a
75 request of a particular type of information. The following
76 types/bits are currently defined, starting with the least
77 significant bit first:
79 (1) Bit 0: Device identifier.
83 (3) Bit 2: Queueing delay.
85 (4) Bit 3: Ingress/Egress port identifiers.
87 (5) Bit 31: Opaque state snapshot request.
89 (7) "Hop Limit" is defined only for "Message Type" of "1"
90 ("Probe"). For "Probe Reply" the "Hop Limit" field must be set
91 to zero. This field is treated as an integer value
92 representing the number of network elements. See the Section 4
93 section on the intended use of the field.
95 (8) The "Hop Count" field specifies the current number of hops of
96 capable network elements the packet has transit through. It
97 begins with zero and must be incremented by one for every
98 network element that adds a telemetry record. Combined with a
99 push mechanism, this simplifies the work for the subsequent
100 network element and the packet receiver. The subsequent
101 network element just needs to parse the template and then
102 insert new record(s) immediately after the template.
104 (9) The "Max Length" field specifies the maximum length of the
105 telemetry payload in bytes. Given that the sender knows the
106 minimum path MTU, the sender can set the maximum of payload
107 bytes allowed before exceeding the MTU. Thus, a simple
108 comparison between "Current Length" and "Max Length" allows to
109 decide whether or not data could be added.
111 (10) The "Current Length" field specifies the current length of data
112 stored in the probe. This field is incremented by eacn network
113 element by the number of bytes it has added with the telemetry
116 (11) The "Sender's Handle" field is set by the sender to allow the
117 receiver to identify a particular originator of probe packets.
118 Along with "Sequence Number" it allows for tracking of packet
119 order and loss within the network.
143 udp_ping_data ping_data;
146 #endif /* PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_PACKET_H_ */
149 * fd.io coding-style-patch-verification: ON
152 * eval: (c-set-style "gnu")