RDMA/mlx5: Fix port number for counter query in multi-port configuration
authorMichael Guralnik <michaelgur@nvidia.com>
Wed, 3 Apr 2024 09:03:46 +0000 (12:03 +0300)
committerLeon Romanovsky <leon@kernel.org>
Mon, 8 Apr 2024 10:33:10 +0000 (13:33 +0300)
Set the correct port when querying PPCNT in multi-port configuration.
Distinguish between cases where switchdev mode was enabled to multi-port
configuration and don't overwrite the queried port to 1 in multi-port
case.

Fixes: 74b30b3ad5ce ("RDMA/mlx5: Set local port to one when accessing counters")
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Link: https://lore.kernel.org/r/9bfcc8ade958b760a51408c3ad654a01b11f7d76.1712134988.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mlx5/mad.c

index 0c3c4e64812c58cf8457dbaffeb7a28e31cebad1..3e43687a7f6f7313f4031955b1ad03fbc22b8bf9 100644 (file)
@@ -188,7 +188,8 @@ static int process_pma_cmd(struct mlx5_ib_dev *dev, u32 port_num,
                mdev = dev->mdev;
                mdev_port_num = 1;
        }
-       if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1) {
+       if (MLX5_CAP_GEN(dev->mdev, num_ports) == 1 &&
+           !mlx5_core_mp_enabled(mdev)) {
                /* set local port to one for Function-Per-Port HCA. */
                mdev = dev->mdev;
                mdev_port_num = 1;