[v4,1/2] graph: fix graph functional tests with valid params

Message ID 20230710071515.3143533-2-zhirun.yan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series fix graph issues |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Yan, Zhirun July 10, 2023, 7:15 a.m. UTC
  rte_graph_clone() should use valid param rather than NULL pointer, cause it
needs the param for alloc work queue memory for mcore dispatch model in
graph_sched_wq_create().

Fixes: 67e2303cd823 ("test/graph: add functional tests for mcore dispatch model")

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
 app/test/test_graph.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
  

Comments

Jerin Jacob July 10, 2023, 9:21 a.m. UTC | #1
On Mon, Jul 10, 2023 at 1:09 PM Zhirun Yan <zhirun.yan@intel.com> wrote:
>
> rte_graph_clone() should use valid param rather than NULL pointer, cause it

rte_graph_clone() should use a valid param rather than NULL pointer as

> needs the param for alloc work queue memory for mcore dispatch model in
> graph_sched_wq_create().
>
> Fixes: 67e2303cd823 ("test/graph: add functional tests for mcore dispatch model")
>
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>

With above change:

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

> ---
>  app/test/test_graph.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/app/test/test_graph.c b/app/test/test_graph.c
> index 8609c0b3a4..47f5ab8395 100644
> --- a/app/test/test_graph.c
> +++ b/app/test/test_graph.c
> @@ -665,7 +665,7 @@ test_graph_clone(void)
>  {
>         rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
>         rte_graph_t main_graph_id = RTE_GRAPH_ID_INVALID;
> -       struct rte_graph_param graph_conf;
> +       struct rte_graph_param graph_conf = {0};
>         int ret = 0;
>
>         main_graph_id = rte_graph_from_name("worker0");
> @@ -700,6 +700,7 @@ test_graph_model_mcore_dispatch_node_lcore_affinity_set(void)
>  {
>         rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
>         unsigned int worker_lcore = RTE_MAX_LCORE;
> +       struct rte_graph_param graph_conf = {0};
>         rte_node_t nid = RTE_NODE_ID_INVALID;
>         char node_name[64] = "test_node00";
>         struct rte_node *node;
> @@ -711,7 +712,7 @@ test_graph_model_mcore_dispatch_node_lcore_affinity_set(void)
>                 printf("Set node %s affinity to lcore %u\n", node_name, worker_lcore);
>
>         nid = rte_node_from_name(node_name);
> -       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", NULL);
> +       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", &graph_conf);
>         node = rte_graph_node_get(cloned_graph_id, nid);
>
>         if (node->dispatch.lcore_id != worker_lcore) {
> @@ -729,11 +730,12 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void)
>  {
>         rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
>         unsigned int worker_lcore = RTE_MAX_LCORE;
> +       struct rte_graph_param graph_conf = {0};
>         struct rte_graph *graph;
>         int ret = 0;
>
>         worker_lcore = rte_get_next_lcore(worker_lcore, true, 1);
> -       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test2", NULL);
> +       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test2", &graph_conf);
>
>         ret = rte_graph_model_mcore_dispatch_core_bind(cloned_graph_id, worker_lcore);
>         if (ret != 0) {
> @@ -765,10 +767,11 @@ static int
>  test_graph_worker_model_set_get(void)
>  {
>         rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
> +       struct rte_graph_param graph_conf = {0};
>         struct rte_graph *graph;
>         int ret = 0;
>
> -       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test3", NULL);
> +       cloned_graph_id = rte_graph_clone(graph_id, "cloned-test3", &graph_conf);
>         ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH);
>         if (ret != 0) {
>                 printf("Set graph mcore dispatch model failed\n");
> --
> 2.37.2
>
  

Patch

diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index 8609c0b3a4..47f5ab8395 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -665,7 +665,7 @@  test_graph_clone(void)
 {
 	rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
 	rte_graph_t main_graph_id = RTE_GRAPH_ID_INVALID;
-	struct rte_graph_param graph_conf;
+	struct rte_graph_param graph_conf = {0};
 	int ret = 0;
 
 	main_graph_id = rte_graph_from_name("worker0");
@@ -700,6 +700,7 @@  test_graph_model_mcore_dispatch_node_lcore_affinity_set(void)
 {
 	rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
 	unsigned int worker_lcore = RTE_MAX_LCORE;
+	struct rte_graph_param graph_conf = {0};
 	rte_node_t nid = RTE_NODE_ID_INVALID;
 	char node_name[64] = "test_node00";
 	struct rte_node *node;
@@ -711,7 +712,7 @@  test_graph_model_mcore_dispatch_node_lcore_affinity_set(void)
 		printf("Set node %s affinity to lcore %u\n", node_name, worker_lcore);
 
 	nid = rte_node_from_name(node_name);
-	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", NULL);
+	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test1", &graph_conf);
 	node = rte_graph_node_get(cloned_graph_id, nid);
 
 	if (node->dispatch.lcore_id != worker_lcore) {
@@ -729,11 +730,12 @@  test_graph_model_mcore_dispatch_core_bind_unbind(void)
 {
 	rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
 	unsigned int worker_lcore = RTE_MAX_LCORE;
+	struct rte_graph_param graph_conf = {0};
 	struct rte_graph *graph;
 	int ret = 0;
 
 	worker_lcore = rte_get_next_lcore(worker_lcore, true, 1);
-	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test2", NULL);
+	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test2", &graph_conf);
 
 	ret = rte_graph_model_mcore_dispatch_core_bind(cloned_graph_id, worker_lcore);
 	if (ret != 0) {
@@ -765,10 +767,11 @@  static int
 test_graph_worker_model_set_get(void)
 {
 	rte_graph_t cloned_graph_id = RTE_GRAPH_ID_INVALID;
+	struct rte_graph_param graph_conf = {0};
 	struct rte_graph *graph;
 	int ret = 0;
 
-	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test3", NULL);
+	cloned_graph_id = rte_graph_clone(graph_id, "cloned-test3", &graph_conf);
 	ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH);
 	if (ret != 0) {
 		printf("Set graph mcore dispatch model failed\n");