aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/dpo')
-rw-r--r--src/vnet/dpo/load_balance.c27
-rw-r--r--src/vnet/dpo/load_balance_map.c23
-rw-r--r--src/vnet/dpo/replicate_dpo.c22
3 files changed, 39 insertions, 33 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();
}
diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c
index 588c1a75a4f..8f9bd366c4a 100644
--- a/src/vnet/dpo/load_balance_map.c
+++ b/src/vnet/dpo/load_balance_map.c
@@ -68,18 +68,20 @@ typedef struct load_balance_map_path_t_ {
*/
load_balance_map_t *load_balance_map_pool;
+/**
+ * the logger
+ */
+vlib_log_class_t load_balance_map_logger;
+
/*
* Debug macro
*/
-#ifdef FIB_DEBUG
-#define LOAD_BALANCE_MAP_DBG(_pl, _fmt, _args...) \
- { \
- clib_warning("lbm: FIXME" _fmt, \
- ##_args); \
- }
-#else
-#define LOAD_BALANCE_MAP_DBG(_pl, _fmt, _args...)
-#endif
+#define LOAD_BALANCE_MAP_DBG(_pl, _fmt, _args...) \
+{ \
+ vlib_log_debug(load_balance_map_logger, \
+ "lbm:" _fmt, \
+ ##_args); \
+}
static index_t
load_balance_map_get_index (load_balance_map_t *lbm)
@@ -412,6 +414,9 @@ load_balance_map_init (load_balance_map_t *lbm,
load_balance_map_fill(lbm);
+ load_balance_map_logger =
+ vlib_log_register_class ("dpo", "load-balance-map");
+
return (lbm);
}
diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c
index 6742bff41aa..443df66e238 100644
--- a/src/vnet/dpo/replicate_dpo.c
+++ b/src/vnet/dpo/replicate_dpo.c
@@ -19,21 +19,20 @@
#include <vnet/adj/adj.h>
#include <vnet/mpls/mpls_types.h>
-#undef REP_DEBUG
+/**
+ * the logger
+ */
+vlib_log_class_t replicate_logger;
-#ifdef REP_DEBUG
#define REP_DBG(_rep, _fmt, _args...) \
{ \
- u8* _tmp =NULL; \
- clib_warning("rep:[%s]:" _fmt, \
- replicate_format(replicate_get_index((_rep)), \
- 0, _tmp), \
- ##_args); \
- vec_free(_tmp); \
+ vlib_log_debug(replicate_logger, \
+ "rep:[%U]:" _fmt, \
+ format_replicate, \
+ replicate_get_index(_rep), \
+ REPLICATE_FORMAT_NONE, \
+ ##_args); \
}
-#else
-#define REP_DBG(_p, _fmt, _args...)
-#endif
#define foreach_replicate_dpo_error \
_(BUFFER_ALLOCATION_FAILURE, "Buffer Allocation Failure")
@@ -580,6 +579,7 @@ void
replicate_module_init (void)
{
dpo_register(DPO_REPLICATE, &rep_vft, replicate_nodes);
+ replicate_logger = vlib_log_register_class("dpo", "replicate");
}
static clib_error_t *