From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 491305F12 for ; Sat, 8 Sep 2018 01:10:07 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C6FD321FFE; Fri, 7 Sep 2018 19:10:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 07 Sep 2018 19:10:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=En8k9of4iucTDaGMb9IHEIBZzFMXN8hsfuVpz7 AM0UE=; b=T4ijSREhyt4YbszDRJc65/H9XSIK61RB5wJOWqmQa3i3BueQ1/h+1C c2gn5eXtvC3zA4K05GwrPMVL4VRzEsszAHNYRiE4PWAR3ZFhJLomIx2RSwLz8Yqg RWO7/7b3DDxm3xgrI5xppEY7I/wRtcEfA7BPyAUTA+fCxpVdXUHqk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=En8k9of4iucTDaGMb 9IHEIBZzFMXN8hsfuVpz7AM0UE=; b=fb2UI2w6fvQlfM+1sPq54vA9vQkFeOq3f bA3w9RQpA1VoxWY1fQV+kvSEQiuj2dD3JpScr7DvyPzpg7q+hNX2rpqjv8zVNT9X 4vjcSRkBgtX+UI/YNICDnjEqcN1dQZJGEcB7Uv4cs628MDOepIvQqcxlabhKUHrH zTbcrq5o/k0Rxf+JQiuS8uoYeEXl0AuoOzD60UxfWhaahJc2eVNvBeT0b2adFvmC G/yZ7Q1hJBRsjLVqT6aHXx/FqdJ0HkoHGNI78XwrG6LTF5kqkYicy5EQNO0ClopM I5MsVASCopTM5efqoeQ8ij6f5r4RKOznjrVMVkOzmnKXsYqyMe6nw== X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 748241029C; Fri, 7 Sep 2018 19:10:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com Date: Sat, 8 Sep 2018 01:09:58 +0200 Message-Id: <20180907230958.21402-1-thomas@monjalon.net> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [RFC] eal: allow hotplug to skip an already probed device 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: Fri, 07 Sep 2018 23:10:07 -0000 In the devargs syntax for device representors, it is possible to add several devices at once: -w dbdf,representor=[0-3] It will become a more frequent case when introducing wildcards and ranges in the new devargs syntax. If a devargs string is provided for probing, and updated with a bigger range for a new probing, then we do not want it to fail because part of this range was already probed previously. On the opposite, we could require rte_eal_hotplug_add() to try to add all matching devices, and fail if one is already probed. That's why a new parameter is added to specify if the function must fail or not when trying to add an already probed device. Signed-off-by: Thomas Monjalon --- This patch contains only the change in the function itself as RFC. This idea was presented at Dublin during the "hotplug talk". --- lib/librte_eal/common/eal_common_dev.c | 4 +++- lib/librte_eal/common/include/rte_dev.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 678dbcac7..17d7e9089 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -128,7 +128,7 @@ int rte_eal_dev_detach(struct rte_device *dev) } int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devname, - const char *devargs) + const char *devargs, bool fail_existing) { struct rte_bus *bus; struct rte_device *dev; @@ -173,6 +173,8 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn } if (dev->driver != NULL) { + if (!fail_existing) + return 0; RTE_LOG(ERR, EAL, "Device is already plugged\n"); return -EEXIST; } diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index b80a80598..10a1cd2b4 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -201,11 +201,14 @@ int rte_eal_dev_detach(struct rte_device *dev); * capable of handling it and pass it to the driver probing function. * @param devargs * Device arguments to be passed to the driver. + * @param fail_existing + * If true and a matching device is already probed, then return -EEXIST. + * If false, then skip the already probed device without returning an error. * @return * 0 on success, negative on error. */ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devname, - const char *devargs); + const char *devargs, bool fail_existing); /** * @warning -- 2.18.0