Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 272361
b: refs/heads/master
c: 418d513
h: refs/heads/master
i:
  272359: 8b1d284
v: v3
  • Loading branch information
Sean Hefty authored and Roland Dreier committed Oct 13, 2011
1 parent 2cc5b21 commit 4bb142e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96104eda01695a26da2c8f7423ec0ba3509c8c97
refs/heads/master: 418d51307d102e72e745031adb4f5ba0ddb646e2
21 changes: 20 additions & 1 deletion trunk/drivers/infiniband/core/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd,
srq->event_handler = srq_init_attr->event_handler;
srq->srq_context = srq_init_attr->srq_context;
srq->srq_type = srq_init_attr->srq_type;
if (srq->srq_type == IB_SRQT_XRC) {
srq->ext.xrc.xrcd = srq_init_attr->ext.xrc.xrcd;
srq->ext.xrc.cq = srq_init_attr->ext.xrc.cq;
atomic_inc(&srq->ext.xrc.xrcd->usecnt);
atomic_inc(&srq->ext.xrc.cq->usecnt);
}
atomic_inc(&pd->usecnt);
atomic_set(&srq->usecnt, 0);
}
Expand Down Expand Up @@ -280,16 +286,29 @@ EXPORT_SYMBOL(ib_query_srq);
int ib_destroy_srq(struct ib_srq *srq)
{
struct ib_pd *pd;
enum ib_srq_type srq_type;
struct ib_xrcd *uninitialized_var(xrcd);
struct ib_cq *uninitialized_var(cq);
int ret;

if (atomic_read(&srq->usecnt))
return -EBUSY;

pd = srq->pd;
srq_type = srq->srq_type;
if (srq_type == IB_SRQT_XRC) {
xrcd = srq->ext.xrc.xrcd;
cq = srq->ext.xrc.cq;
}

ret = srq->device->destroy_srq(srq);
if (!ret)
if (!ret) {
atomic_dec(&pd->usecnt);
if (srq_type == IB_SRQT_XRC) {
atomic_dec(&xrcd->usecnt);
atomic_dec(&cq->usecnt);
}
}

return ret;
}
Expand Down
18 changes: 17 additions & 1 deletion trunk/include/rdma/ib_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ enum ib_cq_notify_flags {
};

enum ib_srq_type {
IB_SRQT_BASIC
IB_SRQT_BASIC,
IB_SRQT_XRC
};

enum ib_srq_attr_mask {
Expand All @@ -543,6 +544,13 @@ struct ib_srq_init_attr {
void *srq_context;
struct ib_srq_attr attr;
enum ib_srq_type srq_type;

union {
struct {
struct ib_xrcd *xrcd;
struct ib_cq *cq;
} xrc;
} ext;
};

struct ib_qp_cap {
Expand Down Expand Up @@ -895,6 +903,14 @@ struct ib_srq {
void *srq_context;
enum ib_srq_type srq_type;
atomic_t usecnt;

union {
struct {
struct ib_xrcd *xrcd;
struct ib_cq *cq;
u32 srq_num;
} xrc;
} ext;
};

struct ib_qp {
Expand Down

0 comments on commit 4bb142e

Please sign in to comment.