From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 31D5F2BE1 for ; Fri, 30 Jun 2017 21:05:48 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id u23so9516397wma.2 for ; Fri, 30 Jun 2017 12:05:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=JdSKYPUeNQUVvK6sd2L4Qmon/pf/VL0j1VSxU1eOWRM=; b=DIXzGo1z93tXJcCyOTikNQ3CE+etrjyuZvbR26Lbo+RyB6OfDl8/llFK3Qj56uvgSD FIFTJgnG6UmApR5fzdOSt+ZoKEJRx9hk+wQfCzILKpLCfUUsgaqWyp+p8+MC1PcJ3zIn RRdwiudjWHLGcmwe5NLwgFJn+MDsrOLvwBvM4X/UwqMArYhSRqJ6NS9A/OGDBnIITpKL p046mjqwfV+6XwdRxxaVezQfIixSYSe78nu+hOgUnKizIm5K8Z4OBiVuerCRmeVcnrla tfhq9ZRCMDz5xujUWREwUzhlbKocFCPosO8eF8qViMj95vAU5yThtJlwEmvOFHxQG5ZP FfWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=JdSKYPUeNQUVvK6sd2L4Qmon/pf/VL0j1VSxU1eOWRM=; b=bcpRapJUW2lwwIF/YI127GWTRgLrsyBCFAn4/MCXVRJM0XizpGw+0TTZ4wpaaJ8kWe /bOrVIUU1FwhfYxPb+WAFtDYVF6KDKzf7p5ci6vopvgPSQ1mqryd6LLQcahLgBFPIp5w 6aMVYEt1nZEtJKjo6DWlpjcD9+uuiwUqRBqm6cCYt5jbV4l0/Icbo58g+zi+uRYrj+K8 +lcmRE42OgC9QL5Nrdc7+7ZRa11JssIXarrF+oL4jysEaFYZEKx6AIDUtDrwCUMa0zra RSTfoB9XKUXpnbBBuxM9VoTwatYMHdSgZwNdUIsfm4glEwOkKcAPo2VVIj5/jDIfcmvi OAAw== X-Gm-Message-State: AKS2vOy6RnjQ0obySeA87pDw5p1vzSNwnNndBjOfHp08iXs/YmiCxPEw qOPXwXQdm8XZWSOL+D546+mvVhF28WuA X-Received: by 10.28.232.29 with SMTP id f29mr6290700wmh.55.1498849547691; Fri, 30 Jun 2017 12:05:47 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.5.136 with HTTP; Fri, 30 Jun 2017 12:05:47 -0700 (PDT) In-Reply-To: <138ba842ce615de6a6895f0ca74b5645aad48ad9.1496308649.git.gaetan.rivet@6wind.com> References: <138ba842ce615de6a6895f0ca74b5645aad48ad9.1496308649.git.gaetan.rivet@6wind.com> From: Jan Blunck Date: Fri, 30 Jun 2017 21:05:47 +0200 X-Google-Sender-Auth: zQ08z8r_0qlMBZF6ZGsZmkvH7gs Message-ID: To: Gaetan Rivet , Olivier MATZ Cc: dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/8] eal: expose rte_eal_using_phys_addrs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jun 2017 19:05:48 -0000 On Thu, Jun 1, 2017 at 12:14 PM, Gaetan Rivet wrote: > This function was previously private to the EAL layer. > Other subsystems requires it, such as the PCI bus. > > This function is only exposed for linuxapps. > > In order not to force other components to include stdbool, which is > incompatible with several NIC drivers, the return type has > been changed from bool to int. > > Signed-off-by: Gaetan Rivet > --- > lib/librte_eal/common/eal_private.h | 11 ----- > lib/librte_eal/linuxapp/eal/Makefile | 2 + > lib/librte_eal/linuxapp/eal/eal_memory.c | 3 +- > lib/librte_eal/linuxapp/eal/eal_pci.c | 1 + > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + > lib/librte_eal/linuxapp/eal/rte_memory_linux.h | 64 +++++++++++++++++++++++++ > 6 files changed, 70 insertions(+), 12 deletions(-) > create mode 100644 lib/librte_eal/linuxapp/eal/rte_memory_linux.h > > diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h > index 6d2206a..b7e4cc6 100644 > --- a/lib/librte_eal/common/eal_private.h > +++ b/lib/librte_eal/common/eal_private.h > @@ -327,17 +327,6 @@ int rte_eal_hugepage_init(void); > */ > int rte_eal_hugepage_attach(void); > > -/** > - * Returns true if the system is able to obtain > - * physical addresses. Return false if using DMA > - * addresses through an IOMMU. > - * > - * Drivers based on uio will not load unless physical > - * addresses are obtainable. It is only possible to get > - * physical addresses when running as a privileged user. > - */ > -bool rte_eal_using_phys_addrs(void); > - > /* > * Validate a bus name. > * > diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile > index 640afd0..530e286 100644 > --- a/lib/librte_eal/linuxapp/eal/Makefile > +++ b/lib/librte_eal/linuxapp/eal/Makefile > @@ -131,4 +131,6 @@ INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h > SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \ > $(addprefix include/exec-env/,$(INC)) > > +SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include += rte_memory_linux.h > + > include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c > index ebe0683..072bfe4 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -99,6 +99,7 @@ > #include "eal_internal_cfg.h" > #include "eal_filesystem.h" > #include "eal_hugepages.h" > +#include "rte_memory_linux.h" > > #define PFN_MASK_SIZE 8 > > @@ -1472,7 +1473,7 @@ rte_eal_hugepage_attach(void) > return -1; > } > > -bool > +int > rte_eal_using_phys_addrs(void) > { > return phys_addrs_available; > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index 595622b..9d5b051 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -45,6 +45,7 @@ > #include "eal_filesystem.h" > #include "eal_private.h" > #include "eal_pci_init.h" > +#include "rte_memory_linux.h" > > /** > * @file > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > index a5127d6..8916520 100644 > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > @@ -207,5 +207,6 @@ DPDK_17.08 { > > rte_bus_from_name; > rte_bus_from_dev; > + rte_eal_using_phys_addrs; Is this only for the UIO mapping? Would it be better to let UIO skip (and warn?) over RTE_BAD_PHYS_ADDR mappings? That way we don't need this export and its probably more resilient to bad mappings. Thoughts? Olivier? > > } DPDK_17.05; > diff --git a/lib/librte_eal/linuxapp/eal/rte_memory_linux.h b/lib/librte_eal/linuxapp/eal/rte_memory_linux.h > new file mode 100644 > index 0000000..0400711 > --- /dev/null > +++ b/lib/librte_eal/linuxapp/eal/rte_memory_linux.h > @@ -0,0 +1,64 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 6WIND S.A. All rights reserved. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of 6WIND nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#ifndef _RTE_MEMORY_LINUX_H_ > +#define _RTE_MEMORY_LINUX_H_ > + > +/** > + * @file > + * > + * Memory-related Linux-specific RTE API. > + */ > + > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * Drivers based on uio will not load unless physical > + * addresses are obtainable. It is only possible to get > + * physical addresses when running as a privileged user. > + * > + * @return > + * 1 if the system is able to obtain physical addresses. > + * 0 if using DMA addresses through an IOMMU. > + */ > +int rte_eal_using_phys_addrs(void); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_MEMORY_LINUX_H_ */ > -- > 2.1.4 >