From fb9d1ac843884aca79873577b53f6254e7933478 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Thu, 4 Aug 2022 20:36:45 +0500 Subject: vnet: fix format of deleted sw interfaces As similar 535364e90459566b603661c3dbe360c72f59ad71 is merged, printing possibly deleted interfaces by index only in all the rest cases. Type: improvement Signed-off-by: Vladislav Grishenko Change-Id: I4fa58b382c0279ff893523ba0188fdb9b09e10af --- src/plugins/dpdk/device/format.c | 10 ++++----- src/plugins/l2tp/l2tp.c | 10 ++++----- src/plugins/lb/cli.c | 26 ++++++++++------------ src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c | 4 +--- 4 files changed, 21 insertions(+), 29 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index 1fd609a68a5..0e612c60405 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -608,10 +608,9 @@ format_dpdk_tx_trace (u8 * s, va_list * va) dpdk_main_t *dm = &dpdk_main; dpdk_device_t *xd = vec_elt_at_index (dm->devices, t->device_index); u32 indent = format_get_indent (s); - vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, xd->sw_if_index); - s = format (s, "%U tx queue %d", - format_vnet_sw_interface_name, vnm, sw, t->queue_index); + s = format (s, "%U tx queue %d", format_vnet_sw_if_index_name, vnm, + xd->sw_if_index, t->queue_index); s = format (s, "\n%Ubuffer 0x%x: %U", format_white_space, indent, t->buffer_index, format_vnet_buffer_no_chain, &t->buffer); @@ -638,10 +637,9 @@ format_dpdk_rx_trace (u8 * s, va_list * va) dpdk_device_t *xd = vec_elt_at_index (dm->devices, t->device_index); format_function_t *f; u32 indent = format_get_indent (s); - vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, xd->sw_if_index); - s = format (s, "%U rx queue %d", - format_vnet_sw_interface_name, vnm, sw, t->queue_index); + s = format (s, "%U rx queue %d", format_vnet_sw_if_index_name, vnm, + xd->sw_if_index, t->queue_index); s = format (s, "\n%Ubuffer 0x%x: %U", format_white_space, indent, t->buffer_index, format_vnet_buffer_no_chain, &t->buffer); diff --git a/src/plugins/l2tp/l2tp.c b/src/plugins/l2tp/l2tp.c index a975fa7f059..308c0f1d659 100644 --- a/src/plugins/l2tp/l2tp.c +++ b/src/plugins/l2tp/l2tp.c @@ -53,12 +53,10 @@ format_l2t_session (u8 * s, va_list * args) vlib_counter_t v; s = format (s, "[%d] %U (our) %U (client) %U (sw_if_index %d)\n", - session - lm->sessions, - format_ip6_address, &session->our_address, - format_ip6_address, &session->client_address, - format_vnet_sw_interface_name, lm->vnet_main, - vnet_get_sw_interface (lm->vnet_main, session->sw_if_index), - session->sw_if_index); + session - lm->sessions, format_ip6_address, + &session->our_address, format_ip6_address, + &session->client_address, format_vnet_sw_if_index_name, + lm->vnet_main, session->sw_if_index, session->sw_if_index); s = format (s, " local cookies %016llx %016llx remote cookie %016llx\n", clib_net_to_host_u64 (session->local_cookie[0]), diff --git a/src/plugins/lb/cli.c b/src/plugins/lb/cli.c index 31152cd01f4..afa73ef616c 100644 --- a/src/plugins/lb/cli.c +++ b/src/plugins/lb/cli.c @@ -447,24 +447,22 @@ lb_set_interface_nat_command_fn (vlib_main_t * vm, { if (lb_nat4_interface_add_del (*sw_if_index, is_del)) { - error = clib_error_return( - 0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, *sw_if_index)); - goto done; - } - } + error = clib_error_return ( + 0, "%s %U failed", is_del ? "del" : "add", + format_vnet_sw_if_index_name, vnm, *sw_if_index); + goto done; + } + } else { if (lb_nat6_interface_add_del (*sw_if_index, is_del)) { - error = clib_error_return( - 0, "%s %U failed", is_del ? "del" : "add", - format_vnet_sw_interface_name, vnm, - vnet_get_sw_interface (vnm, *sw_if_index)); - goto done; - } - } + error = clib_error_return ( + 0, "%s %U failed", is_del ? "del" : "add", + format_vnet_sw_if_index_name, vnm, *sw_if_index); + goto done; + } + } } done: diff --git a/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c index b40ed2e9234..c316f6c9825 100644 --- a/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c +++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c @@ -224,9 +224,7 @@ format_lisp_gpe_sub_interface (u8 * s, va_list * ap) lisp_gpe_sub_interface_t *l3s = va_arg (*ap, lisp_gpe_sub_interface_t *); vnet_main_t *vnm = vnet_get_main (); - s = format (s, "%-16U", - format_vnet_sw_interface_name, - vnm, vnet_get_sw_interface (vnm, l3s->sw_if_index)); + s = format (s, "%-16U", format_vnet_sw_if_index_name, vnm, l3s->sw_if_index); s = format (s, "%=8d", l3s->key->vni); s = format (s, "%=15d", l3s->sw_if_index); s = format (s, "%U", format_ip_address, &l3s->key->local_rloc); -- cgit 1.2.3-korg