From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0060.outbound.protection.outlook.com [104.47.41.60]) by dpdk.org (Postfix) with ESMTP id 209808DAD for ; Wed, 7 Sep 2016 16:09:52 +0200 (CEST) Received: from DM5PR03CA0002.namprd03.prod.outlook.com (10.175.104.12) by BY2PR0301MB2005.namprd03.prod.outlook.com (10.163.196.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Wed, 7 Sep 2016 14:09:50 +0000 Received: from BN1BFFO11FD042.protection.gbl (2a01:111:f400:7c10::1:182) by DM5PR03CA0002.outlook.office365.com (2603:10b6:3:118::12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Wed, 7 Sep 2016 14:09:50 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; 6wind.com; dkim=none (message not signed) header.d=none;6wind.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 BN1BFFO11FD042.mail.protection.outlook.com (10.58.144.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 7 Sep 2016 14:09:49 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u87E8BCp013556; Wed, 7 Sep 2016 07:09:47 -0700 From: Shreyansh Jain To: CC: , Shreyansh Jain , "David Marchand" Date: Wed, 7 Sep 2016 19:37:58 +0530 Message-ID: <1473257297-7221-7-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131177309901626005; (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)(1109001)(1110001)(339900001)(199003)(189002)(2351001)(68736007)(77096005)(105606002)(4326007)(5003940100001)(106466001)(104016004)(87936001)(8676002)(8936002)(229853001)(81166006)(81156014)(11100500001)(50226002)(7846002)(76176999)(356003)(305945005)(2906002)(36756003)(50466002)(47776003)(8666005)(19580405001)(19580395003)(626004)(85426001)(97736004)(110136002)(86362001)(92566002)(575784001)(48376002)(586003)(5660300001)(50986999)(33646002)(189998001)(2950100001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB2005; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD042; 1:kZEUIKB5oJ90dXQP1aZoEyRagPL5b+sHgUpVtkJ74zkxXDXgTLf6TujMXRkb3I3Ai+NXtMKeB+yeFJP7huS95WPAwLQ2SVZ3eeoSnnXSUaN2Pi0rsjZ+yLNotdPQ5QTA0xKTmFh5oOuk2xoxv6wBOIT5VO3W3Z5ijUgCUxouFNm72NaNvPlrEbRxB4si/cSNbxb7UZhcWLLWViJo3rZ0G2DtM12F8VB92qZCkIDSyEktWeQBbQA5ZZVAk5/A4SN3gEZK8lc7QaZCoqDRsoW6vqSvGR1WgqqHIPCaE4zu3E4eDHl2ecftU3XvWp9bI11GpVWE6AQp9dVnKIKKp75NI5YFzVkFiiSfMb486Q7oYLPiE7l4xnl0xOpSmKRU953C+y8g2Nn8KIiYgJApYjBiSweNDEQv5+53VnU4MqIDwTLNaMKzcdWaqZrWrfFAmQoPxMsJtjHn9mEN4kQHUfdgvvUO8dZUQ+Firoczko3qTbvYcXnXEA/miaRXLAimxr7yHmr04gJ0P1MbgpsHvebfDVqrfJmpaQbWWhb1Us4AbXsrsZpkKsM5tRicxd0/bM/zkKNIm9EyzIsUZml+8sFwuPNLP0jPXTPOYYzBTExo1ZTVLnf5USNCJoplcnjNUata MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 28da99c5-c364-424d-b934-08d3d728a1bb X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2005; 2:2+TvxsgkUuyASJAj/KcPPMlcM6mB4+SqU5FCYbHganDPDX8NLgmd0kurXgw+Z+mC8o35fEnHVYk53I73fCTunyf40D1UghwnfJGtk1Z+Vn8XAldO2QsI1HNJBkxAxvQlv3ZifwYFnJHU1BXxmMZWYQIdLifXxgVHDg/a1yBJPq0XkdZXul69L+TgdTuTHVhO; 3:DVJB+CTnSspNcrmIf5RWyAUIDSxgXIzAbWh2fggjIry6t68uoZKk6o9WY8wjT4gYMgHXSobjPdsuoIaMHsVrdZX0j8lw1nl/3KFBr/MG0qF5Wd8xk8fOeF9uinHvxYkmmRGuwq/7IH7TwiBnKuLrt9Llg2jFg8MS95+16yxaBzq+onBxiSI5YxP0/gKmn6/YjL6E/feoZwqLBZg1OfW2N2YeuKlqJKGhNxgYBSTUsCA=; 25:HihPb7si+G2/m/Ti+x0qansq33pMFSFjweMonV+/tPWlMldaT/SKEhIKVSkM7KS4KoFq7656yMMTvKmEENG7atsz47/9gDCLu5xjCHHi++mpzwfYytMO87Igl3DmBb3yFlfObFPVGvhqa8nU1vf/tdvqA51Sg9vVAYUyyHLgdLlBNwl77HS0psmnv/55YLVJ01K1VYQJCZ/8Rdcp1IhxGe6HibcS8JlExZcNrHHJ9USdCU7e1vOvmZnNhcnL1aBBlRfJEfQ5MLs73l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-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13017025)(13015025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB2005; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB2005; X-Forefront-PRVS: 0058ABBBC7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB2005; 23:Lf5RZpUFlbQ1Tpf/YQRT0Xvzs8nlaIsThkWGJ6k?= =?us-ascii?Q?Iy1ASqYuBvr6EwZdJ9O/iRVb4KSHVf3vjq3c9eghhYdyk63DEdFuIYoXcjR4?= =?us-ascii?Q?YK64VROcTQCos4s6gKwDhDzI9eUwxJNc04zr83axzH1TrA7Wdn0TVau97ZeE?= =?us-ascii?Q?fsOhFwJBcIVgbB0oWcBhLL2tzMlq2kU/ZCsgPXTVLgji1KoaJk056cF/5/C1?= =?us-ascii?Q?Mj0rGBWVfi3fB7uXkevZoL0rkBPn5jFieu4dNyWIOQRE925dGqrtDzVQDCVV?= =?us-ascii?Q?N0h847aZHw/NI2wgSjj3K6E5rZPY7hk6pHzg/yF3sZ8jSZoXw99cApfJknPI?= =?us-ascii?Q?P69Sfqd6BpudIUge2gl0Ob087kbMFCxPC7J/INKB5p+5YyFrER+w722hkuxJ?= =?us-ascii?Q?uqqay8oA8YsMgbHVLp/mTTHEtuFZ5sK/wGrl/E64H/46HTiqUAwMjIQN/LWE?= =?us-ascii?Q?o2WsJfYR0Rg4Lx+nRfSaFBHJSRKc7dUVtSTQEuKMXMig9VzlQ9CaT2zEew7I?= =?us-ascii?Q?oLRAU/56gCY7equpxHGt/CLXoD9elZ93jJh2Rai562SW1DPVa6AA/IGKOL0O?= =?us-ascii?Q?LRpBSyB7gb+2rA2YqbXYxpfnFP83IGjDeCoe58s/7+LTPDkl/kxREMENk5cV?= =?us-ascii?Q?eEgM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k1Y2lXncRHeVzjuxgaByqzvs+7IC4pHNFPEV6ZBNTLrJeBWXU1ZZMTBtPqgkhe1UrOzKzJkNTL339mJXo2USIHcMDhNciHZ9h66zkFv/gUjyjBYlMD4IwyxNJwH3ib+ug=; 24:2xufOXjFs3kb9gMebFiOHTxNEcoeTS4hAzhdEPfv/VRKJr2n7i9KJDxu2imYAiWOJ+4fro7DXsUGM/6USmJr5YBnYKXk86I9RbsnSDcjV5U=; 7:nvqLAgQZ3MikUVLoMko3tszR2s1WlAGbZE6d4TIoxHuo98kkVUkG38sZ5TgpGxwPgPEKL0rdqVSeCPjx9m/aXsj68c3qoz4hkfU5B7OpzAODOBqHEuSo4O2FUq2Cho7j75Yd8UO/tOF2dba5D8K+qQE7ePeFduoo98/UfDCtLOsG0AW1DFY1rYmpnBYC7tTOk0koakuegfuWJJKJWUcfgJB05+Sue2eCJ65QNv5AAcIS8HHhgezBvqYGxb+Dh/2O SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2016 14:09:49.9441 (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: BY2PR0301MB2005 Subject: [dpdk-dev] [PATCH v9 06/25] 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, 07 Sep 2016 14:09:53 -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). 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 --- 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 | 10 ++++++++++ lib/librte_eal/common/include/rte_tailq.h | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 95789f9..994650b 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \ __attribute__((used)) = RTE_STR(name) #define PMD_REGISTER_DRIVER(drv, nm)\ -void devinitfn_ ##drv(void);\ -void __attribute__((constructor, used)) devinitfn_ ##drv(void)\ +RTE_INIT(devinitfn_ ##drv);\ +static void devinitfn_ ##drv(void)\ {\ (drv).name = RTE_STR(nm);\ rte_eal_driver_register(&drv);\ 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..cf673e4 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -470,6 +470,16 @@ 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, pci_drv) \ +RTE_INIT(pciinitfn_ ##nm); \ +static void pciinitfn_ ##nm(void) \ +{ \ + (pci_drv).name = RTE_STR(nm);\ + rte_eal_pci_register(&pci_drv); \ +}\ +DRIVER_EXPORT_NAME(nm, __COUNTER__) + /** * 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 cc3c0f1..cc386e4 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