net/mlx5: fix shared counter allocation logic