15825425 - SUNBT7206756 qperf: sdp_bw doesn't work with IPv6
authorSharath M Srinivasan <sharath.srinivasan@oracle.com>
Tue, 05 Feb 2013 19:07:23 -0800
changeset 1144 b219ca1112b6
parent 1143 5a6584b767aa
child 1145 ebafad4abba7
15825425 - SUNBT7206756 qperf: sdp_bw doesn't work with IPv6 15791672 - SUNBT7168806 qperf should not bind to cpu 0 by default 16075288 - qperf/rds_bw failed with 'connect failed: Connection refused' 15821409 - SUNBT7203619 ib_write_bw reports peak b/w as -0.00
components/open-fabrics/perftest/patches/base.patch
components/open-fabrics/qperf/patches/base.patch
--- a/components/open-fabrics/perftest/patches/base.patch	Tue Feb 05 09:09:06 2013 -0800
+++ b/components/open-fabrics/perftest/patches/base.patch	Tue Feb 05 19:07:23 2013 -0800
@@ -50,7 +50,7 @@
  		c1 = get_cycles();
  		sleep(1);
  		c2 = get_cycles();
-+#if defined(__SVR4) && defined(__sun)
++#if defined(__sparc)
 +		printf("1 sec = %g usec\n", (double)((c2 - c1))/1000);
 +#else
  		printf("1 sec = %g usec\n", (c2 - c1) / mhz);
@@ -85,7 +85,7 @@
  static double sample_get_cpu_mhz(void)
  {
 -	struct timeval tv1, tv2;
-+	cycles_t tv1, tv2;
++        struct timeval tv1, tv2;
  	cycles_t start;
  	double sx = 0, sy = 0, sxx = 0, syy = 0, sxy = 0;
 -	double tx, ty;
@@ -98,30 +98,28 @@
  	cycles_t y[MEASUREMENTS];
  	double a; /* system call overhead in cycles */
  	double b; /* cycles per microsecond */
-@@ -78,25 +84,16 @@
+@@ -78,7 +84,6 @@
  
  	for (i = 0; i < MEASUREMENTS; ++i) {
  		start = get_cycles();
-+		tv1 = get_cycles();
+-
+ 		if (gettimeofday(&tv1, NULL)) {
+ 			fprintf(stderr, "gettimeofday failed.\n");
+ 			return 0;
+@@ -86,7 +91,7 @@
  
--		if (gettimeofday(&tv1, NULL)) {
--			fprintf(stderr, "gettimeofday failed.\n");
--			return 0;
--		}
--
  		do {
--			if (gettimeofday(&tv2, NULL)) {
+ 			if (gettimeofday(&tv2, NULL)) {
 -				fprintf(stderr, "gettimeofday failed.\n");
--				return 0;
--			}
--		} while ((tv2.tv_sec - tv1.tv_sec) * 1000000 +
--			(tv2.tv_usec - tv1.tv_usec) < USECSTART + i * USECSTEP);
-+			tv2 = get_cycles();
-+		} while ((tv2 - tv1) < NSECSTART + i * NSECSTEP);
++			        fprintf(stderr, "gettimeofday failed.\n");
+ 				return 0;
+ 			}
+ 		} while ((tv2.tv_sec - tv1.tv_sec) * 1000000 +
+@@ -94,9 +99,10 @@
  
--		x[i] = (tv2.tv_sec - tv1.tv_sec) * 1000000 +
--			tv2.tv_usec - tv1.tv_usec;
-+		x[i] = (tv2 - tv1);
+ 		x[i] = (tv2.tv_sec - tv1.tv_sec) * 1000000 +
+ 			tv2.tv_usec - tv1.tv_usec;
++
  		y[i] = get_cycles() - start;
  		if (DEBUG_DATA)
 -			fprintf(stderr, "x=%ld y=%Ld\n", x[i], (long long)y[i]);
@@ -129,7 +127,7 @@
  	}
  
  	for (i = 0; i < MEASUREMENTS; ++i) {
-@@ -134,10 +131,15 @@
+@@ -134,10 +140,15 @@
  
  static double proc_get_cpu_mhz(int no_cpu_freq_fail)
  {
@@ -145,7 +143,7 @@
  	f = fopen("/proc/cpuinfo","r");
  	if (!f)
  		return 0.0;
-@@ -174,6 +176,13 @@
+@@ -174,6 +185,13 @@
  		}
  	}
  	fclose(f);
@@ -159,20 +157,25 @@
  	return mhz;
  }
  
-@@ -183,10 +192,10 @@
- 	double sample, proc, delta;
+@@ -184,8 +202,9 @@
  	sample = sample_get_cpu_mhz();
  	proc = proc_get_cpu_mhz(no_cpu_freq_fail);
-+#if defined(__SVR4) && defined(__sun)
-+	sample = sample * proc;
-+#endif
  
 -	if (!proc || !sample)
 -		return 0;
--
++#if defined(__sparc)
++	return proc;
++#endif
+ 
  	delta = proc > sample ? proc - sample : sample - proc;
  	if (delta / proc > 0.01) {
- 			fprintf(stderr, "Warning: measured timestamp frequency "
+@@ -194,5 +213,6 @@
+ 					sample, proc);
+ 			return sample;
+ 	}
++
+ 	return proc;
+ }
 diff -r -u /tmp/perftest-1.3.0/get_clock.h perftest-1.3.0/get_clock.h
 --- /tmp/perftest-1.3.0/get_clock.h	Sun Nov  1 03:09:16 2009
 +++ perftest-1.3.0/get_clock.h	Fri Feb 11 04:12:46 2011
@@ -180,16 +183,16 @@
  
  #ifndef GET_CLOCK_H
  #define GET_CLOCK_H
-+#if defined(__SVR4) && defined(__sun)
++#if defined(__sparc)
 +#include <sys/times.h>
 +#include <limits.h>
 +#include <sys/time.h>
-+typedef hrtime_t cycles_t;
++typedef unsigned long long cycles_t;
  
 -#if defined (__x86_64__) || defined(__i386__)
 +static inline cycles_t get_cycles()
 +{
-+	return (gethrtime());
++        return (gethrtime());
 +}
 +
 +#elif defined (__x86_64__) || defined(__i386__)
@@ -1470,7 +1473,7 @@
  			}
  	}
  
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
 +#else
 +	cycles_to_units = 1000000000;
@@ -1538,11 +1541,11 @@
  #include <infiniband/verbs.h>
  
  #include "get_clock.h"
-@@ -358,11 +359,20 @@
+@@ -358,10 +359,19 @@
  
  
  	if (user_param->r_flag->cycles) {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = 1;
 +#else
 +		cycles_to_units =
@@ -1550,15 +1553,14 @@
 +#endif
  		units = "cycles";
  	} else {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
 +#else
 +		cycles_to_units = 1000;
++#endif
  		units = "usec";
-+#endif
  	}
  
- 	if (user_param->r_flag->unsorted) {
 diff -r -u /tmp/perftest-1.3.0/send_bw.c perftest-1.3.0/send_bw.c
 --- /tmp/perftest-1.3.0/send_bw.c	Thu Jan 20 07:37:18 2011
 +++ perftest-1.3.0/send_bw.c	Fri Feb 11 04:12:47 2011
@@ -3376,7 +3378,7 @@
 +			}
 +	}
 +
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
 +	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
 +#else
 +	cycles_to_units = 1000000000;
@@ -3970,19 +3972,21 @@
  	if (!ctx->rcq) {
  	    fprintf(stderr, "Couldn't create CQ\n");
  		return NULL;
-@@ -583,10 +598,19 @@
- 
+@@ -581,12 +596,20 @@
+ 	for (i = 0; i < user_param->iters - 1; ++i)
+ 		delta[i] = tstamp[i + 1] - tstamp[i];
  
+-
  	if (user_param->r_flag->cycles) {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = 1;
 +#else
 +		cycles_to_units =
-+		    (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
++		        (1/get_cpu_mhz(user_param->cpu_freq_f)) * 1000;
 +#endif
  		units = "cycles";
  	} else {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
 +#else
 +		cycles_to_units = 1000;
@@ -3990,7 +3994,7 @@
  		units = "usec";
  	}
  
-@@ -649,7 +673,7 @@
+@@ -649,7 +672,7 @@
  		  
  			// Server is polling on recieve first .
  		    if (user_param->use_event) {
@@ -3999,7 +4003,7 @@
  					fprintf(stderr , " Failed to notify events to CQ");
  					return 1;
  				}
-@@ -701,7 +725,7 @@
+@@ -701,7 +724,7 @@
  		    int s_ne;
  
  		    if (user_param->use_event) {
@@ -4041,11 +4045,19 @@
  		user_parm->inline_size = 0;
  
  	printf(" Inline data is used up to %d bytes message\n", user_parm->inline_size);
-@@ -384,7 +385,11 @@
+@@ -368,7 +369,6 @@
+ 	cycles_t t;
+ 	int iters = user_param->iters;
+ 
+-
+ 	opt_delta = tcompleted[opt_posted] - tposted[opt_completed];
+ 
+ 	if (user_param->noPeak == OFF) {
+@@ -384,7 +384,11 @@
  		  }
  	}
  	
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  	cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f) * 1000000;
 +#else
 +	cycles_to_units = 1000000000;
@@ -4091,7 +4103,7 @@
  
  
  	if (user_param->r_flag->cycles) {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = 1;
 +#else
 +		cycles_to_units =
@@ -4099,7 +4111,7 @@
 +#endif
  		units = "cycles";
  	} else {
-+#if !(defined(__SVR4) && defined(__sun))
++#if !(defined(__sparc))
  		cycles_to_units = get_cpu_mhz(user_param->cpu_freq_f);
 +#else
 +		cycles_to_units = 1000;
--- a/components/open-fabrics/qperf/patches/base.patch	Tue Feb 05 09:09:06 2013 -0800
+++ b/components/open-fabrics/qperf/patches/base.patch	Tue Feb 05 19:07:23 2013 -0800
@@ -11,13 +11,11 @@
  
  
  /*
-@@ -707,10 +709,16 @@
+@@ -707,10 +709,14 @@
      ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
      for (aip = ailist; aip; aip = aip->ai_next) {
          if (kind == K_SDP) {
 +#if (defined(__SVR4) && defined(__sun))
-+		aip->ai_family = AF_INET;
-+		aip->ai_socktype = SOCK_STREAM;
 +		aip->ai_protocol = PROTO_SDP;
 +#else
              if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
@@ -80,12 +78,14 @@
      return 0;
  }
  
-@@ -617,14 +634,19 @@
+@@ -617,14 +634,21 @@
      for (i = 0; i < P_N; ++i)
          if (ParInfo[i].index != i)
              error(BUG, "initialize: ParInfo: out of order: %d", i);
 +#if (defined(__SVR4) && defined(__sun))
 +    solaris_init();
++    Req.affinity = -1;		/* default no affinity */
++    RReq.affinity = -1;
 +#else
      ProcStatFD = open("/proc/stat", 0);
      if (ProcStatFD < 0)
@@ -100,7 +100,7 @@
  /*
   * Look for a colon and skip past it and any spaces.
   */
-@@ -643,6 +665,7 @@
+@@ -643,6 +667,7 @@
          s++;
      return s;
  }
@@ -108,7 +108,7 @@
  
  
  /*
-@@ -1667,13 +1690,18 @@
+@@ -1667,13 +1692,18 @@
  {
      char count[STRSIZE];
      char speed[STRSIZE];
@@ -129,7 +129,7 @@
      if (!fp)
          error(0, "cannot open /proc/cpuinfo");
      cpu[0] = '\0';
-@@ -1732,6 +1760,7 @@
+@@ -1732,6 +1762,7 @@
  
      /* CPU speed */
      speed[0] = '\0';
@@ -137,7 +137,7 @@
      if (!mixed) {
          int n = strlen(cpu);
          if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
-@@ -1745,7 +1774,24 @@
+@@ -1745,7 +1776,24 @@
              }
          }
      }
@@ -162,7 +162,7 @@
      /* Number of CPUs */
      if (cpus == 1)
          count[0] = '\0';
-@@ -2615,9 +2661,15 @@
+@@ -2615,9 +2663,17 @@
  static void
  set_affinity(void)
  {
@@ -172,13 +172,15 @@
      int a = Req.affinity;
  
 +#if defined(__SVR4) && defined(__sun)
++    if (a == -1)	/* no affinity by default */
++	return;
 +    if (processor_bind(P_LWPID, P_MYID, a, NULL) != 0)
 +        error(SYS, "cannot set processor affinity (cpu %d)", a);
 +#else
      if (!a)
          return;
      CPU_ZERO(&set);
-@@ -2624,6 +2676,7 @@
+@@ -2624,6 +2680,7 @@
      CPU_SET(a-1, &set);
      if (sched_setaffinity(0, sizeof(set), &set) < 0)
          error(SYS, "cannot set processor affinity (cpu %d)", a-1);
@@ -186,7 +188,7 @@
  }
  
  
-@@ -2771,9 +2824,36 @@
+@@ -2771,9 +2828,36 @@
  /*
   * Get various temporal parameters.
   */
@@ -223,7 +225,7 @@
      int n;
      char *p;
      char buf[BUFSIZE];
-@@ -2802,6 +2882,7 @@
+@@ -2802,6 +2886,7 @@
      while (n < T_N)
          timex[n++] = 0;
  }
@@ -454,7 +456,30 @@
  
  /*
   * Function prototypes.
-@@ -352,7 +356,11 @@
+@@ -298,13 +302,19 @@
+     if (bind(lfd, (SA *)&laddr, sizeof(laddr)) < 0)
+         error(SYS, "bind INET failed");
+ 
++    /*
++     * OFED generic fix - listen() should be setup first before sending server
++     * port message to the client.  There is a window that the client's
++     * connect() would fail after receiving the "server port" message if the
++     * server hasn't completed the listen().
++     */
++    if (listen(lfd, 1) < 0)
++        error(SYS, "listen failed");
++
+     port = get_socket_port(lfd);
+     encode_uint32(&port, port);
+     send_mesg(&port, sizeof(port), "TCP IPv4 server port");
+ 
+-    if (listen(lfd, 1) < 0)
+-        error(SYS, "listen failed");
+-
+     rlen = sizeof(raddr);
+     fd = accept(lfd, (SA *)&raddr, &rlen);
+     if (fd < 0)
+@@ -352,7 +362,11 @@
      SS sockaddr;
      socklen_t socklen;
  
@@ -466,7 +491,7 @@
      if (sockfd < 0)
          error(SYS, "socket failed");
      setsockopt_one(sockfd, SO_REUSEADDR);
-@@ -373,7 +381,11 @@
+@@ -373,7 +387,11 @@
      struct sockaddr_in *sap = (struct sockaddr_in *)addr;
  
      memset(sap, 0, sizeof(*sap));
@@ -478,7 +503,7 @@
      inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
      sap->sin_port = htons(port);
      *len = sizeof(struct sockaddr_in);
-@@ -431,6 +443,14 @@
+@@ -431,6 +449,14 @@
  
      if (getsockname(fd, (SA *)&sa, &salen) < 0)
          error(SYS, "getsockname failed");