[dpdk-dev] [PATCH v2 6/7] eal: pci: export pci_map_device

David Marchand david.marchand at 6wind.com
Tue Jan 12 09:31:05 CET 2016


On Tue, Jan 12, 2016 at 7:59 AM, Yuanhan Liu <yuanhan.liu at linux.intel.com>
wrote:

> Normally we could set RTE_PCI_DRV_NEED_MAPPING flag so that eal will
> invoke pci_map_device internally for us. From that point view, there
> is no need to export pci_map_device.
>
> However, for virtio pmd driver, which is designed to work without
> binding UIO (or something similar first), pci_map_device() will fail,
> which ends up with virtio pmd driver being skipped. Therefore, we can
> not set RTE_PCI_DRV_NEED_MAPPING blindly at virtio pmd driver.
>
> Therefore, this patch exports pci_map_device, and let virtio pmd
> call it when necessary.
>

Well, if you introduce map function, I suppose, for hotplug, you would need
unmap.

[snip]

diff --git a/lib/librte_eal/common/include/rte_pci.h
> b/lib/librte_eal/common/include/rte_pci.h
> index 334c12e..e9e1725 100644
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -485,6 +485,17 @@ int rte_eal_pci_read_config(const struct
> rte_pci_device *device,
>   */
>  int rte_eal_pci_write_config(const struct rte_pci_device *device,
>                              const void *buf, size_t len, off_t offset);
> +/**
> + * Map this device
> + *
> + * This function is private to EAL.
> + *
> + * @return
> + *   0 on success, negative on error and positive if no driver
> + *   is found for the device.
> + */
> +int rte_eal_pci_map_device(struct rte_pci_device *dev);
> +
>

If you export it, then this can not be marked as private anymore.
Description could be better (I agree it was not that great before).
And a little comment on when to call: driver should not set
RTE_PCI_DRV_NEED_MAPPING flag if it wants to use it.

The rest looks good to me.

-- 
David Marchand


More information about the dev mailing list