DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Shreyansh Jain <shreyansh.jain@nxp.com>
Cc: Reshma Pattan <reshma.pattan@intel.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Ashish Gupta <ashish.gupta@cavium.com>,
	Fiona Trahe <fiona.trahe@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	Akhil Goyal <akhil.goyal@nxp.com>,
	Declan Doherty <declan.doherty@intel.com>,
	Fan Zhang <roy.fan.zhang@intel.com>,
	Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
	Gaetan Rivet <gaetan.rivet@6wind.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Xiao Wang <xiao.w.wang@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Rasesh Mody <rasesh.mody@cavium.com>,
	Harish Patil <harish.patil@cavium.com>,
	Shahed Shaikh <shahed.shaikh@cavium.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	Jasvinder Singh <jasvinder.singh@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Keith Wiles <keith.wiles@intel.com>,
	Nipun Gupta <nipun.gupta@nxp.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	Olivier Matz <olivier.matz@6wind.com>,
	Ashish Gupta <ashish.gupta@caviumnetworks.com>,
	dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2 4/4] lib: reduce global variable usage
Date: Mon, 8 Oct 2018 10:11:54 +0100	[thread overview]
Message-ID: <ca8315a4-b7f4-afe5-b0ab-8d6acd20b99e@intel.com> (raw)
In-Reply-To: <13444cc5-2a1e-881b-40a0-4ab972324e5e@nxp.com>

On 10/8/2018 9:45 AM, Shreyansh Jain wrote:
> On Friday 05 October 2018 09:56 PM, Ferruh Yigit wrote:
>> Some global variables can be eliminated, since they are not part of
>> public interface, it is free to remove them.
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>>   lib/librte_compressdev/rte_compressdev.c     | 32 ++++++++----------
>>   lib/librte_compressdev/rte_compressdev_pmd.h |  5 ---
>>   lib/librte_cryptodev/rte_cryptodev.c         | 34 +++++++++-----------
>>   lib/librte_cryptodev/rte_cryptodev_pmd.h     |  3 --
>>   lib/librte_eventdev/rte_eventdev.c           |  8 ++---
>>   lib/librte_eventdev/rte_eventdev_pmd.h       |  2 --
>>   lib/librte_rawdev/rte_rawdev.c               | 10 +++---
>>   lib/librte_rawdev/rte_rawdev_pmd.h           |  2 --
>>   8 files changed, 37 insertions(+), 59 deletions(-)
> 
> [...]
> 
>> diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
>> index 62b6b97ef..9f1e3592d 100644
>> --- a/lib/librte_rawdev/rte_rawdev.c
>> +++ b/lib/librte_rawdev/rte_rawdev.c
>> @@ -35,21 +35,19 @@
>>   /* dynamic log identifier */
>>   int librawdev_logtype;
>>   
>> -struct rte_rawdev rte_rawdevices[RTE_RAWDEV_MAX_DEVS];
>> +static struct rte_rawdev rte_rawdevices[RTE_RAWDEV_MAX_DEVS];
>>   
>> -struct rte_rawdev *rte_rawdevs = &rte_rawdevices[0];
>> +struct rte_rawdev *rte_rawdevs = rte_rawdevices;
>>   
>>   static struct rte_rawdev_global rawdev_globals = {
>>   	.nb_devs		= 0
>>   };
>>   
>> -struct rte_rawdev_global *rte_rawdev_globals = &rawdev_globals;
>> -
>>   /* Raw device, northbound API implementation */
>>   uint8_t
>>   rte_rawdev_count(void)
>>   {
>> -	return rte_rawdev_globals->nb_devs;
>> +	return rawdev_globals.nb_devs;
>>   }
>>   
>>   uint16_t
>> @@ -60,7 +58,7 @@ rte_rawdev_get_dev_id(const char *name)
>>   	if (!name)
>>   		return -EINVAL;
>>   
>> -	for (i = 0; i < rte_rawdev_globals->nb_devs; i++)
>> +	for (i = 0; i < rawdev_globals.nb_devs; i++)
>>   		if ((strcmp(rte_rawdevices[i].name, name)
>>   				== 0) &&
>>   				(rte_rawdevices[i].attached ==
>> diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h
>> index bb9bbc350..811e51d07 100644
>> --- a/lib/librte_rawdev/rte_rawdev_pmd.h
>> +++ b/lib/librte_rawdev/rte_rawdev_pmd.h
>> @@ -73,8 +73,6 @@ struct rte_rawdev_global {
>>   	uint16_t nb_devs;
>>   };
>>   
>> -extern struct rte_rawdev_global *rte_rawdev_globals;
>> -/** Pointer to global raw devices data structure. */
>>   extern struct rte_rawdev *rte_rawdevs;
>>   /** The pool of rte_rawdev structures. */
> 
> I think `rte_rawdevs` can also be removed from an exposed symbol. In all 
> cases (at least for now), this is being accessed using an API (and no 
> macros). There should be no need for people to read this directly if 
> sufficient get_by_* APIs are available.

+1 to make it library internal.

But `rte_rawdevs` is both in public header and .map file, so it is part of
public API, we can't remove it without deprecation process.
And I want to leave the decision of removing an public symbol to library
maintainers.

> 
> Wouldn't same be valid for rte_compressdevs as well?

`rte_compressdevs` is already removed, but if you mean `rte_cryptodevs` it has
same problem with `rte_rawdevs`, it is part of API.

> Besides the above:
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> 

  reply	other threads:[~2018-10-08  9:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04  3:40 [dpdk-dev] [PATCH] fix static variables Ferruh Yigit
2018-10-05  8:38 ` Rao, Nikhil
2018-10-05 16:26 ` [dpdk-dev] [PATCH v2 1/4] add missing static keyword to globals Ferruh Yigit
2018-10-05 15:55   ` Andrew Rybchenko
2018-10-28 11:04     ` Thomas Monjalon
2018-10-05 16:26   ` [dpdk-dev] [PATCH v2 2/4] drivers: prefix global variables with module name Ferruh Yigit
2018-10-05 16:27     ` Maxime Coquelin
2018-10-08 12:18     ` Shreyansh Jain
2018-10-10  5:56     ` Zhang, Tianfei
2018-10-05 16:26   ` [dpdk-dev] [PATCH v2 3/4] fix global variable issues Ferruh Yigit
2018-10-07 12:21     ` Jerin Jacob
2018-10-05 16:26   ` [dpdk-dev] [PATCH v2 4/4] lib: reduce global variable usage Ferruh Yigit
2018-10-07 12:22     ` Jerin Jacob
2018-10-08  8:45     ` Shreyansh Jain
2018-10-08  9:11       ` Ferruh Yigit [this message]
2018-10-08  9:27         ` Shreyansh Jain
2018-10-07 12:18   ` [dpdk-dev] [PATCH v2 1/4] add missing static keyword to globals Jerin Jacob
2018-10-08  9:43   ` Shreyansh Jain
2018-10-28 23:57   ` [dpdk-dev] [PATCH v3 " Ferruh Yigit
2018-10-28 23:57     ` [dpdk-dev] [PATCH v3 2/4] drivers: prefix global variables with module name Ferruh Yigit
2018-10-28 23:57     ` [dpdk-dev] [PATCH v3 3/4] fix global variable issues Ferruh Yigit
2018-10-29  6:57       ` Hyong Youb Kim
2018-10-28 23:57     ` [dpdk-dev] [PATCH v3 4/4] lib: reduce global variable usage Ferruh Yigit
2018-10-29  1:35       ` Thomas Monjalon
2018-10-10  6:23 ` [dpdk-dev] [PATCH] fix static variables Zhang, Tianfei
2018-10-11  6:56 ` Xing, Beilei
2018-11-02 10:58 ` [dpdk-dev] " Tomasz Cel
2018-11-02 11:09 ` Cel, TomaszX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca8315a4-b7f4-afe5-b0ab-8d6acd20b99e@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=anatoly.burakov@intel.com \
    --cc=arybchenko@solarflare.com \
    --cc=ashish.gupta@cavium.com \
    --cc=ashish.gupta@caviumnetworks.com \
    --cc=beilei.xing@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=gaetan.rivet@6wind.com \
    --cc=harish.patil@cavium.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jasvinder.singh@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=keith.wiles@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=olivier.matz@6wind.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=rasesh.mody@cavium.com \
    --cc=reshma.pattan@intel.com \
    --cc=roy.fan.zhang@intel.com \
    --cc=shahed.shaikh@cavium.com \
    --cc=shreyansh.jain@nxp.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiao.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).