On 10/25/23 21:02, Bernard Metzler wrote:
-----Original Message-----
From: Guoqing Jiang<guoqing.jiang@xxxxxxxxx>
Sent: Monday, October 9, 2023 9:18 AM
To: Bernard Metzler<BMT@xxxxxxxxxxxxxx>;jgg@xxxxxxxx;leon@xxxxxxxxxx
Cc:linux-rdma@xxxxxxxxxxxxxxx
Subject: [EXTERNAL] [PATCH 12/19] RDMA/siw: Introduce siw_free_cm_id
Factor out a helper to simplify code.
Signed-off-by: Guoqing Jiang<guoqing.jiang@xxxxxxxxx>
---
drivers/infiniband/sw/siw/siw_cm.c | 36 +++++++++++++-----------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_cm.c
b/drivers/infiniband/sw/siw/siw_cm.c
index 2f338bb3a24c..987084828786 100644
--- a/drivers/infiniband/sw/siw/siw_cm.c
+++ b/drivers/infiniband/sw/siw/siw_cm.c
@@ -364,6 +364,17 @@ static int siw_cm_upcall(struct siw_cep *cep, enum
iw_cm_event_type reason,
return id->event_handler(id, &event);
}
+void siw_free_cm_id(struct siw_cep *cep, bool put_cep)
+{
+ if (!cep->cm_id)
+ return;
+
+ cep->cm_id->rem_ref(cep->cm_id);
+ cep->cm_id = NULL;
I suggest not including cep_put() here, but to keep
cep reference counting explicit in the code.
+ if (put_cep)
+ siw_cep_put(cep);
+}
Ok, will remove it in next version.
Thanks,
Guoqing