X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface.c;h=b07a9ba755314692dc4056a23d9a520ef5d4de68;hb=fe7d4a2;hp=b197aa1e0737c75587465dcbcbc74c6939da9f6f;hpb=c819fc612f9a79eaba2981dc2e8f7c31552db5ea;p=vpp.git diff --git a/src/vnet/interface.c b/src/vnet/interface.c index b197aa1e073..b07a9ba7553 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -1237,7 +1237,19 @@ vnet_interface_init (vlib_main_t * vm) vec_validate (im->combined_sw_if_counters, VNET_N_COMBINED_INTERFACE_COUNTER - 1); im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX].name = "rx"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_UNICAST].name = + "rx-unicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_MULTICAST].name = + "rx-multicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_RX_BROADCAST].name = + "rx-broadcast"; im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX].name = "tx"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_UNICAST].name = + "tx-unicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_MULTICAST].name = + "tx-multicast"; + im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_TX_BROADCAST].name = + "tx-broadcast"; im->sw_if_counter_lock[0] = 0; @@ -1414,6 +1426,51 @@ vnet_hw_interface_change_mac_address (vnet_main_t * vnm, u32 hw_if_index, (vnm, hw_if_index, mac_address); } +/* update the unnumbered state of an interface*/ +void +vnet_sw_interface_update_unnumbered (u32 unnumbered_sw_if_index, + u32 ip_sw_if_index, u8 enable) +{ + vnet_main_t *vnm = vnet_get_main (); + vnet_sw_interface_t *si; + u32 was_unnum; + + si = vnet_get_sw_interface (vnm, unnumbered_sw_if_index); + was_unnum = (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED); + + if (enable) + { + si->flags |= VNET_SW_INTERFACE_FLAG_UNNUMBERED; + si->unnumbered_sw_if_index = ip_sw_if_index; + + ip4_main.lookup_main.if_address_pool_index_by_sw_if_index + [unnumbered_sw_if_index] = + ip4_main. + lookup_main.if_address_pool_index_by_sw_if_index[ip_sw_if_index]; + ip6_main. + lookup_main.if_address_pool_index_by_sw_if_index + [unnumbered_sw_if_index] = + ip6_main. + lookup_main.if_address_pool_index_by_sw_if_index[ip_sw_if_index]; + } + else + { + si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED); + si->unnumbered_sw_if_index = (u32) ~ 0; + + ip4_main.lookup_main.if_address_pool_index_by_sw_if_index + [unnumbered_sw_if_index] = ~0; + ip6_main.lookup_main.if_address_pool_index_by_sw_if_index + [unnumbered_sw_if_index] = ~0; + } + + if (was_unnum != (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED)) + { + ip4_sw_interface_enable_disable (unnumbered_sw_if_index, enable); + ip6_sw_interface_enable_disable (unnumbered_sw_if_index, enable); + } +} + vnet_l3_packet_type_t vnet_link_to_l3_proto (vnet_link_t link) { @@ -1492,6 +1549,60 @@ default_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai) } } +int collect_detailed_interface_stats_flag = 0; + +void +collect_detailed_interface_stats_flag_set (void) +{ + collect_detailed_interface_stats_flag = 1; +} + +void +collect_detailed_interface_stats_flag_clear (void) +{ + collect_detailed_interface_stats_flag = 0; +} + +static clib_error_t * +collect_detailed_interface_stats_cli (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + unformat_input_t _line_input, *line_input = &_line_input; + clib_error_t *error = NULL; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return clib_error_return (0, "expected enable | disable"); + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "enable") || unformat (line_input, "on")) + collect_detailed_interface_stats_flag_set (); + else if (unformat (line_input, "disable") + || unformat (line_input, "off")) + collect_detailed_interface_stats_flag_clear (); + else + { + error = clib_error_return (0, "unknown input `%U'", + format_unformat_error, line_input); + goto done; + } + } + +done: + unformat_free (line_input); + return error; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (collect_detailed_interface_stats_command, static) = { + .path = "interface collect detailed-stats", + .short_help = "interface collect detailed-stats ", + .function = collect_detailed_interface_stats_cli, +}; +/* *INDENT-ON* */ + /* * fd.io coding-style-patch-verification: ON *