[netperf-dev] netperf2 commit notice r349 - in trunk: . src
raj at netperf.org
raj at netperf.org
Fri May 21 10:53:14 PDT 2010
Author: raj
Date: 2010-05-21 10:53:14 -0700 (Fri, 21 May 2010)
New Revision: 349
Modified:
trunk/AUTHORS
trunk/Release_Notes
trunk/src/nettest_bsd.c
Log:
workaround to get ENOBUFS on tx overflow on linux provided by Andrew Gallatin
Modified: trunk/AUTHORS
===================================================================
--- trunk/AUTHORS 2010-04-28 00:19:42 UTC (rev 348)
+++ trunk/AUTHORS 2010-05-21 17:53:14 UTC (rev 349)
@@ -105,6 +105,7 @@
calibration-free
fixes to configure to recognize Solaris 11
fixes to netcpu_procstat.c for later linux kernels
+workarounds to get Linux to report ENOBUFS on TX queue overflows
Mark Cooper
pointing-out the need for -lresolv when compiling -DDO_DNS on RedHat
Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes 2010-04-28 00:19:42 UTC (rev 348)
+++ trunk/Release_Notes 2010-05-21 17:53:14 UTC (rev 349)
@@ -1,5 +1,9 @@
These are the Release Notes for post-revision 2.4.5 of netperf:
+*) Add a workaround to get Linux to report TX queue drops in a
+ UDP_STREAM test when the socket buffer size is larger than the
+ TX queue. Provided by Andrew Gallatin.
+
*) Fix the configure script to know it does not have to look for an
SCTP library on FreeBSD 8.X
Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c 2010-04-28 00:19:42 UTC (rev 348)
+++ trunk/src/nettest_bsd.c 2010-05-21 17:53:14 UTC (rev 349)
@@ -6323,6 +6323,35 @@
}
+#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;
+ }
+}
+#endif
+
void
send_udp_stream(char remote_host[])
{
@@ -6554,6 +6583,10 @@
fflush(where);
}
}
+
+#if defined (__linux)
+ enable_enobufs(data_socket);
+#endif
#ifdef WIN32
/* this is used so the timer thread can close the socket out from */
More information about the netperf-dev
mailing list