diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2020-06-01 09:56:52 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-01 10:29:47 -0700 |
commit | 839208f118793c665f48a057d1f35d74979b7916 (patch) | |
tree | c47711c1f618cf6dbc7ca401c77512344d7340c0 /benchmarks/tcp/tcp_proxy.go | |
parent | a9b47390c821942d60784e308f681f213645049c (diff) |
Enable TCP Receive buffer moderation in gonet and benchmark.
Fixes #1666
PiperOrigin-RevId: 314148384
Diffstat (limited to 'benchmarks/tcp/tcp_proxy.go')
-rw-r--r-- | benchmarks/tcp/tcp_proxy.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/benchmarks/tcp/tcp_proxy.go b/benchmarks/tcp/tcp_proxy.go index dc1593b34..f5aa0b515 100644 --- a/benchmarks/tcp/tcp_proxy.go +++ b/benchmarks/tcp/tcp_proxy.go @@ -56,6 +56,7 @@ var ( mask = flag.Int("mask", 8, "mask size for address") iface = flag.String("iface", "", "network interface name to bind for netstack") sack = flag.Bool("sack", false, "enable SACK support for netstack") + moderateRecvBuf = flag.Bool("moderate_recv_buf", false, "enable TCP Receive Buffer Auto-tuning") cubic = flag.Bool("cubic", false, "enable use of CUBIC congestion control for netstack") gso = flag.Int("gso", 0, "GSO maximum size") swgso = flag.Bool("swgso", false, "software-level GSO") @@ -231,6 +232,11 @@ func newNetstackImpl(mode string) (impl, error) { return nil, fmt.Errorf("SetTransportProtocolOption for SACKEnabled failed: %v", err) } + // Enable Receive Buffer Auto-Tuning. + if err := s.SetTransportProtocolOption(tcp.ProtocolNumber, tcpip.ModerateReceiveBufferOption(*moderateRecvBuf)); err != nil { + return nil, fmt.Errorf("SetTransportProtocolOption failed: %v", err) + } + // Set Congestion Control to cubic if requested. if *cubic { if err := s.SetTransportProtocolOption(tcp.ProtocolNumber, tcpip.CongestionControlOption("cubic")); err != nil { |