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",
54 u32 n_left_from, next_index, * from, * to_next;
58 u32 pkts_decapsulated = 0;
60 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
69 cached_result.
raw = ~0;
73 stats_n_packets = stats_n_bytes = 0;
75 while (n_left_from > 0)
80 to_next, n_left_to_next);
81 while (n_left_from >= 4 && n_left_to_next >= 2)
88 u16 ppp_proto0 = 0, ppp_proto1 = 0;
91 u32 sw_if_index0, sw_if_index1, len0, len1;
127 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
128 ppp_proto1 = clib_net_to_host_u16(pppoe1->
ppp_proto);
131 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
132 && (ppp_proto0 != PPP_PROTOCOL_ip6))
134 error0 = PPPOE_ERROR_CONTROL_PLANE;
135 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
145 &key0, &bucket0, &result0);
148 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
149 next0 = PPPOE_INPUT_NEXT_DROP;
154 result0.
fields.session_index);
159 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
160 PPPOE_INPUT_NEXT_IP4_INPUT
161 : PPPOE_INPUT_NEXT_IP6_INPUT;
166 pkts_decapsulated ++;
167 stats_n_packets += 1;
168 stats_n_bytes += len0;
174 stats_n_packets -= 1;
175 stats_n_bytes -= len0;
179 thread_index, stats_sw_if_index,
180 stats_n_packets, stats_n_bytes);
182 stats_n_bytes = len0;
183 stats_sw_if_index = sw_if_index0;
201 if ((ppp_proto1 != PPP_PROTOCOL_ip4)
202 && (ppp_proto1 != PPP_PROTOCOL_ip6))
204 error1 = PPPOE_ERROR_CONTROL_PLANE;
205 next1 = PPPOE_INPUT_NEXT_CP_INPUT;
215 &key1, &bucket1, &result1);
218 error1 = PPPOE_ERROR_NO_SUCH_SESSION;
219 next1 = PPPOE_INPUT_NEXT_DROP;
224 result1.
fields.session_index);
229 next1 = (ppp_proto1==PPP_PROTOCOL_ip4)?
230 PPPOE_INPUT_NEXT_IP4_INPUT
231 : PPPOE_INPUT_NEXT_IP6_INPUT;
236 pkts_decapsulated ++;
237 stats_n_packets += 1;
238 stats_n_bytes += len1;
244 stats_n_packets -= 1;
245 stats_n_bytes -= len1;
249 thread_index, stats_sw_if_index,
250 stats_n_packets, stats_n_bytes);
252 stats_n_bytes = len1;
253 stats_sw_if_index = sw_if_index1;
270 to_next, n_left_to_next,
271 bi0, bi1, next0, next1);
274 while (n_left_from > 0 && n_left_to_next > 0)
284 u32 sw_if_index0, len0;
301 ppp_proto0 = clib_net_to_host_u16(pppoe0->
ppp_proto);
303 if ((ppp_proto0 != PPP_PROTOCOL_ip4)
304 && (ppp_proto0 != PPP_PROTOCOL_ip6))
306 error0 = PPPOE_ERROR_CONTROL_PLANE;
307 next0 = PPPOE_INPUT_NEXT_CP_INPUT;
317 &key0, &bucket0, &result0);
320 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
321 next0 = PPPOE_INPUT_NEXT_DROP;
326 result0.
fields.session_index);
331 next0 = (ppp_proto0==PPP_PROTOCOL_ip4)?
332 PPPOE_INPUT_NEXT_IP4_INPUT
333 : PPPOE_INPUT_NEXT_IP6_INPUT;
338 pkts_decapsulated ++;
339 stats_n_packets += 1;
340 stats_n_bytes += len0;
346 stats_n_packets -= 1;
347 stats_n_bytes -= len0;
351 thread_index, stats_sw_if_index,
352 stats_n_packets, stats_n_bytes);
354 stats_n_bytes = len0;
355 stats_sw_if_index = sw_if_index0;
371 to_next, n_left_to_next,
379 PPPOE_ERROR_DECAPSULATED,
387 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
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,
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.
u8 runtime_data[0]
Function dependent node-runtime data.
static u8 * format_pppoe_rx_trace(u8 *s, va_list *args)
vnet_interface_main_t interface_main
#define foreach_pppoe_input_next
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.
static uword pppoe_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static 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.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
struct pppoe_entry_result_t::@550::@552 fields
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).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
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
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
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)
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)
#define CLIB_CACHE_LINE_BYTES
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 vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.