]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
librdmacm: only allocate qp in rdma_create_ep if qp_attr provided
authorSean Hefty <sean.hefty@intel.com>
Tue, 5 Oct 2010 18:30:06 +0000 (11:30 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 5 Oct 2010 18:30:06 +0000 (11:30 -0700)
The comments and documentation for rdma_create_ep indicate that
it will only allocate a QP if initial QP attributes are provided.
However, the code always attempts to create a QP off an
active rdma_cm_id endpoint.

By _not_ allocating the QP, a user can first determine
what RDMA device an rdma_cm_id was associated with (returned from
rdma_create_ep).  The user can then call rdma_create_qp to
allocate a QP referencing an existing CQ, SRQ, or PD.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
trunk/ulp/librdmacm/src/cma.cpp

index 215bdf6a10ac9211ec70b1d9b588fbca0c2ca06b..841fbf6829fcc85d026104a189be3f0c58853995 100644 (file)
@@ -1407,10 +1407,12 @@ int rdma_create_ep(struct rdma_cm_id **id, struct rdma_addrinfo *res,
        if (ret)\r
                goto err;\r
 \r
-       qp_init_attr->qp_type = (enum ibv_qp_type) res->ai_qp_type;\r
-       ret = rdma_create_qp(cm_id, pd, qp_init_attr);\r
-       if (ret)\r
-               goto err;\r
+       if (qp_init_attr) {\r
+               qp_init_attr->qp_type = (enum ibv_qp_type) res->ai_qp_type;\r
+               ret = rdma_create_qp(cm_id, pd, qp_init_attr);\r
+               if (ret)\r
+                       goto err;\r
+       }\r
 \r
 out:\r
        *id = cm_id;\r