doc: add DPAA2 eventdev to release notes
[dpdk.git] / lib / librte_eal / common / eal_common_bus.c
index 997009d..08bec2d 100644 (file)
@@ -1,8 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2016 NXP
- *   All rights reserved.
+ *   Copyright 2016 NXP.
  *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
@@ -92,7 +91,7 @@ rte_bus_probe(void)
        struct rte_bus *bus, *vbus = NULL;
 
        TAILQ_FOREACH(bus, &rte_bus_list, next) {
-               if (!strcmp(bus->name, "virtual")) {
+               if (!strcmp(bus->name, "vdev")) {
                        vbus = bus;
                        continue;
                }
@@ -202,3 +201,24 @@ rte_bus_find_by_name(const char *busname)
 {
        return rte_bus_find(NULL, cmp_bus_name, (const void *)busname);
 }
+
+static int
+bus_can_parse(const struct rte_bus *bus, const void *_name)
+{
+       const char *name = _name;
+
+       return !(bus->parse && bus->parse(name, NULL) == 0);
+}
+
+struct rte_bus *
+rte_bus_find_by_device_name(const char *str)
+{
+       char name[RTE_DEV_NAME_MAX_LEN];
+       char *c;
+
+       snprintf(name, sizeof(name), "%s", str);
+       c = strchr(name, ',');
+       if (c != NULL)
+               c[0] = '\0';
+       return rte_bus_find(NULL, bus_can_parse, name);
+}