summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-10-23 21:52:50 +0200
committerOle Tr�an <otroan@employees.org>2020-10-26 10:45:49 +0000
commit4d7ad4a6cc08e316d78de5ac7ce3ead4e9bfcb66 (patch)
treeef4158573a6aea024be7260ef7ebe4f12dfc64a8 /src/plugins
parent340b10a38ed84600ed3336657ef3a104d9ebe877 (diff)
vlib: add VLIB_REGISTER_LOG_CLASS macro
Type: improvement Change-Id: Iafcaeb88fa3569e042fb9cb270cf062b145416e2 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avf/avf.h10
-rw-r--r--src/plugins/avf/device.c12
2 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 135b5f94eef..57e71263f9e 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -50,18 +50,20 @@
#define AVF_TXD_CMD_RS AVF_TXD_CMD(1)
#define AVF_TXD_CMD_RSV AVF_TXD_CMD(2)
+extern vlib_log_class_registration_t avf_log;
+
#define avf_log_err(dev, f, ...) \
- vlib_log (VLIB_LOG_LEVEL_ERR, avf_main.log_class, "%U: " f, \
+ vlib_log (VLIB_LOG_LEVEL_ERR, avf_log.class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)
#define avf_log_warn(dev, f, ...) \
- vlib_log (VLIB_LOG_LEVEL_WARNING, avf_main.log_class, "%U: " f, \
+ vlib_log (VLIB_LOG_LEVEL_WARNING, avf_log.class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)
#define avf_log_debug(dev, f, ...) \
- vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_main.log_class, "%U: " f, \
+ vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_log.class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)
@@ -245,8 +247,6 @@ typedef struct
avf_device_t **devices;
avf_per_thread_data_t *per_thread_data;
-
- vlib_log_class_t log_class;
} avf_main_t;
extern avf_main_t avf_main;
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index f3915633d5f..b6cf32f0866 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -34,6 +34,12 @@
#define PCI_DEVICE_ID_INTEL_X710_VF 0x154c
#define PCI_DEVICE_ID_INTEL_X722_VF 0x37cd
+/* *INDENT-OFF* */
+VLIB_REGISTER_LOG_CLASS (avf_log) = {
+ .class_name = "avf",
+};
+/* *INDENT-ON* */
+
avf_main_t avf_main;
void avf_delete_if (vlib_main_t * vm, avf_device_t * ad, int with_barrier);
@@ -1017,7 +1023,6 @@ avf_device_init (vlib_main_t * vm, avf_main_t * am, avf_device_t * ad,
void
avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
{
- avf_main_t *am = &avf_main;
vnet_main_t *vnm = vnet_get_main ();
virtchnl_pf_event_t *e;
u32 r;
@@ -1157,7 +1162,7 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
error:
ad->flags |= AVF_DEVICE_F_ERROR;
ASSERT (ad->error != 0);
- vlib_log_err (am->log_class, "%U", format_clib_error, ad->error);
+ vlib_log_err (avf_log.class, "%U", format_clib_error, ad->error);
}
static clib_error_t *
@@ -1780,9 +1785,6 @@ avf_init (vlib_main_t * vm)
vec_validate_aligned (am->per_thread_data, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- am->log_class = vlib_log_register_class ("avf", 0);
- vlib_log_debug (am->log_class, "initialized");
-
return 0;
}