X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fnsim%2Fnsim.h;h=7222a96dcb4388344f763e6442c7ed826d4cf2f1;hb=e6c3e8f0e;hp=d0b5ed32feea7ac97c72d1dfeff77a00b8dee46a;hpb=9e3252b5cec76dddb9877e593c799ebe15cae0af;p=vpp.git diff --git a/src/plugins/nsim/nsim.h b/src/plugins/nsim/nsim.h index d0b5ed32fee..7222a96dcb4 100644 --- a/src/plugins/nsim/nsim.h +++ b/src/plugins/nsim/nsim.h @@ -25,15 +25,14 @@ #include #include -#define WHEEL_ENTRY_DATA_SIZE 1536 /* an even multiple of 64, pls */ - typedef struct { f64 tx_time; + u32 rx_sw_if_index; u32 tx_sw_if_index; - u32 current_length; - CLIB_CACHE_LINE_ALIGN_MARK (pad); - u8 data[WHEEL_ENTRY_DATA_SIZE]; + u32 output_next_index; + u32 buffer_index; + u32 pad; /* pad to 32-bytes */ } nsim_wheel_entry_t; typedef struct @@ -46,23 +45,64 @@ typedef struct CLIB_CACHE_LINE_ALIGN_MARK (pad); } nsim_wheel_t; +typedef struct nsim_node_ctx +{ + vnet_feature_config_main_t *fcm; + f64 expires; + u32 *drop; + u32 *reord; + u16 *reord_nexts; + u8 *action; + u64 n_buffered; + u64 n_loss; +} nsim_node_ctx_t; + +#define foreach_nsm_action \ + _(DROP, "Packet loss") \ + _(REORDER, "Packet reorder") + +enum nsm_action_bit +{ +#define _(sym, str) NSIM_ACTION_##sym##_BIT, + foreach_nsm_action +#undef _ +}; + +typedef enum nsm_action +{ +#define _(sym, str) NSIM_ACTION_##sym = 1 << NSIM_ACTION_##sym##_BIT, + foreach_nsm_action +#undef _ +} nsm_action_e; + typedef struct { /* API message ID base */ u16 msg_id_base; + /* output feature arc index */ + u16 arc_index; + /* Two interfaces, cross-connected with delay */ u32 sw_if_index0, sw_if_index1; u32 output_next_index0, output_next_index1; - /* Per-thread buffer / scheduler wheels */ + /* N interfaces, using the output feature */ + u32 *output_next_index_by_sw_if_index; + + /* Random seed for loss-rate simulation */ + u32 seed; + + /* Per-thread scheduler wheels */ nsim_wheel_t **wheel_by_thread; - u32 **buffer_indices_by_thread; /* Config parameters */ f64 delay; f64 bandwidth; f64 packet_size; + f64 drop_fraction; + f64 reorder_fraction; + u32 poll_main_thread; u64 mmap_size;