From: Stephen Hemminger <stephen@networkplumber.org>
To: maxime.coquelin@redhat.com
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH] vhost: use dynamic log type
Date: Tue, 12 Nov 2019 13:47:09 -0800 [thread overview]
Message-ID: <20191112214709.30953-1-stephen@networkplumber.org> (raw)
Rather than overloading USER1 and USER2 logtypes,
use a DPDK dynamic log type.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/librte_vhost/vhost.c | 12 ++++++++++++
lib/librte_vhost/vhost.h | 5 +++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 1cbe948f7470..9149770a16f5 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -27,6 +27,8 @@
struct virtio_net *vhost_devices[MAX_VHOST_DEVICE];
+int vhost_logtype_config, vhost_logtype_data;
+
/* Called with iotlb_lock read-locked */
uint64_t
__vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
@@ -1457,3 +1459,13 @@ int rte_vhost_extern_callback_register(int vid,
dev->extern_data = ctx;
return 0;
}
+
+RTE_INIT(rte_vhost_init_log)
+{
+ vhost_logtype_config = rte_log_register("lib.vhost.config");
+ if (vhost_logtype_config >= 0)
+ rte_log_set_level(vhost_logtype_config, RTE_LOG_NOTICE);
+ vhost_logtype_data = rte_log_register("lib.vhost.data");
+ if (vhost_logtype_data >= 0)
+ rte_log_set_level(vhost_logtype_data, RTE_LOG_NOTICE);
+}
diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 9f11b28a31bf..87ce24991c26 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -499,8 +499,9 @@ vhost_log_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq,
}
/* Macros for printing using RTE_LOG */
-#define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1
-#define RTE_LOGTYPE_VHOST_DATA RTE_LOGTYPE_USER1
+extern int vhost_logtype_config, vhost_logtype_data;
+#define RTE_LOGTYPE_VHOST_CONFIG vhost_logtype_config
+#define RTE_LOGTYPE_VHOST_DATA vhost_logtype_data
#ifdef RTE_LIBRTE_VHOST_DEBUG
#define VHOST_MAX_PRINT_BUFF 6072
--
2.20.1
next reply other threads:[~2019-11-12 21:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 21:47 Stephen Hemminger [this message]
2020-01-09 14:44 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191112214709.30953-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).