From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v2 19/42] net/bnxt: Don't use eth_driver Date: Tue, 11 Apr 2017 17:44:26 +0200 Message-ID: <0d6b75f59c73b0dec32eb7282b181ecc76b9c51e.1491924900.git.gaetan.rivet@6wind.com> References: <1488794430-25179-1-git-send-email-jblunck@infradead.org> Cc: Jan Blunck To: dev@dpdk.org Return-path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id D46CED278 for ; Tue, 11 Apr 2017 17:45:23 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id l28so752725wre.0 for ; Tue, 11 Apr 2017 08:45:23 -0700 (PDT) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jan Blunck Signed-off-by: Jan Blunck --- drivers/net/bnxt/bnxt_ethdev.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 6167443..5dc3ff0 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -1075,6 +1076,8 @@ static int bnxt_init_board(struct rte_eth_dev *eth_dev) return rc; } +static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev); + static int bnxt_dev_init(struct rte_eth_dev *eth_dev) { @@ -1167,7 +1170,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) return 0; error_free: - eth_dev->driver->eth_dev_uninit(eth_dev); + bnxt_dev_uninit(eth_dev); error: return rc; } @@ -1196,19 +1199,26 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) { return rc; } -static struct eth_driver bnxt_rte_pmd = { - .pci_drv = { - .id_table = bnxt_pci_id_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 - }, - .eth_dev_init = bnxt_dev_init, - .eth_dev_uninit = bnxt_dev_uninit, - .dev_private_size = sizeof(struct bnxt), +static int bnxt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct bnxt), + bnxt_dev_init); +} + +static int bnxt_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, bnxt_dev_uninit); +} + +static struct rte_pci_driver bnxt_rte_pmd = { + .id_table = bnxt_pci_id_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | + RTE_PCI_DRV_INTR_LSC, + .probe = bnxt_pci_probe, + .remove = bnxt_pci_remove, }; -RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map); RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio"); -- 2.1.4