From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id D93BDD2C2 for ; Tue, 11 Apr 2017 17:45:22 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id u2so4134451wmu.0 for ; Tue, 11 Apr 2017 08:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=7oGXBw7ae3lL58kiBpULfLdu5oRwBa/v48f+nKg7X6o=; b=sIaq2/6QLdYSkq/9h4CboEL7t4OMEXUGGjoH1+zpdtF/WoYf+S3Z0WYEKlQwmh0R4B BL/y4qjea2sB1lg7VkFNwu9coquK05LDFABCPtdXelo2T3Vl7oR/QSLR1xTJ6R8VSC38 QtGPZQowE/2A/ysqpOv/qSxg5KmXk1oWSARhiM4x871tDlsFRzm5mV5+LQjRFFZTmIJh EhLR3HFaN1Urlks+mV9MU7FKdLGIY0g2iTXH0uq4EwSriprK7tTaWFMlr0fVmUvVPfNV IOot9Tqz84bCaCh5/tZf4hgQlLilgAZZ53cqkvQmlaECIgBkmr0vjMUdzjgSxnRhY6Gs Yi+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=7oGXBw7ae3lL58kiBpULfLdu5oRwBa/v48f+nKg7X6o=; b=d3HLWuE67Pc3rc2yeVHWQD1aDmfhRVKhSMbsRb8pGpk0LEeiRaZOE+R9+weGK6GR+z 4DzZXtjTJhP3bdm7QecnqmxiPWQMkb0g1gQBjaEGzt28f2CNWvMqqGWjtqmrNqfBmaQj fAwPUJ/T8/8faDq7jDLEA0rBVqcp85dSTeN+UaiYends7/EmCCt2dOPyBiZy6PXs6IPs d2Jxx6Ho0ceiYzdOjcq5Q6dqMjNqt7GHafACOgU5X+IoitRIzGLBdGr+gE/4m7m8tSVa NcnE34gBvNvzE+9CkTKn1dRJAX1w/jZ44YgwyEHqt6qMv6CLGjCoMdCS3Jw1O2DNnGYw 1ThQ== X-Gm-Message-State: AN3rC/4UYSe41rObliNJYowQ852rh4hFg6B4X8T5Itscrdt4fgmZB8PuEd8F/sPve8lAKFSr X-Received: by 10.28.11.130 with SMTP id 124mr15552829wml.3.1491925522341; Tue, 11 Apr 2017 08:45:22 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u63sm2933738wmu.22.2017.04.11.08.45.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:45:21 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:25 +0200 Message-Id: <2000c5f1d3d304bcd3b874eea5ff66feef4dcf29.1491924900.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1488794430-25179-1-git-send-email-jblunck@infradead.org> In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 18/42] net/bnx2x: Don't use eth_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: , X-List-Received-Date: Tue, 11 Apr 2017 15:45:23 -0000 From: Jan Blunck Signed-off-by: Jan Blunck --- drivers/net/bnx2x/bnx2x_ethdev.c | 64 +++++++++++++++++++++++++++------------- drivers/net/bnx2x/bnx2x_rxtx.c | 2 +- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 0e8b4d9..314e5ea 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -12,6 +12,7 @@ #include "bnx2x_rxtx.h" #include +#include /* * The set of PCI devices this driver supports @@ -627,34 +628,57 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev) return bnx2x_common_dev_init(eth_dev, 1); } -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, - }, - .eth_dev_init = eth_bnx2x_dev_init, - .dev_private_size = sizeof(struct bnx2x_softc), +static struct rte_pci_driver rte_bnx2x_pmd; +static struct rte_pci_driver rte_bnx2xvf_pmd; + +static int eth_bnx2x_pci_probe(struct rte_pci_driver *pci_drv, + 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 bnx2x_softc)); + if (!eth_dev) + return -ENOMEM; + + if (pci_drv == &rte_bnx2x_pmd) + ret = eth_bnx2x_dev_init(eth_dev); + else if (pci_drv == &rte_bnx2xvf_pmd) + ret = eth_bnx2xvf_dev_init(eth_dev); + else + ret = -EINVAL; + + if (ret) + rte_eth_dev_pci_release(eth_dev); + + return ret; +} + +static int eth_bnx2x_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, NULL); +} + +static struct rte_pci_driver rte_bnx2x_pmd = { + .id_table = pci_id_bnx2x_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, + .probe = eth_bnx2x_pci_probe, + .remove = eth_bnx2x_pci_remove, }; /* * virtual function driver struct */ -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, - }, - .eth_dev_init = eth_bnx2xvf_dev_init, - .dev_private_size = sizeof(struct bnx2x_softc), +static struct rte_pci_driver rte_bnx2xvf_pmd = { + .id_table = pci_id_bnx2xvf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = eth_bnx2x_pci_probe, + .remove = eth_bnx2x_pci_remove, }; -RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_bnx2x, rte_bnx2x_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_bnx2x, pci_id_bnx2x_map); RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio"); -RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map); RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio"); diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c index adf0309..5dd4aee 100644 --- a/drivers/net/bnx2x/bnx2x_rxtx.c +++ b/drivers/net/bnx2x/bnx2x_rxtx.c @@ -19,7 +19,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name, const struct rte_memzone *mz; snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - dev->driver->pci_drv.driver.name, ring_name, + dev->device->driver->name, ring_name, dev->data->port_id, queue_id); mz = rte_memzone_lookup(z_name); -- 2.1.4