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 EC525A2F for ; Wed, 15 Feb 2017 11:02:26 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id c85so7357456wmi.1 for ; Wed, 15 Feb 2017 02:02:26 -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; bh=8AhwVR7Gp9RICXxoE7EnveW3Vn9EY5UWm73wchVrdc8=; b=aDfWFnUcLIIF6ggFyrALhJ9+xpR4X0kc6uCecXyPjAdOPtTZAQWd6WVssKM8xO4Cd8 CQRw5TCSTwCBlSUISUEsieXpn2vSolxnO5HTfmuszB4IoGu9mgOhfqTm1MCCxIKcTIbE 8p5xyjb64opDF6eSLhDigLBq6TD8RNZt50nKb13iSqzEvo5E5o5sDZC3negi2uK3SDAJ JWCr2DnnoaIJExt67pkCIj6pULNNt77t87d8a602vNjzL/vubi8j8+KAPULbobkAKHlC 6Q+XDGRPZYOKiYuC+MWdvzzsRWNB56vgjnVjgRDiq3QBfG2lXIKYc4wwvvy8VnWe15b1 N0OA== 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; bh=8AhwVR7Gp9RICXxoE7EnveW3Vn9EY5UWm73wchVrdc8=; b=PBB0gEREcEthIoxpfDq9uWZR/Eqr3z+tjvbP/ltrc4ljIEtUqTSG5iQxSZfMppTmEE lZyk41DyqLmuIJn12X3Ynf8ye4cyTvIvxhFoJ2Eq+cpIdsAt+EX9mjgU4iJT9Vj3WSjJ 8k8kMoyGOak8ffDBT7POA6Ugh+7BG+PcRSqx8ltIZXeeQpoVlhy5HdGokHLsnaMft/Ij Rt/Dh4MnxMD8TYTDvjFgkg3y/RL+lQ8Rt7mE0JPbN3EBxADGsGuW3u/5TETLmqZHnd2/ pYcQfzrIALEA7lo5PrIsnZ+BMa4kHHJDsY0Zm1R+HnavxvBUi33cU3i1eLfvTt+g7ZVe tN8g== X-Gm-Message-State: AMke39kxczUfx0SWMPBGFiP3R5mBaXsGofF3bv+L47g/5WJbytvZCxpqfnpa1efMlGRNEg== X-Received: by 10.28.101.214 with SMTP id z205mr7625530wmb.15.1487152946520; Wed, 15 Feb 2017 02:02:26 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id k195sm4716061wmd.7.2017.02.15.02.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2017 02:02:25 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: shreyansh.jain@nxp.com Date: Wed, 15 Feb 2017 11:02:05 +0100 Message-Id: <1487152929-23627-4-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 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 3/7] 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: Wed, 15 Feb 2017 10:02:27 -0000 This is a refactoring of the virtual device probing which moves into into a proper bus structure. Signed-off-by: Jan Blunck --- 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