Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
---
 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

Reply via email to