From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-eopbgr710076.outbound.protection.outlook.com [40.107.71.76]) by dpdk.org (Postfix) with ESMTP id BB58AB464 for ; Tue, 21 Jun 2016 14:02:56 +0200 (CEST) Received: from CH1PR03CA011.namprd03.prod.outlook.com (10.255.156.156) by CY1PR0301MB1626.namprd03.prod.outlook.com (10.162.166.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Tue, 21 Jun 2016 12:02:55 +0000 Received: from BY2FFO11OLC012.protection.gbl (10.255.156.132) by CH1PR03CA011.outlook.office365.com (10.255.156.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12 via Frontend Transport; Tue, 21 Jun 2016 12:02:55 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11OLC012.mail.protection.outlook.com (10.1.15.23) with Microsoft SMTP Server (TLS) id 15.1.517.7 via Frontend Transport; Tue, 21 Jun 2016 12:02:54 +0000 Received: from Tophie.ap.freescale.net (Tophie.ap.freescale.net [10.232.14.199]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u5LC2TDM004076; Tue, 21 Jun 2016 05:02:52 -0700 From: Shreyansh Jain To: CC: , Date: Tue, 21 Jun 2016 17:32:34 +0530 Message-ID: <1466510566-9240-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131109841748968851; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(356003)(7846002)(4326007)(2906002)(48376002)(189998001)(69596002)(97736004)(19580395003)(19580405001)(50986999)(76176999)(586003)(85426001)(50466002)(33646002)(106466001)(36756003)(2351001)(11100500001)(229853001)(86362001)(87936001)(5003940100001)(77096005)(110136002)(8676002)(2950100001)(81156014)(92566002)(8936002)(47776003)(50226002)(6806005)(81166006)(105606002)(68736007)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1626; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC012; 1:RIdelDLQ0oDfW5g1LtzLeiOTET571D+TKrvAtWYkq+hFRw4T948rTZOSHdPxjVBuyDRHipyRhCa+zTf6eeGbgFryLUOIWw75QhC+VPHhs5Wd+M10SvNYGP5eK+91SoP4e1Q8VAzKLfQ+nvpgT9XhNU3TCOHi8Uv7BHB8LfMeJARGVH7MG4CZG46QgCUPij09JGmJSM5U17BvkppKmP+zbObinZ6UXiax3INPd8cL8wbtd3iEjSKSLRbbymxB0ZgEegXYwWLjoqqr8h7D2VPXjlzkqe6Wx2LQt3w6wkXaRDav91k1USRA2+i9B5QTM0K99kL/JhAcftsrBsdT/Q5DflhGjnjH0IQ4vrB89WKLnZNrw4mdtFNMHbHy8c20lamoRmnQ1OnPy3ElYOOJdYk2ielZZrvcoaQwBAQvXgrFvhL1OQSt9ntJbzNwwjy0bkLPtKsdU0I3/wc9QVQrBteernA27DJubhk3lHAqgVdOv+brh4FU1/q8qAMQq5t9GlWtPR42JeA/AMlMfpnvh5ZzigDbbU1TBQef7kInWc9rxfVEolpo8pAq2LUdZngqOeTPoW6KiZWqY/M4EJScEjTiew== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 26f6ca4b-429d-4e90-3ab3-08d399cbfa65 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 2:YJHcrxUW5p0emPTCSGMbXKY3Oe3SXR1jlgxC/7ZD9HWWxKcOLiS7vrmfwmuDegpa2D6xcQVIvow8/YLBNn36mm9sx/GDoH3u4glnv+3vLjgOYZVbNzTciSZQ8dAOG5HwdjVHVzSnrYRaNEl2rLhDJq+lTiSlgy+hTdtJUVaQZu/LIRtHHKJGTOGWmMTbBzJ1; 3:PMQIPUSw46h2C3ljr21dgRLIy4otrgAjtrCNw1hDEdvik7pkzXa2awN0eYP5YoDvIm64uJQ7pcxvi7Q5RgR5kt+/U8XsNf9pQ2LzNssxDwEg1kg0GUj1hKs6aDd6Ne+I7C02lIQcoATSBua+aQYE/Pw2ePAodYTyI/hhyMgFHWUZDkENcEFQ3yn3m8Baxfs08GmJI1JV3MWow9rlD7GcaTynDm/+YA3VhLwBNSOrijE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1626; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 25:SliyNsLB1aVFufjYvDfxOcQra1PDCfhUJkv2YD91+2kvR6Jko0jhoZYwPjSEXB9qOdZkcQ6DZlk+DlhYf0KuTSodKEMQ4RbIR3vlfDh/efFQG2YYKxtryHavFEBzN/QX4QxFbXAgPI4GSB00E97fz4JXMoIRoH8CHN7YmRmFeIDWUnkPyEVNpBxOI7axVcLqyrzzEnrgB5fKdT8PYgx60hPPEiSSnM64dvzhd1lF94eLi3Yd1uUTmJflaAygpU2OKLg1IlAo35O6WIh5TosyCdMP5nx9e5Vlvojhpehu18i2OvU1z6s5A8fWjbjqIZTvwTQ/9gBu8/0aOMbmcp/Lb6W82sRmq86WIbqg4870aABDQiKrZxR1aMDoUC+Z2PSW08uMuGbbQBjU03ZfFYDxUiOdg9ElBts7KeN5N24YUaAxMQi3evsmFlvd6yT9bqvMAmnH+MX8AKHQz8TCEF6k18zhgdfPSEC1urVKQ9bS3p/FThoYtVfszgu56iReYgEhyXP0x+CnZoGaxLlkPR31z/ETqblHBwhnlFRguP5OO0l/N1WmYGk717t0RwqmBId5DMAXLHr/CShlMvZpF2zSA+jKZyxVvtxmAVYyB3qO7k2i8zdN5s15lpjWW97KBw/kefjLPYjdoA3sR/My/4BoO39dDvYmBDOO9NL09uZq13LUTNXE/3EosmzbZ0F+C9o6eA4N9pf5gRJQjfYCOyHBaw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13017025)(13024025)(13023025)(13015025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB1626; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1626; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 4:KoMPlNvWrHl7J4MgysaF6YjJ8FgKO8w6DTJMgD3izVfihMKPrSPwhpuGQcAXlWNeFe/M1MER/20Co9TaGwZ2ZV+h7RhSC94Mm3ofpZMAAhf713gfdoNU6Py/3hwQLCQXMXwsJQZL/TxQ2+QHTjK8OAqV5mxme+pcIUp+0sIx+68o3giRmwpMn4ZraiTUpBRJhi5GdlD3mUq9yXhviWBUIlp/iYqrI7n0S5WVs7FYZEWgMvJm7CRMvgAuwVLo2XiKNw6yB20CoUehtqhZibVWppp/zelhI30osbzZhCrrZai5md6+4eYlqXl2aoBNAWr3/wjh9e+IZVi91re1ph6tF6Dl+5f9KxzeozGdTm/W8gkYjmMjRR9qOvL7GI/EQMP0/zZxfM+KGyuZtMXsIdf0n0S75kHj0VNeVIHPC2wMsleZQEUtwsJf6q9sBEj2W03X0lx7ObmtV+tOadbPuZa1JI8Vs7XwOoaMBSZZR+kIkYl1IzL6f5mcMbdI9P3Op4f7jKZ3AR1tteTt32yGNz9CGA== X-Forefront-PRVS: 098076C36C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1626; 23:iMKzb71TEHl1rT1nxyrNxoFRD0m2XTrCTCYdk3D?= =?us-ascii?Q?neIVf2hWmOJKcYR20kP7MSP6JEXE+JW0I/Ze5A2IGSf2SoAJ0jKq5fYeivU9?= =?us-ascii?Q?82FeZh+UxJhSGv1fasn6E2cH/AK1AfJV9iw5bcQbutTGKlOBrDV+v74f5pxm?= =?us-ascii?Q?kTeyW7jOM6oHp9jVpMDUwZSEQgGHlPAn15+pQJFLsL5M2W26RbRBXegFztQF?= =?us-ascii?Q?InbvTsUU3bjQlX7ox9Xn1JouvE71zYdCXiEq1lYA2sda8dp1XALUS55gyrWl?= =?us-ascii?Q?LXIc/MyxubZKb6tItE8t7vM3QS4CWb1Im85E9bzpcNr5+t7BeAezaW1VpLZP?= =?us-ascii?Q?Fh+719UaF4DlxWpG9G0OWOQrT/wcweRBEF4IN0MbOmTe8RbSC8eVoKC+6Eil?= =?us-ascii?Q?vRPS1WcK/EnI5yRya07+TKVeu982XOAdTsCLh9IstzDXG7lkU296ncd1CQav?= =?us-ascii?Q?+u7IZLlNxmA2BdOmepBHQmIpwcBwkisEk8rI8SgKYidQxubhl5rREs+cn9vK?= =?us-ascii?Q?Euo7GeCTFEgrpl4Bcnk2S8/LQNo18xNe2/FQIQ66pLpwg6lf1sEkVAx9uCxG?= =?us-ascii?Q?O5OVW47ivXyw8ZVjkKmUFTVJS+C4yFSXR0tAqbS5j/3pSUTcrs5dO/goxR2D?= =?us-ascii?Q?uS3NmuQz5DpqwM52NJC3rfzl+UVClw8+cH05mrCd4U+wAG04qzMPqB8wDi/+?= =?us-ascii?Q?CZaDSutBp7NboaDMKj0GIv2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kTKASk6hLgAPZeu9MqPtgVE4GC9WV54+brFh0H9aX6Ke4mbwNPlExd0/AVY29arjStXv3jf4=; 7:hF3YZQXxB1ZLeNPQFQ9V7w6kUzCqtzOP4NdskP9fBZv62FDWGwssx2cGoGrOvUs7qgyv3XSYIjecxX5zapdjdNFN5HVELjwnDDRCKLX2ix/2mc+bC22zIA0eDVVZW7NMaxiC5KdZs8x3ZYS4JKOEbir5WAatCpNH8FYx5El8vNfgibTNsvZcB7u7RfH4hpeK8yhaDJ2lxsSNvlD2MbfZzuhG70pAK+8Xwwg4qiu5dSLAvudhWnmT1ObinVRnTzHT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2016 12:02:54.6628 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1626 Subject: [dpdk-dev] [PATCH v4 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: Tue, 21 Jun 2016 12:02:57 -0000 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). RTE_EAL_PCI_REGISTER is added as a helper for pci drivers. RTE_EAL_PCI_REGISTER assumes that object expanded contains a pci_drv member. Suggested-by: Jan Viktorin Signed-off-by: David Marchand Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/include/rte_dev.h | 4 ++-- lib/librte_eal/common/include/rte_eal.h | 3 +++ lib/librte_eal/common/include/rte_pci.h | 8 ++++++++ lib/librte_eal/common/include/rte_tailq.h | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index f1b5507..85e48f2 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -179,8 +179,8 @@ int rte_eal_vdev_init(const char *name, const char *args); int rte_eal_vdev_uninit(const char *name); #define PMD_REGISTER_DRIVER(d)\ -void devinitfn_ ##d(void);\ -void __attribute__((constructor, used)) devinitfn_ ##d(void)\ +RTE_INIT(devinitfn_ ##d);\ +static void devinitfn_ ##d(void)\ {\ rte_eal_driver_register(&d);\ } diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index a71d6f5..186f3c6 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -252,6 +252,9 @@ static inline int rte_gettid(void) return RTE_PER_LCORE(_thread_id); } +#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..ac890fc 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 RTE_EAL_PCI_REGISTER(name) \ +RTE_INIT(pciinitfn_ ##name); \ +static void pciinitfn_ ##name(void) \ +{ \ + rte_eal_pci_register(&(name).pci_drv); \ +} + /** * Unregister a PCI driver. * diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h index 4a686e6..71ed3bb 100644 --- a/lib/librte_eal/common/include/rte_tailq.h +++ b/lib/librte_eal/common/include/rte_tailq.h @@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name); int rte_eal_tailq_register(struct rte_tailq_elem *t); #define EAL_REGISTER_TAILQ(t) \ -void tailqinitfn_ ##t(void); \ -void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \ +RTE_INIT(tailqinitfn_ ##t); \ +static void tailqinitfn_ ##t(void) \ { \ if (rte_eal_tailq_register(&t) < 0) \ rte_panic("Cannot initialize tailq: %s\n", t.name); \ -- 2.7.4