[netperf-dev] netperf2 commit notice r227 - in trunk: . doc doc/examples src src/missing src/missing/m4
raj at netperf.org
raj at netperf.org
Tue Feb 12 13:48:16 PST 2008
Author: raj
Date: 2008-02-12 13:48:15 -0800 (Tue, 12 Feb 2008)
New Revision: 227
Added:
trunk/src/netdrv_ethtool.c
trunk/src/netdrv_none.c
Modified:
trunk/Makefile.in
trunk/config.h.in
trunk/configure
trunk/configure.ac
trunk/doc/Makefile.in
trunk/doc/examples/Makefile.in
trunk/src/Makefile.am
trunk/src/Makefile.in
trunk/src/missing/Makefile.in
trunk/src/missing/m4/Makefile.in
trunk/src/netlib.h
trunk/src/nettest_bsd.h
trunk/src/nettest_omni.c
Log:
teach netperf how to retrieve driver information
Modified: trunk/Makefile.in
===================================================================
--- trunk/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -70,6 +70,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/config.h.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -268,6 +268,9 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
+/* Use Linux's ethtool interface to determine driver information. */
+#undef USE_ETHTOOL
+
/* Use Solaris's kstat interface to measure CPU util. */
#undef USE_KSTAT
Modified: trunk/configure
===================================================================
--- trunk/configure 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/configure 2008-02-12 21:48:15 UTC (rev 227)
@@ -706,6 +706,7 @@
NEED_LIBCOMPAT_FALSE
NETCPU_SOURCE
NETRTLKUP_SOURCE
+NETDRVLKUP_SOURCE
LTLIBOBJS'
ac_subst_files=''
ac_precious_vars='build_alias
@@ -1322,6 +1323,8 @@
specified mechanism
--enable-rtlookup include code to find the probable egress interface
using specified mechanism
+ --enable-drvlookup include code to find the probable egress interface
+ using specified mechanism
Some influential environment variables:
CC C compiler command
@@ -9473,9 +9476,9 @@
use_cpuutil=false
;;
*)
- { { echo "$as_me:$LINENO: error: --enable-cpuutil takes kstat" >&5
-echo "$as_me: error: --enable-cpuutil takes kstat" >&2;}
- { (exit kstat10); exit kstat10; }; }
+ { { echo "$as_me:$LINENO: error: --enable-cpuutil takes kstat, kstat10, looper, osx, perfstat, procstat, pstat, pstatnew, sysctl or none" >&5
+echo "$as_me: error: --enable-cpuutil takes kstat, kstat10, looper, osx, perfstat, procstat, pstat, pstatnew, sysctl or none" >&2;}
+ { (exit 1); exit 1; }; }
;;
esac
@@ -9484,7 +9487,7 @@
-# time to see about route lookup utilization measurements
+# time to see about route lookup mechanisms
{ echo "$as_me:$LINENO: checking which route lookup type to use" >&5
echo $ECHO_N "checking which route lookup type to use... $ECHO_C" >&6; }
@@ -9515,8 +9518,6 @@
;;
'')
-# ia64-hp-hpux11.23
-# i386-pc-solaris2.10
# guess it automagically in a nice big case statement
case $target in
*-*-linux*)
@@ -9570,9 +9571,9 @@
use_rtlookup=false
;;
*)
- { { echo "$as_me:$LINENO: error: --enable-rtlookup takes rtmget" >&5
-echo "$as_me: error: --enable-rtlookup takes rtmget" >&2;}
- { (exit rtnetlink or none]); exit rtnetlink or none]; }; }
+ { { echo "$as_me:$LINENO: error: --enable-rtlookup takes rtmget, rtnetlink or none" >&5
+echo "$as_me: error: --enable-rtlookup takes rtmget, rtnetlink or none" >&2;}
+ { (exit 1); exit 1; }; }
;;
esac
@@ -9581,6 +9582,63 @@
+# time to see about route lookup mechanisms
+
+{ echo "$as_me:$LINENO: checking which driver info lookup type to use" >&5
+echo $ECHO_N "checking which driver info lookup type to use... $ECHO_C" >&6; }
+
+# Check whether --enable-drvlookup was given.
+if test "${enable_drvlookup+set}" = set; then
+ enableval=$enable_drvlookup;
+fi
+
+
+NETDRVLKUP_SOURCE="$enable_drvlookup"
+case "$enable_drvlookup" in
+ ethtool)
+ use_drvlookup=true
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_ETHTOOL
+_ACEOF
+
+ ;;
+
+ '')
+# guess it automagically in a nice big case statement
+ case $target in
+ *-*-linux*)
+ use_drvlookup=true
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_ETHTOOL
+_ACEOF
+
+ enable_drvlookup="ethtool - auto"
+ NETDRVLKUP_SOURCE="ethtool"
+ ;;
+ *)
+ use_drvlookup=false
+ NETDRVLKUP_SOURCE="none"
+ enable_drvlookup="none. Consider teaching configure about your platform."
+ ;;
+ esac
+ ;;
+ none)
+ use_drvlookup=false
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: --enable-drvlookup takes ethtool or none" >&5
+echo "$as_me: error: --enable-drvlookup takes ethtool or none" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+esac
+
+ { echo "$as_me:$LINENO: result: \"$enable_drvlookup\"" >&5
+echo "${ECHO_T}\"$enable_drvlookup\"" >&6; }
+
+
+
# now spit it all out
ac_config_files="$ac_config_files Makefile src/netperf_version.h src/Makefile src/missing/Makefile src/missing/m4/Makefile doc/Makefile doc/examples/Makefile netperf.spec"
@@ -10332,10 +10390,11 @@
NEED_LIBCOMPAT_FALSE!$NEED_LIBCOMPAT_FALSE$ac_delim
NETCPU_SOURCE!$NETCPU_SOURCE$ac_delim
NETRTLKUP_SOURCE!$NETRTLKUP_SOURCE$ac_delim
+NETDRVLKUP_SOURCE!$NETDRVLKUP_SOURCE$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 93; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/configure.ac 2008-02-12 21:48:15 UTC (rev 227)
@@ -713,7 +713,7 @@
use_cpuutil=false
;;
*)
- AC_MSG_ERROR(--enable-cpuutil takes kstat, kstat10, looper, osx, perfstat, procstat, pstat, pstatnew, sysctl or none])
+ AC_MSG_ERROR([--enable-cpuutil takes kstat, kstat10, looper, osx, perfstat, procstat, pstat, pstatnew, sysctl or none])
;;
esac
@@ -721,7 +721,7 @@
AC_SUBST(NETCPU_SOURCE)
-# time to see about route lookup utilization measurements
+# time to see about route lookup mechanisms
AC_MSG_CHECKING([which route lookup type to use])
@@ -740,8 +740,6 @@
AC_DEFINE([USE_RTNETLINK],,[Use Linux's rtnetlink interface to dettermine egress interface.])
;;
'')
-# ia64-hp-hpux11.23
-# i386-pc-solaris2.10
# guess it automagically in a nice big case statement
case $target in
*-*-linux*)
@@ -779,7 +777,7 @@
use_rtlookup=false
;;
*)
- AC_MSG_ERROR(--enable-rtlookup takes rtmget, rtnetlink or none])
+ AC_MSG_ERROR([--enable-rtlookup takes rtmget, rtnetlink or none])
;;
esac
@@ -787,6 +785,48 @@
AC_SUBST(NETRTLKUP_SOURCE)
+# time to see about route lookup mechanisms
+
+AC_MSG_CHECKING([which driver info lookup type to use])
+
+AC_ARG_ENABLE(drvlookup,
+ [AS_HELP_STRING([--enable-drvlookup],[include code to find the probable egress interface using specified mechanism])])
+
+NETDRVLKUP_SOURCE="$enable_drvlookup"
+case "$enable_drvlookup" in
+ ethtool)
+ use_drvlookup=true
+ AC_DEFINE([USE_ETHTOOL],,[Use Ethtool IOCTLs on a socket to get egress interface.])
+ ;;
+
+ '')
+# guess it automagically in a nice big case statement
+ case $target in
+ *-*-linux*)
+ use_drvlookup=true
+ AC_DEFINE([USE_ETHTOOL],,[Use Linux's ethtool interface to determine driver information.])
+ enable_drvlookup="ethtool - auto"
+ NETDRVLKUP_SOURCE="ethtool"
+ ;;
+ *)
+ use_drvlookup=false
+ NETDRVLKUP_SOURCE="none"
+ enable_drvlookup="none. Consider teaching configure about your platform."
+ ;;
+ esac
+ ;;
+ none)
+ use_drvlookup=false
+ ;;
+ *)
+ AC_MSG_ERROR([--enable-drvlookup takes ethtool or none])
+ ;;
+esac
+
+ AC_MSG_RESULT("$enable_drvlookup")
+
+AC_SUBST(NETDRVLKUP_SOURCE)
+
# now spit it all out
AC_CONFIG_FILES([Makefile
src/netperf_version.h
Modified: trunk/doc/Makefile.in
===================================================================
--- trunk/doc/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/doc/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -74,6 +74,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
Modified: trunk/doc/examples/Makefile.in
===================================================================
--- trunk/doc/examples/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/doc/examples/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -70,6 +70,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/Makefile.am 2008-02-12 21:48:15 UTC (rev 227)
@@ -8,13 +8,14 @@
USE_CPU_SOURCE=netcpu_ at NETCPU_SOURCE@.c
USE_RT_SOURCE=netrt_ at NETRTLKUP_SOURCE@.c
+USE_DRV_SOURCE=netdrv_ at NETDRVLKUP_SOURCE@.c
-EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c dirs NetPerfDir/* NetServerDir/* netperf_version.h.in netrt_rtnetlink.c
+EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c dirs NetPerfDir/* NetServerDir/* netperf_version.h.in netrt_rtnetlink.c netrt_none.c netrt_rtmget.c netdrv_ethtool.c netdrv_none.c
COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h netperf_version.h nettest_sdp.c nettest_sdp.h nettest_omni.c
-netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE)
-netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
# if there are any "missing" routines, the libobjs should cover it
if NEED_LIBCOMPAT
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -70,6 +70,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
@@ -138,13 +139,14 @@
USE_CPU_SOURCE = netcpu_ at NETCPU_SOURCE@.c
USE_RT_SOURCE = netrt_ at NETRTLKUP_SOURCE@.c
+USE_DRV_SOURCE = netdrv_ at NETDRVLKUP_SOURCE@.c
-EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c dirs NetPerfDir/* NetServerDir/* netperf_version.h.in netrt_rtnetlink.c
+EXTRA_DIST = netcpu_none.c netcpu_looper.c netcpu_pstat.c netcpu_pstatnew.c netcpu_perfstat.c netcpu_procstat.c netcpu_kstat.c netcpu_kstat10.c netcpu_sysctl.c netcpu_ntperf.c netcpu_osx.c dirs NetPerfDir/* NetServerDir/* netperf_version.h.in netrt_rtnetlink.c netrt_none.c netrt_rtmget.c netdrv_ethtool.c netdrv_none.c
COMMON_SRC = hist.h netlib.c netlib.h netcpu.h netsh.c netsh.h nettest_bsd.c nettest_bsd.h nettest_dlpi.c nettest_dlpi.h nettest_unix.c nettest_unix.h nettest_xti.c nettest_xti.h nettest_sctp.c nettest_sctp.h netperf_version.h nettest_sdp.c nettest_sdp.h nettest_omni.c
-netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE)
-netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
# if there are any "missing" routines, the libobjs should cover it
@NEED_LIBCOMPAT_TRUE at netperf_LDADD = missing/libcompat.a
@@ -163,14 +165,15 @@
nettest_sdp.$(OBJEXT) nettest_omni.$(OBJEXT)
am__objects_2 = netcpu_ at NETCPU_SOURCE@.$(OBJEXT)
am__objects_3 = netrt_ at NETRTLKUP_SOURCE@.$(OBJEXT)
+am__objects_4 = netdrv_ at NETDRVLKUP_SOURCE@.$(OBJEXT)
am_netperf_OBJECTS = netperf.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
- $(am__objects_3)
+ $(am__objects_3) $(am__objects_4)
netperf_OBJECTS = $(am_netperf_OBJECTS)
@NEED_LIBCOMPAT_TRUE at netperf_DEPENDENCIES = missing/libcompat.a
@NEED_LIBCOMPAT_FALSE at netperf_DEPENDENCIES =
netperf_LDFLAGS =
am_netserver_OBJECTS = netserver.$(OBJEXT) $(am__objects_1) \
- $(am__objects_2) $(am__objects_3)
+ $(am__objects_2) $(am__objects_3) $(am__objects_4)
netserver_OBJECTS = $(am_netserver_OBJECTS)
@NEED_LIBCOMPAT_TRUE at netserver_DEPENDENCIES = missing/libcompat.a
@NEED_LIBCOMPAT_FALSE at netserver_DEPENDENCIES =
@@ -180,6 +183,7 @@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE at DEP_FILES = ./$(DEPDIR)/netcpu_ at NETCPU_SOURCE@.Po \
+ at AMDEP_TRUE@ ./$(DEPDIR)/netdrv_ at NETDRVLKUP_SOURCE@.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/netlib.Po ./$(DEPDIR)/netperf.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/netrt_ at NETRTLKUP_SOURCE@.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/netserver.Po ./$(DEPDIR)/netsh.Po \
@@ -254,6 +258,7 @@
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netcpu_ at NETCPU_SOURCE@.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netdrv_ at NETDRVLKUP_SOURCE@.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netlib.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netperf.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netrt_ at NETRTLKUP_SOURCE@.Po at am__quote@
Modified: trunk/src/missing/Makefile.in
===================================================================
--- trunk/src/missing/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/missing/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -70,6 +70,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
Modified: trunk/src/missing/m4/Makefile.in
===================================================================
--- trunk/src/missing/m4/Makefile.in 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/missing/m4/Makefile.in 2008-02-12 21:48:15 UTC (rev 227)
@@ -70,6 +70,7 @@
NEED_LIBCOMPAT_FALSE = @NEED_LIBCOMPAT_FALSE@
NEED_LIBCOMPAT_TRUE = @NEED_LIBCOMPAT_TRUE@
NETCPU_SOURCE = @NETCPU_SOURCE@
+NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
Added: trunk/src/netdrv_ethtool.c
===================================================================
--- trunk/src/netdrv_ethtool.c (rev 0)
+++ trunk/src/netdrv_ethtool.c 2008-02-12 21:48:15 UTC (rev 227)
@@ -0,0 +1,87 @@
+#include <sys/types.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <net/if.h>
+#include <linux/sockios.h>
+
+/* alas, direct inclusion of ethtool.h depends on some types not
+ normally found in nature, which we must provide or things will be
+ quite unhappy. */
+
+typedef __uint64_t __u64;
+typedef __uint32_t __u32;
+typedef __uint16_t __u16;
+typedef __uint8_t __u8;
+
+#include <linux/ethtool.h>
+
+void
+find_driver_info(char *ifname, char *driver, char *version, char *firmware, char *bus, int len) {
+
+ int s;
+ int ret;
+ struct ifreq ifr;
+ struct ethtool_drvinfo drvinfo;
+
+ if (len < 32) return;
+
+ if (!strcmp(ifname,"lo")) {
+ /* special case loopback */
+ strncpy(driver,"loopback",len);
+ strncpy(version,"system",len);
+ strncpy(firmware,"N/A",len);
+ strncpy(bus,"N/A",len);
+ driver[len-1] = 0;
+ version[len-1] = 0;
+ firmware[len-1] = 0;
+ bus[len-1] = 0;
+ return;
+ }
+
+ s = socket(AF_INET,SOCK_DGRAM,0);
+
+ if (s < 0) {
+ strncpy(driver,"SocketFailure",len);
+ strncpy(version,"SocketFailure",len);
+ strncpy(firmware,"SocketFailure",len);
+ strncpy(bus,"SocketFailure",len);
+ driver[len-1] = 0;
+ version[len-1] = 0;
+ firmware[len-1] = 0;
+ bus[len-1] = 0;
+ return;
+ }
+
+ memset(&ifr, 0, sizeof(ifr));
+ drvinfo.cmd = ETHTOOL_GDRVINFO;
+ strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)-1);
+ ifr.ifr_data = (caddr_t)&drvinfo;
+
+ ret = ioctl(s, SIOCETHTOOL, &ifr);
+
+ printf("ret is %d\n",ret);
+ if (ret == -1) {
+ strncpy(driver,"IoctlFailure",len);
+ strncpy(version,"IoctlFailure",len);
+ strncpy(firmware,"IoctlFailure",len);
+ strncpy(bus,"IoctlFailure",len);
+ driver[len-1] = 0;
+ version[len-1] = 0;
+ firmware[len-1] = 0;
+ bus[len-1] = 0;
+ return;
+ }
+ strncpy(driver,drvinfo.driver,len);
+ strncpy(version,drvinfo.version,len);
+ strncpy(firmware,drvinfo.fw_version,len);
+ strncpy(bus,drvinfo.bus_info,len);
+ driver[len-1] = 0;
+ version[len-1] = 0;
+ firmware[len-1] = 0;
+ bus[len-1] = 0;
+
+ return;
+}
Added: trunk/src/netdrv_none.c
===================================================================
--- trunk/src/netdrv_none.c (rev 0)
+++ trunk/src/netdrv_none.c 2008-02-12 21:48:15 UTC (rev 227)
@@ -0,0 +1,13 @@
+void
+find_driver_info(char *ifname, char *driver, char *version, char *firmware, char *bus, int len) {
+
+ strncpy(driver,"Unavailable",len);
+ strncpy(version,"Unavailable",len);
+ strncpy(firmware,"Unavailable",len);
+ strncpy(bus,"Unavailable",len);
+ driver[len-1] = 0;
+ version[len-1] = 0;
+ firmware[len-1] = 0;
+ bus[len-1] = 0;
+ return;
+}
Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/netlib.h 2008-02-12 21:48:15 UTC (rev 227)
@@ -535,6 +535,7 @@
extern void bind_to_specific_processor(int processor_affinity,int use_cpu_map);
extern int set_nonblock (SOCKET sock);
extern char *find_egress_interface(struct sockaddr *source, struct sockaddr *dest);
+extern void find_driver_info(char *ifname, char *driver, char *version, char *firmware, char *bus, int len);
#ifndef WIN32
Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/nettest_bsd.h 2008-02-12 21:48:15 UTC (rev 227)
@@ -110,7 +110,12 @@
int32_t peak_cpu_id; /* ID of the most utilized CPU */
float peak_cpu_util; /* its individual utilization */
+ /* this is the 18th 32-bit word and we have 248 bytes available */
char ifname[16]; /* the probable egress interface */
+ char driver[32]; /* size based on linux/ethtool.h */
+ char version[32];
+ char firmware[32];
+ char bus[32];
};
#endif /* WANT_OMNI */
Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c 2008-02-12 17:36:51 UTC (rev 226)
+++ trunk/src/nettest_omni.c 2008-02-12 21:48:15 UTC (rev 227)
@@ -297,6 +297,14 @@
int32_t transport_mss = -1;
char *local_interface_name=NULL;
char *remote_interface_name=NULL;
+char local_driver_name[32]="";
+char local_driver_version[32]="";
+char local_driver_firmware[32]="";
+char local_driver_bus[32]="";
+char remote_driver_name[32]="";
+char remote_driver_version[32]="";
+char remote_driver_firmware[32]="";
+char remote_driver_bus[32]="";
int printing_initialized = 0;
@@ -448,6 +456,14 @@
REMOTE_MACHINE,
LOCAL_INTERFACE_NAME,
REMOTE_INTERFACE_NAME,
+ LOCAL_DRIVER_NAME,
+ LOCAL_DRIVER_VERSION,
+ LOCAL_DRIVER_FIRMWARE,
+ LOCAL_DRIVER_BUS,
+ REMOTE_DRIVER_NAME,
+ REMOTE_DRIVER_VERSION,
+ REMOTE_DRIVER_FIRMWARE,
+ REMOTE_DRIVER_BUS,
OUTPUT_END,
NETPERF_OUTPUT_MAX
};
@@ -789,6 +805,22 @@
return "LOCAL_INTERFACE_NAME";
case REMOTE_INTERFACE_NAME:
return "REMOTE_INTERFACE_NAME";
+ case REMOTE_DRIVER_NAME:
+ return "REMOTE_DRIVER_NAME";
+ case REMOTE_DRIVER_VERSION:
+ return "REMOTE_DRIVER_VERSION";
+ case REMOTE_DRIVER_FIRMWARE:
+ return "REMOTE_DRIVER_FIRMWARE";
+ case REMOTE_DRIVER_BUS:
+ return "REMOTE_DRIVER_BUS";
+ case LOCAL_DRIVER_NAME:
+ return "LOCAL_DRIVER_NAME";
+ case LOCAL_DRIVER_VERSION:
+ return "LOCAL_DRIVER_VERSION";
+ case LOCAL_DRIVER_FIRMWARE:
+ return "LOCAL_DRIVER_FIRMWARE";
+ case LOCAL_DRIVER_BUS:
+ return "LOCAL_DRIVER_BUS";
case REMOTE_SYSNAME:
return "REMOTE_SYSNAME";
case REMOTE_MACHINE:
@@ -1152,6 +1184,14 @@
output_csv_list[i++] = REMOTE_MACHINE;
output_csv_list[i++] = LOCAL_INTERFACE_NAME;
output_csv_list[i++] = REMOTE_INTERFACE_NAME;
+ output_csv_list[i++] = LOCAL_DRIVER_NAME;
+ output_csv_list[i++] = LOCAL_DRIVER_VERSION;
+ output_csv_list[i++] = LOCAL_DRIVER_FIRMWARE;
+ output_csv_list[i++] = LOCAL_DRIVER_BUS;
+ output_csv_list[i++] = REMOTE_DRIVER_NAME;
+ output_csv_list[i++] = REMOTE_DRIVER_VERSION;
+ output_csv_list[i++] = REMOTE_DRIVER_FIRMWARE;
+ output_csv_list[i++] = REMOTE_DRIVER_BUS;
output_csv_list[i++] = RESULT_BRAND;
output_csv_list[i++] = COMMAND_LINE;
@@ -2324,10 +2364,106 @@
netperf_output_source[REMOTE_CORK].tot_line_len =
NETPERF_LINE_TOT(REMOTE_CORK);
+ netperf_output_source[LOCAL_DRIVER_NAME].output_name = LOCAL_DRIVER_NAME;
+ netperf_output_source[LOCAL_DRIVER_NAME].line[0] = "Local";
+ netperf_output_source[LOCAL_DRIVER_NAME].line[1] = "Driver";
+ netperf_output_source[LOCAL_DRIVER_NAME].line[2] = "Name";
+ netperf_output_source[LOCAL_DRIVER_NAME].line[3] = "";
+ netperf_output_source[LOCAL_DRIVER_NAME].format = "%s";
+ netperf_output_source[LOCAL_DRIVER_NAME].display_value = local_driver_name;
+ netperf_output_source[LOCAL_DRIVER_NAME].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_DRIVER_NAME);
+ netperf_output_source[LOCAL_DRIVER_NAME].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_DRIVER_NAME);
+
+ netperf_output_source[LOCAL_DRIVER_VERSION].output_name = LOCAL_DRIVER_VERSION;
+ netperf_output_source[LOCAL_DRIVER_VERSION].line[0] = "Local";
+ netperf_output_source[LOCAL_DRIVER_VERSION].line[1] = "Driver";
+ netperf_output_source[LOCAL_DRIVER_VERSION].line[2] = "Version";
+ netperf_output_source[LOCAL_DRIVER_VERSION].line[3] = "";
+ netperf_output_source[LOCAL_DRIVER_VERSION].format = "%s";
+ netperf_output_source[LOCAL_DRIVER_VERSION].display_value = local_driver_version;
+ netperf_output_source[LOCAL_DRIVER_VERSION].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_DRIVER_VERSION);
+ netperf_output_source[LOCAL_DRIVER_VERSION].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_DRIVER_VERSION);
+
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].output_name = LOCAL_DRIVER_FIRMWARE;
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].line[0] = "Local";
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].line[1] = "Driver";
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].line[2] = "Firmware";
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].line[3] = "";
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].format = "%s";
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].display_value = local_driver_firmware;
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_DRIVER_FIRMWARE);
+ netperf_output_source[LOCAL_DRIVER_FIRMWARE].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_DRIVER_FIRMWARE);
+
+ netperf_output_source[LOCAL_DRIVER_BUS].output_name = LOCAL_DRIVER_BUS;
+ netperf_output_source[LOCAL_DRIVER_BUS].line[0] = "Local";
+ netperf_output_source[LOCAL_DRIVER_BUS].line[1] = "Driver";
+ netperf_output_source[LOCAL_DRIVER_BUS].line[2] = "Bus";
+ netperf_output_source[LOCAL_DRIVER_BUS].line[3] = "";
+ netperf_output_source[LOCAL_DRIVER_BUS].format = "%s";
+ netperf_output_source[LOCAL_DRIVER_BUS].display_value = local_driver_bus;
+ netperf_output_source[LOCAL_DRIVER_BUS].max_line_len =
+ NETPERF_LINE_MAX(LOCAL_DRIVER_BUS);
+ netperf_output_source[LOCAL_DRIVER_BUS].tot_line_len =
+ NETPERF_LINE_TOT(LOCAL_DRIVER_BUS);
+
+ netperf_output_source[REMOTE_DRIVER_NAME].output_name = REMOTE_DRIVER_NAME;
+ netperf_output_source[REMOTE_DRIVER_NAME].line[0] = "Remote";
+ netperf_output_source[REMOTE_DRIVER_NAME].line[1] = "Driver";
+ netperf_output_source[REMOTE_DRIVER_NAME].line[2] = "Name";
+ netperf_output_source[REMOTE_DRIVER_NAME].line[3] = "";
+ netperf_output_source[REMOTE_DRIVER_NAME].format = "%s";
+ netperf_output_source[REMOTE_DRIVER_NAME].display_value = remote_driver_name;
+ netperf_output_source[REMOTE_DRIVER_NAME].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_DRIVER_NAME);
+ netperf_output_source[REMOTE_DRIVER_NAME].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_DRIVER_NAME);
+
+ netperf_output_source[REMOTE_DRIVER_VERSION].output_name = REMOTE_DRIVER_VERSION;
+ netperf_output_source[REMOTE_DRIVER_VERSION].line[0] = "Remote";
+ netperf_output_source[REMOTE_DRIVER_VERSION].line[1] = "Driver";
+ netperf_output_source[REMOTE_DRIVER_VERSION].line[2] = "Version";
+ netperf_output_source[REMOTE_DRIVER_VERSION].line[3] = "";
+ netperf_output_source[REMOTE_DRIVER_VERSION].format = "%s";
+ netperf_output_source[REMOTE_DRIVER_VERSION].display_value = remote_driver_version;
+ netperf_output_source[REMOTE_DRIVER_VERSION].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_DRIVER_VERSION);
+ netperf_output_source[REMOTE_DRIVER_VERSION].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_DRIVER_VERSION);
+
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].output_name = REMOTE_DRIVER_FIRMWARE;
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].line[0] = "Remote";
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].line[1] = "Driver";
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].line[2] = "Firmware";
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].line[3] = "";
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].format = "%s";
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].display_value = remote_driver_firmware;
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_DRIVER_FIRMWARE);
+ netperf_output_source[REMOTE_DRIVER_FIRMWARE].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_DRIVER_FIRMWARE);
+
+ netperf_output_source[REMOTE_DRIVER_BUS].output_name = REMOTE_DRIVER_BUS;
+ netperf_output_source[REMOTE_DRIVER_BUS].line[0] = "Remote";
+ netperf_output_source[REMOTE_DRIVER_BUS].line[1] = "Driver";
+ netperf_output_source[REMOTE_DRIVER_BUS].line[2] = "Bus";
+ netperf_output_source[REMOTE_DRIVER_BUS].line[3] = "";
+ netperf_output_source[REMOTE_DRIVER_BUS].format = "%s";
+ netperf_output_source[REMOTE_DRIVER_BUS].display_value = remote_driver_bus;
+ netperf_output_source[REMOTE_DRIVER_BUS].max_line_len =
+ NETPERF_LINE_MAX(REMOTE_DRIVER_BUS);
+ netperf_output_source[REMOTE_DRIVER_BUS].tot_line_len =
+ NETPERF_LINE_TOT(REMOTE_DRIVER_BUS);
+
netperf_output_source[LOCAL_INTERFACE_NAME].output_name = LOCAL_INTERFACE_NAME;
netperf_output_source[LOCAL_INTERFACE_NAME].line[0] = "Local";
netperf_output_source[LOCAL_INTERFACE_NAME].line[1] = "Interface";
- netperf_output_source[LOCAL_INTERFACE_NAME].line[2] = "NAME";
+ netperf_output_source[LOCAL_INTERFACE_NAME].line[2] = "Name";
netperf_output_source[LOCAL_INTERFACE_NAME].line[3] = "";
netperf_output_source[LOCAL_INTERFACE_NAME].format = "%s";
netperf_output_source[LOCAL_INTERFACE_NAME].display_value = local_interface_name;
@@ -2339,7 +2475,7 @@
netperf_output_source[REMOTE_INTERFACE_NAME].output_name = REMOTE_INTERFACE_NAME;
netperf_output_source[REMOTE_INTERFACE_NAME].line[0] = "Remote";
netperf_output_source[REMOTE_INTERFACE_NAME].line[1] = "Interface";
- netperf_output_source[REMOTE_INTERFACE_NAME].line[2] = "NAME";
+ netperf_output_source[REMOTE_INTERFACE_NAME].line[2] = "Name";
netperf_output_source[REMOTE_INTERFACE_NAME].line[3] = "";
netperf_output_source[REMOTE_INTERFACE_NAME].format = "%s";
netperf_output_source[REMOTE_INTERFACE_NAME].display_value = remote_interface_name;
@@ -3890,15 +4026,16 @@
lss_size_end = lss_size;
}
- local_interface_name =
- find_egress_interface(local_res->ai_addr,remote_res->ai_addr);
-
-
/* this call will always give us the elapsed time for the test, and
will also store-away the necessaries for cpu utilization */
cpu_stop(local_cpu_usage,&elapsed_time);
+ local_interface_name =
+ find_egress_interface(local_res->ai_addr,remote_res->ai_addr);
+
+ find_driver_info(local_interface_name,local_driver_name,local_driver_version,local_driver_firmware,local_driver_bus,32);
+
/* if we timed-out, and had padded the timer, we need to subtract
the pad_time from the elapsed time on the assumption that we
were essentially idle for pad_time and just waiting for a timer
@@ -3955,6 +4092,14 @@
remote_bytes_per_send = 0.0;
omni_result->ifname[15] = 0; /* belt and suspenders */
remote_interface_name = strdup(omni_result->ifname);
+ strncpy(remote_driver_name,omni_result->driver,32);
+ strncpy(remote_driver_version,omni_result->version,32);
+ strncpy(remote_driver_firmware,omni_result->firmware,32);
+ strncpy(remote_driver_bus,omni_result->bus,32);
+ remote_driver_name[31] = 0;
+ remote_driver_version[31] = 0;
+ remote_driver_firmware[31] = 0;
+ remote_driver_bus[31] = 0;
}
else {
Set_errno(netperf_response.content.serv_errno);
@@ -4761,6 +4906,12 @@
find_egress_interface(local_res->ai_addr,(struct sockaddr *)&peeraddr_in);
strncpy(omni_results->ifname,local_interface_name,16);
omni_results->ifname[15] = 0;
+ find_driver_info(local_interface_name,
+ omni_results->driver,
+ omni_results->version,
+ omni_results->firmware,
+ omni_results->bus,
+ 32);
if (debug) {
fprintf(where,
"recv_omni: test complete, sending results.\n");
More information about the netperf-dev
mailing list