From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0072.outbound.protection.outlook.com [104.47.33.72]) by dpdk.org (Postfix) with ESMTP id 4464E7F3C for ; Tue, 20 Sep 2016 14:42:25 +0200 (CEST) Received: from DM5PR03CA0020.namprd03.prod.outlook.com (10.175.104.30) by MWHPR03MB2447.namprd03.prod.outlook.com (10.169.200.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Tue, 20 Sep 2016 12:42:23 +0000 Received: from BY2FFO11FD022.protection.gbl (2a01:111:f400:7c0c::140) by DM5PR03CA0020.outlook.office365.com (2603:10b6:3:118::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8 via Frontend Transport; Tue, 20 Sep 2016 12:42:23 +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 BY2FFO11FD022.mail.protection.outlook.com (10.1.15.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.629.5 via Frontend Transport; Tue, 20 Sep 2016 12:42:23 +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 u8KCexsY006559; Tue, 20 Sep 2016 05:42:20 -0700 From: Shreyansh Jain To: CC: , David Marchand , , Thomas Monjalon , Shreyansh Jain Date: Tue, 20 Sep 2016 18:11:18 +0530 Message-ID: <1474375296-26078-7-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474375296-26078-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1474375296-26078-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131188489434268903; (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)(50226002)(19580405001)(68736007)(36756003)(105606002)(2906002)(92566002)(19580395003)(586003)(4326007)(106466001)(104016004)(85426001)(229853001)(87936001)(33646002)(2950100001)(2351001)(11100500001)(77096005)(8936002)(189998001)(97736004)(5660300001)(76176999)(356003)(575784001)(110136003)(305945005)(86362001)(5003940100001)(50466002)(50986999)(81166006)(8676002)(626004)(81156014)(8666005)(7846002)(47776003)(48376002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2447; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD022; 1:r2bORI7SeT1dp5aO2dyIqow7qT4Pd/+pkCVjJwCX0VT8/Y1Zi8shsRCAx2b3S2BCaf4ZDsDKwBSGTsTsryEQ7QTktLaqmCZHak9jFn/NbtHIC3n9gUmh3Vnbq64SN0KgW7qwEa14lxotlppckEONvswdOXiC5IYhQ7DPCqbz8Cf/NFr1Nh3pzgkEGRI/3kSZA3ODqikxHBFio21WngbYn0EyNYhWSrg/T3+fau4c5f7bfiS6Q8HVOTPpuINnDfi0BC6YS8ENAEpEBB5SvKLonmy7KMzdxLM6JmkoqbkAGoq7/HUFyDe+av5NICVrsIq2o0wRHv9C4QphdWon+ofjOIUSd7ePkcUMm9ibMXqz7x4ck7vSkcl7PiE9shLyLBBqg04jalnIEugHxKSxtv1f+voxyO4cH97DhTJeMdE5VlIa4s/K63ae9K2Urm/X6fXxy1Oa6IFKHwKepvtW8WrZuGE9tx+qe6yuYUIpxV0j5KjY2M8aILdNPB7xXW/48PbxoOHELAIFMAVS9ocjjCEioF7Gs/5M/l1dv2exT4VQduLyReKOdtfqC1RHy3XCO8SfkydJ3p8QRQbGdomwmmXBrbpK7TwhdJmxGfevOJ+wQ/aNTGSvG8AlBTAZsPkUe9RnbWGTzxeifLl+Z5c72Qk0bs20dtl+VHz+52PHQakVM4uqCYcjp0bm97Q4Z7NSu9HBPEPthdLaZRlBG9CPVXheyW77/DP747siGcpiv68/boM= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 83e88d42-0770-4c0a-2386-08d3e15391ce X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2447; 2:7e2H4ftj1Lsknk2u6elrtodigQbpI1jtjEL1ERrpniracI+aTCnEXi89p6LMzLz+Sn8HYgX6C1fATIMkPOTtIKY4gewntsaSgKfrMnLEjhS8s8nOZgdUy6qHXbYB3JrFBfL68kJuBxSdcng4yc0rrH0s+u1W0Z2D/voD/qnx0kdPlt4U4CFzCxKkGvSyjWkr; 3:8MXUVYt4CICpVIazeKjCnKQp//asVIS9ew78sOSIpfQtIiq4f1FkH0la5MVoVyYG2a6SOXUousu6mnQikpwkZFbNwPyhRXQ4Nrsuld9YBxxhhgJOz3KvM61nAJ0ws5SL6QlWZVquOpt2z0xvUd8qJtVdEZvKgMweEEbCr/rZijIVLCMeD1QlrAUnT0ISi3AUM/eNpVZ7C/SA/Q2uYoDay4vgyP4yKi3GsO8WNjs5fOY= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2447; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2447; 25:Odt9uA85W65wSO/aKdT2gp6i/gJqdQBFEVGGj1yeHjA56gA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4Jjs22laaTzHC1u/5jD5ZhMej1y/FYg8zzBtxpPmNXgpXf/kuDMoPJilxUyNEPWxyeWdgQjLJDEL5XB+mNcbLUihY/KofvjmfRyTSud/CTKwIeyLNZDeEYsoq2nxo+LtQLw6rS2jvixVnJBIsdlQCUP+0vQ+fGAr4eoLHo7Ln3IqZjP0hfVzRmyYW55L5fOMpV8/6ao/bZhlOO8z9jLjGh228lzITI16wGCnHR87P/mLujhxpNc5sm/5inK6wuWs+QO4zaQkkr2UKjaQ6uzv3PK1CXsws2pnuBmIz2V/FdeGPzsv46T0LXxDEoTpIVD3p0zmfMW5KzPMkN6yf3pQGXymT/RFPDZuE61PZ8pCQscG7ZJ4Oa02bVAAucnS5RQBDQ6qo5vMkPOdVtD6Bq2HKF983TtmnLUuV5cveLHgAb1u50yIatPG55YE9k5OFmXfXk/UgKMyuq/MfUCiysE= 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)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:MWHPR03MB2447; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2447; X-Forefront-PRVS: 0071BFA85B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2447; 23:EteuczEUSR0e2lJgAC0ojcS6XcFMbS8tAp544Ey6X?= =?us-ascii?Q?fBb0TurT8wi03WQIFeAlXK6WE/JkA6UwGb4qHgxxknt8bmb4PLAHWdJgfxyN?= =?us-ascii?Q?U6SuhTIKTNsM7oIagLLPI+flX1osFFsYfgIgJ2pgOkVv8bMeCDxm5u8Nc7yi?= =?us-ascii?Q?Z+EtRRf3egLsp5kvGeJ99EKJKketZoBcblqoagbBxvPh4Gw40bnkg2//2+L3?= =?us-ascii?Q?MLeYHgnyIQ3L7mo70sSEQulaZnAzC4J4F68e3elW/EGO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adata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2016 12:42:23.2240 (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: MWHPR03MB2447 Subject: [dpdk-dev] [PATCH v11 06/24] 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: Tue, 20 Sep 2016 12:42:25 -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