From patchwork Tue Jul 11 23:25:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Blunck X-Patchwork-Id: 26823 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id CA5BC7CB6; Wed, 12 Jul 2017 01:25:46 +0200 (CEST) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 567D958F6 for ; Wed, 12 Jul 2017 01:25:39 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id x23so1757593wrb.0 for ; Tue, 11 Jul 2017 16:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Hkb5KcV6mr96HgqKA9C9mlG9PsRUFg4Msa7UB34GRpk=; b=AjSOGphIg3f++JJ8dUbwHoGYsm8HeBzMlU+zadJ1fKqG9NJ5ia7QQVxZicEyVol3+I bsePgp5flXRbOj4OqTy//kVbS13Qric5jHv97unpojU/T1dmxqcj/M2D4NGy3AUX7FQM aawVJdcMS3dbsI+Ln6YTUDH+NmSHFRtH5IW/9SVQTLgY9y6+TxGB18LnNR+8YhOUUxfe xW61748yGccvySWRMxlEvcXYMzYh80Q/rlyMUZSTFBf39TuC0Y6Lw0okGKkZ6bUj637F nJreMQ3RmJQNeoQ9ag7huOfwj9JXAi/3OaZYn5XoU9BGzofFKa6sZMQEmzgmNqks4B3S EiNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Hkb5KcV6mr96HgqKA9C9mlG9PsRUFg4Msa7UB34GRpk=; b=RHgRW6nvwvDq1NYBMbTDIq5JvQDkIhhcKIex+JlbDBUR1686lJb40UIhZUjo0Da70F Uac775/yPg4RMtZU6f1d+Wm3Q5IoEzYbUSlVpcOGhtDAPFPMHnyAOTbnXizAgfWd9euZ ajk1Xgml3uyT1VoRx0i7V9LiJQSIYqDIWzz5/U5ofwIwNEs2vEwVUJW5akCqXjClfe2T aoljoK1IhEBy1CZk9IBGtDj+cMsWfqdRGiOwiKNy2RmJ/EjzBTq8GOMwFdMAxvXdZvbw QVM1vvfOnZQGvMHNc9kuUow2uJGEo0bVjwCEcgKk5UBtJxEFS9mlZzaU1ytblddM1G+R AUmQ== X-Gm-Message-State: AIVw112Te569Z43VWyiLNXuzKVxeQx7dUSkWu6UA9dxN4Qpvb4FEhhLu KlRRp9cUnv6rCeq4 X-Received: by 10.80.166.216 with SMTP id f24mr4140155edc.71.1499815538864; Tue, 11 Jul 2017 16:25:38 -0700 (PDT) Received: from localhost.localdomain ([37.228.147.16]) by smtp.gmail.com with ESMTPSA id k45sm311516ede.16.2017.07.11.16.25.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 16:25:37 -0700 (PDT) From: Jan Blunck To: dev@dpdk.org Date: Tue, 11 Jul 2017 19:25:04 -0400 Message-Id: <20170711232512.54641-6-jblunck@infradead.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170711232512.54641-1-jblunck@infradead.org> References: <20170711232512.54641-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH 05/13] bus: add configuration interface for buses 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" Signed-off-by: Jan Blunck --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/eal_common_bus.c | 16 ++++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 9 +++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 4 files changed, 27 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 381f895cd..82f64c386 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -206,6 +206,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_bus_configure; rte_eal_devargs_parse; rte_eal_hotplug_add; rte_eal_hotplug_remove; diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 08bec2d93..f5368a486 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -64,6 +64,22 @@ rte_bus_unregister(struct rte_bus *bus) RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name); } +int rte_bus_configure(struct rte_bus *bus, const struct rte_bus_conf *conf) +{ + if (bus == NULL) + return -1; + + /* only set bus scan policy if it was unset before */ + if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) { + RTE_LOG(DEBUG, EAL, "Bus [%s] scan_mode=%d\n", bus->name, + conf->scan_mode); + bus->conf.scan_mode = conf->scan_mode; + } else if (bus->conf.scan_mode != conf->scan_mode) + return -1; + + return 0; +} + /* Scan all the buses for registered devices */ int rte_bus_scan(void) diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index af9f0e13f..ff67e6e93 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -206,6 +206,15 @@ void rte_bus_register(struct rte_bus *bus); void rte_bus_unregister(struct rte_bus *bus); /** + * Configure a Bus instance. + * + * @param bus + * A pointer to a rte_bus structure describing the bus + * to be configured. + */ +int rte_bus_configure(struct rte_bus *bus, const struct rte_bus_conf *conf); + +/** * Scan all the buses. * * @return diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 0f9e009b6..8b8c382a7 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -211,6 +211,7 @@ DPDK_17.08 { EXPERIMENTAL { global: + rte_eal_bus_configure; rte_eal_devargs_parse; rte_eal_hotplug_add; rte_eal_hotplug_remove;