提交 3bdb31f6 编写于 作者: E Eli Cohen 提交者: Roland Dreier

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: NEli Cohen <eli@mellanox.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 ada388f7
...@@ -818,7 +818,31 @@ void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq) ...@@ -818,7 +818,31 @@ void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq)
int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
{ {
return -ENOSYS; struct mlx5_modify_cq_mbox_in *in;
struct mlx5_ib_dev *dev = to_mdev(cq->device);
struct mlx5_ib_cq *mcq = to_mcq(cq);
int err;
u32 fsel;
if (!(dev->mdev.caps.flags & MLX5_DEV_CAP_FLAG_CQ_MODER))
return -ENOSYS;
in = kzalloc(sizeof(*in), GFP_KERNEL);
if (!in)
return -ENOMEM;
in->cqn = cpu_to_be32(mcq->mcq.cqn);
fsel = (MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT);
in->ctx.cq_period = cpu_to_be16(cq_period);
in->ctx.cq_max_count = cpu_to_be16(cq_count);
in->field_select = cpu_to_be32(fsel);
err = mlx5_core_modify_cq(&dev->mdev, &mcq->mcq, in);
kfree(in);
if (err)
mlx5_ib_warn(dev, "modify cq 0x%x failed\n", mcq->mcq.cqn);
return err;
} }
int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
......
...@@ -201,10 +201,23 @@ EXPORT_SYMBOL(mlx5_core_query_cq); ...@@ -201,10 +201,23 @@ EXPORT_SYMBOL(mlx5_core_query_cq);
int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
int type, struct mlx5_cq_modify_params *params) struct mlx5_modify_cq_mbox_in *in)
{ {
return -ENOSYS; struct mlx5_modify_cq_mbox_out out;
int err;
memset(&out, 0, sizeof(out));
in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MODIFY_CQ);
err = mlx5_cmd_exec(dev, in, sizeof(*in), &out, sizeof(out));
if (err)
return err;
if (out.hdr.status)
return mlx5_cmd_status_to_err(&out.hdr);
return 0;
} }
EXPORT_SYMBOL(mlx5_core_modify_cq);
int mlx5_init_cq_table(struct mlx5_core_dev *dev) int mlx5_init_cq_table(struct mlx5_core_dev *dev)
{ {
......
...@@ -85,9 +85,9 @@ enum { ...@@ -85,9 +85,9 @@ enum {
}; };
enum { enum {
MLX5_CQ_MODIFY_RESEIZE = 0, MLX5_CQ_MODIFY_PERIOD = 1 << 0,
MLX5_CQ_MODIFY_MODER = 1, MLX5_CQ_MODIFY_COUNT = 1 << 1,
MLX5_CQ_MODIFY_MAPPING = 2, MLX5_CQ_MODIFY_OVERRUN = 1 << 2,
}; };
struct mlx5_cq_modify_params { 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,7 +158,7 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
struct mlx5_query_cq_mbox_out *out); struct mlx5_query_cq_mbox_out *out);
int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
int type, struct mlx5_cq_modify_params *params); struct mlx5_modify_cq_mbox_in *in);
int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
......
...@@ -177,6 +177,7 @@ enum { ...@@ -177,6 +177,7 @@ enum {
MLX5_DEV_CAP_FLAG_APM = 1LL << 17, MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32, MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38, MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
...@@ -698,6 +699,19 @@ struct mlx5_query_cq_mbox_out { ...@@ -698,6 +699,19 @@ struct mlx5_query_cq_mbox_out {
__be64 pas[0]; __be64 pas[0];
}; };
struct mlx5_modify_cq_mbox_in {
struct mlx5_inbox_hdr hdr;
__be32 cqn;
__be32 field_select;
struct mlx5_cq_context ctx;
u8 rsvd[192];
__be64 pas[0];
};
struct mlx5_modify_cq_mbox_out {
struct mlx5_outbox_hdr hdr;
};
struct mlx5_enable_hca_mbox_in { struct mlx5_enable_hca_mbox_in {
struct mlx5_inbox_hdr hdr; struct mlx5_inbox_hdr hdr;
u8 rsvd[8]; u8 rsvd[8];
...@@ -872,6 +886,7 @@ struct mlx5_modify_mkey_mbox_in { ...@@ -872,6 +886,7 @@ struct mlx5_modify_mkey_mbox_in {
struct mlx5_modify_mkey_mbox_out { struct mlx5_modify_mkey_mbox_out {
struct mlx5_outbox_hdr hdr; struct mlx5_outbox_hdr hdr;
u8 rsvd[8];
}; };
struct mlx5_dump_mkey_mbox_in { struct mlx5_dump_mkey_mbox_in {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册