From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8263AA0A02; Mon, 5 Apr 2021 21:30:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C914140E80; Mon, 5 Apr 2021 21:30:13 +0200 (CEST) Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 1F867140E55 for ; Mon, 5 Apr 2021 21:30:12 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B5F711A7E; Mon, 5 Apr 2021 15:30:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 05 Apr 2021 15:30:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=zLVkjlbOx1yDl 7HkZUPrSdhfQlS89ly4MKFlZ+gnceo=; b=SQGY8C8ic0XQwGlADKkyyZXc/+WUq wmWYoHWARZoQKfEEs6wBwsUQfh43lh/q7E0dDpimMVCZmtcRx9wQoLYquSlbdZA8 WS2dxhmougN+28t5tJa0i8FFP+L0TMGV6XhvcYsLKvognJvXHRslt6JoqGAmaT4o Dg0t16Xq7CAWC+8V2WANZ6wOsE5EblRZWFCRqt59n/CQiYtPh2xN1eZfNPx9g+MS Ie75ZgwxbKUmXUexM/FDPNDeCiIGV1M9Z8SutQFjp0jsrUjtJYR7amL6FlTQyAms vN2aU+0rxadwjkWBmxgGgybvvFX4pBc4UigCTPbHjs+XyfK7XFBAbsRPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=zLVkjlbOx1yDl7HkZUPrSdhfQlS89ly4MKFlZ+gnceo=; b=GaapRkTf dwUZhHxWvTXrykP7Z6JpV78YxCD3vCnXE6OcOg/QLwTxVTnP99SBGGTkLhlwD4Gl X0HHcnhKG9iSiCZiNDkK1zIyUOqoPX6Q9P7bKMK74pdQ3z51aymdfQnUpGfMre2j 0pLeELFoNoK2eljdMj11V2YZaMLcGyUiihBFIs5FO0xT6BNS8Tq7zxCGCDjBL4In GvGV4IuoVsO9gXfBvcm/4lj9I62TDWh2cIXTn+mKlgclrNWlqi1+MHGi0j9xAIJI UehjhnE+ZZnfpobeTXtULONRC+3xsZLefitfLym2XECN40MoHVY2etq2DtUhGDTK f6ulHfU5IbEnRg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejvddgudegtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8687A24005D; Mon, 5 Apr 2021 15:30:09 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Andrew Rybchenko Date: Mon, 5 Apr 2021 21:29:58 +0200 Message-Id: <20210405193000.1113542-3-thomas@monjalon.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405193000.1113542-1-thomas@monjalon.net> References: <20210309233116.1934666-1-thomas@monjalon.net> <20210405193000.1113542-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 2/4] log: introduce macro for maximum level X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" RTE_DIM(...) and RTE_LOG_DEBUG were used to get the highest log level. For better clarity a new constant RTE_LOG_MAX is introduced and mapped to RTE_LOG_DEBUG. Signed-off-by: Thomas Monjalon Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko --- lib/librte_eal/common/eal_common_log.c | 8 ++++---- lib/librte_eal/common/eal_common_options.c | 2 +- lib/librte_eal/include/rte_log.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 058fa10ffc..b9b982fdb5 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -140,7 +140,7 @@ rte_log_set_level(uint32_t type, uint32_t level) { if (type >= rte_logs.dynamic_types_len) return -1; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; rte_logs.dynamic_types[type].loglevel = level; @@ -155,7 +155,7 @@ rte_log_set_level_regexp(const char *regex, uint32_t level) regex_t r; size_t i; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; if (regcomp(&r, regex, 0) != 0) @@ -219,7 +219,7 @@ rte_log_set_level_pattern(const char *pattern, uint32_t level) { size_t i; - if (level > RTE_LOG_DEBUG) + if (level > RTE_LOG_MAX) return -1; for (i = 0; i < rte_logs.dynamic_types_len; i++) { @@ -323,7 +323,7 @@ rte_log_register_type_and_pick_level(const char *name, uint32_t level_def) return type; TAILQ_FOREACH(opt_ll, &opt_loglevel_list, next) { - if (opt_ll->level > RTE_LOG_DEBUG) + if (opt_ll->level > RTE_LOG_MAX) continue; if (opt_ll->pattern) { diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index cd1a2856c9..38b72fb665 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1249,7 +1249,7 @@ eal_parse_log_priority(const char *level) return -1; /* look for named values, skip 0 which is not a valid level */ - for (i = 1; i < RTE_DIM(levels); i++) { + for (i = 1; i <= RTE_LOG_MAX; i++) { if (strncmp(levels[i], level, len) == 0) return i; } diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index 21a7d16340..424dfa3fd0 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -72,6 +72,7 @@ extern "C" { #define RTE_LOG_NOTICE 6U /**< Normal but significant condition. */ #define RTE_LOG_INFO 7U /**< Informational. */ #define RTE_LOG_DEBUG 8U /**< Debug-level messages. */ +#define RTE_LOG_MAX RTE_LOG_DEBUG /**< Most detailed log level. */ /** * Change the stream that will be used by the logging system. -- 2.31.1