From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id B6E465599 for ; Mon, 6 Mar 2017 11:57:06 +0100 (CET) Received: by mail-wr0-f195.google.com with SMTP id u108so17250255wrb.2 for ; Mon, 06 Mar 2017 02:57:06 -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=eOqHsX/WxODzX9NllMf0wG+BfRy4mqz9cqLrR4QzVIQ=; b=AjAjqmThy0B7PHZfOajjetnzlru6pdL0XOZw5tGNGfhcC4bQAEYrCP0FRye/r/MuYo hV5aIjfdan708azuHViqs7Zk2ZHsXVYMLJAIHOEIs+tIhgTmQ4YNNOxjzKJll4L9kiQM 3AsbVsEY7h2S6iNBQQHS7hYwVroQ3zPs9b6JjvGo4kxjBLXb+lKoDeCeT2gisYaVrUgz iS5Cl9c7aA2CP+M4ChSovYCGEfS33XsIAUzALEqRr94672AgdMnh+SLL4jTrFM68SYOL cWfhi/dupohk+QfsPjJAAxVMuaZfQKL48EEEb6NHSBcAED7ABDXAEyUTgwaUBWsK6d7b ZUHQ== 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=eOqHsX/WxODzX9NllMf0wG+BfRy4mqz9cqLrR4QzVIQ=; b=JaEUpAvXfVBq4v5UQNU+mVqD1dXXgh6cFmnduROz9omBuJoBFtC8PMpN4N89MZtXSB ogU6ZlyA4FcKRJaMQjxpBvHRnrem7UnD9KvamYHjrlRHYIrSJyeJXP7iiGTMGZnMMh9p 0MfxCx81Szg/GfdlUpogEPQ2KRxHGW8tqEPEqNT7Z2avmMCfGlnJnCW0wy3KPeXX1YTK MoU5JbWiJ8oEyo/NNIxTbWJVMK+2tB+stg5mbbBDR/BlNwdogekTZKXSoXAxG+543ZcB mwlTbFoyt5CbZhbh97okyQfvQgTnUVhRTS9XuLPX1QpKeqm3alDGW16QpdJFxl1xR6B7 rqgw== X-Gm-Message-State: AMke39m4YY7tu/AXL0YPC957H5HBXTvHFc7lWTZnLlmOtyMAD7XzWq+YQvgV35Q+Q81p7A== X-Received: by 10.223.164.150 with SMTP id g22mr15299390wrb.92.1488797826553; Mon, 06 Mar 2017 02:57:06 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id o63sm14277896wmo.30.2017.03.06.02.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:57:05 -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, 6 Mar 2017 11:56:42 +0100 Message-Id: <1488797809-12917-4-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488797809-12917-1-git-send-email-jblunck@infradead.org> References: <1488797809-12917-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1488018496-995-1-git-send-email-jblunck@infradead.org> References: <1488018496-995-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v4 03/10] 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, 06 Mar 2017 10:57:06 -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 Acked-by: Shreyansh Jain --- 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..b1f490c 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(virtual, rte_vdev_bus); -- 2.7.4