[netperf-dev] netperf2 commit notice r239 - in trunk: . doc doc/examples src src/missing src/missing/m4

raj at netperf.org raj at netperf.org
Tue Mar 4 15:47:43 PST 2008


Author: raj
Date: 2008-03-04 15:47:42 -0800 (Tue, 04 Mar 2008)
New Revision: 239

Added:
   trunk/src/netslot_linux.c
   trunk/src/netslot_none.c
Modified:
   trunk/Makefile.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/nettest_bsd.h
   trunk/src/nettest_omni.c
Log:
teach omni tests how to find interface slot id

Modified: trunk/Makefile.in
===================================================================
--- trunk/Makefile.in	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -72,6 +72,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

Modified: trunk/configure
===================================================================
--- trunk/configure	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/configure	2008-03-04 23:47:42 UTC (rev 239)
@@ -706,6 +706,7 @@
 NEED_LIBCOMPAT_FALSE
 NETCPU_SOURCE
 NETRTLKUP_SOURCE
+NETSLOTLKUP_SOURCE
 NETDRVLKUP_SOURCE
 LTLIBOBJS'
 ac_subst_files=''
@@ -1323,6 +1324,8 @@
                           specified mechanism
   --enable-rtlookup       include code to find the probable egress interface
                           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
 
@@ -9582,8 +9585,65 @@
 
 
 
-# time to see about route lookup mechanisms
+# time to see about slot lookup mechanisms
 
+{ echo "$as_me:$LINENO: checking which slot lookup type to use" >&5
+echo $ECHO_N "checking which slot lookup type to use... $ECHO_C" >&6; }
+
+# Check whether --enable-slotlookup was given.
+if test "${enable_slotlookup+set}" = set; then
+  enableval=$enable_slotlookup;
+fi
+
+
+NETSLOTLKUP_SOURCE="$enable_slotlookup"
+case "$enable_slotlookup" in
+
+	linsys)
+		use_slotlookup=true
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_LINSYS
+_ACEOF
+
+		;;
+	'')
+# guess it automagically in a nice big case statement
+		case $target in
+		     *-*-linux*)
+			use_slotlookup=true
+
+cat >>confdefs.h <<\_ACEOF
+#define USE_LINSYS
+_ACEOF
+
+			enable_slotlookup="linux - auto"
+			NETSLOTLKUP_SOURCE="linux"
+			;;
+		     *)
+			use_slotlookup=false
+			NETSLOTLKUP_SOURCE="none"
+			enable_slotlookup="none. Consider teaching configure about your platform."
+			;;
+		esac
+		;;
+	none)
+		use_slotlookup=false
+		;;
+	*)
+		{ { echo "$as_me:$LINENO: error: --enable-slotlookup takes linux or none" >&5
+echo "$as_me: error: --enable-slotlookup takes linux or none" >&2;}
+   { (exit 1); exit 1; }; }
+		;;
+esac
+
+	{ echo "$as_me:$LINENO: result: \"$enable_slotlookup\"" >&5
+echo "${ECHO_T}\"$enable_slotlookup\"" >&6; }
+
+
+
+# time to see about driver 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; }
 
@@ -10390,11 +10450,12 @@
 NEED_LIBCOMPAT_FALSE!$NEED_LIBCOMPAT_FALSE$ac_delim
 NETCPU_SOURCE!$NETCPU_SOURCE$ac_delim
 NETRTLKUP_SOURCE!$NETRTLKUP_SOURCE$ac_delim
+NETSLOTLKUP_SOURCE!$NETSLOTLKUP_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` = 94; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; 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-28 01:09:27 UTC (rev 238)
+++ trunk/configure.ac	2008-03-04 23:47:42 UTC (rev 239)
@@ -785,8 +785,50 @@
 
 AC_SUBST(NETRTLKUP_SOURCE)
 
-# time to see about route lookup mechanisms
+# time to see about slot lookup mechanisms
 
+AC_MSG_CHECKING([which slot lookup type to use])
+
+AC_ARG_ENABLE(slotlookup,
+	[AS_HELP_STRING([--enable-slotlookup],[include code to find the probable egress interface using specified mechanism])])
+
+NETSLOTLKUP_SOURCE="$enable_slotlookup"
+case "$enable_slotlookup" in
+
+	linsys)
+		use_slotlookup=true
+		AC_DEFINE([USE_LINSYS],,[Use Linux's /sys interface to dettermine egress interface slot number.])
+		;;
+	'')
+# guess it automagically in a nice big case statement
+		case $target in
+		     *-*-linux*)
+			use_slotlookup=true
+			AC_DEFINE([USE_LINSYS],,[Use Linux's /sys interface to determine egress interface slot number.])
+			enable_slotlookup="linux - auto"
+			NETSLOTLKUP_SOURCE="linux"
+			;;
+		     *)
+			use_slotlookup=false
+			NETSLOTLKUP_SOURCE="none"
+			enable_slotlookup="none. Consider teaching configure about your platform."
+			;;
+		esac
+		;;
+	none)
+		use_slotlookup=false
+		;;
+	*)
+		AC_MSG_ERROR([--enable-slotlookup takes linux or none])
+		;;
+esac
+
+	AC_MSG_RESULT("$enable_slotlookup")
+
+AC_SUBST(NETSLOTLKUP_SOURCE)
+
+# time to see about driver lookup mechanisms
+
 AC_MSG_CHECKING([which driver info lookup type to use])
 
 AC_ARG_ENABLE(drvlookup,

Modified: trunk/doc/Makefile.in
===================================================================
--- trunk/doc/Makefile.in	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/doc/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -76,6 +76,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

Modified: trunk/doc/examples/Makefile.in
===================================================================
--- trunk/doc/examples/Makefile.in	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/doc/examples/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -72,6 +72,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/src/Makefile.am	2008-03-04 23:47:42 UTC (rev 239)
@@ -9,13 +9,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
+USE_SLOT_SOURCE=netslot_ at NETSLOTLKUP_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
+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
 
 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) $(USE_DRV_SOURCE)
-netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE) $(USE_SLOT_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE) $(USE_SLOT_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-28 01:09:27 UTC (rev 238)
+++ trunk/src/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -72,6 +72,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -140,13 +141,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
+USE_SLOT_SOURCE = netslot_ at NETSLOTLKUP_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
+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
 
 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) $(USE_DRV_SOURCE)
-netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE)
+netperf_SOURCES = netperf.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE) $(USE_SLOT_SOURCE)
+netserver_SOURCES = netserver.c $(COMMON_SRC) $(USE_CPU_SOURCE) $(USE_RT_SOURCE) $(USE_DRV_SOURCE) $(USE_SLOT_SOURCE)
 
 # if there are any "missing" routines, the libobjs should cover it
 @NEED_LIBCOMPAT_TRUE at netperf_LDADD = missing/libcompat.a
@@ -166,14 +168,16 @@
 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__objects_5 = netslot_ at NETSLOTLKUP_SOURCE@.$(OBJEXT)
 am_netperf_OBJECTS = netperf.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
-	$(am__objects_3) $(am__objects_4)
+	$(am__objects_3) $(am__objects_4) $(am__objects_5)
 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_4)
+	$(am__objects_2) $(am__objects_3) $(am__objects_4) \
+	$(am__objects_5)
 netserver_OBJECTS = $(am_netserver_OBJECTS)
 @NEED_LIBCOMPAT_TRUE at netserver_DEPENDENCIES = missing/libcompat.a
 @NEED_LIBCOMPAT_FALSE at netserver_DEPENDENCIES =
@@ -187,6 +191,7 @@
 @AMDEP_TRUE@	./$(DEPDIR)/netlib.Po ./$(DEPDIR)/netperf.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netrt_ at NETRTLKUP_SOURCE@.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/netserver.Po ./$(DEPDIR)/netsh.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/netslot_ at NETSLOTLKUP_SOURCE@.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_bsd.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_dlpi.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/nettest_omni.Po \
@@ -264,6 +269,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netrt_ at NETRTLKUP_SOURCE@.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netserver.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netsh.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/netslot_ at NETSLOTLKUP_SOURCE@.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_bsd.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_dlpi.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_omni.Po at am__quote@

Modified: trunk/src/missing/Makefile.in
===================================================================
--- trunk/src/missing/Makefile.in	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/src/missing/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -72,6 +72,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

Modified: trunk/src/missing/m4/Makefile.in
===================================================================
--- trunk/src/missing/m4/Makefile.in	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/src/missing/m4/Makefile.in	2008-03-04 23:47:42 UTC (rev 239)
@@ -72,6 +72,7 @@
 NETCPU_SOURCE = @NETCPU_SOURCE@
 NETDRVLKUP_SOURCE = @NETDRVLKUP_SOURCE@
 NETRTLKUP_SOURCE = @NETRTLKUP_SOURCE@
+NETSLOTLKUP_SOURCE = @NETSLOTLKUP_SOURCE@
 OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@

Added: trunk/src/netslot_linux.c
===================================================================
--- trunk/src/netslot_linux.c	                        (rev 0)
+++ trunk/src/netslot_linux.c	2008-03-04 23:47:42 UTC (rev 239)
@@ -0,0 +1,119 @@
+#define _XOPEN_SOURCE 500
+#include <ftw.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static char interface_match[32];
+static char interface_address[13];
+static char interface_slot[13]="not found";
+
+static int
+find_slot(const char *fpath, const struct stat *sb,
+	  int tflag, struct FTW *ftwbuf) 
+{
+  char slot_address[11];
+  int  ret;
+  FILE *address_file;
+  char *myfpath;
+  char *this_tok;
+  char *last_tok;
+
+  /* so, are we at a point in the tree where the basename is
+     "address" ? */
+  if (strcmp("address",fpath + ftwbuf->base) == 0) {
+    address_file = fopen(fpath,"r");
+    if (address_file == NULL) {
+      strcpy(interface_slot,"fopen");
+      return 0;
+    }
+    /* we make the simplifying assumption that PCI domain, bus, slot
+       and function, with associated separators, are 10 characters or
+       less */
+    ret = fread(slot_address,1,10,address_file);
+    if (ret != 10) {
+      strcpy(interface_slot,"fread");
+      fclose(address_file);
+      return 0;
+    }
+    slot_address[ret] = 0;
+    /* the slot address will be a substring of the full bus address of
+       the interface we seek */
+    if (strstr(interface_address,slot_address)) {
+	myfpath = strdup(fpath);
+	if (myfpath == NULL) {
+	  strcpy(interface_slot,"strcpy");
+	  return 1;
+	}
+	
+	this_tok = strtok(myfpath,"/");
+	while (strcmp(this_tok,"address")) {
+	  last_tok = this_tok;
+	  this_tok = strtok(NULL,"/");
+	}
+	if (last_tok != NULL)
+	  strcpy(interface_slot,last_tok);
+	else
+	  strcpy(interface_slot,"last_tok");
+	free(myfpath);
+	fclose(address_file);
+	return 1;
+    }
+  }
+  return 0;
+}
+
+static int
+find_interface(const char *fpath, const struct stat *sb,
+	       int tflag, struct FTW *ftwbuf)
+{
+  char *myfpath;
+  char *this_tok;
+  char *last_tok;
+  if (strcmp(interface_match,fpath + ftwbuf->base) == 0) {
+    myfpath = strdup(fpath);
+    if (myfpath == NULL) {
+      strcpy(interface_address,"strcpy");
+      return 1;
+    }
+    this_tok = strtok(myfpath,"/");
+    while (strcmp(this_tok,interface_match)) {
+      last_tok = this_tok;
+      this_tok = strtok(NULL,"/");
+    }
+    if (last_tok != NULL)
+      strcpy(interface_address,last_tok);
+    else
+      strcpy(interface_address,"last_tok");
+    free(myfpath);
+    return 1;
+  }
+  return 0;
+}
+
+char *
+find_interface_slot(char *interface_name) {
+
+  int flags = 0;
+  int ret;
+
+  flags |= FTW_PHYS;  /* don't follow symlinks for they will lead us
+			 off the path */
+  ret = snprintf(interface_match,31,"net:%s",interface_name);
+  interface_match[31]=0;
+  /* having setup the basename we will be seeking, go find it and the
+     corresponding interface_address */
+  nftw("/sys/devices", find_interface, 20, flags);
+  /* now that we ostensibly have the pci address of the interface
+     (interface_address, lets find that slot shall we? */
+  nftw("/sys/bus/pci/slots", find_slot, 20, flags);
+  return strdup(interface_slot);
+}
+
+
+
+
+
+
+
+

Added: trunk/src/netslot_none.c
===================================================================
--- trunk/src/netslot_none.c	                        (rev 0)
+++ trunk/src/netslot_none.c	2008-03-04 23:47:42 UTC (rev 239)
@@ -0,0 +1,4 @@
+char *
+find_interface_slot(char *interface_name) {
+  return strdup("Not Implemented");
+}

Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/src/nettest_bsd.h	2008-03-04 23:47:42 UTC (rev 239)
@@ -115,12 +115,15 @@
 
   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 */
+  /* this is the 18th 32-bit word and we have 248-(17*4) bytes
+     available from here */
   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];
+  char       ifslot[16];    /* slot id of the probable egress interface */
+  /* only 20 bytes left... */
 };
 
 #endif /* WANT_OMNI */

Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c	2008-02-28 01:09:27 UTC (rev 238)
+++ trunk/src/nettest_omni.c	2008-03-04 23:47:42 UTC (rev 239)
@@ -397,6 +397,8 @@
 char        remote_driver_version[32]="";
 char        remote_driver_firmware[32]="";
 char        remote_driver_bus[32]="";
+char        *local_interface_slot=NULL;
+char        *remote_interface_slot=NULL;
 
 int printing_initialized = 0;
 
@@ -553,10 +555,12 @@
   LOCAL_DRIVER_VERSION,
   LOCAL_DRIVER_FIRMWARE,
   LOCAL_DRIVER_BUS,
+  LOCAL_INTERFACE_SLOT,
   REMOTE_DRIVER_NAME,
   REMOTE_DRIVER_VERSION,
   REMOTE_DRIVER_FIRMWARE,
   REMOTE_DRIVER_BUS,
+  REMOTE_INTERFACE_SLOT,
   LOCAL_INTERVAL_USECS,
   LOCAL_INTERVAL_BURST,
   REMOTE_INTERVAL_USECS,
@@ -900,6 +904,10 @@
     return "REMOTE_NODELAY";
   case   REMOTE_CORK:
     return "REMOTE_CORK";
+  case LOCAL_INTERFACE_SLOT:
+    return "LOCAL_INTERFACE_SLOT";
+  case REMOTE_INTERFACE_SLOT:
+    return "REMOTE_INTERFACE_SLOT";
   case LOCAL_INTERFACE_NAME:
     return "LOCAL_INTERFACE_NAME";
   case REMOTE_INTERFACE_NAME:
@@ -2505,6 +2513,30 @@
   netperf_output_source[REMOTE_INTERFACE_NAME].tot_line_len = 
     NETPERF_LINE_TOT(REMOTE_INTERFACE_NAME);
 
+  netperf_output_source[LOCAL_INTERFACE_SLOT].output_name = LOCAL_INTERFACE_SLOT;
+  netperf_output_source[LOCAL_INTERFACE_SLOT].line[0] = "Local";
+  netperf_output_source[LOCAL_INTERFACE_SLOT].line[1] = "Interface";
+  netperf_output_source[LOCAL_INTERFACE_SLOT].line[2] = "Slot";
+  netperf_output_source[LOCAL_INTERFACE_SLOT].line[3] = "";
+  netperf_output_source[LOCAL_INTERFACE_SLOT].format = "%s";
+  netperf_output_source[LOCAL_INTERFACE_SLOT].display_value = local_interface_slot;
+  netperf_output_source[LOCAL_INTERFACE_SLOT].max_line_len = 
+    NETPERF_LINE_MAX(LOCAL_INTERFACE_SLOT);
+  netperf_output_source[LOCAL_INTERFACE_SLOT].tot_line_len = 
+    NETPERF_LINE_TOT(LOCAL_INTERFACE_SLOT);
+
+  netperf_output_source[REMOTE_INTERFACE_SLOT].output_name = REMOTE_INTERFACE_SLOT;
+  netperf_output_source[REMOTE_INTERFACE_SLOT].line[0] = "Remote";
+  netperf_output_source[REMOTE_INTERFACE_SLOT].line[1] = "Interface";
+  netperf_output_source[REMOTE_INTERFACE_SLOT].line[2] = "Slot";
+  netperf_output_source[REMOTE_INTERFACE_SLOT].line[3] = "";
+  netperf_output_source[REMOTE_INTERFACE_SLOT].format = "%s";
+  netperf_output_source[REMOTE_INTERFACE_SLOT].display_value = remote_interface_slot;
+  netperf_output_source[REMOTE_INTERFACE_SLOT].max_line_len = 
+    NETPERF_LINE_MAX(REMOTE_INTERFACE_SLOT);
+  netperf_output_source[REMOTE_INTERFACE_SLOT].tot_line_len = 
+    NETPERF_LINE_TOT(REMOTE_INTERFACE_SLOT);
+
   netperf_output_source[REMOTE_MACHINE].output_name = REMOTE_MACHINE;
   netperf_output_source[REMOTE_MACHINE].line[0] = "Remote";
   netperf_output_source[REMOTE_MACHINE].line[1] = "Machine";
@@ -4171,6 +4203,8 @@
 
     find_driver_info(local_interface_name,local_driver_name,local_driver_version,local_driver_firmware,local_driver_bus,32);
 
+    local_interface_slot = find_interface_slot(local_interface_name);
+
     /* 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
@@ -4227,6 +4261,7 @@
 	  remote_bytes_per_send = 0.0;
 	omni_result->ifname[15] = 0; /* belt and suspenders */
 	remote_interface_name = strdup(omni_result->ifname);
+	remote_interface_slot = strdup(omni_result->ifslot);
 	strncpy(remote_driver_name,omni_result->driver,32);
 	strncpy(remote_driver_version,omni_result->version,32);
 	strncpy(remote_driver_firmware,omni_result->firmware,32);
@@ -5061,6 +5096,9 @@
     find_egress_interface(local_res->ai_addr,(struct sockaddr *)&peeraddr_in);
   strncpy(omni_results->ifname,local_interface_name,16);
   omni_results->ifname[15] = 0;
+  local_interface_slot = find_interface_slot(local_interface_name);
+  strncpy(omni_results->ifslot,local_interface_slot,16);
+  omni_results->ifslot[16] = 0;
   find_driver_info(local_interface_name,
 		   omni_results->driver,
 		   omni_results->version,



More information about the netperf-dev mailing list