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 C07AE8DA2 for ; Mon, 20 Feb 2017 15:18:40 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id c85so14645407wmi.1 for ; Mon, 20 Feb 2017 06:18:40 -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=rlMwAQ2ls1Bvo6WrY/ApVKkNHG4RqzDYusuKBWVSH2g=; b=gkqLs04VywQqVIZgaEn7WXCxvUm49n34RwnFPyrXmhPAG6ZoLZBpRKCZW+3AidthU9 c9V2n1vI8/YvNjaGXg4ygug/9xQLrKqkHIzrF6qk5x5LaBXo4FD8LUhpdAawlrR/VgE2 MxbN559kagFtU98g4BO43ORCXcIL9gsdU80z4yaeOfsgjXdmkwt583F46Up6KkIiqUK4 U/UONickVmsppNQL9ui8R8bQNTTNzYgu1Hf94lyCWNBflb4VZjVZDmtyYmWe3gQ1j3x+ qoGK/sevbTFRAatS5wYzPE8w74uaiyoCiOYJL3VJKrbT1ySw7qPjWtScPrn238lxo7YQ XbMQ== 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=rlMwAQ2ls1Bvo6WrY/ApVKkNHG4RqzDYusuKBWVSH2g=; b=GuCsQ8HOKu64K2ERIkCSKPH2nb28tDaIW9lg0/BV04csOK4pDKNBHEk8nErim4qJyR ePRWjOLX/yAaRUO29Gp2lJX5hghx+pkZBlu+nz8QQQ73QW/7iAPuf+C+4vt3rXEETtoR hZX3/aRPnQ4XhacOgRWrqFltNfyZ+LslpG1cv7D6ePReH4228zgc9GWXIJ2+3llbByZf 5TCw1078809HdNHh36wWX4uSeAZjZPifiUPaq4kUVXz8g0gCaC6mQHqv5R/7zWyRH9PY f4Jb0ipmb7RQJPZEm6zZNcRG+c6mVBQ+19GHuVNyFHKIjhuh05ThkPEC0EWNlblGVV9a 764w== X-Gm-Message-State: AMke39mBceDGs0G/R5F+ZynMzWkCkBS6aEqMvs1hbp4/JznCZLiWd/7aNL6Rr2gR5CHO1w== X-Received: by 10.28.234.193 with SMTP id g62mr10858462wmi.36.1487600320540; Mon, 20 Feb 2017 06:18:40 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id o2sm24932276wra.42.2017.02.20.06.18.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2017 06:18:39 -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, 20 Feb 2017 15:17:39 +0100 Message-Id: <1487600262-14382-6-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487600262-14382-1-git-send-email-jblunck@infradead.org> References: <1487600262-14382-1-git-send-email-jblunck@infradead.org> 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 v2 5/8] 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, 20 Feb 2017 14:18:40 -0000 This is a preparation for the introduction of the struct rte_vdev_device. Signed-off-by: Jan Blunck Tested-by: Ferruh Yigit --- 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 523a3d6..6ba3c91 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