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 0DFC3A0093; Mon, 7 Mar 2022 09:15:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D05CE41165; Mon, 7 Mar 2022 09:15:48 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id CBD264068F for ; Mon, 7 Mar 2022 09:15:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646640947; x=1678176947; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tKBYLhGvjbyzRDITHvyM2/DI0Kldu910wEdQShsw39s=; b=PWrOCTMK63beV0/XNAPVTkYd/xOAwdDWYbHwHvgba6N95ylvrsW17FFe AP0/0Be9ctQ+Ya5iXG3x62GbbaXqEZrwXg13ycNC7B96sVYdWTqvV6fM9 rfbP3NztLa3MRRB9SwLteo+DbXv/D1DAawTF3OIxRe3In3Uk3WtKtA39c TJE/km5HAiTS//Mufpuj71z9tt34C0YoV8QnrtgoaYzldzSMbmRa9fqZ8 0Hi/YlFEU8QHcBo4qx8lviyxslvqT5juHM02J7b0JlTm+964x9guwkkDP ij3l3XvKVMSjGuOI3sxiKekhgniVysXvmDoXrN3EaU4HDPajiFX2gnQ4v A==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="254272036" X-IronPort-AV: E=Sophos;i="5.90,161,1643702400"; d="scan'208";a="254272036" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 00:15:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,161,1643702400"; d="scan'208";a="512595718" Received: from npg-dpdk-haiyue-2.sh.intel.com ([10.67.118.240]) by orsmga006.jf.intel.com with ESMTP; 07 Mar 2022 00:15:44 -0800 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang , Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Subject: [PATCH v2] graph: remove the useless duplicate name check Date: Mon, 7 Mar 2022 15:41:25 +0800 Message-Id: <20220307074125.1005637-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 --- v2: update the test case. --- app/test/test_graph.c | 10 +++++++++- lib/graph/node.c | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index 35e1a95b89..692360eccd 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -545,13 +545,21 @@ test_node_clone(void) { test_main_t *tm = &test_main; uint32_t node_id, dummy_id; + uint32_t dummy_id_clone; int i; node_id = rte_node_from_name("test_node00"); tm->test_node[0].idx = node_id; +#define TEST_NODE_CLONE_NAME "test_node00" + dummy_id_clone = rte_node_clone(node_id, TEST_NODE_CLONE_NAME); + if (rte_node_is_invalid(dummy_id_clone)) { + 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"); + dummy_id = rte_node_clone(node_id, TEST_NODE_CLONE_NAME); if (!rte_node_is_invalid(dummy_id)) { printf("Got valid id when clone with same name, Expecting fail\n"); return -1; 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