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

raj at netperf.org raj at netperf.org
Wed Mar 19 15:59:13 PDT 2008


Author: raj
Date: 2008-03-19 15:59:12 -0700 (Wed, 19 Mar 2008)
New Revision: 270

Added:
   trunk/src/netdrv_solaris.c
Modified:
   trunk/config.h.in
   trunk/configure
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/Makefile.in
   trunk/src/netslot_none.c
Log:
take a guess as to driver name on solaris by stripping cruft from the interface name

Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in	2008-03-19 19:42:20 UTC (rev 269)
+++ trunk/config.h.in	2008-03-19 22:59:12 UTC (rev 270)
@@ -292,9 +292,6 @@
 /* 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-03-19 19:42:20 UTC (rev 269)
+++ trunk/configure	2008-03-19 22:59:12 UTC (rev 270)
@@ -1327,8 +1327,8 @@
                           using specified mechanism
   --enable-slotlookup     include code to find the probable egress interface
                           using specified mechanism
-  --enable-drvlookup      include code to find the probable egress interface
-                          using specified mechanism
+  --enable-drvlookup      include code to find the driver information for the
+                          probable egress interface
   --enable-syslookup      include code to find some rudimentary system
                           information
 
@@ -9689,26 +9689,24 @@
 case "$enable_drvlookup" in
 	ethtool)
 		use_drvlookup=true
-
-cat >>confdefs.h <<\_ACEOF
-#define USE_ETHTOOL
-_ACEOF
-
 		;;
 
+	solaris)
+		use_drvlookup=true
+		;;
 	'')
 # 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"
 			;;
+		     *-*-solaris*)
+		        use_drvlookup=true
+			enable_drvlookup="solaris - auto"
+			NETDRVLKUP_SOURCE="solaris"
+			;;
 		     *)
 			use_drvlookup=false
 			NETDRVLKUP_SOURCE="none"

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2008-03-19 19:42:20 UTC (rev 269)
+++ trunk/configure.ac	2008-03-19 22:59:12 UTC (rev 270)
@@ -822,24 +822,30 @@
 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])])
+	[AS_HELP_STRING([--enable-drvlookup],[include code to find the driver information for the probable egress interface])])
 
 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.])
 		;;
 
+	solaris)
+		use_drvlookup=true
+		;;
 	'')
 # 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"
 			;;
+		     *-*-solaris*)
+		        use_drvlookup=true
+			enable_drvlookup="solaris - auto"
+			NETDRVLKUP_SOURCE="solaris"
+			;;
 		     *)
 			use_drvlookup=false
 			NETDRVLKUP_SOURCE="none"

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-03-19 19:42:20 UTC (rev 269)
+++ trunk/src/Makefile.am	2008-03-19 22:59:12 UTC (rev 270)
@@ -12,7 +12,7 @@
 USE_SLOT_SOURCE=netslot_ at NETSLOTLKUP_SOURCE@.c
 USE_SYS_SOURCE=netsys_ at NETSYSLKUP_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 netrt_none.c netrt_rtmget.c netdrv_ethtool.c netdrv_none.c netslot_linux.c netslot_none.c netsys_none.c netsys_hpux11i.c netsys_linux.c netsys_solaris.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 netslot_linux.c netslot_none.c netsys_none.c netsys_hpux11i.c netsys_linux.c netsys_solaris.c netdrv_solaris.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
 

Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2008-03-19 19:42:20 UTC (rev 269)
+++ trunk/src/Makefile.in	2008-03-19 22:59:12 UTC (rev 270)
@@ -145,7 +145,7 @@
 USE_SLOT_SOURCE = netslot_ at NETSLOTLKUP_SOURCE@.c
 USE_SYS_SOURCE = netsys_ at NETSYSLKUP_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 netrt_none.c netrt_rtmget.c netdrv_ethtool.c netdrv_none.c netslot_linux.c netslot_none.c netsys_none.c netsys_hpux11i.c netsys_linux.c netsys_solaris.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 netslot_linux.c netslot_none.c netsys_none.c netsys_hpux11i.c netsys_linux.c netsys_solaris.c netdrv_solaris.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
 

Added: trunk/src/netdrv_solaris.c
===================================================================
--- trunk/src/netdrv_solaris.c	                        (rev 0)
+++ trunk/src/netdrv_solaris.c	2008-03-19 22:59:12 UTC (rev 270)
@@ -0,0 +1,67 @@
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+#if defined(NETPERF_STANDALONE_DEBUG)
+#include <stdio.h>
+#include <stdlib.h>
+#endif
+
+void
+find_driver_info(char *ifname, char *driver, char *version, char *firmware, char *bus, int len) {
+
+  /* until something better comes along, we will use the expedient
+     that the interface name, up to but not including the instance
+     number is the driver name. raj 2008-03-19 */
+  int i;
+
+  strncpy(driver,ifname,len);
+  driver[len-1] = 0;
+
+  /* work backwards nuking numbers and punctuation */
+  for (i = strlen(driver) - 1; ((isdigit(driver[i])) ||
+				(ispunct(driver[i]))) && (i >= 0); i--) {
+    driver[i] = 0;
+  }
+
+  /* on the off chance we managed to toast the entire string, we
+     should probably mention that somehow. raj 2008-03-19 */
+  if (strlen(driver) == 0) 
+    strncpy(driver,"NoAlpha",len);
+
+  strncpy(version,"Unavailable",len);
+  strncpy(firmware,"Unavailable",len);
+  strncpy(bus,"Unavailable",len);
+  version[len-1] = 0;
+  firmware[len-1] = 0;
+  bus[len-1] = 0;
+  return;
+}
+
+#if defined(NETPERF_STANDALONE_DEBUG)
+int
+main(int argc, char *argv[]) {
+
+#define MYLEN 32
+  char driver[MYLEN];
+  char version[MYLEN];
+  char firmware[MYLEN];
+  char bus[MYLEN];
+
+  if (argc != 2) {
+    fprintf(stderr,"%s <interfacename>\n",argv[0]);
+    exit(-1);
+  }
+
+  find_driver_info(argv[1],driver, version, firmware, bus, MYLEN);
+
+  printf("Interface %s driver %s version %s firmware %s bus %s\n",
+	 argv[1], driver, version, firmware, bus);
+
+  return 0;
+
+}
+#endif

Modified: trunk/src/netslot_none.c
===================================================================
--- trunk/src/netslot_none.c	2008-03-19 19:42:20 UTC (rev 269)
+++ trunk/src/netslot_none.c	2008-03-19 22:59:12 UTC (rev 270)
@@ -1,3 +1,15 @@
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#if defined(HAVE_STRING_H)
+#include <string.h>
+#endif
+
+#if defined(NETPERF_STANDALONE_DEBUG)
+#include <stdio.h>
+#endif
+
 char *
 find_interface_slot(char *interface_name) {
   return strdup("Not Implemented");
@@ -11,3 +23,34 @@
   *sub_dev = 0;
   return;
 }
+
+#if defined(NETPERF_STANDALONE_DEBUG)
+int
+main(int argc, char *argv[]) {
+
+  char *slot;
+  int vendor;
+  int device;
+  int subvendor;
+  int subdevice;
+
+  if (argc != 2) {
+    fprintf(stderr,"%s <interface>\n",argv[0]);
+    return -1;
+  }
+
+  slot = find_interface_slot(argv[1]);
+
+  find_interface_ids(argv[1], &vendor, &device, &subvendor, &subdevice);
+
+  printf("%s in in slot %s: vendor %4x device %4x subvendor %4x subdevice %4x\n",
+	 argv[1],
+	 slot,
+	 vendor,
+	 device,
+	 subvendor,
+	 subdevice);
+
+  return 0;
+}
+#endif



More information about the netperf-dev mailing list