From: Gaetan Rivet Date: Fri, 7 Jul 2017 00:03:10 +0000 (+0200) Subject: bus/pci: implement parse bus operation X-Git-Tag: spdx-start~2566 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=595876836932ce45c3a47cb17892f4851eb5f7b8;p=dpdk.git bus/pci: implement parse bus operation Signed-off-by: Gaetan Rivet Acked-by: Bruce Richardson --- diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index f3830a142a..1d3eaedef6 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -448,6 +448,20 @@ rte_pci_dump(FILE *f) } } +static int +pci_parse(const char *name, void *addr) +{ + struct rte_pci_addr *out = addr; + struct rte_pci_addr pci_addr; + bool parse; + + parse = (eal_parse_pci_BDF(name, &pci_addr) == 0 || + eal_parse_pci_DomBDF(name, &pci_addr) == 0); + if (parse && addr != NULL) + *out = pci_addr; + return parse == false; +} + /* register a driver */ void rte_pci_register(struct rte_pci_driver *driver) @@ -542,6 +556,7 @@ struct rte_pci_bus rte_pci_bus = { .find_device = pci_find_device, .plug = pci_plug, .unplug = pci_unplug, + .parse = pci_parse, }, .device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list), .driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),