From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 58D0E567F for ; Mon, 6 Mar 2017 11:01:04 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id u48so21046648wrc.1 for ; Mon, 06 Mar 2017 02:01:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Rp3X50p8KUURAVa2OutWHTjVZXpyUMOWnZMrLcSoxFQ=; b=npOLyPa7S0tV3THd8sm2mQxOqOIwlq4dF3C77ecR8WEZomjTmSpNu87QvEhgdR8om1 MyV8TqThyydJxg9oqwWTuZq8e8fbsrwitfLL9LSsB3mW/VrSYxeJ65flif9PWnuzsevJ 2L/tDZ8UED5X2+3wnsdXz7A9ebCDnJS4TfkHTI+fN4tMmAiNTnBDltWhGJKllrnVzPvB hvEEAIt3/5XtYd6tnXM43pCTywCNIn6mGg1vL4GNwJmfQlZxQotVxozY56CZIGGgGzZ6 uj0yxtI1tsZiGj90j2MUwxUW2MuTWJwVrjdem3+CGSzcnkyCtnr99LTEWJC1tI6Q8q4H ToKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Rp3X50p8KUURAVa2OutWHTjVZXpyUMOWnZMrLcSoxFQ=; b=N3efUHoec/fKKya3LjgFRTxNBa6/uXBCN2i/xwc7kTr9034v56I0fAVPS9d9CtfilF /ldP/HoIKNncxuCQQIge7HokIDe7JPwhlribHBRbbvGEMz6cqAUj/g2ZzsJDk5G77NrT iTl7hKpVl12ZfCoaal1PqNC12Z4g70VtDH1Pi/ge0kTlu6nLbU9Wi0Vkhu9b7T+VE3BX 1LR8f0c8JTP4lmM4J6kcgaIf8LijHPWfgjpZksDebsDhm+LU8IftnaTQGBGqyL/1boD7 mGL1uiEcR2dm6RKCKV8sje2h5yjH1T5HhcBV0vJxyfuFGFqDNtK+fZIit7PGuTwTSt4Y J5fQ== X-Gm-Message-State: AMke39kxtqtji/Wf1rLfI+uFkEvIX5zrNVotM/kzN0C2xennFuS50i9QPow3uVEIDhKiSQ== X-Received: by 10.223.165.138 with SMTP id g10mr14316956wrc.105.1488794463858; Mon, 06 Mar 2017 02:01:03 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id u145sm3829237wmu.1.2017.03.06.02.01.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:01:03 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Mon, 6 Mar 2017 11:00:09 +0100 Message-Id: <1488794430-25179-18-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488794430-25179-1-git-send-email-jblunck@infradead.org> References: <1488794430-25179-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH 17/38] 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: Mon, 06 Mar 2017 10:01:04 -0000 Signed-off-by: Jan Blunck --- drivers/net/bnx2x/bnx2x_ethdev.c | 64 +++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index a0b0dfa..e295951 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 @@ -626,34 +627,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"); -- 2.7.4