diff options
author | jhb <jhb@FreeBSD.org> | 2015-03-11 17:35:07 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2015-03-11 17:35:07 +0000 |
commit | 168a37c98f906efa263e7abd3367ace594fd0c59 (patch) | |
tree | 6714cc7427431a9da46eff9da464857c5119a5a4 /sys/dev/cxgbe | |
parent | de871211fe4cfbf68411bea95643bd99527c9266 (diff) | |
download | FreeBSD-src-168a37c98f906efa263e7abd3367ace594fd0c59.zip FreeBSD-src-168a37c98f906efa263e7abd3367ace594fd0c59.tar.gz |
Resize receive socket buffers that support autosizing when receiving
TCP data via direct data placement.
Sponsored by: Chelsio
MFC after: 1 week
Diffstat (limited to 'sys/dev/cxgbe')
-rw-r--r-- | sys/dev/cxgbe/tom/t4_ddp.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 6908de9..7c2cec4 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -65,6 +65,13 @@ __FBSDID("$FreeBSD$"); #include "common/t4_tcb.h" #include "tom/t4_tom.h" +VNET_DECLARE(int, tcp_do_autorcvbuf); +#define V_tcp_do_autorcvbuf VNET(tcp_do_autorcvbuf) +VNET_DECLARE(int, tcp_autorcvbuf_inc); +#define V_tcp_autorcvbuf_inc VNET(tcp_autorcvbuf_inc) +VNET_DECLARE(int, tcp_autorcvbuf_max); +#define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) + #define PPOD_SZ(n) ((n) * sizeof(struct pagepod)) #define PPOD_SIZE (PPOD_SZ(1)) @@ -411,6 +418,21 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report, __be32 rcv_nxt, int len) else discourage_ddp(toep); + /* receive buffer autosize */ + if (sb->sb_flags & SB_AUTOSIZE && + V_tcp_do_autorcvbuf && + sb->sb_hiwat < V_tcp_autorcvbuf_max && + len > (sbspace(sb) / 8 * 7)) { + unsigned int hiwat = sb->sb_hiwat; + unsigned int newsize = min(hiwat + V_tcp_autorcvbuf_inc, + V_tcp_autorcvbuf_max); + + if (!sbreserve_locked(sb, newsize, so, NULL)) + sb->sb_flags &= ~SB_AUTOSIZE; + else + toep->rx_credits += newsize - hiwat; + } + KASSERT(toep->sb_cc >= sbused(sb), ("%s: sb %p has more data (%d) than last time (%d).", __func__, sb, sbused(sb), toep->sb_cc)); |