From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 6/7] eal: pci: export pci_map_device Date: Tue, 12 Jan 2016 16:40:43 +0800 Message-ID: <20160112084043.GR26062@yliu-dev.sh.intel.com> 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=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: David Marchand Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C7D018DB3 for ; Tue, 12 Jan 2016 09:39:46 +0100 (CET) Content-Disposition: inline In-Reply-To: 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 09:31:05AM +0100, David Marchand wrote: > On Tue, Jan 12, 2016 at 7:59 AM, Yuanhan Liu > wrote: >=20 > Normally we could set RTE_PCI_DRV_NEED_MAPPING flag so that eal wil= l > invoke pci_map_device internally for us. From that point view, ther= e > is no need to export pci_map_device. >=20 > However, for virtio pmd driver, which is designed to work without > binding UIO (or something similar first), pci_map_device() will fai= l, > which ends up with virtio pmd driver being skipped. Therefore, we c= an > not set RTE_PCI_DRV_NEED_MAPPING blindly at virtio pmd driver. >=20 > Therefore, this patch exports pci_map_device, and let virtio pmd > call it when necessary. >=20 >=20 > Well, if you introduce map function, I suppose, for hotplug, you would = need > unmap. Good remind. Thanks. I will export pci_unmap_device as well. > [snip] >=20 >=20 > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_e= al/ > 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, > =A0 */ > =A0int rte_eal_pci_write_config(const struct rte_pci_device *device= , > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const vo= id *buf, size_t len, off_t offset); > +/** > + * Map this device > + * > + * This function is private to EAL. > + * > + * @return > + *=A0 =A00 on success, negative on error and positive if no driver > + *=A0 =A0is found for the device. > + */ > +int rte_eal_pci_map_device(struct rte_pci_device *dev); > + >=20 >=20 > If you export it, then this can not be marked as private anymore. Oops, a silly C&P error. Will fix it. > 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. Good suggestion. > The rest looks good to me. Thanks. --yliu