3 * nsim.h - skeleton vpp engine plug-in header file
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:
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __included_nsim_h__
19 #define __included_nsim_h__
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/ethernet/ethernet.h>
25 #include <vppinfra/hash.h>
26 #include <vppinfra/error.h>
28 #define NSIM_MAX_TX_BURST 32 /**< max packets in a tx burst */
35 u32 output_next_index;
37 u32 pad; /* pad to 32-bytes */
46 nsim_wheel_entry_t *entries;
47 CLIB_CACHE_LINE_ALIGN_MARK (pad);
50 typedef struct nsim_node_ctx
52 vnet_feature_config_main_t *fcm;
62 #define foreach_nsm_action \
63 _(DROP, "Packet loss") \
64 _(REORDER, "Packet reorder")
68 #define _(sym, str) NSIM_ACTION_##sym##_BIT,
73 typedef enum nsm_action
75 #define _(sym, str) NSIM_ACTION_##sym = 1 << NSIM_ACTION_##sym##_BIT,
82 /* API message ID base */
85 /* output feature arc index */
88 /* Two interfaces, cross-connected with delay */
89 u32 sw_if_index0, sw_if_index1;
90 u32 output_next_index0, output_next_index1;
92 /* N interfaces, using the output feature */
93 u32 *output_next_index_by_sw_if_index;
95 /* Random seed for loss-rate simulation */
98 /* Per-thread scheduler wheels */
99 nsim_wheel_t **wheel_by_thread;
101 /* Config parameters */
105 f64 reorder_fraction;
107 u32 wheel_slots_per_wrk;
108 u32 poll_main_thread;
112 /* Wheels are configured */
116 vlib_main_t *vlib_main;
117 vnet_main_t *vnet_main;
120 extern nsim_main_t nsim_main;
122 extern vlib_node_registration_t nsim_node;
123 extern vlib_node_registration_t nsim_input_node;
125 #endif /* __included_nsim_h__ */
128 * fd.io coding-style-patch-verification: ON
131 * eval: (c-set-style "gnu")