From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0084.outbound.protection.outlook.com [65.55.169.84]) by dpdk.org (Postfix) with ESMTP id A15C6C784 for ; Thu, 16 Jun 2016 16:06:57 +0200 (CEST) Received: from CH1PR03CA009.namprd03.prod.outlook.com (10.255.156.154) by SN1PR0301MB1630.namprd03.prod.outlook.com (10.162.130.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Thu, 16 Jun 2016 14:06:55 +0000 Received: from BL2FFO11FD016.protection.gbl (10.255.156.132) by CH1PR03CA009.outlook.office365.com (10.255.156.154) with Microsoft SMTP Server (TLS) id 15.1.501.7 via Frontend Transport; Thu, 16 Jun 2016 14:06:55 +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 BL2FFO11FD016.mail.protection.outlook.com (10.173.160.224) with Microsoft SMTP Server (TLS) id 15.1.511.7 via Frontend Transport; Thu, 16 Jun 2016 14:06:55 +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 u5GE6Xo9026530; Thu, 16 Jun 2016 07:06:52 -0700 From: Shreyansh Jain To: CC: , , David Marchand Date: Thu, 16 Jun 2016 19:36:42 +0530 Message-ID: <1466086011-11920-9-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466086011-11920-1-git-send-email-shreyansh.jain@nxp.com> References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1466086011-11920-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131105596152558780; (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)(189002)(199003)(189998001)(50986999)(76176999)(85426001)(19580395003)(19580405001)(69596002)(36756003)(8676002)(48376002)(50466002)(106466001)(105606002)(81166006)(5008740100001)(104016004)(2906002)(4326007)(2950100001)(81156014)(33646002)(5003940100001)(229853001)(2351001)(77096005)(586003)(356003)(47776003)(97736004)(110136002)(92566002)(6806005)(11100500001)(87936001)(50226002)(68736007)(86362001)(8936002)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1630; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; CAT:NONE; LANG:en; CAT:NONE; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD016; 1:YG5T5HRcVZx+t/MC+bUNhk846v17gs+1HT5p2Rmbg9mjlNUG0TJq3psKudJ9YBQP4WK4Mt+POW+tNqPEWjh5MYHoAf5Mlvhv4tD+nXi/x3KY/2gK9YdsG2mhRb7bQnTCnj74kD1affTW73/O1sBkhpNwiVXbeGtXZDnV9p2HaJCIUigZMrnG7W+Ppm8C0/RC51s15FkFsS85Y+TdQHXe+Nk1fFiiFBLrsDJVbvxL3tO5kJouZpq0NqnXmbz+GxNsoDNULrW1PHxcw/tPMRDV0uEb28s2U3amTzPky7I29ynE7ptbTFNzbMojODcmune/lCTuyFhZ61B2yPUNK2dLf+8GrjXPyHbInrFMVJTO1H/i3INI71U26AxZVWew2m8LSC0AeLdKPJYntn5bl+YcYsfZNAVoVqpikLXfjP2/+zVHM3p7m1d+wLhISGvox3vy03659aq8x6iEANqlw4MrKOfj2wmMGXZ7bhI35m87sz6P502SxUV8MXx0R5g5ZamsKdWN/7XGkPrrYiUkAth4vXqJjdwNi7D738O8KCmG5ca2i2F6f0WKQLR1AooMrf13+WPOWeFjPLkuAKUniwYmKQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e95eed40-9df8-46e3-d35b-08d395ef7931 X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1630; 2:5x777jo+sLUyXqVbZp7amnK/RP/Z4yc9icAM9hX39c4u0ffqPFIEaXi+xY4nh1QWVGudXIOUcRufyitsrgw7AJ3zqBL8P1J39PeNALx2Ea/komAdy0g1vcAdJiCGJbwhnDqjR3VbESE+4pzG1PtD6fLUWbL86ja2ZBsPw5gpNsrjjb5ZGLiklR84hh1vh5R7; 3:TQsbdTNxjiRf/V+KhM7rxfURi444tZ4bjL0rn7tDeleVkhTcdmYB7bWZB0DrZIGrl1vWsCy/xEwsP/7ZBsCMZrrBb7AGQrFG/F1ZRbpDzb+fltUUhn+99phaxnWaCkBGIw5/wfSXh69n6d4nZmrmtIwSQLjH+Zhtm7p4L5G2D7BkOljGqEeeZn8fbwdRVqGyh13lrT5bmXBp7mr3kVbjhFSux9veIi1cS/Y9U8uT9y8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1630; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1630; 25:/jUs8JjaueGKEXz5CHeZ/UkbJpcocvB7MJaSVCSvVJzOmx2Ts3C4CtmEBCg0tqW+q1mqHNrg0jyMVkZjfbmTQFJV8OtTOcLVokbXm8YwZgd3uEc/FlrsuKNnP7Tq/Ackyyxxa+Mr3l3EXMqA6DPB+wuq/lDx4b0iI50tL9u3mf+kt7+7L0WMmk9/eTaVotA8YT9GLUckUWkm4+aO/V9LdKs+vEbg7U83f1I9MmarB7erDOUpHnI/fGtB2Q6y5A/pS4cUy7SQeXUx+j2a2fP0YILCLntW3IY5C8CH3l0nP0KYDUFoLwBwliJxbDko74x/l/NGmwpDcAZU6bn6MXzxRTR8bB4rnW4jGS61Pm3v0wJGZ4Xg6eDh9cPICXjI71pCMU+aHSS+446qa5eOS4qkbV616Ya59YSmrPWFwI/Z1vYHKovHuWlHr2XPx/2dteRqnvn2Q/Lq+FXN78EE+qgtiJrAUK6TdEQQGrHx6gYwLmd9oPSzGCXO0pSyvN25Gnm7GhmfiHgj1nMW+hcywH4X/WP2SN34lCuBbm5jyleXaHaxhtjUdqa5ndvfPbuqsOEgptfh6yRwfrOnzGBf4jOja3A/FMm5xUZvRWZKhColzjHn5eI3RSSu0zp+fWhOATCcVp53mapS1GYtkAjyKxd9IcEdDm/ndl65KY6Jciv05JyoQhIAMwy2fiioAxVSSDZZ1himREQrW7Kl6W5bjDL/DJ5y2oiPxMhshK+g6uPB0FCQ0X+m6dDqUKeqWusHZBTG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13018025)(13017025)(13024025)(13015025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:SN1PR0301MB1630; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB1630; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1630; 4:0hB34f0oA9sCG6auHZm7KSPDC8eOGGR8l59lHw4RxfVv2X3jGO9tQ9TBxCy1dXyt9dEGy6200mJWa4FbYNLuTRRsO/9KIZjRBA/wkbcYHcGOzw7Kf1V9foDStIlcYg2YIasfPfY5vCPm2vB/hH6gLIoQwoq7LW51fmDe8x0Pg4Je644/mX0Q1bdJPgpD13iVmEr5W2ttWqFWvAvaIrrz6obQuM2+PQ9kJVkk6WxSUqji6Fk36CiQU8pRAadzigYu/WCg4VA9i8tiNQPh2Ast0KpoKnH0+RO1T63sC1arjYLpjrCXGJEeOwQw0AEvowskKq7UDGBHo97rzTL6NrnV+IgrrTcSMnoXRc4LGuJngOxLvpyqvc0a1ee6eB4w5B43VR4gy/KebXURtw0XBBTLlZHrl2joWUqJi+VwiOAq0swxhS2O3pliW0Ra2c5bqO+g1KH+FMkLer8u1vkAfyDn7Q05hCQFKcf6j3vxLr6lL9A= X-Forefront-PRVS: 09752BC779 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1630; 23:99FjHXYiPHkiMKRla+IH1dsNIqxBoQoR9XFdxbe?= =?us-ascii?Q?MQwQHeujil5fIbGcXiSy7R68buKeM7/qU5cSzw3WWzOTWH0OK4rJU0k0dthf?= =?us-ascii?Q?DsQ6lGriWUk/nGHyOFQ9oklMjr+ioRrFeTu//q6hKmEDaq+jBtGdPgjZtL6a?= =?us-ascii?Q?Jv/itja/wgzviqUqzjdM/jeiee+qUhOjx4q7MNqKLAxp6UI9uBd9riuJZyGK?= =?us-ascii?Q?7r2H/xAD1c0qYvg29FmspNz2ZWR5QDCAG7k+mySFIoQgMwfSqttRpGV9dFJo?= =?us-ascii?Q?ZiGGUuYI+DXQb+8ZtGP7w2W+9ZIbUJYbNZ65BprOdcJokLnA/+MUJVbPDZVe?= =?us-ascii?Q?Vg1HeKipltcv3S0ssHdZgvAYo4z4dhoToa+gJB0nfLOOwcRN+TxuxQ26rqoX?= =?us-ascii?Q?9thJZ4fmmspvUnL1Cvqnk3X1nZ4yhhri3/LNMq0jJD8BQvF5U0yR/UmYIBDV?= =?us-ascii?Q?pDyde9GeAMyEXSI3mbRSIYvFx37ILT26YWiqliYkKV0B5YXXxyV4mTIvaVJG?= =?us-ascii?Q?GId2yNKXF82ag2JIUUMBhQyZHFxQn97lRTQHYnwxVn5/RNjr0M/po+VGFM9u?= =?us-ascii?Q?3jiwnlILEoGKeg2rHnTKz7sEdKW80TVB0EjANs/+dt/BLKWX0RAc13Ina4HN?= =?us-ascii?Q?KnqU1+Crw3ybarKfIgATIDwFoODJ4Zr7SasZ5aWqCrPqhPtIVAuH/+TOLFdY?= =?us-ascii?Q?t+r0BOmcNaXA9k9idTvaGY3v7TzDidVrWe1T/toiytxFL+T2yxItBVeiUbN9?= =?us-ascii?Q?H7mOzYaFcXTtBQZZxLHUftRIsIJ4CSCnwp4jpPsqwPYlqyX2QBdWQ6rNtvcc?= =?us-ascii?Q?pR4l/KigyvUZZP/sk803Rv4F2AuRGJ2rPNXEVKBqPCAIDEtQ7eT35+pf6oH2?= =?us-ascii?Q?xWBp88zwAbZ3Vbm1C1L33KvPoLV44zkDy3BcXsOhOt/34ECbcGDnK5yNaWer?= =?us-ascii?Q?mdynwp+SPUlesY/T1CFeAlCDuY81DHsWWgnXE21C36GXu8ofQyFy7bHBZvzf?= =?us-ascii?Q?j/k0YdA7KkrJrsdxaGN1uDqq1u8Cb+pN5c6WJaoPPoiXw97eqUsPKYY4y8Zy?= =?us-ascii?Q?qfAHSnu4VzsKr7R3MhZnQPQpNMWVZOHjGmJEOIYomp5ZZyqHiGz9isovHW9m?= =?us-ascii?Q?jI9C/OpW131Sgv+LSDJ54eOs1Z/pFdKrN9v+38Qj5xfGFGIfiMPaMLqhMCzj?= =?us-ascii?Q?nA6eqgnRqC16G2Cg=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1630; 6:7gD3Gd5wGygJjPmLTJjvad3KuqKXd/g9tnCCqTe+yzwlropw1NLTJeC9LNfEr8jlVAuZTbaxCrt2B5S48MPq2wsiy5QMLoDwCHu5Ra944mq1V0Q0IfKmAkcvDXH6rMDxYMBgFK3eQItPWFV76ulVoWMcE+j7c9Bhse5BnVKDkaIv1wXxU+kDFbIBCA38Xa6yGEwaongSz2XyEgYABfIM4y6Y0jEUTFnx8NyibXSQm/HoyncdjdVlFuE2GkQ/MPY9Fu4tznYGZ4NES6DNI/JDw2Fbl5nePO/TkrMvbWt6dgY=; 5:q5bCaSuBzeVP0xL+hXbhhKh2xuwpJekRsXInCjaNDosiC+Fs8mxphhrlELKB1nlWhVG7XstoZQdQ0wtehh6JqowgARl6trpNUc4feahzBFty8TQ+mAbZePECUFlv1ciivVELAnP34K4b9zcUGILYgds9IX2gjbrhC7kiVu6TRVw=; 24:knMY6811qKTKVVnRghZ+llz4yXuSCqef4vmfALYFb3jIkFuq5pLzWAZdrX2KuHj43gS1TJuL2tjJwsyrAtAHwtB+Njd6ymqk0jE+y4A+WMI=; 7:V0vnHvXYm+PqDFnmYl2EvGeyAZyyA9qe7zlZaNEkEoi12iD2F6aByan8V4Xu/XnvlHkte2A6yPyNT/GSYWCYIrgWdIaXK1Iz0R4gSoDKY08TpvucFjX+XqS3xfJK7rJZlaHfvm2/hs9tCTHw9f90WlxNfPkPwLJ2RGIF3px0dipfWNp9kli5uQULjxXbFFCwZlirgPP0MMEp66RU4ZvNNg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2016 14:06:55.0218 (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: SN1PR0301MB1630 Subject: [dpdk-dev] [PATCH v3 08/17] drivers: convert all pdev drivers as pci drivers 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: Thu, 16 Jun 2016 14:06:58 -0000 From: David Marchand Simplify crypto and ethdev pci drivers init by using newly introduced init macros and helpers. Those drivers then don't need to register as "rte_driver"s anymore. virtio and mlx* drivers use the general purpose RTE_INIT macro, as they both need some special stuff to be done before registering a pci driver. Signed-off-by: David Marchand --- drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++-------- drivers/net/bnx2x/bnx2x_ethdev.c | 35 +++++------------------- drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++-------------- drivers/net/e1000/em_ethdev.c | 16 +++-------- drivers/net/e1000/igb_ethdev.c | 40 +++++----------------------- drivers/net/ena/ena_ethdev.c | 18 +++---------- drivers/net/enic/enic_ethdev.c | 23 +++------------- drivers/net/fm10k/fm10k_ethdev.c | 23 +++------------- drivers/net/i40e/i40e_ethdev.c | 26 +++--------------- drivers/net/i40e/i40e_ethdev_vf.c | 25 +++--------------- drivers/net/ixgbe/ixgbe_ethdev.c | 47 +++++---------------------------- drivers/net/mlx4/mlx4.c | 20 +++----------- drivers/net/mlx5/mlx5.c | 19 +++---------- drivers/net/nfp/nfp_net.c | 21 +++------------ drivers/net/szedata2/rte_eth_szedata2.c | 25 +++--------------- drivers/net/virtio/virtio_ethdev.c | 26 +++++------------- drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++------------- 17 files changed, 68 insertions(+), 359 deletions(-) diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c index 08496ab..54f0c95 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -120,21 +120,11 @@ static struct rte_cryptodev_driver rte_qat_pmd = { .name = "rte_qat_pmd", .id_table = pci_id_qat_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .devinit = rte_cryptodev_pci_probe, + .devuninit = rte_cryptodev_pci_remove, }, .cryptodev_init = crypto_qat_dev_init, .dev_private_size = sizeof(struct qat_pmd_private), }; -static int -rte_qat_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - return rte_cryptodev_pmd_driver_register(&rte_qat_pmd, PMD_PDEV); -} - -static struct rte_driver pmd_qat_drv = { - .type = PMD_PDEV, - .init = rte_qat_pmd_init, -}; - -PMD_REGISTER_DRIVER(pmd_qat_drv); +RTE_EAL_PCI_REGISTER(qat, rte_qat_pmd.pci_drv); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 071b44f..ba194b5 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -506,11 +506,15 @@ static struct eth_driver rte_bnx2x_pmd = { .name = "rte_bnx2x_pmd", .id_table = pci_id_bnx2x_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_bnx2x_dev_init, .dev_private_size = sizeof(struct bnx2x_softc), }; +RTE_EAL_PCI_REGISTER(bnx2x, rte_bnx2x_pmd.pci_drv); + /* * virtual function driver struct */ @@ -519,36 +523,11 @@ static struct eth_driver rte_bnx2xvf_pmd = { .name = "rte_bnx2xvf_pmd", .id_table = pci_id_bnx2xvf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_bnx2xvf_dev_init, .dev_private_size = sizeof(struct bnx2x_softc), }; -static int rte_bnx2x_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - rte_eth_driver_register(&rte_bnx2x_pmd); - - return 0; -} - -static int rte_bnx2xvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - rte_eth_driver_register(&rte_bnx2xvf_pmd); - - return 0; -} - -static struct rte_driver rte_bnx2x_driver = { - .type = PMD_PDEV, - .init = rte_bnx2x_pmd_init, -}; - -static struct rte_driver rte_bnx2xvf_driver = { - .type = PMD_PDEV, - .init = rte_bnx2xvf_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_bnx2x_driver); -PMD_REGISTER_DRIVER(rte_bnx2xvf_driver); +RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 04eddaf..358c240 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -869,29 +869,11 @@ static struct eth_driver rte_cxgbe_pmd = { .name = "rte_cxgbe_pmd", .id_table = cxgb4_pci_tbl, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_cxgbe_dev_init, .dev_private_size = sizeof(struct port_info), }; -/* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of PCI CXGBE devices. - */ -static int rte_cxgbe_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - CXGBE_FUNC_TRACE(); - - rte_eth_driver_register(&rte_cxgbe_pmd); - return 0; -} - -static struct rte_driver rte_cxgbe_driver = { - .name = "cxgbe_driver", - .type = PMD_PDEV, - .init = rte_cxgbe_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_cxgbe_driver); +RTE_EAL_PCI_REGISTER(cxgbe, rte_cxgbe_pmd.pci_drv); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 653be09..1f80c05 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -368,18 +368,15 @@ static struct eth_driver rte_em_pmd = { .id_table = pci_id_em_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_em_dev_init, .eth_dev_uninit = eth_em_dev_uninit, .dev_private_size = sizeof(struct e1000_adapter), }; -static int -rte_em_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - rte_eth_driver_register(&rte_em_pmd); - return 0; -} +RTE_EAL_PCI_REGISTER(em, rte_em_pmd.pci_drv); static int em_hw_init(struct e1000_hw *hw) @@ -1771,10 +1768,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, e1000_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr); return 0; } - -struct rte_driver em_pmd_drv = { - .type = PMD_PDEV, - .init = rte_em_pmd_init, -}; - -PMD_REGISTER_DRIVER(em_pmd_drv); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index f0921ee..1fc6e83 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -975,12 +975,16 @@ static struct eth_driver rte_igb_pmd = { .id_table = pci_id_igb_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_igb_dev_init, .eth_dev_uninit = eth_igb_dev_uninit, .dev_private_size = sizeof(struct e1000_adapter), }; +RTE_EAL_PCI_REGISTER(igb, rte_igb_pmd.pci_drv); + /* * virtual function driver struct */ @@ -989,18 +993,15 @@ static struct eth_driver rte_igbvf_pmd = { .name = "rte_igbvf_pmd", .id_table = pci_id_igbvf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_igbvf_dev_init, .eth_dev_uninit = eth_igbvf_dev_uninit, .dev_private_size = sizeof(struct e1000_adapter), }; -static int -rte_igb_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - rte_eth_driver_register(&rte_igb_pmd); - return 0; -} +RTE_EAL_PCI_REGISTER(igbvf, rte_igbvf_pmd.pci_drv); static void igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) @@ -1013,20 +1014,6 @@ igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) E1000_WRITE_REG(hw, E1000_RCTL, rctl); } -/* - * VF Driver initialization routine. - * Invoked one at EAL init time. - * Register itself as the [Virtual Poll Mode] Driver of PCI IGB devices. - */ -static int -rte_igbvf_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - - rte_eth_driver_register(&rte_igbvf_pmd); - return 0; -} - static int igb_check_mq_mode(struct rte_eth_dev *dev) { @@ -4802,16 +4789,6 @@ eth_igb_set_eeprom(struct rte_eth_dev *dev, return nvm->ops.write(hw, first, length, data); } -static struct rte_driver pmd_igb_drv = { - .type = PMD_PDEV, - .init = rte_igb_pmd_init, -}; - -static struct rte_driver pmd_igbvf_drv = { - .type = PMD_PDEV, - .init = rte_igbvf_pmd_init, -}; - static int eth_igb_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { @@ -4972,6 +4949,3 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev) E1000_WRITE_FLUSH(hw); } - -PMD_REGISTER_DRIVER(pmd_igb_drv); -PMD_REGISTER_DRIVER(pmd_igbvf_drv); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 8d01e9a..ba6f771 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1431,23 +1431,11 @@ static struct eth_driver rte_ena_pmd = { .name = "rte_ena_pmd", .id_table = pci_id_ena_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_ena_dev_init, .dev_private_size = sizeof(struct ena_adapter), }; -static int -rte_ena_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - rte_eth_driver_register(&rte_ena_pmd); - return 0; -}; - -struct rte_driver ena_pmd_drv = { - .name = "ena_driver", - .type = PMD_PDEV, - .init = rte_ena_pmd_init, -}; - -PMD_REGISTER_DRIVER(ena_pmd_drv); +RTE_EAL_PCI_REGISTER(ena, rte_ena_pmd.pci_drv); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 6bea940..7539811 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -660,28 +660,11 @@ static struct eth_driver rte_enic_pmd = { .name = "rte_enic_pmd", .id_table = pci_id_enic_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_enicpmd_dev_init, .dev_private_size = sizeof(struct enic), }; -/* Driver initialization routine. - * Invoked once at EAL init time. - * Register as the [Poll Mode] Driver of Cisco ENIC device. - */ -static int -rte_enic_pmd_init(__rte_unused const char *name, - __rte_unused const char *params) -{ - ENICPMD_FUNC_TRACE(); - - rte_eth_driver_register(&rte_enic_pmd); - return 0; -} - -static struct rte_driver rte_enic_driver = { - .type = PMD_PDEV, - .init = rte_enic_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_enic_driver); +RTE_EAL_PCI_REGISTER(enic, rte_enic_pmd.pci_drv); diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index c2d377f..146bc2a 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3030,29 +3030,12 @@ static struct eth_driver rte_pmd_fm10k = { .id_table = pci_id_fm10k_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_fm10k_dev_init, .eth_dev_uninit = eth_fm10k_dev_uninit, .dev_private_size = sizeof(struct fm10k_adapter), }; -/* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of PCI FM10K devices. - */ -static int -rte_pmd_fm10k_init(__rte_unused const char *name, - __rte_unused const char *params) -{ - PMD_INIT_FUNC_TRACE(); - rte_eth_driver_register(&rte_pmd_fm10k); - return 0; -} - -static struct rte_driver rte_fm10k_driver = { - .type = PMD_PDEV, - .init = rte_pmd_fm10k_init, -}; - -PMD_REGISTER_DRIVER(rte_fm10k_driver); +RTE_EAL_PCI_REGISTER(fm10k, rte_pmd_fm10k.pci_drv); diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 24777d5..07c36d7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -641,12 +641,16 @@ static struct eth_driver rte_i40e_pmd = { .id_table = pci_id_i40e_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_i40e_dev_init, .eth_dev_uninit = eth_i40e_dev_uninit, .dev_private_size = sizeof(struct i40e_adapter), }; +RTE_EAL_PCI_REGISTER(i40e, rte_i40e_pmd.pci_drv); + static inline int rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev, struct rte_eth_link *link) @@ -676,28 +680,6 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev, } /* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of PCI IXGBE devices. - */ -static int -rte_i40e_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - rte_eth_driver_register(&rte_i40e_pmd); - - return 0; -} - -static struct rte_driver rte_i40e_driver = { - .type = PMD_PDEV, - .init = rte_i40e_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_i40e_driver); - -/* * Initialize registers for flexible payload, which should be set by NVM. * This should be removed from code once it is fixed in NVM. */ diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 90682ac..4782ac0 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1536,34 +1536,15 @@ static struct eth_driver rte_i40evf_pmd = { .name = "rte_i40evf_pmd", .id_table = pci_id_i40evf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = i40evf_dev_init, .eth_dev_uninit = i40evf_dev_uninit, .dev_private_size = sizeof(struct i40e_adapter), }; -/* - * VF Driver initialization routine. - * Invoked one at EAL init time. - * Register itself as the [Virtual Poll Mode] Driver of PCI Fortville devices. - */ -static int -rte_i40evf_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - - rte_eth_driver_register(&rte_i40evf_pmd); - - return 0; -} - -static struct rte_driver rte_i40evf_driver = { - .type = PMD_PDEV, - .init = rte_i40evf_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_i40evf_driver); +RTE_EAL_PCI_REGISTER(i40evf, rte_i40evf_pmd.pci_drv); static int i40evf_dev_configure(struct rte_eth_dev *dev) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 5f3e047..97ae370 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1485,12 +1485,16 @@ static struct eth_driver rte_ixgbe_pmd = { .id_table = pci_id_ixgbe_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_ixgbe_dev_init, .eth_dev_uninit = eth_ixgbe_dev_uninit, .dev_private_size = sizeof(struct ixgbe_adapter), }; +RTE_EAL_PCI_REGISTER(ixgbe, rte_ixgbe_pmd.pci_drv); + /* * virtual function driver struct */ @@ -1499,39 +1503,15 @@ static struct eth_driver rte_ixgbevf_pmd = { .name = "rte_ixgbevf_pmd", .id_table = pci_id_ixgbevf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_ixgbevf_dev_init, .eth_dev_uninit = eth_ixgbevf_dev_uninit, .dev_private_size = sizeof(struct ixgbe_adapter), }; -/* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of PCI IXGBE devices. - */ -static int -rte_ixgbe_pmd_init(const char *name __rte_unused, const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - - rte_eth_driver_register(&rte_ixgbe_pmd); - return 0; -} - -/* - * VF Driver initialization routine. - * Invoked one at EAL init time. - * Register itself as the [Virtual Poll Mode] Driver of PCI niantic devices. - */ -static int -rte_ixgbevf_pmd_init(const char *name __rte_unused, const char *param __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - - rte_eth_driver_register(&rte_ixgbevf_pmd); - return 0; -} +RTE_EAL_PCI_REGISTER(ixgbevf, rte_ixgbevf_pmd.pci_drv); static int ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) @@ -7164,16 +7144,3 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev) ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE); } - -static struct rte_driver rte_ixgbe_driver = { - .type = PMD_PDEV, - .init = rte_ixgbe_pmd_init, -}; - -static struct rte_driver rte_ixgbevf_driver = { - .type = PMD_PDEV, - .init = rte_ixgbevf_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_ixgbe_driver); -PMD_REGISTER_DRIVER(rte_ixgbevf_driver); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 9ed1491..b594433 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5837,15 +5837,10 @@ static struct eth_driver mlx4_driver = { .dev_private_size = sizeof(struct priv) }; -/** - * Driver initialization routine. - */ -static int -rte_mlx4_pmd_init(const char *name, const char *args) +RTE_INIT(rte_mlx4_pmd_init); +static void +rte_mlx4_pmd_init(void) { - (void)name; - (void)args; - RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t)); /* * RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use @@ -5856,13 +5851,4 @@ rte_mlx4_pmd_init(const char *name, const char *args) setenv("RDMAV_HUGEPAGES_SAFE", "1", 1); ibv_fork_init(); rte_eal_pci_register(&mlx4_driver.pci_drv); - return 0; } - -static struct rte_driver rte_mlx4_driver = { - .type = PMD_PDEV, - .name = MLX4_DRIVER_NAME, - .init = rte_mlx4_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_mlx4_driver) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 041cfc3..1989a37 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -646,14 +646,10 @@ static struct eth_driver mlx5_driver = { .dev_private_size = sizeof(struct priv) }; -/** - * Driver initialization routine. - */ -static int -rte_mlx5_pmd_init(const char *name, const char *args) +RTE_INIT(rte_mlx5_pmd_init); +static void +rte_mlx5_pmd_init(void) { - (void)name; - (void)args; /* * RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use * huge pages. Calling ibv_fork_init() during init allows @@ -663,13 +659,4 @@ rte_mlx5_pmd_init(const char *name, const char *args) setenv("RDMAV_HUGEPAGES_SAFE", "1", 1); ibv_fork_init(); rte_eal_pci_register(&mlx5_driver.pci_drv); - return 0; } - -static struct rte_driver rte_mlx5_driver = { - .type = PMD_PDEV, - .name = MLX5_DRIVER_NAME, - .init = rte_mlx5_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_mlx5_driver) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index ef7011e..c135f8c 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2468,29 +2468,14 @@ static struct eth_driver rte_nfp_net_pmd = { .id_table = pci_id_nfp_net_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = nfp_net_init, .dev_private_size = sizeof(struct nfp_net_adapter), }; -static int -nfp_net_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - PMD_INIT_LOG(INFO, "librte_pmd_nfp_net version %s\n", - NFP_NET_PMD_VERSION); - - rte_eth_driver_register(&rte_nfp_net_pmd); - return 0; -} - -static struct rte_driver rte_nfp_net_driver = { - .type = PMD_PDEV, - .init = nfp_net_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_nfp_net_driver); +RTE_EAL_PCI_REGISTER(nfp_net, rte_nfp_net_pmd.pci_drv); /* * Local variables: diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 985a8d6..9adccba 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1574,31 +1574,12 @@ static struct eth_driver szedata2_eth_driver = { .pci_drv = { .name = RTE_SZEDATA2_PCI_DRIVER_NAME, .id_table = rte_szedata2_pci_id_table, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = rte_szedata2_eth_dev_init, .eth_dev_uninit = rte_szedata2_eth_dev_uninit, .dev_private_size = sizeof(struct pmd_internals), }; -static int -rte_szedata2_init(const char *name __rte_unused, - const char *args __rte_unused) -{ - rte_eth_driver_register(&szedata2_eth_driver); - return 0; -} - -static int -rte_szedata2_uninit(const char *name __rte_unused) -{ - return 0; -} - -static struct rte_driver rte_szedata2_driver = { - .type = PMD_PDEV, - .name = RTE_SZEDATA2_DRIVER_NAME, - .init = rte_szedata2_init, - .uninit = rte_szedata2_uninit, -}; - -PMD_REGISTER_DRIVER(rte_szedata2_driver); +RTE_EAL_PCI_REGISTER(szedata2, szedata2_eth_driver.pci_drv); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index c3fb628..14d05fd 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1209,29 +1209,24 @@ static struct eth_driver rte_virtio_pmd = { .name = "rte_virtio_pmd", .id_table = pci_id_virtio_map, .drv_flags = RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_virtio_dev_init, .eth_dev_uninit = eth_virtio_dev_uninit, .dev_private_size = sizeof(struct virtio_hw), }; -/* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of PCI virtio devices. - * Returns 0 on success. - */ -static int -rte_virtio_pmd_init(const char *name __rte_unused, - const char *param __rte_unused) +RTE_INIT(rte_virtio_pmd_init); +static void +rte_virtio_pmd_init(void) { if (rte_eal_iopl_init() != 0) { PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD"); - return -1; + return; } - rte_eth_driver_register(&rte_virtio_pmd); - return 0; + rte_eal_pci_register(&rte_virtio_pmd.pci_drv); } /* @@ -1453,10 +1448,3 @@ __rte_unused uint8_t is_rx) { return 0; } - -static struct rte_driver rte_virtio_driver = { - .type = PMD_PDEV, - .init = rte_virtio_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_virtio_driver); diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 29b469c..25fec79 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -332,25 +332,15 @@ static struct eth_driver rte_vmxnet3_pmd = { .name = "rte_vmxnet3_pmd", .id_table = pci_id_vmxnet3_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_vmxnet3_dev_init, .eth_dev_uninit = eth_vmxnet3_dev_uninit, .dev_private_size = sizeof(struct vmxnet3_hw), }; -/* - * Driver initialization routine. - * Invoked once at EAL init time. - * Register itself as the [Poll Mode] Driver of Virtual PCI VMXNET3 devices. - */ -static int -rte_vmxnet3_pmd_init(const char *name __rte_unused, const char *param __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - - rte_eth_driver_register(&rte_vmxnet3_pmd); - return 0; -} +RTE_EAL_PCI_REGISTER(vmxnet3, rte_vmxnet3_pmd.pci_drv); static int vmxnet3_dev_configure(struct rte_eth_dev *dev) @@ -948,10 +938,3 @@ vmxnet3_process_events(struct vmxnet3_hw *hw) } #endif - -static struct rte_driver rte_vmxnet3_driver = { - .type = PMD_PDEV, - .init = rte_vmxnet3_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_vmxnet3_driver); -- 2.7.4