diff options
author | Eli Cohen <eli@dev.mellanox.co.il> | 2014-01-14 10:45:17 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-01-23 02:23:49 -0500 |
commit | 3bdb31f688276505ede23280885948e934304674 (patch) | |
tree | c5699406b9ed58f6eaa4fe6ab00843425e367c82 | |
parent | ada388f7afad1e2e87acbfe30600fdaff9bd6327 (diff) |
IB/mlx5: Implement modify CQ
Modify CQ is used by ULPs like IPoIB to change moderation parameters. This
patch adds support in mlx5.
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/cq.c | 26 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/cq.c | 17 | ||||
-rw-r--r-- | include/linux/mlx5/cq.h | 8 | ||||
-rw-r--r-- | include/linux/mlx5/device.h | 15 |
4 files changed, 59 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index b72627429745..b4c122eab484 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c | |||
@@ -818,7 +818,31 @@ void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq) | |||
818 | 818 | ||
819 | int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) | 819 | int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) |
820 | { | 820 | { |
821 | return -ENOSYS; | 821 | struct mlx5_modify_cq_mbox_in *in; |
822 | struct mlx5_ib_dev *dev = to_mdev(cq->device); | ||
823 | struct mlx5_ib_cq *mcq = to_mcq(cq); | ||
824 | int err; | ||
825 | u32 fsel; | ||
826 | |||
827 | if (!(dev->mdev.caps.flags & MLX5_DEV_CAP_FLAG_CQ_MODER)) | ||
828 | return -ENOSYS; | ||
829 | |||
830 | in = kzalloc(sizeof(*in), GFP_KERNEL); | ||
831 | if (!in) | ||
832 | return -ENOMEM; | ||
833 | |||
834 | in->cqn = cpu_to_be32(mcq->mcq.cqn); | ||
835 | fsel = (MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT); | ||
836 | in->ctx.cq_period = cpu_to_be16(cq_period); | ||
837 | in->ctx.cq_max_count = cpu_to_be16(cq_count); | ||
838 | in->field_select = cpu_to_be32(fsel); | ||
839 | err = mlx5_core_modify_cq(&dev->mdev, &mcq->mcq, in); | ||
840 | kfree(in); | ||
841 | |||
842 | if (err) | ||
843 | mlx5_ib_warn(dev, "modify cq 0x%x failed\n", mcq->mcq.cqn); | ||
844 | |||
845 | return err; | ||
822 | } | 846 | } |
823 | 847 | ||
824 | int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) | 848 | int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c index c2d660be6f76..e6fedcf94182 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c | |||
@@ -201,10 +201,23 @@ EXPORT_SYMBOL(mlx5_core_query_cq); | |||
201 | 201 | ||
202 | 202 | ||
203 | int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 203 | int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
204 | int type, struct mlx5_cq_modify_params *params) | 204 | struct mlx5_modify_cq_mbox_in *in) |
205 | { | 205 | { |
206 | return -ENOSYS; | 206 | struct mlx5_modify_cq_mbox_out out; |
207 | int err; | ||
208 | |||
209 | memset(&out, 0, sizeof(out)); | ||
210 | in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MODIFY_CQ); | ||
211 | err = mlx5_cmd_exec(dev, in, sizeof(*in), &out, sizeof(out)); | ||
212 | if (err) | ||
213 | return err; | ||
214 | |||
215 | if (out.hdr.status) | ||
216 | return mlx5_cmd_status_to_err(&out.hdr); | ||
217 | |||
218 | return 0; | ||
207 | } | 219 | } |
220 | EXPORT_SYMBOL(mlx5_core_modify_cq); | ||
208 | 221 | ||
209 | int mlx5_init_cq_table(struct mlx5_core_dev *dev) | 222 | int mlx5_init_cq_table(struct mlx5_core_dev *dev) |
210 | { | 223 | { |
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h index 3db67f73d96d..c3cf5a46abce 100644 --- a/include/linux/mlx5/cq.h +++ b/include/linux/mlx5/cq.h | |||
@@ -85,9 +85,9 @@ enum { | |||
85 | }; | 85 | }; |
86 | 86 | ||
87 | enum { | 87 | enum { |
88 | MLX5_CQ_MODIFY_RESEIZE = 0, | 88 | MLX5_CQ_MODIFY_PERIOD = 1 << 0, |
89 | MLX5_CQ_MODIFY_MODER = 1, | 89 | MLX5_CQ_MODIFY_COUNT = 1 << 1, |
90 | MLX5_CQ_MODIFY_MAPPING = 2, | 90 | MLX5_CQ_MODIFY_OVERRUN = 1 << 2, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct mlx5_cq_modify_params { | 93 | struct mlx5_cq_modify_params { |
@@ -158,7 +158,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); | |||
158 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 158 | int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
159 | struct mlx5_query_cq_mbox_out *out); | 159 | struct mlx5_query_cq_mbox_out *out); |
160 | int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, | 160 | int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, |
161 | int type, struct mlx5_cq_modify_params *params); | 161 | struct mlx5_modify_cq_mbox_in *in); |
162 | int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); | 162 | int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); |
163 | void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); | 163 | void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); |
164 | 164 | ||
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 2c1c62e339ca..dbb03caa8aed 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -177,6 +177,7 @@ enum { | |||
177 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, | 177 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, |
178 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, | 178 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, |
179 | MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, | 179 | MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, |
180 | MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, | ||
180 | MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, | 181 | MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, |
181 | MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, | 182 | MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, |
182 | MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, | 183 | MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, |
@@ -698,6 +699,19 @@ struct mlx5_query_cq_mbox_out { | |||
698 | __be64 pas[0]; | 699 | __be64 pas[0]; |
699 | }; | 700 | }; |
700 | 701 | ||
702 | struct mlx5_modify_cq_mbox_in { | ||
703 | struct mlx5_inbox_hdr hdr; | ||
704 | __be32 cqn; | ||
705 | __be32 field_select; | ||
706 | struct mlx5_cq_context ctx; | ||
707 | u8 rsvd[192]; | ||
708 | __be64 pas[0]; | ||
709 | }; | ||
710 | |||
711 | struct mlx5_modify_cq_mbox_out { | ||
712 | struct mlx5_outbox_hdr hdr; | ||
713 | }; | ||
714 | |||
701 | struct mlx5_enable_hca_mbox_in { | 715 | struct mlx5_enable_hca_mbox_in { |
702 | struct mlx5_inbox_hdr hdr; | 716 | struct mlx5_inbox_hdr hdr; |
703 | u8 rsvd[8]; | 717 | u8 rsvd[8]; |
@@ -872,6 +886,7 @@ struct mlx5_modify_mkey_mbox_in { | |||
872 | 886 | ||
873 | struct mlx5_modify_mkey_mbox_out { | 887 | struct mlx5_modify_mkey_mbox_out { |
874 | struct mlx5_outbox_hdr hdr; | 888 | struct mlx5_outbox_hdr hdr; |
889 | u8 rsvd[8]; | ||
875 | }; | 890 | }; |
876 | 891 | ||
877 | struct mlx5_dump_mkey_mbox_in { | 892 | struct mlx5_dump_mkey_mbox_in { |