diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2020-04-27 18:46:06 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2020-04-28 20:42:21 -0300 |
commit | 318d2b06fbaa8fbce379a4e00901251b6368b4e3 (patch) | |
tree | a3b4ff6179dee5ecc736f027337bd0ffa41d692e | |
parent | c86936e6eb13bf3759e4cc0629ccc0076dd763de (diff) | |
download | linux-318d2b06fbaa8fbce379a4e00901251b6368b4e3.tar.bz2 |
RDMA/mlx5: Set QP subtype immediately when it is known
There is no need to delay QP subtype assignment to the end of the
create_qp() function and it is better to move it to be immediately
after it is checked so we would be able to rewrite later checks
to be based on it and not on over-written struct ib_qp_init_attr.
Link: https://lore.kernel.org/r/20200427154636.381474-7-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 86933a2023dc..d991c33c4d9b 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -2581,7 +2581,6 @@ static struct ib_qp *mlx5_ib_create_dct(struct ib_pd *pd, struct mlx5_ib_qp *qp, MLX5_SET(create_dct_in, qp->dct.in, uid, to_mpd(pd)->uid); dctc = MLX5_ADDR_OF(create_dct_in, qp->dct.in, dct_context_entry); - qp->qp_sub_type = MLX5_IB_QPT_DCT; MLX5_SET(dctc, dctc, pd, to_mpd(pd)->pdn); MLX5_SET(dctc, dctc, srqn_xrqn, to_msrq(attr->srq)->msrq.srqn); MLX5_SET(dctc, dctc, cqn, to_mcq(attr->recv_cq)->mcq.cqn); @@ -2765,7 +2764,9 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, err = -EINVAL; goto free_qp; } + qp->qp_sub_type = MLX5_IB_QPT_DCI; } else { + qp->qp_sub_type = MLX5_IB_QPT_DCT; return mlx5_ib_create_dct(pd, qp, init_attr, &ucmd, udata); } @@ -2789,9 +2790,6 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, qp->trans_qp.xrcdn = xrcdn; - if (verbs_init_attr->qp_type == IB_QPT_DRIVER) - qp->qp_sub_type = init_attr->qp_type; - return &qp->ibqp; free_qp: |