Signed-off-by: Jan Blunck <jblu...@infradead.org> --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/eal_common_bus.c | 16 ++++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 9 +++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 4 files changed, 27 insertions(+)
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 381f895cd..82f64c386 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -206,6 +206,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_bus_configure; rte_eal_devargs_parse; rte_eal_hotplug_add; rte_eal_hotplug_remove; diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 08bec2d93..f5368a486 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -64,6 +64,22 @@ rte_bus_unregister(struct rte_bus *bus) RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name); } +int rte_bus_configure(struct rte_bus *bus, const struct rte_bus_conf *conf) +{ + if (bus == NULL) + return -1; + + /* only set bus scan policy if it was unset before */ + if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { + RTE_LOG(DEBUG, EAL, "Bus [%s] scan_mode=%d\n", bus->name, + conf->scan_mode); + bus->conf.scan_mode = conf->scan_mode; + } else if (bus->conf.scan_mode != conf->scan_mode) + return -1; + + return 0; +} + /* Scan all the buses for registered devices */ int rte_bus_scan(void) diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index af9f0e13f..ff67e6e93 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -206,6 +206,15 @@ void rte_bus_register(struct rte_bus *bus); void rte_bus_unregister(struct rte_bus *bus); /** + * Configure a Bus instance. + * + * @param bus + * A pointer to a rte_bus structure describing the bus + * to be configured. + */ +int rte_bus_configure(struct rte_bus *bus, const struct rte_bus_conf *conf); + +/** * Scan all the buses. * * @return diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 0f9e009b6..8b8c382a7 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -211,6 +211,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_bus_configure; rte_eal_devargs_parse; rte_eal_hotplug_add; rte_eal_hotplug_remove; -- 2.13.2