🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #134

Re: Stanford enetfilter

#134
From: Bart Massey
Date: Mon, 30 Oct 1989 00:16
69 lines
2896 bytes
In article <13253@boulder.Colorado.EDU> cdash@boulder.Colorado.EDU (Charles Shub) writes:
> we attempted to add this, and had some problems because there were some 
> changes in 4.3 that weren't made to the filter code. As i recall, there was
> a problem with MCLGET having been redefined....

Actually, if you're concerned about the correctness of that section of the
code, you can always just def it out -- it's "just" an efficiency win, which
tries to use mbuf page clusters instead of plain old mbufs, to avoid
user-space copies.  Here's the code I'm using with 4.3 "Tahoe".  Note that
MCLGET used to always be called with "MCLGET(m,1)", and is now called with
just "MCLGET(m)" -- *yet the semantics of MCLGET() changed in a major way at
the same time the superfluous extra argument was eliminated*, confusing me,
at least, for some time.  IMHO this was a semantic botch -- the new MCLGET()
should have a different name.  Anyway, have fun -- of course this is kernel
code, and neither I nor Tektronix will be responsible if it causes the
erasure of all your disks and tapes... :-)

					Bart Massey
					
					Tektronix, Inc.
					TV Systems Engineering
					M.S. 58-639
					P.O. Box 500
					Beaverton, OR 97077
					(503) 627-5320

					..tektronix!videovax.tv.tek.com!bart


---around line 559 in /sys/net/enet.c---
...
	    if (m == NULL)
		panic( "enwmove: out of mbufs" );
#if 1
/*
 * this is how I'm doing it for 4.3 tahoe
 */
	    /* big enough to use a page */
	    if (iov->iov_len >= MCLBYTES && enPageClusters) {
	        enprintf(ENDBG_TEMP)("enwmove: using page cluster\n");
		MCLGET(m);
		len = m->m_len;
	    } else {
		len = MIN(MLEN, iov->iov_len);
		m->m_len = len;
	    }
	    error = uiomove(mtod(m, caddr_t), len, UIO_WRITE, uio);
#else
/*
 * this is how it was done before 4.3 tahoe
 */
	    if (iov->iov_len >= CLBYTES) {	/* big enough to use a page */
	    	register struct mbuf *p;
		MCLGET(p, 1);
		if (p == 0)
		    goto nopages;
		m->m_off = (int)p - (int)m;
		len = CLBYTES;
	    }
	    else {
nopages:
		len = MIN(MLEN, iov->iov_len);
	    }
	    error = uiomove(mtod(m, caddr_t), len, UIO_WRITE, uio);
	    m->m_len = len;
#endif
	    *mp = m;
	    mp = &(m->m_next);
...
Technical Details
Message-ID: <5607@videovax.tv.tek.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!samsung!ginosko!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekcrl!tekfdi!videovax!bart
References: <561@alias.UUCP> <13253@boulder.Colorado.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!samsung!ginosko!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekcrl!tekfdi!videovax!bart
From: bart@videovax.tv.tek.com (Bart Massey)
Newsgroups: comp.bugs.4bsd,comp.protocols.tcp-ip,comp.unix.questions
Subject: Re: Stanford enetfilter
Message-ID: <5607@videovax.tv.tek.com>
Date: 30 Oct 89 00:16:22 GMT
References: <561@alias.UUCP> <13253@boulder.Colorado.EDU>
Reply-To: bart@videovax.tv.tek.com (Bart Massey)
Followup-To: comp.bugs.4bsd
Distribution: na
Organization: Tektronix TV Measurement Systems, Beaverton OR
Lines: 69