Signed-off-by: Jan Viktorin <viktorin at rehivetech.com> --- 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 <rte_log.h> #include <rte_common.h> #include <rte_devargs.h> +#include <rte_eal.h> #include <rte_soc.h> #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