Re: Scatter Gather List Questions

From: Jens Axboe (axboe@suse.de)
Date: Fri Feb 08 2002 - 04:36:15 EST


On Thu, Feb 07 2002, Craig Rich wrote:
> One question I can start with is, how do you use pci_dma_sg?
>
> pci_map_sg(dev, sglist, nents, direction);
>
> I'm assuming I supply the dev and direction fields. How about the nents

Of course, dev being your pci device and direction the data direction --
PCI_DMA_TODEVICE etc, see linux/pci.h.

> field? Is that supposed to be the largest number of fragments I can
> handle (that's what I assumed.) Finally, the sglist argument has me

nents is the number if segments in the sglist you are supplying as well.
not the maximum number of entries the driver can handle.

> really confused. Do I have to create this structure in advance (and if
> so how) or is pci_map_sg supposed to simply give me a pointer back via
> the sglist argument (that's what I assumed, but that doesn't seem to be
> the case unless I'm doing something else wrong.)

No you have to allocate this structure yourself.

> Also, were in the source code is pci_map_sg located? I'll admit I'm not
> an expert at looking through the source code of an OS like Linux, but
> I'm frustrated by the fact that a simple grep of /usr/src/linux-2.4.2
> does not show where this function is coded.

You are not terribly good a grepping, it seems :-). The function is in
asm/pci.h, depending on the architecture you may have to look inside
arch/ for helpers too.

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:16 EST