From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 12 Jan 2016 00:39:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,556,1444719600"; d="scan'208";a="879590941" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 12 Jan 2016 00:39:45 -0800 Date: Tue, 12 Jan 2016 16:40:43 +0800 From: Yuanhan Liu To: David Marchand 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2 6/7] eal: pci: export pci_map_device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2016 08:39:47 -0000 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: > > 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. Good remind. Thanks. I will export pci_unmap_device as well. > [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. 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