Date: Mon, 09 Aug 2004 14:14:37 -0700 From: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> To: Coleman <cokane@cokane.org> Cc: Alex Lyashkov <shadow@psoft.net> Subject: Re: Network interface RUNNING and UP flags Message-ID: <4117E93D.8060100@savvis.net> In-Reply-To: <1092084486.65806.12.camel@schemer> References: <346a8022040806145018a5e18@mail.gmail.com> <41140139.5080803@savvis.net> <1091862376.7840.3.camel@berloga.shadowland> <20040807092347.GB39835@comp.chem.msu.su> <1092084486.65806.12.camel@schemer>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------080009080300040502030002 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 --------------080009080300040502030002 Content-Type: text/plain; name="if_tap.c.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="if_tap.c.diff.txt" --- 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 */ --------------080009080300040502030002--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4117E93D.8060100>