From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iCVMLpLuf8qjMLx/KnxAQ3NtxdS9EtJ0ebLDZNwz2KI=; b=FtjoY7rvQW7FD/Ic+MLjN/Xoyl1gAXIETLRPP5orW4RfQGN8dO6vt29qMqIb1fQJSP IfIL3tNtPvEzOQ/fb/7ySoFmzRCsMoO8/J//hFLcjSH6kG7If7Bp51DSJIt4PZEvdNmH N8+nkJ2W7sYnpA16BCBLGU4bet4vzg3UyHM9Q4x3DqEStiW66dC9RByl4HPZMLKLdHWc 55EeLRxOWzQfRti6mCR/AKd5RWeAzgo2PNFu4sYn1hkMpCMFTtgAz1uyoS4TmIIr//UI D7jPpts0Jv2xa+an9jIwOUBCuM4UAUME692t66G5YYtzNqVExEaWmv/4Vlavj059r9Ej FsSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=iCVMLpLuf8qjMLx/KnxAQ3NtxdS9EtJ0ebLDZNwz2KI=; b=Z8/Ej+sqOrwY5DD4bYCTtKzqFRbDkX/oZBMnwkcap9MIOHx1FCJuT/5VUqAvHA1QFn npbGh9ta8vtZHPHWMkQ7w1Qc96Ejo3buoyNJ5FvR9Oq4yb1/mHmNQE0svfYCSDg1qG6e dhhFjCApd82fM5k5l8GwsD4ZYf6YPdXByJRuWZyfYLWhxqGkvSbodlCDRtJf9jn9dwbD Ze4fkj6eROAzQLK6l00xRkXOIkd10Wue63rG3jKDZZ1oJwl//+Zyhk3/60pPm/Jtp+PO EZJ1OJKccRDTEZ/nXwNqmo8u/BJr1cQr2vy+u65+XxP/FAhbJhWdMhKZYDuY6OO3sAFV Xo2w== X-Gm-Message-State: ALoCoQnPVgdbxC30e/sWWmSfsoXYzHviOemZkItNnYJyFdN2qjxyazTSGMSnp9TryFs8sxrplBNJ17IwtGrLngjJ9jKsSkI0OCSVtxJH3yISB/eSTIIzQmU= MIME-Version: 1.0 X-Received: by 10.60.83.241 with SMTP id t17mr99435420oey.72.1452587466199; Tue, 12 Jan 2016 00:31:06 -0800 (PST) Received: by 10.76.180.72 with HTTP; Tue, 12 Jan 2016 00:31:05 -0800 (PST) In-Reply-To: <1452581944-24838-7-git-send-email-yuanhan.liu@linux.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> Date: Tue, 12 Jan 2016 09:31:05 +0100 Message-ID: From: David Marchand To: Yuanhan Liu Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" , "Michael S. Tsirkin" 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:31:07 -0000 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