21863652 qperf cannot handle device name with IB port number as argument
authorboris.chiu@oracle.com
Wed, 30 Sep 2015 09:48:41 -0700
changeset 4908 8eb64ba1b2ad
parent 4907 38c3e88acfc0
child 4909 37c8a5df8c41
21863652 qperf cannot handle device name with IB port number as argument
components/open-fabrics/qperf/patches/base.patch
--- a/components/open-fabrics/qperf/patches/base.patch	Wed Sep 30 09:48:41 2015 -0700
+++ b/components/open-fabrics/qperf/patches/base.patch	Wed Sep 30 09:48:41 2015 -0700
@@ -1,3 +1,6 @@
+# This patch was developed both in-house and from outside. We plan to submit it
+# upstream, but do not yet have a target date for doing so
+#
 diff -r -u /tmp/730054/qperf-0.4.6/src/socket.c qperf-0.4.6/src/socket.c
 --- /tmp/730054/qperf-0.4.6/src/socket.c	Mon Aug 31 00:00:40 2009
 +++ qperf-0.4.6/src/socket.c	Mon Nov  8 11:10:20 2010
@@ -563,6 +566,36 @@
      cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
      rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
  
[email protected]@ -2012,7 +2071,7 @@
+         char *p = index(Req.id, ':');
+ 
+         if (p) {
+-            *p++ = '\0';
++            p++;
+             port = atoi(p);
+             if (port < 1)
+                 error(0, "bad IB port: %d; must be at least 1", port);
[email protected]@ -2050,10 +2109,18 @@
+             device = *dev->ib.devlist;
+         else {
+             struct ibv_device **d = dev->ib.devlist;
+-            while ((device = *d++))
+-                if (streq(ibv_get_device_name(device), name))
++            size_t n = strlen(name);
++            char *p = index(Req.id, ':');
++            if (p) {
++                n = p - Req.id;
++            }
++            while ((device = *d++)) {
++                if (streqn(ibv_get_device_name(device), name, n)) {
+                     break;
++                }
++            }
+         }
++
+         if (!device)
+             error(SYS, "failed to find InfiniBand device");
+         dev->ib.context = ibv_open_device(device);
 diff -r -u /tmp/730054/qperf-0.4.6/src/rds.c qperf-0.4.6/src/rds.c
 --- /tmp/730054/qperf-0.4.6/src/rds.c	Mon Aug 31 00:00:40 2009
 +++ qperf-0.4.6/src/rds.c	Mon Nov  8 11:10:19 2010
@@ -649,7 +682,15 @@
 diff -r -u /tmp/730054/qperf-0.4.6/src/qperf.h qperf-0.4.6/src/qperf.h
 --- /tmp/730054/qperf-0.4.6/src/qperf.h	Mon Aug 31 00:00:40 2009
 +++ qperf-0.4.6/src/qperf.h	Tue Oct 18 16:40:59 2011
[email protected]@ -193,6 +193,7 @@
[email protected]@ -49,6 +49,7 @@
+ #define cardof(a)       (sizeof(a)/sizeof(*a))
+ #define endof(a)        (&a[cardof(a)])
+ #define streq(a, b)     (strcmp(a, b) == 0)
++#define streqn(a, b, n)	(strncmp(a, b, n) == 0)
+ #define offset(t, e)    ((long)&((t *)0)->e)
+ #define is_client()     (ServerName != 0)
+ #define is_sender()     (Req.flip ? !is_client() : is_client())
[email protected]@ -193,6 +194,7 @@
      uint32_t    no_cpus;                /* Number of processors */
      uint32_t    no_ticks;               /* Ticks per second */
      uint32_t    max_cqes;               /* Maximum CQ entries */