X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface_format.c;h=df7e938894ab730e15e0b041f8de74fe6089a999;hb=d5b6aa139856a1447f7bc5377058202110eaa4cf;hp=b3a30622031f1085ff4cb8c470e66d739b075a26;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c index b3a30622031..df7e938894a 100644 --- a/src/vnet/interface_format.c +++ b/src/vnet/interface_format.c @@ -45,7 +45,9 @@ format_vnet_sw_interface_flags (u8 * s, va_list * args) { u32 flags = va_arg (*args, u32); - if (flags & VNET_SW_INTERFACE_FLAG_BOND_SLAVE) + if (flags & VNET_SW_INTERFACE_FLAG_ERROR) + s = format (s, "error"); + else if (flags & VNET_SW_INTERFACE_FLAG_BOND_SLAVE) s = format (s, "bond-slave"); else { @@ -58,6 +60,23 @@ format_vnet_sw_interface_flags (u8 * s, va_list * args) return s; } +u8 * +format_vnet_hw_interface_rx_mode (u8 * s, va_list * args) +{ + vnet_hw_interface_rx_mode mode = va_arg (*args, vnet_hw_interface_rx_mode); + + if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING) + return format (s, "polling"); + + if (mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT) + return format (s, "interrupt"); + + if (mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE) + return format (s, "adaptive"); + + return format (s, "unknown"); +} + u8 * format_vnet_hw_interface (u8 * s, va_list * args) { @@ -321,6 +340,7 @@ unformat_vnet_sw_interface (unformat_input_t * input, va_list * args) u32 *result = va_arg (*args, u32 *); vnet_hw_interface_t *hi; u32 hw_if_index, id, id_specified; + u32 sw_if_index; u8 *if_name = 0; uword *p, error = 0; @@ -340,14 +360,17 @@ unformat_vnet_sw_interface (unformat_input_t * input, va_list * args) hi = vnet_get_hw_interface (vnm, hw_if_index); if (!id_specified) { - *result = hi->sw_if_index; + sw_if_index = hi->sw_if_index; } else { if (!(p = hash_get (hi->sub_interface_sw_if_index_by_id, id))) - return 0; - *result = p[0]; + goto done; + sw_if_index = p[0]; } + if (!vnet_sw_interface_is_api_visible (vnm, sw_if_index)) + goto done; + *result = sw_if_index; error = 1; done: vec_free (if_name);