[netperf-dev] netperf2 commit notice r491 - trunk/src
raj at netperf.org
raj at netperf.org
Thu Sep 22 11:56:49 PDT 2011
Author: raj
Date: 2011-09-22 11:56:48 -0700 (Thu, 22 Sep 2011)
New Revision: 491
Modified:
trunk/src/nettest_bsd.c
trunk/src/nettest_bsd.h
trunk/src/nettest_omni.c
Log:
add option to set the tcp mss to the omni tests
Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c 2011-09-20 21:32:20 UTC (rev 490)
+++ trunk/src/nettest_bsd.c 2011-09-22 18:56:48 UTC (rev 491)
@@ -188,7 +188,8 @@
req_size = 1, /* request size */
rsp_size = 1, /* response size */
send_size, /* how big are individual sends */
- recv_size; /* how big are individual receives */
+ recv_size, /* how big are individual receives */
+ transport_mss_req = -1; /* what maximum segment size is wanted */
static int confidence_iteration;
static char local_cpu_method;
@@ -638,7 +639,7 @@
#ifdef TCP_MAXSEG
netperf_socklen_t sock_opt_len;
- sock_opt_len = sizeof(netperf_socklen_t);
+ sock_opt_len = sizeof(int);
if (getsockopt(socket,
getprotobyname("tcp")->p_proto,
TCP_MAXSEG,
@@ -654,6 +655,37 @@
*mss = -1;
#endif /* TCP_MAXSEG */
}
+
+static
+void
+set_tcp_mss(SOCKET socket, int mss) {
+#ifdef TCP_MAXSEG
+ netperf_socklen_t sock_opt_len;
+
+ sock_opt_len = sizeof(int);
+ if ((setsockopt(socket,
+ getprotobyname("tcp")->p_proto,
+ TCP_MAXSEG,
+ &mss,
+ sock_opt_len) == SOCKET_ERROR) && (debug)) {
+ fprintf(where,
+ "netperf: %s: setsockopt TCP_MAXSEG: %s (errno %d)\n",
+ __FUNCTION__,
+ strerror(errno),
+ errno);
+ fflush(where);
+ }
+#else
+ if (debug) {
+ fprintf(where,
+ "netperf: %s platform does not know how to set TCP segment size\n",
+ __FUNCTION);
+ fflush(where);
+ }
+
+#endif /* TCP_MAXSEG */
+}
+
/* return a pointer to a completed addrinfo chain - prefer
@@ -1315,6 +1347,10 @@
#endif /* TCP_NODELAY */
+ if ((transport_mss_req != -1) && (IPPROTO_TCP == res->ai_protocol)) {
+ set_tcp_mss(temp_socket,transport_mss_req);
+ }
+
#if defined(TCP_CORK)
if (loc_tcpcork > 0) {
Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h 2011-09-20 21:32:20 UTC (rev 490)
+++ trunk/src/nettest_bsd.h 2011-09-22 18:56:48 UTC (rev 491)
@@ -570,7 +570,8 @@
rem_rcvavoid, /* avoid recv_copies remotely */
routing_allowed, /* do we set/clear SO_DONTROUTE on data sock */
multicast_ttl, /* what should the TTL be on mcast dgrams */
- want_keepalive; /* do we bother setting SO_KEEPALIVE? */
+ want_keepalive, /* do we bother setting SO_KEEPALIVE? */
+ transport_mss_req;
#ifdef WANT_OMNI
extern void scan_omni_args(int argc, char *argv[]);
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2011-09-20 21:32:20 UTC (rev 490)
+++ trunk/src/nettest_omni.c 2011-09-22 18:56:48 UTC (rev 491)
@@ -383,7 +383,7 @@
int csv = 0;
int keyword = 0;
uint64_t trans_completed = 0;
-int64_t units_remaining;
+int64_t units_remaining;
uint64_t bytes_sent = 0;
uint64_t bytes_received = 0;
uint64_t local_send_calls = 0;
@@ -7984,7 +7984,7 @@
{
-#define OMNI_ARGS "b:cCd:DhH:kl:L:m:M:nNoOp:P:r:R:s:S:t:T:u:Vw:W:46"
+#define OMNI_ARGS "b:cCd:DG:hH:kl:L:m:M:nNoOp:P:r:R:s:S:t:T:u:Vw:W:46"
extern char *optarg; /* pointer to option string */
@@ -8074,6 +8074,10 @@
loc_nodelay = 1;
rem_nodelay = 1;
break;
+ case 'G':
+ /* set the value for a tcp_maxseG call*/
+ transport_mss_req = atoi(optarg);
+ break;
case 'H':
break_args_explicit_sep(optarg,',',arg1,arg2);
if (arg1[0]) {
More information about the netperf-dev
mailing list