diff options
-rw-r--r-- | net/tap.c | 29 |
1 files changed, 13 insertions, 16 deletions
@@ -188,26 +188,23 @@ static void tap_send_completed(VLANClientState *vc, ssize_t len) static void tap_send(void *opaque) { TAPState *s = opaque; + uint8_t *buf = s->buf; int size; - do { - uint8_t *buf = s->buf; - - size = tap_read_packet(s->fd, s->buf, sizeof(s->buf)); - if (size <= 0) { - break; - } + size = tap_read_packet(s->fd, s->buf, sizeof(s->buf)); + if (size <= 0) { + return; + } - if (s->has_vnet_hdr && !s->using_vnet_hdr) { - buf += sizeof(struct virtio_net_hdr); - size -= sizeof(struct virtio_net_hdr); - } + if (s->has_vnet_hdr && !s->using_vnet_hdr) { + buf += sizeof(struct virtio_net_hdr); + size -= sizeof(struct virtio_net_hdr); + } - size = qemu_send_packet_async(s->vc, buf, size, tap_send_completed); - if (size == 0) { - tap_read_poll(s, 0); - } - } while (size > 0); + size = qemu_send_packet_async(s->vc, buf, size, tap_send_completed); + if (size == 0) { + tap_read_poll(s, 0); + } } int tap_has_ufo(VLANClientState *vc) |