aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/interface.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index 5bc1a6eae23..d0919136b0b 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -43,6 +43,14 @@
#include <vnet/adj/adj_mcast.h>
#include <vnet/ip/ip.h>
+/* *INDENT-OFF* */
+VLIB_REGISTER_LOG_CLASS (if_default_log, static) = {
+ .class_name = "interface",
+};
+/* *INDENT-ON* */
+
+#define log_debug(fmt,...) vlib_log_debug(if_default_log.class, fmt, __VA_ARGS__)
+#define log_err(fmt,...) vlib_log_err(if_default_log.class, fmt, __VA_ARGS__)
typedef enum vnet_interface_helper_flags_t_
{
VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE = (1 << 0),
@@ -338,6 +346,8 @@ vnet_hw_interface_set_flags_helper (vnet_main_t * vnm, u32 hw_if_index,
hi->flags |= flags;
done:
+ if (error)
+ log_err ("hw_set_flags_helper: %U", format_clib_error, error);
return error;
}
@@ -490,6 +500,8 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index,
si->flags |= flags;
done:
+ if (error)
+ log_err ("sw_set_flags_helper: %U", format_clib_error, error);
return error;
}
@@ -497,6 +509,7 @@ clib_error_t *
vnet_hw_interface_set_flags (vnet_main_t * vnm, u32 hw_if_index,
vnet_hw_interface_flags_t flags)
{
+ log_debug ("hw_set_flags: hw_if_index %u flags 0x%x", hw_if_index, flags);
return vnet_hw_interface_set_flags_helper
(vnm, hw_if_index, flags,
VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE);
@@ -506,6 +519,7 @@ clib_error_t *
vnet_sw_interface_set_flags (vnet_main_t * vnm, u32 sw_if_index,
vnet_sw_interface_flags_t flags)
{
+ log_debug ("sw_set_flags: sw_if_index %u flags 0x%x", sw_if_index, flags);
return vnet_sw_interface_set_flags_helper
(vnm, sw_if_index, flags,
VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE);
@@ -515,6 +529,7 @@ 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);
+ log_debug ("sw_admin_up: sw_if_index %u", sw_if_index);
if (!(flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP))
{
@@ -527,6 +542,7 @@ 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);
+ log_debug ("sw_admin_down: sw_if_index %u", sw_if_index);
if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
{
@@ -583,6 +599,7 @@ clib_error_t *
vnet_create_sw_interface (vnet_main_t * vnm, vnet_sw_interface_t * template,
u32 * sw_if_index)
{
+ vnet_interface_main_t *im = &vnm->interface_main;
clib_error_t *error;
vnet_hw_interface_t *hi;
vnet_device_class_t *dev_class;
@@ -592,8 +609,9 @@ vnet_create_sw_interface (vnet_main_t * vnm, vnet_sw_interface_t * template,
&& (template->sub.eth.flags.inner_vlan_id_any == 1
|| template->sub.eth.flags.outer_vlan_id_any == 1))
{
- error = clib_error_return (0,
- "inner-dot1q any exact-match is unsupported");
+ char *str = "inner-dot1q any exact-match is unsupported";
+ error = clib_error_return (0, str);
+ log_err ("create_sw_interface: %s", str);
return error;
}
@@ -618,11 +636,19 @@ vnet_create_sw_interface (vnet_main_t * vnm, vnet_sw_interface_t * template,
if (error)
{
/* undo the work done by vnet_create_sw_interface_no_callbacks() */
- vnet_interface_main_t *im = &vnm->interface_main;
+ log_err ("create_sw_interface: set flags failed\n %U",
+ format_clib_error, error);
vnet_sw_interface_t *sw =
pool_elt_at_index (im->sw_interfaces, *sw_if_index);
pool_put (im->sw_interfaces, sw);
}
+ else
+ {
+ vnet_sw_interface_t *sw =
+ pool_elt_at_index (im->sw_interfaces, *sw_if_index);
+ log_debug ("create_sw_interface: interface %U (sw_if_index %u) created",
+ format_vnet_sw_interface_name, vnm, sw, *sw_if_index);
+ }
return error;
}
@@ -634,6 +660,9 @@ vnet_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index)
vnet_sw_interface_t *sw =
pool_elt_at_index (im->sw_interfaces, sw_if_index);
+ log_debug ("delete_sw_interface: sw_if_index %u, name '%U'",
+ sw_if_index, format_vnet_sw_if_index_name, vnm, sw_if_index);
+
/* Check if the interface has config and is removed from L2 BD or XConnect */
vnet_clear_sw_interface_tag (vnm, sw_if_index);
@@ -661,6 +690,9 @@ vnet_sw_interface_set_mtu (vnet_main_t * vnm, u32 sw_if_index, u32 mtu)
if (si->mtu[VNET_MTU_L3] != mtu)
{
si->mtu[VNET_MTU_L3] = mtu;
+ log_debug ("set_mtu: interface %U, new mtu %u",
+ format_vnet_sw_if_index_name, vnm, sw_if_index, mtu);
+
call_sw_interface_mtu_change_callbacks (vnm, sw_if_index);
}
}
@@ -683,7 +715,13 @@ vnet_sw_interface_set_protocol_mtu (vnet_main_t * vnm, u32 sw_if_index,
}
/* Notify interested parties */
if (changed)
- call_sw_interface_mtu_change_callbacks (vnm, sw_if_index);
+ {
+ log_debug ("set_protocol_mtu: interface %U l3 %u ip4 %u ip6 %u mpls %u",
+ format_vnet_sw_if_index_name, vnm, sw_if_index,
+ mtu[VNET_MTU_L3], mtu[VNET_MTU_IP4], mtu[VNET_MTU_IP6],
+ mtu[VNET_MTU_MPLS]);
+ call_sw_interface_mtu_change_callbacks (vnm, sw_if_index);
+ }
}
void
@@ -1484,6 +1522,8 @@ vnet_hw_interface_add_del_mac_address (vnet_main_t * vnm,
mac_address, is_add);
done:
+ if (error)
+ log_err ("hw_add_del_mac_address: %U", format_clib_error, error);
return error;
}
@@ -1714,6 +1754,8 @@ vnet_hw_interface_set_rss_queues (vnet_main_t * vnm,
}
done:
+ if (error)
+ log_err ("hw_set_rss_queues: %U", format_clib_error, error);
return error;
}