38 s =
format (s,
"PPPoE decap from pppoe_session%d session_id %d next %d error %d",
43 s =
format (s,
"PPPoE decap error - session for session_id %d does not exist",
53 u32 n_left_from, next_index, * from, * to_next;
57 u32 pkts_decapsulated = 0;
59 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
64 n_left_from = from_frame->n_vectors;
68 cached_result.
raw = ~0;
70 next_index =
node->cached_next_index;
71 stats_sw_if_index =
node->runtime_data[0];
72 stats_n_packets = stats_n_bytes = 0;
74 while (n_left_from > 0)
79 to_next, n_left_to_next);
80 while (n_left_from >= 4 && n_left_to_next >= 2)
87 u16 ppp_proto0 = 0, ppp_proto1 = 0;
90 u32 sw_if_index0, sw_if_index1, len0, len1;
126 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
127 ppp_proto1 = clib_net_to_host_u16(pppoe1->
ppp_proto);
130 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
131 && (ppp_proto0 != PPP_PROTOCOL_ip6))
133 error0 = PPPOE_ERROR_CONTROL_PLANE;
134 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
144 &key0, &bucket0, &result0);
147 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
148 next0 = PPPOE_INPUT_NEXT_DROP;
153 result0.
fields.session_index);
158 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
159 PPPOE_INPUT_NEXT_IP4_INPUT
160 : PPPOE_INPUT_NEXT_IP6_INPUT;
165 pkts_decapsulated ++;
166 stats_n_packets += 1;
167 stats_n_bytes += len0;
173 stats_n_packets -= 1;
174 stats_n_bytes -= len0;
178 thread_index, stats_sw_if_index,
179 stats_n_packets, stats_n_bytes);
181 stats_n_bytes = len0;
182 stats_sw_if_index = sw_if_index0;
186 b0->
error = error0 ?
node->errors[error0] : 0;
200 if ((ppp_proto1 != PPP_PROTOCOL_ip4)
201 && (ppp_proto1 != PPP_PROTOCOL_ip6))
203 error1 = PPPOE_ERROR_CONTROL_PLANE;
204 next1 = PPPOE_INPUT_NEXT_CP_INPUT;
214 &key1, &bucket1, &result1);
217 error1 = PPPOE_ERROR_NO_SUCH_SESSION;
218 next1 = PPPOE_INPUT_NEXT_DROP;
223 result1.
fields.session_index);
228 next1 = (ppp_proto1==PPP_PROTOCOL_ip4)?
229 PPPOE_INPUT_NEXT_IP4_INPUT
230 : PPPOE_INPUT_NEXT_IP6_INPUT;
235 pkts_decapsulated ++;
236 stats_n_packets += 1;
237 stats_n_bytes += len1;
243 stats_n_packets -= 1;
244 stats_n_bytes -= len1;
248 thread_index, stats_sw_if_index,
249 stats_n_packets, stats_n_bytes);
251 stats_n_bytes = len1;
252 stats_sw_if_index = sw_if_index1;
256 b1->
error = error1 ?
node->errors[error1] : 0;
269 to_next, n_left_to_next,
270 bi0, bi1, next0, next1);
273 while (n_left_from > 0 && n_left_to_next > 0)
283 u32 sw_if_index0, len0;
300 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
302 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
303 && (ppp_proto0 != PPP_PROTOCOL_ip6))
305 error0 = PPPOE_ERROR_CONTROL_PLANE;
306 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
316 &key0, &bucket0, &result0);
319 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
320 next0 = PPPOE_INPUT_NEXT_DROP;
325 result0.
fields.session_index);
330 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
331 PPPOE_INPUT_NEXT_IP4_INPUT
332 : PPPOE_INPUT_NEXT_IP6_INPUT;
337 pkts_decapsulated ++;
338 stats_n_packets += 1;
339 stats_n_bytes += len0;
345 stats_n_packets -= 1;
346 stats_n_bytes -= len0;
350 thread_index, stats_sw_if_index,
351 stats_n_packets, stats_n_bytes);
353 stats_n_bytes = len0;
354 stats_sw_if_index = sw_if_index0;
358 b0->
error = error0 ?
node->errors[error0] : 0;
370 to_next, n_left_to_next,
378 PPPOE_ERROR_DECAPSULATED,
386 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
387 node->runtime_data[0] = stats_sw_if_index;
390 return from_frame->n_vectors;
393 #ifndef CLIB_MARCH_VARIANT 395 #define pppoe_error(n,s) s, 403 .name =
"pppoe-input",
405 .vector_size =
sizeof (
u32),
412 #define _(s,n) [PPPOE_INPUT_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.
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)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
struct pppoe_entry_result_t::@680::@682 fields
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
#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.
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.