aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-11-08 17:41:06 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-11-14 17:54:51 +0000
commitf41244f423a44c6d295895b011eec4bbeef08a8d (patch)
tree6e88a44f43d1970bc1f11b5c5cbbb9d8f6ece376 /src/vnet/devices/virtio/virtio.h
parentaa27dcb84cb312277370b77370a69b2a3596c4c5 (diff)
virtio: refactor virtio-pci logging
Type: refactor Change-Id: I34306c1206b2bf5f521be6c6b78074ccf9259a08 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/virtio.h')
-rw-r--r--src/vnet/devices/virtio/virtio.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index dcbf865d706..2cf1653d1c2 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -82,7 +82,7 @@ typedef enum
typedef enum
{
- VIRTIO_IF_TYPE_TAP,
+ VIRTIO_IF_TYPE_TAP = 1,
VIRTIO_IF_TYPE_PCI,
VIRTIO_IF_N_TYPES,
} virtio_if_type_t;
@@ -212,6 +212,7 @@ extern void virtio_show (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr,
extern void virtio_pci_legacy_notify_queue (vlib_main_t * vm,
virtio_if_t * vif, u16 queue_id);
format_function_t format_virtio_device_name;
+format_function_t format_virtio_log_name;
static_always_inline void
virtio_kick (vlib_main_t * vm, virtio_vring_t * vring, virtio_if_t * vif)
@@ -228,6 +229,28 @@ virtio_kick (vlib_main_t * vm, virtio_vring_t * vring, virtio_if_t * vif)
}
}
+
+#define virtio_log_debug(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_DEBUG, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
+#define virtio_log_warning(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_WARNING, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
+#define virtio_log_error(vif, f, ...) \
+{ \
+ vlib_log(VLIB_LOG_LEVEL_ERR, virtio_main.log_default, \
+ "%U: " f, format_virtio_log_name, vif, \
+ ##__VA_ARGS__); \
+};
+
#endif /* _VNET_DEVICES_VIRTIO_VIRTIO_H_ */
/*