|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
19 #include <srv6-localsid/srv6_localsid_sample.h>
31 s =
format (s,
"SRv6-sample-localsid: localsid_index %d\n",
38 #define foreach_srv6_localsid_counter \
39 _(PROCESSED, "srv6-sample-localsid processed packets") \
40 _(NO_SRH, "(Error) No SRH.")
43 #define _(sym,str) SRV6_LOCALSID_COUNTER_##sym,
50 #define _(sym,string) string,
72 ip6_ext_header_t * prev0)
74 ip6_address_t *new_dst0;
81 u64 *copy_dst0, *copy_src0;
82 u32 copy_len_u64s0 = 0;
97 copy_src0 = (
u64 *) ip0;
98 copy_dst0 = copy_src0 + (sr0->
length + 1);
106 copy_dst0[4 + copy_len_u64s0] = copy_src0[4 + copy_len_u64s0];
107 copy_dst0[3 + copy_len_u64s0] = copy_src0[3 + copy_len_u64s0];
108 copy_dst0[2 + copy_len_u64s0] = copy_src0[2 + copy_len_u64s0];
109 copy_dst0[1 + copy_len_u64s0] = copy_src0[1 + copy_len_u64s0];
110 copy_dst0[0 + copy_len_u64s0] = copy_src0[0 + copy_len_u64s0];
113 for (
i = copy_len_u64s0 - 1;
i >= 0;
i--)
115 copy_dst0[
i] = copy_src0[
i];
121 *next0 = SR_LOCALSID_NEXT_IP6_REWRITE;
131 new_dst0 = (ip6_address_t *) (sr0->
segments);
139 *next0 = SR_LOCALSID_NEXT_IP6_REWRITE;
148 *next0 = SR_LOCALSID_NEXT_ERROR;
149 b0->
error =
node->errors[SR_LOCALSID_ERROR_NO_MORE_SEGMENTS];
155 *next0 = SR_LOCALSID_NEXT_ERROR;
156 b0->
error =
node->errors[SR_LOCALSID_ERROR_NO_SRH];
169 u32 pkts_swapped = 0;
183 to_next, n_left_to_next);
236 n_left_to_next, bi0, next0);
244 return frame->n_vectors;
249 .name =
"srv6-localsid-sample",
250 .vector_size =
sizeof (
u32),
srv6_localsid_sample_next_t
vlib_combined_counter_main_t sr_ls_valid_counters
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
nat44_ei_hairpin_src_next_t next_index
static char * srv6_localsid_counter_strings[]
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
@ SRV6_LOCALSID_N_COUNTERS
@ VLIB_NODE_TYPE_INTERNAL
void * plugin_mem
Memory to be used by the plugin callback functions.
#define ip6_ext_header_len(p)
vlib_main_t vlib_node_runtime_t * node
static u8 * format_srv6_localsid_sample_trace(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_combined_counter_main_t sr_ls_invalid_counters
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static_always_inline void end_srh_processing(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0, u8 psp, ip6_ext_header_t *prev0)
Function doing End processing.
vlib_node_registration_t srv6_localsid_sample_node
(constructor) VLIB_REGISTER_NODE (srv6_localsid_sample_node)
static_always_inline uword vlib_get_thread_index(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
srv6_localsid_sample_counters
static void * ip6_ext_header_find(vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6_header, u8 header_type, ip6_ext_header_t **prev_ext_header)
#define static_always_inline
static uword srv6_localsid_sample_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
struct _vlib_node_registration vlib_node_registration_t
u32 nh_adj
Next_adj for xconnect usage only.
ip6_sr_localsid_t * localsids
@ SRV6_SAMPLE_LOCALSID_NEXT_ERROR
#define foreach_srv6_localsid_counter
@ SRV6_SAMPLE_LOCALSID_NEXT_IP6LOOKUP
Segment Routing main datastructure.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
@ SRV6_SAMPLE_LOCALSID_N_NEXT
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
#define ROUTING_HEADER_TYPE_SR
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static_always_inline void end_decaps_srh_processing(vlib_node_runtime_t *node, vlib_buffer_t *b0, ip6_header_t *ip0, ip6_sr_header_t *sr0, ip6_sr_localsid_t *ls0, u32 *next0)
u16 behavior
Behavior associated to this localsid.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vl_api_fib_path_type_t type
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)