diff options
author | Sean Hefty <sean.hefty@intel.com> | 2011-06-02 13:43:26 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-10-13 12:43:46 -0400 |
commit | 18abd5ea571608a7c726fc56e21d3e31f9febfd0 (patch) | |
tree | e2694cadf06a995e658ec30f7a3bd22835dcda7a /drivers/infiniband/hw | |
parent | 012a8ff577f95211c6ffd3b77a94c34ebae009b6 (diff) |
IB/mlx4: Add support for XRC SRQs
Allow the user to create XRC SRQs. This patch is based on a patch
from Jack Morgenstrein <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/hw')
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/srq.c | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 23e45df9ae36..42a538e5df36 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1095,7 +1095,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
1095 | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | | 1095 | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | |
1096 | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | | 1096 | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | |
1097 | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | | 1097 | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | |
1098 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ); | 1098 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | |
1099 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ); | ||
1099 | 1100 | ||
1100 | ibdev->ib_dev.query_device = mlx4_ib_query_device; | 1101 | ibdev->ib_dev.query_device = mlx4_ib_query_device; |
1101 | ibdev->ib_dev.query_port = mlx4_ib_query_port; | 1102 | ibdev->ib_dev.query_port = mlx4_ib_query_port; |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 4f7f7600d27c..39542f3703b8 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c | |||
@@ -76,14 +76,13 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
76 | struct mlx4_ib_srq *srq; | 76 | struct mlx4_ib_srq *srq; |
77 | struct mlx4_wqe_srq_next_seg *next; | 77 | struct mlx4_wqe_srq_next_seg *next; |
78 | struct mlx4_wqe_data_seg *scatter; | 78 | struct mlx4_wqe_data_seg *scatter; |
79 | u32 cqn; | ||
80 | u16 xrcdn; | ||
79 | int desc_size; | 81 | int desc_size; |
80 | int buf_size; | 82 | int buf_size; |
81 | int err; | 83 | int err; |
82 | int i; | 84 | int i; |
83 | 85 | ||
84 | if (init_attr->srq_type != IB_SRQT_BASIC) | ||
85 | return ERR_PTR(-ENOSYS); | ||
86 | |||
87 | /* Sanity check SRQ size before proceeding */ | 86 | /* Sanity check SRQ size before proceeding */ |
88 | if (init_attr->attr.max_wr >= dev->dev->caps.max_srq_wqes || | 87 | if (init_attr->attr.max_wr >= dev->dev->caps.max_srq_wqes || |
89 | init_attr->attr.max_sge > dev->dev->caps.max_srq_sge) | 88 | init_attr->attr.max_sge > dev->dev->caps.max_srq_sge) |
@@ -177,12 +176,18 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
177 | } | 176 | } |
178 | } | 177 | } |
179 | 178 | ||
180 | err = mlx4_srq_alloc(dev->dev, to_mpd(pd)->pdn, &srq->mtt, | 179 | cqn = (init_attr->srq_type == IB_SRQT_XRC) ? |
180 | to_mcq(init_attr->ext.xrc.cq)->mcq.cqn : 0; | ||
181 | xrcdn = (init_attr->srq_type == IB_SRQT_XRC) ? | ||
182 | to_mxrcd(init_attr->ext.xrc.xrcd)->xrcdn : | ||
183 | (u16) dev->dev->caps.reserved_xrcds; | ||
184 | err = mlx4_srq_alloc(dev->dev, to_mpd(pd)->pdn, cqn, xrcdn, &srq->mtt, | ||
181 | srq->db.dma, &srq->msrq); | 185 | srq->db.dma, &srq->msrq); |
182 | if (err) | 186 | if (err) |
183 | goto err_wrid; | 187 | goto err_wrid; |
184 | 188 | ||
185 | srq->msrq.event = mlx4_ib_srq_event; | 189 | srq->msrq.event = mlx4_ib_srq_event; |
190 | srq->ibsrq.ext.xrc.srq_num = srq->msrq.srqn; | ||
186 | 191 | ||
187 | if (pd->uobject) | 192 | if (pd->uobject) |
188 | if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof (__u32))) { | 193 | if (ib_copy_to_udata(udata, &srq->msrq.srqn, sizeof (__u32))) { |