From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id F03F0A059F;
	Fri, 10 Apr 2020 15:11:43 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2F8EB1C209;
	Fri, 10 Apr 2020 15:11:43 +0200 (CEST)
Received: from mail-io1-f65.google.com (mail-io1-f65.google.com
 [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id 62BDD1C1D9
 for <dev@dpdk.org>; Fri, 10 Apr 2020 15:11:41 +0200 (CEST)
Received: by mail-io1-f65.google.com with SMTP id b12so1672640ion.8
 for <dev@dpdk.org>; Fri, 10 Apr 2020 06:11:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=DGTljAFbFK3GCr2eFh3qKbK0SecOcKYJpnyf1N1ThX0=;
 b=CdssnefM+DqsBS9nTxvrt1emhHGzo3AQT403KBIEApdoVSZw5uDeupEy3ayMgc/y4c
 +nNBcvBmfh7elRPBZVlSDZ89B0IQPsoRvxczApeYJWex/Qvl5McJdFFwAheGCSfKWpSZ
 OWWPv0sjN9oshCfdw4/kdwvaKnAXmKt8ONetPtH4JXHmOiXsyxFBcQIyIoZ96U5YIkMx
 74/GSFSsOElptRrbYXtV8HlMJp0haNi5vLs617xSdj/i1BVaz6Gzi21hluj5iyL4yFEP
 Mw7bQWQVHltr8Iotzc8gwXpyoUWSVveObn7EspZ4y97GdmPO+jxxfmuABW6frCfDGJ62
 7kLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=DGTljAFbFK3GCr2eFh3qKbK0SecOcKYJpnyf1N1ThX0=;
 b=J+mzQ0WpJzSVDFQtqQjNGBj+POehGAqMx5ooNPOIVbVlerpolCuxptOJvVlkP6ecx4
 lDiH7deqPRfiN33a0y7ZEO9IX4q168JgFQoahoayAv9h6v0OWGCC7tL13Z40EVi3WwJu
 UnY6GFOQYld/kdpTB35c1IybCHSVtI+dcTXSACzvvcO4icaqzYPfoiCPUR/Mp6NmLh1F
 L4Wa9/zptD0a9eBaErJkMlGcepKwfii6tffsn+YcZ9Q4Ns29P22FIKrQy4gSL2b7gPbU
 NipFB7a53cEWkgmaXXDorKUhFY5p7FyhtpfSFCDs/LpZqV0w7FMkkN2W75WJqcGmNahg
 uTcA==
X-Gm-Message-State: AGi0PuZr9MQ9uYjP2mneJs30pxqwwKOWpRtIkqYd0LJjE0hxdhXo4NR8
 3Ss29mjlEBcEjZQCXs+CUbiYeChCnOWz9UUYZ2c=
X-Google-Smtp-Source: APiQypLFVNA6K6B9ro8+qI7Nxdmc2WlrP1Pjuu4KEvZ31EyWwXq6ESPD3ahBHCTXIxZbkD8i4MzNyyzfZwRcJW7L0Mw=
X-Received: by 2002:a05:6602:450:: with SMTP id
 e16mr4084542iov.163.1586524300568; 
 Fri, 10 Apr 2020 06:11:40 -0700 (PDT)
MIME-Version: 1.0
References: <1583114253-15345-1-git-send-email-xiangxia.m.yue@gmail.com>
 <1586444567-9311-1-git-send-email-xiangxia.m.yue@gmail.com>
 <CALBAE1NRqEKwkphMf-aVk-g5242ub5KHFrEdqJdUEaP0vdAEDQ@mail.gmail.com>
In-Reply-To: <CALBAE1NRqEKwkphMf-aVk-g5242ub5KHFrEdqJdUEaP0vdAEDQ@mail.gmail.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Fri, 10 Apr 2020 18:41:24 +0530
Message-ID: <CALBAE1NE54-5Ar=ThymW2twpfKew+mOnkGhV14H7DZ281_inrA@mail.gmail.com>
To: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Cc: Olivier Matz <olivier.matz@6wind.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>, 
 Gage Eads <gage.eads@intel.com>,
 "Artem V. Andreev" <artem.andreev@oktetlabs.ru>, 
 Jerin Jacob <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>, 
 Vamsi Attunuru <vattunuru@marvell.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,
 David Marchand <david.marchand@redhat.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>, 
 "Richardson, Bruce" <bruce.richardson@intel.com>, dpdk-dev <dev@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH dpdk-dev v2 1/2] eal: introduce rte-init
 queue for libraries initialization
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Fri, Apr 10, 2020 at 11:48 AM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>

Three more items are missing in this patch

1) Unit test case for new API
2) Make the new API __rte_experimal
3) Update the .map file


> On Thu, Apr 9, 2020 at 8:33 PM <xiangxia.m.yue@gmail.com> wrote:
> >
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >
> > This patch introduces last-init queue, user can register a
> > callback for theirs initialization. Running rte_last_init_run(),
>
> The above section needs to be rewritten wrt v2 changes.
>
> > the almost resource of DPDK are available, such as memzone, ring.
> > With this way, user don't introduce additional codes in eal layer.
> >
> > [This patch will be used for next patch.]
>
> See below
>
>
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> See above
>
> Move [This patch will be used for next patch.] here to avoid
> unnecessary information in the git commit.
>
> > v2:
> > * rename rte_last_init_register ->rte_init_register
> > * rename rte_last_init struct ->rte_init
> > * rename rte_init_cb ->rte_init_cb_t
> > * free the rte_init node when not used.
> > * remove rte_init and others to eal_private.h
> > * add comments
> > * fix checkpatch warning
> > ---
> > diff --git a/lib/librte_eal/include/rte_init.h b/lib/librte_eal/include/rte_init.h
> > new file mode 100644
> > index 0000000..636efff
> > --- /dev/null
> > +++ b/lib/librte_eal/include/rte_init.h
> > @@ -0,0 +1,59 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright 2020 DPDK Community
> > + */
> > +
> > +#ifndef _RTE_INIT_H_
> > +#define _RTE_INIT_H_
>
> @file section is missing. See
> lib/librte_eal/common/include/rte_errno.h as example.
>
>
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +#include <stdio.h>
> > +#include <sys/queue.h>
>
> <sys/queue.h> is not required in public API header file.
>
> > +
> > +/**
> > + * Implementation specific callback function which is
> > + * responsible for specificed initialization.
> > + *
> > + * This is called when almost resources are available.
> > + *
> > + * @return
> > + *     0 for successful callback
> > + *     Negative for unsuccessful callback with error value
> > + */
> > +typedef int (*rte_init_cb_t)(const void *arg);
> > +
> > +/**
> > + * rte_init type.
> > + *
> > + * The rte_init of RTE_INIT_PRE are called firstly,
> > + * and then RTE_INIT_POST.
> > + */
> > +enum rte_init_type {
> > +       RTE_INIT_PRE,
>
> Type specific comment is missing.
>
> Example as reference for formatting.
>
> /**
>  * Enumerate trace mode operation.
>  */
> enum rte_trace_mode_e {
>         /**
>          * In this mode, When no space left in trace buffer, the subsequent
>          * events overwrite the old events in the trace buffer.
>          */
>         RTE_TRACE_MODE_OVERWRITE,
>         /**
>          * In this mode, When no space left on trace buffer, the subsequent
>          * events shall not be recorded in the trace buffer.
>          */
>         RTE_TRACE_MODE_DISCARD,
> };
>
> > +       RTE_INIT_POST
> > +};
>
>
> > +
> > +/**
> > + * Register a rte_init callback.
> > + *
> > + * @param cb
> > + *   A pointer to a rte_init_cb structure, which will be used
>
> s/used/invoked?
>
> > + *   in rte_eal_init().
> > + *
> > + * @param arg
> > + *   The cb will use that as param.
> > + *
> > + * @param type
> > + *   The type of rte_init registered.
> > + */
> > +
> > +void rte_init_register(rte_init_cb_t cb, const void *arg,
> > +                      enum rte_init_type type);
> > +
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
> > +#endif /* _RTE_INIT_H_ */