26 .n_packets_to_capture = 15,
27 .packet_type = MPCAP_PACKET_TYPE_ethernet,
36 #ifndef CLIB_MARCH_VARIANT 46 s =
format (s,
"MPCAP: sw_if_index %d, next index %d\n",
55 #define foreach_mpcap_error \ 56 _(PROCESSED, "Mapped pcap packets processed") 60 #define _(sym,str) MPCAP_ERROR_##sym, 66 #ifndef CLIB_MARCH_VARIANT 68 #define _(sym,string) string, 83 int is_ip4,
int is_trace)
85 u32 n_left_from, *from;
91 u32 error_index = node->
errors[MPCAP_ERROR_PROCESSED];
110 while (n_left_from >= 4)
130 b[0]->
error = error_index;
131 b[1]->
error = error_index;
132 b[2]->
error = error_index;
133 b[3]->
error = error_index;
149 if (b[0]->
flags & VLIB_BUFFER_IS_TRACED)
155 if (b[1]->
flags & VLIB_BUFFER_IS_TRACED)
161 if (b[2]->
flags & VLIB_BUFFER_IS_TRACED)
167 if (b[3]->
flags & VLIB_BUFFER_IS_TRACED)
180 while (n_left_from > 0)
185 b[0]->
error = error_index;
189 if (b[0]->
flags & VLIB_BUFFER_IS_TRACED)
219 #ifndef CLIB_MARCH_VARIANT 222 .name =
"mpcap-unittest",
223 .vector_size =
sizeof (
u32),
vl_api_wireguard_peer_flags_t flags
static f64 vlib_time_now(vlib_main_t *vm)
#define VLIB_NODE_FN(node)
static uword mpcap_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_ip4, int is_trace)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define foreach_mpcap_error
#define VLIB_INIT_FUNCTION(x)
static u8 * format_mpcap_trace(u8 *s, va_list *args)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define MPCAP_FLAG_INIT_DONE
static mpcap_main_t test_mpcap_main
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
char * file_name
File name of mpcap output.
MPCAP main state data structure.
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
sll srl srl sll sra u16x4 i
static void mpcap_add_buffer(mpcap_main_t *pm, vlib_main_t *vm, f64 time_now, u32 buffer_index, u32 n_bytes_in_trace)
Add buffer (vlib_buffer_t) to the trace.
vlib_main_t vlib_node_runtime_t * node
#define clib_error_report(e)
struct _vlib_node_registration vlib_node_registration_t
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static char * mpcap_error_strings[]
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
clib_error_t * mpcap_init(mpcap_main_t *pm)
Initialize a mapped pcap file.
static void ethernet_setup_node(vlib_main_t *vm, u32 node_index)
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
vlib_node_registration_t mpcap_node
(constructor) VLIB_REGISTER_NODE (mpcap_node)
static clib_error_t * mpcap_node_init(vlib_main_t *vm)