From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id EADB57CE2 for ; Mon, 18 Sep 2017 11:32:04 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id e71so848778wmg.4 for ; Mon, 18 Sep 2017 02:32:04 -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=YdEPUpELB3tOMFA7aZfbMkW0wJByXUgt02N9aNk9O98=; b=J2wTCrALqNnuOwp27sY44tlJG/xwpmoWnSUi41xPiPljBEabr/CwIl0VAiOvJh/6xt 1nT2dWX0DRvWSqV0wOQQhTeLJ4imdFO5vU3ozZSv04PVBHxYFJ4r8WGkKMBsPCf0x0yB dNJuDAZxlgVn8VrIX7SlhoiBTBPlj27RfrWfXBGkY4R8N+vT9qg5pnq9FBTOj1/ooP8w c12gCYHgV1dLM6Z0fZ6cOXFzaECjA8+dK5va7clZF7ixHMuypNswOTi3FRF01431jxVy 4SRkqdZ10Y9xmXb56h4cNTUP4rb/dOf/TSgtMyhQCUKNc0l8TYFFvkW7VjVMsC2dPd18 Wsyg== 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=YdEPUpELB3tOMFA7aZfbMkW0wJByXUgt02N9aNk9O98=; b=dDn6G+jfDBAQIDtAKWxJkXHNH4lmTOza0uc9CqdyDz0+7TCeyzQBN4cMqYLpiXqFKC OulaU7TFAbjPgbwgVf7qLy1GgNzIKqpUy4KQP2jXDxuZeD+cvMYQSTtVnvlSUJxXO+tB 807pzB5cBcHMwHHbDb6dkpxv+X7zf9x9dQSw9sTdCogfP1q62JMSFLCsYH1Gid6tnz5F 8GyEY2SY9EFn/HJ7gORYHxla1JxzOrOmkj+m3Mek9R5LzngP4ETtEkfb3jSR15shOUkn sR6R22IcqfquDmGCt72Nxh9JE91QzCQw6E4rG8WZKrj4VJVg4NooljygWOKmA6sAQlD7 aYWw== X-Gm-Message-State: AHPjjUh1Jujpv2Oepw2uhh2VnJ/9l4fsdp/hsWBBEL7VG28M+lsKg8PC DvPVZAtuh6z64iPqbYI= X-Google-Smtp-Source: AOwi7QB3Y/k9NxCi1z/kGeoRhyyNTPyzsdePn9ii087KpcBXMSabD1Ouhs3rFCR9NUJwdlvp63sVJQ== X-Received: by 10.28.109.78 with SMTP id i75mr8573384wmc.117.1505727124046; Mon, 18 Sep 2017 02:32:04 -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 f89sm6416859wmh.18.2017.09.18.02.32.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 02:32:03 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 18 Sep 2017 11:31:35 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 01/14] 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: Mon, 18 Sep 2017 09:32:05 -0000 This function was previously private to the EAL layer. Other subsystems requires it, such as the PCI bus. 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/bsdapp/eal/eal_memory.c | 6 ++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/eal_private.h | 11 ----------- lib/librte_eal/common/include/rte_memory.h | 11 +++++++++++ lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 3614da8..65c96b0 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -192,3 +192,9 @@ rte_eal_hugepage_attach(void) close(fd_hugepage); return -1; } + +int +rte_eal_using_phys_addrs(void) +{ + return 0; +} diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 47a09ea..cff7d18 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -200,6 +200,7 @@ DPDK_17.08 { rte_bus_find; rte_bus_find_by_device; rte_bus_find_by_name; + rte_eal_using_phys_addrs; rte_log_get_level; } DPDK_17.05; 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/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h index 4aa5d1f..5568931 100644 --- a/lib/librte_eal/common/include/rte_memory.h +++ b/lib/librte_eal/common/include/rte_memory.h @@ -195,6 +195,17 @@ unsigned rte_memory_get_nchannel(void); */ unsigned rte_memory_get_nrank(void); +/** + * 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 RTE_LIBRTE_XEN_DOM0 /**< Internal use only - should DOM0 memory mapping be used */ diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5279128..af8719b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1542,7 +1542,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/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 8c08b8d..f866b70 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -205,6 +205,7 @@ DPDK_17.08 { rte_bus_find; rte_bus_find_by_device; rte_bus_find_by_name; + rte_eal_using_phys_addrs; rte_log_get_level; } DPDK_17.05; -- 2.1.4