summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo/load_balance.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-09-24 12:36:26 +0000
committerDamjan Marion <dmarion@me.com>2018-10-16 12:22:49 +0000
commit710071bf0ed7a0926581d1f738a142b72e795d2b (patch)
tree6e3b8e7bc07b3e48ed4041ffe657ba1e4da058f1 /src/vnet/dpo/load_balance.c
parenta5ab5034f4b50fc5a19ccf8910c91613e6a52f5a (diff)
FIB: use vlib-log for debugging
Change-Id: I9052202b8cbcf656e61d635253d515f0f3a8d145 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/dpo/load_balance.c')
-rw-r--r--src/vnet/dpo/load_balance.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/vnet/dpo/load_balance.c b/src/vnet/dpo/load_balance.c
index 48f77986f57..6b77f477fae 100644
--- a/src/vnet/dpo/load_balance.c
+++ b/src/vnet/dpo/load_balance.c
@@ -30,21 +30,19 @@ const f64 multipath_next_hop_error_tolerance = 0.1;
static const char *load_balance_attr_names[] = LOAD_BALANCE_ATTR_NAMES;
-#undef LB_DEBUG
-#ifdef LB_DEBUG
+/**
+ * the logger
+ */
+vlib_log_class_t load_balance_logger;
+
#define LB_DBG(_lb, _fmt, _args...) \
{ \
- u8* _tmp =NULL; \
- clib_warning("lb:[%s]:" _fmt, \
- load_balance_format(load_balance_get_index((_lb)), \
- 0, _tmp), \
- ##_args); \
- vec_free(_tmp); \
+ vlib_log_debug(load_balance_logger, \
+ "lb:[%U]:" _fmt, \
+ format_load_balance, load_balance_get_index(_lb), \
+ LOAD_BALANCE_FORMAT_NONE, \
+ ##_args); \
}
-#else
-#define LB_DBG(_p, _fmt, _args...)
-#endif
-
/**
* Pool of all DPOs. It's not static so the DP can have fast access
@@ -180,6 +178,7 @@ format_load_balance (u8 * s, va_list * args)
return (load_balance_format(lbi, flags, 0, s));
}
+
static u8*
format_load_balance_dpo (u8 * s, va_list * args)
{
@@ -189,7 +188,6 @@ format_load_balance_dpo (u8 * s, va_list * args)
return (load_balance_format(lbi, LOAD_BALANCE_FORMAT_DETAIL, indent, s));
}
-
static load_balance_t *
load_balance_create_i (u32 num_buckets,
dpo_proto_t lb_proto,
@@ -947,6 +945,9 @@ load_balance_module_init (void)
lbi = load_balance_create(1, DPO_PROTO_IP4, 0);
load_balance_set_bucket(lbi, 0, drop_dpo_get(DPO_PROTO_IP4));
+ load_balance_logger =
+ vlib_log_register_class("dpo", "load-balance");
+
load_balance_map_module_init();
}