#include <rte_eal.h>
#include <rte_tailq.h>
#include <rte_devargs.h>
+#include <rte_lcore.h>
#include <rte_malloc.h>
#include <rte_errno.h>
#include <rte_memory.h>
#include "private.h"
-int vmbus_logtype_bus;
extern struct rte_vmbus_bus rte_vmbus_bus;
/* map a particular resource from a file */
return false;
}
-
/*
* If device ID match, call the devinit() function of the driver.
*/
VMBUS_LOG(INFO, "VMBUS device %s on NUMA socket %i",
guid, dev->device.numa_node);
- /* TODO add blacklisted */
+ /* TODO add block/allow logic */
/* map resources for device */
ret = rte_vmbus_map_device(dev);
/* reference driver structure */
dev->driver = dr;
- dev->device.driver = &dr->driver;
if (dev->device.numa_node < 0) {
- VMBUS_LOG(WARNING, " Invalid NUMA socket, default to 0");
+ if (rte_socket_count() > 1)
+ VMBUS_LOG(INFO, "Device %s is not NUMA-aware, defaulting socket to 0",
+ guid);
dev->device.numa_node = 0;
}
if (ret) {
dev->driver = NULL;
rte_vmbus_unmap_device(dev);
+ } else {
+ dev->device.driver = &dr->driver;
}
return ret;
}
/*
- * IF device class GUID mathces, call the probe function of
- * registere drivers for the vmbus device.
+ * If device class GUID matches, call the probe function of
+ * register drivers for the vmbus device.
* Return -1 if initialization failed,
* and 1 if no driver found for this device.
*/
int rc;
/* Check if a driver is already loaded */
- if (dev->driver != NULL) {
+ if (rte_dev_is_probed(&dev->device)) {
VMBUS_LOG(DEBUG, "VMBUS driver already loaded");
return 0;
}
rte_uuid_unparse(dev->device_id, ubuf, sizeof(ubuf));
- /* TODO: add whitelist/blacklist */
+ /* TODO: add allowlist/blocklist */
if (vmbus_probe_all_drivers(dev) < 0) {
VMBUS_LOG(NOTICE,
return ret;
}
+/*
+ * scan for matching device args on command line
+ * example:
+ * -a 'vmbus:635a7ae3-091e-4410-ad59-667c4f8c04c3,latency=20'
+ */
+struct rte_devargs *
+vmbus_devargs_lookup(struct rte_vmbus_device *dev)
+{
+ struct rte_devargs *devargs;
+ rte_uuid_t addr;
+
+ RTE_EAL_DEVARGS_FOREACH("vmbus", devargs) {
+ vmbus_parse(devargs->name, &addr);
+
+ if (rte_uuid_compare(dev->device_id, addr) == 0)
+ return devargs;
+ }
+ return NULL;
+
+}
+
/* register vmbus driver */
void
rte_vmbus_register(struct rte_vmbus_driver *driver)
};
RTE_REGISTER_BUS(vmbus, rte_vmbus_bus.bus);
-
-RTE_INIT(vmbus_init_log)
-{
- vmbus_logtype_bus = rte_log_register("bus.vmbus");
- if (vmbus_logtype_bus >= 0)
- rte_log_set_level(vmbus_logtype_bus, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER_DEFAULT(vmbus_logtype_bus, NOTICE);