aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/qp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx5/qp.c')
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 39d24bf694a8..36197fbac63a 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -1584,6 +1584,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
1584 u32 uidx = MLX5_IB_DEFAULT_UIDX; 1584 u32 uidx = MLX5_IB_DEFAULT_UIDX;
1585 struct mlx5_ib_create_qp ucmd; 1585 struct mlx5_ib_create_qp ucmd;
1586 struct mlx5_ib_qp_base *base; 1586 struct mlx5_ib_qp_base *base;
1587 int mlx5_st;
1587 void *qpc; 1588 void *qpc;
1588 u32 *in; 1589 u32 *in;
1589 int err; 1590 int err;
@@ -1592,6 +1593,10 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
1592 spin_lock_init(&qp->sq.lock); 1593 spin_lock_init(&qp->sq.lock);
1593 spin_lock_init(&qp->rq.lock); 1594 spin_lock_init(&qp->rq.lock);
1594 1595
1596 mlx5_st = to_mlx5_st(init_attr->qp_type);
1597 if (mlx5_st < 0)
1598 return -EINVAL;
1599
1595 if (init_attr->rwq_ind_tbl) { 1600 if (init_attr->rwq_ind_tbl) {
1596 if (!udata) 1601 if (!udata)
1597 return -ENOSYS; 1602 return -ENOSYS;
@@ -1753,7 +1758,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
1753 1758
1754 qpc = MLX5_ADDR_OF(create_qp_in, in, qpc); 1759 qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
1755 1760
1756 MLX5_SET(qpc, qpc, st, to_mlx5_st(init_attr->qp_type)); 1761 MLX5_SET(qpc, qpc, st, mlx5_st);
1757 MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED); 1762 MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);
1758 1763
1759 if (init_attr->qp_type != MLX5_IB_QPT_REG_UMR) 1764 if (init_attr->qp_type != MLX5_IB_QPT_REG_UMR)
@@ -3095,8 +3100,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
3095 goto out; 3100 goto out;
3096 3101
3097 if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE || 3102 if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
3098 !optab[mlx5_cur][mlx5_new]) 3103 !optab[mlx5_cur][mlx5_new]) {
3104 err = -EINVAL;
3099 goto out; 3105 goto out;
3106 }
3100 3107
3101 op = optab[mlx5_cur][mlx5_new]; 3108 op = optab[mlx5_cur][mlx5_new];
3102 optpar = ib_mask_to_mlx5_opt(attr_mask); 3109 optpar = ib_mask_to_mlx5_opt(attr_mask);