From patchwork Tue Oct 16 12:27:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Zhang X-Patchwork-Id: 46891 X-Patchwork-Delegate: maxime.coquelin@redhat.com 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 2FACD5F12; Tue, 16 Oct 2018 14:27:22 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id A00B65B32 for ; Tue, 16 Oct 2018 14:27:20 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2018 05:27:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,388,1534834800"; d="scan'208";a="83006005" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga006.jf.intel.com with ESMTP; 16 Oct 2018 05:27:18 -0700 From: Fan Zhang To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, nicknickolaev@gmail.com Date: Tue, 16 Oct 2018 13:27:17 +0100 Message-Id: <20181016122717.66948-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] lib/rte_vhost: fix message handling 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" This patch fixes the bugs introduced by the message handling rework patch. Previously some "get" message handlers did not have correct return and one if statement was wrong. Fixes: 2f270595c05d ("vhost: rework message handling as a callback array") Cc: nicknickolaev@gmail.com Signed-off-by: Fan Zhang --- lib/librte_vhost/vhost_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 7ef3fb4a4..ac2912990 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1161,7 +1161,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev, msg->size = sizeof(msg->payload.state); - return VH_RESULT_OK; + return VH_RESULT_REPLY; } /* @@ -1218,7 +1218,7 @@ vhost_user_get_protocol_features(struct virtio_net **pdev, msg->payload.u64 = protocol_features; msg->size = sizeof(msg->payload.u64); - return VH_RESULT_OK; + return VH_RESULT_REPLY; } static int @@ -1803,7 +1803,7 @@ vhost_user_msg_handler(int vid, int fd) msg.payload.u64 = !!ret; msg.size = sizeof(msg.payload.u64); send_vhost_reply(fd, &msg); - } else if (ret) { + } else if (ret < 0) { RTE_LOG(ERR, VHOST_CONFIG, "vhost message handling failed.\n"); return -1;