Skip to content

Commit 06e28eb

Browse files
Michal Kalderongregkh
authored andcommitted
RDMA/qedr: Add EDPM mode type for user-fw compatibility
[ Upstream commit bbe4f42 ] In older FW versions the completion flag was treated as the ack flag in edpm messages. commit ff937b9 ("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: ac1b36e ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 01fdb8e commit 06e28eb

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎drivers/infiniband/hw/qedr/qedr.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ struct qedr_ucontext {
235235
u32 dpi_size;
236236
u16 dpi;
237237
bool db_rec;
238+
u8 edpm_mode;
238239
};
239240

240241
union db_prod32 {

‎drivers/infiniband/hw/qedr/verbs.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
275275
DP_ERR(dev, "Problem copying data from user space\n");
276276
return -EFAULT;
277277
}
278-
278+
ctx->edpm_mode = !!(ureq.context_flags &
279+
QEDR_ALLOC_UCTX_EDPM_MODE);
279280
ctx->db_rec = !!(ureq.context_flags & QEDR_ALLOC_UCTX_DB_REC);
280281
}
281282

@@ -316,7 +317,8 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
316317
uresp.dpm_flags = QEDR_DPM_TYPE_IWARP_LEGACY;
317318
else
318319
uresp.dpm_flags = QEDR_DPM_TYPE_ROCE_ENHANCED |
319-
QEDR_DPM_TYPE_ROCE_LEGACY;
320+
QEDR_DPM_TYPE_ROCE_LEGACY |
321+
QEDR_DPM_TYPE_ROCE_EDPM_MODE;
320322

321323
uresp.dpm_flags |= QEDR_DPM_SIZES_SET;
322324
uresp.ldpm_limit_size = QEDR_LDPM_MAX_SIZE;
@@ -1750,7 +1752,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
17501752
struct qed_rdma_create_qp_out_params out_params;
17511753
struct qedr_pd *pd = get_qedr_pd(ibpd);
17521754
struct qedr_create_qp_uresp uresp;
1753-
struct qedr_ucontext *ctx = NULL;
1755+
struct qedr_ucontext *ctx = pd ? pd->uctx : NULL;
17541756
struct qedr_create_qp_ureq ureq;
17551757
int alloc_and_init = rdma_protocol_roce(&dev->ibdev, 1);
17561758
int rc = -EINVAL;
@@ -1788,6 +1790,9 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
17881790
in_params.rq_pbl_ptr = qp->urq.pbl_tbl->pa;
17891791
}
17901792

1793+
if (ctx)
1794+
SET_FIELD(in_params.flags, QED_ROCE_EDPM_MODE, ctx->edpm_mode);
1795+
17911796
qp->qed_qp = dev->ops->rdma_create_qp(dev->rdma_ctx,
17921797
&in_params, &out_params);
17931798

‎include/uapi/rdma/qedr-abi.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
/* user kernel communication data structures. */
4141
enum qedr_alloc_ucontext_flags {
42-
QEDR_ALLOC_UCTX_RESERVED = 1 << 0,
42+
QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0,
4343
QEDR_ALLOC_UCTX_DB_REC = 1 << 1
4444
};
4545

@@ -56,7 +56,7 @@ enum qedr_rdma_dpm_type {
5656
QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0,
5757
QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1,
5858
QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2,
59-
QEDR_DPM_TYPE_RESERVED = 1 << 3,
59+
QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3,
6060
QEDR_DPM_SIZES_SET = 1 << 4,
6161
};
6262

0 commit comments

Comments
 (0)