components/open-fabrics/qperf/patches/002-qperf-free_pd_before_mr.patch
author pkidd <patrick.kidd@oracle.com>
Thu, 01 Dec 2016 09:15:00 -0800
branchs11u3-sru
changeset 7423 a17eef087a5e
parent 6322 c8b38df3868d
permissions -rw-r--r--
Added tag 0.175.3.15.0.4.0, S11.3SRU15.4 for changeset f2e0a2f2bfc0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6322
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     1
#This patch was developed both in-house and from outside. We plan to submit it
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     2
#upstream, but do not yet have a target date for doing so
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     3
#
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     4
# HG changeset patch
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     5
# Parent  10ff83daa8b89e664e292c2b716cd5041af246db
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     6
21863652 qperf cannot handle device name with IB port number as argument
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     7
21863393 qperf attempts to free the PD before freeing the MR associated with it
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     8
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
     9
diff -r 10ff83daa8b8 src/qperf.h
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    10
--- a/src/qperf.h	Thu Nov 12 10:14:04 2015 -0800
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    11
+++ b/src/qperf.h	Thu Nov 12 10:17:35 2015 -0800
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    12
@@ -49,6 +49,7 @@
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    13
 #define cardof(a)       (sizeof(a)/sizeof(*a))
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    14
 #define endof(a)        (&a[cardof(a)])
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    15
 #define streq(a, b)     (strcmp(a, b) == 0)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    16
+#define streqn(a, b, n)	(strncmp(a, b, n) == 0)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    17
 #define offset(t, e)    ((long)&((t *)0)->e)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    18
 #define is_client()     (ServerName != 0)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    19
 #define is_sender()     (Req.flip ? !is_client() : is_client())
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    20
diff -r 10ff83daa8b8 src/rdma.c
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    21
--- a/src/rdma.c	Thu Nov 12 10:14:04 2015 -0800
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    22
+++ b/src/rdma.c	Thu Nov 12 10:17:35 2015 -0800
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    23
@@ -1660,11 +1660,11 @@
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    24
         ibv_destroy_ah(dev->ah);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    25
     if (dev->cq)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    26
         ibv_destroy_cq(dev->cq);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    27
+    rd_mrfree(dev);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    28
     if (dev->pd)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    29
         ibv_dealloc_pd(dev->pd);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    30
     if (dev->channel)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    31
         ibv_destroy_comp_channel(dev->channel);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    32
-    rd_mrfree(dev);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    33
 
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    34
     if (!Req.use_cm)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    35
         ib_close2(dev);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    36
@@ -2081,7 +2081,7 @@
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    37
         char *p = index(Req.id, ':');
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    38
 
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    39
         if (p) {
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    40
-            *p++ = '\0';
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    41
+            p++;
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    42
             port = atoi(p);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    43
             if (port < 1)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    44
                 error(0, "bad IB port: %d; must be at least 1", port);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    45
@@ -2119,10 +2119,18 @@
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    46
             device = *dev->ib.devlist;
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    47
         else {
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    48
             struct ibv_device **d = dev->ib.devlist;
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    49
-            while ((device = *d++))
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    50
-                if (streq(ibv_get_device_name(device), name))
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    51
+            size_t n = strlen(name);
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    52
+            char *p = index(Req.id, ':');
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    53
+            if (p) {
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    54
+                n = p - Req.id;
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    55
+            }
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    56
+            while ((device = *d++)) {
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    57
+                if (streqn(ibv_get_device_name(device), name, n)) {
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    58
                     break;
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    59
+                }
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    60
+            }
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    61
         }
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    62
+
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    63
         if (!device)
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    64
             error(SYS, "failed to find InfiniBand device");
c8b38df3868d PSARC/2016/109 Solaris OFED (OFUV) Version 3.18 and other updates
boris.chiu@oracle.com
parents:
diff changeset
    65
         dev->ib.context = ibv_open_device(device);