From patchwork Sun Feb 14 17:17:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 8302391 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0EF37C02AE for ; Sun, 14 Feb 2016 17:17:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 753B9203C0 for ; Sun, 14 Feb 2016 17:17:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1E8A2039E for ; Sun, 14 Feb 2016 17:17:37 +0000 (UTC) Received: from localhost ([::1]:52192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0Ij-0006r4-3R for patchwork-qemu-devel@patchwork.kernel.org; Sun, 14 Feb 2016 12:17:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0IX-0006pI-KR for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aV0IU-000349-QC for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:25 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35979) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0IU-000345-Jv for qemu-devel@nongnu.org; Sun, 14 Feb 2016 12:17:22 -0500 Received: by mail-wm0-x242.google.com with SMTP id a4so6818646wme.3 for ; Sun, 14 Feb 2016 09:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=l48Fla5cxXwRlWGEvLVpO6hL9KetdfBRSU9KPogFf3c=; b=h4lTc+OFB5wZ5LrXBsmhrFXNQHoe/3lhg07psVKJxUNc5fLqMz7RN1OkNR7ws7YVMR 0wlLwzOQ6hdQMgUsRc5p6RB07eUaBebp719sEZKY8VZnYbo9dX5mLWl7Cbynq65iLtab rxEkfBG4I73xT+VO09gqHgkqvaPe4yKhVWJQEQdif6xuUC7bHS5qADhaBPfhQxZPK0cq Qlawagt/d0P/wvp29YIILNXZ5UlRX8w1mFVlShFsRXJCrVc7Pwj/yoTVOFTqkEmOR59+ 4i3hU8jTDhl0/sOzsrEKT+aKG/b0SqLbawE93wVT9Z2bukrhgsK55nzEmSBuArVkLWzk vjwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=l48Fla5cxXwRlWGEvLVpO6hL9KetdfBRSU9KPogFf3c=; b=f3Wj8cliyqtvTpmSgB+edwgXUQKAfPVYtQerCMfTsUaWhZJKz4xzwimQS1H5RecD0P wu9tv9dNrnwvJOQx7Nx4YoydVtHsuj+6WWHBxQaQeBfHkS5TAYR3IDrDP12CnKYEZaXf cb87p0Co14YcZxF87T6JEXyDp4JKNWp5roO7pRgByKI4Gzpe+rfMXnPIwKfHQxlNA/Sm /WdVfkZ55KxgiFzk6hKV6iIgVKWNPfPxA0jj920Vnzj/BjAG9txlF7EFsi83SWGU8Vac gJtzJEZLuSpIcWGuASENxA0wdcgVjXoqEqQyGZQXfetOJRK83EstNeKKFIgK2qewAOKt u4kg== X-Gm-Message-State: AG10YOSIBRVxOojghbRZCRKd3JreM8yARIlN42MvGWJ179fv7Pk4g2beJ9juweU6MIXpLg== X-Received: by 10.194.76.72 with SMTP id i8mr11702688wjw.117.1455470242050; Sun, 14 Feb 2016 09:17:22 -0800 (PST) Received: from donizetti.lan (94-39-152-251.adsl-ull.clienti.tiscali.it. [94.39.152.251]) by smtp.gmail.com with ESMTPSA id ko2sm21426149wjc.9.2016.02.14.09.17.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Feb 2016 09:17:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 14 Feb 2016 18:17:05 +0100 Message-Id: <1455470231-5223-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> References: <1455470231-5223-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Cc: stefanha@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 2/8] vring: make vring_enable_notification return void X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make the API more similar to the regular virtqueue API. This will help when modifying the code to not use vring.c anymore. Signed-off-by: Paolo Bonzini Acked-by: Cornelia Huck Reviewed-by: Fam Zheng --- hw/block/dataplane/virtio-blk.c | 3 ++- hw/virtio/dataplane/vring.c | 3 +-- include/hw/virtio/dataplane/vring.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 0d99781..03b81bc 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -128,7 +128,8 @@ static void handle_notify(EventNotifier *e) /* Re-enable guest->host notifies and stop processing the vring. * But if the guest has snuck in more descriptors, keep processing. */ - if (vring_enable_notification(s->vdev, &s->vring)) { + vring_enable_notification(s->vdev, &s->vring); + if (!vring_more_avail(s->vdev, &s->vring)) { break; } } else { /* fatal error */ diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 4308d9f..157e8b8 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -175,7 +175,7 @@ void vring_disable_notification(VirtIODevice *vdev, Vring *vring) * * Return true if the vring is empty, false if there are more requests. */ -bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) +void vring_enable_notification(VirtIODevice *vdev, Vring *vring) { if (virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(&vring->vr) = vring->vr.avail->idx; @@ -183,7 +183,6 @@ bool vring_enable_notification(VirtIODevice *vdev, Vring *vring) vring_clear_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } smp_mb(); /* ensure update is seen before reading avail_idx */ - return !vring_more_avail(vdev, vring); } /* This is stolen from linux/drivers/vhost/vhost.c:vhost_notify() */ diff --git a/include/hw/virtio/dataplane/vring.h b/include/hw/virtio/dataplane/vring.h index e80985e..e1c2a65 100644 --- a/include/hw/virtio/dataplane/vring.h +++ b/include/hw/virtio/dataplane/vring.h @@ -42,7 +42,7 @@ static inline void vring_set_broken(Vring *vring) bool vring_setup(Vring *vring, VirtIODevice *vdev, int n); void vring_teardown(Vring *vring, VirtIODevice *vdev, int n); void vring_disable_notification(VirtIODevice *vdev, Vring *vring); -bool vring_enable_notification(VirtIODevice *vdev, Vring *vring); +void vring_enable_notification(VirtIODevice *vdev, Vring *vring); bool vring_should_notify(VirtIODevice *vdev, Vring *vring); void *vring_pop(VirtIODevice *vdev, Vring *vring, size_t sz); void vring_push(VirtIODevice *vdev, Vring *vring, VirtQueueElement *elem,