Skip to contentSkip to conversation

Scatter Gather List Questions

DISCUSSION Craig Rich 2 participants 2 messages Feb 7, 2002 – Feb 8, 2002

lore
Share & tools
lore

Craig Rich

author
#0 lore raw

Jeff:

Hello. Saw this post on the Internet, and was hoping you are still open
to answering some questions about scatter/gather lists in Linux.

I'm tyring to update the Linux driver for our triple speed Ethernet MAC
(we haven't formally given the driver to you yet; I guess we should soon.)

Anyhow, I'm trying to find documentation, or examples of how to use the
scatter/gather capabilities of Linux, and not having much luck. So basically, I'm not sure where to start. I tried grepping the source as you say below, its not helping much.

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
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 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.)

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.

Any help would be greatly appreciated.

Quoted 28 lines

Jeff Garzik [email protected]
Wed, 14 Nov 2001 20:41:34 -0500

* Previous message: [linux-kernel] Need Info on Checksum Offloading
* Next message: [linux-kernel] tty stuff
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Quoted 2 lines · [email protected] wrote:
Quoted 2 lines

Hi All,
Could any1 pls direct me wherein i could find some documentation about implementing checksum offloading for my ethernet LAN driver?

There is not good documentation. Feel free to ask me questions, I am the Linux network driver maintainer.

First, search the source code in linux/drivers/net/* for NETIF_F_IP_CSUM, NETIF_F_HW_CSUM, skb->csum, and nr_frags.

Can I expect an ethernet driver submitted to me, soon?

Jeff

Signature · 3 lines
Jeff Garzik      | Only so many songs can be sung
Building 1024    | with two lips, two lungs, and one tongue.
MandrakeSoft     |         - nomeansno
Signature · 6 lines
Craig Rich
Senior Systems Engineer         mailto:[email protected]
Sundance Technology Inc.        http://www.sundanceti.com
1485 Saratoga Avenue            tel: 408 873 4117 x107
Suite 200                       fax: 408 996 7064
San Jose, CA, USA  95129
#1 lore raw
Quoted 5 lines · Craig Rich

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.

Quoted 2 lines

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.

Quoted 4 lines

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.

Quoted 4 lines

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.

Signature · 1 line
Jens Axboe