20 #include <vnet/devices/pci/ixgev.h> 21 #include <vnet/devices/pci/ixge.h> 22 #include <vnet/devices/pci/ige.h> 23 #include <vnet/devices/pci/vice.h> 35 #define foreach_l2t_ip6_error \ 36 _(USER_TO_NETWORK, "User (v6) to L2 network pkts") \ 37 _(SESSION_ID_MISMATCH, "l2tpv3 local session id mismatches") \ 38 _(COOKIE_MISMATCH, "l2tpv3 local cookie mismatches") 41 #define _(sym,string) string, 48 #define _(sym,str) L2T_IP6_ERROR_##sym, 108 l2t = (l2tpv3_header_t *) (ip6 + 1);
122 session_index = p[0];
127 vnet_buffer (b)->l2t.session_index = session_index;
144 l2tpv3_header_t *l2t;
148 u16 payload_ethertype;
149 u8 dst_mac_address[6];
150 u8 src_mac_address[6];
157 em->
counters[node_counter_base_index + L2T_IP6_ERROR_USER_TO_NETWORK] += 1;
180 lm->ip6_error_node->errors[L2T_IP6_ERROR_SESSION_ID_MISMATCH];
186 && (l2t->cookie == session->lcl_ro_cookie)))))
188 b->
error = lm->ip6_error_node->errors[L2T_IP6_ERROR_COOKIE_MISMATCH];
202 payload_ethertype = l2_payload->
type;
205 #define _(i) dst_mac_address[i] = l2_payload->dst_address[i]; 206 _(0) _(1) _(2) _(3) _(4) _(5);
208 #define _(i) src_mac_address[i] = l2_payload->src_address[i]; 209 _(0) _(1) _(2) _(3) _(4) _(5);
217 #define _(i) l2_payload->dst_address[i] = dst_mac_address[i]; 218 _(0) _(1) _(2) _(3) _(4) _(5);
220 #define _(i) l2_payload->src_address[i] = src_mac_address[i]; 221 _(0) _(1) _(2) _(3) _(4) _(5);
224 l2_payload->
type = clib_host_to_net_u16 (0x8100);
225 vlan_header_pos = (
u8 *) (l2_payload + 1);
228 vlan_header_pos : vlan_header_pos - 4;
232 vh->
type = payload_ethertype;
243 t->vlan_id_host_byte_order = clib_net_to_host_u16 (session->vlan_id);
246 return session->l2_output_next_index;
258 return dispatch_pipeline (vm, node, frame);
264 .name =
"ip6-l2t-input",
265 .vector_size =
sizeof (
u32),
290 if (
unformat (input,
"lookup-v6-src"))
292 else if (
unformat (input,
"lookup-v6-dst"))
294 else if (
unformat (input,
"lookup-session-id"))
325 vice_set_next_node (VICE_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
326 ixgev_set_next_node (IXGEV_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
328 ige_set_next_node (IGE_RX_NEXT_IP6_INPUT,
"ip6-l2t-input");
VLIB_NODE_FUNCTION_MULTIARCH(sw6_ip6_node, ip6_l2t_node_fn)
ip6_address_t client_address
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vlib_node_registration_t l2t_ip6_node
uword * session_by_session_id
struct _vlib_node_registration vlib_node_registration_t
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static u32 session_index_to_counter_index(u32 session_index, u32 counter_id)
#define foreach_l2t_ip6_error
clib_error_t * l2t_ip6_init(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
static char * l2t_ip6_error_strings[]
#define VLIB_INIT_FUNCTION(x)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
void dpdk_set_next_node(dpdk_rx_next_t, char *)
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
#define hash_create_mem(elts, key_bytes, value_bytes)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_error_main_t error_main
u8 * format_l2t_trace(u8 *s, va_list *args)
#define VLIB_CONFIG_FUNCTION(x, n,...)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
ip6_to_l2_lookup_t lookup_type
static void stage1(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
static void stage0(vlib_main_t *vm, vlib_node_runtime_t *node, u32 buffer_index)
ip6_address_t our_address
static clib_error_t * l2tp_config(vlib_main_t *vm, unformat_input_t *input)
#define CLIB_PREFETCH(addr, size, type)
static u32 last_stage(vlib_main_t *vm, vlib_node_runtime_t *node, u32 bi)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static vlib_node_registration_t sw6_ip6_node
(constructor) VLIB_REGISTER_NODE (sw6_ip6_node)
#define hash_create(elts, value_bytes)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u32 packet_increment, u32 byte_increment)
Increment a combined counter.
static uword ip6_l2t_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
uword * session_by_dst_address
#define VLIB_BUFFER_IS_TRACED
vlib_combined_counter_main_t counter_main
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
void ixge_set_next_node(ixge_rx_next_t next, char *name)
#define hash_get_mem(h, key)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define clib_error_return(e, args...)
uword * session_by_src_address
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: 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.