#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
#
# HG changeset patch
# Parent 10ff83daa8b89e664e292c2b716cd5041af246db
21863652 qperf cannot handle device name with IB port number as argument
21863393 qperf attempts to free the PD before freeing the MR associated with it
diff -r 10ff83daa8b8 src/qperf.h
--- a/src/qperf.h Thu Nov 12 10:14:04 2015 -0800
+++ b/src/qperf.h Thu Nov 12 10:17:35 2015 -0800
@@ -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())
diff -r 10ff83daa8b8 src/rdma.c
--- a/src/rdma.c Thu Nov 12 10:14:04 2015 -0800
+++ b/src/rdma.c Thu Nov 12 10:17:35 2015 -0800
@@ -1660,11 +1660,11 @@
ibv_destroy_ah(dev->ah);
if (dev->cq)
ibv_destroy_cq(dev->cq);
+ rd_mrfree(dev);
if (dev->pd)
ibv_dealloc_pd(dev->pd);
if (dev->channel)
ibv_destroy_comp_channel(dev->channel);
- rd_mrfree(dev);
if (!Req.use_cm)
ib_close2(dev);
@@ -2081,7 +2081,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);
@@ -2119,10 +2119,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);