aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices/devices.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-11-09 11:59:42 +0100
committerDave Barach <openvpp@barachs.net>2016-11-09 14:03:25 +0000
commit51327ac5f9ffbe74eb32f26697c563b92eadc3ce (patch)
tree164fbf4e4448553900a232b13334e3a9ef01b142 /vnet/vnet/devices/devices.c
parent66bcab2fff54531a126ddabe3b377df3fc536731 (diff)
devices: create dummy device-input node to keep nexts in sync
device-input feature arc requires that all input-nodes have nexts in sync. packet-generator tends to call vlib_node_add_next when new stream is created and that puts nexts out of sync. With this change all input node are siblings of device-input node so call to vlib_node_add_next(...) will install same next to the whole family. Change-Id: I33d79492e5f30f348af19e527f36fe0222c524d7 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/devices.c')
-rw-r--r--vnet/vnet/devices/devices.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/vnet/vnet/devices/devices.c b/vnet/vnet/devices/devices.c
new file mode 100644
index 00000000000..26753305db2
--- /dev/null
+++ b/vnet/vnet/devices/devices.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include <vnet/devices/devices.h>
+#include <vnet/feature/feature.h>
+
+static uword
+device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_REGISTER_NODE (device_input_node) = {
+ .function = device_input_fn,
+ .name = "device-input",
+ .type = VLIB_NODE_TYPE_INPUT,
+ .state = VLIB_NODE_STATE_DISABLED,
+ .n_next_nodes = VNET_DEVICE_INPUT_N_NEXT_NODES,
+ .next_nodes = VNET_DEVICE_INPUT_NEXT_NODES,
+};
+
+VNET_FEATURE_ARC_INIT (device_input, static) =
+{
+ .arc_name = "device-input",
+ .start_nodes = VNET_FEATURES ("device-input"),
+};
+
+VNET_FEATURE_INIT (l2_patch, static) = {
+ .arc_name = "device-input",
+ .node_name = "l2-patch",
+ .runs_before = VNET_FEATURES ("ethernet-input"),
+};
+
+VNET_FEATURE_INIT (worker_handoff, static) = {
+ .arc_name = "device-input",
+ .node_name = "worker-handoff",
+ .runs_before = VNET_FEATURES ("ethernet-input"),
+};
+
+VNET_FEATURE_INIT (ethernet_input, static) = {
+ .arc_name = "device-input",
+ .node_name = "ethernet-input",
+ .runs_before = 0, /* not before any other features */
+};
+/* *INDENT-ON* */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */