Skip to contentSkip to conversation

examples/ipsec-secgw: fix build error

PATCH Superseded Radu Nicolau 4 participants 9 messages Nov 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ipsec-secgw: fix build error

Move core_statistics definition out of header file.

Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
---
 examples/ipsec-secgw/ipsec-secgw.c | 2 ++
 examples/ipsec-secgw/ipsec-secgw.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
examples/ipsec-secgw/ipsec-secgw.c +2 -0
index 5fcf424efe..ea8e3bcb87 100644
@@ -291,6 +291,8 @@ adjust_ipv6_pktlen(struct rte_mbuf *m, const struct rte_ipv6_hdr *iph,
 
 #if (STATS_INTERVAL > 0)
 
+struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
+
 /* Print out statistics on packet distribution */
 static void
 print_stats_cb(__rte_unused void *param)
examples/ipsec-secgw/ipsec-secgw.h +1 -1
index 96e22de45e..f9be303c28 100644
@@ -93,7 +93,7 @@ struct ipsec_core_statistics {
 	uint64_t burst_rx;
 } __rte_cache_aligned;
 
-struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
+extern struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
 #endif /* STATS_INTERVAL */
 
 extern struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS];
Signature · 1 line
2.25.1
#1 lore raw

I don't see any compilation issue.
How do you trigger the problem?
The scope may be precised in the title.

03/11/2021 11:51, Radu Nicolau:

Quoted 1 line

Move core_statistics definition out of header file.

Why?
Please add explanation and error log here.

Quoted 4 lines
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
#2 lore raw

PATCH v2 1/1 examples/ipsec-secgw: fix potential build error

In reply to Radu Nicolau

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
---
 examples/ipsec-secgw/ipsec-secgw.c | 2 ++
 examples/ipsec-secgw/ipsec-secgw.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
examples/ipsec-secgw/ipsec-secgw.c +2 -0
index 5fcf424efe..ea8e3bcb87 100644
@@ -291,6 +291,8 @@ adjust_ipv6_pktlen(struct rte_mbuf *m, const struct rte_ipv6_hdr *iph,
 
 #if (STATS_INTERVAL > 0)
 
+struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
+
 /* Print out statistics on packet distribution */
 static void
 print_stats_cb(__rte_unused void *param)
examples/ipsec-secgw/ipsec-secgw.h +1 -1
index 96e22de45e..f9be303c28 100644
@@ -93,7 +93,7 @@ struct ipsec_core_statistics {
 	uint64_t burst_rx;
 } __rte_cache_aligned;
 
-struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
+extern struct ipsec_core_statistics core_statistics[RTE_MAX_LCORE];
 #endif /* STATS_INTERVAL */
 
 extern struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS];
Signature · 1 line
2.25.1
#3 lore raw

Re: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: fix potential build error

03/11/2021 12:56, Radu Nicolau:

Quoted 4 lines

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

So it is not fixing compilation,
as we would never apply a patch which would completely break compilation. I would say (in the title) that it moves global variable from header file.

Quoted 4 lines
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
Acked-by
#4 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2] examples/ipsec-secgw: fix potential build error

Quoted 9 lines

03/11/2021 12:56, Radu Nicolau:

Quoted 4 lines

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

So it is not fixing compilation,
as we would never apply a patch which would completely break compilation. I would say (in the title) that it moves global variable from header file.

Updated title " examples/ipsec-secgw: move global array from header"
Applied to dpdk-next-crypto

Quoted 8 lines
Quoted 2 lines
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet

statistics")

Quoted 3 lines
#5 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] examples/ipsec-secgw: fix potential build error

In reply to Thomas Monjalon
Quoted 15 lines · Thomas Monjalon

03/11/2021 12:56, Radu Nicolau:

Quoted 4 lines

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

So it is not fixing compilation,
as we would never apply a patch which would completely break compilation. I would say (in the title) that it moves global variable from header file.

Quoted 4 lines
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")

I guess it has to do with series:
https://patchwork.dpdk.org/project/dpdk/list/?series=20174

http://mails.dpdk.org/archives/test-report/2021-November/237332.html

So it should be part of this series.

Signature · 1 line
David Marchand
#6 lore raw

Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH v2] examples/ipsec-secgw: fix potential build error

Quoted 14 lines
Quoted 9 lines · Thomas Monjalon

03/11/2021 12:56, Radu Nicolau:

Quoted 4 lines

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

So it is not fixing compilation,
as we would never apply a patch which would completely break

compilation.

Quoted 2 lines

I would say (in the title) that it moves global variable from header file.

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet

statistics")

Quoted 3 lines
Quoted 3 lines

I guess it has to do with series:
https://patchwork.dpdk.org/project/dpdk/list/?series=20174

Yes this series initiated the issue, applying both the patch and the series now On next-crypto

#7 lore raw

Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH v2] examples/ipsec-secgw: fix potential build error

Quoted 19 lines · Akhil Goyal
Quoted 19 lines
Quoted 9 lines · Thomas Monjalon

03/11/2021 12:56, Radu Nicolau:

Quoted 4 lines

When STATS_INTERVAL is set to a non-zero value the core_statistics array will be defined in multiple compilation units and this can trigger a linker error on particular environments. In order to fix this the core_statistics definition was moved out of the header file.

So it is not fixing compilation,
as we would never apply a patch which would completely break

compilation.

Quoted 3 lines

I would say (in the title) that it moves global variable from header file.

Quoted 1 line
Fixes 1329602b6c8f ("examples/ipsec-secgw: add per-core packet

statistics")

Quoted 2 lines
Quoted 2 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

I guess it has to do with series:
https://patchwork.dpdk.org/project/dpdk/list/?series=20174

Yes this series initiated the issue, applying both the patch and the series now On next-crypto

It means a patch of this series broke compilation, and this fix here should be squashed in it.

Signature · 1 line
David Marchand
#8 lore raw

Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH v2] examples/ipsec-secgw: fix potential build error

Quoted 6 lines
Quoted 1 line

Yes this series initiated the issue, applying both the patch and the series

now

Quoted 1 line

On next-crypto

It means a patch of this series broke compilation, and this fix here should be squashed in it.

Actually no, this is definitely an issue introduced earlier and should be part of stable. This got highlighted here as STATS_INTERVAL ifdef was removed in this series. The compilation is broken when STATS_INTEVAL is defined in the app.