Send sockbuf's lowat could be quite "high" (hiwat/2), the originally
code actually only uses 1/2 of the send sockbuf space, thus poor
performance.
for (off = offset; ; off += xfsize, *sbytes += xfsize + hbytes) {
vm_pindex_t pindex;
vm_offset_t pgoff;
+ int space;
pindex = OFF_TO_IDX(off);
retry_lookup:
* after checking the connection state above in order to avoid
* a race condition with ssb_wait().
*/
- if (ssb_space_prealloc(&so->so_snd) < so->so_snd.ssb_lowat) {
+ space = ssb_space_prealloc(&so->so_snd);
+ if (space < m->m_pkthdr.len && space < so->so_snd.ssb_lowat) {
if (fp->f_flag & FNONBLOCK) {
m_freem(m);
ssb_unlock(&so->so_snd);