From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D2292A046B
	for <public@inbox.dpdk.org>; Thu, 27 Jun 2019 13:40:57 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7FFD61B9C0;
	Thu, 27 Jun 2019 13:39:42 +0200 (CEST)
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 49B991B9A8
 for <dev@dpdk.org>; Thu, 27 Jun 2019 13:39:35 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 27 Jun 2019 04:39:34 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.63,423,1557212400"; d="scan'208";a="245785852"
Received: from silpixa00399498.ir.intel.com (HELO
 silpixa00399498.ger.corp.intel.com) ([10.237.223.125])
 by orsmga001.jf.intel.com with ESMTP; 27 Jun 2019 04:39:33 -0700
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>, david.marchand@redhat.com,
 thomas@monjalon.net, stephen@networkplumber.org
Date: Thu, 27 Jun 2019 12:39:06 +0100
Message-Id: <53ff24393aaf9e0030f01190cc2ac2d0a77cf38d.1561635481.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <cover.1561635481.git.anatoly.burakov@intel.com>
References: <cover.1561635481.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1561635481.git.anatoly.burakov@intel.com>
References: <cover.1561478388.git.anatoly.burakov@intel.com>
 <cover.1561635481.git.anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH v3 11/14] eal: uninline wait for mcfg complete
	function
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Currently, the function to wait until config completion is
static inline for no reason. Move its implementation to
an EAL common file.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/common/eal_common_mcfg.c | 10 ++++++++++
 lib/librte_eal/common/eal_memcfg.h      | 10 +++-------
 lib/librte_eal/freebsd/eal/eal.c        |  3 ++-
 lib/librte_eal/linux/eal/eal.c          |  2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_mcfg.c b/lib/librte_eal/common/eal_common_mcfg.c
index 337890a61..30969c6bf 100644
--- a/lib/librte_eal/common/eal_common_mcfg.c
+++ b/lib/librte_eal/common/eal_common_mcfg.c
@@ -7,6 +7,16 @@
 
 #include "eal_memcfg.h"
 
+void
+eal_mcfg_wait_complete(void)
+{
+	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+
+	/* wait until shared mem_config finish initialising */
+	while (mcfg->magic != RTE_MAGIC)
+		rte_pause();
+}
+
 void
 rte_mcfg_mem_read_lock(void)
 {
diff --git a/lib/librte_eal/common/eal_memcfg.h b/lib/librte_eal/common/eal_memcfg.h
index 22459a55a..7319d9f7a 100644
--- a/lib/librte_eal/common/eal_memcfg.h
+++ b/lib/librte_eal/common/eal_memcfg.h
@@ -68,12 +68,8 @@ struct rte_mem_config {
 	uint8_t dma_maskbits;
 };
 
-static inline void
-rte_eal_mcfg_wait_complete(struct rte_mem_config *mcfg)
-{
-	/* wait until shared mem_config finish initialising */
-	while (mcfg->magic != RTE_MAGIC)
-		rte_pause();
-}
+/* wait until primary process initialization is complete */
+void
+eal_mcfg_wait_complete(void);
 
 #endif /* EAL_MEMCFG_H */
diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index fac43b017..c102847d1 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -52,6 +52,7 @@
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"
 #include "eal_options.h"
+#include "eal_memcfg.h"
 
 #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
 
@@ -382,7 +383,7 @@ rte_config_init(void)
 	case RTE_PROC_SECONDARY:
 		if (rte_eal_config_attach() < 0)
 			return -1;
-		rte_eal_mcfg_wait_complete(rte_config.mem_config);
+		eal_mcfg_wait_complete();
 		if (rte_eal_config_reattach() < 0)
 			return -1;
 		break;
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 1ab4cc769..6a06628b1 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -505,7 +505,7 @@ rte_config_init(void)
 	case RTE_PROC_SECONDARY:
 		if (rte_eal_config_attach() < 0)
 			return -1;
-		rte_eal_mcfg_wait_complete(rte_config.mem_config);
+		eal_mcfg_wait_complete();
 		if (rte_eal_config_reattach() < 0)
 			return -1;
 		eal_update_internal_config();
-- 
2.17.1