]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/qedr: Add EDPM mode type for user-fw compatibility
authorMichal Kalderon <michal.kalderon@marvell.com>
Tue, 7 Jul 2020 06:30:59 +0000 (09:30 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 16 Jul 2020 19:01:55 +0000 (16:01 -0300)
In older FW versions the completion flag was treated as the ack flag in
edpm messages.  commit ff937b916eb6 ("qed: Add EDPM mode type for user-fw
compatibility") exposed the FW option of setting which mode the QP is in
by adding a flag to the qedr <-> qed API.

This patch adds the qedr <-> libqedr interface so that the libqedr can set
the flag appropriately and qedr can pass it down to FW.  Flag is added for
backward compatibility with libqedr.

For older libs, this flag didn't exist and therefore set to zero.

Fixes: ac1b36e55a51 ("qedr: Add support for user context verbs")
Link: https://lore.kernel.org/r/20200707063100.3811-2-michal.kalderon@marvell.com
Signed-off-by: Yuval Bason <yuval.bason@marvell.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/qedr/qedr.h
drivers/infiniband/hw/qedr/verbs.c
include/uapi/rdma/qedr-abi.h

index aa332027da868b8a9d47e1f34912375cbd4a30f3..460292179b327812611ce25be66c3168a3914f51 100644 (file)
@@ -235,6 +235,7 @@ struct qedr_ucontext {
        u32 dpi_size;
        u16 dpi;
        bool db_rec;
+       u8 edpm_mode;
 };
 
 union db_prod32 {
index 42273aa0b5e1600ce689d9a7adbd8a2e04315b05..5008149ea116fe2c970d21ec79a32db87a5fc00f 100644 (file)
@@ -275,7 +275,8 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
                        DP_ERR(dev, "Problem copying data from user space\n");
                        return -EFAULT;
                }
-
+               ctx->edpm_mode = !!(ureq.context_flags &
+                                   QEDR_ALLOC_UCTX_EDPM_MODE);
                ctx->db_rec = !!(ureq.context_flags & QEDR_ALLOC_UCTX_DB_REC);
        }
 
@@ -316,7 +317,8 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
                uresp.dpm_flags = QEDR_DPM_TYPE_IWARP_LEGACY;
        else
                uresp.dpm_flags = QEDR_DPM_TYPE_ROCE_ENHANCED |
-                                 QEDR_DPM_TYPE_ROCE_LEGACY;
+                                 QEDR_DPM_TYPE_ROCE_LEGACY |
+                                 QEDR_DPM_TYPE_ROCE_EDPM_MODE;
 
        uresp.dpm_flags |= QEDR_DPM_SIZES_SET;
        uresp.ldpm_limit_size = QEDR_LDPM_MAX_SIZE;
@@ -1750,7 +1752,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
        struct qed_rdma_create_qp_out_params out_params;
        struct qedr_pd *pd = get_qedr_pd(ibpd);
        struct qedr_create_qp_uresp uresp;
-       struct qedr_ucontext *ctx = NULL;
+       struct qedr_ucontext *ctx = pd ? pd->uctx : NULL;
        struct qedr_create_qp_ureq ureq;
        int alloc_and_init = rdma_protocol_roce(&dev->ibdev, 1);
        int rc = -EINVAL;
@@ -1788,6 +1790,9 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
                in_params.rq_pbl_ptr = qp->urq.pbl_tbl->pa;
        }
 
+       if (ctx)
+               SET_FIELD(in_params.flags, QED_ROCE_EDPM_MODE, ctx->edpm_mode);
+
        qp->qed_qp = dev->ops->rdma_create_qp(dev->rdma_ctx,
                                              &in_params, &out_params);
 
index a0b83c9d4498ba9cd638f0585d333720b2451f75..b261c9fca07bb6c031b4fe79bd0f73172e018b4c 100644 (file)
@@ -39,7 +39,7 @@
 
 /* user kernel communication data structures. */
 enum qedr_alloc_ucontext_flags {
-       QEDR_ALLOC_UCTX_RESERVED        = 1 << 0,
+       QEDR_ALLOC_UCTX_EDPM_MODE       = 1 << 0,
        QEDR_ALLOC_UCTX_DB_REC          = 1 << 1
 };
 
@@ -56,7 +56,7 @@ enum qedr_rdma_dpm_type {
        QEDR_DPM_TYPE_ROCE_ENHANCED     = 1 << 0,
        QEDR_DPM_TYPE_ROCE_LEGACY       = 1 << 1,
        QEDR_DPM_TYPE_IWARP_LEGACY      = 1 << 2,
-       QEDR_DPM_TYPE_RESERVED          = 1 << 3,
+       QEDR_DPM_TYPE_ROCE_EDPM_MODE    = 1 << 3,
        QEDR_DPM_SIZES_SET              = 1 << 4,
 };