[dpdk-dev] [PATCH v4 18/23] ethdev: Helper to map to struct rte_pci_device

Jan Blunck jblunck at infradead.org
Thu Dec 22 19:13:24 CET 2016


On Thu, Dec 22, 2016 at 4:21 PM, Thomas Monjalon
<thomas.monjalon at 6wind.com> wrote:
> 2016-12-21 16:09, Jan Blunck:
>> PCI drivers could use this helper instead of directly accessing fields of
>> rte_eth_dev to map to rte_pci_device.
> [...]
>> +/**
>> + * @internal
>> + * Helper for drivers that need to convert from rte_eth_dev to rte_pci_device.
>> + */
>> +static inline struct rte_pci_device *__attribute__((always_inline))
>> +rte_eth_dev_to_pci(struct rte_eth_dev *eth_dev)
>> +{
>> +     return eth_dev->pci_dev;
>> +}
>
> Why adding this function instead of just using DEV_PCI_DEV(eth_dev->device)?
>
> I think we must try to avoid any PCI (or other bus) reference inside ethdev.h.

David requested to move it from rte_pci.h to rte_ethdev.h.

It could get forward declared here if one doesn't use it. On the other
hand the rte_pci.h would be required to include rte_ethdev.h if we
move it.


More information about the dev mailing list