From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QjzjU-000827-7x for garchives@archives.gentoo.org; Thu, 21 Jul 2011 20:20:32 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9AA821C42B; Thu, 21 Jul 2011 20:19:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AF64C21C42B for ; Thu, 21 Jul 2011 20:19:49 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6023F1B4016 for ; Thu, 21 Jul 2011 20:19:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C9D908003D for ; Thu, 21 Jul 2011 20:19:48 +0000 (UTC) From: "Doug Goldstein" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Doug Goldstein" Message-ID: <4d2c1d53b9ca086ea9c583581684a84b889e6469.cardoe@gentoo> Subject: [gentoo-commits] proj/qemu-kvm:qemu-kvm-0.14.1-gentoo commit in: / X-VCS-Repository: proj/qemu-kvm X-VCS-Files: spice-qemu-char.c X-VCS-Directories: / X-VCS-Committer: cardoe X-VCS-Committer-Name: Doug Goldstein X-VCS-Revision: 4d2c1d53b9ca086ea9c583581684a84b889e6469 Date: Thu, 21 Jul 2011 20:19:48 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: cc04fa03d352cf3d37f2bca7cf75cfd2 commit: 4d2c1d53b9ca086ea9c583581684a84b889e6469 Author: Hans de Goede redhat com> AuthorDate: Tue Mar 22 15:28:41 2011 +0000 Commit: Doug Goldstein gentoo org> CommitDate: Thu Jul 21 20:19:02 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/qemu-kvm.git;= a=3Dcommit;h=3D4d2c1d53 spice-qemu-char: Fix flow control in client -> guest direction In the old spice-vmc device we used to have: last_out =3D virtio_serial_write(&svc->port, p, MIN(len, VMC_MAX_HOST_WRI= TE)); if (last_out > 0) ... Now in the chardev backend we have: last_out =3D MIN(len, VMC_MAX_HOST_WRITE); qemu_chr_read(scd->chr, p, last_out); if (last_out > 0) { ... Which causes us to no longer detect if the virtio port is not ready to receive data from us. chardev actually has a mechanism to detect this, but it requires a separate call to qemu_chr_can_read, before calling qemu_chr_read (which return void). This patch uses qemu_chr_can_read to fix the flow control from client to guest. Signed-off-by: Hans de Goede redhat.com> --- spice-qemu-char.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 343146c..def713a 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -38,14 +38,13 @@ static int vmc_write(SpiceCharDeviceInstance *sin, co= nst uint8_t *buf, int len) =20 while (len > 0) { last_out =3D MIN(len, VMC_MAX_HOST_WRITE); - qemu_chr_read(scd->chr, p, last_out); - if (last_out > 0) { - out +=3D last_out; - len -=3D last_out; - p +=3D last_out; - } else { + if (qemu_chr_can_read(scd->chr) < last_out) { break; } + qemu_chr_read(scd->chr, p, last_out); + out +=3D last_out; + len -=3D last_out; + p +=3D last_out; } =20 dprintf(scd, 3, "%s: %lu/%zd\n", __func__, out, len + out);