aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/cmd.c
diff options
context:
space:
mode:
authorTalat Batheesh <talatb@mellanox.com>2018-06-21 15:37:56 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-06-22 08:51:14 -0600
commit9f876f3de6616f02960d7d88ad52c805946f4b63 (patch)
treef5f6d0f597d2d3025ab6d51487d7bc5041a6b8c1 /drivers/infiniband/hw/mlx5/cmd.c
parentnet/mlx5: Add RoCE RX ICRC encapsulated counter (diff)
downloadlinux-dev-9f876f3de6616f02960d7d88ad52c805946f4b63.tar.xz
linux-dev-9f876f3de6616f02960d7d88ad52c805946f4b63.zip
IB/mlx5: Support RoCE ICRC encapsulated error counter
This patch adds support to query the counter that counts the RoCE packets with corrupted ICRC (Invariant Cyclic Redundancy Code). This counter will be under /sys/class/infiniband/<mlx5-dev>/ports/<port>/hw_counters/ rx_icrc_encapsulated - The number of RoCE packets with ICRC error. Signed-off-by: Talat Batheesh <talatb@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/cmd.c')
-rw-r--r--drivers/infiniband/hw/mlx5/cmd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c
index 188512bf46e6..026717eaa92d 100644
--- a/drivers/infiniband/hw/mlx5/cmd.c
+++ b/drivers/infiniband/hw/mlx5/cmd.c
@@ -170,3 +170,15 @@ int mlx5_cmd_dealloc_memic(struct mlx5_memic *memic, u64 addr, u64 length)
return err;
}
+
+int mlx5_cmd_query_ext_ppcnt_counters(struct mlx5_core_dev *dev, void *out)
+{
+ u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
+ int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
+
+ MLX5_SET(ppcnt_reg, in, local_port, 1);
+
+ MLX5_SET(ppcnt_reg, in, grp, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP);
+ return mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPCNT,
+ 0, 0);
+}