diff options
author | Meny Yossefi <menyy@mellanox.com> | 2016-02-18 11:15:00 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-03-01 10:57:15 -0500 |
commit | 1c64bf6f291cae7cbe779e407db9477378bb4e7d (patch) | |
tree | b8ef1f134babc7928cb754827a4db8ac6dbeaa28 /drivers/net | |
parent | b54ba2772b7af82a07eb48f88c88f7cadfb33401 (diff) |
net/mlx5_core: Add helper function to read IB error counters
Added helper function to read IB standard error counters
via the PPCNT register.
The PPCNT register read command provides the 32-bit error counters
of both IB/RoCE link layer and transport layer.
Signed-off-by: Meny Yossefi <menyy@mellanox.com>
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/port.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c index a87e773e93f3..5635ce7ad693 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c | |||
@@ -324,6 +324,29 @@ int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev, | |||
324 | } | 324 | } |
325 | EXPORT_SYMBOL_GPL(mlx5_query_port_vl_hw_cap); | 325 | EXPORT_SYMBOL_GPL(mlx5_query_port_vl_hw_cap); |
326 | 326 | ||
327 | int mlx5_core_query_ib_ppcnt(struct mlx5_core_dev *dev, | ||
328 | u8 port_num, void *out, size_t sz) | ||
329 | { | ||
330 | u32 *in; | ||
331 | int err; | ||
332 | |||
333 | in = mlx5_vzalloc(sz); | ||
334 | if (!in) { | ||
335 | err = -ENOMEM; | ||
336 | return err; | ||
337 | } | ||
338 | |||
339 | MLX5_SET(ppcnt_reg, in, local_port, port_num); | ||
340 | |||
341 | MLX5_SET(ppcnt_reg, in, grp, MLX5_INFINIBAND_PORT_COUNTERS_GROUP); | ||
342 | err = mlx5_core_access_reg(dev, in, sz, out, | ||
343 | sz, MLX5_REG_PPCNT, 0, 0); | ||
344 | |||
345 | kvfree(in); | ||
346 | return err; | ||
347 | } | ||
348 | EXPORT_SYMBOL_GPL(mlx5_core_query_ib_ppcnt); | ||
349 | |||
327 | int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause) | 350 | int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause) |
328 | { | 351 | { |
329 | u32 in[MLX5_ST_SZ_DW(pfcc_reg)]; | 352 | u32 in[MLX5_ST_SZ_DW(pfcc_reg)]; |