From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16]) by dpdk.org (Postfix) with ESMTP id 180325A0F for ; Fri, 6 May 2016 15:50:11 +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 3r1Y7Q647dz7JQ; Fri, 6 May 2016 15:50:10 +0200 (CEST) From: Jan Viktorin To: dev@dpdk.org Cc: Jan Viktorin , David Marchand , Thomas Monjalon , Bruce Richardson , Declan Doherty , jianbo.liu@linaro.org, jerin.jacob@caviumnetworks.com, Keith Wiles , Stephen Hemminger Date: Fri, 6 May 2016 15:48:03 +0200 Message-Id: <1462542490-15556-22-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 21/28] eal/soc: unbind kernel driver on probe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2016 13:50:11 -0000 Signed-off-by: Jan Viktorin --- lib/librte_eal/common/eal_common_soc.c | 6 ++++++ lib/librte_eal/common/eal_private.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/eal_soc.c | 11 +++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c index d178c48..49dbcb8 100644 --- a/lib/librte_eal/common/eal_common_soc.c +++ b/lib/librte_eal/common/eal_common_soc.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "eal_private.h" @@ -124,6 +125,11 @@ rte_eal_soc_probe_one_driver(struct rte_soc_driver *dr, ret = rte_eal_soc_map_device(dev); if (ret) return ret; + } else if (dr->drv_flags & RTE_SOC_DRV_FORCE_UNBIND + && rte_eal_process_type() == RTE_PROC_PRIMARY) { + /* unbind */ + if (soc_unbind_kernel_driver(dev) < 0) + return -1; } dev->driver = dr; diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index fc1d9c6..f1409cf 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -210,6 +210,16 @@ int rte_eal_soc_init(void); */ int soc_update_device(const struct rte_soc_addr *addr); +/** + * Unbind kernel driver for this device + * + * This function is private to EAL. + * + * @return + * 0 on success, negative on error + */ +int soc_unbind_kernel_driver(struct rte_soc_device *dev); + struct rte_pci_driver; struct rte_pci_device; diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c b/lib/librte_eal/linuxapp/eal/eal_soc.c index 6ef7d2f..6e9e242 100644 --- a/lib/librte_eal/linuxapp/eal/eal_soc.c +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c @@ -49,6 +49,17 @@ #include "eal_private.h" int +soc_unbind_kernel_driver(struct rte_soc_device *dev) +{ + char devpath[PATH_MAX]; + + snprintf(devpath, sizeof(devpath), "%s/%s", + soc_get_sysfs_path(), dev->addr.name); + + return rte_eal_unbind_kernel_driver(devpath, dev->addr.name); +} + +int rte_eal_soc_map_device(struct rte_soc_device *dev) { int ret = -1; -- 2.8.0