check_qp_type() checks the FW capability only for XRC and DC. RC, UC and UD QPs are created even if the FW does not report the matching capability bit. Check the rc, uc and ud capabilities as well, so that QP creation is refused for a transport the FW does not support. Signed-off-by: Yishai Hadas --- drivers/infiniband/hw/mlx5/qp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 9bbd3c506b9f..49e3e683b68b 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -2841,15 +2841,24 @@ static int check_qp_type(struct ib_qp *ibqp, struct ib_qp_init_attr *attr, case IB_QPT_XRC_INI: if (!MLX5_CAP_GEN(mdev, xrc)) goto out; - fallthrough; + break; case IB_QPT_RC: + if (!MLX5_CAP_GEN(dev->mdev, rc)) + goto out; + break; case IB_QPT_UC: + if (!MLX5_CAP_GEN(dev->mdev, uc)) + goto out; + break; + case IB_QPT_UD: + if (!MLX5_CAP_GEN(dev->mdev, ud)) + goto out; + break; case IB_QPT_SMI: case MLX5_IB_QPT_HW_GSI: case IB_QPT_DRIVER: case IB_QPT_GSI: case IB_QPT_RAW_PACKET: - case IB_QPT_UD: case MLX5_IB_QPT_REG_UMR: break; default: -- 2.18.1