From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) by dpdk.org (Postfix) with ESMTP id 4095FD412 for ; Tue, 11 Apr 2017 17:45:42 +0200 (CEST) Received: by mail-wr0-f170.google.com with SMTP id c55so665087wrc.3 for ; Tue, 11 Apr 2017 08:45:42 -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=7Jd+ud96B1YBlMBPg2uvVguc+UhxAJHAd4fc6A+n6so=; b=lzu9GzBmBrFTdPi3wnAfo2F6+p+bLaNflJX/qHDWD4qWAfkmmnM9ksJqrDsxG3KODz fJ78uoJ84A9nX7YGiEi5kmW0w4RJD+U5KakQ1TQVITKB5p3kSlT4n1vdWf+3yc5zd5n4 z/LX7IFPG7tJJK1aQ4wZTG3jHteeVL+r5jsLt4VkqJXHf4fpa1waYPKeeFCcugQaM1VY caer2AnzDX+x38InwkDzZv36DW1lEy1keWG507nkDv9T4kjOHmLHdMiIYM+vb3gUodGw yPdwZUGv3SGhQq9cQvIauvU1TcGnvaRC8znmvFYbnxve65a3UAq7MYZCtiziUfWQB96y IWcw== 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=7Jd+ud96B1YBlMBPg2uvVguc+UhxAJHAd4fc6A+n6so=; b=hdwfnPNixTNtVeWWAO/dmzg4D5Qu6T8/lSTvlGSObEfdA6uE0O2e2x/kRUdOgjILU8 eJntv9FDFLQzxxla2rq6CNmrQIckeCfZfXadwk7ij/NjG3HDbYLBUpVFSi7NDFbiVelz qd6+SWaOxOI20IXvgsUXj/UMFbiIRHlorovy+fELvfaZg3GPULkBYbwTx6xDPl98j+uQ nIVAaTu+JWozwMkOtBg2pKikPmPtyDqftozA5RPTssTbKBIwlgVXEzR91MuPbqI80Uxy Ns1OcQam1iOY652lvwhEUCuPnwd1FtIzMDo8yHjY+4eYH7f8CT37d6NVWltRKK81Zla7 HhHg== X-Gm-Message-State: AFeK/H3MzHRMbFT3ad+ZrrNyW+Uu2B5INXVewhM8dsVvVNeU4Oz7za4KGH+msGRrmhbqPg4c X-Received: by 10.223.160.239 with SMTP id n44mr55017581wrn.198.1491925541773; Tue, 11 Apr 2017 08:45:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:45:40 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:44 +0200 Message-Id: <9174e2c6b3ecfed77fae020050928eba48004a3f.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 37/42] net/liquidio: 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:42 -0000 Signed-off-by: Gaetan Rivet --- drivers/net/liquidio/lio_ethdev.c | 44 +++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index df91659..4edb0d1 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -2011,24 +2012,45 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev) return 0; } +static int +lio_eth_dev_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 lio_device)); + if (eth_dev == NULL) + return -ENOMEM; + + ret = lio_eth_dev_init(eth_dev); + if (ret) + rte_eth_dev_pci_release(eth_dev); + + return ret; +} + +static int +lio_eth_dev_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, + lio_eth_dev_uninit); +} + /* Set of PCI devices this driver supports */ static const struct rte_pci_id pci_id_liovf_map[] = { { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_VF_VID) }, { .vendor_id = 0, /* sentinel */ } }; -static struct eth_driver rte_liovf_pmd = { - .pci_drv = { - .id_table = pci_id_liovf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - }, - .eth_dev_init = lio_eth_dev_init, - .eth_dev_uninit = lio_eth_dev_uninit, - .dev_private_size = sizeof(struct lio_device), +static struct rte_pci_driver rte_liovf_pmd = { + .id_table = pci_id_liovf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = lio_eth_dev_pci_probe, + .remove = lio_eth_dev_pci_remove, }; -RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map); RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio"); -- 2.1.4