From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 17C745A98 for ; Fri, 14 Jul 2017 23:12:37 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id j85so12764572wmj.0 for ; Fri, 14 Jul 2017 14:12:37 -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=culVXsSZYrqmAZeEVm/q98oXHzR9LVcqwieqLFb2IHfimP/QV8Geu3YA3EG0SjIBjl vU1B/KReWL4OaWylU+OssN4BbuhjByCyrRmaPQ5WBfgGXLCp8qYEr6orcklTjryj4Qos H0934kg7xWvCpZqRqvb3QG8WqC5mBrZcZSmwrCptQWD5JTRmzSaOoAS1nI+JL5ZnhPSk X8fsE1B/Gd3UHkON6eJgdvT80/mkbiHVElfyjRt3EjPY55k1JhZjfiKoXiv2qAgv3GbB wErlqQOf4cZzn2mUXaTyUc/N7ydxTZK8gapnjzDZJ5eU9MAUK+g2/6m6L1hLDTl2QMeU FgKw== 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=RreMLxKaRigzgisUjld3WHt0D+2+0GTKM8/u6B/Bm/s52/LE8mdj1LYfsVtbZSzx4Q M4lIwoDPdbObWlPRugXUXQ2NvVB/MsPGh3pIIE0IlyIlolyiZEhhNGBSEIUYuqiYqAwU 2uD+PeXGxuJJYh5Um2vjW7+SMsDed+PrSQVm2V4VaEwVAtHMJ8z12abAwEORAFrPGnre AaacvJrar0OJm3Q7P+n6JAzcpojxx0tDfFkebfwAxOW8oRtqEWCzKLjAK4iUb73h5hdg g+OS5mn4M/XHv06iBuAZ7PgvR2rqnEJ1PvlZtR/wmQ0QzJaBLZmhLfykFMu9gyheGWSa pQiw== X-Gm-Message-State: AIVw111GlJAnTFhe6j5TkNtqX27CHvS+CVhB+aTAx4c3j0Xl8EBTe666 D75fdC8B6tNkYDy3 X-Received: by 10.80.135.208 with SMTP id 16mr8193543edz.121.1500066756660; Fri, 14 Jul 2017 14:12:36 -0700 (PDT) Received: from localhost.localdomain ([37.228.147.16]) by smtp.gmail.com with ESMTPSA id c11sm4892223eda.0.2017.07.14.14.12.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Jul 2017 14:12:35 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Fri, 14 Jul 2017 17:12:04 -0400 Message-Id: <20170714211213.34436-7-jblunck@infradead.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170714211213.34436-1-jblunck@infradead.org> References: <20170711232512.54641-1-jblunck@infradead.org> <20170714211213.34436-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v2 06/15] 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: , X-List-Received-Date: Fri, 14 Jul 2017 21:12:37 -0000 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; -- 2.13.2