From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0053.outbound.protection.outlook.com [104.47.40.53]) by dpdk.org (Postfix) with ESMTP id A8E095946 for ; Mon, 1 Aug 2016 12:45:12 +0200 (CEST) Received: from DM2PR03CA0029.namprd03.prod.outlook.com (10.141.96.28) by CY1PR0301MB2057.namprd03.prod.outlook.com (10.164.2.139) 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:09 +0000 Received: from BL2FFO11FD028.protection.gbl (2a01:111:f400:7c09::182) by DM2PR03CA0029.outlook.office365.com (2a01:111:e400:2428::28) 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:09 +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 BL2FFO11FD028.mail.protection.outlook.com (10.173.161.107) 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:09 +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 u71Aibjo018422; Mon, 1 Aug 2016 03:45:07 -0700 From: Shreyansh Jain To: CC: , , David Marchand Date: Mon, 1 Aug 2016 16:15:23 +0530 Message-ID: <1470048332-27318-9-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: 131145219101212128; (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)(8936002)(104016004)(87936001)(110136002)(92566002)(50226002)(2950100001)(8676002)(105606002)(68736007)(189998001)(11100500001)(81166006)(81156014)(575784001)(86362001)(586003)(47776003)(229853001)(2906002)(36756003)(33646002)(76176999)(50986999)(2351001)(77096005)(5003940100001)(50466002)(4326007)(85426001)(356003)(106466001)(7846002)(19580405001)(19580395003)(48376002)(97736004)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB2057; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD028; 1:TVqorra2hFPh7JV/rjHyZROHR0RD0RJ0a04lEo6HrWWGujYbFwruucbpdaimLVzMMOe2e80C2K6TVyGExHWq4c5LKrXfomf+52+5pNjXJqcpjxlvYPaAddIXZjTLiW80mqqGwU2+Oxq4bQ3xCmYCFssERmaar4tlOdrJe080fIZKRaq5j1WatC00CO3dBoasLqhazmLk/ByRdENqHGyGTDWOWBYKevNZnOR4vzw/r4buN86XkR5IStveD+Ed7QFbYmuuwqG1Qx+AQ9VJTYiXCUjlPNDJtXzCao/T1MbL1uKZlkfUroJaMaHuAIUfJgK2poE8zVme4ATcRwogrKmJ8OabfrNMSS3kBwXWYY/5uUeRz54SX7WUzoxM/AWl+Vc3JTzfp9mcOBqcZ2nnwJvYhEz5Wzp/cLrRxPpx5suhh0OO0QUrCHl6XURyXM2PGSHNz6ewwZNlH4bUTl/g1s7octk5f+2P1lLD4fc/Z5+dMt+LuZop+xJmTyE+dJ4gSnlIKVVAqrFgnMui6lMThAmLFcxopvAqI/B8wjzlP1qJzwPlZQFrIB6VVcwmQYFYxWA6yulOYMoGGUQnnUIVhv9wD+RZmQgHkcW1JRIpY6TIXcI+tkSyHl+LaH1MUDfJdz2J MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2e72794a-ef30-4127-b2d8-08d3b9f8e8e8 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2057; 2:l7zecgHboZzC/egVn27ONwHY0RfTvgRr/1f7RY05828PLw8kKg+ZifIKpxi5cWVomEAG/5XfGlKJOPPiRA4WCU70s4HZIj7XW/EViqpa8Z3h6dw+ZiOF5e3g+qNHeSmL2WYdGWZpXrXebg6Tdp3/SSQ4/oyJIgyC1oYbZ50q4euhnNIwORD7ALP8Oij6ITFd; 3:aD/kIcL5JNo0R6tVxrpt+5G6zxXj7zNY+D3h/jnsDkpXjMEVHFPnYD1zaiaZ990hKSmXr/X7pizJeDczqe34Tn9f52YSel+dgwzqIDsj1czrw+WVZX863fNecBFP+Pw5/flfh+mPsxynKf6MxIEp8GBHTMhBypqIYlEFeyNPC09hU/wCF7OsjRTZYm+DrvpEKKqlFXoZIXN/HbUib72v0Xh0mc43HZTgAJ8earkzKAE=; 25:aRH7QyDjbIVQiIbMfokhx0BY4by77gQZQSXfskl1Dl/TsQhso7o82AKsc55ovdGXfL39YXoAVvky9SIB1LXftF1LIKYgMY0R3z3C1xRMyPdPskL05s6LQnWDEAhKW2NUhHQV5wrjFM4nNL35uU//CCnKeUdhhGEifbZQQtdcO/PoY3IRteJ9EI4obsfqkNv2TUpVVAU7ilTvn/fNSqdKkRbI+iA21CIerFUYm9vLxEV/jTv1tdsFx+9rVDxJapoXU2Nyk+b2ED+yrmW56OOGdDzyyfHbPnlsNHyu4g7cno1Qba6xZ+DLxLJwxFGDf2Qt4214ht2NHgIeG2ZfcfpKVERf1nWL2PN6RhJ3jV3ex5CFQ0iLf35rTfd0+OKmO4GupsV4lnin/dWEF10dprCFq+wkma/g1SeUMWszHM7Refw= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB2057; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2057; 31:zANdkmFwDmbFAbACExiuCtMnX1xY/lWYwqmEQYQslL4PUG75Hzc6+rqLi5rZiQw2PoPke0eRNdJppsXMSdattEH91qNUz2LfEjgEZXQu/bav9NtcVisHdGYdwrGz73UtYwYx6E5wYkPlir9m0wJ7FQ9DDykM3FNLLkCQPwf24PG5S23FB1ilPvgMNw2QJ/iOjqwbCeWmzKMYksunRapnO7F/fbTtHy/RnGoAU7UxS3Q=; 4:LmVa9j5xqv3DDRdhjZevFQZmgM0cGZSiVFvvVkGEWUC0E3eylSsVuNlOMtkv+/mOlbA81iFQixhjU+TcT9RzrB/FaISby0xih87ygJCVzhVz/4HwZZI4q/3Okk2co6Pdx4uFBnPiVjJRFe7vzB6ezNNqUuPx9L4ilCttZp0WHHwKUoLXjgSXzmoQ36k6UzTyFVTMuf0mvuHZT452pYz8ZcMwOOenrculDPKMu2AhsEGyFotYbtduZdaWB72dkQQe/tCX19Qd2yUvj5ZgOIpCATlyt4NcCTbbcX6ujAx2OAkihwMI3clRE91LqZriuTm7yliSMDy8Y71PxEj5Qa6jzzUjtbfKXV02N6aIbOlBaieAiUkd8W9IKUOnQGP0NF4TFR4aiaqydCEgHiiQagob2DZ3KG+RENI0L6ys19OuHYgi9rMKuSdStki0XbbuuSYzD4dc07LoFqCNG4L3YKy8u0IaXQDkPnSq4X+STvJzVaN2x6CPyBcqegr6WURtuwjWV0dukAfroHj7QmrY6APq5g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13024025)(13015025)(13018025)(13017025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB2057; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB2057; X-Forefront-PRVS: 0021920B5A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB2057; 23:JmuMHvk10Lfg8hUCQbAJ44dLT9D87HQlFz9wXO0?= =?us-ascii?Q?8bZWCKe6+o7Ft2vQpapt6K2hlaCi9dFS00SZcocelAarsPDgGL6nAiWI6osN?= =?us-ascii?Q?Wx8XGSsfN+we4aEjW7uaHNb+fpBX7Zn6RW2Z/Flvny/EXT4ynZh4m24T3DXH?= =?us-ascii?Q?0lOSO5zIDmcVAuhCUCSbnNZs70u/cFwFXKHZT7zD/0yqEHuQJ4dj3xJ3Pl9u?= =?us-ascii?Q?HuWyRmwJuLFt+3Klg/SuwhWmf96YiIJNJWq1xS5TyjijJcLGQ2kL506O12ul?= =?us-ascii?Q?rhTDvf2CDB6oyydpJae/JjTbRohGZs+diuVYo2Xb3ECtK5BxXhrnJT10u79i?= =?us-ascii?Q?6X1LX/vsI3S6OQCD7UTuZXUJeJZ7jAh+Vb7ne8TAI5zMG5XWy0NQSsZqYpXy?= =?us-ascii?Q?GwkLCtHc5zhZ9xI6gfy6GlKfavwFx+1gg+t2394s45ZLqea/gutCHx7DrrwH?= =?us-ascii?Q?5G+Rz/vSBSsGtD52cHr/a9y8KkKCaDugZyr8qDU5+PaIwVgVXog7Hs+z6ACu?= =?us-ascii?Q?gAygyM5+c+qX96gqivorDhdoT8dwq5kGvhchYIcKa4II9mjpUw7fskvi53Bn?= =?us-ascii?Q?B7e7+t5cCorQIjS3fGFv5Ur9aooCpakhgH19ITbxHCpK/tmN3vxNTW9LA4A+?= =?us-ascii?Q?ceWR7o+KjZ8a+6/iuGyHJ04OUxVOLfEPXxeObAfa2l2byuDIg8S3fEcaewIU?= =?us-ascii?Q?ZiEBOeWnNAYWRntTeUdBcunxheNrtRRQetOkiiErLZpfEZjVr3fda7uwdzIU?= =?us-ascii?Q?nfSuuT6zzI6yORyjhZu5NxW149GSJrmsb9noNEj7hvaBKy1blMkMA+TNuIA1?= =?us-ascii?Q?cePjnpQjbFXSaQ/7LMqPh1CCg95a8oUk/gM74sdyXukLGR6Ok8e35ApFkRPa?= =?us-ascii?Q?BoF9zLyZCinPo4wzv1e60rg4iuGmfbWo5BfVkXgzpxeiwE17Q8ZWnMgt4OtG?= =?us-ascii?Q?2YEu2aOyt+NxuNso6O7ZnjhBU+MXPa9xqj55OUH3K7HfItsMGIFrXpKS8ZJV?= =?us-ascii?Q?XGsAfD9REOtWlRd8xURQpKAB9mD4U+nDgp/x5j2IgbbCPFXu1EkY3jsWdT6f?= =?us-ascii?Q?QeUrCYZsdSXQ3uRiU6QWwq4K5r5BXMz7BH78KrDqcXKate9sR+itBlGtJKA+?= =?us-ascii?Q?DQo4tSm9cmE8=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2057; 6:6usUweYZkq1hwL6froDvoJAc5K/yq+7Bs8yeH7Am9XcG5+c1agAbSlOW3sbjQFmtvF0itMAZzDM6+wBwE6wfeeQ0VLv2QvfvWXeakl1R/qigv4CX8lsQDNPaBPvp1gOS/OMaNxXhDwVIWC7lCP/jLd4jdPGfmskwxE/DpPIhVHKCLRflqwZ332p4nNnGN3+YO8dsXMYeNKZ/yNCwKNqB3lm0hbjcwSMHot9wlw5DWR76n2MLRebEZ1XOZDvOy5ovBXO2SCoTf+4VPTLg8i+kcu+XAOyjGo4QMRniTc7VuSw=; 5:R05/4yZxvSYROja9GH1H85g44dvwLkji4W9XM4khzlw2Rsft6lJOUeFpJhl6aVAPNpc4wZseDQE6DKmaJfYu5/Ifv05x4rLeWSPi9DgUI7s+e+eGTYine/5FZeVA1Meh4awFCAL4lHZX/m1b6JaHezsfjiFnz0j+9YrltqBvfoI=; 24:DMjxWsnZYD1m0QIqyIEQOEhGJtTJvGoUoYOGk8cj/n8Ml7dAF4qJ1cEuBLoY6ncZ50MHcq2AWnzRIvw/GtOMcAlZLEOpA9hqMBnEt+SBxkA=; 7:bmHBN7xsxS0n9ygCkQdvirKARPRAOaWIBPEHkBRToBljWsj9ClPAhmq/ARZTaMT22bRDSKPvvpAVaHz8fFhMG2K1ctCFPROXX3JoIQn6mopu/YQbJRbGVQdQUE92DeI96U+/qiM84kvasAalXKNWQpbzRDaRNFJtBS8Kwhoj7rJqLsN+X4Er25l+huHCA/tBUW3EWpQKPQDG8cMkbxhito3QikMxJN34+maBK1bMqtllN/slGTGXk9PJsy4KxrWu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2016 10:45:09.8248 (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: CY1PR0301MB2057 Subject: [dpdk-dev] [PATCH v7 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: Mon, 01 Aug 2016 10:45:13 -0000 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. Exceptions: - virtio and mlx* use RTE_INIT directly as they have custom initialization steps. - VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER. Signed-off-by: David Marchand Signed-off-by: Shreyansh Jain --- drivers/crypto/qat/rte_qat_cryptodev.c | 16 +++--------- drivers/net/bnx2x/bnx2x_ethdev.c | 34 +++++------------------- drivers/net/bnxt/bnxt_ethdev.c | 16 +++--------- drivers/net/cxgbe/cxgbe_ethdev.c | 24 +++-------------- drivers/net/e1000/em_ethdev.c | 16 +++--------- drivers/net/e1000/igb_ethdev.c | 39 +++++----------------------- drivers/net/ena/ena_ethdev.c | 17 +++--------- drivers/net/enic/enic_ethdev.c | 23 +++-------------- drivers/net/fm10k/fm10k_ethdev.c | 23 +++-------------- drivers/net/i40e/i40e_ethdev.c | 24 +++-------------- drivers/net/i40e/i40e_ethdev_vf.c | 25 +++--------------- drivers/net/ixgbe/ixgbe_ethdev.c | 46 +++++---------------------------- drivers/net/mlx4/mlx4.c | 15 +++-------- drivers/net/mlx5/mlx5.c | 14 +++------- drivers/net/nfp/nfp_net.c | 21 +++------------ drivers/net/qede/qede_ethdev.c | 40 ++++++---------------------- drivers/net/szedata2/rte_eth_szedata2.c | 24 +++-------------- drivers/net/thunderx/nicvf_ethdev.c | 20 +++----------- drivers/net/virtio/virtio_ethdev.c | 25 +++++------------- drivers/net/vmxnet3/vmxnet3_ethdev.c | 23 +++-------------- 20 files changed, 78 insertions(+), 407 deletions(-) diff --git a/drivers/crypto/qat/rte_qat_cryptodev.c b/drivers/crypto/qat/rte_qat_cryptodev.c index 1e9e0ba..b94af59 100644 --- a/drivers/crypto/qat/rte_qat_cryptodev.c +++ b/drivers/crypto/qat/rte_qat_cryptodev.c @@ -116,23 +116,13 @@ static struct rte_cryptodev_driver rte_qat_pmd = { .pci_drv = { .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, CRYPTODEV_NAME_QAT_SYM_PMD); +DRIVER_REGISTER_PCI(CRYPTODEV_NAME_QAT_SYM_PMD, rte_qat_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(CRYPTODEV_NAME_QAT_SYM_PMD, pci_id_qat_map); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index f3ab355..214b655 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -621,6 +621,8 @@ 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), @@ -634,38 +636,14 @@ 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, bnx2x); +DRIVER_REGISTER_PCI(bnx2x, rte_bnx2x_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(bnx2x, pci_id_bnx2x_map); -PMD_REGISTER_DRIVER(rte_bnx2xvf_driver, bnx2xvf); +DRIVER_REGISTER_PCI(bnx2xvf, rte_bnx2xvf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(bnx2xvf, pci_id_bnx2xvf_map); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3795fac..28eb8b9 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1048,23 +1048,13 @@ static struct eth_driver bnxt_rte_pmd = { .name = "rte_" DRV_MODULE_NAME "_pmd", .id_table = bnxt_pci_id_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .devinit = rte_eth_dev_pci_probe, + .devuninit = rte_eth_dev_pci_remove, }, .eth_dev_init = bnxt_dev_init, .eth_dev_uninit = bnxt_dev_uninit, .dev_private_size = sizeof(struct bnxt), }; -static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused) -{ - RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name); - rte_eth_driver_register(&bnxt_rte_pmd); - return 0; -} - -static struct rte_driver bnxt_pmd_drv = { - .type = PMD_PDEV, - .init = bnxt_rte_pmd_init, -}; - -PMD_REGISTER_DRIVER(bnxt_pmd_drv, bnxt); +DRIVER_REGISTER_PCI(bnxt, bnxt_rte_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(bnxt, bnxt_pci_id_map); diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 9208a61..431b06d 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1042,30 +1042,12 @@ 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 = { - .type = PMD_PDEV, - .init = rte_cxgbe_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_cxgbe_driver, cxgb4); +DRIVER_REGISTER_PCI(cxgb4, rte_cxgbe_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(cxgb4, cxgb4_pci_tbl); - diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index ad104ed..1281c8b 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -395,6 +395,8 @@ 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, @@ -402,13 +404,6 @@ static struct eth_driver rte_em_pmd = { }; 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; -} - -static int em_hw_init(struct e1000_hw *hw) { int diag; @@ -1799,10 +1794,5 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, return 0; } -struct rte_driver em_pmd_drv = { - .type = PMD_PDEV, - .init = rte_em_pmd_init, -}; - -PMD_REGISTER_DRIVER(em_pmd_drv, em); +DRIVER_REGISTER_PCI(em, rte_em_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(em, pci_id_em_map); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index fbf4d09..6842eab 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1047,6 +1047,8 @@ 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, @@ -1061,19 +1063,14 @@ 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; -} - static void igb_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) { @@ -1085,20 +1082,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) { @@ -5049,16 +5032,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) { @@ -5220,7 +5193,7 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev) E1000_WRITE_FLUSH(hw); } -PMD_REGISTER_DRIVER(pmd_igb_drv, igb); +DRIVER_REGISTER_PCI(igb, rte_igb_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(igb, pci_id_igb_map); -PMD_REGISTER_DRIVER(pmd_igbvf_drv, igbvf); +DRIVER_REGISTER_PCI(igbvf, rte_igbvf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(igbvf, pci_id_igbvf_map); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 9418d50..ee906d4 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1689,23 +1689,12 @@ 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 = { - .type = PMD_PDEV, - .init = rte_ena_pmd_init, -}; - -PMD_REGISTER_DRIVER(ena_pmd_drv, ena); +DRIVER_REGISTER_PCI(ena, rte_ena_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(ena, pci_id_ena_map); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 47b07c9..59812d0 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -616,29 +616,12 @@ 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, enic); +DRIVER_REGISTER_PCI(enic, rte_enic_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(enic, pci_id_enic_map); diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 01f4a72..26cdc10 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3059,30 +3059,13 @@ 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, fm10k); +DRIVER_REGISTER_PCI(fm10k, rte_pmd_fm10k.pci_drv); DRIVER_REGISTER_PCI_TABLE(fm10k, pci_id_fm10k_map); diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index d0aeb70..dacaaea 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -667,6 +667,8 @@ 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, @@ -701,27 +703,7 @@ rte_i40e_dev_atomic_write_link_status(struct rte_eth_dev *dev, return 0; } -/* - * 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, i40e); +DRIVER_REGISTER_PCI(i40e, rte_i40e_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(i40e, pci_id_i40e_map); /* diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index a616ae0..4a745f9 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1557,34 +1557,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, i40evf); +DRIVER_REGISTER_PCI(i40evf, rte_i40evf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(i40evf, pci_id_i40evf_map); static int diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index d478a15..5c115db 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1509,6 +1509,8 @@ 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, @@ -1523,40 +1525,14 @@ 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; -} - static int ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { @@ -7352,17 +7328,7 @@ ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, ixgbevf_dev_interrupt_action(dev); } -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, ixgbe); +DRIVER_REGISTER_PCI(ixgbe, rte_ixgbe_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(ixgbe, pci_id_ixgbe_map); -PMD_REGISTER_DRIVER(rte_ixgbevf_driver, ixgbevf); +DRIVER_REGISTER_PCI(ixgbevf, rte_ixgbevf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(ixgbevf, pci_id_ixgbevf_map); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 304c846..2bed4de 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5922,12 +5922,10 @@ static struct eth_driver mlx4_driver = { /** * 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 @@ -5938,13 +5936,6 @@ 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, - .init = rte_mlx4_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_mlx4_driver, mlx4); DRIVER_REGISTER_PCI_TABLE(mlx4, mlx4_pci_id_map); diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d96a9af..3658769 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -739,11 +739,10 @@ static struct eth_driver mlx5_driver = { /** * 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 @@ -753,13 +752,6 @@ 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, - .init = rte_mlx5_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_mlx5_driver, mlx5); DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 99a258a..cbaf219 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2464,29 +2464,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, nfp); +DRIVER_REGISTER_PCI(nfp, rte_nfp_net_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(nfp, pci_id_nfp_net_map); /* diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 82e44b8..a92dd3b 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1482,7 +1482,9 @@ static struct eth_driver rte_qedevf_pmd = { .id_table = pci_id_qedevf_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 = qedevf_eth_dev_init, .eth_dev_uninit = qedevf_eth_dev_uninit, .dev_private_size = sizeof(struct qede_dev), @@ -1494,41 +1496,15 @@ static struct eth_driver rte_qede_pmd = { .id_table = pci_id_qede_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 = qede_eth_dev_init, .eth_dev_uninit = qede_eth_dev_uninit, .dev_private_size = sizeof(struct qede_dev), }; -static int -rte_qedevf_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - rte_eth_driver_register(&rte_qedevf_pmd); - - return 0; -} - -static int -rte_qede_pmd_init(const char *name __rte_unused, - const char *params __rte_unused) -{ - rte_eth_driver_register(&rte_qede_pmd); - - return 0; -} - -static struct rte_driver rte_qedevf_driver = { - .type = PMD_PDEV, - .init = rte_qede_pmd_init -}; - -static struct rte_driver rte_qede_driver = { - .type = PMD_PDEV, - .init = rte_qedevf_pmd_init -}; - -PMD_REGISTER_DRIVER(rte_qede_driver, qede); +DRIVER_REGISTER_PCI(qede, rte_qede_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(qede, pci_id_qede_map); -PMD_REGISTER_DRIVER(rte_qedevf_driver, qedevf); +DRIVER_REGISTER_PCI(qedevf, rte_qedevf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(qedevf, pci_id_qedevf_map); diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 483d789..6d21024 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1574,31 +1574,13 @@ 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, - .init = rte_szedata2_init, - .uninit = rte_szedata2_uninit, -}; - -PMD_REGISTER_DRIVER(rte_szedata2_driver, RTE_SZEDATA2_DRIVER_NAME); +DRIVER_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver.pci_drv); DRIVER_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table); diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 4f875c0..ad7d607 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1762,26 +1762,12 @@ static struct eth_driver rte_nicvf_pmd = { .name = "rte_nicvf_pmd", .id_table = pci_id_nicvf_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 = nicvf_eth_dev_init, .dev_private_size = sizeof(struct nicvf), }; -static int -rte_nicvf_pmd_init(const char *name __rte_unused, const char *para __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - PMD_INIT_LOG(INFO, "librte_pmd_thunderx nicvf version %s", - THUNDERX_NICVF_PMD_VERSION); - - rte_eth_driver_register(&rte_nicvf_pmd); - return 0; -} - -static struct rte_driver rte_nicvf_driver = { - .type = PMD_PDEV, - .init = rte_nicvf_pmd_init, -}; - -PMD_REGISTER_DRIVER(rte_nicvf_driver, thunderx_nicvf); +DRIVER_REGISTER_PCI(thunderx_nicvf, rte_nicvf_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(thunderx_nicvf, pci_id_nicvf_map); diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 07d6449..5453709 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1307,29 +1307,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); } /* @@ -1563,10 +1558,4 @@ __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, virtio_net); DRIVER_REGISTER_PCI_TABLE(virtio_net, pci_id_virtio_map); diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 5874215..d732979 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -331,26 +331,14 @@ 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; -} - static int vmxnet3_dev_configure(struct rte_eth_dev *dev) { @@ -948,10 +936,5 @@ 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, vmxnet3); +DRIVER_REGISTER_PCI(vmxnet3, rte_vmxnet3_pmd.pci_drv); DRIVER_REGISTER_PCI_TABLE(vmxnet3, pci_id_vmxnet3_map); -- 2.7.4