Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/lib/libvirtif * improve diagnostic print
details: https://anonhg.NetBSD.org/src/rev/79384010c010
branches: trunk
changeset: 757011:79384010c010
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Aug 10 18:06:10 2010 +0000
description:
* improve diagnostic print
* deal with a tap quirk when it returns 0 bytes
diffstat:
sys/rump/net/lib/libvirtif/if_virt.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r 9d25cdcff413 -r 79384010c010 sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c Tue Aug 10 17:53:08 2010 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c Tue Aug 10 18:06:10 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_virt.c,v 1.18 2010/04/05 16:35:30 joerg Exp $ */
+/* $NetBSD: if_virt.c,v 1.19 2010/08/10 18:06:10 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.18 2010/04/05 16:35:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.19 2010/08/10 18:06:10 pooka Exp $");
#include <sys/param.h>
#include <sys/condvar.h>
@@ -110,7 +110,8 @@
snprintf(tapdev, sizeof(tapdev), "/dev/tap%d", num);
fd = rumpuser_open(tapdev, O_RDWR, &error);
if (fd == -1) {
- printf("virtif_create: can't open /dev/tap %d\n", error);
+ printf("virtif_create: can't open /dev/tap%d: %d\n",
+ num, error);
return error;
}
KASSERT(num < 0x100);
@@ -212,7 +213,7 @@
again:
n = rumpuser_read(sc->sc_tapfd, mtod(m, void *), plen, &error);
KASSERT(n < ETHER_MAX_LEN_JUMBO);
- if (n <= 0) {
+ if (__predict_false(n < 0)) {
/*
* work around tap bug: /dev/tap is opened in
* non-blocking mode if it previously was
@@ -227,9 +228,15 @@
rumpuser_poll(&pfd, 1, INFTIM, &error);
goto again;
}
+
m_freem(m);
break;
}
+
+ /* tap sometimes returns EOF. don't sweat it and plow on */
+ if (__predict_false(n == 0))
+ goto again;
+
m->m_len = m->m_pkthdr.len = n;
m->m_pkthdr.rcvif = ifp;
bpf_mtap(ifp, m);
Home |
Main Index |
Thread Index |
Old Index