From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id D2DC92BE1 for ; Fri, 30 Jun 2017 20:52:13 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id 77so39801179wrb.3 for ; Fri, 30 Jun 2017 11:52:13 -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:content-transfer-encoding; bh=2MVCamNnaIl2aaNcVU7UoWJd46Vz2fPFAsDy/pHsZJo=; b=p/N4Sw2BH3oAG11aYHvbePn28XYGCbyPbsOpWf3fYNEfJ45hIQhncgrRSdA1iCiKWt NQ88LNiKl+nVbaS/vppMh/e6/gKLNZbX0GHvBZKc1u744W3ndLzuEsVI+Ly4JyRBpMsz isPTiDil2MIoeMrNICL0U4xnQbnwiV8inlGHO6OVlIYJGlYx27se03cZLKR4Hr8IHe2y eU60Y1VUYPklst7726lr3pX6Z5ZfQxCf7DMR3YJu/kdRKhyTr3FpnCkvnsSa56tbUFif p+hFT3fEXZCyvmJKptyreCY2iuRaN+vfrcraIbzJ0Yl4bF1NC2BRc+0ObbOdhk9TJqdL UysA== 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:content-transfer-encoding; bh=2MVCamNnaIl2aaNcVU7UoWJd46Vz2fPFAsDy/pHsZJo=; b=fziYmIeWwFvjG1eaEnUh4DsiuI0JlVetBb6YVpzD2JNhW+o/isQIsd9Yas5nXHvcDA 0kKN3noKU8/BVPp2vEsWdh45bT9cw8QtqKrBHvt9OW0FEFWb/+E+7Kbn+SZFWeq0mbnK SNIG0ZAZTCoygb9ffiGfoMI6AQSnR8NRj6c7XnvLxb/QLDwUrE7+bESgKPvmiymoS01H 8d+IG2YCe2YNu5RiQy+txCfmiW6szKt9J6+eCN0uMC6ggQ3gRvUzwLCypU5hQKFCqyK/ wjK8Eck7vuhE7cQNOG9Y6eQRMy0RsWcYl8vCUlQUyUCOOKsA5yahqdyBfxI+1AGF/O5p HH3w== X-Gm-Message-State: AKS2vOwxvOho4s+cAXcXLwDI4K043JKrsUzVrt1klBV8AYGMJy6xp56k iz6rZxSGzoZbjImokP9FgUSoZvRtBpLu X-Received: by 10.223.143.77 with SMTP id p71mr26301917wrb.3.1498848733183; Fri, 30 Jun 2017 11:52:13 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.5.136 with HTTP; Fri, 30 Jun 2017 11:52:12 -0700 (PDT) In-Reply-To: <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> <20170630183826.GP13355@bidouze.vm.6wind.com> From: Jan Blunck Date: Fri, 30 Jun 2017 20:52:12 +0200 X-Google-Sender-Auth: nVC-2D2Ehd6EjXcMaNHlJkM3rRs Message-ID: To: =?UTF-8?Q?Ga=C3=ABtan_Rivet?= Cc: dev , Shreyansh Jain Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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:52:14 -0000 On Fri, Jun 30, 2017 at 8:38 PM, Ga=C3=ABtan Rivet = wrote: > 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/com= mon/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/co= mmon/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 link= ing >> + * 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. > No, its the doc that needs fixing. diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/commo= n/inc lude/rte_bus.h index 34ea9d5..2f1c911 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -118,8 +118,8 @@ typedef struct rte_device * * Device declaration. * * @return - * The pointer to a valid rte_device usable by the bus on success. - * NULL on error. rte_errno is then set. + * 0 on success. + * !0 on error. */ typedef int (*rte_bus_plug_t)(struct rte_device *dev, const char *devargs); @@ -133,7 +133,7 @@ typedef int (*rte_bus_plug_t)(struct rte_device *dev, * * @return * 0 on success. - * !0 on error. rte_errno is then set. + * !0 on error. */ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);