Skip to contentSkip to conversation

librdmacm: Make rdma_create_qp_ex() report proper errno

PATCH Superseded Xiao Yang 2 participants 2 messages Dec 16, 2020 InfiniBand

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 librdmacm: Make rdma_create_qp_ex() report proper errno

Current rdma_create_qp_ex() reports fixed ENOMEM when calling ibv_create_qp_ex() fails, so it's hard for user to know which actual error happens on ibv_create_qp_ex().

---
 librdmacm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
librdmacm/cma.c +1 -1
index 8c820ccf..20ee1e00 100644
@@ -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
#1 lore raw
Quoted 8 lines · Xiao Yang

Current rdma_create_qp_ex() reports fixed ENOMEM when calling ibv_create_qp_ex() fails, so it's hard for user to know which actual error happens on ibv_create_qp_ex().

---
 librdmacm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

The same change should be done for the ibv_alloc_pd() call.

   635         if (!cma_dev->pd)
   636                 cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
   637         if (!cma_dev->pd) {
   638                 ret = ERR(ENOMEM);
   639                 goto out;
   640         }

And please add Fixes line.

Thanks