DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] graph: remove the useless duplicate name check
       [not found] <0220307064318.1002855-1-haiyue.wang@intel.com>
@ 2022-03-07  7:41 ` Haiyue Wang
  2022-03-07 10:25 ` [PATCH v3] " Haiyue Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Haiyue Wang @ 2022-03-07  7:41 UTC (permalink / raw)
  To: dev; +Cc: Haiyue Wang, Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3] graph: remove the useless duplicate name check
       [not found] <0220307064318.1002855-1-haiyue.wang@intel.com>
  2022-03-07  7:41 ` [PATCH v2] graph: remove the useless duplicate name check Haiyue Wang
@ 2022-03-07 10:25 ` Haiyue Wang
  2022-03-07 12:47   ` Jerin Jacob
  1 sibling, 1 reply; 4+ messages in thread
From: Haiyue Wang @ 2022-03-07 10:25 UTC (permalink / raw)
  To: dev; +Cc: Haiyue Wang, Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram

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(-)

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] graph: remove the useless duplicate name check
  2022-03-07 10:25 ` [PATCH v3] " Haiyue Wang
@ 2022-03-07 12:47   ` Jerin Jacob
  2022-03-07 20:06     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Jerin Jacob @ 2022-03-07 12:47 UTC (permalink / raw)
  To: Haiyue Wang; +Cc: dpdk-dev, Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram

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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] graph: remove the useless duplicate name check
  2022-03-07 12:47   ` Jerin Jacob
@ 2022-03-07 20:06     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-03-07 20:06 UTC (permalink / raw)
  To: Haiyue Wang
  Cc: dev, Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram, Jerin Jacob

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-07 20:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0220307064318.1002855-1-haiyue.wang@intel.com>
2022-03-07  7:41 ` [PATCH v2] graph: remove the useless duplicate name check Haiyue Wang
2022-03-07 10:25 ` [PATCH v3] " Haiyue Wang
2022-03-07 12:47   ` Jerin Jacob
2022-03-07 20:06     ` Thomas Monjalon

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).