From owner-freebsd-hackers Wed Jul 18 8:48:10 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from gull.mail.pas.earthlink.net (gull.mail.pas.earthlink.net [207.217.121.85]) by hub.freebsd.org (Postfix) with ESMTP id AA72637B403 for ; Wed, 18 Jul 2001 08:48:06 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from mindspring.com (dialup-209.247.138.210.Dial1.SanJose1.Level3.net [209.247.138.210]) by gull.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id IAA07749; Wed, 18 Jul 2001 08:47:55 -0700 (PDT) Message-ID: <3B55AFD0.65F0C860@mindspring.com> Date: Wed, 18 Jul 2001 08:48:32 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Richard Hodges Cc: hackers@FreeBSD.ORG Subject: Re: NatSemi DP83820 gigE driver kit for 4.2 and 4.3 References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Richard Hodges wrote: > > > Now TX buffers are a problem - I have to take what I get and just > > > "deal with it". If both start address and length need to be aligned, > > > then I'm pretty much screwed - I have to copy... > > > > No, exactly ythe opposite: the TX buffer is _not_ a problem. This > > is because it's assembled from mbuf's, so you can actually put it > > on a 16 byte boundary, and index the mbuf into only the forst 14 > > bytes of the packet for the header. > > It is still a problem. If the hardware requires buffer start and length > to be word aligned, I have to copy the entire mbuf chain if it is not > perfectly aligned to start with. The very rare exception is if an mbuf > in the middle just happens to have a length off by exactly the alignment > offset - in that case I can stop there, so long as the rest of the chain > is aligned, of course. This is a very real issue for me (in the form of > the IDT 77211 ATM SAR...) To be fair, this may not be a great example, > since I don't have an ethernet header to worry about. The only issue would be if the DMA on the chip could not support gathering its buffer from multiple sources. This is because you have to at least create mbuf header references (see the "zero copy" NFS code) for the data which you wish to transmit, and seperately create the headers. Unless you are doing headers + 8k payload (e.g. slightly small gigabit "jumbograms"), you aren't going to be able to reference FS buffer cache at an even page boundary (pages are 4k on x86, 8k on Alpha), so it's not like even the sendfile interface DMA's data directly from the disk into the ethernet card. Nor would you want it to do so, really, since it would disable your ability to cache the data, and that would limit you to disk speed, on average. In practice, your disk, not your bus would end up being your speed limiting factor. Even if you had an infinitely fast disk, the transmit buffer on this chip is limited to 8K, so 4K pages may be alright, but 8K pages leave no room for headers. So when you talk about "zero copy", you are generally talking minimally one copy, on data you have on hand (a copy from main memory to card memory), or two copy (a copy from disk or card to main memory to a card) for the data you have to get from somewhere else... in other words, "zero _additional_ copies". In any case, this means your argument doesn't apply to DMA gathering, when transmitting, since the data need not be in contiguous segments of physical RAM -- in other words, the ethernet header can be in a different mbuf cluster than the body of the data, so the body of the data can be alighned, from the host perspective -- and so can the ethernet headers. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message