Skip to contentSkip to conversation

librdmacm: Make some functions report proper errno

PATCH Applied Xiao Yang 2 participants 7 messages Dec 16, 2020 – Dec 22, 2020 InfiniBand

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH v2 1/1 librdmacm: Make some functions report proper errno

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

---
 librdmacm/cma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
librdmacm/cma.c +3 -3
index 8c820ccf..a2575156 100644
@@ -635,7 +635,7 @@ static int ucma_get_device(struct cma_id_private *id_priv, __be64 guid,
 	if (!cma_dev->pd)
 		cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
 	if (!cma_dev->pd) {
-		ret = ERR(ENOMEM);
+		ret = -1;
 		goto out;
 	}
 
@@ -1490,7 +1490,7 @@ static int ucma_create_cqs(struct rdma_cm_id *id, uint32_t send_size, uint32_t r
 	return 0;
 err:
 	ucma_destroy_cqs(id);
-	return ERR(ENOMEM);
+	return -1;
 }
 
 int rdma_create_srq_ex(struct rdma_cm_id *id, struct ibv_srq_init_attr_ex *attr)
@@ -1662,7 +1662,7 @@ int rdma_create_qp_ex(struct rdma_cm_id *id,
 		attr->srq = id->srq;
 	qp = ibv_create_qp_ex(id->verbs, attr);
 	if (!qp) {
-		ret = ERR(ENOMEM);
+		ret = -1;
 		goto err1;
 	}
 
Signature · 1 line
2.25.1
author
#1 lore raw

Hi Leon,

Thanks for your quick reply. :-)
I have done the same change on three functions(ucma_get_device,ucma_create_cqs, rdma_create_qp_ex).

Quoted 13 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

For every function, I am not sure which one is an exact commit so just attach all related commits ids.

Best Regards,
Xiao Yang

Quoted 36 lines
---
 librdmacm/cma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
librdmacm/cma.c +3 -3
index 8c820ccf..a2575156 100644
@@ -635,7 +635,7 @@ static int ucma_get_device(struct cma_id_private *id_priv, __be64 guid,
 	if (!cma_dev->pd)
 		cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
 	if (!cma_dev->pd) {
-		ret = ERR(ENOMEM);
+		ret = -1;
 		goto out;
 	}
 
@@ -1490,7 +1490,7 @@ static int ucma_create_cqs(struct rdma_cm_id *id, uint32_t send_size, uint32_t r
 	return 0;
 err:
 	ucma_destroy_cqs(id);
-	return ERR(ENOMEM);
+	return -1;
 }
 
 int rdma_create_srq_ex(struct rdma_cm_id *id, struct ibv_srq_init_attr_ex *attr)
@@ -1662,7 +1662,7 @@ int rdma_create_qp_ex(struct rdma_cm_id *id,
 		attr->srq = id->srq;
 	qp = ibv_create_qp_ex(id->verbs, attr);
 	if (!qp) {
-		ret = ERR(ENOMEM);
+		ret = -1;
 		goto err1;
 	}
 
#2 lore raw
Quoted 20 lines · Xiao Yang

Hi Leon,

Thanks for your quick reply. :-)
I have done the same change on three functions(ucma_get_device,ucma_create_cqs, rdma_create_qp_ex).

Quoted 13 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

Quoted 2 lines

For every function, I am not sure which one is an exact commit so just attach all related commits ids.

No problem, I'll try to sort it out now.

Thanks

author
#3 lore raw
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Xiao Yang

Hi Leon,

Thanks for your quick reply. :-)
I have done the same change on three functions(ucma_get_device,ucma_create_cqs, rdma_create_qp_ex).

Quoted 13 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

Quoted 3 lines
Quoted 2 lines

For every function, I am not sure which one is an exact commit so just attach all related commits ids.

No problem, I'll try to sort it out now.

Hi Leon,

Sorry to bother you.
Is there anything blocking the patch? :-)

Best Regards,
Xiao Yang

Quoted 5 lines

Thanks

.

#4 lore raw
Quoted 22 lines · Xiao Yang
Quoted 21 lines · Leon Romanovsky
Quoted 20 lines · Xiao Yang

Hi Leon,

Thanks for your quick reply. :-)
I have done the same change on three functions(ucma_get_device,ucma_create_cqs, rdma_create_qp_ex).

Quoted 13 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

For every function, I am not sure which one is an exact commit so just attach all related commits ids.

No problem, I'll try to sort it out now.

Hi Leon,

Sorry to bother you.
Is there anything blocking the patch? :-)

Nothing, we are in the middle of Christmas vacation here, so everything takes more time than usual.

Thanks

Quoted 11 lines

Best Regards,
Xiao Yang

Quoted 5 lines

Thanks

.

author
#5 lore raw

-----邮件原件-----
发件人: Leon Romanovsky <[email protected]>
发送时间: 2020年12月21日 19:43
收件人: Yang, Xiao/杨 晓 <[email protected]>
抄送: [email protected]
主题: Re: [PATCH v2] librdmacm: Make some functions report proper errno

Quoted 25 lines · Xiao Yang
Quoted 24 lines · Leon Romanovsky
Quoted 23 lines · Xiao Yang

Hi Leon,

Thanks for your quick reply. :-)
I have done the same change on three functions(ucma_get_device,ucma_create_cqs, rdma_create_qp_ex).

Quoted 16 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed")
191c9346f335 ("librdmacm: Reference count access to verbs context")
Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp") 9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)")
4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

For every function, I am not sure which one is an exact commit so just attach all related commits ids.

No problem, I'll try to sort it out now.

Hi Leon,

Sorry to bother you.
Is there anything blocking the patch? :-)

Nothing, we are in the middle of Christmas vacation here, so everything takes more time than usual.

Thanks

Hi Leon,

Got it. Thanks for your reply.

Best Regards,
Xiao Yang

Quoted 11 lines

Best Regards,
Xiao Yang

Quoted 5 lines

Thanks

.

#6 lore raw
In reply to Xiao Yang
Quoted 14 lines · Xiao Yang

Some functions reports fixed ENOMEM when getting any failure, so it's hard for user to know which actual error happens on them.

Fixes(ucma_get_device):
2ffda7f29913 ("librdmacm: Only allocate verbs resources when needed") 191c9346f335 ("librdmacm: Reference count access to verbs context") Fixes(ucma_create_cqs):
f8f1335ad8d8 ("librdmacm: make CQs optional for rdma_create_qp")
9e33488e8e50 ("librdmacm: fix all calls to set errno") Fixes(rdma_create_qp_ex):
d2efdede11f7 ("r4019: Add support for userspace RDMA connection management abstraction (CMA)") 4e33a4109a62 ("librdmacm: returns errors from the library consistently") 995eb0c90c1a ("rdmacm: Add support for XRC QPs")

Quoted 5 lines
---
 librdmacm/cma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Thanks, applied.
https://github.com/linux-rdma/rdma-core/pull/908