Re: [PATCH v5 4/7] pci: implement parse bus operation
From: Bruce Richardson <hidden>
Date: 2017-06-27 16:18:29
On Wed, Jun 21, 2017 at 01:30:33AM +0200, Gaetan Rivet wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Gaetan Rivet <redacted> --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/common/eal_common_bus.c | 16 ++++++++++++++++ lib/librte_eal/common/eal_common_pci.c | 19 +++++++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 14 ++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 5 files changed, 63 insertions(+)diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 150b0f7..3517d74 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map@@ -197,3 +197,10 @@ DPDK_17.05 { vfio_get_group_no; } DPDK_17.02; + +DPDK_17.08 { + global: + + rte_bus_from_name; + +} DPDK_17.05;diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index b6bf57e..e69ce38 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c@@ -215,3 +215,19 @@ rte_bus_find_device(const struct rte_device *start, } return dev; } + +static int +bus_cmp_name(const struct rte_bus *bus, const void *_name) +{ + const char *name = _name; + + return strncmp(bus->name, name, + strlen(bus->name)); +} + +/* find a bus by its name */ +struct rte_bus * +rte_bus_from_name(const char *str) +{ + return rte_bus_find(bus_cmp_name, str, NULL); +}
I think the rte_bus_from_name changes should go in a separate patch, as they are not part of the PCI changes. Content-wise, it looks good though, so keep my ack on both patches if split. Acked-by: Bruce Richardson <redacted>