From patchwork Mon Feb 18 10:27:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10817749 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 C864F6C2 for ; Mon, 18 Feb 2019 10:37:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0EE728876 for ; Mon, 18 Feb 2019 10:37:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A272A2A16B; Mon, 18 Feb 2019 10:37:27 +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 52EB028876 for ; Mon, 18 Feb 2019 10:37:27 +0000 (UTC) Received: from localhost ([127.0.0.1]:56105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvgIg-0005kx-Lv for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Feb 2019 05:37:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvgAd-0000NC-LP for qemu-devel@nongnu.org; Mon, 18 Feb 2019 05:29:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvgAb-0006Vr-Nl for qemu-devel@nongnu.org; Mon, 18 Feb 2019 05:29:07 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:38214) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gvgAZ-000635-Q3 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 05:29:05 -0500 Received: by mail-pl1-x643.google.com with SMTP id e5so8589403plb.5 for ; Mon, 18 Feb 2019 02:28:19 -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=fLm/BH/x9EPjut9dCwJW/vRxrX0oTbjmSZMDcQDuCqP38VxAvdE3YpShwUUr7cGaBt /q64v51VUqV0Xz1FTwoasdC2WwaWHkkCZKBaNskNk4hYAmhbVuAD/0etPkYpgKbyEJR5 XHx0rhot428S0C5trIB3YDDNKLBWcHPB0SeyPnKwRPaI2u20xniwpCzNWWQWlVVEg7IT yCnsSo0rJ/PpezViuvrbXK3r+ZXo5Wz6kQmItEEfiHyruOYu1JvQMdZY9ZmZSruJJ+u1 0fGJHh7nNHRCaH1J9Wx3sfvapMdJm0tcn7/xbPWIcSV8qGvj5qaspSCKOZ7nisXp3RS2 XSuQ== 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=b36zlHz3b2BLkiswjeSZke51aFKNvFw0icmsn9l1gnvO1XyhlMbueWS98aXzfxOZ3P 5y7J2U8h3n9+dCkltCWgXh4owHQnje0+DKnpgFgmTjOzDcaFODfpvkEYo5S1DOBciaB0 gkoy/r8B09g9rvKobJ5ZX1wiY7FGkWNUeA3W5ro7bqjo8iJKiaQ0EGQxBH8fuzE8IiXn fBueVVmCa9eWZBkMVsOYFXv71rld85XN/GJULCom5vBpalHt7naSDJPqtyYrYLI11Cr7 fZI8voxZ+Z6mYCb7JPQRfdnV0gYD6LsWt8Z/g3Fm+/iFJHDFtSOY5+jD6gKw2PO4Q9dZ uj6Q== X-Gm-Message-State: AHQUAubgCi0BcYumjNohlZhPjkLUZbjchHar8qPW/BML1U8Gaontt/uU +a4qf+C1S3NlpBn+plq3fX0= X-Google-Smtp-Source: AHgI3IalkO2zr1G0wLDaWvcmkZIscQDxZsbEQme8UnjXJek4gTp65MTX49w7aBfxSaTFHj/7VQX7MA== X-Received: by 2002:a17:902:8b82:: with SMTP id ay2mr24325656plb.64.1550485699023; Mon, 18 Feb 2019 02:28:19 -0800 (PST) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id i74sm25764291pfi.33.2019.02.18.02.28.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 02:28:18 -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: Mon, 18 Feb 2019 18:27:43 +0800 Message-Id: <20190218102748.2242-3-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190218102748.2242-1-xieyongji@baidu.com> References: <20190218102748.2242-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::643 Subject: [Qemu-devel] [PATCH v6 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; }