From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0062.outbound.protection.outlook.com [104.47.38.62]) by dpdk.org (Postfix) with ESMTP id 0C0625398 for ; Fri, 15 Jul 2016 12:48:09 +0200 (CEST) Received: from BN3PR0301CA0044.namprd03.prod.outlook.com (10.160.152.140) by CY1PR03MB2412.namprd03.prod.outlook.com (10.167.8.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.539.14; Fri, 15 Jul 2016 10:48:07 +0000 Received: from BN1AFFO11OLC003.protection.gbl (2a01:111:f400:7c10::120) by BN3PR0301CA0044.outlook.office365.com (2a01:111:e400:401e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14 via Frontend Transport; Fri, 15 Jul 2016 10:48:07 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; rehivetech.com; dkim=none (message not signed) header.d=none;rehivetech.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11OLC003.mail.protection.outlook.com (10.58.53.74) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Fri, 15 Jul 2016 10:48:05 +0000 Received: from [10.232.14.199] (Tophie.ap.freescale.net [10.232.14.199]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6FAm2pW005269; Fri, 15 Jul 2016 03:48:03 -0700 To: Jan Viktorin References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-6-git-send-email-shreyansh.jain@nxp.com> <20160713112043.2fd847ca@jvn> <20160713193430.65b6df9c@jvn> <578722DB.3030900@nxp.com> <20160714175707.43755987@jvn> CC: , , From: Shreyansh jain Message-ID: <5788BF88.3060607@nxp.com> Date: Fri, 15 Jul 2016 16:18:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160714175707.43755987@jvn> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131130532858502327; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(24454002)(377454003)(586003)(2906002)(68736007)(8676002)(65956001)(65806001)(305945005)(7846002)(19580405001)(4326007)(92566002)(19580395003)(36756003)(356003)(83506001)(59896002)(80316001)(8936002)(47776003)(50466002)(189998001)(23746002)(6806005)(230700001)(104016004)(11100500001)(106466001)(54356999)(76176999)(87266999)(33656002)(81156014)(65816999)(87936001)(86362001)(50986999)(77096005)(110136002)(97736004)(64126003)(2950100001)(81166006)(4001350100001)(85426001)(105606002)(93886004)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2412; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC003; 1:Nn6/4OmQJxBrPyOoCzqbdrQrQ0gFIbpPPIlkGkWngV4UgS9wKTgcAeUkKSXJfVPacIvIBpauEYfChENcs5s4dEcwvOLYZQ0lIWyhaWb3pCDnl1AH8j7GZ7g49NQvasNSNmB/Nez3LJWws+RQ4agXx4qtYYNwMZSM4Z1F8H/SRdVcAHTrN5pNAafmoedDQ5vGj6lIO7x1uJ1R6fg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mcjFl3tOHL5AMoTv+M1JKhlYBVuFBD9Htg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13017025)(13018025)(5005006)(8121501046)(13023025)(13024025)(3002001)(10201501046)(6055026); SRVR:CY1PR03MB2412; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB2412; X-Forefront-PRVS: 00046D390F X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; CY1PR03MB2412; 23:I55lOEyaG4fs/OA6AY3CkJszWiEsVTyobCO/t?= =?Windows-1252?Q?vWa1FcRe3imcO8ZjWeemBFlvoqj5eCH+II9ty9JYj3ww/nbeFAw6jbRb?= =?Windows-1252?Q?oo/dILTzWLiNC6HLKZFbWElQfjIRa4R3eJcOM30iklzT18CZR4jZjfPc?= =?Windows-1252?Q?g7bkLJ/115Wz8svafY3VU0bWMDYpCgymKMyZ5l1L06ZLma2LodiaHRW+?= =?Windows-1252?Q?zkzAbqVs+uuoacgBjHoCS7KKC7Vryh3lGrltDakH/K6mc9eERYD2S0Xz?= =?Windows-1252?Q?F0/Np8rI6Kr0hp5TEhEomcYY/3VHmC7gSCl6R3OVQNByFb+YQmT6d+ma?= =?Windows-1252?Q?E0k0v9iFj1u0wL74NyWiusDBj0+SPMiAROvB/ow5vqF4NEf8RNRc9/Qh?= =?Windows-1252?Q?SecQuuado8vjcr1Jfp1+4ymKWTOa9ltmFqDJV6SbKV0Xk4rC4dt6LBVH?= =?Windows-1252?Q?AvzqXxFm+7TSoQ7yhwavm01rKxL06fOlrijpgwwaEn3Qb465y336CUL+?= =?Windows-1252?Q?zSFj5RzTbHx6mOftC5STy5qL9e6PHwQ7h94acMyfRh99S3b0/OinDCYK?= =?Windows-1252?Q?OUHtnNPgIwnixtqRVK5XeQIjvkpsYmY2k1W8WZMaxX24wOyAlSK3tI5R?= =?Windows-1252?Q?ukdSvTxIbQagpyUQhL3Gpk9SmsRgnBrrQmTrSM6z/Zbh3CyuNKbQfsAF?= =?Windows-1252?Q?CUyWMeN4Ex5OFhqK2oW/DoIrLHGAK2tg7+TeeKmIo4icva6qCm/S/nWe?= =?Windows-1252?Q?fYSrrdR1EHEJJnMSlOCHfcuvC8QflQ8yAe/po64EUkLFGHhboBhednow?= =?Windows-1252?Q?huLibnoxQVqKP0mQG7171NyomGk47THEWGwjuAlRXZqeN+f8yxZaBueM?= =?Windows-1252?Q?3vY9qTTut7K2PApiVqOeDZ/IuGMTiE4pEaLYHhb4lDct6YWtd8xnbgtP?= =?Windows-1252?Q?tQfVzHPbX6Crbx+SC0NYA0DuxCdXzU/IsgTCkeD5n7AEP/wbD2B9y1ZZ?= =?Windows-1252?Q?OXXmkee/UTtPuVtQx/ShyXy/UDbsEqHCjRD2rVubH1wBlMEFzm+CmNnA?= =?Windows-1252?Q?wOutBeORHEEAv9IRNAv3jj/oVxAP4v/2p+9TdWkgV4Q16vPmhAc1zawe?= =?Windows-1252?Q?WeI35rDmftE03bYXhCVcB+AByZr1sqf/8aAwiXx+fqNMqjaxxLSWHB2W?= =?Windows-1252?Q?eyLw1EzpEepBjx1LTxL7P8drKzIl1PRxl3qSxjSAHk+NZs2fMY//5RqK?= =?Windows-1252?Q?PXTXMFR4grWDl+LWp+0FsAZgvWJMq+/J2NvY+auspaSFG7YawMBDhJAT?= =?Windows-1252?Q?cl2+7bBL3jj3iRPuSsRkfBtjqgaPgif6bZvH44pK7REG1+gdjCME5vPC?= =?Windows-1252?Q?cVBSzgVbflkYkK/aekfaUIjoh+PkulSMdu1p1+VuKu0tgFaUE00uUXt2?= =?Windows-1252?Q?VeygG+xV7+ofOGu9SSUt46BT9S2T1RNqZROBGvQaA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2412; 6:iS5OKQLD4I3EZ2raD5A27YJw5Lj2lVoqmnRNuvyeVDUfD845obrrErdWQeltKPYtqyOxvY6b5RnggVE0FR3cQJwxg+7GXxgHkMrbSFgGSzX7sczhNH2sgavFB7Xx1ICuZ32BQ8pceBFEg6kUmJblLUF0ZKSK5d1tqdA2ZButelNs2Dpql2JnCk3aEb6MxDfoUVRJlbUX7GKpSEYEOrhvusyggKhzjoQ8XjPu8G62J1WFk1SmH4iNA7k8zekwxQ1jsXZ8jKOu4HbmfVLKAZa0ID5Ip6fwsMj7nmPiKvn/iLQ=; 5:WmT2IMsjA8ijQ4Ly9kGhEtb42PVt8nbgL49OWHNb9SoLPyWJLjign97g5MM9hfm/sqjKbgfkXZIiFdNZYdDclWJTQUUkMI5qvAwRaoNhIFlDFa9Ruf2TBW3RH45h0g7xx/ElPWKP+ANTMAQHJWnRdSAcLCMieT0GJbZiudv9b18=; 24:OHpiWnDjRcbQ0nhGg21QxVKDvlEvvHr0wjoTWkwsud1LFTKsvZIxXVRGrBzqGda1SHWpnH4uti2ToD3o6qC87Zl+IWH/rN5pWi9dtLH4ams=; 7:e0tfy9t0Uou0UqH1I1BvVBN2GpmdecZlq0ZJIVmLMyPATpCzzZTjpgXB4bdubi+Ji13BVxi7ziwZOCO9+tMa/unk3RNjEPHfNAbIdtUWxmc7FMVMOt4PQyYVRUyBXy8nLm0bc1Fju1diUTzFwVfHZ5o0XLMn/2IyVMmBI34tEDzWx2HyiRh4BgHH1tEmgtitN6vQ0fZOBtfmxt9n3/nJmuBsBM+Ab1f9uAfOwgBbr7T5zO+848RdjcNY3yQWl4rA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2016 10:48:05.6006 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2412 Subject: Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 10:48:09 -0000 On Thursday 14 July 2016 09:27 PM, Jan Viktorin wrote: > On Thu, 14 Jul 2016 10:57:55 +0530 > Shreyansh jain wrote: > >> Hi Jan, >> >> On Wednesday 13 July 2016 11:04 PM, Jan Viktorin wrote: >>> On Wed, 13 Jul 2016 11:20:43 +0200 >>> Jan Viktorin wrote: >>> >>>> Hello Shreyansh, >>>> >>>> On Tue, 12 Jul 2016 11:31:10 +0530 >>>> Shreyansh Jain wrote: >>>> >>>>> Introduce a RTE_INIT macro used to mark an init function as a constructor. >>>>> Current eal macros have been converted to use this (no functional impact). >>>>> DRIVER_REGISTER_PCI is added as a helper for pci drivers. >>>>> >>>>> Suggested-by: Jan Viktorin >>>>> Signed-off-by: David Marchand >>>>> Signed-off-by: Shreyansh Jain >>>>> --- >>>> >>>> [...] >>>> >>>>> +#define RTE_INIT(func) \ >>>>> +static void __attribute__((constructor, used)) func(void) >>>>> + >>>>> #ifdef __cplusplus >>>>> } >>>>> #endif >>>>> diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h >>>>> index fa74962..3027adf 100644 >>>>> --- a/lib/librte_eal/common/include/rte_pci.h >>>>> +++ b/lib/librte_eal/common/include/rte_pci.h >>>>> @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f); >>>>> */ >>>>> void rte_eal_pci_register(struct rte_pci_driver *driver); >>>>> >>>>> +/** Helper for PCI device registeration from driver (eth, crypto) instance */ >>>>> +#define DRIVER_REGISTER_PCI(nm, drv) \ >>>>> +RTE_INIT(pciinitfn_ ##nm); \ >>>>> +static void pciinitfn_ ##nm(void) \ >>>>> +{ \ >>>> >>>> You are missing setting the name here like PMD_REGISTER_DRIVER does >>>> now. Or should I include it in my patch set? >>>> >>>> (drv).name = RTE_STR(nm); >> >> That is a miss from my side. >> I will publish v7 with this. You want this right away or should I wait a little while (more reviews, or any pending additions as per Thomas's notes) before publishing? > > Please. The time is almost gone. 18/7/2016 is the release (according > to the roadmap)... I have to fix it in my patchset, otherwise it > does not build (after moving the .name from rte_pci_driver to > rte_driver). > I didn't consider 18/Jul. Please go ahead. I will continue to send v7 _without_ the above change so that your patchset doesn't break. This way you will not get blocked because of me. >> >>> >>> Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it >>> expects a wrapper around it (eth_driver)... I now, my SoC patches were >>> supposing the some... but I think it is wrong. >>> >>> The original David's patch set contains calls like this: >>> >>> RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv); >>> >>> So, I think, we should go the original way. >> >> I have a slightly different opinion of the above. >> IMO, aim of the helpers is to hide the PCI details and continue to make driver consider itself as a generic ETH driver. In that case, dereferencing pci_drv would be done by macro. > > In this case, I'd prefer to see DRIVER_REGISTER_PCI_ETH. > > At first, this was also my way of thinking. But I've changed my mind. I > find it to be a bit overdesigned. There is: DRIVER_REGISTER_PCI(...) DRIVER_REGISTER_PCI_TABLE(...) Wouldn't DRIVER_REGISTER_PCI_ETH look out-of-place? > >> >> Also, considering that in future pci_drv would also have soc_drv, the helpers can effectively hide the intra-structure naming of these. It would help when more such device types (would there be?) are introduced - in which case, driver framework has a consistent coding convention. > > Hide? I am afraid, I don't understand clearly what you mean. DRIVER_REGISTER_PCI(eth_driver) DRIVER_REGISTER_SOC(eth_driver) DRIVER_REGISTER_XXX(eth_driver) ... In either case, the caller always creates the eth_driver and populates internal specific driver structure (pci_drv) as a sub-part of eth_driver specification. Macro 'hides' the internal structure name (pci_drv, soc_drv...). But again, nothing critical. Just a way of usage. We might not even have a 'XXX' in near future. > >> >> But, I am ok switching back to David's way as well - I don't have any strong argument against that. > > I'd like to preserve the clear semantics. That is DRIVER_REGISTER_PCI > -> give a pci device. > > Has anybody a different opinion? David? Thomas? Yes please. Or else, if nothing comes up soon, I will simply go ahead and change to DRIVER_REGISTER_PCI(eth_driver.pci_drv) as this trivial issue shouldn't hold back this series. > >> >>> >>> Jan >>> >>>> >>>>> + rte_eal_pci_register(&drv.pci_drv); \ >>>>> +} >>>>> + >>>>> /** >>>>> * Unregister a PCI driver. >>>>> * >> [...] >> >> - >> Shreyansh >> > > >