diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2007-06-21 06:03:11 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-12 18:41:24 -0400 |
commit | 65541cb7cf353946ecd78016a453b453b8830656 (patch) | |
tree | 0a93ed27fdb6caf3f90250eaaf179b560e6742f3 | |
parent | 6a775e2ba4f7635849ade628e64723ab2beef0bc (diff) |
IB/mlx4: Implement query SRQ
Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/mlx4_ib.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/srq.c | 18 | ||||
-rw-r--r-- | drivers/net/mlx4/srq.c | 30 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 1 |
5 files changed, 52 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 6b9870a50bea..dde8fe9af47e 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -529,6 +529,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
529 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | | 529 | (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | |
530 | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | | 530 | (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | |
531 | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | | 531 | (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | |
532 | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | | ||
532 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ); | 533 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ); |
533 | 534 | ||
534 | ibdev->ib_dev.query_device = mlx4_ib_query_device; | 535 | ibdev->ib_dev.query_device = mlx4_ib_query_device; |
@@ -547,6 +548,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
547 | ibdev->ib_dev.destroy_ah = mlx4_ib_destroy_ah; | 548 | ibdev->ib_dev.destroy_ah = mlx4_ib_destroy_ah; |
548 | ibdev->ib_dev.create_srq = mlx4_ib_create_srq; | 549 | ibdev->ib_dev.create_srq = mlx4_ib_create_srq; |
549 | ibdev->ib_dev.modify_srq = mlx4_ib_modify_srq; | 550 | ibdev->ib_dev.modify_srq = mlx4_ib_modify_srq; |
551 | ibdev->ib_dev.query_srq = mlx4_ib_query_srq; | ||
550 | ibdev->ib_dev.destroy_srq = mlx4_ib_destroy_srq; | 552 | ibdev->ib_dev.destroy_srq = mlx4_ib_destroy_srq; |
551 | ibdev->ib_dev.post_srq_recv = mlx4_ib_post_srq_recv; | 553 | ibdev->ib_dev.post_srq_recv = mlx4_ib_post_srq_recv; |
552 | ibdev->ib_dev.create_qp = mlx4_ib_create_qp; | 554 | ibdev->ib_dev.create_qp = mlx4_ib_create_qp; |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index d6dc57c5ccca..705ff2fa237e 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -256,6 +256,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
256 | struct ib_udata *udata); | 256 | struct ib_udata *udata); |
257 | int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | 257 | int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, |
258 | enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); | 258 | enum ib_srq_attr_mask attr_mask, struct ib_udata *udata); |
259 | int mlx4_ib_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); | ||
259 | int mlx4_ib_destroy_srq(struct ib_srq *srq); | 260 | int mlx4_ib_destroy_srq(struct ib_srq *srq); |
260 | void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); | 261 | void mlx4_ib_free_srq_wqe(struct mlx4_ib_srq *srq, int wqe_index); |
261 | int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | 262 | int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 12fac1c8989d..408748fb5285 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c | |||
@@ -240,6 +240,24 @@ int mlx4_ib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | int mlx4_ib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *srq_attr) | ||
244 | { | ||
245 | struct mlx4_ib_dev *dev = to_mdev(ibsrq->device); | ||
246 | struct mlx4_ib_srq *srq = to_msrq(ibsrq); | ||
247 | int ret; | ||
248 | int limit_watermark; | ||
249 | |||
250 | ret = mlx4_srq_query(dev->dev, &srq->msrq, &limit_watermark); | ||
251 | if (ret) | ||
252 | return ret; | ||
253 | |||
254 | srq_attr->srq_limit = be16_to_cpu(limit_watermark); | ||
255 | srq_attr->max_wr = srq->msrq.max - 1; | ||
256 | srq_attr->max_sge = srq->msrq.max_gs; | ||
257 | |||
258 | return 0; | ||
259 | } | ||
260 | |||
243 | int mlx4_ib_destroy_srq(struct ib_srq *srq) | 261 | int mlx4_ib_destroy_srq(struct ib_srq *srq) |
244 | { | 262 | { |
245 | struct mlx4_ib_dev *dev = to_mdev(srq->device); | 263 | struct mlx4_ib_dev *dev = to_mdev(srq->device); |
diff --git a/drivers/net/mlx4/srq.c b/drivers/net/mlx4/srq.c index 2134f83aed87..b061c86d6839 100644 --- a/drivers/net/mlx4/srq.c +++ b/drivers/net/mlx4/srq.c | |||
@@ -102,6 +102,13 @@ static int mlx4_ARM_SRQ(struct mlx4_dev *dev, int srq_num, int limit_watermark) | |||
102 | MLX4_CMD_TIME_CLASS_B); | 102 | MLX4_CMD_TIME_CLASS_B); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int mlx4_QUERY_SRQ(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox, | ||
106 | int srq_num) | ||
107 | { | ||
108 | return mlx4_cmd_box(dev, 0, mailbox->dma, srq_num, 0, MLX4_CMD_QUERY_SRQ, | ||
109 | MLX4_CMD_TIME_CLASS_A); | ||
110 | } | ||
111 | |||
105 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, | 112 | int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, |
106 | u64 db_rec, struct mlx4_srq *srq) | 113 | u64 db_rec, struct mlx4_srq *srq) |
107 | { | 114 | { |
@@ -205,6 +212,29 @@ int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark | |||
205 | } | 212 | } |
206 | EXPORT_SYMBOL_GPL(mlx4_srq_arm); | 213 | EXPORT_SYMBOL_GPL(mlx4_srq_arm); |
207 | 214 | ||
215 | int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark) | ||
216 | { | ||
217 | struct mlx4_cmd_mailbox *mailbox; | ||
218 | struct mlx4_srq_context *srq_context; | ||
219 | int err; | ||
220 | |||
221 | mailbox = mlx4_alloc_cmd_mailbox(dev); | ||
222 | if (IS_ERR(mailbox)) | ||
223 | return PTR_ERR(mailbox); | ||
224 | |||
225 | srq_context = mailbox->buf; | ||
226 | |||
227 | err = mlx4_QUERY_SRQ(dev, mailbox, srq->srqn); | ||
228 | if (err) | ||
229 | goto err_out; | ||
230 | *limit_watermark = srq_context->limit_watermark; | ||
231 | |||
232 | err_out: | ||
233 | mlx4_free_cmd_mailbox(dev, mailbox); | ||
234 | return err; | ||
235 | } | ||
236 | EXPORT_SYMBOL_GPL(mlx4_srq_query); | ||
237 | |||
208 | int __devinit mlx4_init_srq_table(struct mlx4_dev *dev) | 238 | int __devinit mlx4_init_srq_table(struct mlx4_dev *dev) |
209 | { | 239 | { |
210 | struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; | 240 | struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 8209387ee854..cfb78fb2c046 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -323,6 +323,7 @@ int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, | |||
323 | u64 db_rec, struct mlx4_srq *srq); | 323 | u64 db_rec, struct mlx4_srq *srq); |
324 | void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq); | 324 | void mlx4_srq_free(struct mlx4_dev *dev, struct mlx4_srq *srq); |
325 | int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark); | 325 | int mlx4_srq_arm(struct mlx4_dev *dev, struct mlx4_srq *srq, int limit_watermark); |
326 | int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_watermark); | ||
326 | 327 | ||
327 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); | 328 | int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); |
328 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); | 329 | int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); |