FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
nsim.h
Go to the documentation of this file.
1
2
/*
3
* nsim.h - skeleton vpp engine plug-in header file
4
*
5
* Copyright (c) <current-year> <your-organization>
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at:
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
#ifndef __included_nsim_h__
19
#define __included_nsim_h__
20
21
#include <
vnet/vnet.h
>
22
#include <
vnet/ip/ip.h
>
23
#include <
vnet/ethernet/ethernet.h
>
24
25
#include <
vppinfra/hash.h
>
26
#include <
vppinfra/error.h
>
27
28
#define NSIM_MAX_TX_BURST 32
/**< max packets in a tx burst */
29
30
typedef
struct
31
{
32
f64
tx_time
;
33
u32
rx_sw_if_index
;
34
u32
tx_sw_if_index
;
35
u32
output_next_index
;
36
u32
buffer_index
;
37
u32
pad
;
/* pad to 32-bytes */
38
}
nsim_wheel_entry_t
;
39
40
typedef
struct
41
{
42
u32
wheel_size
;
43
u32
cursize
;
44
u32
head
;
45
u32
tail
;
46
nsim_wheel_entry_t
*
entries
;
47
CLIB_CACHE_LINE_ALIGN_MARK
(
pad
);
48
}
nsim_wheel_t
;
49
50
typedef
struct
nsim_node_ctx
51
{
52
vnet_feature_config_main_t
*
fcm
;
53
f64
expires
;
54
u32
*
drop
;
55
u32
*
reord
;
56
u16
*
reord_nexts
;
57
u8
*
action
;
58
u64
n_buffered
;
59
u64
n_loss
;
60
}
nsim_node_ctx_t
;
61
62
#define foreach_nsm_action \
63
_(DROP, "Packet loss") \
64
_(REORDER, "Packet reorder")
65
66
enum
nsm_action_bit
67
{
68
#define _(sym, str) NSIM_ACTION_##sym##_BIT,
69
foreach_nsm_action
70
#undef _
71
};
72
73
typedef
enum
nsm_action
74
{
75
#define _(sym, str) NSIM_ACTION_##sym = 1 << NSIM_ACTION_##sym##_BIT,
76
foreach_nsm_action
77
#undef _
78
}
nsm_action_e
;
79
80
typedef
struct
81
{
82
/* API message ID base */
83
u16
msg_id_base
;
84
85
/* output feature arc index */
86
u16
arc_index
;
87
88
/* Two interfaces, cross-connected with delay */
89
u32
sw_if_index0,
sw_if_index1
;
90
u32
output_next_index0,
output_next_index1
;
91
92
/* N interfaces, using the output feature */
93
u32
*
output_next_index_by_sw_if_index
;
94
95
/* Random seed for loss-rate simulation */
96
u32
seed
;
97
98
/* Per-thread scheduler wheels */
99
nsim_wheel_t
**
wheel_by_thread
;
100
101
/* Config parameters */
102
f64
delay
;
103
f64
bandwidth
;
104
f64
packet_size
;
105
f64
drop_fraction
;
106
f64
reorder_fraction
;
107
u32
poll_main_thread
;
108
109
u64
mmap_size
;
110
111
/* Wheels are configured */
112
int
is_configured
;
113
114
/* convenience */
115
vlib_main_t
*
vlib_main
;
116
vnet_main_t
*
vnet_main
;
117
}
nsim_main_t
;
118
119
extern
nsim_main_t
nsim_main
;
120
121
extern
vlib_node_registration_t
nsim_node
;
122
extern
vlib_node_registration_t
nsim_input_node
;
123
124
#endif
/* __included_nsim_h__ */
125
126
/*
127
* fd.io coding-style-patch-verification: ON
128
*
129
* Local Variables:
130
* eval: (c-set-style "gnu")
131
* End:
132
*/
nsim_wheel_entry_t::tx_sw_if_index
u32 tx_sw_if_index
Definition:
nsim.h:34
vnet_feature_config_main_t_
Definition:
feature.h:80
nsim_wheel_t::tail
u32 tail
Definition:
nsim.h:45
nsim_main_t::msg_id_base
u16 msg_id_base
Definition:
nsim.h:83
nsim_main_t::delay
f64 delay
Definition:
nsim.h:102
nsim_main_t::seed
u32 seed
Definition:
nsim.h:96
nsim_node_ctx::n_loss
u64 n_loss
Definition:
nsim.h:59
nsim_main_t::drop_fraction
f64 drop_fraction
Definition:
nsim.h:105
nsim_wheel_entry_t::rx_sw_if_index
u32 rx_sw_if_index
Definition:
nsim.h:33
nsim_main_t::poll_main_thread
u32 poll_main_thread
Definition:
nsim.h:107
nsim_node_ctx::action
u8 * action
Definition:
nsim.h:57
CLIB_CACHE_LINE_ALIGN_MARK
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
Definition:
cache.h:60
nsim_wheel_entry_t::tx_time
f64 tx_time
Definition:
nsim.h:32
u16
unsigned short u16
Definition:
types.h:57
nsim_node_ctx
Definition:
nsim.h:50
nsim_main_t::reorder_fraction
f64 reorder_fraction
Definition:
nsim.h:106
nsim_main_t::vlib_main
vlib_main_t * vlib_main
Definition:
nsim.h:115
nsim_wheel_t
Definition:
nsim.h:40
ethernet.h
nsm_action
nsm_action
Definition:
nsim.h:73
nsim_main_t::packet_size
f64 packet_size
Definition:
nsim.h:104
nsim_main_t::is_configured
int is_configured
Definition:
nsim.h:112
nsim_main_t::vnet_main
vnet_main_t * vnet_main
Definition:
nsim.h:116
nsim_main_t::sw_if_index1
u32 sw_if_index1
Definition:
nsim.h:89
error.h
nsim_wheel_entry_t
Definition:
nsim.h:30
nsim_main
nsim_main_t nsim_main
Definition:
nsim.c:39
nsim_node_ctx_t
struct nsim_node_ctx nsim_node_ctx_t
nsim_wheel_entry_t::output_next_index
u32 output_next_index
Definition:
nsim.h:35
nsim_node_ctx::reord_nexts
u16 * reord_nexts
Definition:
nsim.h:56
nsim_main_t::bandwidth
f64 bandwidth
Definition:
nsim.h:103
f64
double f64
Definition:
types.h:142
nsim_wheel_entry_t::pad
u32 pad
Definition:
nsim.h:37
nsim_node_ctx::reord
u32 * reord
Definition:
nsim.h:55
nsim_node
vlib_node_registration_t nsim_node
(constructor) VLIB_REGISTER_NODE (nsim_node)
Definition:
node.c:50
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
nsim_main_t::wheel_by_thread
nsim_wheel_t ** wheel_by_thread
Definition:
nsim.h:99
vnet_main_t
Definition:
vnet.h:76
nsim_wheel_t::head
u32 head
Definition:
nsim.h:44
u64
unsigned long u64
Definition:
types.h:89
ip.h
u32
unsigned int u32
Definition:
types.h:88
foreach_nsm_action
#define foreach_nsm_action
Definition:
nsim.h:62
nsim_wheel_t::cursize
u32 cursize
Definition:
nsim.h:43
nsim_input_node
vlib_node_registration_t nsim_input_node
(constructor) VLIB_REGISTER_NODE (nsim_input_node)
Definition:
nsim_input.c:131
nsim_main_t
Definition:
nsim.h:80
nsim_wheel_t::entries
nsim_wheel_entry_t * entries
Definition:
nsim.h:46
nsim_wheel_t::wheel_size
u32 wheel_size
Definition:
nsim.h:42
vlib_main_t
Definition:
main.h:102
hash.h
u8
unsigned char u8
Definition:
types.h:56
nsim_node_ctx::n_buffered
u64 n_buffered
Definition:
nsim.h:58
nsm_action_e
enum nsm_action nsm_action_e
nsim_node_ctx::fcm
vnet_feature_config_main_t * fcm
Definition:
nsim.h:52
pad
u8 pad[3]
log2 (size of the packing page block)
Definition:
bihash_doc.h:61
nsim_main_t::output_next_index1
u32 output_next_index1
Definition:
nsim.h:90
vnet.h
nsm_action_bit
nsm_action_bit
Definition:
nsim.h:66
nsim_main_t::output_next_index_by_sw_if_index
u32 * output_next_index_by_sw_if_index
Definition:
nsim.h:93
nsim_node_ctx::drop
u32 * drop
Definition:
nsim.h:54
nsim_main_t::arc_index
u16 arc_index
Definition:
nsim.h:86
nsim_main_t::mmap_size
u64 mmap_size
Definition:
nsim.h:109
nsim_node_ctx::expires
f64 expires
Definition:
nsim.h:53
nsim_wheel_entry_t::buffer_index
u32 buffer_index
Definition:
nsim.h:36
src
plugins
nsim
nsim.h
Generated on Sat Jan 8 2022 10:04:19 for FD.io VPP by
1.8.17