Skip to content

Commit 1d91855

Browse files
Luoyoumingjgunthorpe
authored andcommitted
RDMA/hns: Support cqe inline in user space
Enable the CQEIE field and configure the CQEIS field of QPC. And add compatibility handling. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Luoyouming <[email protected]> Signed-off-by: Haoyue Xu <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 2bb185c commit 1d91855

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ enum {
144144
HNS_ROCE_CAP_FLAG_DIRECT_WQE = BIT(12),
145145
HNS_ROCE_CAP_FLAG_SDI_MODE = BIT(14),
146146
HNS_ROCE_CAP_FLAG_STASH = BIT(17),
147+
HNS_ROCE_CAP_FLAG_CQE_INLINE = BIT(19),
147148
};
148149

149150
#define HNS_ROCE_DB_TYPE_COUNT 2

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,6 +4704,18 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
47044704
hr_reg_clear(qpc_mask, QPC_RQIE);
47054705
}
47064706

4707+
if (udata &&
4708+
(ibqp->qp_type == IB_QPT_RC || ibqp->qp_type == IB_QPT_XRC_TGT) &&
4709+
(uctx->config & HNS_ROCE_CQE_INLINE_FLAGS)) {
4710+
hr_reg_write_bool(context, QPC_CQEIE,
4711+
hr_dev->caps.flags &
4712+
HNS_ROCE_CAP_FLAG_CQE_INLINE);
4713+
hr_reg_clear(qpc_mask, QPC_CQEIE);
4714+
4715+
hr_reg_write(context, QPC_CQEIS, 0);
4716+
hr_reg_clear(qpc_mask, QPC_CQEIS);
4717+
}
4718+
47074719
return 0;
47084720
}
47094721

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ struct hns_roce_v2_qp_context {
531531
#define QPC_RQ_RTY_TX_ERR QPC_FIELD_LOC(607, 607)
532532
#define QPC_RX_CQN QPC_FIELD_LOC(631, 608)
533533
#define QPC_XRC_QP_TYPE QPC_FIELD_LOC(632, 632)
534-
#define QPC_RSV3 QPC_FIELD_LOC(634, 633)
534+
#define QPC_CQEIE QPC_FIELD_LOC(633, 633)
535+
#define QPC_CQEIS QPC_FIELD_LOC(634, 634)
535536
#define QPC_MIN_RNR_TIME QPC_FIELD_LOC(639, 635)
536537
#define QPC_RQ_PRODUCER_IDX QPC_FIELD_LOC(655, 640)
537538
#define QPC_RQ_CONSUMER_IDX QPC_FIELD_LOC(671, 656)

drivers/infiniband/hw/hns/hns_roce_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx,
385385
resp.config |= HNS_ROCE_RSP_RQ_INLINE_FLAGS;
386386
}
387387

388+
if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_CQE_INLINE) {
389+
context->config |= ucmd.config & HNS_ROCE_CQE_INLINE_FLAGS;
390+
if (context->config & HNS_ROCE_CQE_INLINE_FLAGS)
391+
resp.config |= HNS_ROCE_RSP_CQE_INLINE_FLAGS;
392+
}
393+
388394
ret = hns_roce_uar_alloc(hr_dev, &context->uar);
389395
if (ret)
390396
goto error_fail_uar_alloc;

include/uapi/rdma/hns-abi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ struct hns_roce_ib_create_qp_resp {
8888
enum {
8989
HNS_ROCE_EXSGE_FLAGS = 1 << 0,
9090
HNS_ROCE_RQ_INLINE_FLAGS = 1 << 1,
91+
HNS_ROCE_CQE_INLINE_FLAGS = 1 << 2,
9192
};
9293

9394
enum {
9495
HNS_ROCE_RSP_EXSGE_FLAGS = 1 << 0,
9596
HNS_ROCE_RSP_RQ_INLINE_FLAGS = 1 << 1,
97+
HNS_ROCE_RSP_CQE_INLINE_FLAGS = 1 << 2,
9698
};
9799

98100
struct hns_roce_ib_alloc_ucontext_resp {

0 commit comments

Comments
 (0)