37 s =
format (s,
"PPPoE decap from pppoe_session%d session_id %d next %d error %d",
42 s =
format (s,
"PPPoE decap error - session for session_id %d does not exist",
52 u32 n_left_from, next_index, * from, * to_next;
56 u32 pkts_decapsulated = 0;
58 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
63 n_left_from = from_frame->n_vectors;
67 cached_result.
raw = ~0;
69 next_index =
node->cached_next_index;
70 stats_sw_if_index =
node->runtime_data[0];
71 stats_n_packets = stats_n_bytes = 0;
73 while (n_left_from > 0)
78 to_next, n_left_to_next);
79 while (n_left_from >= 4 && n_left_to_next >= 2)
87 u16 ppp_proto0 = 0, ppp_proto1 = 0;
89 u32 error0 = 0, error1 = 0;
90 u32 sw_if_index0, sw_if_index1, len0, len1;
129 type0 = clib_net_to_host_u16(h0->
type);
130 if(type0 == ETHERNET_TYPE_VLAN){
132 type0 = clib_net_to_host_u16(vlan0->
type);
134 if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
135 error0 = PPPOE_ERROR_BAD_VER_TYPE;
136 next0 = PPPOE_INPUT_NEXT_DROP;
143 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
146 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
147 && (ppp_proto0 != PPP_PROTOCOL_ip6))
153 error0 = PPPOE_ERROR_CONTROL_PLANE;
154 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
161 &key0, &bucket0, &result0);
164 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
165 next0 = PPPOE_INPUT_NEXT_DROP;
170 result0.
fields.session_index);
178 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
179 PPPOE_INPUT_NEXT_IP4_INPUT
180 : PPPOE_INPUT_NEXT_IP6_INPUT;
186 pkts_decapsulated ++;
187 stats_n_packets += 1;
188 stats_n_bytes += len0;
194 stats_n_packets -= 1;
195 stats_n_bytes -= len0;
199 thread_index, stats_sw_if_index,
200 stats_n_packets, stats_n_bytes);
202 stats_n_bytes = len0;
203 stats_sw_if_index = sw_if_index0;
207 b0->
error = error0 ?
node->errors[error0] : 0;
224 type1 = clib_net_to_host_u16(h1->
type);
225 if(type1 == ETHERNET_TYPE_VLAN){
227 type1 = clib_net_to_host_u16(vlan1->type);
229 if( type1 != ETHERNET_TYPE_PPPOE_DISCOVERY && type1 != ETHERNET_TYPE_PPPOE_SESSION ) {
230 error1 = PPPOE_ERROR_BAD_VER_TYPE;
231 next1 = PPPOE_INPUT_NEXT_DROP;
238 ppp_proto1 = clib_net_to_host_u16(pppoe1->
ppp_proto);
241 if ((ppp_proto1 != PPP_PROTOCOL_ip4)
242 && (ppp_proto1 != PPP_PROTOCOL_ip6))
248 error1 = PPPOE_ERROR_CONTROL_PLANE;
249 next1 = PPPOE_INPUT_NEXT_CP_INPUT;
255 &key1, &bucket1, &result1);
258 error1 = PPPOE_ERROR_NO_SUCH_SESSION;
259 next1 = PPPOE_INPUT_NEXT_DROP;
264 result1.
fields.session_index);
272 next1 = (ppp_proto1==PPP_PROTOCOL_ip4)?
273 PPPOE_INPUT_NEXT_IP4_INPUT
274 : PPPOE_INPUT_NEXT_IP6_INPUT;
280 pkts_decapsulated ++;
281 stats_n_packets += 1;
282 stats_n_bytes += len1;
288 stats_n_packets -= 1;
289 stats_n_bytes -= len1;
293 thread_index, stats_sw_if_index,
294 stats_n_packets, stats_n_bytes);
296 stats_n_bytes = len1;
297 stats_sw_if_index = sw_if_index1;
301 b1->
error = error1 ?
node->errors[error1] : 0;
314 to_next, n_left_to_next,
315 bi0, bi1, next0, next1);
318 while (n_left_from > 0 && n_left_to_next > 0)
329 u32 sw_if_index0, len0;
350 type0 = clib_net_to_host_u16(h0->
type);
351 if(type0 == ETHERNET_TYPE_VLAN){
353 type0 = clib_net_to_host_u16(vlan0->
type);
355 if( type0 != ETHERNET_TYPE_PPPOE_DISCOVERY && type0 != ETHERNET_TYPE_PPPOE_SESSION ) {
356 error0 = PPPOE_ERROR_BAD_VER_TYPE;
357 next0 = PPPOE_INPUT_NEXT_DROP;
364 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
366 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
367 && (ppp_proto0 != PPP_PROTOCOL_ip6))
373 error0 = PPPOE_ERROR_CONTROL_PLANE;
374 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
380 &key0, &bucket0, &result0);
383 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
384 next0 = PPPOE_INPUT_NEXT_DROP;
389 result0.
fields.session_index);
397 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
398 PPPOE_INPUT_NEXT_IP4_INPUT
399 : PPPOE_INPUT_NEXT_IP6_INPUT;
405 pkts_decapsulated ++;
406 stats_n_packets += 1;
407 stats_n_bytes += len0;
413 stats_n_packets -= 1;
414 stats_n_bytes -= len0;
418 thread_index, stats_sw_if_index,
419 stats_n_packets, stats_n_bytes);
421 stats_n_bytes = len0;
422 stats_sw_if_index = sw_if_index0;
426 b0->
error = error0 ?
node->errors[error0] : 0;
438 to_next, n_left_to_next,
446 PPPOE_ERROR_DECAPSULATED,
454 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
455 node->runtime_data[0] = stats_sw_if_index;
458 return from_frame->n_vectors;
461 #ifndef CLIB_MARCH_VARIANT 463 #define pppoe_error(n,s) s, 471 .name =
"pppoe-input",
473 .vector_size =
sizeof (
u32),
480 #define _(s,n) [PPPOE_INPUT_NEXT_##s] = n, 491 .arc_name =
"device-input",
492 .node_name =
"pppoe-input",
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
VNET_FEATURE_INIT(pppoe_input_node, static)
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.
static u8 * format_pppoe_rx_trace(u8 *s, va_list *args)
vnet_interface_main_t interface_main
#define foreach_pppoe_input_next
#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.
char * pppoe_error_strings[]
vlib_node_registration_t pppoe_input_node
(constructor) VLIB_REGISTER_NODE (pppoe_input_node)
vlib_combined_counter_main_t * combined_sw_if_counters
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
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_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#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)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
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.
pppoe_session_t * sessions
vlib_main_t vlib_node_runtime_t * node
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define VNET_FEATURES(...)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
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)
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.