From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0073.outbound.protection.outlook.com [65.55.169.73]) by dpdk.org (Postfix) with ESMTP id EB68BC13A for ; Wed, 22 Jun 2016 11:06:30 +0200 (CEST) Received: from BY2PR03CA011.namprd03.prod.outlook.com (10.255.93.28) by BY2PR0301MB1623.namprd03.prod.outlook.com (10.163.28.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Wed, 22 Jun 2016 09:06:29 +0000 Received: from BL2FFO11FD038.protection.gbl (10.255.93.4) by BY2PR03CA011.outlook.office365.com (10.255.93.28) with Microsoft SMTP Server (TLS) id 15.1.497.12 via Frontend Transport; Wed, 22 Jun 2016 09:06:29 +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 BL2FFO11FD038.mail.protection.outlook.com (10.173.161.134) with Microsoft SMTP Server (TLS) id 15.1.517.7 via Frontend Transport; Wed, 22 Jun 2016 09:06:29 +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 u5M9663e022009; Wed, 22 Jun 2016 02:06:27 -0700 From: Shreyansh Jain To: CC: , Date: Wed, 22 Jun 2016 14:36:24 +0530 Message-ID: <1466586396-22618-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466586396-22618-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1466586396-22618-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131110599895139661; (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)(199003)(189002)(97736004)(36756003)(47776003)(106466001)(105606002)(2950100001)(50466002)(85426001)(69596002)(48376002)(19580405001)(19580395003)(5003940100001)(2351001)(68736007)(33646002)(11100500001)(87936001)(50986999)(229853001)(86362001)(76176999)(110136002)(104016004)(81166006)(81156014)(6806005)(50226002)(8936002)(7846002)(4326007)(189998001)(92566002)(356003)(586003)(2906002)(77096005)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1623; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD038; 1:MBM+852XsS++LREys/iO0HPq+caj3DYBcVzWVxat6Py1JmzPfcWtbdI3304kZZhxJTIZ+YAgSuy3zSLcFBo4tulvUNrR41QXSfg5DOrasuE3xf8r3pVpgeeFDCVg7z4bm3mMNGiTVewG/cqbVDdIUGEdKKwkLxmlj9ub4r/f3mHcyIm/FUfJ+WBmNkD3DYH0VgHK/TiG5N8zgAZoSiEaL6D1xkw6j+EEfJ8tetKct+T+roQCIRV4DhEaQkEAVEbr76VVZ8ANI5LwX83xktsCHTMZyTyZbyeS3scwH/z0WMumY2dRCqsp8ajMPiYLTpgjZZCT/3FO6tUv4YHiK2nS8mNtVFqoSgb67EUTu18lmmV407CNa34SDq2kYDLYClzGmvzwzRW68Uqj4sBjRSVn9PKSiLKLw5qf1LqIxHeaZp/jHwicxdlW8DW30Q64B3yEWLuWkzcvXiTtPu00d74uGc86ubhgWS9WfFiS+/TvSZt7/yiblEocIG8VnYNpDIk3/S02D6TfD4M0NgKpZqvTHztwhAaHpNFABmHVPcq1aKg0aXJ7B3IyMaWA+U7sNcb8rPJeomoopYzAk2tfmisL+A== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 309a435b-6294-4664-c54d-08d39a7c7f80 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 2:Tk5Rs2ckmFOehWiMtJ7YHFWvR+0MMGKVAuiXJYITICI1I8257u312TKCrVBZ2g4LQMiqEowb9nNOi3wRhHQNtnhPCn+nZwPnLVnwMfjLWy/TQy/VhcbNy+87X5ydjvEt5iTXAlvX1TQWHtkbO18FrJ13r44iB5isEJqxo4E9A7mJNfb+eHBAcAeargNMdZ40; 3:ptqZXHG9xVJ3SWdKwbXQxjJZfN4xVCl9V5MSF/WDsaK1xo5+hlW2UhbXLWfId84DDKjHjOshWlliAb6luHeAZisuamY2ryS2WYXX4+KHvY9njyCUEujddrNDFdJ3YAiJUGWoCFGjgFUC9HBZFbAiQo3ItNGBi19HtHgMCS4l6eax7T0x3NatyG+JWoEH2QPGkHftaN7UCZ7VtlIdTjESe6k26CLaz1rm9eShDNbVrSo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1623; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 25:3bP3KUxlWomJcNWFUMNGAylgp9+wzNU/sV3Lu0zFD+FybolhWBIQDmrqnkmJf9/mMlzPFn2PLzFj42pzmrkk489Mo8kz3Emdiw9adt4gd/l4xk8OwzrXg7bbOTDRd6kaNfRFLjYADqovT3q/9lDB3flGy7B3quIpRrXfdkCUp4evYCju/WXZt3y3SkGerrm5EN3PiM7zbSyZIlEGKMNpACU0GWMDZNUpIz5N7lH6ALZNgq9jqU5IM/T9eqctFjROnNQcAl8yc0HSAeBSYfj06ssAXa+2ma2EruEW9mwrxQ0ObR5MHKPMlpGiq7aGsNSIhVpkxfTdAUkFfVIVWHn7QbIsHdMutpPFIRV1Z80RmzHFnz5hJQScy6yJpfo5cVDmJwAD9ze6Mk4ZDjHDN8zLAOFN2gv8ZaBUytq3WH387bEXSRG/qXrsQLcYgPdiH2VfHDWjfRfYQ2ccVEhLCf75MRdU0g3FjAI/tLTa9poFwfoXr+MaaCmcSdkJRcgheAdisuz8mg2i/JIQCjFV7eoDqT8bvttqnK8avNd1Uix6tH3ovdaWqMDfT7FoKBgNslYDuDiAyvmYtINHMPCuCG5Ub7IJJQsLher7Exl76otMFdtyZLDvqw75Nb3Qs1YnzG9MKLWmS46F/K6rKNshp+M+RupcFCYk8jqipo03x1yGuEW37BfKtwQuVyUgXq2hEV6K0aW+QXjZaKaaBbFTw4ivFNO/dIrDV1MjSgHOtMtVc0o= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13024025)(13018025)(13015025)(13023025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB1623; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB1623; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 4:5dYRKVo4JhKQRfVzz1Jx9GOBSNwcz4gsw/Yn+H9eArXEElub1/BsCtRejDX/kjKJPwUUX1XpM/1XDlhAJSUDKaeGO1G423qbrufAkFq/Fbw5e/RKWoKgJd0aZEcMGQHKfhEKwNOZyH2KII3ZdjoLWfUVnv9cmbthxrwc6DpMZXSzCe95wznEd2k4xUfALzuqzMO6L3Q31n4nz0osX+BeFphEjO6LMMePA0L7u4ZrX6kfWQN5JcjJALoOftHdhdmgPOF+tlDn4U6CGk74CyAuqOyY3P4BEusOJy5Yz8iL9IjrO9sS1G/TQ5y3IOWjl99NrxgJ+XhUe8ycNnrEhf01T1RlOoxBqzr+P1E5pfLGVdM7zAqxSUM/dhnc1Tyyh9TENr/Zaj6CiWwpdMaZX8VwH2n+/P+qcj2ooFdWZhydGBXqCEpP2CDq5OJ4UhK58KJAdlHniWXxf74iu3EyhkN6Dk9uynGBQoRWVC3q/uZDIFhKDGuUBEvA3jIPM35Ze01R6+tSvzciCoveu5wi/cBcGw== X-Forefront-PRVS: 0981815F2F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB1623; 23:lXLN2tvDLl6sTk+ugIoWKRvlwgx0nAS7YfbNloZ?= =?us-ascii?Q?/YgfjBwd+ArRzVhbztiCNG/nHIGfU3BXkJf6IPuh29RzTP5RxJqMAKEITqmE?= =?us-ascii?Q?aJ3oDifcjzbl6lheEjbS5azti3eKae7c24v6fjTvNxp/uT4nZoUd0Yd5gbXt?= =?us-ascii?Q?VAFLGqw65WgctYcdXrIpsditVV1121Yi/MH8DNZORwyzdtKaIiuA4be32Egh?= =?us-ascii?Q?3zAyCwsWCrSfjtoU9dZHMtWvzwoJJ+qR4B1xkUe/IDvl2LsC1d9Wcz5Bz58b?= =?us-ascii?Q?9mSfQzrQJ4dlzyhd4mEJV/GK8wko9bguqRxpJ6O0SiaDnLZVXDp9Uuy2/NlM?= =?us-ascii?Q?2HoAooXEOU3BQ6wDGw3oE3H0jmpVAn8brk1KFfjej4l4n59eG1UVn0v+RE9Y?= =?us-ascii?Q?6CXkj4OOW23Ow5pnU1BWu9x+W53z2CSLrhGXgxOK+q9hIbTW+KtqKVZjbRWv?= =?us-ascii?Q?SH5UqOADgYzGImtAsSK1KkUrbQotsujr5nLKz+RKtBmgg0cCisbH5qtmOrrF?= =?us-ascii?Q?NTNwMA5EO856ELqDd2/4IyOUZFNFjPidZGCTZIFCflCDfulV6cBoQXtjZ/6s?= =?us-ascii?Q?FVZGdONgl8R4GAHT4nOu82nj9Of/nzzuJWVMGAsH3+3PHtYcQzHVRGNEcXW/?= =?us-ascii?Q?sQeV0Zom6/1RU0mwnXCLzczuCCQnIxDI3+ie6GXhL7pKjqrrrpJJo9GxEfCx?= =?us-ascii?Q?OrgVfHtT/8A85niPVagBII3q7mPsQokE1UNKxTQ9Z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eBk7m8op0UQgnS4eKUVwRoGJEbssV7MIGhiKWmoojFVCzfWUsJ8GzMUUWtk=; 7:YXQD8d1WW91nxFV5nT1J4Nh22vTdb0p/HZcHrqcssf6aj+fq292IZVt/W75zJDumonUScU2jh9+WP4aR2SCYdabuooVJzSKiiacEcd4KXUstCIhMRY4SEjjVHi2LDWvHK/7gCM9WwCJP78wg4BmhCHk2H3qikfkMhNQSo+zVR/P81w3YAD+XvBrvpuYvK7hAxwIXG3tjvet8ucjs5j5dosGj2wQbvQ5Qhssz/yUW2Nx0n29iL6uK925Ts8gGlEUggw5364VMJUS3IvKy5h040A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2016 09:06:29.2955 (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: BY2PR0301MB1623 Subject: [dpdk-dev] [PATCH v5 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: Wed, 22 Jun 2016 09:06:31 -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. 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