FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
interface_output.c File Reference
+ Include dependency graph for interface_output.c:

Go to the source code of this file.

Data Structures

struct  interface_output_trace_t
 
struct  vnet_error_trace_t_
 

Typedefs

typedef struct vnet_error_trace_t_ vnet_error_trace_t
 

Enumerations

enum  vnet_error_disposition_t { VNET_ERROR_DISPOSITION_DROP, VNET_ERROR_DISPOSITION_PUNT, VNET_ERROR_N_DISPOSITION }
 

Functions

u8format_vnet_interface_output_trace (u8 *s, va_list *va)
 
static void vnet_interface_output_trace (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, uword n_buffers)
 
static_always_inline void vnet_interface_output_handle_offload (vlib_main_t *vm, vlib_buffer_t *b)
 
static_always_inline uword vnet_interface_output_node_inline (vlib_main_t *vm, u32 sw_if_index, vlib_combined_counter_main_t *ccm, vlib_buffer_t **b, u32 config_index, u8 arc, u32 n_left, int do_tx_offloads, int arc_or_subif)
 
static_always_inline void vnet_interface_pcap_tx_trace (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int in_interface_ouput)
 
static_always_inline void store_tx_frame_scalar_data (vnet_hw_if_output_node_runtime_t *r, vnet_hw_if_tx_frame_t *tf)
 
static_always_inline void enqueu_to_tx_node (vlib_main_t *vm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u32 *from, u32 n_vectors)
 
 if (node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
 
 if (rt->is_deleted) return vlib_error_drop_buffers(vm
 
 vnet_interface_pcap_tx_trace (vm, node, frame, 0)
 
 vlib_get_buffers (vm, from, bufs, n_buffers)
 
 if (!(si->flags &VNET_SW_INTERFACE_FLAG_ADMIN_UP)||!(hi->flags &VNET_HW_INTERFACE_FLAG_LINK_UP))
 
 if (PREDICT_FALSE(vnet_have_features(arc, sw_if_index)))
 
else if (hash_elts(hi->sub_interface_sw_if_index_by_id))
 
 vlib_increment_combined_counter (ccm, ti, sw_if_index, n_buffers, n_bytes)
 
VLIB_NODE_FN() vnet_per_buffer_interface_output_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static u8format_vnet_error_trace (u8 *s, va_list *va)
 
static void interface_trace_buffers (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static void drop_catchup_trace (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b)
 
static_always_inline uword interface_drop_punt (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vnet_error_disposition_t disposition)
 
static void pcap_drop_trace (vlib_main_t *vm, vnet_interface_main_t *im, vnet_pcap_t *pp, vlib_frame_t *f)
 
void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add)
 
VLIB_NODE_FN() interface_drop (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
VLIB_NODE_FN() interface_punt (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
 vlib_get_buffers (vm, from, bufs, n_left)
 
 while (n_left >=8)
 
 while (n_left)
 
 if (hi->output_node_thread_runtimes) r
 
 if (f->n_vectors > 0 &&(r==0||r->frame.queue_id==tf->queue_id))
 
 clib_mask_compare_u32 (swif, sw_if_indices, mask, frame->n_vectors)
 
 if (tmp !=to)
 
else if (n_free >=n_comp)
 
 vlib_buffer_copy_indices (to, tmp, n_free)
 
 vlib_put_next_frame (vm, node, next_index, 0)
 
 vlib_buffer_copy_indices (to, tmp+n_free, n_frame2)
 
 store_tx_frame_scalar_data (r, tf)
 
 vlib_put_next_frame (vm, node, next_index, VLIB_FRAME_SIZE - n_frame2)
 
 if (n_left)
 
 VNET_FEATURE_ARC_INIT (interface_output, static)
 
 VNET_FEATURE_INIT (span_tx, static)
 
 VNET_FEATURE_INIT (ipsec_if_tx, static)
 
 VNET_FEATURE_INIT (interface_output_arc_end, static)
 
clib_error_tvnet_per_buffer_interface_output_hw_interface_add_del (vnet_main_t *vnm, u32 hw_if_index, u32 is_create)
 
 VNET_HW_INTERFACE_ADD_DEL_FUNCTION (vnet_per_buffer_interface_output_hw_interface_add_del)
 
void vnet_set_interface_output_node (vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
 Set interface output node - for interface registered without its output/tx nodes created because its VNET_DEVICE_CLASS did not specify any tx_function. More...
 

Variables

vlib_main_tvm
 
vlib_main_t vlib_node_runtime_tnode
 
vlib_main_t vlib_node_runtime_t vlib_frame_tframe
 
vnet_interface_main_tim = &vnm->interface_main
 
vlib_combined_counter_main_tccm
 
vnet_hw_interface_thi = vnet_get_sup_hw_interface (vnm, sw_if_index)
 
vnet_sw_interface_tsi = vnet_get_sw_interface (vnm, sw_if_index)
 
vnet_interface_output_runtime_trt = (void *) node->runtime_data
 
vlib_buffer_tbufs [VLIB_FRAME_SIZE]
 
u32 n_bytes
 
u32 n_buffers = frame->n_vectors
 
u32 config_index = ~0
 
u32 sw_if_index = rt->sw_if_index
 
u32 next_index = VNET_INTERFACE_OUTPUT_NEXT_TX
 
u32 ti = vm->thread_index
 
u8 arc = im->output_feature_arc_index
 
int arc_or_subif = 0
 
int do_tx_offloads = 0
 
u32from = vlib_frame_vector_args (frame)
 
 VNET_INTERFACE_OUTPUT_NEXT_DROP
 
node node_index
 
node VNET_INTERFACE_OUTPUT_ERROR_INTERFACE_DELETED
 
 else
 
vlib_node_registration_t vnet_interface_output_node
 (constructor) VLIB_REGISTER_NODE (vnet_interface_output_node) More...
 
vlib_node_registration_t interface_drop
 (constructor) VLIB_REGISTER_NODE (interface_drop) More...
 
vlib_node_registration_t interface_punt
 (constructor) VLIB_REGISTER_NODE (interface_punt) More...
 
vlib_node_registration_t vnet_per_buffer_interface_output_node
 (constructor) VLIB_REGISTER_NODE (vnet_per_buffer_interface_output_node) More...
 
vnet_hw_if_output_node_runtime_tr = 0
 
vnet_hw_if_tx_frame_ttf = vlib_frame_scalar_args (f)
 
vlib_buffer_t ** b = bufs
 
u32 sw_if_indices [VLIB_FRAME_SIZE]
 
u64 used_elts [VLIB_FRAME_SIZE/64] = {}
 
u64 mask [VLIB_FRAME_SIZE/64] = {}
 
u32tmp = (u32 *) bufs
 
u32 n_left = frame->n_vectors
 
u32 n_free = VLIB_FRAME_SIZE
 
u32 n_comp = clib_compress_u32 (to, from, mask, frame->n_vectors)
 
u32to = vlib_frame_vector_args (f)
 
u32 swif = sw_if_indices[0]
 
u32 off = 0
 
vlib_frame_tf = vlib_get_next_frame_internal (vm, node, next_index, 0)
 
u32 n_frame2 = n_comp - n_free
 
return frame n_vectors
 
vlib_node_registration_t vnet_interface_output_arc_end_node
 (constructor) VLIB_REGISTER_NODE (vnet_interface_output_arc_end_node) More...
 

Typedef Documentation

◆ vnet_error_trace_t

Enumeration Type Documentation

◆ vnet_error_disposition_t

Enumerator
VNET_ERROR_DISPOSITION_DROP 
VNET_ERROR_DISPOSITION_PUNT 
VNET_ERROR_N_DISPOSITION 

Definition at line 715 of file interface_output.c.

Function Documentation

◆ clib_mask_compare_u32()

clib_mask_compare_u32 ( swif  ,
sw_if_indices  ,
mask  ,
frame->  n_vectors 
)

◆ drop_catchup_trace()

static void drop_catchup_trace ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_buffer_t b 
)
static

Definition at line 723 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enqueu_to_tx_node()

static_always_inline void enqueu_to_tx_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vnet_hw_interface_t hi,
u32 from,
u32  n_vectors 
)

Definition at line 354 of file interface_output.c.

+ Here is the call graph for this function:

◆ format_vnet_error_trace()

static u8* format_vnet_error_trace ( u8 s,
va_list *  va 
)
static

Definition at line 618 of file interface_output.c.

+ Here is the call graph for this function:

◆ format_vnet_interface_output_trace()

u8* format_vnet_interface_output_trace ( u8 s,
va_list *  va 
)

Definition at line 63 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ if() [1/10]

if ( si->flags &VNET_SW_INTERFACE_FLAG_ADMIN_UP)||!(hi->flags &VNET_HW_INTERFACE_FLAG_LINK_UP)

Definition at line 449 of file interface_output.c.

+ Here is the call graph for this function:

◆ if() [2/10]

if ( f->  n_vectors,
0 &&  r==0||r->frame.queue_id==tf->queue_id 
)

Definition at line 1144 of file interface_output.c.

+ Here is the call graph for this function:

◆ if() [3/10]

else if ( hash_elts(hi->sub_interface_sw_if_index_by_id)  )

Definition at line 473 of file interface_output.c.

◆ if() [4/10]

if ( hi->  output_node_thread_runtimes)

◆ if() [5/10]

else if ( n_free >=  n_comp)

Definition at line 1177 of file interface_output.c.

+ Here is the call graph for this function:

◆ if() [6/10]

if ( n_left  )

Definition at line 1202 of file interface_output.c.

◆ if() [7/10]

if ( node->flags VLIB_NODE_FLAG_TRACE)

◆ if() [8/10]

Definition at line 465 of file interface_output.c.

+ Here is the call graph for this function:

◆ if() [9/10]

if ( rt->  is_deleted)

◆ if() [10/10]

if ( tmp = to)

Definition at line 1172 of file interface_output.c.

+ Here is the call graph for this function:

◆ interface_drop()

VLIB_NODE_FN() interface_drop ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 1032 of file interface_output.c.

+ Here is the call graph for this function:

◆ interface_drop_punt()

static_always_inline uword interface_drop_punt ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
vnet_error_disposition_t  disposition 
)

Definition at line 773 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ interface_punt()

VLIB_NODE_FN() interface_punt ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 1046 of file interface_output.c.

+ Here is the call graph for this function:

◆ interface_trace_buffers()

static void interface_trace_buffers ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 651 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pcap_drop_trace()

static void pcap_drop_trace ( vlib_main_t vm,
vnet_interface_main_t im,
vnet_pcap_t pp,
vlib_frame_t f 
)
inlinestatic

Definition at line 901 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store_tx_frame_scalar_data() [1/2]

store_tx_frame_scalar_data ( r  ,
tf   
)

◆ store_tx_frame_scalar_data() [2/2]

static_always_inline void store_tx_frame_scalar_data ( vnet_hw_if_output_node_runtime_t r,
vnet_hw_if_tx_frame_t tf 
)

Definition at line 346 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_buffer_copy_indices() [1/2]

vlib_buffer_copy_indices ( to  ,
tmp n_free,
n_frame2   
)

◆ vlib_buffer_copy_indices() [2/2]

vlib_buffer_copy_indices ( to  ,
tmp  ,
n_free   
)
+ Here is the caller graph for this function:

◆ vlib_get_buffers() [1/2]

vlib_get_buffers ( vm  ,
from  ,
bufs  ,
n_buffers   
)
+ Here is the caller graph for this function:

◆ vlib_get_buffers() [2/2]

vlib_get_buffers ( vm  ,
from  ,
bufs  ,
n_left   
)

◆ vlib_increment_combined_counter()

vlib_increment_combined_counter ( ccm  ,
ti  ,
sw_if_index  ,
n_buffers  ,
n_bytes   
)

◆ vlib_put_next_frame() [1/2]

vlib_put_next_frame ( vm  ,
node  ,
next_index  ,
 
)

◆ vlib_put_next_frame() [2/2]

vlib_put_next_frame ( vm  ,
node  ,
next_index  ,
VLIB_FRAME_SIZE n_frame2 
)

◆ VNET_FEATURE_ARC_INIT()

VNET_FEATURE_ARC_INIT ( interface_output  ,
static   
)

◆ VNET_FEATURE_INIT() [1/3]

VNET_FEATURE_INIT ( interface_output_arc_end  ,
static   
)

◆ VNET_FEATURE_INIT() [2/3]

VNET_FEATURE_INIT ( ipsec_if_tx  ,
static   
)

◆ VNET_FEATURE_INIT() [3/3]

VNET_FEATURE_INIT ( span_tx  ,
static   
)

◆ VNET_HW_INTERFACE_ADD_DEL_FUNCTION()

VNET_HW_INTERFACE_ADD_DEL_FUNCTION ( vnet_per_buffer_interface_output_hw_interface_add_del  )

◆ vnet_interface_output_handle_offload()

static_always_inline void vnet_interface_output_handle_offload ( vlib_main_t vm,
vlib_buffer_t b 
)

Definition at line 168 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_interface_output_node_inline()

static_always_inline uword vnet_interface_output_node_inline ( vlib_main_t vm,
u32  sw_if_index,
vlib_combined_counter_main_t ccm,
vlib_buffer_t **  b,
u32  config_index,
u8  arc,
u32  n_left,
int  do_tx_offloads,
int  arc_or_subif 
)

Definition at line 175 of file interface_output.c.

+ Here is the call graph for this function:

◆ vnet_interface_output_trace()

static void vnet_interface_output_trace ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
uword  n_buffers 
)
static

Definition at line 99 of file interface_output.c.

+ Here is the call graph for this function:

◆ vnet_interface_pcap_tx_trace() [1/2]

static_always_inline void vnet_interface_pcap_tx_trace ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  in_interface_ouput 
)

Definition at line 289 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_interface_pcap_tx_trace() [2/2]

vnet_interface_pcap_tx_trace ( vm  ,
node  ,
frame  ,
 
)

◆ vnet_pcap_drop_trace_filter_add_del()

void vnet_pcap_drop_trace_filter_add_del ( u32  error_index,
int  is_add 
)

Definition at line 1018 of file interface_output.c.

+ Here is the call graph for this function:

◆ vnet_per_buffer_interface_output_hw_interface_add_del()

clib_error_t* vnet_per_buffer_interface_output_hw_interface_add_del ( vnet_main_t vnm,
u32  hw_if_index,
u32  is_create 
)

Definition at line 1256 of file interface_output.c.

+ Here is the call graph for this function:

◆ vnet_per_buffer_interface_output_node()

VLIB_NODE_FN() vnet_per_buffer_interface_output_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 516 of file interface_output.c.

+ Here is the call graph for this function:

◆ vnet_set_interface_output_node()

void vnet_set_interface_output_node ( vnet_main_t vnm,
u32  hw_if_index,
u32  node_index 
)

Set interface output node - for interface registered without its output/tx nodes created because its VNET_DEVICE_CLASS did not specify any tx_function.

This is typically the case for tunnel interfaces.

Definition at line 1278 of file interface_output.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ while() [1/2]

while ( n_left >=  8)

Definition at line 1104 of file interface_output.c.

◆ while() [2/2]

while ( n_left  )

Definition at line 1120 of file interface_output.c.

Variable Documentation

◆ arc

u8 arc = im->output_feature_arc_index

Definition at line 426 of file interface_output.c.

◆ arc_or_subif

int arc_or_subif = 0

Definition at line 427 of file interface_output.c.

◆ b

Definition at line 1092 of file interface_output.c.

◆ bufs

Definition at line 420 of file interface_output.c.

◆ ccm

Definition at line 416 of file interface_output.c.

◆ config_index

u32 config_index = ~0

Definition at line 422 of file interface_output.c.

◆ do_tx_offloads

int do_tx_offloads = 0

Definition at line 428 of file interface_output.c.

◆ else

else
Initial value:

Definition at line 500 of file interface_output.c.

◆ f

Definition at line 1098 of file interface_output.c.

◆ frame

Initial value:

Definition at line 413 of file interface_output.c.

◆ from

Definition at line 429 of file interface_output.c.

◆ hi

Definition at line 417 of file interface_output.c.

◆ im

vnet_interface_main_t * im = &vnm->interface_main

Definition at line 415 of file interface_output.c.

◆ interface_drop

vlib_node_registration_t interface_drop
Initial value:
= {
.name = "error-drop",
.vector_size = sizeof (u32),
.format_trace = format_vnet_error_trace,
.n_next_nodes = 1,
.next_nodes = {
[0] = "drop",
},
}

(constructor) VLIB_REGISTER_NODE (interface_drop)

Definition at line 1054 of file interface_output.c.

◆ interface_punt

vlib_node_registration_t interface_punt
Initial value:
= {
.name = "error-punt",
.vector_size = sizeof (u32),
.format_trace = format_vnet_error_trace,
.n_next_nodes = 1,
.next_nodes = {
[0] = "punt",
},
}

(constructor) VLIB_REGISTER_NODE (interface_punt)

Definition at line 1067 of file interface_output.c.

◆ mask

u64 mask[VLIB_FRAME_SIZE/64] = {}

Definition at line 1095 of file interface_output.c.

◆ n_buffers

return n_buffers = frame->n_vectors

Definition at line 421 of file interface_output.c.

◆ n_bytes

u32 n_bytes

Definition at line 421 of file interface_output.c.

◆ n_comp

Definition at line 1096 of file interface_output.c.

◆ n_frame2

u32 n_frame2 = n_comp - n_free

Definition at line 1192 of file interface_output.c.

◆ n_free

n_free = VLIB_FRAME_SIZE

Definition at line 1096 of file interface_output.c.

◆ n_left

n_left = frame->n_vectors

Definition at line 1096 of file interface_output.c.

◆ n_vectors

return frame n_vectors

Definition at line 1217 of file interface_output.c.

◆ next_index

Definition at line 424 of file interface_output.c.

◆ node

Definition at line 412 of file interface_output.c.

◆ node_index

node node_index

Definition at line 440 of file interface_output.c.

◆ off

off = 0

Definition at line 1096 of file interface_output.c.

◆ r

Definition at line 1089 of file interface_output.c.

◆ rt

vnet_interface_output_runtime_t* rt = (void *) node->runtime_data

Definition at line 419 of file interface_output.c.

◆ si

Definition at line 418 of file interface_output.c.

◆ sw_if_index

u32 * sw_if_index = rt->sw_if_index

Definition at line 423 of file interface_output.c.

◆ sw_if_indices

u32 sw_if_indices[VLIB_FRAME_SIZE]

Definition at line 1093 of file interface_output.c.

◆ swif

more swif = sw_if_indices[0]

Definition at line 1096 of file interface_output.c.

◆ tf

Definition at line 1091 of file interface_output.c.

◆ ti

Definition at line 425 of file interface_output.c.

◆ tmp

tmp = (u32 *) bufs

Definition at line 1096 of file interface_output.c.

◆ to

Definition at line 1096 of file interface_output.c.

◆ used_elts

u64 used_elts[VLIB_FRAME_SIZE/64] = {}

Definition at line 1094 of file interface_output.c.

◆ vm

Definition at line 412 of file interface_output.c.

◆ vnet_interface_output_arc_end_node

vlib_node_registration_t vnet_interface_output_arc_end_node
Initial value:
= {
.name = "interface-output-arc-end",
.vector_size = sizeof (u32),
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}

(constructor) VLIB_REGISTER_NODE (vnet_interface_output_arc_end_node)

Definition at line 1220 of file interface_output.c.

◆ VNET_INTERFACE_OUTPUT_ERROR_INTERFACE_DELETED

node VNET_INTERFACE_OUTPUT_ERROR_INTERFACE_DELETED

Definition at line 440 of file interface_output.c.

◆ VNET_INTERFACE_OUTPUT_NEXT_DROP

VNET_INTERFACE_OUTPUT_NEXT_DROP

Definition at line 439 of file interface_output.c.

◆ vnet_interface_output_node

vlib_node_registration_t vnet_interface_output_node
Initial value:
= {
.name = "interface-output-template",
.vector_size = sizeof (u32),
}

(constructor) VLIB_REGISTER_NODE (vnet_interface_output_node)

Definition at line 510 of file interface_output.c.

◆ vnet_per_buffer_interface_output_node

vlib_node_registration_t vnet_per_buffer_interface_output_node
Initial value:
= {
.name = "interface-output",
.vector_size = sizeof (u32),
}

(constructor) VLIB_REGISTER_NODE (vnet_per_buffer_interface_output_node)

Definition at line 1079 of file interface_output.c.

format_vnet_error_trace
static u8 * format_vnet_error_trace(u8 *s, va_list *va)
Definition: interface_output.c:618
vm
vlib_main_t * vm
Definition: interface_output.c:412
frame
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
Definition: interface_output.c:413
vlib_buffer_enqueue_to_single_next
static_always_inline void vlib_buffer_enqueue_to_single_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 next_index, u32 count)
Definition: buffer_node.h:373
next_index
u32 next_index
Definition: interface_output.c:424
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
VLIB_NODE_FLAG_TRACE_SUPPORTED
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
Definition: node.h:295
from
u32 * from
Definition: interface_output.c:429
vnet_main_t
Definition: vnet.h:76
u32
unsigned int u32
Definition: types.h:88
node
vlib_main_t vlib_node_runtime_t * node
Definition: interface_output.c:412
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105