u32 hits = 0;
u32 misses = 0;
u32 chain_hits = 0;
+ u32 n_next;
- if (is_ip4)
+ if (is_ip4) {
lm = &ip4_main.lookup_main;
- else
+ n_next = IP4_LOOKUP_N_NEXT;
+ } else {
lm = &ip6_main.lookup_main;
+ n_next = IP6_LOOKUP_N_NEXT;
+ }
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
bi0 = from[0];
b0 = vlib_get_buffer (vm, bi0);
- h0 = b0->data;
+ h0 = (void *)vlib_buffer_get_current(b0) -
+ ethernet_buffer_header_size(b0);
bi1 = from[1];
b1 = vlib_get_buffer (vm, bi1);
- h1 = b1->data;
+ h1 = (void *)vlib_buffer_get_current(b1) -
+ ethernet_buffer_header_size(b1);
adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
adj0 = ip_get_adjacency (lm, adj_index0);
bi0 = from[0];
b0 = vlib_get_buffer (vm, bi0);
- h0 = b0->data;
+ h0 = (void *)vlib_buffer_get_current(b0) -
+ ethernet_buffer_header_size(b0);
adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
adj0 = ip_get_adjacency (lm, adj_index0);
vnet_buffer(b0)->l2_classify.opaque_index
= e0->opaque_index;
vlib_buffer_advance (b0, e0->advance);
- next0 = (e0->next_index < IP_LOOKUP_N_NEXT)?
+ next0 = (e0->next_index < node->n_next_nodes)?
e0->next_index:next0;
hits++;
}
t0->next_table_index);
else
{
- next0 = (t0->miss_next_index < IP_LOOKUP_N_NEXT)?
- t0->miss_next_index:next0;
+ next0 = (t0->miss_next_index < n_next) ?
+ t0->miss_next_index : next0;
misses++;
break;
}
vnet_buffer(b0)->l2_classify.opaque_index
= e0->opaque_index;
vlib_buffer_advance (b0, e0->advance);
- next0 = (e0->next_index < IP_LOOKUP_N_NEXT)?
+ next0 = (e0->next_index < node->n_next_nodes)?
e0->next_index:next0;
hits++;
chain_hits++;
.function = ip4_classify,
.name = "ip4-classify",
.vector_size = sizeof (u32),
+ .sibling_of = "ip4-lookup",
.format_trace = format_ip_classify_trace,
.n_errors = ARRAY_LEN(ip_classify_error_strings),
.error_strings = ip_classify_error_strings,
- .n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [IP_LOOKUP_NEXT_DROP] = "ip4-drop",
- [IP_LOOKUP_NEXT_PUNT] = "ip4-punt",
- [IP_LOOKUP_NEXT_LOCAL] = "ip4-local",
- [IP_LOOKUP_NEXT_ARP] = "ip4-arp",
- [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", /* probably not... */
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .n_next_nodes = 0,
};
+VLIB_NODE_FUNCTION_MULTIARCH (ip4_classify_node, ip4_classify)
+
static uword
ip6_classify (vlib_main_t * vm,
vlib_node_runtime_t * node,
.function = ip6_classify,
.name = "ip6-classify",
.vector_size = sizeof (u32),
+ .sibling_of = "ip6-lookup",
.format_trace = format_ip_classify_trace,
.n_errors = ARRAY_LEN(ip_classify_error_strings),
.error_strings = ip_classify_error_strings,
- .n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [IP_LOOKUP_NEXT_DROP] = "ip6-drop",
- [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",
- [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",
- [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",
- [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", /* probably not... */
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .n_next_nodes = 0,
};
+VLIB_NODE_FUNCTION_MULTIARCH (ip6_classify_node, ip6_classify)
+
static clib_error_t *
ip_classify_init (vlib_main_t * vm)
{