RDMA/mlx5: Fix Q-counters per vport allocation
authorPatrisious Haddad <phaddad@nvidia.com>
Mon, 5 Jun 2023 10:33:19 +0000 (13:33 +0300)
committerLeon Romanovsky <leon@kernel.org>
Sun, 11 Jun 2023 08:25:39 +0000 (11:25 +0300)
commitc2ea687e5e0e29802714a981a1ccdc17c2c4b2be
tree9239f1242d86cf61871346c3f940c70848f78885
parente1f4a52ac171dd863fe89055e749ef5e0a0bc5ce
RDMA/mlx5: Fix Q-counters per vport allocation

Previously Q-counters data was being allocated over the PF for all of
the available vports, however that isn't necessary.

Since each VF or SF has a Q-counter allocated for itself.

So we only need to allocate two counters data structures, one for the
device counters, and one for all the other vports to expose the
representors, since they only need to read from it in order to
determine mainly counters numbers and names, so they can all share.

This in turn also solves a bug we previously had where we couldn't
switch the device to switchdev mode when there were more than 128 SF/VFs
configured, since that is the maximum amount of Q-counters available for
a single port

Fixes: d22467a71ebe ("RDMA/mlx5: Expand switchdev Q-counters to expose representor statistics")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Mark Zhang <markzhang@nvidia.com>
Link: https://lore.kernel.org/r/f54671df16e2227a069b229b33b62cd9ee24c475.1685960567.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mlx5/counters.c