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 9BF6942B89; Wed, 24 May 2023 08:36:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A16340ED8; Wed, 24 May 2023 08:36:49 +0200 (CEST) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mails.dpdk.org (Postfix) with ESMTP id 1B9354067E for ; Wed, 24 May 2023 08:36:48 +0200 (CEST) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ae408f4d1aso5046265ad.0 for ; Tue, 23 May 2023 23:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684910207; x=1687502207; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=n4F+IDgvie4Cti7ZDn14TC/HubY4P+cv9oyu+1nWLfs=; b=RhYPE08IEabGYJfLClE74Oxsit+RMo2aL1jkvqUJdxIzh8Hf939003RhjG130tD5Z3 lUVTvVpdYrowCHUm5QEEXdNTRd/6dunH6mrdjkQ1Hgkwrpe4oWRhd9yHzEgERRAKP9c+ 8jsoO6dw/4zRrhAtDyVNbInihdMB6/uuksg6xxqkfatUBwhi/MDki3mq27p7ZYkcqrLu 1EVdrWQ6bEvYo8DWF4SIed5Kd3UMehPecdQ6lWhX40+dIoeqRR0n6MmHAorMJMZvYcOs ggwnBj+xJLMRAFq1F1fAYHKL2fyXcYx2x2iaDRsG60Rk8i2z5UaIaVNj3+5rWw+Q8r/Y cKMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684910207; x=1687502207; h=content-transfer-encoding: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=n4F+IDgvie4Cti7ZDn14TC/HubY4P+cv9oyu+1nWLfs=; b=l7CpQaQGKS7cv6sJni7FKBL7QAKYfMiBtbuXc+Pzm1rEHImWqFu48vAPvKGiPjx1x5 sWPM/uBmr7oAuWXcVMitHCjfXy43LjEDB3L2AVVbfTgH4cA4bNXiFgRpmK/m/h3zBdtZ zMEmbhsBVptX4w1ymTcSu0JYvQpUJhAKJ6XHRzaN5bdax84s0Hv+qWuFtrB1o2rmLpvM hId2R0DrWD9nNqgn8mSfQ+yDbMVZmvyoFTeF1gRogPDQaZPFBC3xdIU+xacCgXKuA6R7 9uDJ05/NF6I46/AJgkFRdP8DyEJ55ueF2Bk9db8L29jrodGNWtEQY0m5xPWacDjkh+VK dJkQ== X-Gm-Message-State: AC+VfDzP0twYpNPg3KHsmJR1rGni5qOMtuiDJmf32QSNeoLLk/KgY+03 tLc8oaQnjk+FFV2tGhfOtvS8u81LE+GHU9tgoBA= X-Google-Smtp-Source: ACHHUZ5KeAVF1l0/MllIkE+iyw6ZuDp3JFQLfDCCxXWBUzqwp4m8jI6BAu/FyqOM5ANCi6Rql9kTxVNUipl1SGAhL00= X-Received: by 2002:a17:903:2287:b0:1ad:b5f4:dfd5 with SMTP id b7-20020a170903228700b001adb5f4dfd5mr19755395plh.32.1684910207049; Tue, 23 May 2023 23:36:47 -0700 (PDT) MIME-Version: 1.0 References: <20230331040306.3143693-1-zhirun.yan@intel.com> <20230509060347.1237884-1-zhirun.yan@intel.com> <20230509060347.1237884-6-zhirun.yan@intel.com> In-Reply-To: <20230509060347.1237884-6-zhirun.yan@intel.com> From: Jerin Jacob Date: Wed, 24 May 2023 12:06:20 +0530 Message-ID: Subject: Re: [PATCH v6 05/15] graph: introduce graph node core affinity API To: Zhirun Yan Cc: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com, ndabilpuram@marvell.com, stephen@networkplumber.org, pbhagavatula@marvell.com, cunming.liang@intel.com, haiyue.wang@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Tue, May 9, 2023 at 11:34=E2=80=AFAM Zhirun Yan w= rote: > > Add lcore_id for node to hold affinity core id and impl > rte_graph_model_dispatch_lcore_affinity_set to set node affinity > with specific lcore. > > 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_dispatch.c | 30 +++++++++++++++++++ > lib/graph/rte_graph_model_dispatch.h | 43 ++++++++++++++++++++++++++++ Could you change all the new model file to prefix _mcore_ like below to align with enum name. rte_graph_model_mcore_dispatch.* > lib/graph/version.map | 2 ++ > 6 files changed, 78 insertions(+) > create mode 100644 lib/graph/rte_graph_model_dispatch.c > create mode 100644 lib/graph/rte_graph_model_dispatch.h > > diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h > index eacdef45f0..bd4c576324 100644 > --- a/lib/graph/graph_private.h > +++ b/lib/graph/graph_private.h > @@ -51,6 +51,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 */ Could you move to end of existing fast path variables. Also, please extend the comments for new variable introduced ONLY for dispatch model. Comment should express it is only for dispatch model. > 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 9fab8243da..c729d984b6 100644 > --- a/lib/graph/meson.build > +++ b/lib/graph/meson.build > @@ -16,6 +16,7 @@ sources =3D files( > 'graph_populate.c', > 'graph_pcap.c', > 'rte_graph_worker.c', > + 'rte_graph_model_dispatch.c', > ) > headers =3D files('rte_graph.h', 'rte_graph_worker.h') > > diff --git a/lib/graph/node.c b/lib/graph/node.c > index 149414dcd9..339b4a0da5 100644 > --- a/lib/graph/node.c > +++ b/lib/graph/node.c > @@ -100,6 +100,7 @@ __rte_node_register(const struct rte_node_register *r= eg) > goto free; > } > > + node->lcore_id =3D RTE_MAX_LCORE; > node->id =3D node_id++; > > /* Add the node at tail */ > diff --git a/lib/graph/rte_graph_model_dispatch.c b/lib/graph/rte_graph_m= odel_dispatch.c > new file mode 100644 > index 0000000000..3364a76ed4 > --- /dev/null > +++ b/lib/graph/rte_graph_model_dispatch.c > @@ -0,0 +1,30 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Intel Corporation > + */ > + > +#include "graph_private.h" > +#include "rte_graph_model_dispatch.h" > + > +int > +rte_graph_model_dispatch_lcore_affinity_set(const char *name, unsigned i= nt lcore_id) > +{ > + struct node *node; > + int ret =3D -EINVAL; Shouldn't we need to check the is model is dispatch before proceeding? If so, same comment applicable for all function created solely for new mode= l. Also, in case some _exiting_ API not valid for dispatch model, please add the check for the same. > + > + if (lcore_id >=3D RTE_MAX_LCORE) > + return ret; > + > + graph_spinlock_lock(); > + > + STAILQ_FOREACH(node, node_list_head_get(), next) { > + if (strncmp(node->name, name, RTE_NODE_NAMESIZE) =3D=3D 0= ) { > + node->lcore_id =3D lcore_id; > + ret =3D 0; > + break; > + } > + } > + > + graph_spinlock_unlock(); > + > + return ret; > +} > diff --git a/lib/graph/rte_graph_model_dispatch.h b/lib/graph/rte_graph_m= odel_dispatch.h > new file mode 100644 > index 0000000000..179624e972 > --- /dev/null > +++ b/lib/graph/rte_graph_model_dispatch.h > @@ -0,0 +1,43 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2023 Intel Corporation > + */ > + > +#ifndef _RTE_GRAPH_MODEL_DISPATCH_H_ > +#define _RTE_GRAPH_MODEL_DISPATCH_H_ _RTE_GRAPH_MODEL_MCORE_DISPATCH_H_ > + > +/** > + * @file rte_graph_model_dispatch.h > + * > + * @warning > + * @b EXPERIMENTAL: > + * All functions in this file may be changed or removed without prior no= tice. > + * > + * This API allows to set core affinity with the node. > + */ > +#include "rte_graph_worker_common.h" Move this under below "extern "C > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * Set lcore affinity with the node. Please change API description for all the API introduced for dispatch model to explicitly mention, it is valid only for dispatch model. Something like, "Set lcore affinity with the node for dispatch model" or so= . > + * > + * @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_graph_model_dispatch_lcore_affinity_set(const char *name, > + unsigned int lcore_id); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _RTE_GRAPH_MODEL_DISPATCH_H_ */ > diff --git a/lib/graph/version.map b/lib/graph/version.map > index eea73ec9ca..1f090be74e 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_graph_model_dispatch_lcore_affinity_set; Could you change all the new model API to prefix _mcore_ like below to align with enum name. rte_graph_model_mcore_dispatch_lcore_affinity_set > + > local: *; > }; > -- > 2.37.2 >