From 3789483934bfe185cc849275cb698e14410d5703 Mon Sep 17 00:00:00 2001 From: Timothy McDaniel Date: Sun, 1 Nov 2020 17:29:54 -0600 Subject: [PATCH] event/dlb: add dynamic logging This commit adds base support for dynamic logging. The default log level is NOTICE. Dynamic logging is used exclusively throughout this patchset. Signed-off-by: Timothy McDaniel Reviewed-by: Gage Eads --- drivers/event/dlb/dlb.c | 7 +++++++ drivers/event/dlb/dlb_log.h | 25 +++++++++++++++++++++++++ drivers/event/dlb/meson.build | 3 +-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 drivers/event/dlb/dlb.c create mode 100644 drivers/event/dlb/dlb_log.h diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c new file mode 100644 index 0000000000..e03aa214c5 --- /dev/null +++ b/drivers/event/dlb/dlb.c @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2020 Intel Corporation + */ + +#include + +RTE_LOG_REGISTER(eventdev_dlb_log_level, pmd.event.dlb, NOTICE); diff --git a/drivers/event/dlb/dlb_log.h b/drivers/event/dlb/dlb_log.h new file mode 100644 index 0000000000..c69c9e5beb --- /dev/null +++ b/drivers/event/dlb/dlb_log.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2016-2020 Intel Corporation + */ + +#ifndef _DLB_EVDEV_LOG_H_ +#define _DLB_EVDEV_LOG_H_ + +extern int eventdev_dlb_log_level; + +/* Dynamic logging */ +#define DLB_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, eventdev_dlb_log_level, "%s" fmt "\n", \ + __func__, ##args) + +#define DLB_LOG_INFO(fmt, args...) \ + DLB_LOG_IMPL(INFO, fmt, ## args) + +#define DLB_LOG_ERR(fmt, args...) \ + DLB_LOG_IMPL(ERR, fmt, ## args) + +/* remove debug logs at compile time unless actually debugging */ +#define DLB_LOG_DBG(fmt, args...) \ + RTE_LOG_DP(DEBUG, PMD, fmt, ## args) + +#endif /* _DLB_EVDEV_LOG_H_ */ diff --git a/drivers/event/dlb/meson.build b/drivers/event/dlb/meson.build index 68cb0aede3..50209bfccf 100644 --- a/drivers/event/dlb/meson.build +++ b/drivers/event/dlb/meson.build @@ -7,8 +7,7 @@ if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64') subdir_done() endif -sources = files( -) +sources = files('dlb.c') headers = files() -- 2.20.1