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)
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;
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];
167 u32 n_left_from, * from, * to_next;
169 u32 pkts_swapped = 0;
178 while (n_left_from > 0)
183 to_next, n_left_to_next);
185 while (n_left_from > 0 && n_left_to_next > 0)
236 n_left_to_next, bi0, next0);
249 .name =
"srv6-localsid-sample",
250 .vector_size =
sizeof (
u32),
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u32 nh_adj
Next_adj for xconnect usage only.
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
static uword srv6_localsid_sample_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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 ROUTING_HEADER_TYPE_SR
static u8 * format_srv6_localsid_sample_trace(u8 *s, va_list *args)
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.
vlib_combined_counter_main_t sr_ls_invalid_counters
vlib_combined_counter_main_t sr_ls_valid_counters
srv6_localsid_sample_counters
#define static_always_inline
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)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#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.
static char * srv6_localsid_counter_strings[]
#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).
#define ip6_ext_header_len(p)
ip6_sr_localsid_t * localsids
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
vlib_node_registration_t srv6_localsid_sample_node
(constructor) VLIB_REGISTER_NODE (srv6_localsid_sample_node)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
void * plugin_mem
Memory to be used by the plugin callback functions.
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.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
VLIB buffer representation.
srv6_localsid_sample_next_t
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define foreach_srv6_localsid_counter
Segment Routing main datastructure.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.