From patchwork Thu Oct 26 10:05:51 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: 30945 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 00B3B1BAAC; Thu, 26 Oct 2017 12:06:49 +0200 (CEST) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id A53BF1BA8D for ; Thu, 26 Oct 2017 12:06:35 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id p75so6851573wmg.3 for ; Thu, 26 Oct 2017 03:06:35 -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=LYkZdlG7BY1TNBX/OebAwrgVqrbB6IgQsN6TotHu3vI=; b=utGOfXFaleK1ly/PV8Vb38AydQdo7daaNVsGjztTYpNjX8Ck7dbkZ0LjaaUJiNNt7q RBLzUA2ioI3LBbZMkcntbSsk4VVbDZec5Zi+T/q7frncpQb7a+kdGQxV6yfo2nmbFoXu Li8VYrflR/VBNOHv6605g5UyVooHMAOJO0KCovSVOY3BN1OdswAAOvDOyXzxtKU+mgO+ if/KwjbyB55UOtZWu4h4ZONMtSjtldlmV/8FXzT0eNkZbc0rLLZVTmq/T35PTBgpSJoJ wlOa9HFmrZPzev859JagCVZ0TdC4lZ+JV3pOBTkWHoTCZaUinujXJVNz6O45zFXWA65o qSXA== 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=LYkZdlG7BY1TNBX/OebAwrgVqrbB6IgQsN6TotHu3vI=; b=j7PeCeghiLXHHWfUfIp4sI4EWlTwQStN1U+F6UWQac42uBAYEWMtECF7xHMq+7io0a P02MrBsEf1YIhGM2HLTG0fNjK5DhNRshGjKEIewmQIFv9FAXC4Y6zMYzsHlofKmWosq/ dcM6IAtRJDPDQsp3Je86xnQM2BAX+8aEpDTiZ6Bsmpl5jh+lFdz9FgIR+tr5TOrOO1e0 3ZLgimhA/T7iVoNL94Hebm0Rz/x+OftVYFDYlQjITezQ69xHmv94iuxzm23C3LVDCozK 4xRbKGUc2CJASBqjNCXutRoTt5p/tEbPRHd3vWG/jrewPrYXcnvPkG6Kut5U79FP8M+m OuIw== X-Gm-Message-State: AMCzsaVj2UzKKDETwQaPEw9hv6j6orcQNYRP/bu6dJC+rcHUgvXbicjk /Qh0qDL4tnMTkJpeHJUIXrfuP0Ki X-Google-Smtp-Source: ABhQp+SzW504D0hyqeTRiF5TnqCfxo0bZtjnV6Ug6LlU94TWA+xFl6ifWz67Ye58C2A3BYHtvOYvUw== X-Received: by 10.80.204.138 with SMTP id q10mr2801370edi.108.1509012394949; Thu, 26 Oct 2017 03:06:34 -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 u12sm3339619edk.45.2017.10.26.03.06.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Oct 2017 03:06:34 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 26 Oct 2017 12:05:51 +0200 Message-Id: <5340e241bcbe58810e6bc9b72e0d043958591359.1509012196.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 v8 06/25] eal: expose internal config elements 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" Some internal configuration elements set by the user on the command line are necessary outside the EAL, when the PCI bus is detached. Expose: + rte_eal_create_uio_dev + rte_eal_has_pci + rte_eal_vfio_intr_mode Signed-off-by: Gaetan Rivet --- lib/librte_eal/bsdapp/eal/eal.c | 16 ++++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 28 ++++++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 4 files changed, 63 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index e981721..d54a280 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -723,3 +723,19 @@ rte_eal_process_type(void) { return rte_config.process_type; } + +int rte_eal_has_pci(void) +{ + return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev(void) +{ + return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode(void) +{ + return RTE_INTR_MODE_NONE; +} diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 4ea2ff4..cc2636c 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -47,6 +47,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -268,6 +270,32 @@ rte_set_application_usage_hook(rte_usage_hook_t usage_func); int rte_eal_has_hugepages(void); /** + * Whether EAL is using PCI bus. + * Disabled by --no-pci option. + * + * @return + * Nonzero if the PCI bus is enabled. + */ +int rte_eal_has_pci(void); + +/** + * Whether the EAL was asked to create UIO device. + * + * @return + * Nonzero if true. + */ +int rte_eal_create_uio_dev(void); + +/** + * The user-configured vfio interrupt mode. + * + * @return + * Interrupt mode configured with the command line, + * RTE_INTR_MODE_NONE by default. + */ +enum rte_intr_mode rte_eal_vfio_intr_mode(void); + +/** * A wrap API for syscall gettid. * * @return diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 02381d0..18a07b0 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -989,6 +989,22 @@ int rte_eal_has_hugepages(void) return ! internal_config.no_hugetlbfs; } +int rte_eal_has_pci(void) +{ + return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev(void) +{ + return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode(void) +{ + return internal_config.vfio_intr_mode; +} + int rte_eal_check_module(const char *module_name) { diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index bcc594d..9f06d23 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -241,10 +241,13 @@ EXPERIMENTAL { DPDK_17.11 { global: + rte_eal_create_uio_dev; rte_bus_get_iommu_class; + rte_eal_has_pci; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops; rte_eal_using_phys_addrs; + rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; rte_pci_get_iommu_class;