From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 8A2152BC7 for ; Mon, 23 Apr 2018 11:00:20 +0200 (CEST) Received: from alille-654-1-134-221.w90-34.abo.wanadoo.fr ([90.34.61.221] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fAXKa-0002hM-Oq; Mon, 23 Apr 2018 11:00:18 +0200 Received: by droids-corp.org (sSMTP sendmail emulation); Mon, 23 Apr 2018 11:00:09 +0200 Date: Mon, 23 Apr 2018 11:00:09 +0200 From: Olivier Matz To: Pavan Nikhilesh Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, beilei.xing@intel.com, rasesh.mody@cavium.com, harish.patil@cavium.com, jianbo.liu@arm.com, dev@dpdk.org Message-ID: <20180423090009.vpzv74r3uknh4jnx@platinum> References: <20180419185159.11266-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180419185159.11266-1-pbhagavatula@caviumnetworks.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH] drivers: cleanup unnecessary global variables X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2018 09:00:20 -0000 On Fri, Apr 20, 2018 at 12:21:59AM +0530, Pavan Nikhilesh wrote: > Signed-off-by: Pavan Nikhilesh > --- > drivers/bus/dpaa/base/fman/netcfg_layer.c | 5 ----- > drivers/bus/dpaa/base/qbman/bman_driver.c | 4 ++-- > drivers/bus/dpaa/base/qbman/qman.c | 2 +- > drivers/bus/dpaa/base/qbman/qman_driver.c | 4 ++-- > drivers/bus/dpaa/base/qbman/qman_priv.h | 1 - > drivers/bus/dpaa/dpaa_bus.c | 2 +- > drivers/bus/fslmc/qbman/qbman_portal.c | 3 +-- > drivers/bus/fslmc/qbman/qbman_portal.h | 1 - > drivers/net/i40e/i40e_flow.c | 2 +- > drivers/net/qede/base/bcm_osal.c | 2 +- > drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 2 +- > lib/librte_net/net_crc_neon.h | 4 ++-- > 12 files changed, 12 insertions(+), 20 deletions(-) [...] > diff --git a/lib/librte_net/net_crc_neon.h b/lib/librte_net/net_crc_neon.h > index 63fa1d4a1..cb3da72ed 100644 > --- a/lib/librte_net/net_crc_neon.h > +++ b/lib/librte_net/net_crc_neon.h > @@ -21,8 +21,8 @@ struct crc_pmull_ctx { > uint64x2_t rk7_rk8; > }; > > -struct crc_pmull_ctx crc32_eth_pmull __rte_aligned(16); > -struct crc_pmull_ctx crc16_ccitt_pmull __rte_aligned(16); > +static struct crc_pmull_ctx crc32_eth_pmull __rte_aligned(16); > +static struct crc_pmull_ctx crc16_ccitt_pmull __rte_aligned(16); > > /** Not sure it will still work after that. >>From what I see, these global variables are initialized once in rte_net_crc_neon_init, and used as a const parameter in crc32_eth_calc_pmull(). Changing them to static will create an instance of these variables for each included file, which is not what we want. I think that the proper way to solve it would be to add the definition in a new .c file, and only have a declaration in the .h. An even better way would be to make variable const and initialize it with its content. It could even enhance performance. Something like: net_crc_neon.h: static const struct crc_pmull_ctx crc32_eth_pmull = { } __rte_aligned(16); static const struct crc_pmull_ctx crc16_ccitt_pmull = { } __rte_aligned(16);