Date: Mon, 09 Aug 2004 17:47:54 -0400 From: Coleman <cokane@cokane.org> To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> Cc: Alex Lyashkov <shadow@psoft.net> Subject: Re: Network interface RUNNING and UP flags Message-ID: <1092088073.65806.29.camel@schemer> In-Reply-To: <4117E93D.8060100@savvis.net> References: <346a8022040806145018a5e18@mail.gmail.com> <1091862376.7840.3.camel@berloga.shadowland> <20040807092347.GB39835@comp.chem.msu.su> <1092084486.65806.12.camel@schemer> <4117E93D.8060100@savvis.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Ah yes, now I see. There is no mutex on struct ifnet then? And I suppose those splimp/splx calls should remain. I'll look at whats available and relay my findings to you guys. On Mon, 2004-08-09 at 17:14, Maksim Yevmenkin wrote: > Hello, > > > Here, I pushed that section of code up before the prior > > mtx_unlock(&tp->tap_mtx) above it, then removed the splimp/splx > > calls. Is this what you were referring to (attached)? Also, I noticed > > splx and splimp are called in a number of other places in this > > driver, even under -CURRENT. You want those out too? The patch is a > > patch on the original -CURRENT version of the driver and not a patch > > to the previous patch I received. > > ok, the "tap_mtx" lock is used to protect fields which belongs to the > "struct tap_softc". the IFF_xxx flags are set in the "if_flags" field, > which belongs to the "struct ifnet". note that other parts of the system > will access the same "struct ifnet", and, thus separate lock is required > to protect all fields inside the "struct ifnet". currently it is done > (or rather not done) with splimp(9)/splx(9) calls. i guess this will be > fixed some time in the future. > > my original patch was not 100% correct. i have attached better (imo) > patch. please try it out, and, if there are no objections, i will commit it. > > thanks, > max > > > ______________________________________________________________________ > --- if_tap.c.orig Fri Aug 6 15:02:06 2004 > +++ if_tap.c Mon Aug 9 13:57:48 2004 > @@ -340,7 +340,8 @@ > struct thread *td; > { > struct tap_softc *tp = NULL; > - int error; > + struct ifnet *ifp = NULL; > + int error, s; > > if ((error = suser(td)) != 0) > return (error); > @@ -368,10 +369,15 @@ > bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr)); > tp->tap_pid = td->td_proc->p_pid; > tp->tap_flags |= TAP_OPEN; > + ifp = &tp->tap_if; > mtx_unlock(&tp->tap_mtx); > > - TAPDEBUG("%s is open. minor = %#x\n", > - tp->tap_if.if_xname, minor(dev)); > + s = splimp(); > + ifp->if_flags |= IFF_RUNNING; > + ifp->if_flags &= ~IFF_OACTIVE; > + splx(s); > + > + TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev)); > > return (0); > } /* tapopen */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1092088073.65806.29.camel>