RDMA/mlx5: Split scatter CQE configuration for DCT QP
authorLeon Romanovsky <leonro@mellanox.com>
Mon, 27 Apr 2020 15:46:08 +0000 (18:46 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 28 Apr 2020 23:42:22 +0000 (20:42 -0300)
DCT QPs have separate creation flow and can be easily extracted
from configure_responder_scat_cqe(), this makes both updated
functions more clear.

Link: https://lore.kernel.org/r/20200427154636.381474-9-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>
drivers/infiniband/hw/mlx5/qp.c

index ae336c1..d0e8d27 100644 (file)
@@ -1907,13 +1907,6 @@ static void configure_responder_scat_cqe(struct ib_qp_init_attr *init_attr,
 
        rcqe_sz = mlx5_ib_get_cqe_size(init_attr->recv_cq);
 
-       if (init_attr->qp_type == MLX5_IB_QPT_DCT) {
-               if (rcqe_sz == 128)
-                       MLX5_SET(dctc, qpc, cs_res, MLX5_RES_SCAT_DATA64_CQE);
-
-               return;
-       }
-
        MLX5_SET(qpc, qpc, cs_res,
                 rcqe_sz == 128 ? MLX5_RES_SCAT_DATA64_CQE :
                                  MLX5_RES_SCAT_DATA32_CQE);
@@ -2583,8 +2576,12 @@ static int create_dct(struct ib_pd *pd, struct mlx5_ib_qp *qp,
        MLX5_SET64(dctc, dctc, dc_access_key, ucmd->access_key);
        MLX5_SET(dctc, dctc, user_index, uidx);
 
-       if (ucmd->flags & MLX5_QP_FLAG_SCATTER_CQE)
-               configure_responder_scat_cqe(attr, dctc);
+       if (ucmd->flags & MLX5_QP_FLAG_SCATTER_CQE) {
+               int rcqe_sz = mlx5_ib_get_cqe_size(attr->recv_cq);
+
+               if (rcqe_sz == 128)
+                       MLX5_SET(dctc, dctc, cs_res, MLX5_RES_SCAT_DATA64_CQE);
+       }
 
        qp->state = IB_QPS_RESET;