From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jerome.jutteau@outscale.com>
Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com
 [209.85.215.45]) by dpdk.org (Postfix) with ESMTP id EEC925961
 for <dev@dpdk.org>; Mon, 19 Oct 2015 11:45:09 +0200 (CEST)
Received: by lffz202 with SMTP id z202so23394627lff.3
 for <dev@dpdk.org>; Mon, 19 Oct 2015 02:45:09 -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=QF1MhjpoKvL6F5uHB4cifzdCOGM6FgBtStyH8NIeBnY=;
 b=K3/ZEtW1FyOvd3xe57iMBPlRGbVsvojjQgfd3cMLFBMRgwvJuo8PNBM+THThetHGrX
 2nE+erK5sl6E5eZbUNpcnuqcg7tdYpKMyYMAk6oTJTtkS3euqiRwgy+sref7+I018rHI
 KzffHBXIpQPhFn0QoFmbxbdIR9TQUO56XueFlO46nY9ACoDL/YK9DSId5+79TiFPi0nU
 HbQ9Tmp28LBBZAkEro5dfj/MuLS2kmdblrXmDIOiAQoUHtEyD5Y3NP13zxbhzLK3Y18V
 U4vreYFGM19jpj98BiC6GNyA2evA0ip4Kw2R5N6vFnp9p8sPfectekvo96yAZp4SjqvA
 0S7g==
X-Gm-Message-State: ALoCoQlf1tSc/JGl7BCNQqRd9Bd8103M+7hWfor2euLFRIJq32Js8PM3+yWPcQ3/nXq0vOt4+GaM
X-Received: by 10.180.86.129 with SMTP id p1mr20255503wiz.83.1445247909682;
 Mon, 19 Oct 2015 02:45:09 -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.08
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 19 Oct 2015 02:45:09 -0700 (PDT)
From: Jerome Jutteau <jerome.jutteau@outscale.com>
To: dev@dpdk.org
Date: Mon, 19 Oct 2015 11:44:26 +0200
Message-Id: <1445247869-713-2-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 1/4] vhost: avoid device identifier to be
	reset to 0 in reset_owner
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Oct 2015 09:45:10 -0000

virtio-net clean and init device after a VHOST_USER_RESET_OWNER.
This reset device identifier to 0 and break ll_root listing logic.
This patch keep the old device identifier and re-write it on the cleaned
device.

Signed-off-by: Jerome Jutteau <jerome.jutteau@outscale.com>
---
 lib/librte_vhost/virtio-net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index d0f1764..955a29d 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -399,11 +399,14 @@ static int
 reset_owner(struct vhost_device_ctx ctx)
 {
 	struct virtio_net_config_ll *ll_dev;
+	uint64_t device_fh;
 
 	ll_dev = get_config_ll_entry(ctx);
+	device_fh = ll_dev->dev.device_fh;
 
 	cleanup_device(&ll_dev->dev);
 	init_device(&ll_dev->dev);
+	ll_dev->dev.device_fh = device_fh;
 
 	return 0;
 }
-- 
jerome