DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH next 06/10] net/failsafe: convert to dynamic logging
Date: Wed, 25 Apr 2018 08:56:42 -0700	[thread overview]
Message-ID: <20180425155646.3627-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20180425155646.3627-1-stephen@networkplumber.org>

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/failsafe/failsafe.c         | 13 ++++++++++++-
 drivers/net/failsafe/failsafe_private.h |  8 ++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index dc9b0d08881d..5e7a8ba1b0dd 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -13,6 +13,8 @@
 
 #include "failsafe_private.h"
 
+int failsafe_logtype;
+
 const char pmd_failsafe_driver_name[] = FAILSAFE_DRIVER_NAME;
 static const struct rte_eth_link eth_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
@@ -304,7 +306,7 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
 	    strlen(rte_vdev_device_args(vdev)) == 0) {
 		eth_dev = rte_eth_dev_attach_secondary(name);
 		if (!eth_dev) {
-			RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
+			ERROR("Failed to probe %s", name);
 			return -1;
 		}
 		/* TODO: request info from primary to set up Rx and Tx */
@@ -332,3 +334,12 @@ static struct rte_vdev_driver failsafe_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_failsafe, failsafe_drv);
 RTE_PMD_REGISTER_PARAM_STRING(net_failsafe, PMD_FAILSAFE_PARAM_STRING);
+
+RTE_INIT(failsafe_init_log);
+static void
+failsafe_init_log(void)
+{
+	failsafe_logtype = rte_log_register("pmd.net.failsafe");
+	if (failsafe_logtype >= 0)
+		rte_log_set_level(failsafe_logtype, RTE_LOG_NOTICE);
+}
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 7db9eebe3fcc..b54f8e33671f 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -326,8 +326,12 @@ extern int mac_from_arg;
 #define FS_THREADID_FMT  "lu"
 #endif
 
-#define LOG__(level, m, ...) \
-	RTE_LOG(level, PMD, "net_failsafe: " m "%c", __VA_ARGS__)
+extern int failsafe_logtype;
+
+#define LOG__(l, m, ...) \
+	rte_log(RTE_LOG_ ## l, failsafe_logtype, \
+		"net_failsafe: " m "%c", __VA_ARGS__)
+
 #define LOG_(level, ...) LOG__(level, __VA_ARGS__, '\n')
 #define DEBUG(...) LOG_(DEBUG, __VA_ARGS__)
 #define INFO(...) LOG_(INFO, __VA_ARGS__)
-- 
2.17.0

  parent reply	other threads:[~2018-04-25 15:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 15:56 [dpdk-dev] [PATCH next 00/10] more " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 01/10] net/tap: convert to " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 02/10] net/af_packet: convert to dynamic log level Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 03/10] net/null: convert to dynamic logging Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 04/10] net/ring: " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 05/10] net/softnic: " Stephen Hemminger
2018-04-25 15:56 ` Stephen Hemminger [this message]
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 07/10] net/kni: support " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 08/10] net/pcap: " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 09/10] net/vhost: implement " Stephen Hemminger
2018-04-25 15:56 ` [dpdk-dev] [PATCH next 10/10] net/bond: convert to " Stephen Hemminger
2018-04-26 23:41   ` Ferruh Yigit
2018-04-26 23:42 ` [dpdk-dev] [PATCH next 00/10] more " Ferruh Yigit
2018-04-26 23:55   ` Ferruh Yigit
2018-04-26 23:55   ` Ferruh Yigit

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=20180425155646.3627-7-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /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).