[v3] graph: remove the useless duplicate name check

Message ID 20220307102556.1011130-1-haiyue.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] graph: remove the useless duplicate name check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional fail Functional Testing issues
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Wang, Haiyue March 7, 2022, 10:25 a.m. UTC
  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>
---
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(-)
  

Comments

Jerin Jacob March 7, 2022, 12:47 p.m. UTC | #1
On Mon, Mar 7, 2022 at 4:30 PM Haiyue Wang <haiyue.wang@intel.com> wrote:
>
> 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>


Acked-by: Jerin Jacob <jerinj@marvell.com>

> ---
> 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
>
  
Thomas Monjalon March 7, 2022, 8:06 p.m. UTC | #2
07/03/2022 13:47, Jerin Jacob:
> On Mon, Mar 7, 2022 at 4:30 PM Haiyue Wang <haiyue.wang@intel.com> wrote:
> >
> > 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>
> 
> 
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied, thanks.
  

Patch

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;