summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-06-15 21:08:51 +0000
committerjhb <jhb@FreeBSD.org>2016-06-15 21:08:51 +0000
commit9b91f224a1c593ec00b5c9de9de751de231d379e (patch)
tree1e72795502bcb95bd3aace01257949f0a35db67e
parentc2450dd871e94dff6268305fb4da52940513c81e (diff)
downloadFreeBSD-src-9b91f224a1c593ec00b5c9de9de751de231d379e.zip
FreeBSD-src-9b91f224a1c593ec00b5c9de9de751de231d379e.tar.gz
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
-rw-r--r--sys/dev/cxgbe/tom/t4_cpl_io.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index fd83ca1..387ee51 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -577,7 +577,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
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);
@@ -652,9 +652,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
}
}
- space = sbspace(sb);
-
- if (space <= sb->sb_hiwat * 3 / 8 &&
+ if (sbused(sb) > sb->sb_hiwat * 5 / 8 &&
toep->plen_nocompl + plen >= sb->sb_hiwat / 4)
compl = 1;
else
@@ -663,7 +661,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
if (sb->sb_flags & SB_AUTOSIZE &&
V_tcp_do_autosndbuf &&
sb->sb_hiwat < V_tcp_autosndbuf_max &&
- space < sb->sb_hiwat / 8) {
+ sbused(sb) >= sb->sb_hiwat * 7 / 8) {
int newsize = min(sb->sb_hiwat + V_tcp_autosndbuf_inc,
V_tcp_autosndbuf_max);
OpenPOWER on IntegriCloud