vlib: add flag to explicitelly mark nodes which can init per-node packet trace
Type: feature
Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index d6dda6c..8d1ded8 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -468,6 +468,7 @@
.state = VLIB_NODE_STATE_DISABLED,
.n_errors = AVF_INPUT_N_ERROR,
.error_strings = avf_input_error_strings,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
};
/* *INDENT-ON* */
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index 0e6fba3..a16d485 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -478,6 +478,7 @@
.type = VLIB_NODE_TYPE_INPUT,
.name = "dpdk-input",
.sibling_of = "device-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
/* Will be enabled if/when hardware is detected. */
.state = VLIB_NODE_STATE_DISABLED,
diff --git a/src/plugins/dpdk/ipsec/crypto_node.c b/src/plugins/dpdk/ipsec/crypto_node.c
index 7fae7d6..76e57a3 100644
--- a/src/plugins/dpdk/ipsec/crypto_node.c
+++ b/src/plugins/dpdk/ipsec/crypto_node.c
@@ -303,6 +303,7 @@
VLIB_REGISTER_NODE (dpdk_crypto_input_node) =
{
.name = "dpdk-crypto-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.format_trace = format_dpdk_crypto_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
.state = VLIB_NODE_STATE_DISABLED,
diff --git a/src/plugins/ixge/ixge.c b/src/plugins/ixge/ixge.c
index c27042d..6ab79c9 100644
--- a/src/plugins/ixge/ixge.c
+++ b/src/plugins/ixge/ixge.c
@@ -2219,6 +2219,7 @@
.function = ixge_input,
.type = VLIB_NODE_TYPE_INPUT,
.name = "ixge-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
/* Will be enabled if/when hardware is detected. */
.state = VLIB_NODE_STATE_DISABLED,
diff --git a/src/plugins/marvell/pp2/input.c b/src/plugins/marvell/pp2/input.c
index 50f0963..ec3d376 100644
--- a/src/plugins/marvell/pp2/input.c
+++ b/src/plugins/marvell/pp2/input.c
@@ -374,6 +374,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (mrvl_pp2_input_node) = {
.function = mrvl_pp2_input_fn,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.name = "mrvl-pp2-input",
.sibling_of = "device-input",
.format_trace = format_mrvl_pp2_input_trace,
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 154d244..aef8ffb 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -925,6 +925,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (memif_input_node) = {
.name = "memif-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.sibling_of = "device-input",
.format_trace = format_memif_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
diff --git a/src/plugins/rdma/input.c b/src/plugins/rdma/input.c
index 3c9481f..30fae83 100644
--- a/src/plugins/rdma/input.c
+++ b/src/plugins/rdma/input.c
@@ -360,6 +360,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (rdma_input_node) = {
.name = "rdma-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.sibling_of = "device-input",
.format_trace = format_rdma_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c
index 64fdf1c..173ab91 100644
--- a/src/plugins/vmxnet3/input.c
+++ b/src/plugins/vmxnet3/input.c
@@ -481,6 +481,7 @@
VLIB_REGISTER_NODE (vmxnet3_input_node) = {
.name = "vmxnet3-input",
.sibling_of = "device-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.format_trace = format_vmxnet3_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
.state = VLIB_NODE_STATE_DISABLED,
diff --git a/src/vlib/handoff_trace.c b/src/vlib/handoff_trace.c
index 7a67438..fcb514b 100644
--- a/src/vlib/handoff_trace.c
+++ b/src/vlib/handoff_trace.c
@@ -79,6 +79,7 @@
VLIB_REGISTER_NODE (handoff_trace_node, static) =
{
.name = "handoff_trace",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.function = handoff_trace_node_fn,
.vector_size = sizeof (u32),
.format_trace = format_handoff_trace,
diff --git a/src/vlib/node.h b/src/vlib/node.h
index 2db31c6..9f324f7 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -303,6 +303,7 @@
#define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
#define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
+#define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8)
/* State for input nodes. */
u8 state;
diff --git a/src/vlib/trace.c b/src/vlib/trace.c
index 7062113..530598d 100644
--- a/src/vlib/trace.c
+++ b/src/vlib/trace.c
@@ -357,6 +357,7 @@
{
unformat_input_t _line_input, *line_input = &_line_input;
vlib_trace_main_t *tm;
+ vlib_node_t *node;
vlib_trace_node_t *tn;
u32 node_index, add;
u8 verbose = 0;
@@ -383,6 +384,17 @@
}
}
+ node = vlib_get_node (vm, node_index);
+
+ if ((node->flags & VLIB_NODE_FLAG_TRACE_SUPPORTED) == 0)
+ {
+ error = clib_error_create ("node '%U' doesn't support per-node "
+ "tracing. There may be another way to "
+ "initiate trace on this node.",
+ format_vlib_node_name, vm, node_index);
+ goto done;
+ }
+
/* *INDENT-OFF* */
foreach_vlib_main ((
{
diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c
index 77a53b6..f5470c3 100644
--- a/src/vnet/bonding/device.c
+++ b/src/vnet/bonding/device.c
@@ -790,6 +790,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (bond_process_node) = {
.function = bond_process,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "bond-process",
};
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 85f3e01..196c088 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -369,6 +369,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (af_packet_input_node) = {
.name = "af-packet-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.sibling_of = "device-input",
.format_trace = format_af_packet_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
diff --git a/src/vnet/devices/netmap/node.c b/src/vnet/devices/netmap/node.c
index 00e31c0..bc55ecc 100644
--- a/src/vnet/devices/netmap/node.c
+++ b/src/vnet/devices/netmap/node.c
@@ -278,6 +278,7 @@
VLIB_REGISTER_NODE (netmap_input_node) = {
.name = "netmap-input",
.sibling_of = "device-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.format_trace = format_netmap_input_trace,
.type = VLIB_NODE_TYPE_INPUT,
/* default state is INTERRUPT mode, switch to POLLING if worker threads are enabled */
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 8441250..9711c7a 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -398,6 +398,7 @@
.name = "virtio-input",
.sibling_of = "device-input",
.format_trace = format_virtio_input_trace,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.type = VLIB_NODE_TYPE_INPUT,
.state = VLIB_NODE_STATE_INTERRUPT,
.n_errors = VIRTIO_INPUT_N_ERROR,
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 488764b..2d90ed1 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -794,6 +794,7 @@
.type = VLIB_NODE_TYPE_INPUT,
.name = "vhost-user-input",
.sibling_of = "device-input",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
/* Will be enabled if/when hardware is detected. */
.state = VLIB_NODE_STATE_DISABLED,
diff --git a/src/vnet/ethernet/p2p_ethernet_input.c b/src/vnet/ethernet/p2p_ethernet_input.c
index 36845fc..7e5f7ca 100644
--- a/src/vnet/ethernet/p2p_ethernet_input.c
+++ b/src/vnet/ethernet/p2p_ethernet_input.c
@@ -237,6 +237,7 @@
.vector_size = sizeof (u32),
.format_trace = format_p2p_ethernet_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.n_errors = ARRAY_LEN(p2p_ethernet_error_strings),
.error_strings = p2p_ethernet_error_strings,
diff --git a/src/vnet/ip/punt_node.c b/src/vnet/ip/punt_node.c
index 8a39d11..b48af84 100644
--- a/src/vnet/ip/punt_node.c
+++ b/src/vnet/ip/punt_node.c
@@ -621,6 +621,7 @@
{
.function = punt_socket_rx,
.name = "punt-socket-rx",
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.type = VLIB_NODE_TYPE_INPUT,
.state = VLIB_NODE_STATE_INTERRUPT,
.vector_size = 1,
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index bb760b0..39aea7c 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1797,6 +1797,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (pg_input_node) = {
.function = pg_input,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.name = "pg-input",
.sibling_of = "device-input",
.type = VLIB_NODE_TYPE_INPUT,
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index ad18637..891870c 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1339,6 +1339,7 @@
VLIB_REGISTER_NODE (session_queue_node) =
{
.function = session_queue_node_fn,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.name = "session-queue",
.format_trace = format_session_queue_trace,
.type = VLIB_NODE_TYPE_INPUT,
diff --git a/src/vnet/unix/tuntap.c b/src/vnet/unix/tuntap.c
index 9d6f899..72c4f73 100644
--- a/src/vnet/unix/tuntap.c
+++ b/src/vnet/unix/tuntap.c
@@ -398,6 +398,7 @@
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (tuntap_rx_node,static) = {
.function = tuntap_rx,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.name = "tuntap-rx",
.sibling_of = "device-input",
.type = VLIB_NODE_TYPE_INPUT,