Skip to contentSkip to conversation

Choosing scatter/gather limits

DISCUSSION Pierre Ossman 2 participants 3 messages Oct 11, 2004 – Oct 13, 2004

lore
Share & tools
lore
#0 lore raw

I've been adding scatter/gather support for the MMC host driver I'm writing. I cannot find any documentation on how to chose the limits though.

The device is an ISA device capable of DMA and PIO transfers. The scatter/gather system seems to be designed for PCI but I figured it could be used here aswell. Should save the time needed to shuffle stuff into a common buffer (or doing a lot of requests).

When in DMA mode the maximum segment size is 64kB (since ISA DMA cannot transfer larger blocks). The maximum sector limit should perhaps be 128 then. I don't know if 512 bytes per sector is something you can rely on. The MMC cards can (in theory) choose any sector size they want.

In PIO mode the segment size and sector count doesn't have an upper limit. I just traverse the scatter list as I read data.

The segment counts are also unlimited since these parts are handled in software.

So how do I choose these values? The segment counts affect memory usage (since I have to allocate the scatterlist) but the others are just a matter of how much data can be stuffed into one request. Should they be set to 0xffffffff then?

Rgds
Pierre Ossman

#1 lore raw
Quoted 2 lines · Pierre Ossman

I've been adding scatter/gather support for the MMC host driver I'm writing. I cannot find any documentation on how to chose the limits though.

It seems that you have to read the block layer code to find out what's going on with these limits. There's some documentation on it in Documentation/block/bio.txt. If it's lacking, then please send comments to the block layer people to add the necessary information.

Please also note that I'm intending to make the MMC host drivers know nothing about block IO stuff, so all you'll be passed is the MMC commands and a scatter gather list - so making sure that your driver always uses blk_rq_map_sg() and works from the SG list will ensure that your driver remains easy to update.

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw
Quoted 14 lines · Russell King
Quoted 3 lines · Pierre Ossman

I've been adding scatter/gather support for the MMC host driver I'm writing. I cannot find any documentation on how to chose the limits though.

It seems that you have to read the block layer code to find out what's going on with these limits. There's some documentation on it in Documentation/block/bio.txt. If it's lacking, then please send comments to the block layer people to add the necessary information.

I just wanted to make sure I don't pick values that causes problems somewhere else. I'll make an attempt to dig through the bio code though.

Quoted 8 lines

Please also note that I'm intending to make the MMC host drivers know nothing about block IO stuff, so all you'll be passed is the MMC commands and a scatter gather list - so making sure that your driver always uses blk_rq_map_sg() and works from the SG list will ensure that your driver remains easy to update.

Shouldn't be a problem. The SGIO support in the driver is done. Just need to get rid of all bugs.

Rgds
Pierre