From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 4240A5A3E for ; Sat, 25 Feb 2017 11:28:35 +0100 (CET) Received: by mail-wr0-f196.google.com with SMTP id 89so4905744wrr.1 for ; Sat, 25 Feb 2017 02:28:35 -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=xXrSbCKZuWRrMzZwddY7NEBSFdGKxhBKKvlw44r4xiM=; b=U8LoQtj9GFcdMwMEoio9Ru51zzCph9Cus8WF/aJpoOtY1jA1xK0vq1G1EkraU4yi76 oyCZhGDx04MT152tjq4pMsEUCnoVdwZfNIrV6wechpgGj2+9y6iICWNmh3V7QuT8+9Sm t7qoFjxRmcItvgAFOOgTSLDN/YLBP1FFZt4pctuv+XeFVlGKLiI4VWDK7RAEreECe0NK F1Lp1lm055Bhc07htWnR7rMllRT1JFdrKyXfGr4P//e7mhNxKgUPHhkjKqIR6qki4wle NO+Pd7a2NzWfL32ciP23j8rzW7Xshb7TCyyevlx9KluNlkYebmMQ5vs+EUo4SxEbSo36 iytw== 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=xXrSbCKZuWRrMzZwddY7NEBSFdGKxhBKKvlw44r4xiM=; b=GVeA38TWJfM6hP6mC7QSI16EZKBOv6UDybGpu4MBj1woBusE1Jc4XSvtmh635bt2Ze h75XQdhHnTmnQpZGmF3JIzTmMBCEoGbgh2TIsH6p6BH35fYjFygWmTW9lFUAmCu1In82 7QK4u4Mc5XQ8Ijg2dcLvtsEBYqUavCwhFspQNQUQy6RRibHGRSYflj3pE0CpyIti6T6+ ZhUkYA9cyPtd6T+S5usnrs9X6yNjz85bfBHua6Z/7O7b9Yc/GNNGkKO83u/3rumA1Lnq dgfvvAwTj30SafHC4buiWct1L6HoVgM2piALz2RLYoMVkuOZKGCeovbuRyxJB3q22eAn wnHQ== X-Gm-Message-State: AMke39m6fuKsqXFrcNAxw0MMuajkd0zKTRUD00WY+7fPq8GSgMa7Q0nF3dax44D7Woro+Q== X-Received: by 10.223.146.196 with SMTP id 62mr6040365wrn.199.1488018515077; Sat, 25 Feb 2017 02:28:35 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id e72sm5830893wma.16.2017.02.25.02.28.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Feb 2017 02:28:34 -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: Sat, 25 Feb 2017 11:28:11 +0100 Message-Id: <1488018496-995-6-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488018496-995-1-git-send-email-jblunck@infradead.org> References: <1488018496-995-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1487600262-14382-1-git-send-email-jblunck@infradead.org> References: <1487600262-14382-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v3 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: Sat, 25 Feb 2017 10:28:35 -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 0fcfdd7..5a267ee 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -65,14 +65,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. @@ -93,18 +90,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. @@ -125,8 +133,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