Skip to content

Commit f4176cd

Browse files
committed
efa: Validate RQ depth relatively to max WR SGEs
EFA RQ max depth reported is the max descriptors a single RQ supports. For RQ EFA support multiple SGEs which means a single recv WR consumes multiple descriptors. This means that if the ULP requests more than 1 descriptor per recv WR, it can't use the max RQ depth reported. Validate the requested RQ depth relatively to the supported max RQ depth with the max SGEs requested. Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
1 parent d2df166 commit f4176cd

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

providers/efa/verbs.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,11 @@ int efadv_get_max_sq_depth(struct ibv_context *ibvctx, struct efadv_sq_depth_att
16601660
return efa_calc_sq_max_depth(ctx, attr->max_inline_data, write_with_inline);
16611661
}
16621662

1663+
static int efa_calc_rq_max_depth(struct efa_context *ctx, uint32_t max_recv_sge)
1664+
{
1665+
return ctx->max_rq_wr / max_recv_sge;
1666+
}
1667+
16631668
int efadv_get_max_rq_depth(struct ibv_context *ibvctx, struct efadv_rq_depth_attr *attr,
16641669
uint32_t inlen)
16651670
{
@@ -1681,7 +1686,7 @@ int efadv_get_max_rq_depth(struct ibv_context *ibvctx, struct efadv_rq_depth_att
16811686
return -EINVAL;
16821687
}
16831688

1684-
return ctx->max_rq_wr / attr->max_recv_sge;
1689+
return efa_calc_rq_max_depth(ctx, attr->max_recv_sge);
16851690
}
16861691

16871692
static void efa_setup_qp(struct efa_context *ctx,
@@ -1831,7 +1836,7 @@ static int efa_check_qp_limits(struct efa_context *ctx,
18311836
struct efadv_qp_init_attr *efa_attr)
18321837
{
18331838
bool inline_write_enabled = !!(efa_attr->flags & EFADV_QP_FLAGS_INLINE_WRITE);
1834-
int sq_max_depth;
1839+
int sq_max_depth, rq_max_depth;
18351840

18361841
if (attr->cap.max_send_sge > ctx->max_sq_sge) {
18371842
verbs_err(&ctx->ibvctx,
@@ -1854,10 +1859,11 @@ static int efa_check_qp_limits(struct efa_context *ctx,
18541859
return EINVAL;
18551860
}
18561861

1857-
if (attr->cap.max_recv_wr > ctx->max_rq_wr) {
1862+
rq_max_depth = efa_calc_rq_max_depth(ctx, attr->cap.max_recv_sge);
1863+
if (attr->cap.max_recv_wr > rq_max_depth) {
18581864
verbs_err(&ctx->ibvctx,
1859-
"Max receive WR %u > %u\n", attr->cap.max_recv_wr,
1860-
ctx->max_rq_wr);
1865+
"Requested max SGE %u, max receive WR %u > %u\n", attr->cap.max_recv_sge,
1866+
attr->cap.max_recv_wr, rq_max_depth);
18611867
return EINVAL;
18621868
}
18631869

0 commit comments

Comments
 (0)