From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 8CE0C58EC for ; Tue, 11 Apr 2017 17:44:33 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id t189so4270086wmt.1 for ; Tue, 11 Apr 2017 08:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=huhdvDVENJFb0hdZVScGnVB2qVZjBH7QoKaGAIhU1cw=; b=TEndmTonVxb31+BkEHga+TPmSXLZ8UEm5Y9kHIWG1SVO8yAysh2IUG9nNY3/JUqr0I S2D4jOqElBV6nWwo0c51wlt0K3q8xLiSX2+Ph2j6xTE4M8mExxbLRTesx5hYH6WZ2/GX 9As3cnIRUTXkU03J/u6cZ/BLUo84PuIcrD9fZzV9drmVuLdMUxmVqP97dwMN/pGuiqzx JtJDFKNmny8Wb4mgkCv8CbrxhAW4FybCvKpLqUqsLj0occH7dH+uWpKGJ3h9ljlD6iUA XXqJ9OsUgl1kHGD99ylqBN+oVL8me0Ax8hU1hWx2amFI3UGwYWFMmBmDXZwKI9WtOKjN FF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=huhdvDVENJFb0hdZVScGnVB2qVZjBH7QoKaGAIhU1cw=; b=gircxIDjPZA+gNlGzfedBqTM9YqAEwJYmc3OLXV1CIgqLqdKU7dX7sbHH5upxTz0wp /XeJEFL9tHDghZIWyobgR309imMOe4sd1wjDOuZnWgFbWMmd59y00lbGyqeaCgxloN3j AMSAPMeH46M5C4HE87+/I9n8FNAycGEmLTPr+F/xDrlubs2wMXIyuIDF05oVacHYGZvR U1bOjgsNHoyQqAh96sgL0bbIULtLzhkYUqenPhcXpc3p4vFGOoUF9vvT9EGf7qZ6l/bq hVACx6U+gE8IatgLBoCfzIK9WOkzXQDj90+Wsd8FK7vIQ8swUFKnxfDhBPGJcUi7cfas +Ytw== X-Gm-Message-State: AN3rC/7GGIbdKRf+D3vKfIPnjqmqzxmvWe9rBNxoh1tMM/lcBLOkzM5B rZvLU5eB6ugJbATlA5w= X-Received: by 10.28.225.10 with SMTP id y10mr14364804wmg.34.1491925473057; Tue, 11 Apr 2017 08:44:33 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v14sm2936830wmv.24.2017.04.11.08.44.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:44:32 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:08 +0200 Message-Id: <9b66a920831cd05b32b082f7d7304378c3d2a562.1491925092.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1488797809-12917-1-git-send-email-jblunck@infradead.org> In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 04/12] 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: Tue, 11 Apr 2017 15:44:33 -0000 From: Jan Blunck 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 a94c4c6..c255073 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -66,14 +66,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. @@ -94,18 +91,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. @@ -126,8 +134,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.1.4