Stanford enetfilter
Bart Massey
bart at videovax.tv.tek.com
Mon Oct 30 11:16:22 AEST 1989
In article <13253 at boulder.Colorado.EDU> cdash at 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);
...
More information about the Comp.unix.questions
mailing list