Discussion:
[PATCH] srp-target: Rertry when QP creation fails with ENOMEM
Sagi Grimberg
2014-10-19 15:05:33 UTC
Permalink
From: Bart Van Assche <***@acm.org>

Retry with srp_sq_size/2.

Reported-by: Mark Lehrer <***@gmail.com>
Signed-off-by: Bart Van Assche <***@acm.org>
Signed-off-by: Sagi Grimberg <***@mellanox.com>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index d28a8c2..d1042eb 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2092,6 +2092,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
if (!qp_init)
goto out;

+retry:
ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
ch->rq_size + srp_sq_size, 0);
if (IS_ERR(ch->cq)) {
@@ -2115,6 +2116,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
ch->qp = ib_create_qp(sdev->pd, qp_init);
if (IS_ERR(ch->qp)) {
ret = PTR_ERR(ch->qp);
+ if (ret == -ENOMEM) {
+ srp_sq_size /= 2;
+ if (srp_sq_size >= MIN_SRPT_SQ_SIZE) {
+ ib_destroy_cq(ch->cq);
+ goto retry;
+ }
+ }
printk(KERN_ERR "failed to create_qp ret= %d\n", ret);
goto err_destroy_cq;
}
--
1.7.1
Nicholas A. Bellinger
2014-10-22 05:24:23 UTC
Permalink
Post by Sagi Grimberg
Retry with srp_sq_size/2.
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Applied to target-pending/queue. Thanks Bart + Sagi!

A more detailed commit log and/or comment would be helpful to include
for master on this one..

--nab
Sagi Grimberg
2014-10-22 11:24:07 UTC
Permalink
Post by Nicholas A. Bellinger
Post by Sagi Grimberg
Retry with srp_sq_size/2.
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Applied to target-pending/queue. Thanks Bart + Sagi!
A more detailed commit log and/or comment would be helpful to include
for master on this one..
How about:

It is not guaranteed to that srp_sq_size is supported
by the HCA. So if we failed to create the QP with ENOMEM,
try with a smaller srp_sq_size. Keep it up until we hit
MIN_SRPT_SQ_SIZE, then fail the connection.

Sagi.
Nicholas A. Bellinger
2014-10-22 21:07:57 UTC
Permalink
Post by Sagi Grimberg
Post by Nicholas A. Bellinger
Post by Sagi Grimberg
Retry with srp_sq_size/2.
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Applied to target-pending/queue. Thanks Bart + Sagi!
A more detailed commit log and/or comment would be helpful to include
for master on this one..
It is not guaranteed to that srp_sq_size is supported
by the HCA. So if we failed to create the QP with ENOMEM,
try with a smaller srp_sq_size. Keep it up until we hit
MIN_SRPT_SQ_SIZE, then fail the connection.
Updated. Thanks Sagi!

--nab

Loading...