diff options
author | jhb <jhb@FreeBSD.org> | 2015-04-09 17:56:25 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2015-04-09 17:56:25 +0000 |
commit | d79cd9bb7197bd0fe3120c508728f7145dfa2f55 (patch) | |
tree | ed5e833404a78c838a2d0de64ae4b612b1e52c73 /sys/dev | |
parent | cffb1bfcbabf846a437530d8d86bba233e57d711 (diff) | |
download | FreeBSD-src-d79cd9bb7197bd0fe3120c508728f7145dfa2f55.zip FreeBSD-src-d79cd9bb7197bd0fe3120c508728f7145dfa2f55.tar.gz |
MFC 279892:
Resize receive socket buffers that support autosizing when receiving
TCP data via direct data placement.
Diffstat (limited to 'sys/dev')
-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 3b99a6e..68ec2cc 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 >= sb->sb_cc, ("%s: sb %p has more data (%d) than last time (%d).", __func__, sb, sb->sb_cc, toep->sb_cc)); |