From patchwork Thu Feb 28 08:53:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10832693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7E0C1390 for ; Thu, 28 Feb 2019 08:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9EE42E40C for ; Thu, 28 Feb 2019 08:56:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C80CC2E412; Thu, 28 Feb 2019 08:56:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 732E42E41C for ; Thu, 28 Feb 2019 08:56:31 +0000 (UTC) Received: from localhost ([127.0.0.1]:34537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzHUU-0001k5-Nn for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Feb 2019 03:56:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzHT3-0000RV-64 for qemu-devel@nongnu.org; Thu, 28 Feb 2019 03:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzHT0-0004Kx-T0 for qemu-devel@nongnu.org; Thu, 28 Feb 2019 03:55:01 -0500 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:34246) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzHSy-0004IO-Tj for qemu-devel@nongnu.org; Thu, 28 Feb 2019 03:54:57 -0500 Received: by mail-pg1-x541.google.com with SMTP id i130so9401421pgd.1 for ; Thu, 28 Feb 2019 00:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fiHcsz3JHZWGauGOQSLwZCLApSBpe9h6n5kwPgJaYQs=; b=NQrKywctyPxQBJoGoQZVpN1+y1G+3GMRb517+KuvtugVjeBwj/qmiUvNDzanZOc4RU xjWE/9Q78quCDs1zXtCPTu68JfUDq+4Ti5E5RMio8LCHV9wNgIDsD4sLtLv3kknaXY3P pUliAzwR59Qi+4h5T7VOAhznnRD+9KCbz+3ufDTYK72z/akLhmt0gjGfBLcOM/O92FIt JxpkicWJqK61KQKFxW9nb4R/oIIrPOHW+a8Gm29q1Fy4skN8qx0cbnW3mpO4r9T34mYd kmq/ICe1b+6qZJWezfylSwdgV9WG7ewSgG8gYtxLAjVKnGSpu4NUWq3q2Ja9/q+D3tm7 yLLw== 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; bh=fiHcsz3JHZWGauGOQSLwZCLApSBpe9h6n5kwPgJaYQs=; b=E7OvPNwHUhhTPzNLS9ynPodP9uE0tgpa4/89mi6FfW1gFOqM+cTYrB4OIDJxuLg1Ar oRL7iTpFMtgveDN2fUib/0kXh/I9uIVYi5k8emcWixifnBFySHYT4rr6lIL8lIoU2snI 0Ran5fMLJ1Hp0PH9oH0lj4UjEZipNdO0dQSyoQN1iOmdaWIw+cT0dPcKunXU+X6q04Kj tSrNbkcAgmNQ8dAIop4gWqxNLglMGC7AwNg+FY5vyNzMWec5QvEv7aG8nXbdxK0FOdqP HHlFgk3/ulUAUCoQ4RuFe55CAWHitKbDcM8JSmV6LQCcQiPJt8B6NjUdGCy2h+gNjGAW wMlg== X-Gm-Message-State: AHQUAuZNpnilKq37BQpTql84L6UCbq0iMjXUcrOoMCatV/v4M1O4nPZS WKD1pS185swAtoD92Rxi+MU= X-Google-Smtp-Source: AHgI3IYmBdiKQo17GhXWsuPOsUav8yxbwX9WZFlBAiogcsNUBKxCv3klvPzhHgU2AmK9+1pU4DF7zg== X-Received: by 2002:a63:6a48:: with SMTP id f69mr7272696pgc.7.1551344086412; Thu, 28 Feb 2019 00:54:46 -0800 (PST) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id b197sm35419648pga.89.2019.02.28.00.54.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 00:54:46 -0800 (PST) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru Date: Thu, 28 Feb 2019 16:53:50 +0800 Message-Id: <20190228085355.9614-3-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228085355.9614-1-xieyongji@baidu.com> References: <20190228085355.9614-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH v7 2/7] libvhost-user: Remove unnecessary FD flag check for event file descriptors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji The vu_check_queue_msg_file() has checked the FD flag. So let's delete the redundant check after it. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- contrib/libvhost-user/libvhost-user.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index 3f14b4138b..16fec3a3fd 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -907,10 +907,8 @@ vu_set_vring_kick_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].kick_fd = -1; } - if (!(vmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)) { - dev->vq[index].kick_fd = vmsg->fds[0]; - DPRINT("Got kick_fd: %d for vq: %d\n", vmsg->fds[0], index); - } + dev->vq[index].kick_fd = vmsg->fds[0]; + DPRINT("Got kick_fd: %d for vq: %d\n", vmsg->fds[0], index); dev->vq[index].started = true; if (dev->iface->queue_set_started) { @@ -995,9 +993,7 @@ vu_set_vring_call_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].call_fd = -1; } - if (!(vmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)) { - dev->vq[index].call_fd = vmsg->fds[0]; - } + dev->vq[index].call_fd = vmsg->fds[0]; DPRINT("Got call_fd: %d for vq: %d\n", vmsg->fds[0], index); @@ -1020,9 +1016,7 @@ vu_set_vring_err_exec(VuDev *dev, VhostUserMsg *vmsg) dev->vq[index].err_fd = -1; } - if (!(vmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK)) { - dev->vq[index].err_fd = vmsg->fds[0]; - } + dev->vq[index].err_fd = vmsg->fds[0]; return false; }