From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0058.outbound.protection.outlook.com [104.47.37.58]) by dpdk.org (Postfix) with ESMTP id DC3FB58DF for ; Mon, 1 Aug 2016 12:45:04 +0200 (CEST) Received: from BN3PR0301CA0036.namprd03.prod.outlook.com (10.160.180.174) by BY2PR0301MB0696.namprd03.prod.outlook.com (10.160.63.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Mon, 1 Aug 2016 10:45:02 +0000 Received: from BL2FFO11FD061.protection.gbl (2a01:111:f400:7c09::193) by BN3PR0301CA0036.outlook.office365.com (2a01:111:e400:4000::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15 via Frontend Transport; Mon, 1 Aug 2016 10:45:02 +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 BL2FFO11FD061.mail.protection.outlook.com (10.173.161.157) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.549.5 via Frontend Transport; Mon, 1 Aug 2016 10:45:03 +0000 Received: from Tophie.ap.freescale.net (Tophie.ap.freescale.net [10.232.14.199]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u71Aibjl018422; Mon, 1 Aug 2016 03:45:00 -0700 From: Shreyansh Jain To: CC: , , David Marchand Date: Mon, 1 Aug 2016 16:15:20 +0530 Message-ID: <1470048332-27318-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470048332-27318-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1470048332-27318-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131145219034567810; (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)(50226002)(76176999)(5003940100001)(2906002)(68736007)(86362001)(575784001)(50986999)(36756003)(305945005)(8936002)(81166006)(97736004)(47776003)(8676002)(586003)(7846002)(4326007)(81156014)(11100500001)(356003)(104016004)(87936001)(105606002)(110136002)(189998001)(106466001)(33646002)(2950100001)(2351001)(229853001)(77096005)(48376002)(50466002)(92566002)(19580395003)(19580405001)(85426001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0696; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD061; 1:yHthbiO2Xz0NyWB2wsMakrxGe0oYaYPwtf2S4ds57ZeztneQIRxUVM6nE/ykPybGyHzmuB/y+IWGxQ4pSZgs6XA3eRZ0TsWzmWkpBTovqyVImL3G1/LMRw0BT6XnqODPh5muD0xJrl4/KSdCtsiax6DurtxaFZnWYO0A+MXRJ9hHcG/jEIlcF8/z9zVj+5uGt28OEFoW/corq3ZsSMEbRNFRk+c/XsInI0Zd2BDmkbmY/ctm4a3FwzERhCkbcpn1O9QZd3MfiAltYLUkQULoskLFPvY7cGYe3fEiRs7m140m+2Is5mLCTED/xvgbWXQ6GuGqt60dti4XIyNH4zBAFm44+sozfuJH6kxIo+dKXDzgEUK0d9b47Fap7WjU0+aDAzca5RN2xc1oW1uZ6n90kQ30GXfJyueTRnvnjTXK7sdd87HafCqlGa9depgn23OVXyo4gnP1maWPL3lW1Dg9sLU0u2vz4po29/h08Lx8sJltpiXbNPfSG1s01CVeHs4/D3uEMpuoV5BEMBkBPhmJASH1FUhSvZIBD/2rUL4TS7qd5q/zMydRCqRDgeEmeViJk8Us1kC92L0/mdm8yIxBD2X6VHj5JwpjlVJuMPca0CP1NmbNhFNA+UWWQqZu0JUy MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0809ec80-4449-4743-6819-08d3b9f8e4ed X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0696; 2:7fEysIhre04B7x2OsT20/SKcQAmSAIKxvTSjbJqSL0C3yiNgZCgvf/HfuovhP8uLCITDIni4cCNqnV/5qQYnMLj5aq2pJc+29fSe71YtGvbKzRTJhcAJbyeRl5fOb8jiIqPvdmcEKx7S/Y9rB/FgeiPYDeZxjFdcdDtnYLJNQnll9+ImgMGl3UeZVotomIsw; 3:nI/rxLdYQgMrE+1W24jsrRBNwM8lzZD1gFuNN4y40MqS/vYPluh2DwQ8tG7oz8Y18Exe4GKEd0jB6s8BBZuPplBmKtetthqWIuRbX2aNIEVPMP9uSDkcxwyBF+CGEgK5qB//hFKUlu0osC+jwXNbu1n/BksACY97/aySVdh20MLFf+dUvK96ItYdzqHKgHMdDa6+leNeJkfw+4qHsQ1KBFDhFrYmZAxLsMxTXDTyf4o= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0696; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0696; 25:KGIHqqWxE7qGzilcsCHTlPBQGQ3useweFTTvnI4A7E/RKYuEgRBHt/5pXnqRMyQvYYRgRmgS+p/s+68iZIhAThBckRpM5VHlaoJSkr9m/dOPIArSkVK2dY2FyLre5hgIcF49UVw5hLNq0t8LbqoJszhQ4cqi8E3rnG0JRtjIJsO+WD9TCWU0aKHQ+Wd1h/Hrytmk18jQRhH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ZeLMVbXK9e4cA/9Y+pyunzCfxyl/JUhCYKO+dFndrxtAM0YD6IVP93sNM6xqZRUnxPx6HUj9XXQuNVX55PI4og2R6vXS+q5NRocm0X24R51QcIyWengzk8Nox+0ji7RLu3/DTS5TG2qFl87k1zlive9ab3lYibaFm+J+B7Zc7IjLPxieGwtU4W4YkMRMkSTkRT7ln9JsxjSWLlwB6iGCtz6Ck3H/5Pxq45vLPs8wmTgKvZDCXh/tGN3RxFPJcFSbwKjVs/NFtTQOw== 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)(8121501046)(13024025)(13023025)(13015025)(13017025)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB0696; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0696; X-Forefront-PRVS: 0021920B5A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB0696; 23:9ctcF+FvxO6LZ8VHT4VFFlzzghceh4ThdAIMZZY?= =?us-ascii?Q?PCHhl6gGE3ZQy36+RHuVV7r1wRMw74UNsQnPY2SurBxcqnj4rSX9KyUQx294?= =?us-ascii?Q?8RjvVXkBCenc2bEHYewYLFrw8fmJ0KPvsHK8qkKwZvSFuwJaGxZbb5S3nXo0?= =?us-ascii?Q?BAeLBzG0HoBLyE03YaYLAdSD/J+a4YscfIr8feb81Y504edL/Jr9ttWCzipN?= =?us-ascii?Q?JbDvvmoCeSJI47k4KGBr26HJ7BAoIqaVY+FsRDl6dXBomo7aFimTySEKyIXo?= =?us-ascii?Q?ZupyunOJwF7ZhFpUW6DZvuV1gf4rPQ3132zEQ5iHiWwRt6X6xA6gWOOewNHK?= =?us-ascii?Q?CIJK1Elrl2yC1dE5BiI/G6Pyx9UiXPBtcQaurd8qIyW/bvbpbZXH3cGkFSdj?= =?us-ascii?Q?QbHRrXCM3ajeBvm475y5iVURtd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BYTaBCv4ygbzFphqQLPP6hgvxFCI8JMWlrZdLYAV7TJaNwS9NAFP3CtFlFfxJEcfGLJlpXOl6GXb/n4dluz+fnllX8CiCim4uCltnKSfCfAVZ6sZDH6XU5VXbmmvcTzS9vtYvnv9cIsL79MDI=; 5:h0fj7fI1pZDw3is7+2VRRm29qdZX9VjkXJk0G/gFp93svTYxz2TLcycLuRzqCGHfv8PgwccO7Z0KZXFum0i17p/hK9//pjKyYfJbs51/cBb4z84SgTayoUWKwO8SoQ3IhmdxQWFfdJk+eNZkveMhq1oFAK55UXFZO0PVkhtw6nQ=; 24:ipwXDyXuVQzVpepSOK70csVNmGlI/oJpW4otTSLKdn/BfwX9rNSiFJVGbim+q0lbdhUtQD/On5OJM+S1TuRLpWIvayU4NBsRhkp/reLeseM=; 7:aGcxEk/Qx/vTv3ydTPd3mqjbpUshW4AuVuxN2LHO6HeehsMffJXLQa9Vvzke3prtZjiUo2EnngZwY7IKEmAWjTgzTHdnAUPF4QvWPoWec/VN73CwmGgJq23WHAiC2OTGUWjAG2Z2y2x5ruqz3ZGEtaBfvzauWplrB8NvTq6JOa/MiHOCwhzYX2eneLUTLDgFlnH1slvpJmMLO2s5ORrKU2gbKYV4jWUQpmwKLzb7kiUfm55NSLJ+B7Nxm9tAzD3M SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2016 10:45:03.1447 (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: BY2PR0301MB0696 Subject: [dpdk-dev] [PATCH v7 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: Mon, 01 Aug 2016 10:45:05 -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 | 9 +++++++++ lib/librte_eal/common/include/rte_tailq.h | 4 ++-- 4 files changed, 16 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..ffeb94c 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -470,6 +470,15 @@ 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); \ +} + /** * 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