Received: from eggs.gnu.org ([2001:4830:134:3::10]:35930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzowg-0001TC-7R for qemu-devel@nongnu.org; Tue, 02 Jun 2015 12:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzowc-0004RB-9w for qemu-devel@nongnu.org; Tue, 02 Jun 2015 12:21:42 -0400 Date: Tue, 2 Jun 2015 17:21:34 +0100 From: Stefan Hajnoczi Message-ID: <20150602162134.GF8199@stefanha-thinkpad.redhat.com> References: <1432032670-15124-1-git-send-email-famz@redhat.com> <1432032670-15124-7-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="L2Brqb15TUChFOBK" Content-Disposition: inline In-Reply-To: <1432032670-15124-7-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 06/13] tap: Drop tap_can_send List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, Juan Quintela , Jason Wang , qemu-devel@nongnu.org, Vincenzo Maffione , "Vassili Karpov (malc)" , Gerd Hoffmann , Stefan Hajnoczi , Amit Shah , Paolo Bonzini , Giuseppe Lettieri , Luigi Rizzo --L2Brqb15TUChFOBK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 19, 2015 at 10:51:03AM +0000, Fam Zheng wrote: > - while (qemu_can_send_packet(&s->nc)) { > + while (true) { > + bool can_send; > uint8_t *buf =3D s->buf; > =20 > + can_send =3D qemu_can_send_packet(&s->nc); > + > size =3D tap_read_packet(s->fd, s->buf, sizeof(s->buf)); > if (size <=3D 0) { > break; > @@ -204,8 +198,12 @@ static void tap_send(void *opaque) > size -=3D s->host_vnet_hdr_len; > } > =20 > + /* If !can_send, we will want to disable the read poll, but we s= till > + * need the send completion callback to enable it again, which i= s a > + * sign of peer becoming ready. So call the send function anywa= y. > + */ > size =3D qemu_send_packet_async(&s->nc, buf, size, tap_send_comp= leted); > - if (size =3D=3D 0) { > + if (size =3D=3D 0 || !can_send) { > tap_read_poll(s, false); > break; > } else if (size < 0) { Why is can_send necessary here but not for the other netdevs that you converted? I thought relying on size =3D=3D 0 is enough. --L2Brqb15TUChFOBK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVbdgOAAoJEJykq7OBq3PIIqMH/1Kdlffq7SLAQdNCxGl3bb6S fmX/HIDcVEF+Kl4EPn0VkX40ha6DMGVT1cu2SEk6vJNAr7MOjL397IQlPykRTJwF pyShvb68tevNxjoQrMwg6JCCaMGGuORAvYAAg3OT1RDcB59ugQx86dfpfBiovOcf gbT0ika894+rrblkF8g77Uc1ZGpChlNDVLiizFpw4w+xPGP9zEi1KweIPrEZH5q8 NnH6ROJGY9wvhfcBCJWhj7dWqh8lzqxntdHROx+gzixj+Ec3TLIyF8PrFVk6IgaG yDciRDh98UE/fj/dTfJ7AM9Y7I4b9YqMWcLaDBUwPK58Ycua/iCmBBt635XSg8g= =ITtx -----END PGP SIGNATURE----- --L2Brqb15TUChFOBK--