[v2] examples/ipsec-secgw: fix potential build error

Message ID 20211103115618.3559996-1-radu.nicolau@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v2] examples/ipsec-secgw: fix potential build error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Radu Nicolau Nov. 3, 2021, 11:56 a.m. UTC
  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")
Cc: stable@dpdk.org

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 examples/ipsec-secgw/ipsec-secgw.c | 2 ++
 examples/ipsec-secgw/ipsec-secgw.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 3, 2021, 1:08 p.m. UTC | #1
03/11/2021 12:56, 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.

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.

> Fixes: 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
  
Akhil Goyal Nov. 3, 2021, 1:36 p.m. UTC | #2
> 03/11/2021 12:56, 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.
> 
> 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

Acked-by: Akhil Goyal <gakhil@marvell.com>

> 
> > Fixes: 1329602b6c8f ("examples/ipsec-secgw: add per-core packet
> statistics")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> 
>
  
David Marchand Nov. 3, 2021, 1:42 p.m. UTC | #3
On Wed, Nov 3, 2021 at 2:09 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 03/11/2021 12:56, 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.
>
> 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.
>
> > Fixes: 1329602b6c8f ("examples/ipsec-secgw: add per-core packet statistics")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>

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.
  
Akhil Goyal Nov. 3, 2021, 1:45 p.m. UTC | #4
> On Wed, Nov 3, 2021 at 2:09 PM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> >
> > 03/11/2021 12:56, 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.
> >
> > 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.
> >
> > > Fixes: 1329602b6c8f ("examples/ipsec-secgw: add per-core packet
> statistics")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> 
> 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
  
David Marchand Nov. 3, 2021, 1:50 p.m. UTC | #5
On Wed, Nov 3, 2021 at 2:45 PM Akhil Goyal <gakhil@marvell.com> wrote:
>
> > On Wed, Nov 3, 2021 at 2:09 PM Thomas Monjalon <thomas@monjalon.net>
> > wrote:
> > >
> > > 03/11/2021 12:56, 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.
> > >
> > > 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.
> > >
> > > > Fixes: 1329602b6c8f ("examples/ipsec-secgw: add per-core packet
> > statistics")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> >
> > 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.
  
Akhil Goyal Nov. 3, 2021, 1:55 p.m. UTC | #6
> > 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.
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.
  

Patch

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 5fcf424efe..ea8e3bcb87 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -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)
diff --git a/examples/ipsec-secgw/ipsec-secgw.h b/examples/ipsec-secgw/ipsec-secgw.h
index 96e22de45e..f9be303c28 100644
--- a/examples/ipsec-secgw/ipsec-secgw.h
+++ b/examples/ipsec-secgw/ipsec-secgw.h
@@ -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];