[ofw] [PATCH 8/11] librdmacm: add rdma_get_request

Hefty, Sean sean.hefty at intel.com
Mon Aug 16 16:21:43 PDT 2010


Add a call for synchronous passive side operation that obtains
connection requests.  This is similar to the socket accept call.

From: Sean Hefty <sean.hefty at intel.com>
---
 trunk/ulp/librdmacm/include/rdma/rdma_cma.h |    3 ++
 trunk/ulp/librdmacm/src/cma.cpp             |   40 +++++++++++++++++++++++++++
 trunk/ulp/librdmacm/src/cma_exports.src     |    1 +
 3 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/trunk/ulp/librdmacm/include/rdma/rdma_cma.h b/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
index b4cda67..489fa66 100644
--- a/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
+++ b/trunk/ulp/librdmacm/include/rdma/rdma_cma.h
@@ -417,6 +417,9 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
 __declspec(dllexport)
 int rdma_listen(struct rdma_cm_id *id, int backlog);
 
+__declspec(dllexport)
+int rdma_get_request(struct rdma_cm_id *listen, struct rdma_cm_id **id);
+
 /**
  * rdma_accept - Called to accept a connection request.
  * @id: Connection identifier associated with the request.
diff --git a/trunk/ulp/librdmacm/src/cma.cpp b/trunk/ulp/librdmacm/src/cma.cpp
index 7240c4d..f897245 100644
--- a/trunk/ulp/librdmacm/src/cma.cpp
+++ b/trunk/ulp/librdmacm/src/cma.cpp
@@ -919,6 +919,46 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
 }
 
 __declspec(dllexport)
+int rdma_get_request(struct rdma_cm_id *listen, struct rdma_cm_id **id)
+{
+	struct cma_id_private *id_priv;
+	struct rdma_cm_event *event;
+	int ret;
+
+	id_priv = CONTAINING_RECORD(listen, struct cma_id_private, id);
+	if (!id_priv->sync) {
+		return rdma_seterrno(EINVAL);
+	}
+
+	if (listen->event) {
+		rdma_ack_cm_event(listen->event);
+		listen->event = NULL;
+	}
+
+	ret = rdma_get_cm_event(listen->channel, &event);
+	if (ret)
+		return ret;
+
+	if (event->status) {
+		ret = rdma_seterrno(event->status);
+		goto err;
+	}
+	
+	if (event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
+		ret = rdma_seterrno(EINVAL);
+		goto err;
+	}
+
+	*id = event->id;
+	(*id)->event = event;
+	return 0;
+
+err:
+	listen->event = event;
+	return ret;
+}
+
+__declspec(dllexport)
 int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
 {
 	struct cma_id_private *id_priv;
diff --git a/trunk/ulp/librdmacm/src/cma_exports.src b/trunk/ulp/librdmacm/src/cma_exports.src
index 8f370be..2d6b336 100644
--- a/trunk/ulp/librdmacm/src/cma_exports.src
+++ b/trunk/ulp/librdmacm/src/cma_exports.src
@@ -32,5 +32,6 @@ rdma_set_option
 rdma_migrate_id
 rdma_getaddrinfo
 rdma_freeaddrinfo
+rdma_get_request
 rdmaw_wsa_errno
 #endif




More information about the ofw mailing list