From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: Re: [PATCH v2 6/7] eal: pci: export pci_map_device Date: Tue, 12 Jan 2016 09:31:05 +0100 Message-ID: References: <1449719650-3482-1-git-send-email-yuanhan.liu@linux.intel.com> <1452581944-24838-1-git-send-email-yuanhan.liu@linux.intel.com> <1452581944-24838-7-git-send-email-yuanhan.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "dev@dpdk.org" , "Michael S. Tsirkin" To: Yuanhan Liu Return-path: Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by dpdk.org (Postfix) with ESMTP id D72B6DE6 for ; Tue, 12 Jan 2016 09:31:06 +0100 (CET) Received: by mail-ob0-f178.google.com with SMTP id is5so21083047obc.0 for ; Tue, 12 Jan 2016 00:31:06 -0800 (PST) In-Reply-To: <1452581944-24838-7-git-send-email-yuanhan.liu@linux.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jan 12, 2016 at 7:59 AM, Yuanhan Liu 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