Re: mm and DMA devices

Alan Cox (alan@lxorguk.ukuu.org.uk)
Mon, 18 Oct 1999 13:50:10 +0100 (BST)


> I can allocate buffers using kmalloc() and alloc_skb() and translate
> the addresses to bus addresses using virt_to_bus()

Yes. You should call dev_alloc_skb() for receive packet buffers but that
isn't relevant to this issue.

> but the position of the buffers do not seem to stay constant (this was
> really a hard one to figure out!). Now what is going on here? Are

They stay constant. kmalloc buffers are pinned physically.

> 2.) When asked by the network subsystem to transmit a buffer I can
> not choose the kind of memory the data is provided in. I can only
> either copy it around or take the risk it will be pulled away
> under my feet.

The buffer you are given isnt going anywhere until you free it. It might be
outside ISA DMA range. ISA cards have to handle this - take a look at
drivers/net/z85230.c for an ISA example that handles it.

For PCI if your hardware is ok then you can hit the full 4Gig and are fine.
Remember to check alignment rules. Some hardware has problems with
alignment and you may have to make aligned copies at times.

Alan

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