#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h> /* for ethernet_header_t */
#include <vnet/classify/vnet_classify.h>
+#include <vnet/dpo/classify_dpo.h>
typedef struct {
u32 next_index;
u32 n_left_from, * from, * to_next;
ip_lookup_next_t next_index;
vnet_classify_main_t * vcm = &vnet_classify_main;
- ip_lookup_main_t * lm;
f64 now = vlib_time_now (vm);
u32 hits = 0;
u32 misses = 0;
u32 chain_hits = 0;
+ u32 n_next;
- if (is_ip4)
- lm = &ip4_main.lookup_main;
- else
- lm = &ip6_main.lookup_main;
+ if (is_ip4) {
+ n_next = IP4_LOOKUP_N_NEXT;
+ } else {
+ n_next = IP6_LOOKUP_N_NEXT;
+ }
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
vlib_buffer_t * b0, * b1;
u32 bi0, bi1;
u8 * h0, * h1;
- u32 adj_index0, adj_index1;
- ip_adjacency_t * adj0, * adj1;
+ u32 cd_index0, cd_index1;
+ classify_dpo_t *cd0, * cd1;
u32 table_index0, table_index1;
vnet_classify_table_t * t0, * t1;
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);
- table_index0 = adj0->classify.table_index;
+ cd_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
+ cd0 = classify_dpo_get(cd_index0);
+ table_index0 = cd0->cd_table_index;
- adj_index1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX];
- adj1 = ip_get_adjacency (lm, adj_index1);
- table_index1 = adj1->classify.table_index;
+ cd_index1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX];
+ cd1 = classify_dpo_get(cd_index1);
+ table_index1 = cd1->cd_table_index;
t0 = pool_elt_at_index (vcm->tables, table_index0);
vlib_buffer_t * b0;
u32 bi0;
u8 * h0;
- u32 adj_index0;
- ip_adjacency_t * adj0;
+ u32 cd_index0;
+ classify_dpo_t *cd0;
u32 table_index0;
vnet_classify_table_t * t0;
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);
- table_index0 = adj0->classify.table_index;
+ cd_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
+ cd0 = classify_dpo_get(cd_index0);
+ table_index0 = cd0->cd_table_index;
t0 = pool_elt_at_index (vcm->tables, table_index0);
vnet_buffer(b0)->l2_classify.hash =
{
u32 bi0;
vlib_buffer_t * b0;
- u32 next0 = IP_LOOKUP_NEXT_MISS;
+ u32 next0 = IP_LOOKUP_NEXT_DROP;
u32 table_index0;
vnet_classify_table_t * t0;
vnet_classify_entry_t * e0;
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;
}
.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 = IP4_LOOKUP_NEXT_NODES,
+ .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 = IP6_LOOKUP_NEXT_NODES,
+ .n_next_nodes = 0,
};
+VLIB_NODE_FUNCTION_MULTIARCH (ip6_classify_node, ip6_classify)
+
static clib_error_t *
ip_classify_init (vlib_main_t * vm)
{