[netperf-dev] netperf2 commit notice r616 - trunk/src
raj at netperf.org
raj at netperf.org
Wed Dec 5 16:09:15 PST 2012
Author: raj
Date: 2012-12-05 16:09:15 -0800 (Wed, 05 Dec 2012)
New Revision: 616
Modified:
trunk/src/netlib.c
trunk/src/nettest_bsd.h
trunk/src/nettest_omni.c
Log:
first pass at trying to get fastopen on the server side
Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c 2012-11-28 22:03:09 UTC (rev 615)
+++ trunk/src/netlib.c 2012-12-06 00:09:15 UTC (rev 616)
@@ -3079,7 +3079,7 @@
get_sock_buffer(sd, which, effective_sizep);
#else /* SO_SNDBUF */
- *effective_size = -1;
+ *effective_sizep = -1;
#endif /* SO_SNDBUF */
}
Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h 2012-11-28 22:03:09 UTC (rev 615)
+++ trunk/src/nettest_bsd.h 2012-12-06 00:09:15 UTC (rev 616)
@@ -41,6 +41,7 @@
#define OMNI_WANT_IFIDS 0x00000100
#define OMNI_WANT_DRVINFO 0x00000200
#define OMNI_CHECK_INTERVAL 0x00000400
+#define OMNI_FASTOPEN 0x00000800
/* room in the middle */
#define OMNI_WANT_KEEPALIVE 0x80000000
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2012-11-28 22:03:09 UTC (rev 615)
+++ trunk/src/nettest_omni.c 2012-12-06 00:09:15 UTC (rev 616)
@@ -331,6 +331,7 @@
int remote_checksum_off;
int connection_test;
int use_fastopen = 0;
+int use_write = 0;
int need_to_connect;
int need_connection;
int bytes_to_send;
@@ -2869,10 +2870,17 @@
destlen);
}
else {
- len = send(data_socket,
- send_ring->buffer_ptr,
- bytes_to_send,
- 0);
+ if (!use_write) {
+ len = send(data_socket,
+ send_ring->buffer_ptr,
+ bytes_to_send,
+ 0);
+ }
+ else {
+ len = write(data_socket,
+ send_ring->buffer_ptr,
+ bytes_to_send);
+ }
}
if(len != bytes_to_send) {
/* don't forget that some platforms may do a partial send upon
@@ -3875,6 +3883,9 @@
if (desired_output_groups & OMNI_WANT_REM_CONG)
omni_request->flags |= OMNI_WANT_REM_CONG;
+ if (use_fastopen)
+ omni_request->flags |= OMNI_FASTOPEN;
+
if (check_interval)
omni_request->flags |= OMNI_CHECK_INTERVAL;
@@ -5106,6 +5117,9 @@
#endif
connection_test = omni_request->flags & OMNI_CONNECT_TEST;
+#ifdef TCP_FASTOPEN
+ use_fastopen = omni_request->flags & OMNI_FASTOPEN;
+#endif
direction = omni_request->direction;
/* let's be quite certain the fill file string is null terminated */
@@ -5268,16 +5282,35 @@
accept. the age-old constant of 5 is probably OK for our purposes
but does not necessarily represent best practice */
if (need_to_accept) {
- if (listen(s_listen, 5) == SOCKET_ERROR) {
+ int backlog = 5;
+#ifdef TCP_FASTOPEN
+ /* one of these days I will have to go find-out what the backlog
+ is supposed to be here. until then, I'll just set it to five
+ like the listen() call does - it is classic, and was what was
+ used in the online example I found */
+ if (use_fastopen &&
+ (setsockopt(s_listen,SOL_TCP, TCP_FASTOPEN, &backlog, sizeof(qlen)) ==
+ SOCKET_ERROR)) {
netperf_response.content.serv_errno = errno;
close(s_listen);
send_response();
if (debug) {
- fprintf(where,"could not listen\n");
+ fprintf(where,"netperfserver: %s could not listen\n",__FUNCTION__);
fflush(where);
}
exit(1);
}
+#endif /* TCP_FASTOPEN */
+ if (listen(s_listen, backlog) == SOCKET_ERROR) {
+ netperf_response.content.serv_errno = errno;
+ close(s_listen);
+ send_response();
+ if (debug) {
+ fprintf(where,"netperfserver: %s could not listen\n",__FUNCTION__);
+ fflush(where);
+ }
+ exit(1);
+ }
}
/* now get the port number assigned by the system */
@@ -7047,7 +7080,7 @@
{
-#define OMNI_ARGS "b:cCd:De:FG:hH:i:kK:l:L:m:M:nNoOp:P:r:R:s:S:t:T:u:Vw:W:46"
+#define OMNI_ARGS "b:cCd:De:FG:hH:i:IkK:l:L:m:M:nNoOp:P:r:R:s:S:t:T:u:Vw:W:46"
extern char *optarg; /* pointer to option string */
@@ -7177,6 +7210,9 @@
case 'i':
check_interval = atoi(optarg);
break;
+ case 'I':
+ use_write = 1;
+ break;
case 'k':
netperf_output_mode = KEYVAL;
legacy = 0;
More information about the netperf-dev
mailing list