Re: zero-copy TCP

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Sun Sep 03 2000 - 16:39:13 EST


> read/recv block while the NIC DMAs into user space main memory.

Thats actually not always a win either. A DMA to user space flushes those pages
out of cache which isnt so ideal if the CPU wants them. Some of the results
are suprisingly counter-intuitive like this

> (Can't DMA earlier because we don't know the buffer address in advance
> when using the standard socket API).

Yes I realised the API you meant when you said. This is local store of packet
then hand to user memory when the IRQ handler names a target address.

> The NIC memory is never accessed directly. It's a cache of skbuff data
> payloads, and the only access is by DMA, in those places where the
> kernel stack normally does copy_to_user/copy_from_user.

Yep. Unfortunately to make it work you need to do a bit more than that - you
have to pin pages in memory, flush caches on some cpus, lock those pages
against being truncated by another process (on the other cpu) and you have
to deal with queue reclamation when the nic gets short of buffers.

You can do it and with some of the PC world hardware. NeXT did this with their
lance driver

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



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:16 EST