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 3FEDAA0588;
	Tue,  7 Apr 2020 15:31:48 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 8E9492B96;
	Tue,  7 Apr 2020 15:31:47 +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 6D610FFA
 for <dev@dpdk.org>; Tue,  7 Apr 2020 15:31:46 +0200 (CEST)
Received: by mail-io1-f65.google.com with SMTP id n10so3350975iom.3
 for <dev@dpdk.org>; Tue, 07 Apr 2020 06:31:46 -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=pJvRh4aT/uof/PfHMBKQ6yCi8yaNr64vBfo8cFcPyTk=;
 b=VD5xh88+NF52a+LG0VN9I2wwroDDKW7vdgN4JXnzXKHyMWNzk6+xbJPCkvpq49KhSj
 2G1mNQCupwqZr+VeQh2VLyhtPKWxLhaGAoIrdBullr3O8csrm7tv3VyObls6hNFNjBbC
 XalGq0ItdOLUKVCNRXkUEZcH/piJpb7zP3aIRoB+NIpA/HUTDYNyHK5wpBQg1YgUj++T
 4PjOROZ6iRiGfaPF97ep5uRkJOraZ0N+RLTQT33sO5IkKtc9qVrE46lgf3yAMt8DhnFh
 sKmD5ndJp5tBpui6MI8nu6cWOVfFHyUcaQ9RBwwO+DcskqMP5Lzf/8uKkGje5wheGM1s
 SHkQ==
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=pJvRh4aT/uof/PfHMBKQ6yCi8yaNr64vBfo8cFcPyTk=;
 b=jTdWUxo84omIIQ499nQyU6F3Jorvf74f2tFt6bYRC7oLF1z1gWEEoDlLdCjqann61X
 C7Hxx69gNazSUV2NkppYOAO2k25hasXdUTLkwtEFjEeHkIgWhnmUUJjNjArMaH8qf0BR
 /0L+q0yKSCEQyq7Ap7EvJ03hVfU2hA4V6Lja4jGHb2R+ei1vQBVPLFD9MmxqJUFsF3l5
 DN8JwSN/BRm/gML4l9IMh7OoSuDIoqmxQmLGwWhJMorWgBU0KhJrwgwxiD+vi8kAKZW/
 DNggtf9kkNIdWpxAcs3Rwy6Li4qrdM78yBhAFJExTMVXY86CG6GL4Hzn203zkgc0qfNC
 7law==
X-Gm-Message-State: AGi0PuYCowy11WruJ5lUtSWX2ZqhAX2NzpChJ/Yt5Km42wGZiDvPLcnc
 BGjFUUVenh+KmWDMVfnzl3znKMl5lIdPVXOwgnM=
X-Google-Smtp-Source: APiQypLz/Z43uyrgbKdqq8xShbpwlEr23DavjpgbZ3w9APh1SQketYGeAKLvfdVF1mapTYeZBvx3fb3MhwCRvrkclqA=
X-Received: by 2002:a05:6602:2f87:: with SMTP id
 u7mr2050449iow.94.1586266305522; 
 Tue, 07 Apr 2020 06:31:45 -0700 (PDT)
MIME-Version: 1.0
References: <20200331192945.2466880-1-jerinj@marvell.com>
 <20200405085613.1336841-1-jerinj@marvell.com>
 <20200405085613.1336841-6-jerinj@marvell.com>
 <097e35c5-ffb0-854c-12b6-184849f2d922@semihalf.com>
 <CALBAE1Mu_4ST4ZB4LRCw97cSQ00oJ5Er-E0qYaBr1=NpxStHug@mail.gmail.com>
 <551b1959-eb68-0265-8c22-b792fd8bff56@semihalf.com>
In-Reply-To: <551b1959-eb68-0265-8c22-b792fd8bff56@semihalf.com>
From: Jerin Jacob <jerinjacobk@gmail.com>
Date: Tue, 7 Apr 2020 19:01:28 +0530
Message-ID: <CALBAE1M7tiZDLpJvQwuYm71aQjjvSnDkntJ=X8rYzgG19qWdrg@mail.gmail.com>
To: Andrzej Ostruszka <amo@semihalf.com>
Cc: dpdk-dev <dev@dpdk.org>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v4 05/29] graph: implement internal graph
 operation helpers
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 Tue, Apr 7, 2020 at 6:24 PM Andrzej Ostruszka <amo@semihalf.com> wrote:

> >
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next) {
> >>> +             if (graph_node->node->flags & RTE_NODE_SOURCE_F) {
> >>> +                     if (graph_node->node->nb_edges == 0)
> >>> +                             SET_ERR_JMP(EINVAL, fail,
> >>> +                                         "%s node needs minimum one edge",
> >>> +                                         graph_node->node->name);
> >>> +                     if (graph_bfs(graph, graph_node))
> >>> +                             goto fail;
> >>> +             }
> >>> +     }
> >>> +
> >>> +     STAILQ_FOREACH(graph_node, &graph->node_list, next)
> >>> +             if (graph_node->visited == false)
> >>> +                     SET_ERR_JMP(EINVAL, fail, "Found isolated node %s",
> >>> +                                 graph_node->node->name);> +
> >>> +     return 0;
> >>
> >> You don't want to clear visited because it will not be used or cleared
> >> on next call?
> >
> > See above graph_mark_nodes_as_not_visited() function.
>
> Yes I noticed that and referred to it in the question.  My intention was
> to ask whether you are fine with graph having visited=true for the rest
> of its life, or should we clear them again at the end of this function.

Got it. For now, visted=true is OK for the rest of it its life.

Since it needs to go over all the nodes to clear it again. As an optimization,
I thought of exposing  graph_mark_nodes_as_not_visited() and
 graph_bfs() is exported in graph_private.h. Those primitives would be enough
to make other use cases when needed.


>
> With regards
> Andrzej Ostruszka