From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id D571A5598 for ; Mon, 20 Feb 2017 15:18:33 +0100 (CET) Received: by mail-wr0-f193.google.com with SMTP id z61so11358612wrc.3 for ; Mon, 20 Feb 2017 06:18:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=juUp8svg9YmZHx0JrHWMrCH8A3CU4xsu5XSVXREVsfk=; b=jh5HiarOs/agQS0fNygyRYXDhb88ApzY4DP6rfRXUSBZ/wbqBI/BLaE0QJfGtRAzNU HY8hidn/H31xeJatNFR3X+8wRnFCd/5vEEm7B7vl9HI3BVuaygX8VqVo+0YVBahzAtWt 6NsP1Dknix8WPA2cGypOy51z1rEf/7Pn8T0JqvmHoTLctP2yQtoA4SlRUnhCPA4/JUhv CvQ3pmEphMHE+WoVwQGheaXvhrjJ7q3OMd3Cx/aUIjx6xwXB/xRCZU8J90RhKzLtujD6 J6t5B4ha52fwN2OM1GYr9IfYQrMW8BXAeN+CQzd2gk2g9CJm3gHP6LHNs9ssie9LaV21 EYug== 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:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=juUp8svg9YmZHx0JrHWMrCH8A3CU4xsu5XSVXREVsfk=; b=rOP1MAIz5+Sk3pT6kkAhR8UTut37si1X2YO7gkYvlY3Ryjnmn9KeVjy5HN8id8FH9Y AJSNKKh1NCG3DueuAv6Qo/Tda4RL7pXCKmfAo4SmZCFWWN1NcssYwFi2jStjE6UUB/rI 074c/+78YoxeQJIJuFwTtJeyvHIL5r59piDYxCbZS88CQf/sFLn1WnGcq4qyQcHLbUaq zi20nXGlEmrtWOa5dvngKjQiQ33OmdqBkufkgACbi2VjFttGNIHCkyPuLWYilhy57siS kFXW0SVtHEbCKBbJDa5kPqZy4CAHdEquvMKbhWEkcEZku/KOOWqtfJGsIfX9wKdqPC7N GXzg== X-Gm-Message-State: AMke39nFTJC+VcpiKnoCLzjMjjTJzuDdHyk+F7YdHTCN2mKMnrASgU1Lep8s6DWYuBtapA== X-Received: by 10.223.164.150 with SMTP id g22mr15913902wrb.148.1487600312716; Mon, 20 Feb 2017 06:18:32 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id o2sm24932276wra.42.2017.02.20.06.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2017 06:18:27 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: david.marchand@6wind.com, shreyansh.jain@nxp.com, ferruh.yigit@intel.com Date: Mon, 20 Feb 2017 15:17:37 +0100 Message-Id: <1487600262-14382-4-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487600262-14382-1-git-send-email-jblunck@infradead.org> References: <1487600262-14382-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1487152929-23627-1-git-send-email-jblunck@infradead.org> References: <1487152929-23627-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v2 3/8] eal: move virtual device probing into a bus 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, 20 Feb 2017 14:18:34 -0000 This is a refactoring of the virtual device probing which moves into into a proper bus structure. Signed-off-by: Jan Blunck Tested-by: Ferruh Yigit --- lib/librte_eal/common/eal_common_dev.c | 22 ----------------- lib/librte_eal/common/eal_common_vdev.c | 44 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 4f3b493..1ce90f6 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -79,28 +79,6 @@ void rte_eal_device_remove(struct rte_device *dev) int rte_eal_dev_init(void) { - struct rte_devargs *devargs; - - /* - * Note that the dev_driver_list is populated here - * from calls made to rte_eal_driver_register from constructor functions - * embedded into PMD modules via the RTE_PMD_REGISTER_VDEV macro - */ - - /* call the init function for each virtual device */ - TAILQ_FOREACH(devargs, &devargs_list, next) { - - if (devargs->type != RTE_DEVTYPE_VIRTUAL) - continue; - - if (rte_eal_vdev_init(devargs->virt.drv_name, - devargs->args)) { - RTE_LOG(ERR, EAL, "failed to initialize %s device\n", - devargs->virt.drv_name); - return -1; - } - } - return 0; } diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 7d6e54f..523a3d6 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -37,8 +37,10 @@ #include #include +#include #include #include +#include struct vdev_driver_list vdev_driver_list = TAILQ_HEAD_INITIALIZER(vdev_driver_list); @@ -122,3 +124,45 @@ rte_eal_vdev_uninit(const char *name) RTE_LOG(ERR, EAL, "no driver found for %s\n", name); return -EINVAL; } + +static int +vdev_scan(void) +{ + /* for virtual devices we don't need to scan anything */ + return 0; +} + +static int +vdev_probe(void) +{ + struct rte_devargs *devargs; + + /* + * Note that the dev_driver_list is populated here + * from calls made to rte_eal_driver_register from constructor functions + * embedded into PMD modules via the RTE_PMD_REGISTER_VDEV macro + */ + + /* call the init function for each virtual device */ + TAILQ_FOREACH(devargs, &devargs_list, next) { + + if (devargs->type != RTE_DEVTYPE_VIRTUAL) + continue; + + if (rte_eal_vdev_init(devargs->virt.drv_name, + devargs->args)) { + RTE_LOG(ERR, EAL, "failed to initialize %s device\n", + devargs->virt.drv_name); + return -1; + } + } + + return 0; +} + +static struct rte_bus rte_vdev_bus = { + .scan = vdev_scan, + .probe = vdev_probe, +}; + +RTE_REGISTER_BUS_LATE(virtual, rte_vdev_bus); -- 2.7.4