From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5CB1641CEC; Mon, 20 Feb 2023 15:05:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFE5C43053; Mon, 20 Feb 2023 15:05:55 +0100 (CET) Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) by mails.dpdk.org (Postfix) with ESMTP id 1E7B640395 for ; Mon, 20 Feb 2023 15:05:54 +0100 (CET) Received: by mail-vs1-f48.google.com with SMTP id df34so2724843vsb.6 for ; Mon, 20 Feb 2023 06:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1676901953; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YLwrr63aSm4hajHn1fdU83WlC4b8ejdjgmH4rSJxfHE=; b=g2vM1vS7FkcMo+ehGzh7nnF/bWeEuiM/7C/vavnae0fZ9wP3Mt1mvjT2BRlh1VmsLd K9Begm9JtguET3DOpp5KQG3phc4Be9i3xTdVyQlh9Lmtrbpcde0D1Wk4Lk+fr/Bw1Brx 9L/c+uJoI2wV0n1MXTDYFmw43QdDB4Nu8SdSWnGjhpzT1w9BAl9VQ9qlA7IYMk48mwCu 0UUx0RDgPIFBw1YTtyTmnbPBGFeIU6lhBkSO/X9hQga4hMK+a/WdiUuvMefZttWO2dRW oOd+CS+8MtKfUampuvLQiqTOv6nufgf46YqPv3WRx+tKXPJCoP1MvitHGkwJtfprmYhv OjbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676901953; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YLwrr63aSm4hajHn1fdU83WlC4b8ejdjgmH4rSJxfHE=; b=ICn2EsLkvqPlX7QjNVJ69VqPTzk+oOhX+MgCedlqpMB4XkltjoPb3348H30RLR3q4G KB2XY7UQrz1z73vqvDUD8/eULoEFe0dyV6v7Ya00TuzWRWMd53elJrNJbaB8TPuSs2gW y8TlyoPzPCQUgHcFkM8UrcvG2GmNmiN9tgQdU0GKQyqMb1WvNgHwtY9JD3xcn4Q+GJwC EXWIZ7ldADn/ZAetQQx0WGb2BVU9EqtMDUq5QLAQvcjXi/3TbsARFW3Z4PZykWjc7989 i6oZaBtS6/WjdfgZiQdFbHHJKn3L/Uh8+sdK2cMeW/+UrC2vRWqSTSlhJygRfprz8Oi9 NPhA== X-Gm-Message-State: AO0yUKWG2l7/rqjCKCMLdbOSolXzftWGeRpTMkqUSMrVfPOghm9RdmxR c73lHiQ/K7zdex7lGTXEUPSTTD9Iu6ajLpG5mtU= X-Google-Smtp-Source: AK7set+YSMNk5fNK4M3twMAvYHEAa7moMiQYHM2dci4xpHBtKcSipWk7Y8rgoZWT2xDk+pDzMZKmVr7W+KETd1dW6JM= X-Received: by 2002:a05:6102:38d4:b0:3f0:89e1:7c80 with SMTP id k20-20020a05610238d400b003f089e17c80mr277233vst.72.1676901953284; Mon, 20 Feb 2023 06:05:53 -0800 (PST) MIME-Version: 1.0 References: <20221117050926.136974-1-zhirun.yan@intel.com> <20221117050926.136974-6-zhirun.yan@intel.com> In-Reply-To: <20221117050926.136974-6-zhirun.yan@intel.com> From: Jerin Jacob Date: Mon, 20 Feb 2023 19:35:27 +0530 Message-ID: Subject: Re: [PATCH v1 05/13] graph: introduce core affinity API To: Zhirun Yan Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, cunming.liang@intel.com, haiyue.wang@intel.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Nov 17, 2022 at 10:40 AM Zhirun Yan wrote: > > 1. add lcore_id for node to hold affinity core id. > 2. impl rte_node_model_generic_set_lcore_affinity to affinity node > with one lcore. > 3. update version map for graph public API. No need to explicitly tell 3. Rewrite 1 and 2 , one or two sentence without 1 and 2. > > Signed-off-by: Haiyue Wang > Signed-off-by: Cunming Liang > Signed-off-by: Zhirun Yan > --- > lib/graph/graph_private.h | 1 + > lib/graph/meson.build | 1 + > lib/graph/node.c | 1 + > lib/graph/rte_graph_model_generic.c | 31 +++++++++++++++++++++ > lib/graph/rte_graph_model_generic.h | 43 +++++++++++++++++++++++++++++ > lib/graph/version.map | 2 ++ > 6 files changed, 79 insertions(+) > create mode 100644 lib/graph/rte_graph_model_generic.c > create mode 100644 lib/graph/rte_graph_model_generic.h > > diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h > index f9a85c8926..627090f802 100644 > --- a/lib/graph/graph_private.h > +++ b/lib/graph/graph_private.h > @@ -49,6 +49,7 @@ struct node { > STAILQ_ENTRY(node) next; /**< Next node in the list. */ > char name[RTE_NODE_NAMESIZE]; /**< Name of the node. */ > uint64_t flags; /**< Node configuration flag. */ > + unsigned int lcore_id; /**< Node runs on the Lcore ID */ > rte_node_process_t process; /**< Node process function. */ > rte_node_init_t init; /**< Node init function. */ > rte_node_fini_t fini; /**< Node fini function. */ > diff --git a/lib/graph/meson.build b/lib/graph/meson.build > index c7327549e8..8c8b11ed27 100644 > --- a/lib/graph/meson.build > +++ b/lib/graph/meson.build > @@ -14,6 +14,7 @@ sources = files( > 'graph_debug.c', > 'graph_stats.c', > 'graph_populate.c', > + 'rte_graph_model_generic.c', > ) > headers = files('rte_graph.h', 'rte_graph_worker.h') > > diff --git a/lib/graph/node.c b/lib/graph/node.c > index fc6345de07..8ad4b3cbeb 100644 > --- a/lib/graph/node.c > +++ b/lib/graph/node.c > @@ -100,6 +100,7 @@ __rte_node_register(const struct rte_node_register *reg) > goto free; > } > > + node->lcore_id = RTE_MAX_LCORE; > node->id = node_id++; > > /* Add the node at tail */ > diff --git a/lib/graph/rte_graph_model_generic.c b/lib/graph/rte_graph_model_generic.c > new file mode 100644 > index 0000000000..54ff659c7b > --- /dev/null > +++ b/lib/graph/rte_graph_model_generic.c > @@ -0,0 +1,31 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2022 Intel Corporation > + */ > + > +#include "graph_private.h" > +#include "rte_graph_model_generic.h" > + > +int > +rte_node_model_generic_set_lcore_affinity(const char *name, unsigned int lcore_id) Please use action/verb as last. Also It is graph specific API. Right? I would suggest, rte_graph_model_pipeline_lcore_affinity_set() > diff --git a/lib/graph/rte_graph_model_generic.h b/lib/graph/rte_graph_model_generic.h > new file mode 100644 > index 0000000000..20ca48a9e3 > --- /dev/null > +++ b/lib/graph/rte_graph_model_generic.h > @@ -0,0 +1,43 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2022 Intel Corporation > + */ > + > +#ifndef _RTE_GRAPH_MODEL_GENERIC_H_ > +#define _RTE_GRAPH_MODEL_GENERIC_H_ > + > +/** > + * @file rte_graph_model_generic.h > + * > + * @warning > + * @b EXPERIMENTAL: > + * All functions in this file may be changed or removed without prior notice. > + * > + * This API allows a worker thread to walk over a graph and nodes to create, > + * process, enqueue and move streams of objects to the next nodes. > + */ > +#include "rte_graph_worker_common.h" > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * Set lcore affinity to the node. > + * > + * @param name > + * Valid node name. In the case of the cloned node, the name will be > + * "parent node name" + "-" + name. > + * @param lcore_id > + * The lcore ID value. > + * > + * @return > + * 0 on success, error otherwise. > + */ > +__rte_experimental > +int rte_node_model_generic_set_lcore_affinity(const char *name, unsigned int lcore_id); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_GRAPH_MODEL_GENERIC_H_ */ > diff --git a/lib/graph/version.map b/lib/graph/version.map > index eea73ec9ca..33ff055be6 100644 > --- a/lib/graph/version.map > +++ b/lib/graph/version.map > @@ -46,5 +46,7 @@ EXPERIMENTAL { > rte_graph_worker_model_set; > rte_graph_worker_model_get; > > + rte_node_model_generic_set_lcore_affinity; > + > local: *; > }; > -- > 2.25.1 >