mirror of
https://github.com/qemu/qemu.git
synced 2025-01-22 13:33:25 +08:00
tap: drain queue in tap_send()
Okay, let's try re-enabling the drain-entire-queue behaviour, with a difference - before each subsequent packet, use qemu_can_send_packet() to check that we can send it. This is similar to how we check before polling the tap fd and avoids having to drop a packet if the receiver cannot handle it. This patch should be a performance improvement since we no longer have to go through the mainloop for each packet. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
cdd5cc12ba
commit
5819c91806
@ -188,12 +188,14 @@ 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) {
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s->has_vnet_hdr && !s->using_vnet_hdr) {
|
||||
@ -205,6 +207,7 @@ static void tap_send(void *opaque)
|
||||
if (size == 0) {
|
||||
tap_read_poll(s, 0);
|
||||
}
|
||||
} while (size > 0 && qemu_can_send_packet(s->vc));
|
||||
}
|
||||
|
||||
int tap_has_ufo(VLANClientState *vc)
|
||||
|
Loading…
Reference in New Issue
Block a user