From: bluhm Date: Wed, 8 Jan 2014 23:32:17 +0000 (+0000) Subject: Set socket buffer size to fixed value of 100000 octets. This X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=14f355dbe81773a6ad69447ab5927e81f267af4e;p=openbsd 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. --- 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 * @@ -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;