From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 77E7F42B89;
	Wed, 24 May 2023 09:14:38 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 652C840ED8;
	Wed, 24 May 2023 09:14:38 +0200 (CEST)
Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com
 [209.85.217.50]) by mails.dpdk.org (Postfix) with ESMTP id EE7924067E
 for <dev@dpdk.org>; Wed, 24 May 2023 09:14:36 +0200 (CEST)
Received: by mail-vs1-f50.google.com with SMTP id
 ada2fe7eead31-437e8282c1fso181436137.2
 for <dev@dpdk.org>; Wed, 24 May 2023 00:14:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684912476; x=1687504476;
 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=ifWrRcXVoVGqSxU5P2aH3mm9FJx1YD7PO48kZYazkuM=;
 b=iVy+F8Vm0yj0z529T93TwEC0LkopMprLjDpdm3+Sq+AaMk1zviCwZZMaGWAq1HB45i
 JYPbrQPELsRTzeQvWPzfCNuQPpTqy3HsuMPlmUscjD7lrgR7KayH+rOP0+C5UjK8a56m
 ehM70J0EED+GnyWMONocVuE6RZ2oVBCWKXXpkaZ5u1bdxAb7IpUrFJ9y47mxms+Hx1Jt
 mjQTjv73QRyq1WAVqrWhN+BKZAiSqNzyqgErW8VmpJWedoH2Kzdu7hpjSePOUFnxS+q5
 6rAAXDNXFWTGdW/KBvrzI0ysi4dNsiqqnDA4ffr16evBjAjHJ0qCRmTzzEe8Ju0xrxWF
 6ZeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684912476; x=1687504476;
 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=ifWrRcXVoVGqSxU5P2aH3mm9FJx1YD7PO48kZYazkuM=;
 b=gBAdaL4lPbFGuG1MNtR/0O0I35zhR86iJFeRHRyHM41+9pIr3RYTNpmcWMDmv7CfCg
 iTfFuWmz1YLjupM5waEgAHz2m6JZcDwi8tauHdL66oMEFbb0AGjk7NrSjBJMq9UOK/gD
 6h9kxhEhCzXhYbmdncNIcdeBdPekwefy+sOW2qi9iFeL2dZDomixsmM75W9klsy8VeYa
 NhxipAxcjMxhkSSm0fnmWn7//j2PX8j0OC0Ep1SYVOzN0N8H1XJcPapfCrw1g0LH689k
 pO6GfsscnLFNWPb/bBbs3RFqRPMevvUMBJchhkSli1BecpedyVYLOJkrpT8INDlDJspD
 v61g==
X-Gm-Message-State: AC+VfDxFJHWs9bhGsfAQFC2MPMmkRlrUYkthSFh6APWlitHYFRjF8BeS
 SLs2/RGmjoMlOexOvDc98IgBNg2CxocrWdB9jsWLqAWe/VsLIw==
X-Google-Smtp-Source: ACHHUZ4JIrXxJskFXzXpKEsB/6RlBBzP+L92S/EFBl4ScxFAMl1aRfThtjcfagngh8eQK7w4WN1+sJAR3/H8nes7Ruo=
X-Received: by 2002:a67:d099:0:b0:436:2c6f:205f with SMTP id
 s25-20020a67d099000000b004362c6f205fmr3708727vsi.5.1684912476223; Wed, 24 May
 2023 00:14:36 -0700 (PDT)
MIME-Version: 1.0
References: <20230331040306.3143693-1-zhirun.yan@intel.com>
 <20230509060347.1237884-1-zhirun.yan@intel.com>
 <20230509060347.1237884-8-zhirun.yan@intel.com>
In-Reply-To: <20230509060347.1237884-8-zhirun.yan@intel.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Wed, 24 May 2023 12:44:10 +0530
Message-ID: <CALBAE1NfxVNFCeMUgyGRMfkxdhGkch=hRiFYYiUEf+g_T4p1DA@mail.gmail.com>
Subject: Re: [PATCH v6 07/15] graph: introduce graph clone API for other
 worker core
To: Zhirun Yan <zhirun.yan@intel.com>
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 <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

On Tue, May 9, 2023 at 11:35=E2=80=AFAM Zhirun Yan <zhirun.yan@intel.com> w=
rote:
>
> This patch adds graph API for supporting to clone the graph object for
> a specified worker core. The new graph will also clone all nodes.
>
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> ---
> +
> +static rte_graph_t
> +graph_clone(struct graph *parent_graph, const char *name)
> +{
> +       struct graph_node *graph_node;
> +       struct graph *graph;
> +
> +       graph_spinlock_lock();
> +
> +       /* Don't allow to clone a node from a cloned graph */

Both clone_name() and graph_clone() kind of duplicate
rte_node_clone(), Please check, Can we have common _private_ function
to reuse just the common code between them


> +
>  rte_graph_t
>  rte_graph_from_name(const char *name)
>  {
> diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
> index f63b339d81..52ca30ed56 100644
> --- a/lib/graph/graph_private.h
> +++ b/lib/graph/graph_private.h
> @@ -99,6 +99,8 @@ struct graph {
>         /**< Circular buffer mask for wrap around. */
>         rte_graph_t id;
>         /**< Graph identifier. */
> +       rte_graph_t parent_id;
> +       /**< Parent graph identifier. */
>         unsigned int lcore_id;
>         /**< Lcore identifier where the graph prefer to run on. */
>         size_t mem_sz;
> diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h
> index c523809d1f..2f86c17de7 100644
> --- a/lib/graph/rte_graph.h
> +++ b/lib/graph/rte_graph.h
> @@ -247,6 +247,26 @@ rte_graph_t rte_graph_create(const char *name, struc=
t rte_graph_param *prm);
>  __rte_experimental
>  int rte_graph_destroy(rte_graph_t id);
>
> +/**
> + * Clone Graph.
> + *
> + * Clone a graph from static graph (graph created from rte_graph_create)=
. And

rte_graph_create->rte_graph_create()

> + * all cloned graphs attached to the parent graph MUST be destroyed toge=
ther


Can we add reference count in the implementation to avoid this
limition. If this too much for this release, we can try to add next
release

> + * for fast schedule design limitation (stop ALL graph walk firstly).
> + *
> + * @param id
> + *   Static graph id to clone from.
> + * @param name
> + *   Name of the new graph. The library prepends the parent graph name t=
o the
> + * user-specified name. The final graph name will be,
> + * "parent graph name" + "-" + name.
> + *
> + * @return
> + *   Valid graph id on success, RTE_GRAPH_ID_INVALID otherwise.
> + */
> +__rte_experimental
> +rte_graph_t rte_graph_clone(rte_graph_t id, const char *name);
> +
>  /**
>   * Get graph id from graph name.
>   *
> diff --git a/lib/graph/version.map b/lib/graph/version.map
> index 7de6f08f59..aaa86f66ed 100644
> --- a/lib/graph/version.map
> +++ b/lib/graph/version.map
> @@ -7,6 +7,7 @@ EXPERIMENTAL {
>
>         rte_graph_create;
>         rte_graph_destroy;
> +       rte_graph_clone;


Found new generic graph API, Please add test case for it at
app/test/test_graph.c.



>         rte_graph_dump;
>         rte_graph_export;
>         rte_graph_from_name;
> --
> 2.37.2
>