From patchwork Mon Aug 19 11:41:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 57743 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E8C091BEBE; Mon, 19 Aug 2019 13:42:19 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 663B91BEB5 for ; Mon, 19 Aug 2019 13:42:17 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDB8A190C107 for ; Mon, 19 Aug 2019 11:42:16 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-32.brq.redhat.com [10.40.204.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2219D1001B14 for ; Mon, 19 Aug 2019 11:42:15 +0000 (UTC) From: David Marchand To: dev@dpdk.org Date: Mon, 19 Aug 2019 13:41:50 +0200 Message-Id: <1566214919-32250-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1566214919-32250-1-git-send-email-david.marchand@redhat.com> References: <1566214919-32250-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Mon, 19 Aug 2019 11:42:16 +0000 (UTC) Subject: [dpdk-dev] [PATCH 02/11] log: define logtype register wrapper for drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" The function rte_log_register_type_and_pick_level() fills a gap for dynamically loaded code (especially drivers) who would not pick up the log level passed at startup. Let's promote it to stable and export it for use by drivers via a wrapper. Signed-off-by: David Marchand Acked-by: Andrew Rybchenko --- lib/librte_eal/common/include/rte_log.h | 12 ++++++++---- lib/librte_eal/rte_eal_version.map | 8 +++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index cbb4184..c3aff00 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -209,9 +209,6 @@ int rte_log_cur_msg_logtype(void); int rte_log_register(const char *name); /** - * @warning - * @b EXPERIMENTAL: this API may change without prior notice - * * Register a dynamic log type and try to pick its level from EAL options * * rte_log_register() is called inside. If successful, the function tries @@ -227,9 +224,16 @@ int rte_log_register(const char *name); * - >=0: the newly registered log type * - <0: rte_log_register() error value */ -__rte_experimental int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def); +#define RTE_LOG_REGISTER(token, name, level, fallback) \ +RTE_INIT(token##_init) \ +{ \ + token = rte_log_register_type_and_pick_level(name, level); \ + if (token < 0) \ + token = fallback; \ +} + /** * Dump log information. * diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 7cbf82d..7326e92 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -312,6 +312,13 @@ DPDK_19.08 { } DPDK_19.05; +DPDK_19.11 { + global: + + rte_log_register_type_and_pick_level; + +} DPDK_19.08; + EXPERIMENTAL { global: @@ -342,7 +349,6 @@ EXPERIMENTAL { rte_fbarray_is_used; rte_fbarray_set_free; rte_fbarray_set_used; - rte_log_register_type_and_pick_level; rte_malloc_dump_heaps; rte_mem_alloc_validator_register; rte_mem_alloc_validator_unregister;