X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface.c;h=1702cdc00d1387234373e336dc8964ab18b64c1a;hb=c87b66c86201458c0475d50c6e93f1497f9eec2e;hp=c882a8381b7f45fc0a4266d1482820989a7b04bd;hpb=b3a9381ad54ea30bf872cf781023e353a89ebaa6;p=vpp.git diff --git a/src/vnet/interface.c b/src/vnet/interface.c index c882a8381b7..1702cdc00d1 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -287,9 +287,6 @@ call_sw_interface_add_del_callbacks (vnet_main_t * vnm, u32 sw_if_index, (vnm, sw_if_index, is_create, vnm->sw_interface_add_del_functions); } -#define VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE (1 << 0) -#define VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE (1 << 1) - static clib_error_t * vnet_hw_interface_set_flags_helper (vnet_main_t * vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags, @@ -305,8 +302,7 @@ vnet_hw_interface_set_flags_helper (vnet_main_t * vnm, u32 hw_if_index, (helper_flags & VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE) != 0; mask = - (VNET_HW_INTERFACE_FLAG_LINK_UP | VNET_HW_INTERFACE_FLAG_DUPLEX_MASK | - VNET_HW_INTERFACE_FLAG_SPEED_MASK); + (VNET_HW_INTERFACE_FLAG_LINK_UP | VNET_HW_INTERFACE_FLAG_DUPLEX_MASK); flags &= mask; /* Call hardware interface add/del callbacks. */ @@ -519,6 +515,30 @@ vnet_sw_interface_set_flags (vnet_main_t * vnm, u32 sw_if_index, VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE); } +void +vnet_sw_interface_admin_up (vnet_main_t * vnm, u32 sw_if_index) +{ + u32 flags = vnet_sw_interface_get_flags (vnm, sw_if_index); + + if (!(flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)) + { + flags |= VNET_SW_INTERFACE_FLAG_ADMIN_UP; + vnet_sw_interface_set_flags (vnm, sw_if_index, flags); + } +} + +void +vnet_sw_interface_admin_down (vnet_main_t * vnm, u32 sw_if_index) +{ + u32 flags = vnet_sw_interface_get_flags (vnm, sw_if_index); + + if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) + { + flags &= ~(VNET_SW_INTERFACE_FLAG_ADMIN_UP); + vnet_sw_interface_set_flags (vnm, sw_if_index, flags); + } +} + static u32 vnet_create_sw_interface_no_callbacks (vnet_main_t * vnm, vnet_sw_interface_t * template) @@ -838,7 +858,7 @@ vnet_register_interface (vnet_main_t * vnm, /* The new class may differ from the old one. * Functions have to be updated. */ node = vlib_get_node (vm, hw->output_node_index); - node->function = vnet_interface_output_node_multiarch_select (); + node->function = vnet_interface_output_node; node->format_trace = format_vnet_interface_output_trace; /* *INDENT-OFF* */ foreach_vlib_main ({ @@ -888,13 +908,14 @@ vnet_register_interface (vnet_main_t * vnm, r.flags = 0; r.name = output_node_name; - r.function = vnet_interface_output_node_multiarch_select (); + r.function = vnet_interface_output_node; r.format_trace = format_vnet_interface_output_trace; { static char *e[] = { "interface is down", "interface is deleted", + "no buffers to segment GSO", }; r.n_errors = ARRAY_LEN (e); @@ -1329,6 +1350,11 @@ vnet_interface_init (vlib_main_t * vm) } } + im->gso_interface_count = 0; + /* init per-thread data */ + vec_validate_aligned (im->per_thread_data, vlib_num_workers (), + CLIB_CACHE_LINE_BYTES); + if ((error = vlib_call_init_function (vm, vnet_interface_cli_init))) return error; @@ -1413,7 +1439,7 @@ vnet_rename_interface (vnet_main_t * vnm, u32 hw_if_index, char *new_name) static clib_error_t * vnet_hw_interface_change_mac_address_helper (vnet_main_t * vnm, u32 hw_if_index, - u8 * mac_address) + const u8 * mac_address) { clib_error_t *error = 0; vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index); @@ -1458,7 +1484,7 @@ vnet_hw_interface_change_mac_address_helper (vnet_main_t * vnm, clib_error_t * vnet_hw_interface_change_mac_address (vnet_main_t * vnm, u32 hw_if_index, - u8 * mac_address) + const u8 * mac_address) { return vnet_hw_interface_change_mac_address_helper (vnm, hw_if_index, mac_address);