X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fadj%2Fadj.c;h=c601e6bd19dd02f300dc6199007f2c0feafc5bc4;hb=ae9c45938bdf6e180f83f02aed31113e60db20a9;hp=3ca3d6015f9bab4247e109bbcdf4cb9d861e7b27;hpb=8f215b4a03a98bf94931a09b23ab0fbd8ccd1ab9;p=vpp.git diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c index 3ca3d6015f9..c601e6bd19d 100644 --- a/src/vnet/adj/adj.c +++ b/src/vnet/adj/adj.c @@ -139,6 +139,10 @@ format_ip_adjacency (u8 * s, va_list * args) adj_index = va_arg (*args, u32); fiaf = va_arg (*args, format_ip_adjacency_flags_t); + + if (!adj_is_valid(adj_index)) + return format(s, ""); + adj = adj_get(adj_index); switch (adj->lookup_next_index) @@ -178,8 +182,8 @@ format_ip_adjacency (u8 * s, va_list * args) s = format (s, "\n flags:%U", format_adj_flags, adj->ia_flags); s = format (s, "\n counts:[%Ld:%Ld]", counts.packets, counts.bytes); s = format (s, "\n locks:%d", adj->ia_node.fn_locks); - s = format(s, "\n delegates:\n "); - adj_delegate_format(s, adj); + s = format(s, "\n delegates:"); + s = adj_delegate_format(s, adj); s = format(s, "\n children:"); if (fib_node_list_get_size(adj->ia_node.fn_children)) @@ -213,7 +217,7 @@ adj_recursive_loop_detect (adj_index_t ai, case IP_LOOKUP_NEXT_ICMP_ERROR: case IP_LOOKUP_N_NEXT: /* - * these adjcencey types are terminal graph nodes, so there's no + * these adjacency types are terminal graph nodes, so there's no * possibility of a loop down here. */ break; @@ -245,7 +249,7 @@ adj_last_lock_gone (ip_adjacency_t *adj) switch (adj->lookup_next_index) { case IP_LOOKUP_NEXT_MIDCHAIN: - dpo_reset(&adj->sub_type.midchain.next_dpo); + adj_midchain_teardown(adj); /* FALL THROUGH */ case IP_LOOKUP_NEXT_ARP: case IP_LOOKUP_NEXT_REWRITE: @@ -263,8 +267,10 @@ adj_last_lock_gone (ip_adjacency_t *adj) adj_glean_remove(adj->ia_nh_proto, adj->rewrite_header.sw_if_index); break; - case IP_LOOKUP_NEXT_MCAST: case IP_LOOKUP_NEXT_MCAST_MIDCHAIN: + adj_midchain_teardown(adj); + /* FALL THROUGH */ + case IP_LOOKUP_NEXT_MCAST: adj_mcast_remove(adj->ia_nh_proto, adj->rewrite_header.sw_if_index); break; @@ -365,7 +371,7 @@ adj_child_remove (adj_index_t adj_index, } /* - * Context for the walk to update the cached feture flags. + * Context for the walk to update the cached feature flags. */ typedef struct adj_feature_update_t_ { @@ -401,10 +407,11 @@ adj_feature_update_walk_cb (adj_index_t ai, return (ADJ_WALK_RC_CONTINUE); } -void +static void adj_feature_update (u32 sw_if_index, u8 arc_index, - u8 is_enable) + u8 is_enable, + void *data) { /* * Walk all the adjacencies on the interface to update the cached @@ -537,10 +544,32 @@ static fib_node_back_walk_rc_t adj_back_walk_notify (fib_node_t *node, fib_node_back_walk_ctx_t *ctx) { - /* - * Que pasa. yo soj en el final! - */ - ASSERT(0); + ip_adjacency_t *adj; + + adj = ADJ_FROM_NODE(node); + + switch (adj->lookup_next_index) + { + case IP_LOOKUP_NEXT_MIDCHAIN: + adj_midchain_delegate_restack(adj_get_index(adj)); + break; + case IP_LOOKUP_NEXT_ARP: + case IP_LOOKUP_NEXT_REWRITE: + case IP_LOOKUP_NEXT_BCAST: + case IP_LOOKUP_NEXT_GLEAN: + case IP_LOOKUP_NEXT_MCAST: + case IP_LOOKUP_NEXT_MCAST_MIDCHAIN: + case IP_LOOKUP_NEXT_DROP: + case IP_LOOKUP_NEXT_PUNT: + case IP_LOOKUP_NEXT_LOCAL: + case IP_LOOKUP_NEXT_ICMP_ERROR: + case IP_LOOKUP_N_NEXT: + /* + * Que pasa. yo soj en el final! + */ + ASSERT(0); + break; + } return (FIB_NODE_BACK_WALK_CONTINUE); } @@ -564,6 +593,8 @@ adj_module_init (vlib_main_t * vm) adj_midchain_module_init(); adj_mcast_module_init(); + vnet_feature_register(adj_feature_update, NULL); + return (NULL); } @@ -582,9 +613,7 @@ adj_show (vlib_main_t * vm, { if (unformat (input, "%d", &ai)) ; - else if (unformat (input, "sum")) - summary = 1; - else if (unformat (input, "summary")) + else if (unformat (input, "summary") || unformat (input, "sum")) summary = 1; else if (unformat (input, "%U", unformat_vnet_sw_interface, vnet_get_main(), @@ -693,8 +722,8 @@ adj_cli_counters_set (vlib_main_t * vm, } /*? - * Enabe/disble per-adjacency counters. This is optional because it comes with - * a non-negligible performance cost. + * Enable/disable per-adjacency counters. This is optional because it comes + * with a non-negligible performance cost. ?*/ VLIB_CLI_COMMAND (adj_cli_counters_set_command, static) = { .path = "adjacency counters",