test/graph: initialize graph param variable

Message ID 20230203084804.2235611-1-amitprakashs@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series test/graph: initialize graph param variable |

Checks

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

Commit Message

Amit Prakash Shukla Feb. 3, 2023, 8:48 a.m. UTC
  Initializing rte_graph_param variable with 0 to avoid any
garbage value in structure elements which are not populated
as part of this function.

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
 app/test/test_graph_perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jerin Jacob Feb. 7, 2023, 6:47 a.m. UTC | #1
On Fri, Feb 3, 2023 at 2:19 PM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
>
> Initializing rte_graph_param variable with 0 to avoid any
> garbage value in structure elements which are not populated
> as part of this function.
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>

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


> ---
>  app/test/test_graph_perf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c
> index 1d065438a6..c5b463f700 100644
> --- a/app/test/test_graph_perf.c
> +++ b/app/test/test_graph_perf.c
> @@ -324,7 +324,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
>         char nname[RTE_NODE_NAMESIZE / 2];
>         struct test_node_data *node_data;
>         char *ename[nodes_per_stage];
> -       struct rte_graph_param gconf;
> +       struct rte_graph_param gconf = {0};
>         const struct rte_memzone *mz;
>         uint8_t total_percent = 0;
>         rte_node_t *src_nodes;
> --
> 2.25.1
>
  
David Marchand Feb. 7, 2023, 1:34 p.m. UTC | #2
On Fri, Feb 3, 2023 at 9:49 AM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
>
> Initializing rte_graph_param variable with 0 to avoid any
> garbage value in structure elements which are not populated
> as part of this function.

Something looks strange to me.
I fail to see which part of this object is not initialised by the test code.

app/test/test_graph_perf.c:     struct rte_graph_param gconf;
app/test/test_graph_perf.c:     gconf.socket_id = SOCKET_ID_ANY;
app/test/test_graph_perf.c:     gconf.nb_node_patterns = graph_data->nb_nodes;
app/test/test_graph_perf.c:     gconf.node_patterns = (const char
**)(uintptr_t)node_patterns;
app/test/test_graph_perf.c:     graph_id = rte_graph_create(gname, &gconf);

With this struct defined as:
struct rte_graph_param {
        int socket_id; /**< Socket id where memory is allocated. */
        uint16_t nb_node_patterns;  /**< Number of node patterns. */
        const char **node_patterns;
        /**< Array of node patterns based on shell pattern. */
};

Is this perhaps related to the following series?
https://patchwork.dpdk.org/project/dpdk/list/?series=26783&state=%2A&archive=both

If this is the case, then this fix should be squashed as part of the
rte_graph_param struct extension.

Thanks.
  

Patch

diff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c
index 1d065438a6..c5b463f700 100644
--- a/app/test/test_graph_perf.c
+++ b/app/test/test_graph_perf.c
@@ -324,7 +324,7 @@  graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
 	char nname[RTE_NODE_NAMESIZE / 2];
 	struct test_node_data *node_data;
 	char *ename[nodes_per_stage];
-	struct rte_graph_param gconf;
+	struct rte_graph_param gconf = {0};
 	const struct rte_memzone *mz;
 	uint8_t total_percent = 0;
 	rte_node_t *src_nodes;