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, 89 b0->
error = node->
errors[SRV6_LOCALSID_COUNTER_NO_SRH];
96 b0->
error = node->
errors[SRV6_LOCALSID_COUNTER_NO_SRH];
108 u32 n_left_from, * from, * to_next;
110 u32 pkts_swapped = 0;
119 while (n_left_from > 0)
124 to_next, n_left_to_next);
126 while (n_left_from > 0 && n_left_to_next > 0)
176 n_left_to_next, bi0, next0);
189 .name =
"srv6-localsid-sample",
190 .vector_size =
sizeof (
u32),
static uword srv6_localsid_sample_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
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.
struct _vlib_node_registration vlib_node_registration_t
#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
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword os_get_cpu_number(void)
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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
ip6_sr_localsid_t * localsids
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, u32 *next0)
Function doing End processing.
#define VLIB_BUFFER_IS_TRACED
vlib_node_registration_t srv6_localsid_sample_node
(constructor) VLIB_REGISTER_NODE (srv6_localsid_sample_node)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
void * plugin_mem
Memory to be used by the plugin callback functions.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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.
#define VLIB_REGISTER_NODE(x,...)
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.