X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fmpls%2Fmpls_lookup.c;h=56492f1368ad34bea043c55e173c5fe3260c05d6;hb=744da656d3442bb812f50d6e8746f0f11adee8b3;hp=4b8a3eef13b6cb1c63ba706c7adf7b1829b108c9;hpb=f12a83f54ff2239d70494d577af3e1bb253692e1;p=vpp.git diff --git a/src/vnet/mpls/mpls_lookup.c b/src/vnet/mpls/mpls_lookup.c index 4b8a3eef13b..56492f1368a 100644 --- a/src/vnet/mpls/mpls_lookup.c +++ b/src/vnet/mpls/mpls_lookup.c @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ static vlib_node_registration_t mpls_lookup_node; /** * The arc/edge from the MPLS lookup node to the MPLS replicate node */ -static u32 mpls_lookup_to_replicate_edge; +u32 mpls_lookup_to_replicate_edge; typedef struct { u32 next_index; @@ -47,34 +47,16 @@ format_mpls_lookup_trace (u8 * s, va_list * args) CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); mpls_lookup_trace_t * t = va_arg (*args, mpls_lookup_trace_t *); - s = format (s, "MPLS: next [%d], lookup fib index %d, LB index %d hash %#x " + s = format (s, "MPLS: next [%d], lookup fib index %d, LB index %d hash %x " "label %d eos %d", t->next_index, t->lfib_index, t->lb_index, t->hash, vnet_mpls_uc_get_label( clib_net_to_host_u32(t->label_net_byte_order)), - vnet_mpls_uc_get_s(t->label_net_byte_order)); + vnet_mpls_uc_get_s( + clib_net_to_host_u32(t->label_net_byte_order))); return s; } -/* - * Compute flow hash. - * We'll use it to select which adjacency to use for this flow. And other things. - */ -always_inline u32 -mpls_compute_flow_hash (const mpls_unicast_header_t * hdr, - flow_hash_config_t flow_hash_config) -{ - /* - * improve this to include: - * - all labels in the stack. - * - recognise entropy labels. - * - * We need to byte swap so we use the numerical value. i.e. an odd label - * leads to an odd bucket. ass opposed to a label above and below value X. - */ - return (vnet_mpls_uc_get_label(clib_net_to_host_u32(hdr->label_exp_s_ttl))); -} - static inline uword mpls_lookup (vlib_main_t * vm, vlib_node_runtime_t * node, @@ -121,22 +103,22 @@ mpls_lookup (vlib_main_t * vm, /* Prefetch next iteration. */ { - vlib_buffer_t * p2, * p3, *p4, *p5; + vlib_buffer_t *p4, *p5, *p6, *p7; - p2 = vlib_get_buffer (vm, from[2]); - p3 = vlib_get_buffer (vm, from[3]); p4 = vlib_get_buffer (vm, from[4]); p5 = vlib_get_buffer (vm, from[5]); + p6 = vlib_get_buffer (vm, from[6]); + p7 = vlib_get_buffer (vm, from[7]); - vlib_prefetch_buffer_header (p2, STORE); - vlib_prefetch_buffer_header (p3, STORE); vlib_prefetch_buffer_header (p4, STORE); vlib_prefetch_buffer_header (p5, STORE); + vlib_prefetch_buffer_header (p6, STORE); + vlib_prefetch_buffer_header (p7, STORE); - CLIB_PREFETCH (p2->data, sizeof (h0[0]), STORE); - CLIB_PREFETCH (p3->data, sizeof (h0[0]), STORE); - CLIB_PREFETCH (p4->data, sizeof (h0[0]), STORE); - CLIB_PREFETCH (p5->data, sizeof (h0[0]), STORE); + CLIB_PREFETCH (p4->data, sizeof (h0[0]), LOAD); + CLIB_PREFETCH (p5->data, sizeof (h0[0]), LOAD); + CLIB_PREFETCH (p6->data, sizeof (h0[0]), LOAD); + CLIB_PREFETCH (p7->data, sizeof (h0[0]), LOAD); } bi0 = to_next[0] = from[0]; @@ -518,7 +500,7 @@ format_mpls_load_balance_trace (u8 * s, va_list * args) return s; } -always_inline uword +static uword mpls_load_balance (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) @@ -556,8 +538,8 @@ mpls_load_balance (vlib_main_t * vm, vlib_prefetch_buffer_header (p2, STORE); vlib_prefetch_buffer_header (p3, STORE); - CLIB_PREFETCH (p2->data, sizeof (mpls0[0]), STORE); - CLIB_PREFETCH (p3->data, sizeof (mpls0[0]), STORE); + CLIB_PREFETCH (p2->data, sizeof (mpls0[0]), LOAD); + CLIB_PREFETCH (p3->data, sizeof (mpls0[0]), LOAD); } pi0 = to_next[0] = from[0]; @@ -714,7 +696,7 @@ VLIB_REGISTER_NODE (mpls_load_balance_node) = { .n_next_nodes = 1, .next_nodes = { - [0] = "mpls-drop", + [MPLS_LOOKUP_NEXT_DROP] = "mpls-drop", }, };