[openib-general] [PATCH] rdma cm: expose rdma_unbind to allow ULPs to release assigned port
Sean Hefty
sean.hefty at intel.com
Mon Apr 24 16:04:12 PDT 2006
Can you try this out? I only did some limited testing.
Expose port unbinding routine to allow ULPs to control when an assigned
port is released by the CMA. This is needed by SDP in order to provide
for graceful shutdown when SO_REUSEADDR has been set on the socket.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
Index: core/cma.c
===================================================================
--- core/cma.c (revision 6588)
+++ core/cma.c (working copy)
@@ -642,10 +642,13 @@ static void cma_cancel_operation(struct
}
}
-static void cma_release_port(struct rdma_id_private *id_priv)
+void rdma_unbind(struct rdma_cm_id *id)
{
- struct rdma_bind_list *bind_list = id_priv->bind_list;
+ struct rdma_id_private *id_priv;
+ struct rdma_bind_list *bind_list;
+ id_priv = container_of(id, struct rdma_id_private, id);
+ bind_list = id_priv->bind_list;
if (!bind_list)
return;
@@ -655,8 +658,10 @@ static void cma_release_port(struct rdma
idr_remove(bind_list->ps, bind_list->port);
kfree(bind_list);
}
+ id_priv->bind_list = NULL;
mutex_unlock(&lock);
}
+EXPORT_SYMBOL(rdma_unbind);
void rdma_destroy_id(struct rdma_cm_id *id)
{
@@ -681,7 +686,7 @@ void rdma_destroy_id(struct rdma_cm_id *
mutex_unlock(&lock);
}
- cma_release_port(id_priv);
+ rdma_unbind(id);
atomic_dec(&id_priv->refcount);
wait_event(id_priv->wait, !atomic_read(&id_priv->refcount));
Index: include/rdma/rdma_cm.h
===================================================================
--- include/rdma/rdma_cm.h (revision 6418)
+++ include/rdma/rdma_cm.h (working copy)
@@ -251,5 +251,13 @@ int rdma_reject(struct rdma_cm_id *id, c
*/
int rdma_disconnect(struct rdma_cm_id *id);
+/**
+ * rdma_unbind - Release any allocated port binding with the rdma_cm_id.
+ *
+ * This releases any port that is bound to the specified rdma_cm_id. The
+ * associated port becomes available for immediate re-use.
+ */
+void rdma_unbind(struct rdma_cm_id *id);
+
#endif /* RDMA_CM_H */
More information about the general
mailing list