2 * Copyright (c) 2015 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.
15 #include <vlib/vlib.h>
16 #include <vnet/vnet.h>
17 #include <vnet/pg/pg.h>
18 #include <vppinfra/error.h>
20 #include <vnet/ip/ip.h>
22 #include <vppinfra/hash.h>
23 #include <vppinfra/error.h>
24 #include <vppinfra/elog.h>
26 #include <vnet/ip/ip6_hop_by_hop.h>
28 /* Timestamp precision multipliers for seconds, milliseconds, microseconds
29 * and nanoseconds respectively.
31 static f64 trace_tsp_mul[4] = {1, 1e3, 1e6, 1e9};
33 char *ppc_state[] = {"None", "Encap", "Decap"};
35 ip6_hop_by_hop_main_t ip6_hop_by_hop_main;
38 * ip6 hop-by-hop option handling. We push pkts with h-b-h options to
39 * ip6_hop_by_hop_node_fn from ip6-lookup at a cost of ~2 clocks/pkt in
42 * We parse through the h-b-h option TLVs, specifically looking for
43 * HBH_OPTION_TYPE_IOAM_DATA_LIST. [Someone needs to get bananas from
44 * IANA, aka to actually allocate the option TLV codes.]
46 * If we find the indicated option type, and we have remaining list
47 * elements in the trace list, allocate and populate the trace list
50 * At the ingress edge: punch in the h-b-h rewrite, then visit the
51 * standard h-b-h option handler. We have to be careful in the standard
52 * h-b-h handler, to avoid looping until we run out of rewrite space.
53 * Ask me how I know that.
56 * decide on egress point "pop and count" scheme
57 * time stamp handling: usec since the top of the hour?
58 * configure the node id
59 * trace list application data support
60 * cons up analysis / steering plug-in(s)
61 * add configuration binary APIs, vpp_api_test_support, yang models and
63 * perf tune: dual loop, replace memcpy w/ N x 8-byte load/stores
68 * primary h-b-h handler trace support
69 * We work pretty hard on the problem for obvious reasons
74 u32 timestamp_msbs; /* Store the top set of bits of timestamp */
76 } ip6_hop_by_hop_trace_t;
84 fetch_trace_data_size(u8 trace_type)
86 u8 trace_data_size = 0;
88 if (trace_type == TRACE_TYPE_IF_TS_APP)
89 trace_data_size = sizeof(ioam_trace_if_ts_app_t);
90 else if(trace_type == TRACE_TYPE_IF)
91 trace_data_size = sizeof(ioam_trace_if_t);
92 else if(trace_type == TRACE_TYPE_TS)
93 trace_data_size = sizeof(ioam_trace_ts_t);
94 else if(trace_type == TRACE_TYPE_APP)
95 trace_data_size = sizeof(ioam_trace_app_t);
96 else if(trace_type == TRACE_TYPE_TS_APP)
97 trace_data_size = sizeof(ioam_trace_ts_app_t);
99 return trace_data_size;
102 static u8 * format_ioam_data_list_element (u8 * s, va_list * args)
104 u32 *elt = va_arg (*args, u32 *);
105 u8 *trace_type_p = va_arg (*args, u8 *);
106 u8 trace_type = *trace_type_p;
109 if (trace_type & BIT_TTL_NODEID)
111 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*elt);
112 s = format (s, "ttl 0x%x node id 0x%x ",
113 ttl_node_id_host_byte_order>>24,
114 ttl_node_id_host_byte_order & 0x00FFFFFF);
119 if (trace_type & BIT_ING_INTERFACE && trace_type & BIT_ING_INTERFACE)
121 u32 ingress_host_byte_order = clib_net_to_host_u32(*elt);
122 s = format (s, "ingress 0x%x egress 0x%x ",
123 ingress_host_byte_order >> 16,
124 ingress_host_byte_order &0xFFFF);
128 if (trace_type & BIT_TIMESTAMP)
130 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*elt);
131 s = format (s, "ts 0x%x \n", ts_in_host_byte_order);
135 if (trace_type & BIT_APPDATA)
137 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*elt);
138 s = format (s, "app 0x%x ", appdata_in_host_byte_order);
145 static u8 * format_ip6_hop_by_hop_trace (u8 * s, va_list * args)
147 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
148 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
149 ip6_hop_by_hop_trace_t * t = va_arg (*args, ip6_hop_by_hop_trace_t *);
150 ip6_hop_by_hop_header_t *hbh0;
151 ip6_hop_by_hop_option_t *opt0, *limit0;
152 ioam_trace_option_t * trace0;
153 u8 trace_data_size_in_words = 0;
158 hbh0 = (ip6_hop_by_hop_header_t *)t->option_data;
160 s = format (s, "IP6_HOP_BY_HOP: next index %d len %d traced %d\n",
161 t->next_index, (hbh0->length+1)<<3, t->trace_len);
163 opt0 = (ip6_hop_by_hop_option_t *) (hbh0+1);
164 limit0 = (ip6_hop_by_hop_option_t *) ((u8 *)hbh0) + t->trace_len;
166 while (opt0 < limit0)
168 type0 = opt0->type & HBH_OPTION_TYPE_MASK;
172 case HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST:
173 trace0 = (ioam_trace_option_t *)opt0;
174 s = format (s, " Trace Type 0x%x , %d elts left ts msb(s) 0x%x\n",
175 trace0->ioam_trace_type, trace0->data_list_elts_left,
177 trace_data_size_in_words =
178 fetch_trace_data_size(trace0->ioam_trace_type)/4;
179 elt0 = &trace0->elts[0];
181 ((u8 *)(&trace0->elts[0]) + trace0->hdr.length - 2
182 /* -2 accounts for ioam_trace_type,elts_left */))
184 s = format (s, " [%d] %U\n",elt_index,
185 format_ioam_data_list_element,
186 elt0, &trace0->ioam_trace_type);
188 elt0 += trace_data_size_in_words;
191 opt0 = (ip6_hop_by_hop_option_t *)
192 (((u8 *)opt0) + opt0->length
193 + sizeof (ip6_hop_by_hop_option_t));
196 case HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK:
197 s = format (s, " POW opt present\n");
198 opt0 = (ip6_hop_by_hop_option_t *)
199 (((u8 *)opt0) + sizeof (ioam_pow_option_t));
202 case 0: /* Pad, just stop */
203 opt0 = (ip6_hop_by_hop_option_t *) ((u8 *)opt0) + 1;
207 s = format (s, "Unknown %d", type0);
208 opt0 = (ip6_hop_by_hop_option_t *)
209 (((u8 *)opt0) + opt0->length
210 + sizeof (ip6_hop_by_hop_option_t));
217 vlib_node_registration_t ip6_hop_by_hop_node;
219 #define foreach_ip6_hop_by_hop_error \
220 _(PROCESSED, "Pkts with ip6 hop-by-hop options")
223 #define _(sym,str) IP6_HOP_BY_HOP_ERROR_##sym,
224 foreach_ip6_hop_by_hop_error
226 IP6_HOP_BY_HOP_N_ERROR,
227 } ip6_hop_by_hop_error_t;
229 static char * ip6_hop_by_hop_error_strings[] = {
230 #define _(sym,string) string,
231 foreach_ip6_hop_by_hop_error
236 ip6_hop_by_hop_node_fn (vlib_main_t * vm,
237 vlib_node_runtime_t * node,
238 vlib_frame_t * frame)
240 ip6_main_t * im = &ip6_main;
241 ip_lookup_main_t * lm = &im->lookup_main;
242 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
243 u32 n_left_from, * from, * to_next;
244 ip_lookup_next_t next_index;
250 from = vlib_frame_vector_args (frame);
251 n_left_from = frame->n_vectors;
252 next_index = node->cached_next_index;
254 while (n_left_from > 0)
258 vlib_get_next_frame (vm, node, next_index,
259 to_next, n_left_to_next);
261 #if 0 /* $$$ DUAL-LOOP ME */
262 while (n_left_from >= 4 && n_left_to_next >= 2)
264 u32 next0 = IP6_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
265 u32 next1 = IP6_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
266 u32 sw_if_index0, sw_if_index1;
268 ethernet_header_t *en0, *en1;
270 vlib_buffer_t * b0, * b1;
272 /* Prefetch next iteration. */
274 vlib_buffer_t * p2, * p3;
276 p2 = vlib_get_buffer (vm, from[2]);
277 p3 = vlib_get_buffer (vm, from[3]);
279 vlib_prefetch_buffer_header (p2, LOAD);
280 vlib_prefetch_buffer_header (p3, LOAD);
282 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
283 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
286 /* speculatively enqueue b0 and b1 to the current next frame */
287 to_next[0] = bi0 = from[0];
288 to_next[1] = bi1 = from[1];
294 b0 = vlib_get_buffer (vm, bi0);
295 b1 = vlib_get_buffer (vm, bi1);
297 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
298 ASSERT (b0->current_data == 0);
299 ASSERT (b1->current_data == 0);
301 ip0 = vlib_buffer_get_current (b0);
302 ip1 = vlib_buffer_get_current (b0);
304 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
305 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
307 /* $$$$$ End of processing 2 x packets $$$$$ */
309 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
311 if (b0->flags & VLIB_BUFFER_IS_TRACED)
313 ip6_hop_by_hop_trace_t *t =
314 vlib_add_trace (vm, node, b0, sizeof (*t));
315 t->sw_if_index = sw_if_index0;
316 t->next_index = next0;
318 if (b1->flags & VLIB_BUFFER_IS_TRACED)
320 ip6_hop_by_hop_trace_t *t =
321 vlib_add_trace (vm, node, b1, sizeof (*t));
322 t->sw_if_index = sw_if_index1;
323 t->next_index = next1;
327 /* verify speculative enqueues, maybe switch current next frame */
328 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
329 to_next, n_left_to_next,
330 bi0, bi1, next0, next1);
334 while (n_left_from > 0 && n_left_to_next > 0)
341 ip_adjacency_t * adj0;
342 ip6_hop_by_hop_header_t *hbh0;
343 ip6_hop_by_hop_option_t *opt0, *limit0;
344 ioam_trace_option_t * trace0;
348 /* speculatively enqueue b0 to the current next frame */
356 b0 = vlib_get_buffer (vm, bi0);
358 ip0 = vlib_buffer_get_current (b0);
359 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
360 adj0 = ip_get_adjacency (lm, adj_index0);
361 hbh0 = (ip6_hop_by_hop_header_t *)(ip0+1);
362 opt0 = (ip6_hop_by_hop_option_t *)(hbh0+1);
363 limit0 = (ip6_hop_by_hop_option_t *)
364 ((u8 *)hbh0 + ((hbh0->length+1)<<3));
366 /* Scan the set of h-b-h options, process ones that we understand */
367 while (opt0 < limit0)
369 type0 = opt0->type & HBH_OPTION_TYPE_MASK;
372 case HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST:
373 trace0 = (ioam_trace_option_t *)opt0;
374 if (PREDICT_TRUE (trace0->data_list_elts_left))
376 trace0->data_list_elts_left--;
377 /* fetch_trace_data_size returns in bytes. Convert it to 4-bytes
378 * to skip to this node's location.
380 elt_index = trace0->data_list_elts_left *
381 fetch_trace_data_size(trace0->ioam_trace_type)/4;
382 elt0 = &trace0->elts[elt_index];
383 if (trace0->ioam_trace_type & BIT_TTL_NODEID)
386 clib_host_to_net_u32 ((ip0->hop_limit<<24)
391 if (trace0->ioam_trace_type & BIT_ING_INTERFACE)
394 (vnet_buffer(b0)->sw_if_index[VLIB_RX]&0xFFFF) << 16 | (adj0->rewrite_header.sw_if_index & 0xFFFF);
395 *elt0 = clib_host_to_net_u32(*elt0);
399 if (trace0->ioam_trace_type & BIT_TIMESTAMP)
401 /* Send least significant 32 bits */
402 f64 time_f64 = (f64)(((f64)hm->unix_time_0) +
403 (vlib_time_now(hm->vlib_main) - hm->vlib_time_0));
406 time_f64 * trace_tsp_mul[hm->trace_tsp];
407 *elt0 = clib_host_to_net_u32(time_u64.as_u32[0]);
411 if (trace0->ioam_trace_type & BIT_APPDATA)
413 /* $$$ set elt0->app_data */
414 *elt0 = clib_host_to_net_u32(hm->app_data);
419 opt0 = (ip6_hop_by_hop_option_t *)
420 (((u8 *)opt0) + opt0->length
421 + sizeof (ip6_hop_by_hop_option_t));
424 case HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK:
425 opt0 = (ip6_hop_by_hop_option_t *)
426 (((u8 *)opt0) + sizeof (ioam_pow_option_t));
430 opt0 = (ip6_hop_by_hop_option_t *) ((u8 *)opt0) + 1;
434 opt0 = (ip6_hop_by_hop_option_t *)
435 (((u8 *)opt0) + opt0->length
436 + sizeof (ip6_hop_by_hop_option_t));
444 * Since we push pkts here from the h-b-h header imposition code
445 * we have to be careful what we wish for...
447 next0 = adj0->lookup_next_index != IP_LOOKUP_NEXT_ADD_HOP_BY_HOP ?
448 adj0->lookup_next_index : adj0->saved_lookup_next_index;
450 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
451 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
453 ip6_hop_by_hop_trace_t *t =
454 vlib_add_trace (vm, node, b0, sizeof (*t));
455 u32 trace_len = (hbh0->length+1)<<3;
456 t->next_index = next0;
457 /* Capture the h-b-h option verbatim */
458 trace_len = trace_len < ARRAY_LEN(t->option_data) ?
459 trace_len : ARRAY_LEN(t->option_data);
460 t->trace_len = trace_len;
461 t->timestamp_msbs = time_u64.as_u32[1];
462 memcpy (t->option_data, hbh0, trace_len);
467 /* verify speculative enqueue, maybe switch current next frame */
468 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
469 to_next, n_left_to_next,
473 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
476 vlib_node_increment_counter (vm, ip6_hop_by_hop_node.index,
477 IP6_HOP_BY_HOP_ERROR_PROCESSED, processed);
478 return frame->n_vectors;
481 VLIB_REGISTER_NODE (ip6_hop_by_hop_node) = {
482 .function = ip6_hop_by_hop_node_fn,
483 .name = "ip6-hop-by-hop",
484 .vector_size = sizeof (u32),
485 .format_trace = format_ip6_hop_by_hop_trace,
486 .type = VLIB_NODE_TYPE_INTERNAL,
488 .n_errors = ARRAY_LEN(ip6_hop_by_hop_error_strings),
489 .error_strings = ip6_hop_by_hop_error_strings,
491 /* See ip/lookup.h */
492 .n_next_nodes = IP_LOOKUP_N_NEXT,
494 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
495 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
496 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
497 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
498 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
499 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
500 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
501 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
502 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
503 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
504 /* Next 3 arcs probably never used */
505 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
506 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
507 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
511 /* The main h-b-h tracer will be invoked, no need to do much here */
514 } ip6_add_hop_by_hop_trace_t;
516 /* packet trace format function */
517 static u8 * format_ip6_add_hop_by_hop_trace (u8 * s, va_list * args)
519 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
520 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
521 ip6_add_hop_by_hop_trace_t * t = va_arg (*args,
522 ip6_add_hop_by_hop_trace_t *);
524 s = format (s, "IP6_ADD_HOP_BY_HOP: next index %d",
529 vlib_node_registration_t ip6_add_hop_by_hop_node;
531 #define foreach_ip6_add_hop_by_hop_error \
532 _(PROCESSED, "Pkts w/ added ip6 hop-by-hop options")
535 #define _(sym,str) IP6_ADD_HOP_BY_HOP_ERROR_##sym,
536 foreach_ip6_add_hop_by_hop_error
538 IP6_ADD_HOP_BY_HOP_N_ERROR,
539 } ip6_add_hop_by_hop_error_t;
541 static char * ip6_add_hop_by_hop_error_strings[] = {
542 #define _(sym,string) string,
543 foreach_ip6_add_hop_by_hop_error
548 ip6_add_hop_by_hop_node_fn (vlib_main_t * vm,
549 vlib_node_runtime_t * node,
550 vlib_frame_t * frame)
552 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
553 u32 n_left_from, * from, * to_next;
554 ip_lookup_next_t next_index;
556 u8 * rewrite = hm->rewrite;
557 u32 rewrite_length = vec_len (rewrite);
559 from = vlib_frame_vector_args (frame);
560 n_left_from = frame->n_vectors;
561 next_index = node->cached_next_index;
563 while (n_left_from > 0)
567 vlib_get_next_frame (vm, node, next_index,
568 to_next, n_left_to_next);
571 while (n_left_from >= 4 && n_left_to_next >= 2)
573 u32 next0 = IP6_ADD_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
574 u32 next1 = IP6_ADD_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
575 u32 sw_if_index0, sw_if_index1;
577 ethernet_header_t *en0, *en1;
579 vlib_buffer_t * b0, * b1;
581 /* Prefetch next iteration. */
583 vlib_buffer_t * p2, * p3;
585 p2 = vlib_get_buffer (vm, from[2]);
586 p3 = vlib_get_buffer (vm, from[3]);
588 vlib_prefetch_buffer_header (p2, LOAD);
589 vlib_prefetch_buffer_header (p3, LOAD);
591 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
592 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
595 /* speculatively enqueue b0 and b1 to the current next frame */
596 to_next[0] = bi0 = from[0];
597 to_next[1] = bi1 = from[1];
603 b0 = vlib_get_buffer (vm, bi0);
604 b1 = vlib_get_buffer (vm, bi1);
606 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
607 ASSERT (b0->current_data == 0);
608 ASSERT (b1->current_data == 0);
610 ip0 = vlib_buffer_get_current (b0);
611 ip1 = vlib_buffer_get_current (b0);
613 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
614 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
616 /* $$$$$ End of processing 2 x packets $$$$$ */
618 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
620 if (b0->flags & VLIB_BUFFER_IS_TRACED)
622 ip6_add_hop_by_hop_trace_t *t =
623 vlib_add_trace (vm, node, b0, sizeof (*t));
624 t->sw_if_index = sw_if_index0;
625 t->next_index = next0;
627 if (b1->flags & VLIB_BUFFER_IS_TRACED)
629 ip6_add_hop_by_hop_trace_t *t =
630 vlib_add_trace (vm, node, b1, sizeof (*t));
631 t->sw_if_index = sw_if_index1;
632 t->next_index = next1;
636 /* verify speculative enqueues, maybe switch current next frame */
637 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
638 to_next, n_left_to_next,
639 bi0, bi1, next0, next1);
643 while (n_left_from > 0 && n_left_to_next > 0)
649 ip6_hop_by_hop_header_t * hbh0;
650 u64 * copy_src0, * copy_dst0;
653 /* speculatively enqueue b0 to the current next frame */
661 b0 = vlib_get_buffer (vm, bi0);
663 ip0 = vlib_buffer_get_current (b0);
665 /* Copy the ip header left by the required amount */
666 copy_dst0 = (u64 *)(((u8 *)ip0) - rewrite_length);
667 copy_src0 = (u64 *) ip0;
669 copy_dst0 [0] = copy_src0 [0];
670 copy_dst0 [1] = copy_src0 [1];
671 copy_dst0 [2] = copy_src0 [2];
672 copy_dst0 [3] = copy_src0 [3];
673 copy_dst0 [4] = copy_src0 [4];
674 vlib_buffer_advance (b0, - (word)rewrite_length);
675 ip0 = vlib_buffer_get_current (b0);
677 hbh0 = (ip6_hop_by_hop_header_t *)(ip0 + 1);
678 /* $$$ tune, rewrite_length is a multiple of 8 */
679 memcpy (hbh0, rewrite, rewrite_length);
680 /* Patch the protocol chain, insert the h-b-h (type 0) header */
681 hbh0->protocol = ip0->protocol;
683 new_l0 = clib_net_to_host_u16 (ip0->payload_length) + rewrite_length;
684 ip0->payload_length = clib_host_to_net_u16 (new_l0);
686 /* Populate the (first) h-b-h list elt */
687 next0 = IP_LOOKUP_NEXT_HOP_BY_HOP;
689 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
690 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
692 ip6_add_hop_by_hop_trace_t *t =
693 vlib_add_trace (vm, node, b0, sizeof (*t));
694 t->next_index = next0;
699 /* verify speculative enqueue, maybe switch current next frame */
700 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
701 to_next, n_left_to_next,
705 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
708 vlib_node_increment_counter (vm, ip6_add_hop_by_hop_node.index,
709 IP6_ADD_HOP_BY_HOP_ERROR_PROCESSED, processed);
710 return frame->n_vectors;
713 VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = {
714 .function = ip6_add_hop_by_hop_node_fn,
715 .name = "ip6-add-hop-by-hop",
716 .vector_size = sizeof (u32),
717 .format_trace = format_ip6_add_hop_by_hop_trace,
718 .type = VLIB_NODE_TYPE_INTERNAL,
720 .n_errors = ARRAY_LEN(ip6_add_hop_by_hop_error_strings),
721 .error_strings = ip6_add_hop_by_hop_error_strings,
723 /* See ip/lookup.h */
724 .n_next_nodes = IP_LOOKUP_N_NEXT,
726 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
727 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
728 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
729 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
730 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
731 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
732 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
733 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
734 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
735 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
736 /* Next 3 arcs probably never used */
737 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
738 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
739 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
744 /* The main h-b-h tracer was already invoked, no need to do much here */
747 } ip6_pop_hop_by_hop_trace_t;
749 /* packet trace format function */
750 static u8 * format_ip6_pop_hop_by_hop_trace (u8 * s, va_list * args)
752 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
753 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
754 ip6_pop_hop_by_hop_trace_t * t = va_arg (*args, ip6_pop_hop_by_hop_trace_t *);
756 s = format (s, "IP6_POP_HOP_BY_HOP: next index %d",
761 vlib_node_registration_t ip6_pop_hop_by_hop_node;
763 #define foreach_ip6_pop_hop_by_hop_error \
764 _(PROCESSED, "Pkts w/ removed ip6 hop-by-hop options") \
765 _(NO_HOHO, "Pkts w/ no ip6 hop-by-hop options")
768 #define _(sym,str) IP6_POP_HOP_BY_HOP_ERROR_##sym,
769 foreach_ip6_pop_hop_by_hop_error
771 IP6_POP_HOP_BY_HOP_N_ERROR,
772 } ip6_pop_hop_by_hop_error_t;
774 static char * ip6_pop_hop_by_hop_error_strings[] = {
775 #define _(sym,string) string,
776 foreach_ip6_pop_hop_by_hop_error
781 ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm,
782 vlib_node_runtime_t * node,
783 vlib_frame_t * frame)
785 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
786 ip6_main_t * im = &ip6_main;
787 ip_lookup_main_t * lm = &im->lookup_main;
788 u32 n_left_from, * from, * to_next;
789 ip_lookup_next_t next_index;
792 u32 (*ioam_end_of_path_cb) (vlib_main_t *, vlib_node_runtime_t *,
793 vlib_buffer_t *, ip6_header_t *,
796 ioam_end_of_path_cb = hm->ioam_end_of_path_cb;
798 from = vlib_frame_vector_args (frame);
799 n_left_from = frame->n_vectors;
800 next_index = node->cached_next_index;
802 while (n_left_from > 0)
806 vlib_get_next_frame (vm, node, next_index,
807 to_next, n_left_to_next);
810 while (n_left_from >= 4 && n_left_to_next >= 2)
812 u32 next0 = IP6_POP_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
813 u32 next1 = IP6_POP_HOP_BY_HOP_NEXT_INTERFACE_OUTPUT;
814 u32 sw_if_index0, sw_if_index1;
816 ethernet_header_t *en0, *en1;
818 vlib_buffer_t * b0, * b1;
820 /* Prefetch next iteration. */
822 vlib_buffer_t * p2, * p3;
824 p2 = vlib_get_buffer (vm, from[2]);
825 p3 = vlib_get_buffer (vm, from[3]);
827 vlib_prefetch_buffer_header (p2, LOAD);
828 vlib_prefetch_buffer_header (p3, LOAD);
830 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
831 CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
834 /* speculatively enqueue b0 and b1 to the current next frame */
835 to_next[0] = bi0 = from[0];
836 to_next[1] = bi1 = from[1];
842 b0 = vlib_get_buffer (vm, bi0);
843 b1 = vlib_get_buffer (vm, bi1);
845 /* $$$$$ Dual loop: process 2 x packets here $$$$$ */
846 ASSERT (b0->current_data == 0);
847 ASSERT (b1->current_data == 0);
849 ip0 = vlib_buffer_get_current (b0);
850 ip1 = vlib_buffer_get_current (b0);
852 sw_if_index0 = vnet_buffer(b0)->sw_if_index[VLIB_RX];
853 sw_if_index1 = vnet_buffer(b1)->sw_if_index[VLIB_RX];
855 /* $$$$$ End of processing 2 x packets $$$$$ */
857 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)))
859 if (b0->flags & VLIB_BUFFER_IS_TRACED)
861 ip6_pop_hop_by_hop_trace_t *t =
862 vlib_add_trace (vm, node, b0, sizeof (*t));
863 t->sw_if_index = sw_if_index0;
864 t->next_index = next0;
866 if (b1->flags & VLIB_BUFFER_IS_TRACED)
868 ip6_pop_hop_by_hop_trace_t *t =
869 vlib_add_trace (vm, node, b1, sizeof (*t));
870 t->sw_if_index = sw_if_index1;
871 t->next_index = next1;
875 /* verify speculative enqueues, maybe switch current next frame */
876 vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
877 to_next, n_left_to_next,
878 bi0, bi1, next0, next1);
882 while (n_left_from > 0 && n_left_to_next > 0)
889 ip_adjacency_t * adj0;
890 ip6_hop_by_hop_header_t *hbh0;
891 u64 * copy_dst0, * copy_src0;
894 /* speculatively enqueue b0 to the current next frame */
902 b0 = vlib_get_buffer (vm, bi0);
904 ip0 = vlib_buffer_get_current (b0);
905 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
906 adj0 = ip_get_adjacency (lm, adj_index0);
908 /* Perfectly normal to end up here w/ out h-b-h header */
909 if (PREDICT_TRUE (ip0->protocol == 0))
911 hbh0 = (ip6_hop_by_hop_header_t *)(ip0+1);
913 /* Collect data from trace via callback */
914 next0 = ioam_end_of_path_cb ?
915 ioam_end_of_path_cb (vm, node, b0, ip0, adj0)
916 : adj0->saved_lookup_next_index;
919 /* Pop the trace data */
920 vlib_buffer_advance (b0, (hbh0->length+1)<<3);
921 new_l0 = clib_net_to_host_u16 (ip0->payload_length) -
922 ((hbh0->length+1)<<3);
923 ip0->payload_length = clib_host_to_net_u16 (new_l0);
924 ip0->protocol = hbh0->protocol;
925 copy_src0 = (u64 *)ip0;
926 copy_dst0 = copy_src0 + (hbh0->length+1);
927 copy_dst0 [4] = copy_src0[4];
928 copy_dst0 [3] = copy_src0[3];
929 copy_dst0 [2] = copy_src0[2];
930 copy_dst0 [1] = copy_src0[1];
931 copy_dst0 [0] = copy_src0[0];
936 next0 = adj0->saved_lookup_next_index;
940 if (PREDICT_FALSE((node->flags & VLIB_NODE_FLAG_TRACE)
941 && (b0->flags & VLIB_BUFFER_IS_TRACED)))
943 ip6_pop_hop_by_hop_trace_t *t =
944 vlib_add_trace (vm, node, b0, sizeof (*t));
945 t->next_index = next0;
948 /* verify speculative enqueue, maybe switch current next frame */
949 vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
950 to_next, n_left_to_next,
954 vlib_put_next_frame (vm, node, next_index, n_left_to_next);
957 vlib_node_increment_counter (vm, ip6_pop_hop_by_hop_node.index,
958 IP6_POP_HOP_BY_HOP_ERROR_PROCESSED, processed);
959 vlib_node_increment_counter (vm, ip6_pop_hop_by_hop_node.index,
960 IP6_POP_HOP_BY_HOP_ERROR_NO_HOHO, no_header);
961 return frame->n_vectors;
964 VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = {
965 .function = ip6_pop_hop_by_hop_node_fn,
966 .name = "ip6-pop-hop-by-hop",
967 .vector_size = sizeof (u32),
968 .format_trace = format_ip6_pop_hop_by_hop_trace,
969 .type = VLIB_NODE_TYPE_INTERNAL,
971 .n_errors = ARRAY_LEN(ip6_pop_hop_by_hop_error_strings),
972 .error_strings = ip6_pop_hop_by_hop_error_strings,
974 /* See ip/lookup.h */
975 .n_next_nodes = IP_LOOKUP_N_NEXT,
977 [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
978 [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
979 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
980 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
981 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
982 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
983 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
984 [IP_LOOKUP_NEXT_MAP] = "ip6-map",
985 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
986 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
987 /* Next 3 arcs probably never used */
988 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
989 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
990 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
995 static clib_error_t *
996 ip6_hop_by_hop_init (vlib_main_t * vm)
998 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
1001 hm->vnet_main = vnet_get_main();
1002 hm->unix_time_0 = (u32) time (0); /* Store starting time */
1003 hm->vlib_time_0 = vlib_time_now (vm);
1004 hm->ioam_flag = IOAM_HBYH_MOD;
1005 hm->trace_tsp = TSP_MICROSECONDS; /* Micro seconds */
1010 VLIB_INIT_FUNCTION (ip6_hop_by_hop_init);
1012 int ip6_ioam_set_rewrite (u8 **rwp, u32 trace_type, u32 trace_option_elts,
1013 int has_pow_option, int has_ppc_option)
1017 ip6_hop_by_hop_header_t *hbh;
1018 ioam_trace_option_t * trace_option;
1019 ioam_pow_option_t * pow_option;
1021 u8 trace_data_size = 0;
1025 if (trace_option_elts == 0 && has_pow_option == 0)
1028 /* Work out how much space we need */
1029 size = sizeof (ip6_hop_by_hop_header_t);
1031 if (trace_option_elts)
1033 size += sizeof (ip6_hop_by_hop_option_t);
1035 trace_data_size = fetch_trace_data_size(trace_type);
1036 if (trace_data_size == 0)
1037 return VNET_API_ERROR_INVALID_VALUE;
1039 if (trace_option_elts * trace_data_size > 254)
1040 return VNET_API_ERROR_INVALID_VALUE;
1042 size += trace_option_elts * trace_data_size;
1046 size += sizeof (ip6_hop_by_hop_option_t);
1047 size += sizeof (ioam_pow_option_t);
1050 /* Round to a multiple of 8 octets */
1051 rnd_size = (size + 7) & ~7;
1053 /* allocate it, zero-fill / pad by construction */
1054 vec_validate (rewrite, rnd_size-1);
1056 hbh = (ip6_hop_by_hop_header_t *) rewrite;
1057 /* Length of header in 8 octet units, not incl first 8 octets */
1058 hbh->length = (rnd_size>>3) - 1;
1059 current = (u8 *)(hbh+1);
1061 if (trace_option_elts)
1063 trace_option = (ioam_trace_option_t *)current;
1064 trace_option->hdr.type = HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
1065 | HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE;
1066 trace_option->hdr.length =
1067 2 /*ioam_trace_type,data_list_elts_left */ +
1068 trace_option_elts * trace_data_size;
1069 trace_option->ioam_trace_type = trace_type & TRACE_TYPE_MASK;
1070 trace_option->data_list_elts_left = trace_option_elts;
1071 current += sizeof (ioam_trace_option_t) +
1072 trace_option_elts * trace_data_size;
1076 pow_option = (ioam_pow_option_t *)current;
1077 pow_option->hdr.type = HBH_OPTION_TYPE_IOAM_PROOF_OF_WORK
1078 | HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE;
1079 pow_option->hdr.length = sizeof (ioam_pow_option_t) -
1080 sizeof (ip6_hop_by_hop_option_t);
1081 current += sizeof (ioam_pow_option_t);
1089 clear_ioam_rewrite_fn(void)
1091 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1093 vec_free(hm->rewrite);
1098 hm->trace_option_elts = 0;
1099 hm->has_pow_option = 0;
1100 hm->has_ppc_option = 0;
1101 hm->trace_tsp = TSP_MICROSECONDS;
1106 clib_error_t * clear_ioam_rewrite_command_fn (vlib_main_t * vm,
1107 unformat_input_t * input,
1108 vlib_cli_command_t * cmd)
1110 return(clear_ioam_rewrite_fn());
1113 VLIB_CLI_COMMAND (ip6_clear_ioam_trace_cmd, static) = {
1114 .path = "clear ioam rewrite",
1115 .short_help = "clear ioam rewrite",
1116 .function = clear_ioam_rewrite_command_fn,
1120 ip6_ioam_trace_profile_set(u32 trace_option_elts, u32 trace_type, u32 node_id,
1121 u32 app_data, int has_pow_option, u32 trace_tsp,
1125 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1126 rv = ip6_ioam_set_rewrite (&hm->rewrite, trace_type, trace_option_elts,
1127 has_pow_option, has_ppc_option);
1132 hm->node_id = node_id;
1133 hm->app_data = app_data;
1134 hm->trace_type = trace_type;
1135 hm->trace_option_elts = trace_option_elts;
1136 hm->has_pow_option = has_pow_option;
1137 hm->has_ppc_option = has_ppc_option;
1138 hm->trace_tsp = trace_tsp;
1142 return clib_error_return_code(0, rv, 0, "ip6_ioam_set_rewrite returned %d", rv);
1149 static clib_error_t *
1150 ip6_set_ioam_rewrite_command_fn (vlib_main_t * vm,
1151 unformat_input_t * input,
1152 vlib_cli_command_t * cmd)
1154 u32 trace_option_elts = 0;
1155 u32 trace_type = 0, node_id = 0;
1156 u32 app_data = 0, trace_tsp = TSP_MICROSECONDS;
1157 int has_pow_option = 0;
1158 int has_ppc_option = 0;
1159 clib_error_t * rv = 0;
1161 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1163 if (unformat (input, "trace-type 0x%x trace-elts %d "
1164 "trace-tsp %d node-id 0x%x app-data 0x%x",
1165 &trace_type, &trace_option_elts, &trace_tsp,
1166 &node_id, &app_data))
1168 else if (unformat (input, "pow"))
1170 else if (unformat (input, "ppc encap"))
1171 has_ppc_option = PPC_ENCAP;
1172 else if (unformat (input, "ppc decap"))
1173 has_ppc_option = PPC_DECAP;
1174 else if (unformat (input, "ppc none"))
1175 has_ppc_option = PPC_NONE;
1181 rv = ip6_ioam_trace_profile_set(trace_option_elts, trace_type, node_id,
1182 app_data, has_pow_option, trace_tsp, has_ppc_option);
1188 VLIB_CLI_COMMAND (ip6_set_ioam_rewrite_cmd, static) = {
1189 .path = "set ioam rewrite",
1190 .short_help = "set ioam rewrite trace-type <0x1f|0x3|0x9|0x11|0x19> trace-elts <nn> trace-tsp <0|1|2|3> node-id <node id in hex> app-data <app_data in hex> [pow] [ppc <encap|decap>]",
1191 .function = ip6_set_ioam_rewrite_command_fn,
1194 static clib_error_t *
1195 ip6_show_ioam_summary_cmd_fn (vlib_main_t * vm,
1196 unformat_input_t * input,
1197 vlib_cli_command_t * cmd)
1199 ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main;
1203 if (!is_zero_ip6_address(&hm->adj))
1205 s = format(s, " REWRITE FLOW CONFIGS - \n");
1206 s = format(s, " Destination Address : %U\n",
1207 format_ip6_address, &hm->adj, sizeof(ip6_address_t));
1208 s = format(s, " Flow operation : %d (%s)\n", hm->ioam_flag,
1209 (hm->ioam_flag == IOAM_HBYH_ADD) ? "Add" :
1210 ((hm->ioam_flag == IOAM_HBYH_MOD) ? "Mod" : "Pop"));
1214 s = format(s, " REWRITE FLOW CONFIGS - Not configured\n");
1217 if (hm->trace_option_elts)
1219 s = format(s, " HOP BY HOP OPTIONS - TRACE CONFIG - \n");
1220 s = format(s, " Trace Type : 0x%x (%d)\n",
1221 hm->trace_type, hm->trace_type);
1222 s = format(s, " Trace timestamp precision : %d (%s)\n", hm->trace_tsp,
1223 (hm->trace_tsp == TSP_SECONDS) ? "Seconds" :
1224 ((hm->trace_tsp == TSP_MILLISECONDS) ? "Milliseconds" :
1225 (((hm->trace_tsp == TSP_MICROSECONDS) ? "Microseconds" : "Nanoseconds"))));
1226 s = format(s, " Num of trace nodes : %d\n",
1227 hm->trace_option_elts);
1228 s = format(s, " Node-id : 0x%x (%d)\n",
1229 hm->node_id, hm->node_id);
1230 s = format(s, " App Data : 0x%x (%d)\n",
1231 hm->app_data, hm->app_data);
1235 s = format(s, " HOP BY HOP OPTIONS - TRACE CONFIG - Not configured\n");
1238 s = format(s, " POW OPTION - %d (%s)\n",
1239 hm->has_pow_option, (hm->has_pow_option?"Enabled":"Disabled"));
1240 if (hm->has_pow_option)
1241 s = format(s, "Try 'show ioam sc-profile' for more information\n");
1243 s = format(s, " EDGE TO EDGE - PPC OPTION - %d (%s)\n",
1244 hm->has_ppc_option, ppc_state[hm->has_ppc_option]);
1245 if (hm->has_ppc_option)
1246 s = format(s, "Try 'show ioam ppc' for more information\n");
1248 vlib_cli_output(vm, "%v", s);
1253 VLIB_CLI_COMMAND (ip6_show_ioam_run_cmd, static) = {
1254 .path = "show ioam summary",
1255 .short_help = "Summary of IOAM configuration",
1256 .function = ip6_show_ioam_summary_cmd_fn,
1259 int ip6_ioam_set_destination (ip6_address_t *addr, u32 mask_width, u32 vrf_id,
1260 int is_add, int is_pop, int is_none)
1262 ip6_main_t * im = &ip6_main;
1263 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
1264 ip_lookup_main_t * lm = &im->lookup_main;
1265 ip_adjacency_t * adj;
1270 BVT(clib_bihash_kv) kv, value;
1272 if ((is_add + is_pop + is_none) != 1)
1273 return VNET_API_ERROR_INVALID_VALUE_2;
1275 /* Go find the adjacency we're supposed to tickle */
1276 p = hash_get (im->fib_index_by_table_id, vrf_id);
1279 return VNET_API_ERROR_NO_SUCH_FIB;
1283 len = vec_len (im->prefix_lengths_in_search_order);
1285 for (i = 0; i < len; i++)
1287 int dst_address_length = im->prefix_lengths_in_search_order[i];
1288 ip6_address_t * mask = &im->fib_masks[dst_address_length];
1290 if (dst_address_length != mask_width)
1293 kv.key[0] = addr->as_u64[0] & mask->as_u64[0];
1294 kv.key[1] = addr->as_u64[1] & mask->as_u64[1];
1295 kv.key[2] = ((u64)((fib_index))<<32) | dst_address_length;
1297 rv = BV(clib_bihash_search_inline_2)(&im->ip6_lookup_table, &kv, &value);
1302 return VNET_API_ERROR_NO_SUCH_ENTRY;
1306 /* Got it, modify as directed... */
1307 adj_index = value.value;
1308 adj = ip_get_adjacency (lm, adj_index);
1310 /* Restore original lookup-next action */
1311 if (adj->saved_lookup_next_index)
1313 adj->lookup_next_index = adj->saved_lookup_next_index;
1314 adj->saved_lookup_next_index = 0;
1317 /* Save current action */
1318 if (is_add || is_pop)
1319 adj->saved_lookup_next_index = adj->lookup_next_index;
1322 adj->lookup_next_index = IP_LOOKUP_NEXT_ADD_HOP_BY_HOP;
1325 adj->lookup_next_index = IP_LOOKUP_NEXT_POP_HOP_BY_HOP;
1328 hm->ioam_flag = (is_add ? IOAM_HBYH_ADD :
1329 (is_pop ? IOAM_HBYH_POP : IOAM_HBYH_MOD));
1333 static clib_error_t *
1334 ip6_set_ioam_destination_command_fn (vlib_main_t * vm,
1335 unformat_input_t * input,
1336 vlib_cli_command_t * cmd)
1339 u32 mask_width = ~0;
1346 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
1348 if (unformat (input, "%U/%d",
1349 unformat_ip6_address, &addr, &mask_width))
1351 else if (unformat (input, "vrf-id %d", &vrf_id))
1353 else if (unformat (input, "add"))
1355 else if (unformat (input, "pop"))
1357 else if (unformat (input, "none"))
1363 if ((is_add + is_pop + is_none) != 1)
1364 return clib_error_return (0, "One of (add, pop, none) required");
1365 if (mask_width == ~0)
1366 return clib_error_return (0, "<address>/<mask-width> required");
1368 rv = ip6_ioam_set_destination (&addr, mask_width, vrf_id,
1369 is_add, is_pop, is_none);
1376 return clib_error_return (0, "ip6_ioam_set_destination returned %d", rv);
1382 VLIB_CLI_COMMAND (ip6_set_ioam_destination_cmd, static) = {
1383 .path = "set ioam destination",
1384 .short_help = "set ioam destination <ip6-address>/<width> add | pop | none",
1385 .function = ip6_set_ioam_destination_command_fn,
1388 void vnet_register_ioam_end_of_path_callback (void *cb)
1390 ip6_hop_by_hop_main_t * hm = &ip6_hop_by_hop_main;
1392 hm->ioam_end_of_path_cb = cb;