Skip to content

Commit a4e6a1d

Browse files
gal-pressmanjgunthorpe
authored andcommitted
RDMA/efa: Introduce SRD RNR retry
This patch introduces the ability to configure SRD QPs with the RNR retry parameter when issuing a modify QP command. In addition, a capability bit was added to report support to the userspace library. Link: https://lore.kernel.org/r/20200731060420.17053-5-galpress@amazon.com Reviewed-by: Firas JahJah <firasj@amazon.com> Reviewed-by: Yossi Leybovich <sleybo@amazon.com> Signed-off-by: Gal Pressman <galpress@amazon.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 22c50e0 commit a4e6a1d

5 files changed

Lines changed: 32 additions & 9 deletions

File tree

‎drivers/infiniband/hw/efa/efa_admin_cmds_defs.h‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ struct efa_admin_modify_qp_cmd {
197197
* 2 : qkey
198198
* 3 : sq_psn
199199
* 4 : sq_drained_async_notify
200-
* 31:5 : reserved
200+
* 5 : rnr_retry
201+
* 31:6 : reserved
201202
*/
202203
u32 modify_mask;
203204

@@ -219,8 +220,8 @@ struct efa_admin_modify_qp_cmd {
219220
/* Enable async notification when SQ is drained */
220221
u8 sq_drained_async_notify;
221222

222-
/* MBZ */
223-
u8 reserved1;
223+
/* Number of RNR retries (valid only for SRD QPs) */
224+
u8 rnr_retry;
224225

225226
/* MBZ */
226227
u16 reserved2;
@@ -255,8 +256,8 @@ struct efa_admin_query_qp_resp {
255256
/* Indicates that draining is in progress */
256257
u8 sq_draining;
257258

258-
/* MBZ */
259-
u8 reserved1;
259+
/* Number of RNR retries (valid only for SRD QPs) */
260+
u8 rnr_retry;
260261

261262
/* MBZ */
262263
u16 reserved2;
@@ -573,7 +574,9 @@ struct efa_admin_feature_device_attr_desc {
573574
/*
574575
* 0 : rdma_read - If set, RDMA Read is supported on
575576
* TX queues
576-
* 31:1 : reserved - MBZ
577+
* 1 : rnr_retry - If set, RNR retry is supported on
578+
* modify QP command
579+
* 31:2 : reserved - MBZ
577580
*/
578581
u32 device_caps;
579582

@@ -865,6 +868,7 @@ struct efa_admin_host_info {
865868
#define EFA_ADMIN_MODIFY_QP_CMD_QKEY_MASK BIT(2)
866869
#define EFA_ADMIN_MODIFY_QP_CMD_SQ_PSN_MASK BIT(3)
867870
#define EFA_ADMIN_MODIFY_QP_CMD_SQ_DRAINED_ASYNC_NOTIFY_MASK BIT(4)
871+
#define EFA_ADMIN_MODIFY_QP_CMD_RNR_RETRY_MASK BIT(5)
868872

869873
/* reg_mr_cmd */
870874
#define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK GENMASK(4, 0)
@@ -882,6 +886,7 @@ struct efa_admin_host_info {
882886

883887
/* feature_device_attr_desc */
884888
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK BIT(0)
889+
#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK BIT(1)
885890

886891
/* host_info */
887892
#define EFA_ADMIN_HOST_INFO_DRIVER_MODULE_TYPE_MASK GENMASK(7, 0)

‎drivers/infiniband/hw/efa/efa_com_cmd.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ int efa_com_modify_qp(struct efa_com_dev *edev,
7676
cmd.qkey = params->qkey;
7777
cmd.sq_psn = params->sq_psn;
7878
cmd.sq_drained_async_notify = params->sq_drained_async_notify;
79+
cmd.rnr_retry = params->rnr_retry;
7980

8081
err = efa_com_cmd_exec(aq,
8182
(struct efa_admin_aq_entry *)&cmd,
@@ -121,6 +122,7 @@ int efa_com_query_qp(struct efa_com_dev *edev,
121122
result->qkey = resp.qkey;
122123
result->sq_draining = resp.sq_draining;
123124
result->sq_psn = resp.sq_psn;
125+
result->rnr_retry = resp.rnr_retry;
124126

125127
return 0;
126128
}

‎drivers/infiniband/hw/efa/efa_com_cmd.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct efa_com_modify_qp_params {
4747
u32 qkey;
4848
u32 sq_psn;
4949
u8 sq_drained_async_notify;
50+
u8 rnr_retry;
5051
};
5152

5253
struct efa_com_query_qp_params {
@@ -58,6 +59,7 @@ struct efa_com_query_qp_result {
5859
u32 qkey;
5960
u32 sq_draining;
6061
u32 sq_psn;
62+
u8 rnr_retry;
6163
};
6264

6365
struct efa_com_destroy_qp_params {

‎drivers/infiniband/hw/efa/efa_verbs.c‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ int efa_query_device(struct ib_device *ibdev,
223223
if (EFA_DEV_CAP(dev, RDMA_READ))
224224
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_RDMA_READ;
225225

226+
if (EFA_DEV_CAP(dev, RNR_RETRY))
227+
resp.device_caps |= EFA_QUERY_DEVICE_CAPS_RNR_RETRY;
228+
226229
err = ib_copy_to_udata(udata, &resp,
227230
min(sizeof(resp), udata->outlen));
228231
if (err) {
@@ -268,7 +271,7 @@ int efa_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
268271

269272
#define EFA_QUERY_QP_SUPP_MASK \
270273
(IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT | \
271-
IB_QP_QKEY | IB_QP_SQ_PSN | IB_QP_CAP)
274+
IB_QP_QKEY | IB_QP_SQ_PSN | IB_QP_CAP | IB_QP_RNR_RETRY)
272275

273276
if (qp_attr_mask & ~EFA_QUERY_QP_SUPP_MASK) {
274277
ibdev_dbg(&dev->ibdev,
@@ -290,6 +293,7 @@ int efa_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
290293
qp_attr->sq_psn = result.sq_psn;
291294
qp_attr->sq_draining = result.sq_draining;
292295
qp_attr->port_num = 1;
296+
qp_attr->rnr_retry = result.rnr_retry;
293297

294298
qp_attr->cap.max_send_wr = qp->max_send_wr;
295299
qp_attr->cap.max_recv_wr = qp->max_recv_wr;
@@ -776,7 +780,9 @@ static const struct {
776780
.valid = 1,
777781
.req_param = IB_QP_SQ_PSN,
778782
.opt_param = IB_QP_CUR_STATE |
779-
IB_QP_QKEY,
783+
IB_QP_QKEY |
784+
IB_QP_RNR_RETRY,
785+
780786
}
781787
},
782788
[IB_QPS_RTS] = {
@@ -856,7 +862,8 @@ static int efa_modify_qp_validate(struct efa_dev *dev, struct efa_qp *qp,
856862

857863
#define EFA_MODIFY_QP_SUPP_MASK \
858864
(IB_QP_STATE | IB_QP_CUR_STATE | IB_QP_EN_SQD_ASYNC_NOTIFY | \
859-
IB_QP_PKEY_INDEX | IB_QP_PORT | IB_QP_QKEY | IB_QP_SQ_PSN)
865+
IB_QP_PKEY_INDEX | IB_QP_PORT | IB_QP_QKEY | IB_QP_SQ_PSN | \
866+
IB_QP_RNR_RETRY)
860867

861868
if (qp_attr_mask & ~EFA_MODIFY_QP_SUPP_MASK) {
862869
ibdev_dbg(&dev->ibdev,
@@ -943,6 +950,12 @@ int efa_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
943950
params.sq_psn = qp_attr->sq_psn;
944951
}
945952

953+
if (qp_attr_mask & IB_QP_RNR_RETRY) {
954+
EFA_SET(&params.modify_mask, EFA_ADMIN_MODIFY_QP_CMD_RNR_RETRY,
955+
1);
956+
params.rnr_retry = qp_attr->rnr_retry;
957+
}
958+
946959
err = efa_com_modify_qp(&dev->edev, &params);
947960
if (err)
948961
return err;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ struct efa_ibv_create_ah_resp {
105105

106106
enum {
107107
EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
108+
EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
108109
};
109110

110111
struct efa_ibv_ex_query_device_resp {

0 commit comments

Comments
 (0)