net/mlx5: FPGA, Abort FPGA init if the device reports no QP capability
authorYevgeny Kliteynik <kliteyn@mellanox.com>
Wed, 8 Nov 2017 16:07:17 +0000 (18:07 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 30 May 2018 00:27:50 +0000 (17:27 -0700)
In the case that the reported max number of QPs capability
equals to zero, abort FPGA init.

Signed-off-by: Yevgeny Kliteynik <kliteyn@mellanox.com>
Signed-off-by: Adi Nissim <adin@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c

index 02319f779a49f7061d39fcc914ccfa35f34d14ca..26caa0475985c6532322c82674c96bc2cbc7f53c 100644 (file)
@@ -170,6 +170,12 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev)
                       MLX5_CAP_FPGA(fdev->mdev, sandbox_product_version));
 
        max_num_qps = MLX5_CAP_FPGA(mdev, shell_caps.max_num_qps);
+       if (!max_num_qps) {
+               mlx5_fpga_err(fdev, "FPGA reports 0 QPs in SHELL_CAPS\n");
+               err = -ENOTSUPP;
+               goto out;
+       }
+
        err = mlx5_core_reserve_gids(mdev, max_num_qps);
        if (err)
                goto out;