diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 83b97c8..768d7d9 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -329,8 +329,7 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, m->m_flags &= ~(M_BCAST|M_MCAST); if (!(ifp->if_flags & IFF_UP) || - sc->gif_psrc == NULL || sc->gif_pdst == NULL || - sc->gif_si == NULL) { + sc->gif_psrc == NULL || sc->gif_pdst == NULL) { m_freem(m); error = ENETDOWN; goto end; @@ -356,11 +355,10 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, splx(s); goto end; } - - /* softint_schedule() must be called with kpreempt_disabled() */ - softint_schedule(sc->gif_si); splx(s); + gifintr(sc); + error = 0; end: @@ -418,16 +416,14 @@ gifintr(void *arg) switch (sc->gif_psrc->sa_family) { #ifdef INET case AF_INET: - mutex_enter(softnet_lock); + KASSERT(mutex_owned(softnet_lock)); error = in_gif_output(ifp, family, m); - mutex_exit(softnet_lock); break; #endif #ifdef INET6 case AF_INET6: - mutex_enter(softnet_lock); + KASSERT(mutex_owned(softnet_lock)); error = in6_gif_output(ifp, family, m); - mutex_exit(softnet_lock); break; #endif default: @@ -790,7 +786,6 @@ gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) struct gif_softc *sc2; struct sockaddr *osrc, *odst; struct sockaddr *nsrc, *ndst; - void *osi; int s; int error; @@ -823,33 +818,6 @@ gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) } /* Firstly, clear old configurations. */ - if (sc->gif_si) { - osrc = sc->gif_psrc; - odst = sc->gif_pdst; - osi = sc->gif_si; - sc->gif_psrc = NULL; - sc->gif_pdst = NULL; - sc->gif_si = NULL; - /* - * At this point, gif_output() does not softint_schedule() - * any more. However, there are below 2 fears of other CPUs - * which would cause panic because of the race between - * softint_execute() and softint_disestablish(). - * (a) gif_output() has done softint_schedule(), and softint - * (gifintr()) is waiting for execution - * => This pattern is avoided by waiting SOFTINT_PENDING - * CPUs in softint_disestablish() - * (b) gifintr() is already running - * => This pattern is avoided by waiting SOFTINT_ACTIVE - * CPUs in softint_disestablish() - */ - - softint_disestablish(osi); - sc->gif_psrc = osrc; - sc->gif_pdst = odst; - osrc = NULL; - odst = NULL; - } /* XXX we can detach from both, but be polite just in case */ if (sc->gif_psrc) (void)gif_encap_detach(sc); @@ -874,20 +842,6 @@ gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) continue; } - - sc->gif_si = softint_establish(SOFTINT_NET, gifintr, sc); - if (sc->gif_si == NULL) { - (void)gif_encap_detach(sc); - - /* rollback to the last configuration. */ - nsrc = osrc; - ndst = odst; - osrc = sc->gif_psrc; - odst = sc->gif_pdst; - - error = ENOMEM; - continue; - } } while (error != 0 && (nsrc != NULL && ndst != NULL)); /* Thirdly, even rollback failed, clear configurations. */ if (error) { @@ -915,25 +869,10 @@ static void gif_delete_tunnel(struct ifnet *ifp) { struct gif_softc *sc = ifp->if_softc; - struct sockaddr *osrc, *odst; - void *osi; int s; s = splsoftnet(); - if (sc->gif_si) { - osrc = sc->gif_psrc; - odst = sc->gif_pdst; - osi = sc->gif_si; - - sc->gif_psrc = NULL; - sc->gif_pdst = NULL; - sc->gif_si = NULL; - - softint_disestablish(osi); - sc->gif_psrc = osrc; - sc->gif_pdst = odst; - } if (sc->gif_psrc) { sockaddr_free(sc->gif_psrc); sc->gif_psrc = NULL; diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h index 743cbfb..b97fbf3 100644 --- a/sys/net/if_gif.h +++ b/sys/net/if_gif.h @@ -59,7 +59,6 @@ struct gif_softc { const struct encaptab *encap_cookie4; const struct encaptab *encap_cookie6; LIST_ENTRY(gif_softc) gif_list; /* list of all gifs */ - void *gif_si; /* softintr handle */ }; #define GIF_ROUTE_TTL 10