2 * Copyright (c) 2016 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.
16 #ifndef included_vnet_vnet_device_h
17 #define included_vnet_vnet_device_h
19 #include <vppinfra/pcap.h>
20 #include <vnet/l3_types.h>
24 VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT,
25 VNET_DEVICE_INPUT_NEXT_IP4_INPUT,
26 VNET_DEVICE_INPUT_NEXT_IP6_INPUT,
27 VNET_DEVICE_INPUT_NEXT_MPLS_INPUT,
28 VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT,
29 VNET_DEVICE_INPUT_NEXT_DROP,
32 VNET_DEVICE_INPUT_NEXT_IP4_DROP,
33 VNET_DEVICE_INPUT_NEXT_IP6_DROP,
34 VNET_DEVICE_INPUT_NEXT_PUNT,
36 VNET_DEVICE_INPUT_N_NEXT_NODES,
37 } vnet_device_input_next_t;
39 #define VNET_DEVICE_INPUT_NEXT_NODES \
41 [VNET_DEVICE_INPUT_NEXT_DROP] = "error-drop", \
42 [VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT] = "ethernet-input", \
43 [VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT] = "ip4-input-no-checksum", \
44 [VNET_DEVICE_INPUT_NEXT_IP4_INPUT] = "ip4-input", \
45 [VNET_DEVICE_INPUT_NEXT_IP6_INPUT] = "ip6-input", \
46 [VNET_DEVICE_INPUT_NEXT_MPLS_INPUT] = "mpls-input", \
47 [VNET_DEVICE_INPUT_NEXT_IP4_DROP] = "ip4-drop", \
48 [VNET_DEVICE_INPUT_NEXT_IP6_DROP] = "ip6-drop", \
49 [VNET_DEVICE_INPUT_NEXT_PUNT] = "punt-dispatch", \
54 CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
56 /* total input packet counter */
57 u64 aggregate_rx_packets;
58 } vnet_device_per_worker_data_t;
62 vnet_device_per_worker_data_t *workers;
63 uword first_worker_thread_index;
64 uword last_worker_thread_index;
65 uword next_worker_thread_index;
68 extern vnet_device_main_t vnet_device_main;
69 extern vlib_node_registration_t device_input_node;
70 extern const u32 device_input_next_node_advance[];
71 extern const u32 device_input_next_node_flags[];
74 vnet_get_aggregate_rx_packets (void)
76 vnet_device_main_t *vdm = &vnet_device_main;
78 vnet_device_per_worker_data_t *pwd;
80 vec_foreach (pwd, vdm->workers) sum += pwd->aggregate_rx_packets;
86 vnet_device_increment_rx_packets (u32 thread_index, u64 count)
88 vnet_device_main_t *vdm = &vnet_device_main;
89 vnet_device_per_worker_data_t *pwd;
91 pwd = vec_elt_at_index (vdm->workers, thread_index);
92 pwd->aggregate_rx_packets += count;
95 #endif /* included_vnet_vnet_device_h */
98 * fd.io coding-style-patch-verification: ON
101 * eval: (c-set-style "gnu")