Skip to content

Commit 74b30b3

Browse files
Chris Mirleon
authored andcommitted
RDMA/mlx5: Set local port to one when accessing counters
When accessing Ports Performance Counters Register (PPCNT), local port must be one if it is Function-Per-Port HCA that HCA_CAP.num_ports is 1. The offending patch can change the local port to other values when accessing PPCNT after enabling switchdev mode. The following syndrome will be printed: # cat /sys/class/infiniband/rdmap4s0f0/ports/2/counters/* # dmesg mlx5_core 0000:04:00.0: mlx5_cmd_check:756:(pid 12450): ACCESS_REG(0x805) op_mod(0x1) failed, status bad parameter(0x3), syndrome (0x1e5585) Fix it by setting local port to one for Function-Per-Port HCA. Fixes: 210b1f7 ("IB/mlx5: When not in dual port RoCE mode, use provided port as native") Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Chris Mi <[email protected]> Link: https://lore.kernel.org/r/6c5086c295c76211169e58dbd610fb0402360bab.1661763459.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 9ca05b0 commit 74b30b3

File tree

1 file changed

+6
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+6
-0
lines changed

drivers/infiniband/hw/mlx5/mad.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u32 port_num,
166166
mdev = dev->mdev;
167167
mdev_port_num = 1;
168168
}
169+
if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1) {
170+
/* set local port to one for Function-Per-Port HCA. */
171+
mdev = dev->mdev;
172+
mdev_port_num = 1;
173+
}
174+
169175
/* Declaring support of extended counters */
170176
if (in_mad->mad_hdr.attr_id == IB_PMA_CLASS_PORT_INFO) {
171177
struct ib_class_port_info cpi = {};

0 commit comments

Comments
 (0)