From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 182F9567C for ; Mon, 6 Mar 2017 11:00:55 +0100 (CET) Received: by mail-wr0-f193.google.com with SMTP id u48so21046234wrc.1 for ; Mon, 06 Mar 2017 02:00:55 -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=YIXE3m93Hc/uca8y0LucdHuiL8Ehy4/8h9/LoRwL6Wc=; b=Ze7hn1E71Zj6eUuLMLo/hA5mhsHtdbXGn0MYkcoohMKsEjjkoUPjKnUQmOVmIQuY/G fmWGPyA+GbdVQOJhKSOtOcWs8/zZMk664VRMnY0Sn07aK7onqtiBhqHt3X/scPA8QUgA rLzflY2mUdJCyqHusnKIfD1jMMvU5FP27iAvAk2ppUr3AbCp+mQNTCoRHMYt3lAZZsTS fhwQa3PkzqIHdpMHoOrzhzJisU7OzvagbIB0SqWI7ZWi5ko/x8pWTgn8gQUi7KvSuAcs z3rjaTnkMNyEmuI4aJS9zdbWADgtpWgABoZqT2Cj/MGhsL7YNDbyt4ph7uiox3VfZTz5 wpGA== 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=YIXE3m93Hc/uca8y0LucdHuiL8Ehy4/8h9/LoRwL6Wc=; b=o56/O1+QrDj6z1ShvMUqeaXdjtAgBl3BraZR1fDkQaRAMs7u4z2BnnAzfztGyjHM9P veaGlMbTpchPntA3xenZVL06Q2KoYR51UDnnxQw2H2uXyLEXBs1r4DiJ2qfXy5fXO3nP 1Cmu7CZYyt9C95VVoYZMheeh60lHGC3+MgV/0byITPFm3QYI+3Ld/GtHPN34z3GJ0GA1 Li/L2LsSAKcKiguOyp7+tPivMM9V0Ifkw0D2B1I7S0hr1VBPk06lyr+cjU+agHeShHJZ Zw1i6ITbGsPuYT2yWJSruwdoUHaLrFR6UW/eQm0YOQ5q3sn0mqXRhG5Hk9lRMSDpaCYg 76EQ== X-Gm-Message-State: AMke39n4UtkJdFMR7VHU/6DWPZo2oHjQglnBTNsOt3p+Zohrh5wr7sGmXn6bZUGoOOEESQ== X-Received: by 10.223.162.205 with SMTP id t13mr14760325wra.155.1488794454051; Mon, 06 Mar 2017 02:00:54 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id u145sm3829237wmu.1.2017.03.06.02.00.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:00:52 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Mon, 6 Mar 2017 11:00:00 +0100 Message-Id: <1488794430-25179-9-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 08/38] net/virtio: use ethdev allocation helper for virtual devices 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:00:55 -0000 Signed-off-by: Jan Blunck --- drivers/net/virtio/virtio_user_ethdev.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 42ad8a2..15e3a93 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -37,6 +37,7 @@ #include #include +#include #include #include "virtio_ethdev.h" @@ -277,27 +278,21 @@ get_integer_arg(const char *key __rte_unused, static struct rte_vdev_driver virtio_user_driver; static struct rte_eth_dev * -virtio_user_eth_dev_alloc(const char *name) +virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev) { struct rte_eth_dev *eth_dev; struct rte_eth_dev_data *data; struct virtio_hw *hw; struct virtio_user_dev *dev; - eth_dev = rte_eth_dev_allocate(name); + eth_dev = rte_eth_vdev_allocate(vdev, sizeof(*hw)); if (!eth_dev) { PMD_INIT_LOG(ERR, "cannot alloc rte_eth_dev"); return NULL; } data = eth_dev->data; - - hw = rte_zmalloc(NULL, sizeof(*hw), 0); - if (!hw) { - PMD_INIT_LOG(ERR, "malloc virtio_hw failed"); - rte_eth_dev_release_port(eth_dev); - return NULL; - } + hw = eth_dev->data->dev_private; dev = rte_zmalloc(NULL, sizeof(*dev), 0); if (!dev) { @@ -313,12 +308,7 @@ virtio_user_eth_dev_alloc(const char *name) hw->modern = 0; hw->use_simple_rxtx = 0; hw->virtio_user_dev = dev; - data->dev_private = hw; - data->drv_name = virtio_user_driver.driver.name; - data->numa_node = SOCKET_ID_ANY; - data->kdrv = RTE_KDRV_NONE; data->dev_flags = RTE_ETH_DEV_DETACHABLE; - eth_dev->driver = NULL; return eth_dev; } @@ -412,7 +402,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) goto end; } - eth_dev = virtio_user_eth_dev_alloc(rte_vdev_device_name(dev)); + eth_dev = virtio_user_eth_dev_alloc(dev); if (!eth_dev) { PMD_INIT_LOG(ERR, "virtio_user fails to alloc device"); goto end; -- 2.7.4