Subject: Re: DMA segs and scatter/gather
To: Bruce J.A. Nourish <bjan+tech-kern@bjan.net>
From: Sam Leffler <sam@errno.com>
List: tech-kern
Date: 08/22/2003 08:25:37
> Switch gears to FreeBSD code. The hardware in question supports
> ATH_MAX_SCATTER descriptors. This number is passed into
> bus_dma_tag_create, as the "maximum number of discontinuities
> (scatter/gather segments)" supported by the device. bus_dmamap_alloc
> is now called, with that DMA tag. FreeBSD's dmamap_alloc gets most
> of it's parameters by frobbing the DMA tag - so surely it would
> allocate ATH_MAX_SCATTER descriptors?
>

The number of descriptors varies depending on the size and layout of the 
object being mapped.  ATH_MAX_SCATTER is really only meaningful to the tx 
path where the driver has no control over the memory layout.  Rx's are 
currently always done to a cluster which is known to be physically 
contiguous.  Likewise the other data structures are known to have a small 
enough size to not require more than one segment.  I don't think 
ATH_MAX_SCATTER is used other than when setting up tx DMA.  If it is then 
it's a mistake but harmless.

Perhaps you should talk to me directly about this stuff?  I can explain why 
things are like they are in the FreeBSD code; I just can't cite 
chapter+verse on NetBSD specifics w/o looking at that code.

	Sam