aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-03-04 14:31:03 +0100
committerDamjan Marion <dmarion@me.com>2021-05-01 11:42:37 +0000
commitf89bbbe300dad7bc479db535e7822199f98aca30 (patch)
tree1163eeac010375a962fcda8c2e0c7a7046161bf1 /src/vnet
parentc8983241b9d93d2c3b60b0705efbc3cdee54c534 (diff)
vlib: refactor trajectory trace debug feature
trajectory trace has been broken for a while because we used to save the buffer trajectory in a vector pointed to in opaque2. This does not work well when opaque2 is copied (eg. because of a clone) as 2 buffers end up sharing the same vector. This dedicates a full cacheline in the buffer metadata instead when trajectory is compiled in. No dynamic allocation, no sharing, no tears. Type: refactor Change-Id: I6a028ca1b48d38f393a36979e5e452c2dd48ad3f Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/CMakeLists.txt1
-rw-r--r--src/vnet/bfd/bfd_main.c2
-rw-r--r--src/vnet/bonding/device.c7
-rw-r--r--src/vnet/bonding/node.c7
-rw-r--r--src/vnet/buffer.h7
-rw-r--r--src/vnet/devices/af_packet/node.c1
-rw-r--r--src/vnet/devices/virtio/node.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c4
-rw-r--r--src/vnet/dpo/replicate_dpo.c2
-rw-r--r--src/vnet/interface.c5
-rw-r--r--src/vnet/ip-neighbor/ip4_neighbor.h1
-rw-r--r--src/vnet/ip-neighbor/ip6_neighbor.h1
-rw-r--r--src/vnet/ip/ip_frag.c1
-rw-r--r--src/vnet/ip/punt_node.c2
-rw-r--r--src/vnet/ip6-nd/ip6_ra.c1
-rw-r--r--src/vnet/ipfix-export/flow_report.c3
-rw-r--r--src/vnet/ipfix-export/ipfix_doc.md1
-rw-r--r--src/vnet/session/session_node.c5
-rw-r--r--src/vnet/syslog/syslog.c1
-rw-r--r--src/vnet/tcp/tcp.h9
-rw-r--r--src/vnet/tcp/tcp_output.c7
-rw-r--r--src/vnet/unix/gdb_funcs.c41
-rw-r--r--src/vnet/unix/tuntap.c8
-rw-r--r--src/vnet/util/trajectory.c99
24 files changed, 42 insertions, 176 deletions
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 0a3b7101ab5..6e02efd68a0 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -1340,7 +1340,6 @@ list(APPEND VNET_SOURCES
util/radix.c
util/refcount.c
util/throttle.c
- util/trajectory.c
)
list(APPEND VNET_HEADERS
diff --git a/src/vnet/bfd/bfd_main.c b/src/vnet/bfd/bfd_main.c
index 30d98f6ab34..9e575afcaca 100644
--- a/src/vnet/bfd/bfd_main.c
+++ b/src/vnet/bfd/bfd_main.c
@@ -924,7 +924,6 @@ bfd_send_echo (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
ASSERT (b->current_data == 0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
bfd_echo_pkt_t *pkt = vlib_buffer_get_current (b);
clib_memset (pkt, 0, sizeof (*pkt));
pkt->discriminator = bs->local_discr;
@@ -993,7 +992,6 @@ bfd_send_periodic (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
ASSERT (b->current_data == 0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
bfd_init_control_frame (bm, bs, b);
switch (bs->poll_state)
{
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index c69d5a40145..8a0c1092251 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -422,11 +422,6 @@ bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
CLIB_PREFETCH (pb[3]->data, CLIB_CACHE_LINE_BYTES, LOAD);
}
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[1]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[2]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[3]);
-
if (lb_alg == BOND_LB_L2)
{
h[0] = bond_lb_l2 (b[0]);
@@ -474,8 +469,6 @@ bond_tx_inline (vlib_main_t * vm, bond_if_t * bif, vlib_buffer_t ** b,
while (n_left > 0)
{
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
-
if (bif->lb == BOND_LB_L2)
h[0] = bond_lb_l2 (b[0]);
else if (bif->lb == BOND_LB_L34)
diff --git a/src/vnet/bonding/node.c b/src/vnet/bonding/node.c
index d49894fcb74..21a968177fe 100644
--- a/src/vnet/bonding/node.c
+++ b/src/vnet/bonding/node.c
@@ -328,11 +328,6 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
&n_rx_packets, &n_rx_bytes);
}
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[1]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[2]);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[3]);
-
/* next */
n_left -= 4;
b += 4;
@@ -352,8 +347,6 @@ VLIB_NODE_FN (bond_input_node) (vlib_main_t * vm,
bond_sw_if_idx_rewrite (vm, node, b[0], bond_sw_if_index,
&n_rx_packets, &n_rx_bytes);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
-
/* next */
n_left -= 1;
b += 1;
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 00e9aa698c6..19585e22506 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -491,13 +491,6 @@ typedef struct
{
struct
{
-#if VLIB_BUFFER_TRACE_TRAJECTORY > 0
- /* buffer trajectory tracing */
- u16 *trajectory_trace;
-#endif
- };
- struct
- {
u64 pad[1];
u64 pg_replay_timestamp;
};
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 9f1782e2d13..16cd69a52ce 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -332,7 +332,6 @@ af_packet_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* trace */
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (first_b0);
if (PREDICT_FALSE
(n_trace > 0 && vlib_trace_buffer (vm, node, next0, first_b0,
/* follow_chain */ 0)))
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 98df322ea15..df8c0fa9a64 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -522,8 +522,6 @@ virtio_device_input_gso_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
}
/* trace */
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
-
if (PREDICT_FALSE (n_trace > 0 && vlib_trace_buffer (vm, node, next0, b0, /* follow_chain */
1)))
{
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 739125bbcfe..1636bd8c4a9 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -686,8 +686,6 @@ vhost_user_if_input (vlib_main_t *vm, vhost_user_main_t *vum,
last_avail_idx++;
last_used_idx++;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b_head);
-
vnet_buffer (b_head)->sw_if_index[VLIB_RX] = vui->sw_if_index;
vnet_buffer (b_head)->sw_if_index[VLIB_TX] = (u32) ~ 0;
b_head->error = 0;
@@ -1318,8 +1316,6 @@ vhost_user_if_input_packed (vlib_main_t *vm, vhost_user_main_t *vum,
b_head->total_length_not_including_first_buffer -=
b_head->current_length;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b_head);
-
vnet_buffer (b_head)->sw_if_index[VLIB_RX] = vui->sw_if_index;
vnet_buffer (b_head)->sw_if_index[VLIB_TX] = ~0;
b_head->error = 0;
diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c
index 929fed0b831..5f88f12b910 100644
--- a/src/vnet/dpo/replicate_dpo.c
+++ b/src/vnet/dpo/replicate_dpo.c
@@ -791,8 +791,6 @@ replicate_inline (vlib_main_t * vm,
{
replicate_trace_t *t;
- if (c0 != b0)
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (c0);
t = vlib_add_trace (vm, node, c0, sizeof (*t));
t->rep_index = repi0;
t->dpo = *dpo0;
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index cd734cedd5c..32fb1f2e64a 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -1439,11 +1439,6 @@ vnet_interface_init (vlib_main_t * vm)
vnm->interface_tag_by_sw_if_index = hash_create (0, sizeof (uword));
-#if VLIB_BUFFER_TRACE_TRAJECTORY > 0
- if ((error = vlib_call_init_function (vm, trajectory_trace_init)))
- return error;
-#endif
-
return 0;
}
diff --git a/src/vnet/ip-neighbor/ip4_neighbor.h b/src/vnet/ip-neighbor/ip4_neighbor.h
index 11309af82d5..c330dfa59e7 100644
--- a/src/vnet/ip-neighbor/ip4_neighbor.h
+++ b/src/vnet/ip-neighbor/ip4_neighbor.h
@@ -61,7 +61,6 @@ ip4_neighbor_probe (vlib_main_t * vm,
h0->ip4_over_ethernet[0].ip4 = *src;
h0->ip4_over_ethernet[1].ip4 = *dst;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
vnet_buffer (b0)->sw_if_index[VLIB_TX] = adj0->rewrite_header.sw_if_index;
vlib_buffer_advance (b0, -adj0->rewrite_header.data_bytes);
diff --git a/src/vnet/ip-neighbor/ip6_neighbor.h b/src/vnet/ip-neighbor/ip6_neighbor.h
index 681e634861c..ad2ace21948 100644
--- a/src/vnet/ip-neighbor/ip6_neighbor.h
+++ b/src/vnet/ip-neighbor/ip6_neighbor.h
@@ -86,7 +86,6 @@ ip6_neighbor_probe (vlib_main_t * vm,
ip6_tcp_udp_icmp_compute_checksum (vm, 0, &h0->ip, &bogus_length);
ASSERT (bogus_length == 0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
vnet_buffer (b0)->sw_if_index[VLIB_TX] = sw_if_index;
diff --git a/src/vnet/ip/ip_frag.c b/src/vnet/ip/ip_frag.c
index 33fbb9b2a9d..cafa9a66d6b 100644
--- a/src/vnet/ip/ip_frag.c
+++ b/src/vnet/ip/ip_frag.c
@@ -77,7 +77,6 @@ frag_buffer_alloc (vlib_buffer_t * org_b, u32 * bi)
return 0;
vlib_buffer_t *b = vlib_get_buffer (vm, *bi);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
vlib_buffer_copy_trace_flag (vm, org_b, *bi);
return b;
diff --git a/src/vnet/ip/punt_node.c b/src/vnet/ip/punt_node.c
index 90953e63704..7f9beef0ffe 100644
--- a/src/vnet/ip/punt_node.c
+++ b/src/vnet/ip/punt_node.c
@@ -546,8 +546,6 @@ punt_socket_rx_fd (vlib_main_t * vm, vlib_node_runtime_t * node, u32 fd)
b->flags = VNET_BUFFER_F_LOCALLY_ORIGINATED;
b->current_length = size - sizeof (packetdesc);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
-
switch (packetdesc.action)
{
case PUNT_L2:
diff --git a/src/vnet/ip6-nd/ip6_ra.c b/src/vnet/ip6-nd/ip6_ra.c
index 547ecf31034..270e428afad 100644
--- a/src/vnet/ip6-nd/ip6_ra.c
+++ b/src/vnet/ip6-nd/ip6_ra.c
@@ -1132,7 +1132,6 @@ create_buffer_for_rs (vlib_main_t * vm, ip6_ra_t * radv_info)
}
p0 = vlib_get_buffer (vm, bi0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (p0);
p0->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
vnet_buffer (p0)->sw_if_index[VLIB_RX] = sw_if_index;
diff --git a/src/vnet/ipfix-export/flow_report.c b/src/vnet/ipfix-export/flow_report.c
index a831c3cbede..5d25bb5d413 100644
--- a/src/vnet/ipfix-export/flow_report.c
+++ b/src/vnet/ipfix-export/flow_report.c
@@ -119,9 +119,6 @@ send_template_packet (flow_report_main_t * frm,
b0 = vlib_get_buffer (vm, bi0);
- /* Initialize the buffer */
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
-
ASSERT (vec_len (fr->rewrite) < vlib_buffer_get_default_data_size (vm));
clib_memcpy_fast (b0->data, fr->rewrite, vec_len (fr->rewrite));
diff --git a/src/vnet/ipfix-export/ipfix_doc.md b/src/vnet/ipfix-export/ipfix_doc.md
index 1c7aad7750d..edae3f73660 100644
--- a/src/vnet/ipfix-export/ipfix_doc.md
+++ b/src/vnet/ipfix-export/ipfix_doc.md
@@ -299,7 +299,6 @@ This function creates the packet header for an ipfix data packet
}
b0 = vlib_get_buffer (vm, bi0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
offset = 0;
mlm->buffers_by_thread[thread_index] = b0;
}
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 9fae9996698..d30df33a5e7 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1141,9 +1141,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
n_left -= 2;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b1);
-
vec_add1 (wrk->pending_tx_buffers, bi0);
vec_add1 (wrk->pending_tx_buffers, bi1);
vec_add1 (wrk->pending_tx_nexts, next_index);
@@ -1171,8 +1168,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
n_left -= 1;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
-
vec_add1 (wrk->pending_tx_buffers, bi0);
vec_add1 (wrk->pending_tx_nexts, next_index);
}
diff --git a/src/vnet/syslog/syslog.c b/src/vnet/syslog/syslog.c
index 20728b8a17a..8f3313950e8 100644
--- a/src/vnet/syslog/syslog.c
+++ b/src/vnet/syslog/syslog.c
@@ -170,7 +170,6 @@ syslog_msg_send (syslog_msg_t * syslog_msg)
return -1;
b = vlib_get_buffer (vm, bi);
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
/* one message per UDP datagram RFC5426 3.1. */
tmp = format (0, "%U", format_syslog_msg, syslog_msg);
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 23b61313568..a02a295e72b 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -288,15 +288,6 @@ tcp_get_worker (u32 thread_index)
return &tcp_main.wrk_ctx[thread_index];
}
-#if (VLIB_BUFFER_TRACE_TRAJECTORY)
-#define tcp_trajectory_add_start(b, start) \
-{ \
- (*vlib_buffer_trace_trajectory_cb) (b, start); \
-}
-#else
-#define tcp_trajectory_add_start(b, start)
-#endif
-
tcp_connection_t *tcp_connection_alloc (u8 thread_index);
tcp_connection_t *tcp_connection_alloc_w_base (u8 thread_index,
tcp_connection_t * base);
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index dac50b5bf40..bde06da87ed 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -345,7 +345,7 @@ tcp_reuse_buffer (vlib_main_t * vm, vlib_buffer_t * b)
b->current_length = 0;
b->total_length_not_including_first_buffer = 0;
vnet_buffer (b)->tcp.flags = 0;
-
+ VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
/* Leave enough space for headers */
return vlib_buffer_make_headroom (b, TRANSPORT_MAX_HDRS_LEN);
}
@@ -359,7 +359,6 @@ tcp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b)
b->total_length_not_including_first_buffer = 0;
b->current_data = 0;
vnet_buffer (b)->tcp.flags = 0;
- VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b);
/* Leave enough space for headers */
return vlib_buffer_make_headroom (b, TRANSPORT_MAX_HDRS_LEN);
}
@@ -555,8 +554,6 @@ tcp_enqueue_to_ip_lookup (tcp_worker_ctx_t * wrk, vlib_buffer_t * b, u32 bi,
vnet_buffer (b)->sw_if_index[VLIB_TX] = fib_index;
vnet_buffer (b)->sw_if_index[VLIB_RX] = 0;
- tcp_trajectory_add_start (b, 1);
-
session_add_pending_tx_buffer (vm->thread_index, bi,
tm->ipl_next_node[!is_ip4]);
@@ -633,7 +630,6 @@ tcp_make_reset_in_place (vlib_main_t * vm, vlib_buffer_t * b, u8 is_ip4)
}
tcp_reuse_buffer (vm, b);
- tcp_trajectory_add_start (b, 4);
th = vlib_buffer_push_tcp_net_order (b, dst_port, src_port, seq, ack,
sizeof (tcp_header_t), flags, 0);
@@ -1018,7 +1014,6 @@ tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b)
tcp_retransmit_timer_set (&wrk->timer_wheel, tc);
tc->rto_boff = 0;
}
- tcp_trajectory_add_start (b, 3);
return 0;
}
diff --git a/src/vnet/unix/gdb_funcs.c b/src/vnet/unix/gdb_funcs.c
index 797cb0eb7d1..886d849c173 100644
--- a/src/vnet/unix/gdb_funcs.c
+++ b/src/vnet/unix/gdb_funcs.c
@@ -380,6 +380,47 @@ gdb_validate_buffer (vlib_buffer_t * b)
return 0;
}
+/**
+ * Dump a trajectory trace, reasonably easy to call from gdb
+ */
+void
+gdb_dump_trajectory_trace (u32 bi)
+{
+#if VLIB_BUFFER_TRACE_TRAJECTORY > 0
+ vlib_main_t *vm = vlib_get_main ();
+ vlib_node_main_t *vnm = &vm->node_main;
+ vlib_buffer_t *b;
+ u16 *trace;
+ u8 i;
+
+ b = vlib_get_buffer (vm, bi);
+
+ trace = b->trajectory_trace;
+
+ fformat (stderr, "Context trace for bi %d b 0x%llx, visited %d\n", bi, b,
+ b->trajectory_nb);
+
+ for (i = 0; i < b->trajectory_nb; i++)
+ {
+ u32 node_index;
+
+ node_index = trace[i];
+
+ if (node_index >= vec_len (vnm->nodes))
+ {
+ fformat (stderr, "Skip bogus node index %d\n", node_index);
+ continue;
+ }
+
+ fformat (stderr, "%v (%d)\n", vnm->nodes[node_index]->name, node_index);
+ }
+#else
+ fformat (stderr, "in vlib/buffers.h, "
+ "#define VLIB_BUFFER_TRACE_TRAJECTORY 1\n");
+
+#endif
+}
+
/* Cafeteria plan, maybe you don't want these functions */
clib_error_t *
gdb_func_init (vlib_main_t * vm)
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 50f02df9e82..4a848349ae1 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -336,14 +336,6 @@ tuntap_rx (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
vnet_buffer (b)->sw_if_index[VLIB_RX] = tm->sw_if_index;
vnet_buffer (b)->sw_if_index[VLIB_TX] = (u32) ~ 0;
- /*
- * Turn this on if you run into
- * "bad monkey" contexts, and you want to know exactly
- * which nodes they've visited...
- */
- if (VLIB_BUFFER_TRACE_TRAJECTORY)
- b->pre_data[0] = 0;
-
b->error = node->errors[0];
if (tm->is_ether)
diff --git a/src/vnet/util/trajectory.c b/src/vnet/util/trajectory.c
deleted file mode 100644
index 2538c7ee64a..00000000000
--- a/src/vnet/util/trajectory.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** \file
- * Buffer trace trajectory utilities
- */
-
-#include <vnet/vnet.h>
-
-/**
- * Dump a trajectory trace, reasonably easy to call from gdb
- */
-void
-vnet_dump_trajectory_trace (vlib_main_t * vm, u32 bi)
-{
-#if VLIB_BUFFER_TRACE_TRAJECTORY > 0
- vlib_node_main_t *vnm = &vm->node_main;
- vlib_buffer_t *b;
- u16 *trace;
- u8 i;
-
- b = vlib_get_buffer (vm, bi);
-
- trace = vnet_buffer2 (b)->trajectory_trace;
-
- fformat (stderr, "Context trace for bi %d b 0x%llx, visited %d\n",
- bi, b, vec_len (trace));
-
- for (i = 0; i < vec_len (trace); i++)
- {
- u32 node_index;
-
- node_index = trace[i];
-
- if (node_index >= vec_len (vnm->nodes))
- {
- fformat (stderr, "Skip bogus node index %d\n", node_index);
- continue;
- }
-
- fformat (stderr, "%v (%d)\n", vnm->nodes[node_index]->name, node_index);
- }
-#else
- fformat (stderr, "in vlib/buffers.h, "
- "#define VLIB_BUFFER_TRACE_TRAJECTORY 1\n");
-
-#endif
-}
-
-#if VLIB_BUFFER_TRACE_TRAJECTORY > 0
-
-void
-init_trajectory_trace (vlib_buffer_t * b)
-{
- if (!clib_mem_is_vec (vnet_buffer2 (b)->trajectory_trace))
- {
- vnet_buffer2 (b)->trajectory_trace = 0;
- vec_validate (vnet_buffer2 (b)->trajectory_trace, 7);
- }
- _vec_len (vnet_buffer2 (b)->trajectory_trace) = 0;
-}
-
-void
-add_trajectory_trace (vlib_buffer_t * b, u32 node_index)
-{
- vec_add1 (vnet_buffer2 (b)->trajectory_trace, (u16) node_index);
-}
-
-static clib_error_t *
-trajectory_trace_init (vlib_main_t * vm)
-{
- vlib_buffer_trace_trajectory_cb = add_trajectory_trace;
- vlib_buffer_trace_trajectory_init_cb = init_trajectory_trace;
- return 0;
-}
-
-VLIB_INIT_FUNCTION (trajectory_trace_init);
-
-#endif
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */