Skip to content

Commit 90b3e38

Browse files
Rana Shahoutdavem330
authored andcommitted
net/mlx5_core: Modify CQ moderation parameters
Introduce mlx5_core_modify_cq_moderation() to be used by the netdev, to set hardware coalescing. Signed-off-by: Rana Shahout <ranas@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4c916a7 commit 90b3e38

File tree

2 files changed

+21
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core
  • include/linux/mlx5

2 files changed

+21
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/cq.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,24 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
219219
}
220220
EXPORT_SYMBOL(mlx5_core_modify_cq);
221221

222+
int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
223+
struct mlx5_core_cq *cq,
224+
u16 cq_period,
225+
u16 cq_max_count)
226+
{
227+
struct mlx5_modify_cq_mbox_in in;
228+
229+
memset(&in, 0, sizeof(in));
230+
231+
in.cqn = cpu_to_be32(cq->cqn);
232+
in.ctx.cq_period = cpu_to_be16(cq_period);
233+
in.ctx.cq_max_count = cpu_to_be16(cq_max_count);
234+
in.field_select = cpu_to_be32(MLX5_CQ_MODIFY_PERIOD |
235+
MLX5_CQ_MODIFY_COUNT);
236+
237+
return mlx5_core_modify_cq(dev, cq, &in, sizeof(in));
238+
}
239+
222240
int mlx5_init_cq_table(struct mlx5_core_dev *dev)
223241
{
224242
struct mlx5_cq_table *table = &dev->priv.cq_table;

include/linux/mlx5/cq.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
169169
struct mlx5_query_cq_mbox_out *out);
170170
int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
171171
struct mlx5_modify_cq_mbox_in *in, int in_sz);
172+
int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
173+
struct mlx5_core_cq *cq, u16 cq_period,
174+
u16 cq_max_count);
172175
int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
173176
void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
174177

0 commit comments

Comments
 (0)