*/
typedef struct
{
-
- /* Next nodes for features and output interfaces */
- l2_output_next_nodes_st next_nodes;
+ /* Next nodes for L2 output features */
+ u32 l2_out_feat_next[32];
/* convenience variables */
vlib_main_t *vlib_main;
vlib_node_t *n = vlib_get_node (vm, l2_efp_filter_node.index);
u32 node_counter_base_index = n->error_heap_index;
vlib_error_main_t *em = &vm->error_main;
- u32 cached_sw_if_index = ~0;
- u32 cached_next_index = ~0;
-
- /* invalidate cache to begin with */
- cached_sw_if_index = ~0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors; /* number of packets to process */
vlib_buffer_t *b0, *b1;
u32 next0, next1;
u32 sw_if_index0, sw_if_index1;
- u32 feature_bitmap0, feature_bitmap1;
u16 first_ethertype0, first_ethertype1;
u16 outer_id0, inner_id0, outer_id1, inner_id1;
u32 match_flags0, match_flags1;
em->counters[node_counter_base_index +
L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 2;
- /* Remove ourself from the feature bitmap */
- feature_bitmap0 =
- vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
- feature_bitmap1 =
- vnet_buffer (b1)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
-
/* Determine next node */
- l2_output_dispatch (msm->vlib_main,
- msm->vnet_main,
- node,
- l2_efp_filter_node.index,
- &cached_sw_if_index,
- &cached_next_index,
- &msm->next_nodes,
- b0, sw_if_index0, feature_bitmap0, &next0);
- l2_output_dispatch (msm->vlib_main,
- msm->vnet_main,
- node,
- l2_efp_filter_node.index,
- &cached_sw_if_index,
- &cached_next_index,
- &msm->next_nodes,
- b1, sw_if_index1, feature_bitmap1, &next1);
+ next0 = vnet_l2_feature_next (b0, msm->l2_out_feat_next,
+ L2OUTPUT_FEAT_EFP_FILTER);
+ next1 = vnet_l2_feature_next (b1, msm->l2_out_feat_next,
+ L2OUTPUT_FEAT_EFP_FILTER);
/* perform the efp filter check on two packets */
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
+ clib_memcpy_fast (t->src, h0->src_address, 6);
+ clib_memcpy_fast (t->dst, h0->dst_address, 6);
+ clib_memcpy_fast (t->raw, &h0->type, sizeof (t->raw));
}
if (b1->flags & VLIB_BUFFER_IS_TRACED)
{
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b1, sizeof (*t));
t->sw_if_index = sw_if_index1;
- clib_memcpy (t->src, h1->src_address, 6);
- clib_memcpy (t->dst, h1->dst_address, 6);
- clib_memcpy (t->raw, &h1->type, sizeof (t->raw));
+ clib_memcpy_fast (t->src, h1->src_address, 6);
+ clib_memcpy_fast (t->dst, h1->dst_address, 6);
+ clib_memcpy_fast (t->raw, &h1->type, sizeof (t->raw));
}
}
vlib_buffer_t *b0;
u32 next0;
u32 sw_if_index0;
- u32 feature_bitmap0;
u16 first_ethertype0;
u16 outer_id0, inner_id0;
u32 match_flags0;
em->counters[node_counter_base_index +
L2_EFP_FILTER_ERROR_L2_EFP_FILTER] += 1;
- /* Remove ourself from the feature bitmap */
- feature_bitmap0 =
- vnet_buffer (b0)->l2.feature_bitmap & ~L2OUTPUT_FEAT_EFP_FILTER;
-
/* Determine next node */
- l2_output_dispatch (msm->vlib_main,
- msm->vnet_main,
- node,
- l2_efp_filter_node.index,
- &cached_sw_if_index,
- &cached_next_index,
- &msm->next_nodes,
- b0, sw_if_index0, feature_bitmap0, &next0);
+ next0 = vnet_l2_feature_next (b0, msm->l2_out_feat_next,
+ L2OUTPUT_FEAT_EFP_FILTER);
/* perform the efp filter check on one packet */
l2_efp_filter_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
t->sw_if_index = sw_if_index0;
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- clib_memcpy (t->raw, &h0->type, sizeof (t->raw));
+ clib_memcpy_fast (t->src, h0->src_address, 6);
+ clib_memcpy_fast (t->dst, h0->dst_address, 6);
+ clib_memcpy_fast (t->raw, &h0->type, sizeof (t->raw));
}
/* verify speculative enqueue, maybe switch current next frame */
l2_efp_filter_node.index,
L2OUTPUT_N_FEAT,
l2output_get_feat_names (),
- mp->next_nodes.feat_next_node_index);
+ mp->l2_out_feat_next);
return 0;
}
/** Enable/disable the EFP Filter check on the subinterface. */
void
-l2_efp_filter_configure (vnet_main_t * vnet_main, u32 sw_if_index, u32 enable)
+l2_efp_filter_configure (vnet_main_t * vnet_main, u32 sw_if_index, u8 enable)
{
/* set the interface flag */
l2output_intf_bitmap_enable (sw_if_index, L2OUTPUT_FEAT_EFP_FILTER, enable);