From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <viktorin@rehivetech.com>
Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16])
 by dpdk.org (Postfix) with ESMTP id DB4525962
 for <dev@dpdk.org>; Fri,  6 May 2016 15:50:10 +0200 (CEST)
Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz
 [147.229.13.147])
 by wes1-so2.wedos.net (Postfix) with ESMTPSA id 3r1Y7Q55pMz7JP;
 Fri,  6 May 2016 15:50:10 +0200 (CEST)
From: Jan Viktorin <viktorin@rehivetech.com>
To: dev@dpdk.org
Cc: Jan Viktorin <viktorin@rehivetech.com>,
 David Marchand <david.marchand@6wind.com>,
 Thomas Monjalon <thomas.monjalon@6wind.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Declan Doherty <declan.doherty@intel.com>, jianbo.liu@linaro.org,
 jerin.jacob@caviumnetworks.com, Keith Wiles <keith.wiles@intel.com>,
 Stephen Hemminger <stephen@networkplumber.org>
Date: Fri,  6 May 2016 15:48:02 +0200
Message-Id: <1462542490-15556-21-git-send-email-viktorin@rehivetech.com>
X-Mailer: git-send-email 2.8.0
In-Reply-To: <1462542490-15556-1-git-send-email-viktorin@rehivetech.com>
References: <1462542490-15556-1-git-send-email-viktorin@rehivetech.com>
In-Reply-To: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com>
References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com>
Subject: [dpdk-dev] [PATCH v1 20/28] eal/soc: map resources conditionally
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 06 May 2016 13:50:11 -0000

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
 lib/librte_eal/common/eal_common_soc.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c
index af4daa5..d178c48 100644
--- a/lib/librte_eal/common/eal_common_soc.c
+++ b/lib/librte_eal/common/eal_common_soc.c
@@ -119,10 +119,12 @@ rte_eal_soc_probe_one_driver(struct rte_soc_driver *dr,
 		return 1;
 	}
 
-	/* map resources */
-	ret = rte_eal_soc_map_device(dev);
-	if (ret)
-		return ret;
+	if (dr->drv_flags & RTE_SOC_DRV_NEED_MAPPING) {
+		/* map resources */
+		ret = rte_eal_soc_map_device(dev);
+		if (ret)
+			return ret;
+	}
 
 	dev->driver = dr;
 	RTE_VERIFY(dr->devinit != NULL);
@@ -173,8 +175,10 @@ rte_eal_soc_detach_dev(struct rte_soc_driver *dr,
 	/* clear driver structure */
 	dev->driver = NULL;
 
-	/* unmap resources for devices */
-	rte_eal_soc_unmap_device(dev);
+	if (dr->drv_flags & RTE_SOC_DRV_NEED_MAPPING)
+		/* unmap resources for devices */
+		rte_eal_soc_unmap_device(dev);
+
 	return 0;
 }
 
-- 
2.8.0