From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id BB1BB9E3 for ; Tue, 18 Apr 2017 20:27:32 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 18 Apr 2017 11:27:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,219,1488873600"; d="scan'208";a="90985867" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by fmsmga005.fm.intel.com with ESMTP; 18 Apr 2017 11:27:30 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit , Shepard Siegel , Ed Czeck , John Miller Date: Tue, 18 Apr 2017 19:27:25 +0100 Message-Id: <20170418182726.30462-2-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20170418182726.30462-1-ferruh.yigit@intel.com> References: <6042261.q63DMppQd2@xps13> <20170418182726.30462-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH 1/2] net/ark: remove eth_dev 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: , X-List-Received-Date: Tue, 18 Apr 2017 18:27:33 -0000 Signed-off-by: Ferruh Yigit --- CC: Shepard Siegel CC: Ed Czeck CC: John Miller --- drivers/net/ark/ark_ethdev.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 651dd26..1f6cd0d 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -40,6 +40,7 @@ #include "ark_global.h" #include "ark_logs.h" #include "ark_ethdev.h" +#include #include "ark_ethdev_tx.h" #include "ark_ethdev_rx.h" #include "ark_mpu.h" @@ -118,16 +119,36 @@ static const struct rte_pci_id pci_id_ark_map[] = { {.vendor_id = 0, /* sentinel */ }, }; -static struct eth_driver rte_ark_pmd = { - .pci_drv = { - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - .id_table = pci_id_ark_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC - }, - .eth_dev_init = eth_ark_dev_init, - .eth_dev_uninit = eth_ark_dev_uninit, - .dev_private_size = sizeof(struct ark_adapter), +static int +eth_ark_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct rte_eth_dev *eth_dev; + int ret; + + eth_dev = rte_eth_dev_pci_allocate(pci_dev, sizeof(struct ark_adapter)); + + if (eth_dev == NULL) + return -ENOMEM; + + ret = eth_ark_dev_init(eth_dev); + if (ret) + rte_eth_dev_pci_release(eth_dev); + + return ret; +} + +static int +eth_ark_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, eth_ark_dev_uninit); +} + +static struct rte_pci_driver rte_ark_pmd = { + .id_table = pci_id_ark_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .probe = eth_ark_pci_probe, + .remove = eth_ark_pci_remove, }; static const struct eth_dev_ops ark_eth_dev_ops = { @@ -375,7 +396,6 @@ eth_ark_dev_init(struct rte_eth_dev *dev) eth_dev->device = &pci_dev->device; eth_dev->data->dev_private = ark; - eth_dev->driver = ark->eth_dev->driver; eth_dev->dev_ops = ark->eth_dev->dev_ops; eth_dev->tx_pkt_burst = ark->eth_dev->tx_pkt_burst; eth_dev->rx_pkt_burst = ark->eth_dev->rx_pkt_burst; @@ -963,7 +983,7 @@ eth_ark_check_args(struct ark_adapter *ark, const char *params) return 0; } -RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_ark, rte_ark_pmd); RTE_PMD_REGISTER_KMOD_DEP(net_ark, "* igb_uio | uio_pci_generic "); RTE_PMD_REGISTER_PCI_TABLE(net_ark, pci_id_ark_map); RTE_PMD_REGISTER_PARAM_STRING(net_ark, -- 2.9.3