From patchwork Sun Dec 4 10:11:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 17626 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B9E5AFA56; Sun, 4 Dec 2016 11:10:19 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0077.outbound.protection.outlook.com [104.47.34.77]) by dpdk.org (Postfix) with ESMTP id C4EBD2BF6 for ; Sun, 4 Dec 2016 11:09:22 +0100 (CET) Received: from CY4PR03CA0001.namprd03.prod.outlook.com (10.168.162.11) by MWHPR03MB2477.namprd03.prod.outlook.com (10.169.200.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Sun, 4 Dec 2016 10:09:18 +0000 Received: from BN1BFFO11FD009.protection.gbl (2a01:111:f400:7c10::1:182) by CY4PR03CA0001.outlook.office365.com (2603:10b6:903:33::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 10:09:18 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.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 BN1BFFO11FD009.mail.protection.outlook.com (10.58.144.72) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 10:09:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:703; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uB4A8pKB019825; Sun, 4 Dec 2016 03:09:14 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Sun, 4 Dec 2016 15:41:22 +0530 Message-ID: <1480846288-2517-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> References: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253197579817463; (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)(1110001)(1109001)(336004)(339900001)(189002)(199003)(4326007)(2906002)(105606002)(104016004)(81156014)(106466001)(85426001)(81166006)(92566002)(5003940100001)(48376002)(50466002)(2351001)(5890100001)(626004)(2950100002)(47776003)(5660300001)(110136003)(97736004)(69596002)(68736007)(76176999)(50986999)(6916009)(38730400001)(6666003)(39410400001)(50226002)(39400400001)(7846002)(39380400001)(189998001)(8936002)(8676002)(77096006)(305945005)(39450400002)(36756003)(8666005)(33646002)(86362001)(356003)(575784001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2477; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD009; 1:WbPF/uR95DzT5u8FDrVw+iJsRRkhTFh6M6tIkDaf/EMh84vxfEyuV1xexZxZlcxNhpY3AkR4wanD9Awg7y8oiUcMwLkH3K8aL5xZpMuZaTSOLCilnti1cjwZnK2zTqMbOAMHNQSC03CLLJ6CqFnXQ/Z+fqfpRlaEE2XJRjfAtQhNR+l3xLvs4dwJuTgiyQhNK1L08S62/+h6BQkmh8Ik4lmFf5HHxlyEVYMkJt+SLQuXNhPMqH7zN9NYvunWHFhCt+mlIOeFvASPddoPrhbYXxVD6rjUNmO4b70VZ/iIHzlLbAVU5YVt1gBMt0Ogy5nI/Ukw+PtKXynV9b8FV8y6hFGzlU7X8+u3hxHR6hKDoEJy2bAx/f/QUJN/evnA6UK09aMWC/QXOdT1LRZVIf8C0WorQqL7DU3Z9EaMCCrjXaY5CAsUjgfv1hfviBQbMfhY8+7X/uffy6ySxGQ6OwDl6Tw8bX0pX+iLTdgBfTufMV7XG+t6JRX/JZFKxVTuJmSHE55n2v/mC4cpm+czLkeZs7E7D51gjVMfQJiS1wvPyu9nDx1gs0JJcoC/UMQnWiPhXSdb4wpB1IZ0DQ2MWtD+mbcsKUASXh91nTtM0IlZFKSxg6olrlx2LX2nyeCcg9ose1XvY9i7G9a0V4jbcazqCDc0tY9EbcxJngApnsFx2Y5wYu0M5vEnCY3sF1JST9+KF6lF+kCabc+/Ao5sp4OI/EF2XtMNqPsR4w2hdXIfdp0= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e5dc5ee8-556b-471d-b096-08d41c2d9bd5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 3:b3POKAJKJu9gAijV/SNhVNDviCqa6W7XrolDapjUv7yeG0YsWTF1MbD4hLTzF6+cvSCVNbWF1coFFroB7OCcXPKs850dfzhuLFTDkmwYMzjrd+1JDZUXb4voXTiIVciYh29zSGvjfpQUeYR6t+WM70XGz6mr7SOth8beuy+e3Csjib8BJMgo1PXo0WrOVAv8NjqDVH/8ml2TFf6dCh5slx03EWHnUbh+yzZantJEIZ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HwLZGWaMK3dh9zLLGuek7AH52aaIAM3q0Rh/dUCiw5E63vSKfO820DQxvv6omDN6HDMERTdFvr8ShAwSqL1A5js8llRO42wsbKez3HFWEo2/HS9UpEgUhCXom/vqTRtdWoha8lH+lzZ9FzqeLRUcaEHD3ez6k/QJzQHh8b4CtAJLnNK5J9tJG+BXd2rHzNAxlAF0yTLnTtxWaB3CirJyEucqM5vdp9HHRJcgHVk7RJgD3zSRz2u0cSTAhqYY1WadW4d0vIVr7CYHJrN3uFU470qznMXYO+DcqdwCWZ48= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13015025)(13017025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123559025)(20161123561025); SRVR:MWHPR03MB2477; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 4:uJ8Jwb/TTkNZlxvHUFl/kcy/eyfmkwCfZ7dYGUbdOGjnIhThNA+un+8zwZhPS3SpaPzmj97DaSHJBDSS5HCL2yTU+ZW4Nje86Dh9v6ovFYYUsCvP4s7pOhzXeOrz6jKWl4yWC8HOg3ctA50Dz94iK0MjXF11gP8QRRgjZw90M8WH6VLHMepG/OHFJXpg7l59bQIc7TBdo7jU6HCjFoRm6InHo1sZ6LM8snbNRGs+oeCtKSYTAmqDZNOo5eXs0maBDwIFg69skuwO2truQBcYyF1bufE/ZHMFz6631pFl3suYpcxZP/9rFmYXjjKZDueMexrzaY3A+F8ayOnMz+g0KU91dy74B21Ntexqv3cK91VIFOq/VAa1yq2XUd1KdHJrrcM5TmDxpdt/8kNyZ5/uIkSeQTPaiglqb7aRk4HtaXoVYReSQ/xwLlhCH6cNlHA6Vg8cC4SlZ9Xt2iiYR5Lfl8fEagmpMG64VGbrhOb7CEXZA2Ft23ZTN0WEcZqW8VRGVVMBN+WcftZAXlIGR67Qp/U4b05angiY5KhYS2u8kIRvAq1cq6065yyFK/nPoB8ByMffukT3HWCh51RTlRS5HHydr3eRmuqIT0rUaI+4Cfj4vBlMLtH7LXfDMunLh6uAGx8Qork6zZVRS1nkJlRu+U2qF9ge/rk9EA5A2pbuXKWZEjBlr8GKEwvkqCur4kEa20CQQUPLa8vcxomJu3wVRnyELgq+67G3u3bwDc5KI0R3lxhoI2P7ErbP5h0l53mnCxhAhHOszVRCU7yDxSx82Q== X-Forefront-PRVS: 014617085B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2477; 23:gphwPJVfe5edciy4qhN3ZeGCdWCXqlYb3N/zXuqwK?= =?us-ascii?Q?NRhVUfg4C8sAQ7bzKM8C/dy2q7TvtZpZiWECEEYz1Bc+846QntTfpXKBnaxj?= =?us-ascii?Q?8DVasHY6B0RAotgvxzm5wuhzLqCY+ff3HBnFvrgDHvso0Dhc1EeFZmj0vSNI?= =?us-ascii?Q?5/AsHUv2tlg5vIixxumTgI7lfqzrDJW5YDR3Rbm1qEbJSEkd7YU45B9WNG11?= =?us-ascii?Q?Y/swA0CrxREP9foYjxwp64j/q10+he5evVK5YvxgI4CjNX+TvXAU/+l5RFxp?= =?us-ascii?Q?nhaIjCHllOUtaU5OdxQZxKFPa4uPLm7Oi+mdXNEGzd2mMW4ZhCQqGTMVqazB?= =?us-ascii?Q?L9kXSME+Ad54x6SQvcQRqSWyKIqPhCWwaxFHHGKp1nJndP0RSyJkaHkUeXTJ?= =?us-ascii?Q?Und3oXNxQocJj9RT+dZSvkpCb3feQynxqwlbTEojuPfV+Igi6vpz49AHEiB0?= =?us-ascii?Q?W4Jd6EmgMnKwr4MpEuJi/UDCD62VNdGX1AUuZuEbyLlzfIZw84uTC7j6OS4S?= =?us-ascii?Q?a46uBgMj4051YMcIWm1eFdugjpV0WovoAmn24Futp7khnoZM5zm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0aku+MTMXfLFwMCV0KrjDGFPco4+Sunm3gowTsP394+UEc+0X3cBO9kXRHgzkcN0j30UH5eb26Q+OqpH4fFwOiNfCkDzYW0N8EIiwoK+uMRtfj+FDul0ZhKgQA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 10:09:17.7321 (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: MWHPR03MB2477 Subject: [dpdk-dev] [PATCH 07/13] pci: replace probe and remove handlers with rte_driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_pci_driver probe/remove callback are replaced with the rte_driver based probe/remove. This patch changes all the PCI drivers which reference rte_pci_driver->probe/remove. rte_pci_driver continues to have probe/remove callback which would be used once eth_driver is removed in later patches. Only changes to PCI are done. VDEV changes require a different model because of arguments being passed to vdev->probe/remove. Signed-off-by: Shreyansh Jain --- drivers/net/bnx2x/bnx2x_ethdev.c | 12 ++++++++---- drivers/net/bnxt/bnxt_ethdev.c | 6 ++++-- drivers/net/cxgbe/cxgbe_ethdev.c | 6 ++++-- drivers/net/e1000/em_ethdev.c | 6 ++++-- drivers/net/e1000/igb_ethdev.c | 12 ++++++++---- drivers/net/ena/ena_ethdev.c | 6 ++++-- drivers/net/enic/enic_ethdev.c | 6 ++++-- drivers/net/fm10k/fm10k_ethdev.c | 6 ++++-- drivers/net/i40e/i40e_ethdev.c | 6 ++++-- drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++-- drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++++++---- drivers/net/mlx4/mlx4.c | 6 ++++-- drivers/net/mlx5/mlx5.c | 4 +++- drivers/net/nfp/nfp_net.c | 6 ++++-- drivers/net/qede/qede_ethdev.c | 16 ++++++++++------ drivers/net/szedata2/rte_eth_szedata2.c | 6 ++++-- drivers/net/virtio/virtio_ethdev.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 6 ++++-- lib/librte_eal/common/eal_common_pci.c | 10 ++++++++-- lib/librte_eal/common/include/rte_dev.h | 12 ++++++++++++ lib/librte_ether/rte_ethdev.c | 16 ++++++++++++---- lib/librte_ether/rte_ethdev.h | 6 +++--- 22 files changed, 122 insertions(+), 54 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 0eae433..6b5f906 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -620,8 +620,10 @@ static struct eth_driver rte_bnx2x_pmd = { .pci_drv = { .id_table = pci_id_bnx2x_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_bnx2x_dev_init, .dev_private_size = sizeof(struct bnx2x_softc), @@ -634,8 +636,10 @@ static struct eth_driver rte_bnx2xvf_pmd = { .pci_drv = { .id_table = pci_id_bnx2xvf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_bnx2xvf_dev_init, .dev_private_size = sizeof(struct bnx2x_softc), diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 035fe07..70dccf6 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1163,8 +1163,10 @@ static struct eth_driver bnxt_rte_pmd = { .id_table = bnxt_pci_id_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE | RTE_PCI_DRV_INTR_LSC, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove + }, }, .eth_dev_init = bnxt_dev_init, .eth_dev_uninit = bnxt_dev_uninit, diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index b7f28eb..334e462 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1041,8 +1041,10 @@ static struct eth_driver rte_cxgbe_pmd = { .pci_drv = { .id_table = cxgb4_pci_tbl, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_cxgbe_dev_init, .dev_private_size = sizeof(struct port_info), diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index aee3d34..34c4b31 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -394,8 +394,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_em_dev_init, .eth_dev_uninit = eth_em_dev_uninit, diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 2fddf0c..ae75b7e 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -1081,8 +1081,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_igb_dev_init, .eth_dev_uninit = eth_igb_dev_uninit, @@ -1096,8 +1098,10 @@ static struct eth_driver rte_igbvf_pmd = { .pci_drv = { .id_table = pci_id_igbvf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_igbvf_dev_init, .eth_dev_uninit = eth_igbvf_dev_uninit, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index ab9a178..8825585 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1707,8 +1707,10 @@ static struct eth_driver rte_ena_pmd = { .pci_drv = { .id_table = pci_id_ena_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_ena_dev_init, .dev_private_size = sizeof(struct ena_adapter), diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 2b154ec..1ed951f 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -636,8 +636,10 @@ static struct eth_driver rte_enic_pmd = { .pci_drv = { .id_table = pci_id_enic_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_enicpmd_dev_init, .dev_private_size = sizeof(struct enic), diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 923690c..53a8e33 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -3064,8 +3064,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_fm10k_dev_init, .eth_dev_uninit = eth_fm10k_dev_uninit, diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 67778ba..7c08095 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -673,8 +673,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_i40e_dev_init, .eth_dev_uninit = eth_i40e_dev_uninit, diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index aa306d6..cbff0da 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1529,8 +1529,10 @@ static struct eth_driver rte_i40evf_pmd = { .pci_drv = { .id_table = pci_id_i40evf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = i40evf_dev_init, .eth_dev_uninit = i40evf_dev_uninit, diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index edc9b22..4b99ca1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1567,8 +1567,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_ixgbe_dev_init, .eth_dev_uninit = eth_ixgbe_dev_uninit, @@ -1582,8 +1584,10 @@ static struct eth_driver rte_ixgbevf_pmd = { .pci_drv = { .id_table = pci_id_ixgbevf_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_ixgbevf_dev_init, .eth_dev_uninit = eth_ixgbevf_dev_uninit, diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index da61a85..b3f72d9 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5910,8 +5910,10 @@ static struct eth_driver mlx4_driver = { .name = MLX4_DRIVER_NAME }, .id_table = mlx4_pci_id_map, - .probe = mlx4_pci_probe, - .drv_flags = RTE_PCI_DRV_INTR_LSC, + .driver = { + .probe = mlx4_pci_probe, + .drv_flags = RTE_PCI_DRV_INTR_LSC, + }, }, .dev_private_size = sizeof(struct priv) }; diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 90cc35e..fa34724 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -733,7 +733,9 @@ static struct eth_driver mlx5_driver = { .name = MLX5_DRIVER_NAME }, .id_table = mlx5_pci_id_map, - .probe = mlx5_pci_probe, + .driver = { + .probe = mlx5_pci_probe, + }, .drv_flags = RTE_PCI_DRV_INTR_LSC, }, .dev_private_size = sizeof(struct priv) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index c6b1587..ffcc1b5 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2472,8 +2472,10 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = nfp_net_init, .dev_private_size = sizeof(struct nfp_net_adapter), diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index d106dd0..b8ad392 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1645,9 +1645,11 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - }, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = 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), @@ -1658,9 +1660,11 @@ 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, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - }, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = 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), diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index f3cd52d..d08da9d 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1573,8 +1573,10 @@ static const struct rte_pci_id rte_szedata2_pci_id_table[] = { static struct eth_driver szedata2_eth_driver = { .pci_drv = { .id_table = rte_szedata2_pci_id_table, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = rte_szedata2_eth_dev_init, .eth_dev_uninit = rte_szedata2_eth_dev_uninit, diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 079fd6c..b7bec8f 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1377,11 +1377,11 @@ static struct eth_driver rte_virtio_pmd = { .pci_drv = { .driver = { .name = "net_virtio", + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, }, .id_table = pci_id_virtio_map, .drv_flags = RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, }, .eth_dev_init = eth_virtio_dev_init, .eth_dev_uninit = eth_virtio_dev_uninit, diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 8bb13e5..52993de 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -337,8 +337,10 @@ static struct eth_driver rte_vmxnet3_pmd = { .pci_drv = { .id_table = pci_id_vmxnet3_map, .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, + .driver = { + .probe = rte_eth_dev_pci_probe, + .remove = rte_eth_dev_pci_remove, + }, }, .eth_dev_init = eth_vmxnet3_dev_init, .eth_dev_uninit = eth_vmxnet3_dev_uninit, diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 6bff675..3082b1a 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -161,6 +161,8 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d { int ret; const struct rte_pci_id *id_table; + struct rte_driver *driver; + struct rte_device *device; for (id_table = dr->id_table; id_table->vendor_id != 0; id_table++) { @@ -212,9 +214,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d /* reference driver structure */ dev->driver = dr; + driver = &dr->driver; + device = &dev->device; /* call the driver probe() function */ - ret = dr->probe(dr, dev); + ret = driver->probe(driver, device); if (ret) dev->driver = NULL; @@ -232,6 +236,7 @@ static int rte_eal_pci_detach_dev(struct rte_pci_driver *dr, struct rte_pci_device *dev) { + struct rte_driver *driver = NULL; const struct rte_pci_id *id_table; if ((dr == NULL) || (dev == NULL)) @@ -262,7 +267,8 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr, RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); - if (dr->remove && (dr->remove(dev) < 0)) + driver = &(dr->driver); + if (driver->remove && (driver->remove(&(dev->device)) < 0)) return -1; /* negative value is an error */ /* clear driver structure */ diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 4004f9a..7d2ab16 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -145,6 +145,16 @@ void rte_eal_device_insert(struct rte_device *dev); void rte_eal_device_remove(struct rte_device *dev); /** + * Initialisation function for the driver called during probing. + */ +typedef int (driver_probe_t)(struct rte_driver *, struct rte_device *); + +/** + * Uninitialisation function for the driver called during hotplugging. + */ +typedef int (driver_remove_t)(struct rte_device *); + +/** * A structure describing a device driver. */ struct rte_driver { @@ -152,6 +162,8 @@ struct rte_driver { struct rte_bus *bus; /**< Bus serviced by this driver */ const char *name; /**< Driver name. */ const char *alias; /**< Driver alias. */ + driver_probe_t *probe; /**< Probe the device */ + driver_remove_t *remove; /**< Remove/hotplugging the device */ }; /** diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..164d348 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -232,15 +232,20 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) } int -rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +rte_eth_dev_pci_probe(struct rte_driver *drv, + struct rte_device *dev) { struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; + struct rte_pci_driver *pci_drv; + struct rte_pci_device *pci_dev; char ethdev_name[RTE_ETH_NAME_MAX_LEN]; int diag; + pci_drv = container_of(drv, struct rte_pci_driver, driver); + pci_dev = container_of(dev, struct rte_pci_device, device); + eth_drv = (struct eth_driver *)pci_drv; rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, @@ -285,16 +290,19 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, } int -rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) +rte_eth_dev_pci_remove(struct rte_device *dev) { const struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; + struct rte_pci_device *pci_dev; char ethdev_name[RTE_ETH_NAME_MAX_LEN]; int ret; - if (pci_dev == NULL) + if (dev == NULL) return -EINVAL; + pci_dev = container_of(dev, struct rte_pci_device, device); + rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name)); diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 9678179..3c45a1f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -4369,15 +4369,15 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); * Wrapper for use by pci drivers as a .probe function to attach to a ethdev * interface. */ -int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev); +int rte_eth_dev_pci_probe(struct rte_driver *drv, + struct rte_device *dev); /** * @internal * Wrapper for use by pci drivers as a .remove function to detach a ethdev * interface. */ -int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev); +int rte_eth_dev_pci_remove(struct rte_device *dev); #ifdef __cplusplus }