From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z03D3-0006h2-K3 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 03:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z03Cz-00067k-L6 for qemu-devel@nongnu.org; Wed, 03 Jun 2015 03:35:33 -0400 Date: Wed, 3 Jun 2015 15:35:18 +0800 From: Fam Zheng Message-ID: <20150603073518.GG1533@ad.nay.redhat.com> References: <1432032670-15124-1-git-send-email-famz@redhat.com> <1432032670-15124-7-git-send-email-famz@redhat.com> <20150602162134.GF8199@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150602162134.GF8199@stefanha-thinkpad.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: Stefan Hajnoczi 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 On Tue, 06/02 17:21, Stefan Hajnoczi wrote: > 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 = s->buf; > > > > + can_send = qemu_can_send_packet(&s->nc); > > + > > size = tap_read_packet(s->fd, s->buf, sizeof(s->buf)); > > if (size <= 0) { > > break; > > @@ -204,8 +198,12 @@ static void tap_send(void *opaque) > > size -= s->host_vnet_hdr_len; > > } > > > > + /* If !can_send, we will want to disable the read poll, but we still > > + * need the send completion callback to enable it again, which is a > > + * sign of peer becoming ready. So call the send function anyway. > > + */ > > size = qemu_send_packet_async(&s->nc, buf, size, tap_send_completed); > > - if (size == 0) { > > + if (size == 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 == 0 is enough. I think so. Jason pointed out this offline as well. I'll drop it. Fam