]> git.baikalelectronics.ru Git - kernel.git/commitdiff
IB/mlx5: Support IB_SRQT_TM
authorArtemy Kovalyov <artemyko@mellanox.com>
Thu, 17 Aug 2017 12:52:11 +0000 (15:52 +0300)
committerDoug Ledford <dledford@redhat.com>
Tue, 29 Aug 2017 12:30:20 +0000 (08:30 -0400)
Pass to mlx5_core flag to enable rendezvous offload, list_size and CQ
when SRQ created with IB_SRQT_TM.

Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
Reviewed-by: Yossi Itigin <yosefe@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/qp.c
drivers/infiniband/hw/mlx5/srq.c

index d6df88a78d5e12edd6f461eae9f8d766e2c1931c..acb79d3a4f1d3741d163f98e83a4f2e6a4a75d34 100644 (file)
@@ -1729,10 +1729,15 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
 
        MLX5_SET(qpc, qpc, rq_type, get_rx_type(qp, init_attr));
 
-       if (qp->sq.wqe_cnt)
+       if (qp->sq.wqe_cnt) {
                MLX5_SET(qpc, qpc, log_sq_size, ilog2(qp->sq.wqe_cnt));
-       else
+       } else {
                MLX5_SET(qpc, qpc, no_sq, 1);
+               if (init_attr->srq &&
+                   init_attr->srq->srq_type == IB_SRQT_TM)
+                       MLX5_SET(qpc, qpc, offload_type,
+                                MLX5_QPC_OFFLOAD_TYPE_RNDV);
+       }
 
        /* Set default resources */
        switch (init_attr->qp_type) {
index e6be4f2927a7b9dfef9dcf7105a412f4a5bc9085..6d5fadad909081d17b80c967cbe69b8c381e6bd8 100644 (file)
@@ -101,7 +101,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
                                 udata->inlen - sizeof(ucmd)))
                return -EINVAL;
 
-       if (in->type == IB_SRQT_XRC) {
+       if (in->type != IB_SRQT_BASIC) {
                err = get_srq_user_index(to_mucontext(pd->uobject->context),
                                         &ucmd, udata->inlen, &uidx);
                if (err)
@@ -145,7 +145,7 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
        in->log_page_size = page_shift - MLX5_ADAPTER_PAGE_SHIFT;
        in->page_offset = offset;
        if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 &&
-           in->type == IB_SRQT_XRC)
+           in->type != IB_SRQT_BASIC)
                in->user_index = uidx;
 
        return 0;
@@ -205,7 +205,7 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq,
 
        in->log_page_size = srq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT;
        if (MLX5_CAP_GEN(dev->mdev, cqe_version) == MLX5_CQE_VERSION_V1 &&
-           in->type == IB_SRQT_XRC)
+           in->type != IB_SRQT_BASIC)
                in->user_index = MLX5_IB_DEFAULT_UIDX;
 
        return 0;
@@ -298,6 +298,18 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
        else
                in.xrcd = to_mxrcd(dev->devr.x0)->xrcdn;
 
+       if (init_attr->srq_type == IB_SRQT_TM) {
+               in.tm_log_list_size =
+                       ilog2(init_attr->ext.tag_matching.max_num_tags) + 1;
+               if (in.tm_log_list_size >
+                   MLX5_CAP_GEN(dev->mdev, log_tag_matching_list_sz)) {
+                       mlx5_ib_dbg(dev, "TM SRQ max_num_tags exceeding limit\n");
+                       err = -EINVAL;
+                       goto err_usr_kern_srq;
+               }
+               in.flags |= MLX5_SRQ_FLAG_RNDV;
+       }
+
        if (ib_srq_has_cq(init_attr->srq_type))
                in.cqn = to_mcq(init_attr->ext.cq)->mcq.cqn;
        else