Signed-off-by: Jan Viktorin <viktorin at rehivetech.com> --- lib/librte_eal/bsdapp/eal/eal.c | 4 ++++ lib/librte_eal/common/eal_private.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 3 +++ lib/librte_eal/linuxapp/eal/eal_soc.c | 17 +++++++++++++++++ 4 files changed, 34 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 06bfd4e..23faebd 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -64,6 +64,7 @@ #include <rte_string_fns.h> #include <rte_cpuflags.h> #include <rte_interrupts.h> +#include <rte_soc.h> #include <rte_pci.h> #include <rte_dev.h> #include <rte_devargs.h> @@ -567,6 +568,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_init() < 0) rte_panic("Cannot init PCI\n"); + if (rte_eal_soc_init() < 0) + rte_panic("Cannot init SoC\n"); + eal_check_mem_on_local_socket(); if (eal_plugins_init() < 0) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 5145215..b27ec89 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -187,6 +187,16 @@ int rte_eal_ivshmem_obj_init(void); struct rte_soc_driver; struct rte_soc_device; +/** + * Init the SoC infra. + * + * This function is private to EAL. + * + * @return + * 0 on success, negative on error + */ +int rte_eal_soc_init(void); + struct rte_pci_driver; struct rte_pci_device; diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index a9f3ae2..5f190ff 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -803,6 +803,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_init() < 0) rte_panic("Cannot init PCI\n"); + if (rte_eal_soc_init() < 0) + rte_panic("Cannot init SoC\n"); + #ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_init() < 0) rte_panic("Cannot init IVSHMEM\n"); diff --git a/lib/librte_eal/linuxapp/eal/eal_soc.c b/lib/librte_eal/linuxapp/eal/eal_soc.c index 8dbb367..a3b9935 100644 --- a/lib/librte_eal/linuxapp/eal/eal_soc.c +++ b/lib/librte_eal/linuxapp/eal/eal_soc.c @@ -44,6 +44,7 @@ #include <rte_log.h> #include <rte_soc.h> +#include "eal_internal_cfg.h" #include "eal_private.h" static char * @@ -280,3 +281,19 @@ error: closedir(dir); return -1; } + +/* Init the SoC EAL subsystem */ +int +rte_eal_soc_init(void) +{ + /* for debug purposes, SoC can be disabled */ + if (internal_config.no_soc) + return 0; + + if (rte_eal_soc_scan() < 0) { + RTE_LOG(ERR, EAL, "%s(): Cannot scan SoC devices\n", __func__); + return -1; + } + + return 0; +} -- 2.8.0