aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/vhost_user.h
diff options
context:
space:
mode:
authorJerome Tollet <jtollet@cisco.com>2018-10-02 11:41:11 +0200
committerDamjan Marion <damarion@cisco.com>2018-10-02 16:28:57 +0200
commit2f54c27f7fd0d2c24e7d6b1d48809e8b58ec1abf (patch)
treec86d8e316796d9cfce9c52eed3241862609de9df /src/vnet/devices/virtio/vhost_user.h
parent5507192339aed14634929b3e8d7c5d3e5ea8f997 (diff)
vhost-user: add support for vlib_log API
Change-Id: I0af68f6b41d0024aa64b93a8b18e2d179bf939b0 Signed-off-by: Jerome Tollet <jtollet@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/vhost_user.h')
-rw-r--r--src/vnet/devices/virtio/vhost_user.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/vnet/devices/virtio/vhost_user.h b/src/vnet/devices/virtio/vhost_user.h
index 5bc36082a63..f2ed2dffd46 100644
--- a/src/vnet/devices/virtio/vhost_user.h
+++ b/src/vnet/devices/virtio/vhost_user.h
@@ -45,20 +45,25 @@
#define VRING_USED_F_NO_NOTIFY 1
#define VRING_AVAIL_F_NO_INTERRUPT 1
-#define DBG_SOCK(args...) \
- { \
- vhost_user_main_t *_vum = &vhost_user_main; \
- if (_vum->debug) \
- clib_warning(args); \
- };
-
-#define VHOST_DEBUG_VQ 0
-
-#if VHOST_DEBUG_VQ == 1
-#define DBG_VQ(args...) clib_warning(args);
-#else
-#define DBG_VQ(args...)
-#endif
+#define vu_log_debug(dev, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_DEBUG, vhost_user_main.log_default, "%U: " f, \
+ format_vnet_hw_if_index_name, vnet_get_main(), \
+ dev->hw_if_index, ##__VA_ARGS__); \
+};
+
+#define vu_log_warn(dev, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_WARNING, vhost_user_main.log_default, "%U: " f, \
+ format_vnet_hw_if_index_name, vnet_get_main(), \
+ dev->hw_if_index, ##__VA_ARGS__); \
+};
+#define vu_log_err(dev, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_ERR, vhost_user_main.log_default, "%U: " f, \
+ format_vnet_hw_if_index_name, vnet_get_main(), \
+ dev->hw_if_index, ##__VA_ARGS__); \
+};
#define UNIX_GET_FD(unixfd_idx) ({ \
typeof(unixfd_idx) __unixfd_idx = (unixfd_idx); \
@@ -345,8 +350,8 @@ typedef struct
/* The number of rx interface/queue pairs in interrupt mode */
u32 ifq_count;
- /* debug on or off */
- u8 debug;
+ /* logging */
+ vlib_log_class_t log_default;
} vhost_user_main_t;
typedef struct