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 E027F559C for ; Fri, 6 May 2016 15:50:09 +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 3r1Y7P5H5Tz7FP; Fri, 6 May 2016 15:50:09 +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:47:55 +0200 Message-Id: <1462542490-15556-14-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 13/28] eal/soc: update device on probe when already exists 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:10 -0000 Signed-off-by: Jan Viktorin --- lib/librte_eal/common/eal_common_soc.c | 5 +++++ lib/librte_eal/common/eal_private.h | 13 +++++++++++++ lib/librte_eal/linuxapp/eal/eal_soc.c | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/lib/librte_eal/common/eal_common_soc.c b/lib/librte_eal/common/eal_common_soc.c index 3b885e8..75a7a97 100644 --- a/lib/librte_eal/common/eal_common_soc.c +++ b/lib/librte_eal/common/eal_common_soc.c @@ -242,6 +242,11 @@ rte_eal_soc_probe_one(const struct rte_soc_addr *addr) if (addr == NULL) return -1; + /* update current SoC device in global list, kernel bindings might have + * changed since last time we looked at it */ + if (soc_update_device(addr) < 0) + goto err_return; + TAILQ_FOREACH(dev, &soc_device_list, next) { if (rte_eal_compare_soc_addr(&dev->addr, addr)) continue; diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index b27ec89..fc1d9c6 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -197,6 +197,19 @@ struct rte_soc_device; */ int rte_eal_soc_init(void); +/** + * Update a soc device object by asking the kernel for the latest information. + * + * This function is private to EAL. + * + * @param addr + * The SoC address to look for + * @return + * - 0 on success. + * - negative on error. + */ +int soc_update_device(const struct rte_soc_addr *addr); + 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 a3b9935..742d80d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_soc.c +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c @@ -252,6 +252,17 @@ fail: } int +soc_update_device(const struct rte_soc_addr *addr) +{ + char filename[PATH_MAX]; + + snprintf(filename, sizeof(filename), "%s/%s", + soc_get_sysfs_path(), addr->name); + + return soc_scan_one(filename, addr->name); +} + +int rte_eal_soc_scan(void) { struct dirent *e; -- 2.8.0