To support a generic manipulation with devices we need to have a general representation of the rte_*_addr which replaces the rte_pci_addr in the code. Here we introduce the rte_bus_addr consisting of a union of various rte_*_addr fields and the device magic to discriminate among them.
A wrapper around rte_eal_compare_pci_addr is introduced and it will be extended while adding a new non-PCI infra. Signed-off-by: Jan Viktorin <viktorin at rehivetech.com> --- lib/librte_eal/common/include/rte_dev.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index c99d038..48c46fd 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -161,6 +161,23 @@ union rte_device { } /** + * Generic bus address of a device. + */ +struct rte_bus_addr { + union { + struct rte_pci_addr pci; + }; + unsigned int dev_magic; +}; + +static inline int +rte_eal_compare_bus_addr(const struct rte_bus_addr *a, + const struct rte_bus_addr *b) +{ + return rte_eal_compare_pci_addr(&a->pci, &b->pci); +} + +/** * Register a device driver. * * @param driver -- 2.6.3