Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net - deal with softint_establish failure
details: https://anonhg.NetBSD.org/src/rev/38f611c049f1
branches: trunk
changeset: 789487:38f611c049f1
user: yamt <yamt%NetBSD.org@localhost>
date: Tue Aug 20 12:28:12 2013 +0000
description:
- deal with softint_establish failure
- establish softint only when necessary
diffstat:
sys/net/if_tap.c | 30 ++++++++++++++++++++++++------
1 files changed, 24 insertions(+), 6 deletions(-)
diffs (74 lines):
diff -r 557b61529779 -r 38f611c049f1 sys/net/if_tap.c
--- a/sys/net/if_tap.c Tue Aug 20 10:33:03 2013 +0000
+++ b/sys/net/if_tap.c Tue Aug 20 12:28:12 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tap.c,v 1.70 2013/01/28 15:05:03 yamt Exp $ */
+/* $NetBSD: if_tap.c,v 1.71 2013/08/20 12:28:12 yamt Exp $ */
/*
* Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.70 2013/01/28 15:05:03 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.71 2013/08/20 12:28:12 yamt Exp $");
#if defined(_KERNEL_OPT)
@@ -268,7 +268,7 @@
char enaddrstr[3 * ETHER_ADDR_LEN];
sc->sc_dev = self;
- sc->sc_sih = softint_establish(SOFTINT_CLOCK, tap_softintr, sc);
+ sc->sc_sih = NULL;
getnanotime(&sc->sc_btime);
sc->sc_atime = sc->sc_mtime = sc->sc_btime;
@@ -391,7 +391,10 @@
if_down(ifp);
splx(s);
- softint_disestablish(sc->sc_sih);
+ if (sc->sc_sih != NULL) {
+ softint_disestablish(sc->sc_sih);
+ sc->sc_sih = NULL;
+ }
#if defined(COMPAT_40) || defined(MODULAR)
/*
@@ -852,6 +855,10 @@
}
splx(s);
+ if (sc->sc_sih != NULL) {
+ softint_disestablish(sc->sc_sih);
+ sc->sc_sih = NULL;
+ }
sc->sc_flags &= ~(TAP_INUSE | TAP_ASYNCIO);
return (0);
@@ -1104,10 +1111,21 @@
case FIOGETOWN:
return fgetown(sc->sc_pgid, cmd, data);
case FIOASYNC:
- if (*(int *)data)
+ if (*(int *)data) {
+ if (sc->sc_sih == NULL) {
+ sc->sc_sih = softint_establish(SOFTINT_CLOCK,
+ tap_softintr, sc);
+ if (sc->sc_sih == NULL)
+ return EBUSY; /* XXX */
+ }
sc->sc_flags |= TAP_ASYNCIO;
- else
+ } else {
sc->sc_flags &= ~TAP_ASYNCIO;
+ if (sc->sc_sih != NULL) {
+ softint_disestablish(sc->sc_sih);
+ sc->sc_sih = NULL;
+ }
+ }
return 0;
case FIONBIO:
if (*(int *)data)
Home |
Main Index |
Thread Index |
Old Index