[netperf-dev] netperf2 commit notice r535 - in trunk: . src

raj at netperf.org raj at netperf.org
Wed Feb 29 16:48:57 PST 2012


Author: raj
Date: 2012-02-29 16:48:57 -0800 (Wed, 29 Feb 2012)
New Revision: 535

Modified:
   trunk/AUTHORS
   trunk/Release_Notes
   trunk/src/nettest_omni.c
Log:
apply ENOBUFS patch from Shachar Raindel

Modified: trunk/AUTHORS
===================================================================
--- trunk/AUTHORS	2012-02-03 00:06:18 UTC (rev 534)
+++ trunk/AUTHORS	2012-03-01 00:48:57 UTC (rev 535)
@@ -274,4 +274,7 @@
 Uncovering an out of bounds access of the netperf_output_source array.
 
 Bjoern A. Zeeb - a patch to enable netperf to correctly manipulate
-IPv6 addresses in the control message.
\ No newline at end of file
+IPv6 addresses in the control message.
+
+Shachar Raindel - a patch to bring the "get linux to emit ENOBUFS"
+functionality from classic netperf tests to the omni tests.
\ No newline at end of file

Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes	2012-02-03 00:06:18 UTC (rev 534)
+++ trunk/Release_Notes	2012-03-01 00:48:57 UTC (rev 535)
@@ -1,5 +1,10 @@
 These are the Release Notes for post Revision 2.5.0 top-of-trunk netperf:
 
+*) Include a patch from Sachar Raindel to enable the omni tests to get
+   ENOBUFS under Linux when the socket buffer is larger than the tx
+   queue of the egress interface.  This will help preclude netperf's
+   reporting a larger than link-rate send-side figure.
+
 *) Fix a problem with late checking of the return from select() in
    src/netserver.c. Reported by Waqar Sheikh.
 

Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c	2012-02-03 00:06:18 UTC (rev 534)
+++ trunk/src/nettest_omni.c	2012-03-01 00:48:57 UTC (rev 535)
@@ -3179,13 +3179,44 @@
 {
   printf("%s",test_uuid);
 }
+#if defined(__linux)
+/*
+ * Linux has this odd behavior where if the socket buffers are larger
+ * than a device's txqueuelen, the kernel will silently drop transmits
+ * which would not fit into the tx queue, and not pass an ENOBUFS
+ * error back to the application.  As a result, a UDP stream test can
+ * report absurd transmit bandwidths (like 20Gb/s on a 1GbE NIC).
+ * This behavior can be avoided if you request extended error
+ * reporting on the socket.  This is done by setting the IP_RECVERR
+ * socket option at the IP level.
+ */
+static void
+enable_enobufs(int s)
+{
+  struct protoent *pr;
+  int on = 1;
+  
+  if ((pr = getprotobyname("ip")) == NULL) {
+    fprintf(where, "enable_enobufs failed: getprotobyname\n");
+    fflush(where);
+    return;
+  }
+  if (setsockopt(s, pr->p_proto, IP_RECVERR, (char *)&on, sizeof(on)) < 0) {
+    fprintf(where, "enable_enobufs failed: setsockopt\n");
+    fflush(where);
+    return;
+  }
+  /*printf( "enable_enobufs successful\n");*/
+}
+#endif
 
- /* this code is intended to be "the two routines to run them all" for
-    BSDish sockets.  it comes about as part of a desire to shrink the
-    code footprint of netperf and to avoid having so many blessed
-    routines to alter as time goes by.  the downside is there will be
-    more "ifs" than there were before. raj 2008-01-07 */
 
+/* this code is intended to be "the two routines to run them all" for
+   BSDish sockets.  it comes about as part of a desire to shrink the
+   code footprint of netperf and to avoid having so many blessed
+   routines to alter as time goes by.  the downside is there will be
+   more "ifs" than there were before. raj 2008-01-07 */
+
 void
 send_omni_inner(char remote_host[], unsigned int legacy_caller, char header_str[])
 {
@@ -3365,6 +3396,9 @@
       perror("netperf: send_omni: unable to create data socket");
       exit(1);
     }
+#if defined(__linux)
+    enable_enobufs(data_socket);
+#endif
     need_socket = 0;
 
     /* we need to consider if this is a request/response test, if we
@@ -3759,6 +3793,9 @@
 	  exit(1);
 	}
 	need_socket = 0;
+#if defined(__linux)
+	enable_enobufs(data_socket);
+#endif
       }
 
       /* only connect if and when we need to */



More information about the netperf-dev mailing list