From patchwork Mon Dec 4 14:08:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 31909 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C90307CE5; Mon, 4 Dec 2017 15:09:23 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id AA21F7CE5 for ; Mon, 4 Dec 2017 15:09:22 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E1A915565; Mon, 4 Dec 2017 14:09:22 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB00865E8B; Mon, 4 Dec 2017 14:09:15 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, yliu@fridaylinux.org, tiwei.bie@intel.com, jianfeng.tan@intel.com Cc: lprosek@redhat.com, lersek@redhat.com, Maxime Coquelin Date: Mon, 4 Dec 2017 15:08:58 +0100 Message-Id: <20171204140900.7906-3-maxime.coquelin@redhat.com> In-Reply-To: <20171204140900.7906-1-maxime.coquelin@redhat.com> References: <20171204140900.7906-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 04 Dec 2017 14:09:22 +0000 (UTC) Subject: [dpdk-dev] [PATCH 2/4] vhost: propagate VHOST_USER_SET_FEATURES handling error 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Not propagating VHOST_USER_SET_FEATURES request handling error may result in unpredictable behavior, as host and guests features may no more be synchronized. This patch fixes this by reporting the error to the upper layer, which would result in the device being destroyed and the connection with the master to be closed. Signed-off-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index f51055ab2..7d84af3e2 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1263,7 +1263,9 @@ vhost_user_msg_handler(int vid, int fd) send_vhost_reply(fd, &msg); break; case VHOST_USER_SET_FEATURES: - vhost_user_set_features(dev, msg.payload.u64); + ret = vhost_user_set_features(dev, msg.payload.u64); + if (ret) + return -1; break; case VHOST_USER_GET_PROTOCOL_FEATURES: