DPDK patches and discussions
 help / color / mirror / Atom feed
From: Haiyue Wang <haiyue.wang@intel.com>
To: dev@dpdk.org
Cc: Haiyue Wang <haiyue.wang@intel.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>
Subject: [PATCH v2] graph: remove the useless duplicate name check
Date: Mon,  7 Mar 2022 15:41:25 +0800	[thread overview]
Message-ID: <20220307074125.1005637-1-haiyue.wang@intel.com> (raw)
In-Reply-To: <0220307064318.1002855-1-haiyue.wang@intel.com>

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 <haiyue.wang@intel.com>
---
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


       reply	other threads:[~2022-03-07  8:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0220307064318.1002855-1-haiyue.wang@intel.com>
2022-03-07  7:41 ` Haiyue Wang [this message]
2022-03-07 10:25 ` [PATCH v3] " Haiyue Wang
2022-03-07 12:47   ` Jerin Jacob
2022-03-07 20:06     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307074125.1005637-1-haiyue.wang@intel.com \
    --to=haiyue.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).