sockbuf: Pre-alloc sockbuf space, so asynchronized pru_send could be used.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 22 Jan 2012 13:29:29 +0000 (21:29 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 22 Jan 2012 13:29:29 +0000 (21:29 +0800)
commitf786a6ac5c46366d76322e2580f68a8c21dcc07b
treea392f45aa2fd0b2e11988770ca5b3b15179c30e7
parentd72c3761a1b9b923e4e3b392678b20053c0c5555
sockbuf: Pre-alloc sockbuf space, so asynchronized pru_send could be used.

When doing asynchronized pru_send, it is quite possible that we could
break the send sockbuf's upper limit, if we only use ssb_space() to
calculate the remaining sockbuf space.

Now, we add another two counters into sockbuf, when we send a mbuf
chain to the netisr, we update the these two counters to reflect how
much mbufs will be pending on the send sockbuf.  When calculating the
remaining space of the send sockbuf we also take these two counters
into consideration, so we will not break the upper limit of the send
sockbuf.  These two counter will also be updated when the mbufs in
the sockbuf is to be dropped/freed.

Reenable the asynchronized pru_send in sendfile and sosendtcp
sys/kern/uipc_sockbuf.c
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/netinet/tcp_input.c
sys/sys/sockbuf.h
sys/sys/socketvar.h