Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Mar 2003 11:49:14 -0600 (CST)
From:      Mike Silbersack <silby@silby.com>
To:        Doug Ambrisko <ambrisko@ambrisko.com>, Sam Leffler <sam@errno.com>, Maxime Henrion <mux@freebsd.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/conf options src/sys/netinet ip_output.c
Message-ID:  <20030326114030.U2075@odysseus.silby.com>
In-Reply-To: <200303260452.h2Q4quap015364@www.ambrisko.com>
References:  <200303260452.h2Q4quap015364@www.ambrisko.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-436137172-1048700704=:2075
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <20030326114511.A2075@odysseus.silby.com>


On Tue, 25 Mar 2003, Doug Ambrisko wrote:

> | I think that we'll end up being even better off by just making a
> | m_defragment function, thereby reducing code duplication even more.  I'll
> | make sure to test any such function more than I tested the MBUF_FRAG_TEST
> | code, however. :)
>
> Yes, I was thinking that as well.

Ok, here's my attempt at a m_defragment function.  It seems to work well
here, although I have only tested it with the if_xl driver.  Could you
guys give it a quick lookover to see if it has any bugs?  I'll add the
ability to copy mbuf chains longer than MCLBYTES once I know all the
packet header handling / etc is correct.

Also note that the patch contains my changes to if_xl, which are mostly
debugging code.  You can ignore most of that.  One change I _will_ make to
if_xl, however, is to walk the chain and find out its length _before_ we
do any busdma calls; this moves the defragmentation occur earlier, thereby
avoiding the need for a complex error recovery case.  I suspect we'll want
to do the same in the other network drivers.

Thanks,

Mike "Silby" Silbersack
--0-436137172-1048700704=:2075
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="m_defragment-pass2.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <20030326114504.K2075@odysseus.silby.com>
Content-Description: 
Content-Disposition: ATTACHMENT; FILENAME="m_defragment-pass2.pat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opOw0KK3N0cnVjdAltYnVmCSptX2RlZnJhZ21l
bnQoc3RydWN0IG1idWYgKiwgaW50KTsNCiBzdHJ1Y3QJbWJ1ZgkqbV9kZXZn
ZXQoY2hhciAqLCBpbnQsIGludCwgc3RydWN0IGlmbmV0ICosDQogCQkgICAg
dm9pZCAoKikoY2hhciAqLCBjYWRkcl90LCB1X2ludCkpOw0KIHN0cnVjdAlt
YnVmCSptX2R1cChzdHJ1Y3QgbWJ1ZiAqLCBpbnQpOw0K

--0-436137172-1048700704=:2075--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030326114030.U2075>