Support for zero copy sockets

Adrian Chadd adrian at freebsd.org
Tue Aug 12 00:42:28 UTC 2014


On 11 August 2014 12:11, Navdeep Parhar <np at freebsd.org> wrote:
> There is zero copy receive (aka Direct Data Placement -- DDP) in the TOE
> driver that accompanies cxgbe(4).  I have a tx zero copy implementation
> for it as well (this is not in -current right now).  But all this code
> is chip specific and applies only to TCP connections that are handled
> by the TOE driver.  It doesn't rely on COW or page flipping.
>
> The reason I'm mentioning all of this here is that if anyone is thinking
> of working on proper zero copy awareness (and APIs) at the socket layer
> then count me in as an interested party.

I'm not going to get into it just for now, as I have enough on my
FreeBSD plate to do already.

However, the thing that always irked me about the hardware based
solutions is that they're great for a subset of problems - typically
small sets of sockets. The real interesting problem for me is how to
make it work for say, 500,000 or more concurrent TCP sessions.

I can see a method of doing zero-copy writes to the network stack -
look at what the AIO code does in the physical IO path for doing
writes. It wires down the memory and stuffs it into the buffer.

The thing I haven't yet sorted out is what to do about mappings in
case kernel code wants to peek at the socket data payload for whatever
reason.

(And yes, reads are still a problem.)



-a


More information about the freebsd-hackers mailing list