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

raj at netperf.org raj at netperf.org
Thu Aug 25 11:41:18 PDT 2011


Author: raj
Date: 2011-08-25 11:41:18 -0700 (Thu, 25 Aug 2011)
New Revision: 483

Modified:
   trunk/Release_Notes
   trunk/src/netsh.c
   trunk/src/netsh.h
   trunk/src/nettest_bsd.c
   trunk/src/nettest_bsd.h
   trunk/src/nettest_omni.c
Log:
add calls to SO_PRIORITY for the omni path

Modified: trunk/Release_Notes
===================================================================
--- trunk/Release_Notes	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/Release_Notes	2011-08-25 18:41:18 UTC (rev 483)
@@ -1,5 +1,10 @@
 These are the Release Notes for post Revision 2.5.0 top-of-trunk netperf:
 
+*) The control message size has been increased from 256 bytes to 512
+    bytes. THIS WILL BREAK COMPATABILITY WITH PREVIOUS VERSIONS OF
+    NETPERF. However, we need more room on the pinhead on which the
+    angels dance.
+
 *) Make the "sum" field of the histogram structure a 64 bit int to
    avoid having it wrap-around on tests where the sum of all the
    measured latencies was larger than 31 bits. This was causing

Modified: trunk/src/netsh.c
===================================================================
--- trunk/src/netsh.c	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/src/netsh.c	2011-08-25 18:41:18 UTC (rev 483)
@@ -102,7 +102,7 @@
    getopt to parse the command line, we will tell getopt that they do
    not take parms, and then look for them ourselves */
 
-#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdDf:F:H:hi:I:jk:K:l:L:n:NO:o:P:p:rSs:t:T:v:VW:w:46"
+#define GLOBAL_CMD_LINE_ARGS "A:a:b:B:CcdDf:F:H:hi:I:jk:K:l:L:n:NO:o:P:p:rSs:t:T:v:VW:w:y:46"
 
 /************************************************************************/
 /*									*/
@@ -235,6 +235,10 @@
 /* address family */
 int	af = AF_INET;
 
+/* socket priority via SO_PRIORITY */
+int local_socket_prio = -1;
+int remote_socket_prio = -1;
+
 /* did someone request processor affinity? */
 int cpu_binding_requested = 0;
 
@@ -298,7 +302,8 @@
     -v verbosity      Specify the verbosity level\n\
     -W send,recv      Set the number of send,recv buffers\n\
     -v level          Set the verbosity level (default 1, min 0)\n\
-    -V                Display the netperf version and exit\n";
+    -V                Display the netperf version and exit\n\
+    -y local,remote   Set the socket priority\n";
 
 char netperf_usage2[] = "\n\
 For those options taking two parms, at least one must be specified;\n\
@@ -938,6 +943,19 @@
       if (arg2[0])
 	recv_width = convert(arg2);
       break;
+    case 'y':
+#if defined(SO_PRIORITY)
+      break_args(optarg, arg1, arg2);
+      if (arg1[0])
+	local_socket_prio = convert(arg1);
+      if (arg2[0])
+	remote_socket_prio = convert(arg2);
+#else
+      fprintf(where,"Setting SO_PRIORITY is not supported on this platform\n");
+      fflush(where);
+      exit(-1);
+#endif
+      break;
     case 'l':
       /* determine test end conditions */
       /* assume a timed test */
@@ -1170,6 +1188,7 @@
      should set certain "remote" settings to reflect this, regardless
      of what else may have been set on the command line */
   if (no_control) {
+    remote_socket_prio = -1;
     remote_recv_align = -1;
     remote_send_align = -1;
     remote_send_offset = -1;
@@ -1321,6 +1340,8 @@
   printf("Local recv alignment: %d\n",local_recv_align);
   printf("Remote send alignment: %d\n",remote_send_align);
   printf("Remote recv alignment: %d\n",remote_recv_align);
+  printf("Local socket priority: %d\n", local_socket_prio);
+  printf("Remote socket priority: %d\n", remote_socket_prio);
   printf("Report local CPU %d\n",local_cpu_usage);
   printf("Report remote CPU %d\n",remote_cpu_usage);
   printf("Verbosity: %d\n",verbosity);

Modified: trunk/src/netsh.h
===================================================================
--- trunk/src/netsh.h	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/src/netsh.h	2011-08-25 18:41:18 UTC (rev 483)
@@ -164,14 +164,18 @@
 
 extern int cpu_binding_requested;
 
-/* stuff to controll the bufferspace "width" */
+/* stuff to control the bufferspace "width" */
 extern int	send_width;
 extern int      recv_width;
 
+/* control the socket priority */
+extern int local_socket_prio;
+extern int remote_socket_prio;
+
 /* address family */
 extern int	af;
 
-/* different options for other things					*/
+/* different options for other things */
 extern int
   local_cpu_usage,
   remote_cpu_usage;

Modified: trunk/src/nettest_bsd.c
===================================================================
--- trunk/src/nettest_bsd.c	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/src/nettest_bsd.c	2011-08-25 18:41:18 UTC (rev 483)
@@ -1434,6 +1434,22 @@
   }
 #endif
 
+#if defined(HAS_SO_PRIORITY)
+  if (local_socket_prio > 0) {
+    if (setsockopt(temp_socket,
+                  SOL_SOCKET,
+                  SO_PRIORITY,
+                  &local_socket_prio,
+                  sizeof(int)) == SOCKET_ERROR) {
+      fprintf(where,
+             "netperf: create_data_socket: so_priority: errno %d\n",
+             errno);
+      fflush(where);
+      local_socket_prio = -2;
+    }
+  }
+#endif
+
   return(temp_socket);
 
 }

Modified: trunk/src/nettest_bsd.h
===================================================================
--- trunk/src/nettest_bsd.h	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/src/nettest_bsd.h	2011-08-25 18:41:18 UTC (rev 483)
@@ -82,6 +82,7 @@
   uint32_t   interval_usecs;/* how long each interval should be */
   uint32_t   netperf_ip[4]; /* when netserver needs netperf's data IP */
   uint32_t   netserver_ip[4]; /* when netperf tells netserver his IP */
+  int32_t    socket_prio; /* what netserver should use for socket prio */
 };
 
 struct  omni_response_struct {
@@ -111,9 +112,9 @@
      full */
   uint32_t   cpu_frequency;  /* this should be megahertz */
   uint32_t   security_info;
-  /* there are 16 ints above here, and we have 248 - (16*4) or 184 bytes
-     remaining */
-#define OMNI_RESPONSE_CONV_CUTOFF 16
+  int32_t    socket_prio;
+  /* there are 17 ints above here */
+#define OMNI_RESPONSE_CONV_CUTOFF 17
   char       system_model[33];
   char       cpu_model[80];  /* seems like an awful lot doesn't
 				it. some clever person at Intel
@@ -121,7 +122,6 @@
 				name that long - and still didn't
 				include the 9NNN model number! */
   char       security_string[16];
-  /* 48 bytes left */
   
 };
 
@@ -162,7 +162,7 @@
   char       firmware[32];  
   char       bus[32];
   char       ifslot[16];    /* slot id of the probable egress interface */
-  /* 0 bytes left... */
+
 };
 
 #endif /* WANT_OMNI */

Modified: trunk/src/nettest_omni.c
===================================================================
--- trunk/src/nettest_omni.c	2011-08-24 18:25:25 UTC (rev 482)
+++ trunk/src/nettest_omni.c	2011-08-25 18:41:18 UTC (rev 483)
@@ -671,6 +671,8 @@
   P99_LATENCY,
   MEAN_LATENCY,
   STDDEV_LATENCY,
+  LOCAL_SOCKET_PRIO,
+  REMOTE_SOCKET_PRIO,
   COMMAND_LINE,    /* COMMAND_LINE should always be "last" */
   OUTPUT_END,
   NETPERF_OUTPUT_MAX
@@ -1273,6 +1275,10 @@
     return "MEAN_LATENCY";
   case STDDEV_LATENCY:
     return "STDDEV_LATENCY";
+  case LOCAL_SOCKET_PRIO:
+    return "LOCAL_SOCKET_PRIO";
+  case REMOTE_SOCKET_PRIO:
+    return "REMOTE_SOCKET_PRIO";
   case OUTPUT_END:
     return "OUTPUT_END";
   default:
@@ -3729,6 +3735,26 @@
   netperf_output_source[i].output_default = 0;
   netperf_output_source[i].output_group = OMNI_WANT_STATS;
 
+  i = LOCAL_SOCKET_PRIO;
+  netperf_output_source[i].output_name = LOCAL_SOCKET_PRIO;
+  netperf_output_source[i].line[0] = "Local";
+  netperf_output_source[i].line[1] = "Socket";
+  netperf_output_source[i].line[2] = "Priority";
+  netperf_output_source[i].format = "%d";
+  netperf_output_source[i].display_value = &local_socket_prio;
+  netperf_output_source[i].max_line_len = NETPERF_LINE_MAX(i);
+  netperf_output_source[i].tot_line_len = NETPERF_LINE_TOT(i);
+
+  i = REMOTE_SOCKET_PRIO;
+  netperf_output_source[i].output_name = REMOTE_SOCKET_PRIO;
+  netperf_output_source[i].line[0] = "Remote";
+  netperf_output_source[i].line[1] = "Socket";
+  netperf_output_source[i].line[2] = "Priority";
+  netperf_output_source[i].format = "%d";
+  netperf_output_source[i].display_value = &remote_socket_prio;
+  netperf_output_source[i].max_line_len =  NETPERF_LINE_MAX(i);
+  netperf_output_source[i].tot_line_len =  NETPERF_LINE_TOT(i);
+
   netperf_output_source[OUTPUT_END].output_name = OUTPUT_END;
   netperf_output_source[OUTPUT_END].line[0] = "This";
   netperf_output_source[OUTPUT_END].line[1] = "Is";
@@ -4918,7 +4944,8 @@
       omni_request->recv_offset	           = remote_recv_offset;
       omni_request->recv_width             = recv_width;
       omni_request->response_size	   = rsp_size;
-      
+      omni_request->socket_prio            = remote_socket_prio;
+
       /* we have no else clauses here because we previously set flags
 	 to zero above raj 20090803 */
       if (rem_nodelay)
@@ -5020,6 +5047,8 @@
 	remote_cpu_rate     = omni_response->cpu_rate;
 	remote_send_width   = omni_response->send_width;
 	remote_recv_width   = omni_response->recv_width;
+	remote_socket_prio  = omni_response->socket_prio;
+
 	/* make sure that port numbers are in network order because
 	   recv_response will have put everything into host order */
 	set_port_number(remote_res,
@@ -6029,6 +6058,7 @@
   loc_sndavoid    = omni_request->so_sndavoid;
   routing_allowed = (omni_request->flags) & OMNI_ROUTING_ALLOWED;
   want_keepalive  = (omni_request->flags) & OMNI_WANT_KEEPALIVE;
+  local_socket_prio = omni_request->socket_prio;
 
 #ifdef WANT_INTERVALS
   interval_usecs = omni_request->interval_usecs;
@@ -6093,6 +6123,8 @@
 
   omni_response->send_size = omni_request->send_size;
   omni_response->send_width = omni_request->send_width;
+  omni_response->socket_prio = local_socket_prio;
+
   if (omni_request->direction & NETPERF_XMIT) {
 #ifdef fo
     /* do we need to set multicast ttl? */



More information about the netperf-dev mailing list