FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
devices.h
Go to the documentation of this file.
1
/*
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:
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
#ifndef included_vnet_vnet_device_h
17
#define included_vnet_vnet_device_h
18
19
#include <
vppinfra/pcap.h
>
20
#include <
vnet/l3_types.h
>
21
22
typedef
enum
23
{
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
,
30
31
/* For tunnels */
32
VNET_DEVICE_INPUT_NEXT_IP4_DROP
,
33
VNET_DEVICE_INPUT_NEXT_IP6_DROP
,
34
VNET_DEVICE_INPUT_NEXT_PUNT
,
35
36
VNET_DEVICE_INPUT_N_NEXT_NODES
,
37
}
vnet_device_input_next_t
;
38
39
#define VNET_DEVICE_INPUT_NEXT_NODES \
40
{ \
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", \
50
}
51
52
typedef
struct
53
{
54
CLIB_CACHE_LINE_ALIGN_MARK
(cacheline0);
55
56
/* total input packet counter */
57
u64
aggregate_rx_packets
;
58
}
vnet_device_per_worker_data_t
;
59
60
typedef
struct
61
{
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
;
66
}
vnet_device_main_t
;
67
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
[];
72
73
static
inline
u64
74
vnet_get_aggregate_rx_packets
(
void
)
75
{
76
vnet_device_main_t
*vdm = &
vnet_device_main
;
77
u64
sum = 0;
78
vnet_device_per_worker_data_t
*pwd;
79
80
vec_foreach
(pwd, vdm->
workers
) sum += pwd->
aggregate_rx_packets
;
81
82
return
sum;
83
}
84
85
static
inline
void
86
vnet_device_increment_rx_packets
(
u32
thread_index
,
u64
count
)
87
{
88
vnet_device_main_t
*vdm = &
vnet_device_main
;
89
vnet_device_per_worker_data_t
*pwd;
90
91
pwd =
vec_elt_at_index
(vdm->
workers
,
thread_index
);
92
pwd->
aggregate_rx_packets
+=
count
;
93
}
94
95
#endif
/* included_vnet_vnet_device_h */
96
97
/*
98
* fd.io coding-style-patch-verification: ON
99
*
100
* Local Variables:
101
* eval: (c-set-style "gnu")
102
* End:
103
*/
vnet_device_main_t::last_worker_thread_index
uword last_worker_thread_index
Definition:
devices.h:64
thread_index
u32 thread_index
Definition:
nat44_ei_hairpinning.c:492
device_input_node
vlib_node_registration_t device_input_node
(constructor) VLIB_REGISTER_NODE (device_input_node)
Definition:
devices.c:32
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition:
cache.h:60
VNET_DEVICE_INPUT_NEXT_DROP
@ VNET_DEVICE_INPUT_NEXT_DROP
Definition:
devices.h:29
vnet_device_per_worker_data_t::aggregate_rx_packets
u64 aggregate_rx_packets
Definition:
devices.h:57
VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
@ VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT
Definition:
devices.h:28
VNET_DEVICE_INPUT_NEXT_IP6_DROP
@ VNET_DEVICE_INPUT_NEXT_IP6_DROP
Definition:
devices.h:33
count
u8 count
Definition:
dhcp.api:208
VNET_DEVICE_INPUT_NEXT_IP4_DROP
@ VNET_DEVICE_INPUT_NEXT_IP4_DROP
Definition:
devices.h:32
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition:
vec_bootstrap.h:203
VNET_DEVICE_INPUT_NEXT_IP6_INPUT
@ VNET_DEVICE_INPUT_NEXT_IP6_INPUT
Definition:
devices.h:26
VNET_DEVICE_INPUT_NEXT_IP4_INPUT
@ VNET_DEVICE_INPUT_NEXT_IP4_INPUT
Definition:
devices.h:25
vnet_device_main_t::workers
vnet_device_per_worker_data_t * workers
Definition:
devices.h:62
l3_types.h
uword
u64 uword
Definition:
types.h:112
pcap.h
PCAP utility definitions.
vnet_device_input_next_t
vnet_device_input_next_t
Definition:
devices.h:22
VNET_DEVICE_INPUT_NEXT_MPLS_INPUT
@ VNET_DEVICE_INPUT_NEXT_MPLS_INPUT
Definition:
devices.h:27
VNET_DEVICE_INPUT_NEXT_PUNT
@ VNET_DEVICE_INPUT_NEXT_PUNT
Definition:
devices.h:34
device_input_next_node_flags
const u32 device_input_next_node_flags[]
Definition:
devices.c:57
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vnet_device_per_worker_data_t
Definition:
devices.h:52
VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT
@ VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT
Definition:
devices.h:24
vnet_device_main_t::first_worker_thread_index
uword first_worker_thread_index
Definition:
devices.h:63
VNET_DEVICE_INPUT_N_NEXT_NODES
@ VNET_DEVICE_INPUT_N_NEXT_NODES
Definition:
devices.h:36
u64
unsigned long u64
Definition:
types.h:89
u32
unsigned int u32
Definition:
types.h:88
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition:
vec_bootstrap.h:213
vnet_device_increment_rx_packets
static void vnet_device_increment_rx_packets(u32 thread_index, u64 count)
Definition:
devices.h:86
vnet_device_main
vnet_device_main_t vnet_device_main
Definition:
devices.c:22
device_input_next_node_advance
const u32 device_input_next_node_advance[]
Definition:
devices.c:47
vnet_device_main_t::next_worker_thread_index
uword next_worker_thread_index
Definition:
devices.h:65
vnet_get_aggregate_rx_packets
static u64 vnet_get_aggregate_rx_packets(void)
Definition:
devices.h:74
vnet_device_main_t
Definition:
devices.h:60
src
vnet
devices
devices.h
Generated on Sat Jan 8 2022 10:04:45 for FD.io VPP by
1.8.17