From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 58A30376C for ; Sun, 7 Jun 2015 02:04:13 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 06 Jun 2015 17:04:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,565,1427785200"; d="scan'208";a="722382255" Received: from alonn-mobl1.ger.corp.intel.com (HELO rkwiles-mac01.local.com) ([10.254.56.243]) by fmsmga001.fm.intel.com with ESMTP; 06 Jun 2015 17:04:11 -0700 From: Keith Wiles To: dev@dpdk.org Date: Sat, 6 Jun 2015 19:04:06 -0500 Message-Id: <1433635446-78275-2-git-send-email-keith.wiles@intel.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1433635446-78275-1-git-send-email-keith.wiles@intel.com> References: <1433635446-78275-1-git-send-email-keith.wiles@intel.com> Subject: [dpdk-dev] [PATCH] log:Change magic number on RTE_LOG_LEVEL to a define X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 00:04:13 -0000 Config files used RTE_LOG_LEVEL=8 to set log level to DEBUG. Using a the RTE_LOG_XXXX is easier to maintain. Converted the RTE_LOG_XXXX defines into a enum of values with the same names for to reduct maintaining the values and allow debuggers to print the name of the value. Signed-off-by: Keith Wiles --- config/common_bsdapp | 8 +++++++- config/common_linuxapp | 8 +++++++- lib/librte_eal/common/eal_common_log.c | 4 ++-- lib/librte_eal/common/include/rte_log.h | 19 +++++++++++-------- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 0b169c8..97bbcbd 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -93,12 +93,18 @@ CONFIG_RTE_MAX_NUMA_NODES=8 CONFIG_RTE_MAX_MEMSEG=256 CONFIG_RTE_MAX_MEMZONE=2560 CONFIG_RTE_MAX_TAILQ=32 -CONFIG_RTE_LOG_LEVEL=8 CONFIG_RTE_LOG_HISTORY=256 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n # +# Log level use: RTE_LOG_XXX +# XXX = NOOP, EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG +# Look in rte_log.h for others if any. +# +CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG + +# # FreeBSD contiguous memory driver settings # CONFIG_RTE_CONTIGMEM_MAX_NUM_BUFS=64 diff --git a/config/common_linuxapp b/config/common_linuxapp index 5deb55a..886fc66 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -93,7 +93,6 @@ CONFIG_RTE_MAX_NUMA_NODES=8 CONFIG_RTE_MAX_MEMSEG=256 CONFIG_RTE_MAX_MEMZONE=2560 CONFIG_RTE_MAX_TAILQ=32 -CONFIG_RTE_LOG_LEVEL=8 CONFIG_RTE_LOG_HISTORY=256 CONFIG_RTE_LIBEAL_USE_HPET=n CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n @@ -102,6 +101,13 @@ CONFIG_RTE_EAL_IGB_UIO=y CONFIG_RTE_EAL_VFIO=y # +# Log level use: RTE_LOG_XXX +# XXX = NOOP, EMERG, ALERT, CRIT, ERR, WARNING, NOTICE, INFO or DEBUG +# Look in rte_log.h for others if any. +# +CONFIG_RTE_LOG_LEVEL=RTE_LOG_DEBUG + +# # Special configurations in PCI Config Space for high performance # CONFIG_RTE_PCI_CONFIG=n diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index fe3d7d5..3dcceab 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -82,7 +82,7 @@ static struct log_history_list log_history; /* global log structure */ struct rte_logs rte_logs = { .type = ~0, - .level = RTE_LOG_DEBUG, + .level = RTE_LOG_LEVEL, .file = NULL, }; @@ -93,7 +93,7 @@ static int history_enabled = 1; /** * This global structure stores some informations about the message - * that is currently beeing processed by one lcore + * that is currently being processed by one lcore */ struct log_cur_msg { uint32_t loglevel; /**< log level - see rte_log.h */ diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index 3b467c1..e7e893e 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -89,14 +89,17 @@ extern struct rte_logs rte_logs; #define RTE_LOGTYPE_USER8 0x80000000 /**< User-defined log type 8. */ /* Can't use 0, as it gives compiler warnings */ -#define RTE_LOG_EMERG 1U /**< System is unusable. */ -#define RTE_LOG_ALERT 2U /**< Action must be taken immediately. */ -#define RTE_LOG_CRIT 3U /**< Critical conditions. */ -#define RTE_LOG_ERR 4U /**< Error conditions. */ -#define RTE_LOG_WARNING 5U /**< Warning conditions. */ -#define RTE_LOG_NOTICE 6U /**< Normal but significant condition. */ -#define RTE_LOG_INFO 7U /**< Informational. */ -#define RTE_LOG_DEBUG 8U /**< Debug-level messages. */ +enum { + RTE_LOG_NOOP = 0, /**< Noop not used (zero entry) */ + RTE_LOG_EMERG, /**< System is unusable. */ + RTE_LOG_ALERT, /**< Action must be taken immediately. */ + RTE_LOG_CRIT, /**< Critical conditions. */ + RTE_LOG_ERR, /**< Error conditions. */ + RTE_LOG_WARNING, /**< Warning conditions. */ + RTE_LOG_NOTICE, /**< Normal but significant condition. */ + RTE_LOG_INFO, /**< Informational. */ + RTE_LOG_DEBUG /**< Debug-level messages. */ +}; /** The default log stream. */ extern FILE *eal_default_log_stream; -- 2.3.0