components/open-fabrics/librdmacm/patches/005-librdmacm-xrc-and-22595881.patch
author Sharath M Srinivasan <sharath.srinivasan@oracle.com>
Thu, 13 Apr 2017 20:30:48 -0700
changeset 7865 22ec3267b2a3
permissions -rw-r--r--
PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS 25759055 OFUV (Userland) support for XRC APIs 22595881 defer librdmacm allocation of PD on ADDRESS_RESOLVED event
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7865
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     1
#This patch was developed both in-house and from outside. We plan to submit it
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     2
#upstream, but do not yet have a target date for doing so
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     3
#
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     4
# HG changeset patch
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     5
# Parent  217eb28f33861f64f8a7c4b78d8209e7465bbd83
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     6
25759055 OFUV (Userland) support for XRC APIs
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     7
22595881 defer librdmacm allocation of PD on ADDRESS_RESOLVED event
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     8
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
     9
diff -r 217eb28f3386 examples/rdma_xclient.c
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    10
--- a/examples/rdma_xclient.c	Mon Nov 21 11:48:29 2016 -0800
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    11
+++ b/examples/rdma_xclient.c	Mon Mar 20 14:24:32 2017 -0700
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    12
@@ -148,7 +148,11 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    13
 			case 'r':
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    14
 				break;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    15
 			case 'x':
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    16
-				hints.ai_port_space = RDMA_PS_IB;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    17
+#if defined(__SVR4) && defined(__sun)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    18
+                                hints.ai_port_space = RDMA_PS_TCP;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    19
+#else
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    20
+                                hints.ai_port_space = RDMA_PS_IB;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    21
+#endif
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    22
 				hints.ai_qp_type = IBV_QPT_XRC_SEND;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    23
 				break;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    24
 			default:
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    25
@@ -167,7 +171,7 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    26
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    27
 err:
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    28
 	printf("usage: %s\n", argv[0]);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    29
-	printf("\t[-s server]\n");
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    30
+	printf("\t[-s server_address]\n");
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    31
 	printf("\t[-p port_number]\n");
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    32
 	printf("\t[-c communication type]\n");
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    33
 	printf("\t    r - RC: reliable-connected (default)\n");
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    34
diff -r 217eb28f3386 examples/rdma_xserver.c
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    35
--- a/examples/rdma_xserver.c	Mon Nov 21 11:48:29 2016 -0800
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    36
+++ b/examples/rdma_xserver.c	Mon Mar 20 14:24:32 2017 -0700
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    37
@@ -162,7 +162,11 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    38
 			case 'r':
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    39
 				break;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    40
 			case 'x':
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    41
+#if defined(__SVR4) && defined(__sun)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    42
+				hints.ai_port_space = RDMA_PS_TCP;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    43
+#else
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    44
 				hints.ai_port_space = RDMA_PS_IB;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    45
+#endif
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    46
 				hints.ai_qp_type = IBV_QPT_XRC_RECV;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    47
 				break;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    48
 			default:
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    49
diff -r 217eb28f3386 man/rdma_set_option.3
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    50
--- a/man/rdma_set_option.3	Mon Nov 21 11:48:29 2016 -0800
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    51
+++ b/man/rdma_set_option.3	Mon Mar 20 14:24:32 2017 -0700
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    52
@@ -16,9 +16,9 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    53
 .IP "level" 12
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    54
 Protocol level of the option to set.  Currently level RDMA_OPTION_ID is supported.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    55
 .IP "optname" 12
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    56
-Name of the option, relative to the level, to set.  The only supported option isRDMA_OPTION_ID_REUSEADDR for level RDMA_OPTION_ID.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    57
+Name of the option, relative to the level, to set.  The supported options are RDMA_OPTION_ID_REUSEADDR and RDMA_OPTION_ID_TOS for level RDMA_OPTION_ID.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    58
 .IP "optval" 12
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    59
-Reference to the option data.  The data is dependent on the level and optname.  For the option RDMA_OPTION_ID_REUSEADDR, an integer is passed.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    60
+Reference to the option data.  The data is dependent on the level and optname.  For the options RDMA_OPTION_ID_REUSEADDR and RDMA_OPTION_ID_TOS, an integer is passed.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    61
 .IP "optlen" 12
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    62
 The size of the %optval buffer.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    63
 .SH "DESCRIPTION"
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    64
@@ -33,6 +33,9 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    65
 using rdma_listen(3), is not supported for CMIDs set with
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    66
 this option. This option enables multiple connections to share
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    67
 the same source IP Port on the active side of the connection.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    68
+The RDMA_OPTION_ID_TOS option can be used to set the Terms of Service
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    69
+level. A value of 0 disables the option and a non-zero value
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    70
+enables the option.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    71
 .sp
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    72
 .SH "RETURN VALUE"
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    73
 Returns 0 on success, or -1 on error.  If an error occurs, errno will be
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    74
diff -r 217eb28f3386 src/cma.c
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    75
--- a/src/cma.c	Mon Nov 21 11:48:29 2016 -0800
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    76
+++ b/src/cma.c	Mon Mar 20 14:24:32 2017 -0700
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    77
@@ -456,17 +456,8 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    78
 	if ((ret = ucma_init_device(cma_dev)))
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    79
 		goto out;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    80
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    81
-	if (!cma_dev->refcnt++) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    82
-		cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    83
-		if (!cma_dev->pd) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    84
-			cma_dev->refcnt--;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    85
-			ret = ERR(ENOMEM);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    86
-			goto out;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    87
-		}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    88
-	}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    89
 	id_priv->cma_dev = cma_dev;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    90
 	id_priv->id.verbs = cma_dev->verbs;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    91
-	id_priv->id.pd = cma_dev->pd;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    92
 out:
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    93
 	pthread_mutex_unlock(&mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    94
 	return ret;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    95
@@ -475,11 +466,12 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    96
 static void ucma_put_device(struct cma_device *cma_dev)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    97
 {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    98
 	pthread_mutex_lock(&mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
    99
-	if (!--cma_dev->refcnt) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   100
-		ibv_dealloc_pd(cma_dev->pd);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   101
-		if (cma_dev->xrcd)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   102
-			ibv_close_xrcd(cma_dev->xrcd);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   103
+	if (cma_dev->pd && !--cma_dev->refcnt) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   104
+	        ibv_dealloc_pd(cma_dev->pd);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   105
+		cma_dev->pd = NULL;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   106
 	}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   107
+	if (cma_dev->xrcd)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   108
+		ibv_close_xrcd(cma_dev->xrcd);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   109
 	pthread_mutex_unlock(&mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   110
 }
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   111
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   112
@@ -613,7 +605,7 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   113
 	enum ibv_qp_type qp_type;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   114
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   115
 	qp_type = (ps == RDMA_PS_IPOIB || ps == RDMA_PS_UDP) ?
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   116
-		  IBV_QPT_UD : IBV_QPT_RC;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   117
+		IBV_QPT_UD : IBV_QPT_RC;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   118
 	return rdma_create_id2(channel, id, context, ps, qp_type);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   119
 }
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   120
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   121
@@ -1391,9 +1383,26 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   122
 		return ERR(EINVAL);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   123
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   124
 	id_priv = container_of(id, struct cma_id_private, id);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   125
-	if (!(attr->comp_mask & IBV_QP_INIT_ATTR_PD) || !attr->pd) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   126
+	if (!attr->pd || !(attr->comp_mask & IBV_QP_INIT_ATTR_PD)) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   127
+		struct cma_device *cma_dev;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   128
+		pthread_mutex_lock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   129
+		cma_dev = id_priv->cma_dev;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   130
+		if (!cma_dev->pd && !cma_dev->refcnt++) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   131
+			pthread_mutex_unlock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   132
+			cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   133
+			if (!cma_dev->pd) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   134
+				pthread_mutex_lock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   135
+				cma_dev->refcnt--;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   136
+				pthread_mutex_unlock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   137
+				return ERR(ENOMEM);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   138
+			}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   139
+			pthread_mutex_lock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   140
+			id_priv->id.pd = cma_dev->pd;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   141
+		}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   142
+		pthread_mutex_unlock(&id_priv->mut);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   143
+
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   144
 		attr->comp_mask |= IBV_QP_INIT_ATTR_PD;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   145
-		attr->pd = id->pd;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   146
+		attr->pd = (id->pd) ? id->pd : cma_dev->pd;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   147
 	} else if (id->verbs != attr->pd->context)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   148
 		return ERR(EINVAL);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   149
 
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   150
@@ -1457,12 +1466,49 @@
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   151
 {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   152
 	struct ibv_qp_init_attr_ex attr_ex;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   153
 	int ret;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   154
-
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   155
-	memcpy(&attr_ex, qp_init_attr, sizeof *qp_init_attr);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   156
+	int init_attr_base_size;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   157
+
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   158
+	/*
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   159
+	 * XRC binary compatibility patches to libibverbs add 'xrc_domain'
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   160
+	 * field to the end of "struct ibv_qp_init_attr" in libibverbs,
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   161
+	 * so it is not completely isomorphic to initial fields in
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   162
+	 * "struct ibv_qp_init_attr_ex".
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   163
+	 *
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   164
+	 * We should copy below only the shared fields excluding the
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   165
+	 * xrc_domain field from "struct inv_qp_init_attr" into the
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   166
+	 * "struct ibv_qp_init_attr_ex", otherwise it clobbers the field
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   167
+	 * immediately following the isomorphic initial fields.
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   168
+	 *
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   169
+	 * (The xrc_domain any way has no affect on the sender side, so
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   170
+	 * there is no need to copy it anyway!)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   171
+	 */
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   172
+	init_attr_base_size = offsetof(struct ibv_qp_init_attr, xrc_domain);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   173
+
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   174
+	memset(&attr_ex, 0, sizeof(attr_ex)); /* pre-set all fields to zero */
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   175
+	/* copy only common fields */
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   176
+	memcpy(&attr_ex, qp_init_attr, init_attr_base_size);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   177
 	attr_ex.comp_mask = IBV_QP_INIT_ATTR_PD;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   178
 	attr_ex.pd = pd ? pd : id->pd;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   179
+
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   180
+	if (qp_init_attr->qp_type == IBV_QPT_XRC) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   181
+		/*
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   182
+		 * another private handshake to indicate
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   183
+		 * XRC send or receive side endpoint
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   184
+		 */
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   185
+		if (qp_init_attr->cap.max_send_wr == 0) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   186
+			attr_ex.qp_type = IBV_QPT_XRC_RECV;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   187
+			if (qp_init_attr->xrc_domain) {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   188
+				attr_ex.comp_mask |= IBV_QP_INIT_ATTR_XRCD;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   189
+				attr_ex.xrcd = (struct ibv_xrcd *)
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   190
+					qp_init_attr->xrc_domain;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   191
+			}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   192
+		} else {
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   193
+			attr_ex.qp_type = IBV_QPT_XRC_SEND;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   194
+		}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   195
+	}
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   196
 	ret = rdma_create_qp_ex(id, &attr_ex);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   197
-	memcpy(qp_init_attr, &attr_ex, sizeof *qp_init_attr);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   198
+	/* copy only common fields */
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   199
+	memcpy(qp_init_attr, &attr_ex, init_attr_base_size);
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   200
 	return ret;
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   201
 }
22ec3267b2a3 PSARC/2017/028 OFUV Exafusion support: XRC and RDMA_OPTION_ID_TOS
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
diff changeset
   202