From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id EB4422C37 for ; Fri, 30 Jun 2017 20:38:35 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id 77so208339338wrb.1 for ; Fri, 30 Jun 2017 11:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=iD5wskANQ6BtiW4ZVjjaRYTMPds4f89RMJmoFFsl+Zk=; b=BOxceJrPjOCPivIK3PywHgjOvIg/Cma/JstqkVRaxc7SZjs/B78YZJpm/KHFudOXBA hCk7r+s+xN14KBfM8aDaRp31SdlWVF5OQyiRUbZDEcBLvjWpJnnZyemf/FCqREp5aJXn sp1VsffoIvwevSUjVd+nyWlHyUv5CGW5DQPUXrRKk3gMWJa9nkHjmu0NWsYW+qKTdnE6 WdcF4Z0huhlTR1bdZUUn2Pg/CAZYp8MZyC1CNHr/7czffZONIIWjl+V1xIln19u5AQjP O2t1bGXsR0uEg11uvbXlmZkNKwE4VpyixC29BjTe2H5EWknrVZBKzupfVwsapYBdNSWK Q0mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=iD5wskANQ6BtiW4ZVjjaRYTMPds4f89RMJmoFFsl+Zk=; b=EO3zjA11X5hCajqElmyaQIyMAAWrgoO9+TYof9HEIIyZZdAuP3WXC+eMNCqrOZmPsx ycEh0jKe4Blhe33tXd7fO5Ii1zJxSs4TTUr2F97YHaDwJOds4QscPuIicsBRVSrKRLRM 47NglZ1Hb72IObV/M7fUR6TrMOeglaTRQVBuhGDdXuWhY031qhvwcuBw1T6tGzF2FFS2 G+je69LY9ILcf4JnHYw4x4NU188Id3Hre+amrd4oYq4hoWBzx/TxetjBZ8Xtw6bRTI43 Sr+5fvfkb0Yu9nm4XVxWnBot2MsKKA+3hlPTnPUdxKsXwyLvgMbGj3JN0sCneuvmZR2C JaGg== X-Gm-Message-State: AKS2vOz8p4Ra7rBMDMVBEI+ud4IIcVFbhrpiYwu/UVPEl0s+7SO3+cGF 43RzhlKQ5Tq++492mP8= X-Received: by 10.223.162.156 with SMTP id s28mr25693348wra.2.1498847915430; Fri, 30 Jun 2017 11:38:35 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id t74sm11503954wmt.19.2017.06.30.11.38.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 11:38:34 -0700 (PDT) Date: Fri, 30 Jun 2017 20:38:26 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Jan Blunck Cc: dev@dpdk.org, shreyansh.jain@nxp.com Message-ID: <20170630183826.GP13355@bidouze.vm.6wind.com> References: <20170629182206.1072-1-jblunck@infradead.org> <20170630181943.23929-1-jblunck@infradead.org> <20170630181943.23929-10-jblunck@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170630181943.23929-10-jblunck@infradead.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v8 09/14] bus: introduce device plug/unplug functionality 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, 30 Jun 2017 18:38:36 -0000 On Fri, Jun 30, 2017 at 08:19:38PM +0200, Jan Blunck wrote: > This allows the buses to plug and probe specific devices. This is meant to > be a building block for hotplug support. > > Signed-off-by: Jan Blunck > --- > lib/librte_eal/common/eal_common_bus.c | 2 ++ > lib/librte_eal/common/include/rte_bus.h | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+) > > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c > index bf2b138..87b0c6e 100644 > --- a/lib/librte_eal/common/eal_common_bus.c > +++ b/lib/librte_eal/common/eal_common_bus.c > @@ -51,6 +51,8 @@ rte_bus_register(struct rte_bus *bus) > RTE_VERIFY(bus->scan); > RTE_VERIFY(bus->probe); > RTE_VERIFY(bus->find_device); > + /* Buses supporting driver plug also require unplug. */ > + RTE_VERIFY(!bus->plug || bus->unplug); > > TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); > RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name); > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > index 509292d..34ea9d5 100644 > --- a/lib/librte_eal/common/include/rte_bus.h > +++ b/lib/librte_eal/common/include/rte_bus.h > @@ -108,6 +108,36 @@ typedef struct rte_device * > const void *data); > > /** > + * Implementation specific probe function which is responsible for linking > + * devices on that bus with applicable drivers. > + * > + * @param dev > + * Device pointer that was returned by a previous call to find_device. > + * > + * @param devargs > + * Device declaration. > + * > + * @return > + * The pointer to a valid rte_device usable by the bus on success. > + * NULL on error. rte_errno is then set. > + */ > +typedef int (*rte_bus_plug_t)(struct rte_device *dev, This typedef does not match its doc. If it is the doc that is right, the PCI and vdev implementation should be fixed as well. > + const char *devargs); > + > +/** > + * Implementation specific remove function which is responsible for unlinking > + * devices on that bus from assigned driver. > + * > + * @param dev > + * Device pointer that was returned by a previous call to find_device. > + * > + * @return > + * 0 on success. > + * !0 on error. rte_errno is then set. > + */ > +typedef int (*rte_bus_unplug_t)(struct rte_device *dev); > + > +/** > * A structure describing a generic bus. > */ > struct rte_bus { > @@ -116,6 +146,8 @@ struct rte_bus { > rte_bus_scan_t scan; /**< Scan for devices attached to bus */ > rte_bus_probe_t probe; /**< Probe devices on bus */ > rte_bus_find_device_t find_device; /**< Find a device on the bus */ > + rte_bus_plug_t plug; /**< Probe single device for drivers */ > + rte_bus_unplug_t unplug; /**< Remove single device from driver */ > }; > > /** > -- > 2.9.4 > -- Gaëtan Rivet 6WIND