diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-01-08 23:32:18 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2014-01-08 23:32:18 +0000 |
commit | 009de9e6390f9ab42fd2a19ba76bbd8feebc055a (patch) | |
tree | 56e54e3a00a6a0400adede2f5fcafbb6027d8fa1 /regress/sys | |
parent | 44b46b03a04fb11167542c8e14a4dcf34de0975f (diff) |
Set socket buffer size to fixed value of 100000 octets. This
prevents that the socket splicing performance test interferes with
the dynamic TCP buffer size adjusting.
Diffstat (limited to 'regress/sys')
-rw-r--r-- | regress/sys/kern/sosplice/perf/Makefile | 4 | ||||
-rw-r--r-- | regress/sys/kern/sosplice/perf/relay.c | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/regress/sys/kern/sosplice/perf/Makefile b/regress/sys/kern/sosplice/perf/Makefile index 81676cd0625..28119e762c6 100644 --- a/regress/sys/kern/sosplice/perf/Makefile +++ b/regress/sys/kern/sosplice/perf/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.1 2013/01/08 21:42:19 bluhm Exp $ +# $OpenBSD: Makefile,v 1.2 2014/01/08 23:32:17 bluhm Exp $ PROG ?= relay CFLAGS += -Wall -Werror @@ -20,6 +20,8 @@ copy splice: ${PROG} .for r in copy splice run-regress-$p-$r: $r + @echo + @echo $@ .if empty (REMOTE_SSH) ./$r ${p:S/tcp//:S/udp/-u/} 12345 localhost 12346 & \ rpid=$$! ; \ diff --git a/regress/sys/kern/sosplice/perf/relay.c b/regress/sys/kern/sosplice/perf/relay.c index aab8cbf4fa4..699a1b56aaf 100644 --- a/regress/sys/kern/sosplice/perf/relay.c +++ b/regress/sys/kern/sosplice/perf/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.1 2013/01/08 21:42:19 bluhm Exp $ */ +/* $OpenBSD: relay.c,v 1.2 2014/01/08 23:32:17 bluhm Exp $ */ /* * Copyright (c) 2013 Alexander Bluhm <bluhm@openbsd.org> * @@ -142,6 +142,10 @@ socket_listen(int *ls, struct addrinfo *hints, const char *listenaddr, cause = "listen socket"; continue; } + optval = 100000; + if (setsockopt(ls[nls], SOL_SOCKET, SO_RCVBUF, + &optval, sizeof(optval)) == -1) + err(1, "setsockopt rcvbuf"); optval = 1; if (setsockopt(ls[nls], SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) == -1) @@ -229,7 +233,7 @@ socket_connect(struct addrinfo *hints, const char *hostname, const char *port) socklen_t salen; struct addrinfo *res, *res0; const char *cause = NULL; - int error, save_errno, cs; + int optval, error, save_errno, cs; hints->ai_flags = 0; error = getaddrinfo(hostname, port, hints, &res0); @@ -244,6 +248,10 @@ socket_connect(struct addrinfo *hints, const char *hostname, const char *port) cause = "connect socket"; continue; } + optval = 100000; + if (setsockopt(cs, SOL_SOCKET, SO_SNDBUF, + &optval, sizeof(optval)) == -1) + err(1, "setsockopt sndbuf"); if (connect(cs, res->ai_addr, res->ai_addrlen) == -1) { cause = "connect"; save_errno = errno; |