[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 06/13] tap: Drop tap_can_send
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v3 06/13] tap: Drop tap_can_send |
Date: |
Wed, 3 Jun 2015 15:35:18 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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