From mboxrd@z Thu Jan 1 00:00:00 1970 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) 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=1VOzsN+Zg9/p7eq6UJ/5k6JHRWTDemrwLQ1Qp9aUAa0=; b=WZIWba5ZcVenjl3nIdqv0CHyBUtNQ0GaEoFhMjp6lEoUNvPIsV6teEy5sZPZLOhNts 98DhhJRcjR5XmDj8JUEuxNbm/cTolNLo+OjDfdWzI2QwRYuuJ8GszcvFCHplzeu4znZS THjFDeuHCZZXuamaIOfwXN9ySNsuqu1ajD/9JtkdNwhjsSiuOru/LWgdwLeHEhROWBWJ r8jqENO8lGMvxYJ1i5FZ4oW2GIQNrD5V6xXfkEAM6MzAbELqTJsI7dc+KwuU7Zp8LXOe Ho0f8ENbpbNGN04qua0Vh1LtpICT7GnEPh+dLfWg8IVaEPeeqo+1VgQSn16Z2bXpROnf Gk0Q== 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=1VOzsN+Zg9/p7eq6UJ/5k6JHRWTDemrwLQ1Qp9aUAa0=; b=ewxJrV6e9Ai0zUog/liTRgbZVUJ9DDQkE33yZyYZ82qMDs7hEDvc8aZbRVK1+WlZIw y2d9PYoSbEw3vAkcsd2LjzAmp/WaZcBl6m27pSbJbrfhxYvjyk2XsRGEwmRiBQQewZC+ geNx6lNSpAqil8qCOZ8w3n25wDHFArnsvFtIDws4aUX36FcwioVM/wjrA6prY/JLf4NY i/kruqp4NnkHgzTG0COpnoKtap3PIwk46YJtvjQmtgFPED17nbSopXe8NWXdbT/972nc SSw8IBt6qN4IhHjq/C1C3wsT4SVa/xgJABjpL2XnrVrUZn+J6uNEMzFaPVYQbWIKFyqR 7kEQ== X-Gm-Message-State: AFeK/H1SbZz10Qtl6244msGbQFn1ASeo5D/O0e7ss538Zv1TbouyGf/sfMdphX8Esgd4JWs+ X-Received: by 10.223.166.108 with SMTP id k99mr28695169wrc.139.1491925540689; Tue, 11 Apr 2017 08:45:40 -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.39 (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:43 +0200 Message-Id: <85df27cc9fd0f5ac7a5244ba8c2755ad616ab527.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 36/42] net/avp: 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:41 -0000 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