From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v2 36/42] net/avp: Don't use eth_driver Date: Tue, 11 Apr 2017 17:44:43 +0200 Message-ID: <85df27cc9fd0f5ac7a5244ba8c2755ad616ab527.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-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id 27787D40A for ; Tue, 11 Apr 2017 17:45:41 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id o21so689654wrb.2 for ; Tue, 11 Apr 2017 08:45:41 -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" Signed-off-by: Gaetan Rivet --- drivers/net/avp/avp_ethdev.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 7f2ab47..9ca2786 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -1076,17 +1077,37 @@ eth_avp_dev_uninit(struct rte_eth_dev *eth_dev) return 0; } +static int +eth_avp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct rte_eth_dev *eth_dev; + int ret; -static struct eth_driver rte_avp_pmd = { - { - .id_table = pci_id_avp_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - }, - .eth_dev_init = eth_avp_dev_init, - .eth_dev_uninit = eth_avp_dev_uninit, - .dev_private_size = sizeof(struct avp_adapter), + eth_dev = rte_eth_dev_pci_allocate(pci_dev, + sizeof(struct avp_adapter)); + if (eth_dev == NULL) + return -ENOMEM; + + ret = eth_avp_dev_init(eth_dev); + if (ret) + rte_eth_dev_pci_release(eth_dev); + + return ret; +} + +static int +eth_avp_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, + eth_avp_dev_uninit); +} + +static struct rte_pci_driver rte_avp_pmd = { + .id_table = pci_id_avp_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = eth_avp_pci_probe, + .remove = eth_avp_pci_remove, }; static int @@ -2287,5 +2308,5 @@ avp_dev_stats_reset(struct rte_eth_dev *eth_dev) } } -RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_avp, pci_id_avp_map); -- 2.1.4