Subject: Re: unaligned mbufs and dma
To: Johan Danielsson <joda@pdc.kth.se>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-net
Date: 11/08/1999 17:29:55
On 08 Nov 1999 22:00:28 +0100 
 joda@pdc.kth.se (Johan Danielsson) wrote:

 > I guess there isn't any better way to solve hardware alignment
 > requirements than the one used by the roadrunner driver (basically
 > traverse the mbuf chain, and fix unaligned mbufs)? Should perhaps this
 > functionality be provided in some driver independent way?

For transmitting?  Not really.  What e.g. the `vr' driver does is simply:

	- if mbuf is unaligned or if it is comprised of more than
	  one DMA segment, copy the entire packet into an mbuf with
	  appropriate alignment.

Yes, it's a real pain in the arse.

For receiving, it depends.  There are a few ways one can solve this:

	- Pass unaligned data to the upper layers and let it align
	  as necessary.

	- Do the copy song-and-dance like we do now.

	- Be a little more clever with how you set up receive descriptors
	  so you have to copy less (looking into doing this with the new
	  Tulip driver).

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>