From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id 635C12C13 for ; Wed, 28 Jun 2017 13:58:33 +0200 (CEST) Received: by mail-wr0-f181.google.com with SMTP id c11so173268651wrc.3 for ; Wed, 28 Jun 2017 04:58:33 -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=CIscmUnKKlBNVBnCxxfD6QiJ5PcNBLbnM4YDe+RXvmA=; b=g68COHl0CFxltoukA797vUCUC3DzAYj7rXyNHZNXPhKCs8Ms4Eh9V4/hy0lYqPan8g Fl9DP/STXAx7ESDbQ022TA1V6UkpdTAGxsL6fiGatPa8Be23aS6Q0aLT+wpSUoztGp/C f1BlGiV9ymMXOvQzYbOKWB6psqP6/yOHkvjUqlOFKG5/oR+eAI04dQOhwsfckpfuakVi 1eq6LsEaSbgcfJabplnUboCJrDgr5Ht/c4yG966+byqptusbOp2jP9zzvFl2Wq9cjnOo x9Xy+xbWh5Y2FxqTa/Jf/h/kizk65CTi3TXgScDJZbkrByyg6hwfRFG5T5Josef9Vlfx Mq4w== 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=CIscmUnKKlBNVBnCxxfD6QiJ5PcNBLbnM4YDe+RXvmA=; b=W07dqzoZ2ckh9NOt45yKi8J63icU9VL67ovsjR7mjInmzL8dmGbFsXjD52FMQHfrQA xb8qNK8B4yjvmBaNZiGtw62vjJO11MV6txuOYD0m3B6YVMbLrp5lsvmWYqBqgaRFrl7q IH4jyaJSeiAawuRgjGbyx6oU8akhBZjMIJAdCgN6tgLbVDCDJTR4wADGhgNjhiBFdYD0 tbnIB7551x6KM2t8zEOgaYO042YGIvbpclyK4ASoaj8d32l3gDPx+RdFqg8AdJq5V7YN 6UM/xfrCUfoH3PPaRApmXooe1k4XkYXyGdY3rz0LlllUWdRHfMsQeruVXUGj1sbQeges fexA== X-Gm-Message-State: AKS2vOzINWLL6jMV8HtZG7h3MNIeCtvaqosyv2esVmHCz/FvVHoFGpjz nPAiUL5ID7wChJAblwjdObc+0GUkqA== X-Received: by 10.223.182.172 with SMTP id j44mr14781375wre.122.1498651113006; Wed, 28 Jun 2017 04:58:33 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.5.136 with HTTP; Wed, 28 Jun 2017 04:58:32 -0700 (PDT) In-Reply-To: <4639959.eMbdazoqpE@xps> References: <4639959.eMbdazoqpE@xps> From: Jan Blunck Date: Wed, 28 Jun 2017 13:58:32 +0200 X-Google-Sender-Auth: T4PX4bUQc2E1jSp_m81lGzoJ_6k Message-ID: To: Thomas Monjalon Cc: dev , Gaetan Rivet 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: Wed, 28 Jun 2017 11:58:33 -0000 On Wed, Jun 28, 2017 at 1:44 PM, Thomas Monjalon wrote: > 27/06/2017 21:03, Jan Blunck: >> On Tue, Jun 27, 2017 at 6:11 PM, Gaetan Rivet wrote: >> > --- a/lib/librte_eal/common/include/rte_bus.h >> > +++ b/lib/librte_eal/common/include/rte_bus.h >> > /** >> > + * 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. > > Plugging a device that has been scanned before is a special case. > In a true hotplug scenario, we could use this plug function passing > a devargs. > I don't see any issue passing rte_devargs to plug and rte_device to unplug. What do you mean by "true hotplug"? The problem with this is that passing just rte_devargs to plug() requires the bus to parse and enrich the rte_devargs with bus specifics. From there it gets folded into the to-be-created bus specific rte_XXX_device. This makes it unnecessarily complicated and even worse it adds a second code path how devices come alive. When we get notified about a hotplug event we already know which bus this event belongs to: 1. scan the bus for incoming devices 2. plug single device with devargs and probe for drivers Makes sense?