net/ice/base: introduce and use for each bit iterator
[dpdk.git] / drivers / bus / vmbus / vmbus_common.c
index c7165ad..4c9ac33 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "private.h"
 
-int vmbus_logtype_bus;
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
 /* map a particular resource from a file */
@@ -85,7 +84,6 @@ vmbus_match(const struct rte_vmbus_driver *dr,
 
        return false;
 }
-
 /*
  * If device ID match, call the devinit() function of the driver.
  */
@@ -112,7 +110,6 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
 
        /* 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");
@@ -125,13 +122,15 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr,
        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
+ * If device class GUID matches, call the probe function of
  * registere drivers for the vmbus device.
  * Return -1 if initialization failed,
  * and 1 if no driver found for this device.
@@ -143,7 +142,7 @@ vmbus_probe_all_drivers(struct rte_vmbus_device *dev)
        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;
        }
@@ -204,6 +203,27 @@ vmbus_parse(const char *name, void *addr)
        return ret;
 }
 
+/*
+ * scan for matching device args on command line
+ * example:
+ *     -w '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)
@@ -277,10 +297,4 @@ struct rte_vmbus_bus rte_vmbus_bus = {
 };
 
 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(vmbus_logtype_bus, bus.vmbus, NOTICE);