From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 2B4CAD21F for ; Tue, 11 Apr 2017 17:45:11 +0200 (CEST) Received: by mail-wm0-f46.google.com with SMTP id t189so4284921wmt.1 for ; Tue, 11 Apr 2017 08:45:11 -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=t6KaCMV7Ja/A6dkXFF0blxjP1WpYyPkFyGmifIdu6GM=; b=SYTpQyBYjJ7LaQukvh7q8LT9xEmw9X2rvAVcvwp8j1gyyYC/3RJITQGXbWqTy60CtN V1dMKYC4iJn6s2F8FiAkDVR686MysvI/3sKh2Fh6l+XNGChalkWyKCIOfM/uUdmi6zlh U73Dbs5+1DZ/k8LtHvYOHywduPJH2bSJE10vnSY4KPQ3kRB36lJwq0ZM3kV8at/HF/cl nDzYGqCqgtaCTVMh+2+eJ5QrN092+hAuYH6cxehL8ijkaln4LrZvVpnEB05OkmMYryu2 z3L+SnwyJCrwNl71znpBq9aa3n0/WOcfXsTn9tYPMvxI4qgzGnF92lHVmkvL0186/+DU CuyQ== 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=t6KaCMV7Ja/A6dkXFF0blxjP1WpYyPkFyGmifIdu6GM=; b=JpazmXruukaqynDdexcs9s7I7ggTv7qGX4VJvv4AnGUAKe8Gcqh6IrhqXsiv+rXSF3 CUkhLu5gxbQ9mg8TepHHytkB+0Uafp2WymynsknwPH1zMyW8CmmnZGZsCmcdszZJzqUE 87HgaHLRFDtySGwejxkbWma2dCUY4w/8LIzYhHLQcF0V1HRmRiLYxvtL0CD65CIDadnp KNESIQECAqLLn9h7fvXLpmew/SbK8ACgVc6k9TUcXgqMbq4p5T5umxzklI50VLjnaoc5 /b7u6gJ38ZZOzLLmD0VhSXmBXjWYErQkCjRjifSN7XQRGjLlnzUB/wsxhcUTiADlY8UH GGMA== X-Gm-Message-State: AN3rC/4NWyEi2iFhdyifpZCShUv5G7MUuOwkwneAWBuSJqOHSvcym0JX LowYR/NVV/PF6+Te X-Received: by 10.28.186.8 with SMTP id k8mr9434895wmf.1.1491925510923; Tue, 11 Apr 2017 08:45:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:45:09 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:14 +0200 Message-Id: <8c204a365a0c49d70a11eed10022a4d6f2ce93a5.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 07/42] 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: Tue, 11 Apr 2017 15:45:11 -0000 From: Jan Blunck 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 46276ee..361841a 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -336,27 +337,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) { @@ -377,12 +372,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; } @@ -500,7 +490,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.1.4