> -----Original Message----- > From: Anoob Joseph <ano...@marvell.com> > Sent: Monday, June 3, 2019 11:02 PM > To: Jerin Jacob Kollanukkaran <jer...@marvell.com>; Nikhil Rao > <nikhil....@intel.com>; Erik Gabriel Carrillo <erik.g.carri...@intel.com>; > Abhinandan Gujjar <abhinandan.guj...@intel.com>; Bruce Richardson > <bruce.richard...@intel.com>; Pablo de Lara > <pablo.de.lara.gua...@intel.com> > Cc: Anoob Joseph <ano...@marvell.com>; Narayana Prasad Raju Athreya > <pathr...@marvell.com>; dev@dpdk.org; Lukas Bartosik > <lbarto...@marvell.com>; Pavan Nikhilesh Bhagavatula > <pbhagavat...@marvell.com>; Hemant Agrawal > <hemant.agra...@nxp.com>; Nipun Gupta <nipun.gu...@nxp.com>; Harry > van Haaren <harry.van.haa...@intel.com>; Mattias Rönnblom > <mattias.ronnb...@ericsson.com>; Liang Ma <liang.j...@intel.com> > Subject: [PATCH 04/39] examples/l2fwd-event: move global vars to common > header > > Moving global variables to common header for access from control plane and > data plane code. > > Signed-off-by: Anoob Joseph <ano...@marvell.com> > Signed-off-by: Lukasz Bartosik <lbarto...@marvell.com> > --- > examples/l2fwd-event/l2fwd_common.h | 26 > +++++++++++++++++++++++ > examples/l2fwd-event/main.c | 41 +++++++++++++++--------------------- > - > 2 files changed, 43 insertions(+), 24 deletions(-) > > diff --git a/examples/l2fwd-event/l2fwd_common.h b/examples/l2fwd- > event/l2fwd_common.h > index a7bb5af..55226f7 100644 > --- a/examples/l2fwd-event/l2fwd_common.h > +++ b/examples/l2fwd-event/l2fwd_common.h > @@ -5,6 +5,10 @@ > #ifndef _L2FWD_COMMON_H_ > #define _L2FWD_COMMON_H_ > > +#include <stdbool.h> > + > +#include <rte_common.h> > + > #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 > > #define MAX_PKT_BURST 32 > @@ -34,4 +38,26 @@ struct l2fwd_port_statistics { > uint64_t dropped; > } __rte_cache_aligned; > > +volatile bool force_quit; > + > +int mac_updating; > + > +/* ethernet addresses of ports */ > +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; > + > +/* mask of enabled ports */ > +static uint32_t l2fwd_enabled_port_mask; > + > +/* list of enabled ports */ > +static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS]; > + > +struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; > + > +struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; > + > +struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; > + > +/* A tsc-based timer responsible for triggering statistics printout */ > +uint64_t timer_period;
Instead of moving global variables to other header file, IMO, it is better to create a structure with context and share with workers with rte_eal_mp_remote_launch() or so.