a1100194f3d7a161709723485d46666fe060c8e8
[vpp.git] / vnet / vnet / devices / devices.c
1 /*
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:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15
16 #include <vnet/vnet.h>
17 #include <vnet/devices/devices.h>
18 #include <vnet/feature/feature.h>
19 #include <vnet/ip/ip.h>
20 #include <vnet/ethernet/ethernet.h>
21
22 static uword
23 device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
24                  vlib_frame_t * frame)
25 {
26   return 0;
27 }
28
29 /* *INDENT-OFF* */
30 VLIB_REGISTER_NODE (device_input_node) = {
31   .function = device_input_fn,
32   .name = "device-input",
33   .type = VLIB_NODE_TYPE_INPUT,
34   .state = VLIB_NODE_STATE_DISABLED,
35   .n_next_nodes = VNET_DEVICE_INPUT_N_NEXT_NODES,
36   .next_nodes = VNET_DEVICE_INPUT_NEXT_NODES,
37 };
38
39 /* Table defines how much we need to advance current data pointer
40    in the buffer if we shortcut to l3 nodes */
41
42 const u32 __attribute__((aligned (CLIB_CACHE_LINE_BYTES)))
43 device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES /
44                                 CLIB_CACHE_LINE_BYTES) +1) * CLIB_CACHE_LINE_BYTES] =
45 {
46       [VNET_DEVICE_INPUT_NEXT_IP4_INPUT] = sizeof (ethernet_header_t),
47       [VNET_DEVICE_INPUT_NEXT_IP6_INPUT] = sizeof (ethernet_header_t),
48       [VNET_DEVICE_INPUT_NEXT_MPLS_INPUT] = sizeof (ethernet_header_t),
49 };
50
51 VNET_FEATURE_ARC_INIT (device_input, static) =
52 {
53   .arc_name  = "device-input",
54   .start_nodes = VNET_FEATURES ("device-input"),
55   .arc_index_ptr = &feature_main.device_input_feature_arc_index,
56 };
57
58 VNET_FEATURE_INIT (l2_patch, static) = {
59   .arc_name = "device-input",
60   .node_name = "l2-patch",
61   .runs_before = VNET_FEATURES ("ethernet-input"),
62 };
63
64 VNET_FEATURE_INIT (worker_handoff, static) = {
65   .arc_name = "device-input",
66   .node_name = "worker-handoff",
67   .runs_before = VNET_FEATURES ("ethernet-input"),
68 };
69
70 VNET_FEATURE_INIT (span_input, static) = {
71   .arc_name = "device-input",
72   .node_name = "span-input",
73   .runs_before = VNET_FEATURES ("ethernet-input"),
74 };
75
76 VNET_FEATURE_INIT (ethernet_input, static) = {
77   .arc_name = "device-input",
78   .node_name = "ethernet-input",
79   .runs_before = 0, /* not before any other features */
80 };
81 /* *INDENT-ON* */
82
83 /*
84  * fd.io coding-style-patch-verification: ON
85  *
86  * Local Variables:
87  * eval: (c-set-style "gnu")
88  * End:
89  */