aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-01-21 06:44:18 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-17 23:38:05 +0000
commit07a38572caa2c2d2d8658420a7c3df8e7f9d0e74 (patch)
tree1410e662936aac8972f7f1f25e56429f443791d5 /src/vnet/devices/tap
parente821ab100aea2fb3f740a98650eb750ff5911c49 (diff)
Add logging support
Change-Id: Ieac9cf50156dbbb4962411e900d59256441915ef Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r--src/vnet/devices/tap/tap.c9
-rw-r--r--src/vnet/devices/tap/tap.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 8005b347391..7cffaafb1e2 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -31,6 +31,7 @@
#include <linux/rtnetlink.h>
#include <vlib/vlib.h>
+#include <vlib/log.h>
#include <vlib/unix/unix.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip4_packet.h>
@@ -519,11 +520,19 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
return 0;
}
+#define vlib_log_info(...) vlib_log(VLIB_LOG_LEVEL_INFO, __VA_ARGS__)
+
static clib_error_t *
tap_init (vlib_main_t * vm)
{
tap_main_t *tm = &tap_main;
+ clib_error_t *error;
+ error = vlib_call_init_function (vm, vlib_log_init);
+ if (error)
+ return error;
tm->dev_instance_by_interface_id = hash_create (0, sizeof (uword));
+ tm->log_default = vlib_log_register_class ("tap", 0);
+ vlib_log_info (tm->log_default, "initialized");
return 0;
}
diff --git a/src/vnet/devices/tap/tap.h b/src/vnet/devices/tap/tap.h
index 98af0d8f3ab..6e46302770d 100644
--- a/src/vnet/devices/tap/tap.h
+++ b/src/vnet/devices/tap/tap.h
@@ -69,6 +69,9 @@ typedef struct
{
u32 last_used_interface_id;
uword *dev_instance_by_interface_id;
+
+ /* logging */
+ vlib_log_class_t log_default;
} tap_main_t;
void tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args);