svn commit: r301932 - head/sys/dev/cxgbe/tom

John Baldwin jhb at freebsd.org
Wed Jun 15 21:50:34 UTC 2016


On Wednesday, June 15, 2016 09:08:51 PM John Baldwin wrote:
> Author: jhb
> Date: Wed Jun 15 21:08:51 2016
> New Revision: 301932
> URL: https://svnweb.freebsd.org/changeset/base/301932
> 
> Log:
>   Use sbused() instead of sbspace() to avoid signed issues.
>   
>   Inserting a full mbuf with an external cluster into the socket buffer
>   resulted in sbspace() returning -MLEN.  However, since sb_hiwat is
>   unsigned, the -MLEN value was converted to unsigned in comparisons.  As a
>   result, the socket buffer was never autosized.  Note that sb_lowat is signed
>   to permit direct comparisons with sbspace(), but sb_hiwat is unsigned.
>   Follow suit with what tcp_output() does and compare the value of sbused()
>   with sb_hiwat instead.
>   
>   Approved by:	re (gjb)
>   Sponsored by:	Chelsio Communications

Amusingly (or not), sb_lowat used to be signed as well.  Mike Karels
changed it to signed in this commit to BSD:

https://svnweb.freebsd.org/csrg/sys/sys/socketvar.h?revision=43896

The log reads:

add SB_ASYNC in sockbuf, add  SB_NOTIFY, SB_NOINTR;
make lowat signed for comparison with sbspace (should probably give up
and make all fields signed

-- 
John Baldwin


More information about the svn-src-all mailing list