svn commit: r308283 - stable/10/sys/dev/cxgbe/tom
John Baldwin
jhb at FreeBSD.org
Fri Nov 4 04:02:01 UTC 2016
Author: jhb
Date: Fri Nov 4 04:01:59 2016
New Revision: 308283
URL: https://svnweb.freebsd.org/changeset/base/308283
Log:
MFC 301932: 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.
Note: Since stable/10 does not include sbused(), this uses sb->sb_cc
instead.
Sponsored by: Chelsio Communications
Modified:
stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 03:49:53 2016 (r308282)
+++ stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 04:01:59 2016 (r308283)
@@ -606,7 +606,7 @@ t4_push_frames(struct adapter *sc, struc
struct tcpcb *tp = intotcpcb(inp);
struct socket *so = inp->inp_socket;
struct sockbuf *sb = &so->so_snd;
- int tx_credits, shove, compl, space, sowwakeup;
+ int tx_credits, shove, compl, sowwakeup;
struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx];
INP_WLOCK_ASSERT(inp);
@@ -678,9 +678,7 @@ t4_push_frames(struct adapter *sc, struc
}
}
- space = sbspace(sb);
-
- if (space <= sb->sb_hiwat * 3 / 8 &&
+ if (sb->sb_cc > sb->sb_hiwat * 5 / 8 &&
toep->plen_nocompl + plen >= sb->sb_hiwat / 4)
compl = 1;
else
@@ -689,7 +687,7 @@ t4_push_frames(struct adapter *sc, struc
if (sb->sb_flags & SB_AUTOSIZE &&
V_tcp_do_autosndbuf &&
sb->sb_hiwat < V_tcp_autosndbuf_max &&
- space < sb->sb_hiwat / 8) {
+ sb->sb_cc >= sb->sb_hiwat * 7 / 8) {
int newsize = min(sb->sb_hiwat + V_tcp_autosndbuf_inc,
V_tcp_autosndbuf_max);
More information about the svn-src-stable
mailing list