From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id E9A2C952 for ; Mon, 6 Mar 2017 11:57:08 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id n11so13065304wma.0 for ; Mon, 06 Mar 2017 02:57:08 -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=fZPsptFpsFtwK0EpXgWufEbNOapP3nozInPsgqSKXpY=; b=eklq/sBIt1aBXTAsThsmry6epzvBhKClF3OmQc/zQMDrzPaufVB3INrzeSQlUKPOQn jXVs8CvySnl+B7phBjC5NCiDSmkf2Irp9yFn+R6CJmuCx6LWoMGf6Mbq8yOLEckVxSQU cLinthSv0t+YCw+NC5vSY4BimPgWcGwDTL95nzkXFpQznTOknvI1QVFN7Qr7NAp8IUSJ AIu//ouxujBP/Wypr0Au5MMIbTEADkWqNZmpOVlNnaksX4qZnRUp2DkqvgmbPyI/TUrr QWZYBje88/EBj6FNxwM4xCX1m+s4mQIu6T2oQKo8zjmi3obYPnhnspuBBsDyGCO5fgyA tcOQ== 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=fZPsptFpsFtwK0EpXgWufEbNOapP3nozInPsgqSKXpY=; b=tsrqDYuLPKVMQrXPZ/xRMleTuLVVPGd+OariJuNDhwM+4U24lTkKpi5UcoDNA9L3Ar vs6poALSw9PzMfmYcfwxQbVdzvZ1IgTJFdFeeFkYPHUNzmMfbwNm3Yil4jBFOzHdynmy wHNSIIlTwIFjEYvvdunDo4jRmDusy6danJIY4KSoFVQyKTBgj53h86O7K+Z4zPN3zBEe I0hyPlZT4FKkUPYnZVnIDDUBQ0Bh2liUQ4NNh0hbaY716sUYsFn3sMsATz4cyMSxLyV6 VhRSS+dHMxB0+lubviWDiWeUSrXytPOjuP+QgwZjdCKwXhjEIRoEWuWsGBB8TlhaCvOB 4EJg== X-Gm-Message-State: AMke39kUjYO9TeCiYRJqFyWYdhsWyfEE952W9eLBodSYWeXwGwe9jv6LZgHdOV1nly1aww== X-Received: by 10.28.234.206 with SMTP id g75mr12398144wmi.54.1488797828498; Mon, 06 Mar 2017 02:57:08 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:57:07 -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:44 +0100 Message-Id: <1488797809-12917-6-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 05/10] eal: Refactor vdev driver probe/remove 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:09 -0000 This is a preparation for the introduction of the struct rte_vdev_device. Signed-off-by: Jan Blunck Tested-by: Ferruh Yigit Acked-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_vdev.c | 44 ++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index b1f490c..07974c5 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -61,14 +61,11 @@ rte_eal_vdrv_unregister(struct rte_vdev_driver *driver) TAILQ_REMOVE(&vdev_driver_list, driver, next); } -int -rte_eal_vdev_init(const char *name, const char *args) +static int +vdev_probe_all_drivers(const char *name, const char *args) { struct rte_vdev_driver *driver; - if (name == NULL) - return -EINVAL; - TAILQ_FOREACH(driver, &vdev_driver_list, next) { /* * search a driver prefix in virtual device name. @@ -89,18 +86,29 @@ rte_eal_vdev_init(const char *name, const char *args) return driver->probe(name, args); } - RTE_LOG(ERR, EAL, "no driver found for %s\n", name); - return -EINVAL; + return 1; } int -rte_eal_vdev_uninit(const char *name) +rte_eal_vdev_init(const char *name, const char *args) { - struct rte_vdev_driver *driver; + int ret; if (name == NULL) return -EINVAL; + ret = vdev_probe_all_drivers(name, args); + if (ret > 0) + RTE_LOG(ERR, EAL, "no driver found for %s\n", name); + + return ret; +} + +static int +vdev_remove_driver(const char *name) +{ + struct rte_vdev_driver *driver; + TAILQ_FOREACH(driver, &vdev_driver_list, next) { /* * search a driver prefix in virtual device name. @@ -121,8 +129,22 @@ rte_eal_vdev_uninit(const char *name) return driver->remove(name); } - RTE_LOG(ERR, EAL, "no driver found for %s\n", name); - return -EINVAL; + return 1; +} + +int +rte_eal_vdev_uninit(const char *name) +{ + int ret; + + if (name == NULL) + return -EINVAL; + + ret = vdev_remove_driver(name); + if (ret > 0) + RTE_LOG(ERR, EAL, "no driver found for %s\n", name); + + return ret; } static int -- 2.7.4