From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by dpdk.org (Postfix) with ESMTP id 41A428E9E for ; Mon, 19 Oct 2015 11:45:31 +0200 (CEST) Received: by lffz202 with SMTP id z202so23410319lff.3 for ; Mon, 19 Oct 2015 02:45:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RqUE35lyIgEoFFuKWVKdP0T+dD8ENuXDswCxrbXrofA=; b=bGi01xNJvnFjV4o2v6wPcgCInXosTTi0kQhQZpqio2338aObPdM6Kehk6EVS9JvIjw ZhqnSurzSZi4JXRxmlgyC5WwA3f2x9k/n7Hxq1LMoS+boXGj2IbzJkE+2uqGUzQ7Ohj9 /DUX+y/UlHmRzjrZecXQbGnN/6FKmMAw9CBBHrH+tl2xHYjw9qgCROP6B2D0leMIDZlJ BgMv188b/lxCXB59DyOSYI2Nj5cQddkrK8KlSLuWwc2zmWtsUcJRpdg8BrS1lByZupGi XLQp+XNw0mNTQ9YnmM4DJshtheXC7+76cTRlbHxwbbNDJBWnFLaHVfTTfaVfQZ34pQiB ZZuQ== X-Gm-Message-State: ALoCoQkkNRfuzhwwNlD1C/tQ3QD6UR4db1SFe6JQW2dHw9VG+RhiO5asGEvEkJOLMN1RmXBfWW2l X-Received: by 10.180.93.133 with SMTP id cu5mr18418004wib.49.1445247930959; Mon, 19 Oct 2015 02:45:30 -0700 (PDT) Received: from localhost.localdomain (ows-185-21-195-233.eu-west-1.compute.outscale.com. [185.21.195.233]) by smtp.gmail.com with ESMTPSA id xt1sm39011197wjb.32.2015.10.19.02.45.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 02:45:30 -0700 (PDT) From: Jerome Jutteau To: dev@dpdk.org Date: Mon, 19 Oct 2015 11:44:29 +0200 Message-Id: <1445247869-713-5-git-send-email-jerome.jutteau@outscale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1445247869-713-1-git-send-email-jerome.jutteau@outscale.com> References: <1445247869-713-1-git-send-email-jerome.jutteau@outscale.com> Subject: [dpdk-dev] [PATCH v2 4/4] vhost: change method to get device in reset_owner X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 09:45:31 -0000 Using get_config_ll_entry in reset_owner don't show any error when the device is not found. This patch fix this by using get_device instead instead of get_config_ll_entry. Signed-off-by: Jerome Jutteau --- lib/librte_vhost/virtio-net.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index ec6a575..a6ab245 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -398,18 +398,17 @@ set_owner(struct vhost_device_ctx ctx) static int reset_owner(struct vhost_device_ctx ctx) { - struct virtio_net_config_ll *ll_dev; + struct virtio_net *dev; uint64_t device_fh; - ll_dev = get_config_ll_entry(ctx); - if (ll_dev == NULL) + dev = get_device(ctx); + if (dev == NULL) return -1; - device_fh = ll_dev->dev.device_fh; - - cleanup_device(&ll_dev->dev); - init_device(&ll_dev->dev); - ll_dev->dev.device_fh = device_fh; + device_fh = dev->device_fh; + cleanup_device(dev); + init_device(dev); + dev->device_fh = device_fh; return 0; } -- jerome