aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2011-05-23 22:42:29 -0400
committerRoland Dreier <roland@purestorage.com>2011-10-13 12:14:31 -0400
commit418d51307d102e72e745031adb4f5ba0ddb646e2 (patch)
tree929f9e9331541535013a302e8ff9432480ae635e /drivers/infiniband
parent96104eda01695a26da2c8f7423ec0ba3509c8c97 (diff)
RDMA/core: Add XRC SRQ type
XRC ("eXtended reliable connected") is an IB transport that provides better scalability by allowing senders to specify which shared receive queue (SRQ) should be used to receive a message, which essentially allows one transport context (QP connection) to serve multiple destinations (as long as they share an adapter, of course). XRC defines SRQs that are specifically used by XRC connections. Expand the SRQ code to support XRC SRQs. An XRC SRQ is currently restricted to only XRC use according to the IB XRC Annex. Portions of this patch were derived from work by Jack Morgenstein <jackm@dev.mellanox.co.il>. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/verbs.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index cbe85ddaf898..25c1c1ea4460 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -251,6 +251,12 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd,
251 srq->event_handler = srq_init_attr->event_handler; 251 srq->event_handler = srq_init_attr->event_handler;
252 srq->srq_context = srq_init_attr->srq_context; 252 srq->srq_context = srq_init_attr->srq_context;
253 srq->srq_type = srq_init_attr->srq_type; 253 srq->srq_type = srq_init_attr->srq_type;
254 if (srq->srq_type == IB_SRQT_XRC) {
255 srq->ext.xrc.xrcd = srq_init_attr->ext.xrc.xrcd;
256 srq->ext.xrc.cq = srq_init_attr->ext.xrc.cq;
257 atomic_inc(&srq->ext.xrc.xrcd->usecnt);
258 atomic_inc(&srq->ext.xrc.cq->usecnt);
259 }
254 atomic_inc(&pd->usecnt); 260 atomic_inc(&pd->usecnt);
255 atomic_set(&srq->usecnt, 0); 261 atomic_set(&srq->usecnt, 0);
256 } 262 }
@@ -280,16 +286,29 @@ EXPORT_SYMBOL(ib_query_srq);
280int ib_destroy_srq(struct ib_srq *srq) 286int ib_destroy_srq(struct ib_srq *srq)
281{ 287{
282 struct ib_pd *pd; 288 struct ib_pd *pd;
289 enum ib_srq_type srq_type;
290 struct ib_xrcd *uninitialized_var(xrcd);
291 struct ib_cq *uninitialized_var(cq);
283 int ret; 292 int ret;
284 293
285 if (atomic_read(&srq->usecnt)) 294 if (atomic_read(&srq->usecnt))
286 return -EBUSY; 295 return -EBUSY;
287 296
288 pd = srq->pd; 297 pd = srq->pd;
298 srq_type = srq->srq_type;
299 if (srq_type == IB_SRQT_XRC) {
300 xrcd = srq->ext.xrc.xrcd;
301 cq = srq->ext.xrc.cq;
302 }
289 303
290 ret = srq->device->destroy_srq(srq); 304 ret = srq->device->destroy_srq(srq);
291 if (!ret) 305 if (!ret) {
292 atomic_dec(&pd->usecnt); 306 atomic_dec(&pd->usecnt);
307 if (srq_type == IB_SRQT_XRC) {
308 atomic_dec(&xrcd->usecnt);
309 atomic_dec(&cq->usecnt);
310 }
311 }
293 312
294 return ret; 313 return ret;
295} 314}