24 #define foreach_pppoe_tap_next \ 25 _(DROP, "error-drop") \ 26 _(TUNTAP, "tuntap-tx" ) \ 27 _(INTERFACE, "interface-output" ) \ 31 #define _(s,n) PPPOE_TAP_NEXT_##s, 55 s =
format (s,
"PPPoE dispatch from sw_if_index %d next %d error %d \n" 56 " pppoe_code 0x%x ppp_proto 0x%x",
62 s =
format (s,
"PPPoE dispatch from tap_if_index %d next %d error %d \n" 63 " pppoe_code 0x%x ppp_proto 0x%x",
91 else if (result0->
fields.sw_if_index == ~0)
94 result0->
fields.sw_if_index = sw_if_index0;
95 result0->
fields.session_index = ~0;
101 result0->
fields.sw_if_index = sw_if_index0;
105 BVT (clib_bihash_kv) kv;
107 kv.value = result0->
raw;
116 u32 n_left_from, next_index, * from, * to_next;
120 u32 pkts_decapsulated = 0;
122 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
131 cached_result.
raw = ~0;
135 stats_n_packets = stats_n_bytes = 0;
137 while (n_left_from > 0)
142 to_next, n_left_to_next);
144 while (n_left_from > 0 && n_left_to_next > 0)
156 u32 rx_sw_if_index0=~0, tx_sw_if_index0=~0, len0;
174 error0 = PPPOE_ERROR_BAD_VER_TYPE;
175 next0 = PPPOE_INPUT_NEXT_DROP;
186 &key0, &bucket0, &result0);
187 tx_sw_if_index0 = result0.
fields.sw_if_index;
191 error0 = PPPOE_ERROR_NO_SUCH_SESSION;
192 next0 = PPPOE_INPUT_NEXT_DROP;
196 next0 = PPPOE_TAP_NEXT_INTERFACE;
208 &key0, &bucket0, &result0);
209 tx_sw_if_index0 = result0.
fields.sw_if_index;
216 next0 = PPPOE_TAP_NEXT_TUNTAP;
222 pkts_decapsulated ++;
223 stats_n_packets += 1;
224 stats_n_bytes += len0;
230 stats_n_packets -= 1;
231 stats_n_bytes -= len0;
235 thread_index, stats_sw_if_index,
236 stats_n_packets, stats_n_bytes);
238 stats_n_bytes = len0;
239 stats_sw_if_index = rx_sw_if_index0;
257 to_next, n_left_to_next,
265 PPPOE_ERROR_DECAPSULATED,
273 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
282 .name =
"pppoe-tap-dispatch",
284 .vector_size =
sizeof (
u32),
288 #define _(s,n) [PPPOE_TAP_NEXT_##s] = n, static uword pppoe_tap_dispatch(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static_always_inline void pppoe_learn_process(vlib_node_runtime_t *node, pppoe_main_t *pem, vlib_buffer_t *b0, 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.
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.
vnet_interface_main_t interface_main
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
struct pppoe_entry_result_t::@367::@369 fields
struct _vlib_node_registration vlib_node_registration_t
static_always_inline void pppoe_lookup_1(BVT(clib_bihash)*session_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)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
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 u8 * format_pppoe_tap_trace(u8 *s, va_list *args)
#define foreach_pppoe_tap_next
#define static_always_inline
int clib_bihash_add_del(clib_bihash *h, clib_bihash_kv *add_v, int is_add)
Add or delete a (key,value) pair from a bi-hash table.
vlib_combined_counter_main_t * combined_sw_if_counters
vlib_node_registration_t pppoe_tap_dispatch_node
(constructor) VLIB_REGISTER_NODE (pppoe_tap_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).
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)
static_always_inline uword vlib_get_thread_index(void)
vlib_node_registration_t pppoe_input_node
(constructor) VLIB_REGISTER_NODE (pppoe_input_node)
#define VLIB_BUFFER_IS_TRACED
#define clib_memcpy(a, b, c)
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.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
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.
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define VLIB_REGISTER_NODE(x,...)
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.