From patchwork Mon Sep 25 15:23:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 29171 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1207A1B1A8; Mon, 25 Sep 2017 17:24:33 +0200 (CEST) Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 4CA5437B4 for ; Mon, 25 Sep 2017 17:24:28 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id z39so8436888wrb.8 for ; Mon, 25 Sep 2017 08:24:28 -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=XfFb2Uec7ArjOWJ6zXSqaQk2KMZZET+TrY98b8fZ+5A=; b=kzpA33rVDAV80ZnANL4A+VVoabSM7jUxEel7njJ44Lv+DLDmEtA8ANljid2aj/EHB6 LsHqHj5pC8OO+3GSYGp6QMWu2PEj2dtJprl2CBKwERZrk+365bs8h2/CveqFjvV6ZFgg MAmN+FJhiDdx3mKIA3LjRirjgibI4pElDjD8cWHlswiypIOtnTf8dmjex0D7f3g6Zzd5 U+9YE97hGAPa7IIPnO6QrW8lLbpA2D+dJgLTX1tGdH7Dc/N0gdtgIBEVKveLDUU8sFOZ W4T50k53Q/iQRsM8lPOEs/snkMQNgKWsVcITG9vcPYS9JUN3saI+RRLLtBnBn9Y6YOii hhcg== 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=XfFb2Uec7ArjOWJ6zXSqaQk2KMZZET+TrY98b8fZ+5A=; b=fDvRafU+v0bca8JrtzpZVu5+Sx6L7OhrNVxopm+SUrKhUQo63OkjZrerM1a76Vg7Zu zaLzaBoCA4C3U5ZE+UxPR2v7vKSaQiwvRv9ataRiOZf/MHzsmpe88P3MgoP7aFcpWdoQ Aq3PJJ3UVwhneL3MQjA7dbP1kfXHhoFvPP7v2Yfit8chaMU31zeqIVXSNLBAylDPHuwa i9r4f7bsAjnBaXqP/5Xu5YZnjWWajhw9+xxRf31s2cjOTiuLvoU4B+U/eOaXU0kjemBL RZztTMe/E9Dg06TUaeGsaYOsx5z+E0T0oI71dKcTel3ibfS5XlISgKuWXYHrq7FYiVft eIew== X-Gm-Message-State: AHPjjUhb3hZEMNhNQbiBN76GNtOg1hs0059fT/loYbaFZqv2L44LDxZP 7PTtQ6KA7vnzRv3XFEr3IeSOjeTb X-Google-Smtp-Source: AOwi7QDsHMtjMT9e1YXOZFQXGur1MW6aYcK7bl72ztyRZ7qzFUMTaiep7LfxIjc7/6x9HTX2VLtSyw== X-Received: by 10.223.134.25 with SMTP id 25mr7064887wrv.186.1506353067573; Mon, 25 Sep 2017 08:24:27 -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 o3sm1058933wmg.3.2017.09.25.08.24.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 08:24:26 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Mon, 25 Sep 2017 17:23:58 +0200 Message-Id: <8256b43e2c3443a3e2edd7763599e3e6b63090b6.1506352671.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 v3 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 | 9 ++++++++- 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 | 9 ++++++++- 6 files changed, 34 insertions(+), 14 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..2065c53 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -204,6 +204,13 @@ DPDK_17.08 { } DPDK_17.05; +DPDK_17.11 { + global; + + rte_eal_using_phys_addrs; + +} DPDK_17.08; + EXPERIMENTAL { global: @@ -237,4 +244,4 @@ EXPERIMENTAL { rte_service_set_stats_enable; rte_service_start_with_defaults; -} DPDK_17.08; +} DPDK_17.11; 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..18bce25 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -209,6 +209,13 @@ DPDK_17.08 { } DPDK_17.05; +DPDK_17.11 { + global; + + rte_eal_using_phys_addrs; + +} DPDK_17.08; + EXPERIMENTAL { global: @@ -242,4 +249,4 @@ EXPERIMENTAL { rte_service_set_stats_enable; rte_service_start_with_defaults; -} DPDK_17.08; +} DPDK_17.11;