cvs commit: src/sys/kern uipc_socket.c

Robert Watson rwatson at FreeBSD.org
Mon Dec 5 01:53:57 PST 2005


On Sun, 4 Dec 2005, Mike Silbersack wrote:

> On Mon, 28 Nov 2005, Robert Watson wrote:
>
>>  Break out functionality in sosend() responsible for building mbuf
>>  chains and copying in mbufs from the body of the send logic, creating
>>  a new function sosend_copyin().  This changes makes sosend() almost
>>  readable, and will allow the same logic to be used by tailored socket
>>  send routines.
>
> Now for a followup, you can merge this with m_uiotombuf. :)
>
> Back when I wrote m_uiotombuf, I had intended to put it inside sosend, I 
> just didn't want to deal with the complexity of the zero copy sockets.

Due to the risk of error and combining changes, I decided I'd break out sosend 
changes into several steps:

(1) Break out copyin logic so that the code is no longer nearly as nested, and
     basically reads the same regardless of whether a uio or an mbuf chain is
     passed in.

(2) Create sosend_dgram(), a reduced socket send routine for atomic datagram
     sockets, which is able to avoid a lot of work due to not having the
     additional work loop, avoiding some work with the send socket buffer, and
     so on.

(3) Enhance m_uiotombuf() so that it can either be trivially wrapped by
     sosend_copyin(), or replace it.  At the very least, this means adding
     zero-copy support to m_uiotombuf(), but I've not looked at this much.

Of these, (1) is now committed and shaking out, and I have (2) in perforce 
waiting for (1) to settle.  I hope to look at (3) once (2) is merged, but want 
to let (1) settle a bit longer.  The sosend() logic is sufficiently convoluted 
that errors are easy to make.  The new code is much better, but the extraction 
process for the copyin code was fairly painful and another mistake in there 
wouldn't surprise me.

Robert N M Watson


More information about the cvs-all mailing list