From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E520C2BB1D for ; Tue, 7 Apr 2020 12:09:20 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 2EBF22051A for ; Tue, 7 Apr 2020 12:09:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g97uIdGR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2EBF22051A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E9EDF2BD8; Tue, 7 Apr 2020 14:09:18 +0200 (CEST) Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) by dpdk.org (Postfix) with ESMTP id 820132B96 for ; Tue, 7 Apr 2020 14:09:17 +0200 (CEST) Received: by mail-il1-f196.google.com with SMTP id j9so2912582ilr.7 for ; Tue, 07 Apr 2020 05:09:17 -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=/TndwEj9fcgnVSGugOxUW5LHtHtAO4XuJWUah5olOZM=; b=g97uIdGRWGt9lQq0XqjcNmhpmgtm7nsjXvdifYXOB4amis/ovygIaT2dgw0b0TkCAs LBUFWMQ8G+xP+a65BPcLAV9o45An5KGeKAKAp6sD36V5g3P9OEq5WWv4w+fB8M65MEnM b2q0XcXopT0XXeJOgJS/S2a4ctlkHsbAmw73PODmR2QkbYueoQ0gvQcsYvckW1FlOGaz ZsEwP8NrJZGk5HG2wWLxbfTruhuz3iiGyhVPnyUDTM2dLjpjBVCdMb7nqNMpdHQkqiDT rbiyLhJzhZaGHtrjwkLtnDz4q8yYjOsU3i3C49TvI+H6Y1bYfvQeTpyZGgZ17VyHOPzD 72UA== 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=/TndwEj9fcgnVSGugOxUW5LHtHtAO4XuJWUah5olOZM=; b=hSsTpDulYXgAbJJcBfSwkPVXek5exvrYJj+NpCmDFzC5nwgDnSGaECMAnjX+y3Ax8p 1aRii9LFiGMN87TTon/dzBa9XrazWgsKXKbHQMm/CiLFG6w7etyo4WCqWjRmRmJ2VvE5 uBZcIKJWXD4X49nmUu84xnO81mGaZXiRfGKjLo/+02g0Q3TrCNZMXUftk5hCQY/iKs0I FhtMbCUv3dNQqDaAXOrsBZGrc2cXGV7bVrRyb+soiLb/RMMIMTcfIgZnHcRtfNRycWzU 5uSDaqKiZPtUEUMcT6wrfowBbqTfzWnXyVTaR7LZYkbgXs+9xgA4sxNNRXsRvDyUcSTB 7u2Q== X-Gm-Message-State: AGi0Pua4uu8spA8rjqTyDLXNGBD/Kp2XLHFZT0M0Kwq/44O52u5xM3TD IChzBftB2Ce+uedrlJrToGL8w4GhQoGNmi8i6xI= X-Google-Smtp-Source: APiQypKM4TsGvZbwSFomm9gbvIqQoKYayfrBMYLYJU5dsiXoNI6Wc0278DLsfB3X11DbopdK867sXqez9oPMePiU7eM= X-Received: by 2002:a92:48cb:: with SMTP id j72mr2090696ilg.162.1586261356627; Tue, 07 Apr 2020 05:09:16 -0700 (PDT) MIME-Version: 1.0 References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@marvell.com> <20200405085613.1336841-5-jerinj@marvell.com> <020f8ab9-71e7-b5af-926f-ab52cc342fd4@semihalf.com> In-Reply-To: From: Jerin Jacob Date: Tue, 7 Apr 2020 17:39:00 +0530 Message-ID: To: Andrzej Ostruszka Cc: Jerin Jacob , Kiran Kumar K , dpdk-dev , Thomas Monjalon , David Marchand , Ray Kinsella , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Pavan Nikhilesh , Nithin Dabilpuram , Xiao Wang Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 04/29] graph: implement node debug routines 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 Tue, Apr 7, 2020 at 5:20 PM Andrzej Ostruszka wrote: > > On 4/7/20 12:22 PM, Jerin Jacob wrote: > > On Mon, Apr 6, 2020 at 11:47 PM Andrzej Ostruszka wrote: > >> > >> On 4/5/20 10:55 AM, jerinj@marvell.com wrote: > >>> From: Jerin Jacob > >>> > >>> Adding node debug API implementation support to dump > >>> single or all the node objects to the given file. > >>> > >>> Signed-off-by: Jerin Jacob > >>> Signed-off-by: Kiran Kumar K > >>> Signed-off-by: Pavan Nikhilesh > >>> Signed-off-by: Nithin Dabilpuram > >> [...] > >>> diff --git a/lib/librte_graph/node.c b/lib/librte_graph/node.c > >>> index d04a0fce0..8592c1221 100644 > >>> --- a/lib/librte_graph/node.c > >>> +++ b/lib/librte_graph/node.c > >>> @@ -377,6 +377,38 @@ rte_node_edge_get(rte_node_t id, char *next_nodes[]) > >>> return rc; > >>> } > >>> > >>> +static void > >>> +node_scan_dump(FILE *f, rte_node_t id, bool all) > >>> +{ > >>> + struct node *node; > >>> + > >>> + RTE_ASSERT(f != NULL); > >> > >> Why the assert? Below this is used in public (I guess) functions so > >> user can provide wrong input - in that case I'd expect warning/error not > >> an assert. > > > > Public API rte_node_dump() and node_scan_dump() calls this API without > > any check. > > That was my point. I would expect either there or here to have a check > for arg instead of assert. I'd say that asserts are very good for > checking internal logic, but not so for checking if user input is OK. All DPDK _dump() functions returns void. I thought, We will keep the same here. Another option is. if it is NULL we can return. i.e -RTE_ASSERT(f != NULL); +if (f == NULL) + return Either scheme is OK with me, Let me know your preference, I will change accordingly. > > But I'm fine if you ignore this. > > With regards > Andrzej Ostruszka