From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 817787D1C for ; Fri, 25 Aug 2017 11:04:52 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id b189so6983507wmd.0 for ; Fri, 25 Aug 2017 02:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=sBBJLN3IaWBFwmvswcuQESiPet0D4or84wJ2+TNvoOs=; b=uarTWM+rtiNKlYgomX04OMwQXEUajP0QY2Buzn12F2TGVJ0LEfUwDGC9sIuHqtyw/3 z8SYVt4P2daI18eWsIMg4rU4NRATFFs4SvWWxznmqx72ItTLp2wNVbz4g2DMQm6gOfxG vmxeAIUkmJFTgWMRnbpYBxlvCuUUDVNaodXcvmohk8Bc2uTigTh971iNV59bqjwgP1ZQ FIPXBjcxN0NT/mS98gMqfGyBthLRDFBiCnYTKFv+YEf2JBSdijJzDrCCQmU6X+Qh6F4i wC2eGw1CeDXQvgp1UGCU4dm3WtBr0t8ophg3DtmuuWNISUIdKV+HhvJUiWMy6YjLf4X/ rDlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=sBBJLN3IaWBFwmvswcuQESiPet0D4or84wJ2+TNvoOs=; b=Cng8dWPWnTzPC34ztSOtj2pMVlMjQM6tC9MTQ3aLY6BAZjDeBGyfMlgL76iSb0gQCG KwhVuWPn+MVbw9961fCzf6vcEva6TT0ni2Xvk42S35aDrxnWALP1iSmfB2/hpY7uTPzM AT0YmNeaN3Z25c5YZzbkVYA1xJ2X8Dz5TuK8EZiqUIUpHSXAQBpTNy50VIGr5My1N/S7 qDMNoUFpMSvA4tYWQOnCfyBppDLtOqvRsMmw3c/e3os/OGBlk3OB/vMStDNQp0j4wMPA +RmGPfRedy26Nt0FldcD/NaGzIpquCfYzO5h6OA2LqfHVjl155J3h6xol6eBUpBH2tV/ JYXw== X-Gm-Message-State: AHYfb5hytyh3ld19qURjkuerQoVfYx9WgNe5k61uOFoE2fuXlhP7zqYw PNlecrC14Ah+aR35TKg= X-Received: by 10.28.172.4 with SMTP id v4mr790758wme.72.1503651891597; Fri, 25 Aug 2017 02:04:51 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id q141sm782350wmb.11.2017.08.25.02.04.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Aug 2017 02:04:50 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Fri, 25 Aug 2017 11:04:23 +0200 Message-Id: <3312a5ecfba777436f60dbc6476851abb0c6f9d8.1503651392.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 01/13] 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, 25 Aug 2017 09:04:52 -0000 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 597d82e..10a7078 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -333,17 +333,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); - -/** * Find a bus capable of identifying a device. * * @param str diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 90bca4d..ad7e34a 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -135,4 +135,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 5279128..6639670 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -72,6 +72,7 @@ #include "eal_internal_cfg.h" #include "eal_filesystem.h" #include "eal_hugepages.h" +#include "rte_memory_linux.h" #define PFN_MASK_SIZE 8 @@ -1542,7 +1543,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 8951ce7..8f658d6 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 3a8f154..5cfd934 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -206,6 +206,7 @@ DPDK_17.08 { rte_bus_find_by_device; rte_bus_find_by_name; rte_log_get_level; + rte_eal_using_phys_addrs; } 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