From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id BEA0D2BE1 for ; Tue, 27 Jun 2017 21:03:47 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id 131so7482730wmq.2 for ; Tue, 27 Jun 2017 12:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qswwt86C8GcJXNRGRAX5yNwLJTLdMpMFv3lmmNEAUbE=; b=KTdUv3GzwRvcJzx86x/id4q9Z2hDZ/A10DHP2hxb3hscxeKh8QqtFSjUtXb9IQghD8 4BYX16o3bxnpiLwbIMVe5vWaYA6JDSlrtfa55ex06twAAuppap9T3dsv3B/Gsba83rfA Q0uifnU/CTRzetuJXlyNs3Dvp2iMXfdie3OIBSZG2KY+smFNM2HtD+fxL/YNAmuta+kx mDKNlxvtk4YP6zjcMuVoIcE9U2u59ldXNEOLUQEedn0KMKqX7tsy1CKx7bZWBzI/npE1 9kVgZpmBwTEuiKQ2ZOhZaXfNMMY4QCdI/a4G2Sv77HxdoumbqOeXv8NkLVDFRogjv0NP n6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qswwt86C8GcJXNRGRAX5yNwLJTLdMpMFv3lmmNEAUbE=; b=DZMCyLKgBwDoIeAUv8Ecp+amtNhMvopB5T2aV+xD0tKwPSaOo5CMt1pHBsjpOWglau r9zhYKoHbOz5/HeZuS250FOATkzR59B3NJaaRo2DsKAbWz0UfHCJM7rgqOIsNPxlR+89 /EZ6T5nqhc6cF+LniwRlk2LkXL+chZO/tOWVccX+7QZZBiuJf8D61W5Xj29kFmDTfZPa Enn6lhxxA1fYPz6ykvp3MSq8sAYmMie5L0vRx8TnhwZvF/oxTdvzyWrh0Q+oJE0zYVho DAVcf1kI+SVobgio1zbDUX+bvnfEMu43oZZF6A0ev97FW8eM0PqkG/MpwplWWD7yqIys s/aA== X-Gm-Message-State: AKS2vOxwbdLt3RjvSo6jOcxgppEfCfHyhptftJx3rLvIWQ8EXhybuoa6 D9KOXe3b24hUlB/f8x7UxpOvrxUGGQ== X-Received: by 10.28.47.79 with SMTP id v76mr4386263wmv.34.1498590227304; Tue, 27 Jun 2017 12:03:47 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.158.200 with HTTP; Tue, 27 Jun 2017 12:03:46 -0700 (PDT) In-Reply-To: References: From: Jan Blunck Date: Tue, 27 Jun 2017 21:03:46 +0200 X-Google-Sender-Auth: mTekJmmWdZwqTQKDVHV49YHKNuw Message-ID: To: Gaetan Rivet Cc: dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v6 05/11] bus: introduce hotplug 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: Tue, 27 Jun 2017 19:03:47 -0000 On Tue, Jun 27, 2017 at 6:11 PM, Gaetan Rivet wrote: > From: Jan Blunck > > Signed-off-by: Jan Blunck > Signed-off-by: Gaetan Rivet > --- > lib/librte_eal/common/eal_common_bus.c | 2 ++ > lib/librte_eal/common/include/rte_bus.h | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c > index dde6c83..83d9c07 100644 > --- a/lib/librte_eal/common/eal_common_bus.c > +++ b/lib/librte_eal/common/eal_common_bus.c > @@ -50,6 +50,8 @@ rte_bus_register(struct rte_bus *bus) > /* A bus should mandatorily have the scan implemented */ > RTE_VERIFY(bus->scan); > RTE_VERIFY(bus->probe); > + /* Buses supporting hotplug 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 9aa047d..8c2d19c 100644 > --- a/lib/librte_eal/common/include/rte_bus.h > +++ b/lib/librte_eal/common/include/rte_bus.h > @@ -109,6 +109,35 @@ typedef struct rte_device * > const struct rte_device *start); > > /** > + * Implementation specific probe function which is responsible for linking > + * devices on that bus with applicable drivers. > + * The plugged device might already have been used previously by the bus, > + * in which case some buses might prefer to detect and re-use the relevant > + * information pertaining to this device. > + * > + * @param da > + * 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 struct rte_device * (*rte_bus_plug_t)(struct rte_devargs *da); Shouldn't this be orthogonal to unplug() and take a rte_device. You should only be able to plug devices that have been found by scan before. Jan > + > +/** > + * 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 device plug call. > + * > + * @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 { > @@ -117,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.1.4 >