From patchwork Fri Sep 7 22:27:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 44440 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 458AE5F12; Sat, 8 Sep 2018 00:27:41 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id CB7C15B12 for ; Sat, 8 Sep 2018 00:27:39 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 76CEE21C48; Fri, 7 Sep 2018 18:27:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 07 Sep 2018 18:27:39 -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=7ZcV7amAxVLawy6YUWuRB0p/opd0YB2AG30L7a yNKcc=; b=QWBW3e6kEVocHn8QNWxQ1cH9/qBaXYVMWC3UD/70IRTwB4XsTUEvJ3 vumcP70mLa9sxsbYRTutIg9x7kkqr3yArTKTHZdIA6UV3GqhVteVagOCjB7m7KbC CN/JjIutRqBmz/zYPBJrl/RGa3iomymRrUPsxVPMSb8/vWbR7BUOo= 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=7ZcV7amAxVLawy6YU WuRB0p/opd0YB2AG30L7ayNKcc=; b=HmKmhRsbT69Ebj+UMtimgPu89FvLzgVbe sHayUpQijiqeKYaC4AJiF0p6HlZmGSdKDdgHX8q8sfGJJg3XYQxXwmlDssAeoC9S MzngyerkaitYkyFGj6Bjk+U2IeVQ3uFg1oOncTzrNEVGa5hWTFjg4YefD64c7wtl X6u3Eq8pvF7lVr1vZxz1J4TWZDRg3W+q06/lPFmffLxmvkwmyyWYY6HDEIMNpyyk ciBeaTRQWmLoyXOfRCwvP9+edPeiSwgiJnT/OnvGS6paWYrQeOfUi19cBLflbb+C hvRCoowRfOKCinrBAaTRDDEELnMVpz3F+Tny1qT4/Uxr3MQ17r+7A== 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 75A43E455B; Fri, 7 Sep 2018 18:27:38 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com Date: Sat, 8 Sep 2018 00:27:27 +0200 Message-Id: <20180907222727.20521-1-thomas@monjalon.net> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [RFC] eal: simplify parameters of hotplug functions 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" All informations about a device to probe can be grouped in a common string, which is what we usually call devargs. That's why the bus name and device name can be removed from rte_eal_hotplug_add(). When removing a device, we already know its rte_device handle which can be directly passed as parameter of rte_eal_hotplug_remove(). If the rte_device is not known, it can be retrieved from the devargs, thanks to RTE_DEV_FOREACH(). Signed-off-by: Thomas Monjalon --- This patch contains only the change in the API as RFC. This idea was presented at Dublin during the "hotplug talk". --- lib/librte_eal/common/include/rte_dev.h | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index b80a80598..2f4212d01 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -194,18 +194,12 @@ int rte_eal_dev_detach(struct rte_device *dev); * * Hotplug add a given device to a specific bus. * - * @param busname - * The bus name the device is added to. - * @param devname - * The device name. Based on this device name, eal will identify a driver - * capable of handling it and pass it to the driver probing function. * @param devargs - * Device arguments to be passed to the driver. + * Device arguments including bus, class and driver properties * @return * 0 on success, negative on error. */ -int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devname, - const char *devargs); +int __rte_experimental rte_eal_hotplug_add(const char *devargs); /** * @warning @@ -213,15 +207,12 @@ int __rte_experimental rte_eal_hotplug_add(const char *busname, const char *devn * * Hotplug remove a given device from a specific bus. * - * @param busname - * The bus name the device is removed from. - * @param devname - * The device name being removed. + * @param dev + * Data structure of the device to remove * @return * 0 on success, negative on error. */ -int __rte_experimental rte_eal_hotplug_remove(const char *busname, - const char *devname); +int __rte_experimental rte_eal_hotplug_remove(struct rte_device *dev); /** * Device comparison function.