From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D129A0599; Fri, 10 Apr 2020 08:18:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4F9AD1C1AE; Fri, 10 Apr 2020 08:18:39 +0200 (CEST) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by dpdk.org (Postfix) with ESMTP id 11A011C1AD for ; Fri, 10 Apr 2020 08:18:38 +0200 (CEST) Received: by mail-io1-f67.google.com with SMTP id i3so787401ioo.13 for ; Thu, 09 Apr 2020 23:18:37 -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=OlCVxoN43fnWxzNYkTAXNw60X3gR94aQBmQ0j5V+VnQ=; b=YhOJDPwIuryeOR2mWlb3TfQtQ/A9RuB21eQfsPM8b2kY5zXX6llhoMFKp4F0XS8190 4CB3i1xjrVvldudIP7DxyNuhpw+BuxaetjIw0MzGC1Xq/0tx3bARVVtdNv1OkCsZ9Q+g EyTusvCPeOx+I4hYBRT3hf5Ril/9IadoI51BKMsxEVDbG7o9Bkc5AvaFgryQ8QOhl9qe eLesp7O9pDQzOoud4p/sFm/uUJGKiE6aaVw5qJR/7PHRv25FKTo+8vrUf8FmiD5luvOu ApxrKRPc6eSZ5qvsdb4JzH7S0p3ub2xA7IwZu+l9V+8lIRSYIPjKhC5rYRKLIa1L0WCM dCGA== 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=OlCVxoN43fnWxzNYkTAXNw60X3gR94aQBmQ0j5V+VnQ=; b=CMKYF900ZRGXNjwcrTnDQtoZJsCKI2Q5Hm+16FiMfjmRzy4JsO001Xkx8jMmmFzB9b edX8brMsSXpoMFbaMR/sD7rzqz0wbZl2ZKyWXtYQ9TnJ1REloEWdXh5N140mEhqVe0k+ pKv+MF2N0g065MiRH60sD07Y8FNZ5ftfrE0Lv3RIAm54o4sAy+PHqxNOQQayJEuaRkpD pBRl8+aJb8vkMXTT4tpeAPRlwceEJ6SnWedrQQkRCedkyVqsyu5IgDQFuCe+kW2uSz6m x2IomMblMbRU1QK9W7U7c+3ZrpXsa+4WUwDsxdWUC5NYOZf012qPaSYqQEYnfWzwCE9u M/GA== X-Gm-Message-State: AGi0PuaZz8kiXdvBjcvKRNSO4YQJT9WW/pj6n0oEB0wUXf6Zu3OHtwRB i3ytjWy4gbaSPh6JlFkfvKzw0cwxw1oRIguR3eM= X-Google-Smtp-Source: APiQypJ6nxOy9ctq/YKvZZO4eP2L0PGRj3/P+yzDwVLjIfVzpSkNah9JioznIIleokw8snyENArCKC9e/7BzVMdt84c= X-Received: by 2002:a05:6602:2f87:: with SMTP id u7mr2842247iow.94.1586499517248; Thu, 09 Apr 2020 23:18:37 -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> In-Reply-To: <1586444567-9311-1-git-send-email-xiangxia.m.yue@gmail.com> From: Jerin Jacob Date: Fri, 10 Apr 2020 11:48:21 +0530 Message-ID: To: Tonghao Zhang Cc: Olivier Matz , Andrew Rybchenko , Gage Eads , "Artem V. Andreev" , Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru , Hemant Agrawal , David Marchand , Anatoly Burakov , "Richardson, Bruce" , dpdk-dev 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Apr 9, 2020 at 8:33 PM wrote: > > From: Tonghao Zhang > > 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 > --- 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 > +#include 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_ */