]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net/mlx5_core: Modify CQ moderation parameters
authorRana Shahout <ranas@mellanox.com>
Thu, 28 May 2015 19:28:44 +0000 (22:28 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 31 May 2015 01:23:59 +0000 (18:23 -0700)
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>
drivers/net/ethernet/mellanox/mlx5/core/cq.c
include/linux/mlx5/cq.h

index eb0cf81f5f4518a06579a6c52e191b72ad1d0e50..04ab7e445eae080b0888d74022af1222479ea36b 100644 (file)
@@ -219,6 +219,24 @@ int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
 }
 EXPORT_SYMBOL(mlx5_core_modify_cq);
 
+int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
+                                  struct mlx5_core_cq *cq,
+                                  u16 cq_period,
+                                  u16 cq_max_count)
+{
+       struct mlx5_modify_cq_mbox_in in;
+
+       memset(&in, 0, sizeof(in));
+
+       in.cqn              = cpu_to_be32(cq->cqn);
+       in.ctx.cq_period    = cpu_to_be16(cq_period);
+       in.ctx.cq_max_count = cpu_to_be16(cq_max_count);
+       in.field_select     = cpu_to_be32(MLX5_CQ_MODIFY_PERIOD |
+                                         MLX5_CQ_MODIFY_COUNT);
+
+       return mlx5_core_modify_cq(dev, cq, &in, sizeof(in));
+}
+
 int mlx5_init_cq_table(struct mlx5_core_dev *dev)
 {
        struct mlx5_cq_table *table = &dev->priv.cq_table;
index 2695ced222df23b56df42252fb7319c7d7d8b157..abc4767695e4bcd6a53fa1eaf8bd8d7809349d26 100644 (file)
@@ -169,6 +169,9 @@ int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
                       struct mlx5_query_cq_mbox_out *out);
 int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
                        struct mlx5_modify_cq_mbox_in *in, int in_sz);
+int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
+                                  struct mlx5_core_cq *cq, u16 cq_period,
+                                  u16 cq_max_count);
 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);