[ofa-general] [PATCH 2/4] uDAPL v2 - IB UD extension - dapl: add support for UD extensions in common code
Arlin Davis
arlin.r.davis at intel.com
Sun Jul 20 15:18:18 PDT 2008
allow EP create for extended service types.
extend connection event types to include UD AH resolution/exchange.
add new extended connect and connect request upcalls for providers.
- dapls_evd_post_cr_event_ext
- dapls_evd_post_connection_event_ext
Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
dapl/common/dapl_ep_create.c | 6 +-
dapl/common/dapl_evd_util.c | 169 ++++++++++++++++++++++++++++++++++++++++++
dapl/common/dapl_evd_util.h | 20 +++++
3 files changed, 193 insertions(+), 2 deletions(-)
diff --git a/dapl/common/dapl_ep_create.c b/dapl/common/dapl_ep_create.c
index 9e6bd9c..ff233b0 100644
--- a/dapl/common/dapl_ep_create.c
+++ b/dapl/common/dapl_ep_create.c
@@ -160,8 +160,10 @@ dapl_ep_create (
* max_*_dtos must 0 as the user will not be able to post dto ops on
* the respective queue.
*/
- if (ep_attr != NULL &&
- (ep_attr->service_type != DAT_SERVICE_TYPE_RC ||
+ if (ep_attr != NULL && (
+#ifndef DAT_EXTENSIONS
+ ep_attr->service_type != DAT_SERVICE_TYPE_RC ||
+#endif
(recv_evd_handle == DAT_HANDLE_NULL && ep_attr->max_recv_dtos != 0) ||
(recv_evd_handle != DAT_HANDLE_NULL && ep_attr->max_recv_dtos == 0) ||
(request_evd_handle == DAT_HANDLE_NULL && ep_attr->max_request_dtos != 0) ||
diff --git a/dapl/common/dapl_evd_util.c b/dapl/common/dapl_evd_util.c
index 63fee81..9270750 100644
--- a/dapl/common/dapl_evd_util.c
+++ b/dapl/common/dapl_evd_util.c
@@ -44,6 +44,9 @@
#include "dapl_adapter_util.h"
#include "dapl_cookie.h"
#include "dapl.h"
+#include "dapl_cr_util.h"
+#include "dapl_sp_util.h"
+#include "dapl_ep_util.h"
#include <sys/socket.h>
#include <netinet/in.h>
@@ -84,6 +87,8 @@ char *dapl_event_str( IN DAT_EVENT_NUMBER event_num )
#ifdef DAT_EXTENSIONS
{"DAT_EXTENSION_EVENT", DAT_EXTENSION_EVENT},
{"DAT_IB_EXTENSION_RANGE_BASE", DAT_IB_EXTENSION_RANGE_BASE},
+ {"DAT_IB_UD_CONNECTION_REQUEST_EVENT", DAT_IB_EXTENSION_RANGE_BASE+1},
+ {"DAT_IB_UD_CONNECTION_EVENT_ESTABLISHED", DAT_IB_EXTENSION_RANGE_BASE+2},
{"DAT_IW_EXTENSION_RANGE_BASE", DAT_IW_EXTENSION_RANGE_BASE},
#endif /* DAT_EXTENSIONS */
{NULL,0},
@@ -1048,6 +1053,170 @@ dapls_evd_post_generic_event (
return DAT_SUCCESS;
}
+#ifdef DAT_EXTENSIONS
+DAT_RETURN
+dapls_evd_post_cr_event_ext (
+ IN DAPL_SP *sp_ptr,
+ IN DAT_EVENT_NUMBER event_number,
+ IN dp_ib_cm_handle_t ib_cm_handle,
+ IN DAT_COUNT p_size,
+ IN DAT_PVOID p_data,
+ IN DAT_PVOID ext_data)
+{
+ DAPL_CR *cr_ptr;
+ DAPL_EP *ep_ptr;
+ DAT_EVENT *event_ptr;
+ DAT_SP_HANDLE sp_handle;
+
+ dapl_os_lock (&sp_ptr->header.lock);
+ if (sp_ptr->listening == DAT_FALSE) {
+ dapl_os_unlock (&sp_ptr->header.lock);
+ dapl_dbg_log(DAPL_DBG_TYPE_CM,
+ "---> post_cr_event_ext: conn event on down SP\n");
+ (void)dapls_ib_reject_connection(ib_cm_handle,
+ DAT_CONNECTION_EVENT_UNREACHABLE,
+ 0, NULL);
+ return DAT_CONN_QUAL_UNAVAILABLE;
+ }
+
+ /*
+ * RSP connections only allow a single connection. Close
+ * it down NOW so we reject any further connections.
+ */
+ if (sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP)
+ sp_ptr->listening = DAT_FALSE;
+
+ dapl_os_unlock (&sp_ptr->header.lock);
+
+ /* allocate new connect request */
+ cr_ptr = dapls_cr_alloc(sp_ptr->header.owner_ia);
+ if (cr_ptr == NULL)
+ return DAT_INSUFFICIENT_RESOURCES;
+
+ /* Set up the CR */
+ cr_ptr->sp_ptr = sp_ptr; /* maintain sp_ptr in case of reject */
+ cr_ptr->param.remote_port_qual = 0;
+ cr_ptr->ib_cm_handle = ib_cm_handle;
+ cr_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR)&cr_ptr->remote_ia_address;
+
+ /*
+ * Copy the remote address and private data out of the private_data
+ */
+ cr_ptr->param.private_data = cr_ptr->private_data;
+ cr_ptr->param.private_data_size = p_size;
+ if (p_size)
+ dapl_os_memcpy(cr_ptr->private_data, p_data, p_size);
+
+ /* EP will be NULL unless RSP service point */
+ ep_ptr = (DAPL_EP *)sp_ptr->ep_handle;
+
+ if (sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG)
+ {
+ DAPL_IA *ia_ptr;
+ /*
+ * Never true for RSP connections
+ *
+ * Create an EP for the user. If we can't allocate an
+ * EP we are out of resources and need to tell the
+ * requestor that we cant help them.
+ */
+ ia_ptr = sp_ptr->header.owner_ia;
+ ep_ptr = dapl_ep_alloc(ia_ptr, NULL);
+ if (ep_ptr == NULL) {
+ dapls_cr_free (cr_ptr);
+ /* Invoking function will call dapls_ib_cm_reject() */
+ return DAT_INSUFFICIENT_RESOURCES;
+ }
+ ep_ptr->param.ia_handle = ia_ptr;
+ ep_ptr->param.local_ia_address_ptr =
+ (DAT_IA_ADDRESS_PTR)&ia_ptr->hca_ptr->hca_address;
+
+ /* Link the EP onto the IA */
+ dapl_ia_link_ep(ia_ptr, ep_ptr);
+ }
+
+ cr_ptr->param.local_ep_handle = ep_ptr;
+
+ if (ep_ptr != NULL) {
+ /* Assign valid EP fields: RSP and PSP_PROVIDER_FLAG only */
+ if ( sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG ) {
+ ep_ptr->param.ep_state =
+ DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING;
+ } else {
+ /* RSP */
+ dapl_os_assert (sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP);
+ ep_ptr->param.ep_state =
+ DAT_EP_STATE_PASSIVE_CONNECTION_PENDING;
+ }
+ ep_ptr->cm_handle = ib_cm_handle;
+ }
+
+ /* link the CR onto the SP so we can pick it up later */
+ dapl_sp_link_cr(sp_ptr, cr_ptr);
+
+ /* assign sp_ptr to union to avoid typecast errors from some compilers */
+ sp_handle.psp_handle = (DAT_PSP_HANDLE)sp_ptr;
+
+ /* Post the event. */
+
+ /*
+ * Note event lock may be held on successful return
+ * to be released by dapli_evd_post_event(), if provider side locking
+ * is needed.
+ */
+ event_ptr = dapli_evd_get_and_init_event(sp_ptr->evd_handle,
+ event_number);
+ if (event_ptr == NULL)
+ return DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
+
+ event_ptr->event_data.cr_arrival_event_data.sp_handle = sp_handle;
+ event_ptr->event_data.cr_arrival_event_data.local_ia_address_ptr =
+ (DAT_IA_ADDRESS_PTR)&sp_ptr->header.owner_ia->hca_ptr->hca_address;
+ event_ptr->event_data.cr_arrival_event_data.conn_qual = sp_ptr->conn_qual;
+ event_ptr->event_data.cr_arrival_event_data.cr_handle = (DAT_HANDLE)cr_ptr;
+
+ dapl_os_memcpy(&event_ptr->event_extension_data[0], ext_data, 64);
+
+ dapli_evd_post_event(sp_ptr->evd_handle, event_ptr);
+
+ return DAT_SUCCESS;
+}
+
+
+DAT_RETURN
+dapls_evd_post_connection_event_ext (
+ IN DAPL_EVD *evd_ptr,
+ IN DAT_EVENT_NUMBER event_number,
+ IN DAT_EP_HANDLE ep_handle,
+ IN DAT_COUNT private_data_size,
+ IN DAT_PVOID private_data,
+ IN DAT_PVOID ext_data)
+{
+ DAT_EVENT *event_ptr;
+ event_ptr = dapli_evd_get_and_init_event (evd_ptr, event_number);
+ /*
+ * Note event lock may be held on successful return
+ * to be released by dapli_evd_post_event(), if provider side locking
+ * is needed.
+ */
+ if (event_ptr == NULL)
+ return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
+
+ event_ptr->event_data.connect_event_data.ep_handle = ep_handle;
+ event_ptr->event_data.connect_event_data.private_data_size
+ = private_data_size;
+ event_ptr->event_data.connect_event_data.private_data = private_data;
+
+ dapl_os_memcpy(&event_ptr->event_extension_data[0], ext_data, 64);
+
+ dapli_evd_post_event (evd_ptr, event_ptr);
+
+ return DAT_SUCCESS;
+}
+#endif
+
+
+
/*
* dapli_evd_cqe_to_event
*
diff --git a/dapl/common/dapl_evd_util.h b/dapl/common/dapl_evd_util.h
index 563bd67..2304435 100644
--- a/dapl/common/dapl_evd_util.h
+++ b/dapl/common/dapl_evd_util.h
@@ -109,6 +109,26 @@ dapls_evd_post_generic_event (
IN DAT_EVENT_NUMBER event_number,
IN DAT_EVENT_DATA *data);
+#ifdef DAT_EXTENSIONS
+DAT_RETURN
+dapls_evd_post_cr_event_ext (
+ IN DAPL_SP *sp_ptr,
+ IN DAT_EVENT_NUMBER event_number,
+ IN dp_ib_cm_handle_t ib_cm_handle,
+ IN DAT_COUNT p_size,
+ IN DAT_PVOID p_data,
+ IN DAT_PVOID ext_data);
+
+DAT_RETURN
+dapls_evd_post_connection_event_ext (
+ IN DAPL_EVD *evd_ptr,
+ IN DAT_EVENT_NUMBER event_number,
+ IN DAT_EP_HANDLE ep_handle,
+ IN DAT_COUNT private_data_size,
+ IN DAT_PVOID private_data,
+ IN DAT_PVOID ext_data);
+#endif
+
/*************************************
* dapl internal callbacks functions *
*************************************/
--
1.5.2.5
More information about the general
mailing list