From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0054.outbound.protection.outlook.com [104.47.1.54]) by dpdk.org (Postfix) with ESMTP id E9206DE3 for ; Mon, 8 Oct 2018 10:46:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JQWeEyFbjLsmWLtUzZK3qGC0Inbr5VP6jFNt54yW1BY=; b=VMc5xUtzMt/CVXpvJfl8esDMtknFATQYxQam7ro5YwzLYA6Orf3TZob9GGRixBxDxRiFTl51mU80ot+PQCg2xMaraqGn8tST9NuKH4DxlVpp8JKEw9O5UPoIFo0jTS3MSR6gjJnwxvxPeSYWrMfVTozWqIewdZbjtTE7Ym3I+VQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from [10.232.14.39] (14.142.187.166) by AM6PR04MB4678.eurprd04.prod.outlook.com (2603:10a6:20b:1b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.21; Mon, 8 Oct 2018 08:46:24 +0000 To: Ferruh Yigit Cc: Reshma Pattan , Hemant Agrawal , Ashish Gupta , Fiona Trahe , Pablo de Lara , Akhil Goyal , Declan Doherty , Fan Zhang , Rahul Lakkireddy , Gaetan Rivet , Qi Zhang , Xiao Wang , Beilei Xing , Wenzhuo Lu , Konstantin Ananyev , Rasesh Mody , Harish Patil , Shahed Shaikh , Andrew Rybchenko , Jasvinder Singh , Cristian Dumitrescu , Keith Wiles , Nipun Gupta , Anatoly Burakov , Thomas Monjalon , Jerin Jacob , Olivier Matz , Ashish Gupta , dev@dpdk.org References: <20181004034047.26824-1-ferruh.yigit@intel.com> <20181005162612.31906-1-ferruh.yigit@intel.com> <20181005162612.31906-4-ferruh.yigit@intel.com> From: Shreyansh Jain Message-ID: <13444cc5-2a1e-881b-40a0-4ab972324e5e@nxp.com> Date: Mon, 8 Oct 2018 14:15:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181005162612.31906-4-ferruh.yigit@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR0101CA0022.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::32) To AM6PR04MB4678.eurprd04.prod.outlook.com (2603:10a6:20b:1b::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e6d2ec6-8f94-4232-a738-08d62cfa8ae9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR04MB4678; X-Microsoft-Exchange-Diagnostics: 1; AM6PR04MB4678; 3:k7nPeZqF0qPdmEDxJvHNz7A+f4a/A80zmEgkeXtnrDkp1UWAEN0afjfbKo6krVEALBK961tAlYEw2hk6GcifXyXdEFGfdRBcUI+7b4y1GGll/mfwNySHUxdhu5jYmbg4SFK/F1tgg0VZ5iPTjWaUVaNS4VI9vbxDczTtXD6uQHxGwYe9u6NBMID/6uux52tS1IK14OSEJijPnEcub+7ETW21DzEwliixYEJWqVqNBiS2TfcOM/P51qYGqPniYpJW; 25:QK1DSib7wlGrOf/BcUxEGOKUD/MKFeCiYnunvK3r2jGHc2Gl3dxzRWpCfbAl5BEfEhGqg8Kw4tmcvNgz+0A137JS6Z6klZiLyFixfkdIkRXNcDHj18augzhDj3I9jvUHnKSn1YBVzoXwQ/2EymJTnrZEoBd4DWuhzfy/9rJjyq7Ck3pb4A+c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pLHSD5G6JS6bqMuxs4x3Ky13n/QOzyDlKLL8J54uIXWr6MgThU/T9wgCIfCLdkmD2NZtzymEQJ9Lfukv2yjzQYOoQ6uIS7oQEl+pF3ltke2S3UvSJzB/EL4hGFc+fooHheDV2/Tc3yWtqX1i7oaQoYMeWkkczdlPvEO2mfbB6I27nrC0ogJ+SJmBkJaLwJwduEjiK5XfhcslRcmYlKAHFdxvfm4ZawEPZWWXtOkwfuSeHlgfpw1/OhM+Z7Wha+Z7nKVRBuqgcatG3jTocU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699)(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231355)(944501410)(52105095)(3002001)(6055026)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:AM6PR04MB4678; BCL:0; PCL:0; RULEID:; SRVR:AM6PR04MB4678; X-Forefront-PRVS: 081904387B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(396003)(346002)(136003)(376002)(39860400002)(366004)(189003)(199004)(446003)(81166006)(6666003)(81156014)(8936002)(7416002)(229853002)(66066001)(65956001)(65806001)(6916009)(68736007)(36756003)(53936002)(956004)(6486002)(47776003)(486006)(476003)(8676002)(2616005)(31686004)(76176011)(52116002)(106356001)(5024004)(55236004)(105586002)(44832011)(11346002)(52146003)(23676004)(2486003)(386003)(6116002)(16576012)(316002)(2906002)(478600001)(97736004)(67846002)(58126008)(186003)(16526019)(7736002)(305945005)(65826007)(5009440100003)(6246003)(54906003)(5660300001)(25786009)(77096007)(4326008)(26005)(50466002)(3846002)(64126003)(230700001)(86362001)(31696002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR04MB4678; H:[10.232.14.39]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTZQUjA0TUI0Njc4OzIzOmwwYVczUnVCM3FJelZRUDFOdFR4c01NeGdU?= =?utf-8?B?bVQ0cElDd1FqckNpNE80ZVpMU0VYSVp1K040K3RiaVk3WG9mRGdBVWZkZmJR?= =?utf-8?B?bVlZSklzKytSeG1FL2tqVkQ0UENieTFKQ08vR2hxWXhNdkdhODVtSG5hSjF4?= =?utf-8?B?VVJSSGMwNkc4cVFWbVJhbDNoNGsxY3Fsc0ZWZVhtK1lVU1lFbmVxSlhkOHBN?= =?utf-8?B?Tkl2U1F1T1NtYVppcjRSYkcxM1lwMWFQelJMV1hJQnBQZHNxYldVbWN5SHU1?= =?utf-8?B?Vm5pUENzV3dlQVo2KzE3Vk1KRmJ5SHl5UnlYVmorSG94VVVIV2dJTEtPc2V1?= =?utf-8?B?MUNqZWNXZmxuQXRPTHovZkllVGNSWVRoS2tpTEc1YlNSbUh6RE5PMWxKeks3?= =?utf-8?B?Q2t0YnkwUWNHcWNoamEybURxTkd1NXFFUmVSTFZTRTI2OWE1cm80RjRrOU1V?= =?utf-8?B?Zm80TTByaFlZc3ZMVVpBaERPSTdRVTR6SUVCOW5vUHJEL0EvM1RNUUVway9T?= =?utf-8?B?QWdzTlBrSFExcFA0UUVaK2xBMW9SK2d3MzVQMWozMGwvUGlFeUhFTFN3Tm01?= =?utf-8?B?T0pFUWxYUERvSGpJUEZFZW5rL3o0L1l0aDQzT2tQNGwrRUNBdjNYT1h5c1o1?= =?utf-8?B?aks1TTZvSHBqanlkRDVsSDE4ZDA5cVNEUUZManpDSTdqdUtjVHhkdjB3UENP?= =?utf-8?B?ZnZtc2pUT255ZlBhY1BVU1VReXJzcU0rN1hmTjNQcHZVR2VkTFM0bDN6KzQ4?= =?utf-8?B?UzU4MHp5NmJEa2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6BWgrrXvQ+HfuJgxCQmDhmMggexFkANrF9IrW/eTd1A7mtSBxTgJ15eBsztztirh8TUGxc/kXL5FxqUpoQq/GNH4qNd2Tq8KUN0XXfwKY5YmR+OHPhZ75F5jz+ct9agKXhSgl4q3IWONRrgXCg4txLLEih1xivEfJvmycfxTPqDq0RffG3WTbo2T0zpJMCrVM64y+zKim8pi+E3d+ca4rXSmvukMQa57zQZp1iJNTPTp8UamjlX+EpuoAslrT7rsEARZ6xp/5c0+ilOybAmZM3W2l7Ac/0n6kwPo4Ax4ajTOkmNltk64+5szKZFeUyfJ3YaUuirNWe+UZ8qoLwN8OJQNS01W6gEmMaOGDQDpA==; 5:YtplzNzaw1PZ6rNawtABoL/HQQ+6E9Y8AZ90vFdLIsohFA8tMLOodqBO19qTe99U/5/JW4QmKpyD19cQz/isw3r/BvFQlXt7x4lUF4FAWVi5ILNL4QkLaK8Bghb7gGHuMZq3FS3KVzLXtEKWOupWZVlNPUfIsIn4K+dB0miJxHw=; 7:xeBfXNPhzBGed5l6cU6oT9MS9IVouoMiPrPwrYH1m4OVl3tQ0J++dZSmGCyM9yArc+fkz+8Y/BgScs1o8XfjoA2CgbX0r5rgXoar63swvc89/lcBCYmr6zKOP2rgRvPTYRzH8sIUtPg5KF+UfrVyLyqJeBGanJvIE4AXfM624x6C94d5Ht1YUPXB+PYOX9BSJH3keMaXGZvpcpeN6D/Bk3wBMaQsIaHHxDOamMDvttGYqEoGR7mJz5nYThO7qdd3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2018 08:46:24.8830 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e6d2ec6-8f94-4232-a738-08d62cfa8ae9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4678 Subject: Re: [dpdk-dev] [PATCH v2 4/4] lib: reduce global variable usage 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, 08 Oct 2018 08:46:32 -0000 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 > --- > 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. Wouldn't same be valid for rte_compressdevs as well? Besides the above: Acked-by: Shreyansh Jain