From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0052.outbound.protection.outlook.com [104.47.40.52]) by dpdk.org (Postfix) with ESMTP id 5464158DD for ; Fri, 16 Sep 2016 06:32:26 +0200 (CEST) Received: from BN6PR03CA0054.namprd03.prod.outlook.com (10.173.137.16) by DM5PR03MB2619.namprd03.prod.outlook.com (10.168.196.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.8; Fri, 16 Sep 2016 04:32:24 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::170) by BN6PR03CA0054.outlook.office365.com (2603:10b6:404:4c::16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10 via Frontend Transport; Fri, 16 Sep 2016 04:32:25 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.619.6 via Frontend Transport; Fri, 16 Sep 2016 04:32:24 +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 u8G4Trfn029256; Thu, 15 Sep 2016 21:32:21 -0700 From: Shreyansh Jain To: CC: , David Marchand , , Thomas Monjalon , Shreyansh Jain Date: Fri, 16 Sep 2016 09:59:42 +0530 Message-ID: <1474000200-16705-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474000200-16705-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1474000200-16705-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131184739446430985; (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)(189002)(199003)(48376002)(8936002)(97736004)(50986999)(81166006)(2906002)(4326007)(68736007)(86362001)(575784001)(76176999)(50226002)(626004)(104016004)(7846002)(50466002)(586003)(2950100001)(5660300001)(47776003)(19580405001)(229853001)(92566002)(19580395003)(2351001)(305945005)(77096005)(189998001)(8666005)(81156014)(36756003)(33646002)(105606002)(106466001)(5003940100001)(85426001)(87936001)(110136003)(356003)(8676002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2619; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD033; 1:m0S/dmBueTivtVyJq9hzcA0QZkU91Lga8wCsSuC6rNMwIVq95P0BTstc1UvypfqWB1KseV348fzvTXzRGjJoa5EJGt9Z1xm7jYQW6EVwPaQUm2jFCfPQDmpqCUiYj5cbKODcJ+Yzo+K5dnB04OfnSI/y5gUITUXu+en0c95dvTi2Uz/wQhwNJOupNG62aGIXuWHmYgI/IybT9U+DsLvpGlxAojJYYIQlIR+njw9WwSb4PsRxNuImQtx0sMvfay9BtnkVXcY/mGVW5h2b9Ff+JJU3RrE2yDCIh1sWEIYA7P31hwbHYDifx3HYKd55vhMBnqLpratM5G1JpMS+ASiUW6wBbHPjHz/2fK/e/NZXUTn8OVR8gVp93NAE12IK7ghoBkW/zfXSZcjE9D46gJmpJ49E0tCLoBAyy5UUfIN30/fEAEO8a7cpeBore+2KPxF1hx3jyYS8YXCKG8D0yMEppP0q96yZtIpN8Uz+nemLSAYKtx9FHLpWo0/XaNaruIaOyAWDtoR9Y59xvX90kYMLNvvhF2Zkan5DPZ/j4VvG0pPNQ82RfFwIfxtYFQ3RJ4vwl9bvsOX1p8J47YZcbbUP+KaSCZyrr1j9jojQ8tkRxCIUAk7/lQ+uI6/ve7is8uwe/mTAXu/WYPhZbLLYSgfa07YfQFZHmE2FfUk+Qu/IRL7+t6IRDTF7YdssZvxp6MwNhVU2Bb+Bb4mvW3OfORUKI1T2m7mI4S+mPtOtNUKDC08= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 289ad8f9-fc7c-4205-1201-08d3ddea750c X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2619; 2:TpD3au5AJtvgx275LbcTRnoIKZ3WbG3V7m9WZ/qKesIpu0IVQCBqiwH9i6/N/Lhlyt8rNfKZQj4aFmlLVfoxI1bYWAtAP0METTKFsr3wXUqzWBAY0IDA7tcOa1HjCs6uWxJjdJ5bpFfvegzEdNztpe2V200ywfjt7L+EGwkP8jYrERN122hHxogqcuEXKWz6; 3:1ClW8rKtF3uigVNleYxfwa9ud09z79p2z1Nno4RGagcoCGEKxnFIB1OMH98o63dddI3na8gDgUl30GdKatq9YhjuV4v0woKo97K8WK0CaTfMy4FkkWuFxPJgL4/MliMlcJb/jm6CrsQCNV5H6xrxc/I2CQRCaR2bHu3cKckpDmHfTEIYkCkV+ksTfb/jmc5qBOG0gtezJahNLTjB+mqePQ0KMt/unfS+BNoD7aZp9Lo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2619; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2619; 25:aHOmCgImnNpjzB2bF0QbuWqD2dm8xVvX6kZjmL9tp5DtOBBW+/Ih9l4rgFPFHTQwAtUhByBPH9jP4reH8kBl3lnQykwJZU7hNmkd4mNSrpG0LBiA9rsa20eJWLkoe4hnj4N4JY7xayylCXVDkWpAmW4jmQqBo714f4ouY+bST9qczgyDmteZ+LIqg0yJPvb4OKlVcILSRUXJi5hNUsX2mnrJAy1ukY1B86/3+AGnyP1+JAOcAjuvwzODEBm6BnVpC9gcSZgc2G5P5qsiErhN1laYhjpH+74ND3cpHsgkxaqRMUeKDDWe4vde9X2AaFXBjTIKhlcfjYkR/fNU5nWe40HO36Xb3+sL9EWJFJVljGjKKiKo+DTuFPd0T71TvKiUnJrre/un6qQG2Xcghacrfpo2GtfWM6welJPvT8zgyCi+uE6azlrR8IZ0AoaRn6e0oKoV83FyEhpl4L0IyJe41WNxBhorx7LpJeve4UnGsMHghk7wrmH3iwZi+OsB9w5oZ9gbNAKC1thAHoWnqR2wWwTxM+YVUY+j/EhiWCKqCM4yMR7dGoa4Fi4HlULXKuxQJWKUgWhxGIovp1Ol1+81fSctm6FnuSzN6asf6SRLIWhspcZ3yhAM3j4oxaqyvTh6XSe6todDrBvTPpIcX3fKMpJz7skqA9v4mOIWQZFmlTC8Jlj3wx4g2IhUQloFCWwVNB0GnFnEb/4FvsJNMyR0WQ==; 31:gr+SdRm1pH1byGjxHjWZq0cWjXeFb/eTBvSb564uxNXuts14nqxMKhXrHyzztxkh/03l9yuM38PugTh9W8zD82vwxRqKVvOdf/x+hCQVVwIZcUnYByHAu3LNVH4UNOpR28zdnpcRsMnfaHQESasGO1MVemAF4+pyz+vvohOJvMO1/2HZkySKFU8nM1Xu/5+XuRFDa/fQKH71LO3M6pDjP6iemFg8za82mxYW82l+hUc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13017025)(8121501046)(5005006)(13015025)(13024025)(13023025)(13018025)(3002001)(10201501046)(6055026); SRVR:DM5PR03MB2619; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2619; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2619; 4:br0xuCFLJhcLu8jXZcwy0PMwwPINVBLNNMJA4QNu9JLaVi+lfkcvI2G6lxr7y3c+BqOgB43GI3qjO2l1qV3GV6nkiZMDLBPB+QWVfueP1kKIKFmvLtVgUcfjAn3nsU+h5sB3sFCuCfVOmMz0o0T7NjkN34pnnj8dMpBdM2omd+CjpyeF2C9XvFw0Ni5s9+7FcXGGw/hqCjMqfoqjlcHRMEN3BwrIc3nYRDt4hx1MzmQPATPrj2sTzrqnNXeZnif/iVbaWQSeT1iC9JzGxE7PFmURgNWbI2cn/110ZErPG7zBOIkVIzGxkOxzog+QEePsj6XQN5SuVEpmAGMRIscS0Pz0QAzEU6rG+Y2+PzIRhOmcAF+k4SS8i0vQ1zVs8O97pTuUCDsgmXL8ERO6gBvl23v3K/eO+qRT7yS6mY8wLjwdmpdZsNsIb6Bq4izaT1wo5ijazMztBEH3b6X5C1x6jJApLbUvfPMnh/eGdZFL/Yh67LGRB6Jww4qnpV1RvpBF39+q4p8rMrPadgFUEUw5hVdWsSywG1EzJOYih2/wVh4= X-Forefront-PRVS: 0067A8BA2A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2619; 23:ttW4zd7p4ovCRY971XMCmJ8StSq6qy7J28BJs7wag?= =?us-ascii?Q?/EEnAig/fhG3qmPZM5MURBZijTO8jUKLvd1xKyoo7SvYMe/eINzntbKzIoUN?= =?us-ascii?Q?LVqYhNlnybh3xmojXsaF5CE+we5AYbhe8J7a+JpuWhvudWRP+g4sbgSqF5OS?= =?us-ascii?Q?C//fc3MSy4Pkd2yBxeFyReEEhRTaBUGUxfmNC8giShDugBBMno1g8yYFXGOm?= =?us-ascii?Q?PKEsjXnUaL6q1mwQV8U3/ZmYcDUZm9xtey+003CrrkEnzHYew8LTTfKOl72z?= =?us-ascii?Q?nWf/mALCb00++Q8x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-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2619; 6:LulIv1SRVq+rdpmLH5r+AJoYuAK0wKq2XWotulC6ze+m5ldsjOfOWClWFF1T6Wpf+myDk7wpb6kA+wCNRF8GZZBMCvjGhhPuf06mKvdiZt6Uso2dA9IBE/rKQDzAqfU0Yk6wIiaw7UtMglZ4RYAU5D3Or3Jc/Ur2erf+W3ygxi0UT8JiAdgIM/TgPsF4S8bo9LLCRAbCbbvmZSKjQS+CAUnRHK4pyq2UMNJNBXSbTkruUoA9UBFQlo+mLfvY2/Gow+ANkTyi9zyb5kmWHT7SNNolxNnjNmdmPaK25+9FgI4=; 5:j7do23x2IZoTOLyDl5fpC4gE9lztxFr035yiwuaBsWZPyQuJL3WxwakpW68DOsH1HWVHKlDd03K7Rs+fiKAy2RN6/W1WPo3XhSlHIAHmQNInqEcoNa4HBhsoZYSGB+SoSoAcOgGdJstJwRRzmPH/FkbcRJXeVwv/YCnKT9YdAsQ=; 24:hPXqse+PJcZbBdJ5U9FSVE0OiKSYeT1ttr9frsgYeOfXXEckBrJ7GNo4CzjZJgHxf15hpqYTomuFHNv3i+zw0UaGDoo1uVKRypV/QILY/xw=; 7:o6b/n54cCnyoDCppL8u+Zz726aHrGqq5CD85jLEhzVEIeAJ2UohgDp0o0qzr503m+eTr1dDhbtDfXlmVbjOUYQIOr19gxST3Vqs+Vk6rMT+JwZw0Rx1p2jdBzv+ksBcQDJv7nBJelOqVLWGiPQqmGy73f+J1By36+oxd6heFO9m6xFgDc+15iyGooirXuHRnJ9nQL7mJR7QxElMGD2iVj59QEEOxEdzcP0alIoC/TuF04enaxikDBfsCmmLRL2WC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2016 04:32:24.3466 (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: DM5PR03MB2619 Subject: [dpdk-dev] [PATCH v10 07/25] eal: introduce PCI device 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, 16 Sep 2016 04:32:27 -0000 From: David Marchand 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 [Shreyansh: Update PCI Registration macro name] 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 8233a2a..94ae14e 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 probefn_ ##drv(void);\ -void __attribute__((constructor, used)) probefn_ ##drv(void)\ +RTE_INIT(probefn_ ##drv);\ +static void probefn_ ##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 98d20db..d150b9d 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -253,6 +253,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 803c78a..cf81898 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 registration 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