From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 65CA15F17 for ; Thu, 22 Mar 2018 16:58:44 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id e194so16830696wmd.3 for ; Thu, 22 Mar 2018 08:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5V3XRE2Coz5b+BZiQc7ytCjTjhWB6mcTv0pFZMTgLEw=; b=OWjmYQzYxkGKbUbocI/WBMOP2/xu+0WFGFNourWOfO1TlFbkXC2yfxZJ7XtHCpwfb6 0PoRh4Kd+nFZow/MVdN4+qb6/Zp8UPB3cPL/plaNG0c2B/2xzbYj3BHUxeizwmpN4XnJ 5P53SFvyxgG5bus/nEjDvY3MxqrlBSptPZWPnMhbkTycirSpZzRjs1hllb9/RDpZYP1k exTp+Ved/4U/N0T83s0TcqRKPL+8ARFocmExEzbEpxuDEq00GvG0iM3hECUqJJbkgU3y 3vz6/QSJMIpIVGvIs33aYfWFVS202IYxs60DoxrByJ9IoAfjl5/h2iQfSoCBKwF/4glz RUeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5V3XRE2Coz5b+BZiQc7ytCjTjhWB6mcTv0pFZMTgLEw=; b=SsjIYCnBflR0Na28jxF0u01xDNAlwcP5jFs4S+9Sma+6Fphvr6eC8SrU+cVqknPcm3 9AZ7OLBTWkn1nCX2q4vcm7EYxBFGQhoTJsfof1YdcTVcCPyot2HOlrwTBkxmi66kOXbH N92QaF/fZB6Q5b1Bn4fzPSjbWGKI+G+pvijLoxHk86aw0e6e8OAXzRU640T0onMkKJj8 44U8nzio9Hwt5lh6Xu9yTlhVZk4QG9Dy4ti4DUu7iHadRG3J1cVAOqS8FUbdad0e0zQC fBvLQ0E364AarvXfmZwCcsk6gAWAmNmGZbKABaN5v/cZg7snqXbDAW8I9hMbML7QNMv4 BX4Q== X-Gm-Message-State: AElRT7GD6qHARhFlU2k8goNWoBmsWs1xelI5Wq7FQ13e8d6dwwRrZVXX x5tOKb1KwwsMe2c3YpXMFhqdvjAt X-Google-Smtp-Source: AG47ELulNI1fsItC/aMwx6y6EkcBQivAhSuU5csDXU0sq8uB967ZRGdJP5RHMjp1PEFQ9bqU/oOj9A== X-Received: by 10.28.149.71 with SMTP id x68mr6541455wmd.78.1521734323613; Thu, 22 Mar 2018 08:58:43 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id l16sm13963957wma.41.2018.03.22.08.58.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 08:58:42 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , Neil Horman Date: Thu, 22 Mar 2018 16:58:24 +0100 Message-Id: <20180322155824.30723-1-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180322155643.nrfkxosktvt67gik@bidouze.vm.6wind.com> References: <20180322155643.nrfkxosktvt67gik@bidouze.vm.6wind.com> Subject: [dpdk-dev] [PATCH] eal: list acceptable init priorities 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: , X-List-Received-Date: Thu, 22 Mar 2018 15:58:44 -0000 Build a central list to quickly see each used priorities for constructors, allowing to verify that they are both above 100 and in the proper order. Cc: Neil Horman Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_log.c | 2 +- lib/librte_eal/common/include/rte_bus.h | 2 +- lib/librte_eal/common/include/rte_common.h | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 37b2e20e5..b384c72d3 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -224,7 +224,7 @@ static const struct logtype logtype_strings[] = { }; /* Logging should be first initializer (before drivers and bus) */ -RTE_INIT_PRIO(rte_log_init, 101); +RTE_INIT_PRIO(rte_log_init, LOG); static void rte_log_init(void) { diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 46911afa7..747baf140 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -326,7 +326,7 @@ enum rte_iova_mode rte_bus_get_iommu_class(void); * The constructor has higher priority than PMD constructors. */ #define RTE_REGISTER_BUS(nm, bus) \ -RTE_INIT_PRIO(businitfn_ ##nm, 110); \ +RTE_INIT_PRIO(businitfn_ ##nm, BUS); \ static void businitfn_ ##nm(void) \ {\ (bus).name = RTE_STR(nm);\ diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 500fc3adb..5ff0de08f 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -81,6 +81,12 @@ typedef uint16_t unaligned_uint16_t; */ #define RTE_SET_USED(x) (void)(x) +#define RTE_PRIORITY_LOG 101 +#define RTE_PRIORITY_BUS 110 + +#define RTE_PRIO(prio) \ + RTE_PRIORITY_ ## prio + /** * Run function before main() with low priority. * @@ -102,7 +108,7 @@ static void __attribute__((constructor, used)) func(void) * Lowest number is the first to run. */ #define RTE_INIT_PRIO(func, prio) \ -static void __attribute__((constructor(prio), used)) func(void) +static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void) /** * Run after main() with high priority. -- 2.11.0