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 DA0CCA0093; Mon, 7 Mar 2022 12:00:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE49140688; Mon, 7 Mar 2022 12:00:21 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 7A8064014E for ; Mon, 7 Mar 2022 12:00:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646650819; x=1678186819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kVxHU87D+y10urVuzSR9pPN9vWgAbIu6ZQbtU9hMWbA=; b=durc2xX8QSuVQnmsoiaFttqT8+4TIxpG3UmPskQiAC4h4uBswk61s3ej J+pbMAn3sxZUmcAETO7FClaOAeaHjdgu83YpdK8Km1Zq0tJXX2vpd12GD aWN9IvprNty9aC/9JGR9TWruj8sJHJcArKMurUoFKlha8hubHaEMSXg/L EFfYALQrupOyMISbN5XfSHEcjg24rhc59h/2Bc80Es4ZqzgnV1xMjKg+E Y802LpIN4/mnOsoBSDjhireSBuXYgViez99Cf66ood0t49cwYN/aV3da6 lV1yecu039DVOHyMjRr3eYN15VuBhEnI2/RzlGL6yB6OhU7vlZdiC2LP6 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="254555254" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254555254" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 03:00:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,161,1643702400"; d="scan'208";a="512641480" Received: from npg-dpdk-haiyue-2.sh.intel.com ([10.67.118.240]) by orsmga006.jf.intel.com with ESMTP; 07 Mar 2022 03:00:16 -0800 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang , Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Subject: [PATCH v3] graph: remove the useless duplicate name check Date: Mon, 7 Mar 2022 18:25:56 +0800 Message-Id: <20220307102556.1011130-1-haiyue.wang@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <0220307064318.1002855-1-haiyue.wang@intel.com> References: <0220307064318.1002855-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The node clone API parameter 'name' is the new node's postfix name, not the final node name, so it makes no sense to check it. And the new name will be checked duplicate when calling API '__rte_node_register'. And update the test case to call clone API twice to check the real name duplicate. Signed-off-by: Haiyue Wang --- v3: No need to define another node id var. v2: update the test case. --- app/test/test_graph.c | 6 ++++++ lib/graph/node.c | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index 35e1a95b89..1a2d1e6fab 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -550,6 +550,12 @@ test_node_clone(void) node_id = rte_node_from_name("test_node00"); tm->test_node[0].idx = node_id; + dummy_id = rte_node_clone(node_id, "test_node00"); + if (rte_node_is_invalid(dummy_id)) { + printf("Got invalid id when clone, Expecting fail\n"); + return -1; + } + /* Clone with same name, should fail */ dummy_id = rte_node_clone(node_id, "test_node00"); if (!rte_node_is_invalid(dummy_id)) { diff --git a/lib/graph/node.c b/lib/graph/node.c index 79230035a2..ae6eadb260 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -150,10 +150,6 @@ node_clone(struct node *node, const char *name) goto fail; } - /* Check for duplicate name */ - if (node_has_duplicate_entry(name)) - goto fail; - reg = calloc(1, sizeof(*reg) + (sizeof(char *) * node->nb_edges)); if (reg == NULL) { rte_errno = ENOMEM; -- 2.35.1