aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2011-05-27 02:06:44 -0400
committerRoland Dreier <roland@purestorage.com>2011-10-13 12:20:27 -0400
commitd3d72d909e783d048ee39046aa7b4fa798a4dda8 (patch)
treeb773014148c09565b02ad542295b5c6caa7fd498 /include/rdma/ib_verbs.h
parentb42b63cf0dde2af6eec462b2d6cca7d938702a28 (diff)
RDMA/verbs: Cleanup XRC TGT QPs when destroying XRCD
XRC TGT QPs are intended to be shared among multiple users and processes. Allow the destruction of an XRC TGT QP to be done explicitly through ib_destroy_qp() or when the XRCD is destroyed. To support destroying an XRC TGT QP, we need to track TGT QPs with the XRCD. When the XRCD is destroyed, all tracked XRC TGT QPs are also cleaned up. To avoid stale reference issues, if a user is holding a reference on a TGT QP, we increment a reference count on the QP. The user releases the reference by calling ib_release_qp. This releases any access to the QP from a user above verbs, but allows the QP to continue to exist until destroyed by the XRCD. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c3d7602b5e90..ac46dcf04358 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -880,7 +880,10 @@ struct ib_pd {
880 880
881struct ib_xrcd { 881struct ib_xrcd {
882 struct ib_device *device; 882 struct ib_device *device;
883 atomic_t usecnt; /* count all resources */ 883 atomic_t usecnt; /* count all exposed resources */
884
885 struct mutex tgt_qp_mutex;
886 struct list_head tgt_qp_list;
884}; 887};
885 888
886struct ib_ah { 889struct ib_ah {
@@ -926,6 +929,7 @@ struct ib_qp {
926 struct ib_cq *recv_cq; 929 struct ib_cq *recv_cq;
927 struct ib_srq *srq; 930 struct ib_srq *srq;
928 struct ib_xrcd *xrcd; /* XRC TGT QPs only */ 931 struct ib_xrcd *xrcd; /* XRC TGT QPs only */
932 struct list_head xrcd_list;
929 struct ib_uobject *uobject; 933 struct ib_uobject *uobject;
930 void (*event_handler)(struct ib_event *, void *); 934 void (*event_handler)(struct ib_event *, void *);
931 void *qp_context; 935 void *qp_context;
@@ -1482,6 +1486,17 @@ int ib_query_qp(struct ib_qp *qp,
1482int ib_destroy_qp(struct ib_qp *qp); 1486int ib_destroy_qp(struct ib_qp *qp);
1483 1487
1484/** 1488/**
1489 * ib_release_qp - Release an external reference to a QP.
1490 * @qp: The QP handle to release
1491 *
1492 * The specified QP handle is released by the caller. If the QP is
1493 * referenced internally, it is not destroyed until all internal
1494 * references are released. After releasing the qp, the caller
1495 * can no longer access it and all events on the QP are discarded.
1496 */
1497int ib_release_qp(struct ib_qp *qp);
1498
1499/**
1485 * ib_post_send - Posts a list of work requests to the send queue of 1500 * ib_post_send - Posts a list of work requests to the send queue of
1486 * the specified QP. 1501 * the specified QP.
1487 * @qp: The QP to post the work request on. 1502 * @qp: The QP to post the work request on.