22 #define foreach_pppoe_cp_next \ 23 _(DROP, "error-drop") \ 24 _(INTERFACE, "interface-output" ) \ 28 #define _(s,n) PPPOE_CP_NEXT_##s, 52 s =
format (s,
"PPPoE dispatch from sw_if_index %d next %d error %d \n" 53 " pppoe_code 0x%x ppp_proto 0x%x",
59 s =
format (s,
"PPPoE dispatch from cp_if_index %d next %d error %d \n" 60 " pppoe_code 0x%x ppp_proto 0x%x",
71 u32 n_left_from, next_index, * from, * to_next;
75 u32 pkts_decapsulated = 0;
77 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
82 n_left_from = from_frame->n_vectors;
86 cached_result.
raw = ~0;
88 next_index =
node->cached_next_index;
89 stats_sw_if_index =
node->runtime_data[0];
90 stats_n_packets = stats_n_bytes = 0;
92 while (n_left_from > 0)
97 to_next, n_left_to_next);
99 while (n_left_from > 0 && n_left_to_next > 0)
111 u32 rx_sw_if_index0=~0, tx_sw_if_index0=~0, len0;
129 error0 = PPPOE_ERROR_BAD_VER_TYPE;
130 next0 = PPPOE_INPUT_NEXT_DROP;
141 &key0, &bucket0, &result0);
142 tx_sw_if_index0 = result0.
fields.sw_if_index;
146 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
147 next0 = PPPOE_INPUT_NEXT_DROP;
151 next0 = PPPOE_CP_NEXT_INTERFACE;
166 &key0, &bucket0, &result0);
167 tx_sw_if_index0 = result0.
fields.sw_if_index;
174 next0 = PPPOE_CP_NEXT_INTERFACE;
180 pkts_decapsulated ++;
181 stats_n_packets += 1;
182 stats_n_bytes += len0;
188 stats_n_packets -= 1;
189 stats_n_bytes -= len0;
193 thread_index, stats_sw_if_index,
194 stats_n_packets, stats_n_bytes);
196 stats_n_bytes = len0;
197 stats_sw_if_index = rx_sw_if_index0;
201 b0->
error = error0 ?
node->errors[error0] : 0;
215 to_next, n_left_to_next,
223 PPPOE_ERROR_DECAPSULATED,
231 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
232 node->runtime_data[0] = stats_sw_if_index;
235 return from_frame->n_vectors;
239 .name =
"pppoe-cp-dispatch",
241 .vector_size =
sizeof (
u32),
248 #define _(s,n) [PPPOE_CP_NEXT_##s] = n,
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static void vlib_buffer_reset(vlib_buffer_t *b)
Reset current header & length to state they were in when packet was received.
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.
vnet_interface_main_t interface_main
#define clib_memcpy_fast(a, b, c)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define VLIB_NODE_FN(node)
struct pppoe_entry_result_t::@705::@707 fields
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 * combined_sw_if_counters
description fragment has unexpected format
vlib_error_t error
Error code for buffers to be enqueued to error handler.
vlib_node_registration_t pppoe_cp_dispatch_node
(constructor) VLIB_REGISTER_NODE (pppoe_cp_dispatch_node)
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.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static_always_inline void pppoe_learn_process(BVT(clib_bihash) *table, u32 sw_if_index0, pppoe_entry_key_t *key0, pppoe_entry_key_t *cached_key, u32 *bucket0, pppoe_entry_result_t *result0)
Perform learning on one packet based on the mac table lookup result.
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
vlib_node_registration_t pppoe_input_node
(constructor) VLIB_REGISTER_NODE (pppoe_input_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.
static u8 * format_pppoe_cp_trace(u8 *s, va_list *args)
vlib_main_t vlib_node_runtime_t * node
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vnet_sw_interface_type_t type
static_always_inline void pppoe_lookup_1(BVT(clib_bihash) *table, pppoe_entry_key_t *cached_key, pppoe_entry_result_t *cached_result, u8 *mac0, u16 session_id0, pppoe_entry_key_t *key0, u32 *bucket0, pppoe_entry_result_t *result0)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
char * pppoe_error_strings[]
#define foreach_pppoe_cp_next