Commit 3587f82a683122e25da59e1e81150ffde313e54f
1 parent
7aa763c7
qemu: generate signals on tap I/O
Currently tap does not generate signals on I/O; this causes network latency to be dependent on the timer tick (1ms without dyntick, guest dependent with dyntick). By generating a signal on I/O, we can inform the guest immediately that a packet has arrived. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5688 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
4 additions
and
1 deletions
net.c
| @@ -622,6 +622,8 @@ static void tap_send(void *opaque) | @@ -622,6 +622,8 @@ static void tap_send(void *opaque) | ||
| 622 | 622 | ||
| 623 | /* fd support */ | 623 | /* fd support */ |
| 624 | 624 | ||
| 625 | +void enable_sigio_timer(int fd); | ||
| 626 | + | ||
| 625 | static TAPState *net_tap_fd_init(VLANState *vlan, int fd) | 627 | static TAPState *net_tap_fd_init(VLANState *vlan, int fd) |
| 626 | { | 628 | { |
| 627 | TAPState *s; | 629 | TAPState *s; |
| @@ -630,6 +632,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, int fd) | @@ -630,6 +632,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, int fd) | ||
| 630 | if (!s) | 632 | if (!s) |
| 631 | return NULL; | 633 | return NULL; |
| 632 | s->fd = fd; | 634 | s->fd = fd; |
| 635 | + enable_sigio_timer(fd); | ||
| 633 | s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s); | 636 | s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s); |
| 634 | qemu_set_fd_handler(s->fd, tap_send, NULL, s); | 637 | qemu_set_fd_handler(s->fd, tap_send, NULL, s); |
| 635 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd); | 638 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd); |
vl.c
| @@ -1403,7 +1403,7 @@ static int fcntl_setfl(int fd, int flag) | @@ -1403,7 +1403,7 @@ static int fcntl_setfl(int fd, int flag) | ||
| 1403 | 1403 | ||
| 1404 | #define RTC_FREQ 1024 | 1404 | #define RTC_FREQ 1024 |
| 1405 | 1405 | ||
| 1406 | -static void enable_sigio_timer(int fd) | 1406 | +void enable_sigio_timer(int fd) |
| 1407 | { | 1407 | { |
| 1408 | struct sigaction act; | 1408 | struct sigaction act; |
| 1409 | 1409 |