FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ip4_input.c File Reference
+ Include dependency graph for ip4_input.c:

Go to the source code of this file.

Data Structures

struct  ip4_input_trace_t
 

Functions

static u8format_ip4_input_trace (u8 *s, va_list *va)
 
static_always_inline u32 ip4_input_set_next (u32 sw_if_index, vlib_buffer_t *b, int arc_enabled)
 
static_always_inline void ip4_input_check_sw_if_index (vlib_main_t *vm, vlib_simple_counter_main_t *cm, u32 sw_if_index, u32 *last_sw_if_index, u32 *cnt, int *arc_enabled)
 
static uword ip4_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int verify_checksum)
 
VLIB_NODE_FN() ip4_input_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 IPv4 input node. More...
 
VLIB_NODE_FN() ip4_input_no_checksum_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static clib_error_tip4_init (vlib_main_t *vm)
 

Variables

char * ip4_error_strings []
 
vlib_node_registration_t ip4_input_node
 (constructor) VLIB_REGISTER_NODE (ip4_input_node) More...
 
vlib_node_registration_t ip4_input_no_checksum_node
 (constructor) VLIB_REGISTER_NODE (ip4_input_no_checksum_node) More...
 

Function Documentation

◆ format_ip4_input_trace()

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

Definition at line 52 of file ip4_input.c.

◆ ip4_init()

static clib_error_t* ip4_init ( vlib_main_t vm)
static

Definition at line 419 of file ip4_input.c.

+ Here is the call graph for this function:

◆ ip4_input_check_sw_if_index()

static_always_inline void ip4_input_check_sw_if_index ( vlib_main_t vm,
vlib_simple_counter_main_t cm,
u32  sw_if_index,
u32 last_sw_if_index,
u32 cnt,
int *  arc_enabled 
)

Definition at line 92 of file ip4_input.c.

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

◆ ip4_input_inline()

static uword ip4_input_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame,
int  verify_checksum 
)
inlinestatic

Definition at line 122 of file ip4_input.c.

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

◆ ip4_input_no_checksum_node()

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

Definition at line 369 of file ip4_input.c.

+ Here is the call graph for this function:

◆ ip4_input_node()

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

IPv4 input node.

Node Identifier:
ip4-input

This is the IPv4 input node: validates ip4 header checksums, verifies ip header lengths, discards pkts with expired TTLs, and sends pkts to the set of ip feature nodes configured on the rx interface.

Parameters
vmvlib_main_t corresponding to the current thread
nodevlib_node_runtime_t
framevlib_frame_t whose contents should be dispatched
Graph mechanics: buffer metadata, next index usage

Uses:

  • vnet_feature_config_main_t cm corresponding to each pkt's dst address unicast / multicast status.
  • b->current_config_index corresponding to each pkt's rx sw_if_index.
    • This sets the per-packet graph trajectory, ensuring that each packet visits the per-interface features in order.
  • vnet_buffer(b)->sw_if_index[VLIB_RX]
    • Indicates the sw_if_index value of the interface that the packet was received on.

Sets:

  • vnet_buffer(b)->ip.adj_index[VLIB_TX]
    • The lookup result adjacency index.

Next Indices:

  • Dispatches pkts to the (first) feature node: vnet_get_config_data (... &next0 ...); or error-drop

Definition at line 363 of file ip4_input.c.

+ Here is the call graph for this function:

◆ ip4_input_set_next()

static_always_inline u32 ip4_input_set_next ( u32  sw_if_index,
vlib_buffer_t b,
int  arc_enabled 
)

Definition at line 65 of file ip4_input.c.

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

Variable Documentation

◆ ip4_error_strings

char* ip4_error_strings[]
Initial value:
= {
#define _(sym,string)
}

Definition at line 377 of file ip4_input.c.

◆ ip4_input_no_checksum_node

vlib_node_registration_t ip4_input_no_checksum_node
Initial value:
= {
.name = "ip4-input-no-checksum",
.vector_size = sizeof (u32),
.sibling_of = "ip4-input",
.format_buffer = format_ip4_header,
.format_trace = format_ip4_input_trace,
}

(constructor) VLIB_REGISTER_NODE (ip4_input_no_checksum_node)

Definition at line 408 of file ip4_input.c.

◆ ip4_input_node

vlib_node_registration_t ip4_input_node
Initial value:
= {
.name = "ip4-input",
.vector_size = sizeof (u32),
.protocol_hint = VLIB_NODE_PROTO_HINT_IP4,
.n_errors = IP4_N_ERROR,
.error_strings = ip4_error_strings,
.n_next_nodes = IP4_INPUT_N_NEXT,
.next_nodes = {
[IP4_INPUT_NEXT_DROP] = "error-drop",
[IP4_INPUT_NEXT_PUNT] = "error-punt",
[IP4_INPUT_NEXT_OPTIONS] = "ip4-options",
[IP4_INPUT_NEXT_LOOKUP] = "ip4-lookup",
[IP4_INPUT_NEXT_LOOKUP_MULTICAST] = "ip4-mfib-forward-lookup",
[IP4_INPUT_NEXT_ICMP_ERROR] = "ip4-icmp-error",
[IP4_INPUT_NEXT_REASSEMBLY] = "ip4-full-reassembly",
},
.format_buffer = format_ip4_header,
.format_trace = format_ip4_input_trace,
}

(constructor) VLIB_REGISTER_NODE (ip4_input_node)

Global ip4 input node.

Definition at line 385 of file ip4_input.c.

VLIB_NODE_PROTO_HINT_IP4
@ VLIB_NODE_PROTO_HINT_IP4
Definition: node.h:62
IP4_INPUT_NEXT_LOOKUP_MULTICAST
@ IP4_INPUT_NEXT_LOOKUP_MULTICAST
Definition: ip4_input.h:52
IP4_INPUT_NEXT_LOOKUP
@ IP4_INPUT_NEXT_LOOKUP
Definition: ip4_input.h:51
IP4_N_ERROR
@ IP4_N_ERROR
Definition: ip4_error.h:97
ip4_error_strings
char * ip4_error_strings[]
Definition: ip4_input.c:377
IP4_INPUT_NEXT_ICMP_ERROR
@ IP4_INPUT_NEXT_ICMP_ERROR
Definition: ip4_input.h:53
u32
unsigned int u32
Definition: types.h:88
IP4_INPUT_N_NEXT
@ IP4_INPUT_N_NEXT
Definition: ip4_input.h:55
format_ip4_input_trace
static u8 * format_ip4_input_trace(u8 *s, va_list *va)
Definition: ip4_input.c:52
format_ip4_header
format_function_t format_ip4_header
Definition: format.h:81
foreach_ip4_error
#define foreach_ip4_error
Definition: ip4_error.h:43
IP4_INPUT_NEXT_PUNT
@ IP4_INPUT_NEXT_PUNT
Definition: ip4_input.h:49
IP4_INPUT_NEXT_OPTIONS
@ IP4_INPUT_NEXT_OPTIONS
Definition: ip4_input.h:50
IP4_INPUT_NEXT_REASSEMBLY
@ IP4_INPUT_NEXT_REASSEMBLY
Definition: ip4_input.h:54
IP4_INPUT_NEXT_DROP
@ IP4_INPUT_NEXT_DROP
Definition: ip4_input.h:48