+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_adapter_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the adapter data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_ADAPTER_UTIL_H_\r
-#define _DAPL_ADAPTER_UTIL_H_\r
-\r
-#include <complib/cl_types.h>\r
-typedef enum async_handler_type\r
-{\r
- DAPL_ASYNC_UNAFILIATED,\r
- DAPL_ASYNC_CQ_ERROR,\r
- DAPL_ASYNC_CQ_COMPLETION,\r
- DAPL_ASYNC_QP_ERROR\r
-} DAPL_ASYNC_HANDLER_TYPE;\r
-\r
-\r
-DAT_RETURN dapls_ib_enum_hcas (\r
- OUT DAPL_HCA_NAME **hca_names,\r
- OUT DAT_COUNT *total_hca_count,\r
- IN const char *vendor );\r
-\r
-DAT_RETURN dapls_ib_open_hca (\r
- IN IB_HCA_NAME name,\r
- OUT ib_hca_handle_t *ib_hca_handle);\r
-\r
-DAT_RETURN dapls_ib_close_hca (\r
- IN ib_hca_handle_t ib_hca_handle);\r
-\r
-DAT_RETURN dapls_ib_qp_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAPL_EP *ep_ctx_ptr );\r
-\r
-DAT_RETURN dapls_ib_qp_free (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr );\r
-\r
-DAT_RETURN dapls_ib_qp_modify (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_EP_ATTR *ep_attr );\r
-DAT_RETURN dapls_ib_connect (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- IN DAT_CONN_QUAL remote_conn_qual,\r
- IN DAT_COUNT prd_size,\r
- IN DAPL_PRIVATE *prd_ptr );\r
-\r
-DAT_RETURN dapls_ib_disconnect (\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_CLOSE_FLAGS close_flags );\r
-\r
-DAT_RETURN dapls_ib_setup_conn_listener (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_UINT64 ServiceID,\r
- IN DAPL_SP *sp_ptr );\r
-\r
-DAT_RETURN dapls_ib_remove_conn_listener (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_ptr);\r
-\r
-DAT_RETURN dapls_ib_accept_connection (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT private_data_size,\r
- IN DAPL_PRIVATE *prd_ptr );\r
-\r
-DAT_RETURN dapls_ib_reject_connection (\r
- IN ib_cm_handle_t cm_handle,\r
- IN int reject_reason );\r
-\r
-DAT_RETURN dapls_ib_cr_handoff (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_CONN_QUAL cr_handoff );\r
-\r
-DAT_RETURN dapls_ib_setup_async_callback (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_ASYNC_HANDLER_TYPE handler_type,\r
- IN unsigned int * callback_handle,\r
- IN ib_async_handler_t callback,\r
- IN void *context );\r
-\r
-DAT_RETURN dapls_ib_cq_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_COUNT *cqlen);\r
-\r
-DAT_RETURN dapls_ib_cq_resize (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_COUNT *qlen );\r
-\r
-DAT_RETURN dapls_ib_cq_free (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr);\r
-\r
-DAT_RETURN dapls_set_cq_notify (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr);\r
-\r
-DAT_RETURN dapls_ib_cqd_create (\r
- IN DAPL_HCA *hca_ptr);\r
-\r
-DAT_RETURN dapls_ib_cqd_destroy (\r
- IN DAPL_HCA *hca_ptr);\r
-\r
-DAT_RETURN dapls_ib_pd_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_PZ *pz);\r
-\r
-DAT_RETURN dapls_ib_pd_free (\r
- IN DAPL_PZ *pz);\r
-\r
-DAT_RETURN dapls_ib_mr_register (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr,\r
- IN DAT_PVOID virt_addr,\r
- IN DAT_VLEN length,\r
- IN DAT_MEM_PRIV_FLAGS privileges);\r
-\r
-DAT_RETURN dapls_ib_mr_deregister (\r
- IN DAPL_LMR *lmr);\r
-\r
-DAT_RETURN dapls_ib_mr_register_shared (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr,\r
- IN DAT_MEM_PRIV_FLAGS privileges);\r
-\r
-DAT_RETURN dapls_ib_get_any_svid (\r
- IN DAPL_HCA *hca_ptr,\r
- OUT DAT_CONN_QUAL *p_svid);\r
-\r
-DAT_RETURN dapls_ib_mw_alloc (\r
- IN DAPL_RMR *rmr);\r
-\r
-DAT_RETURN dapls_ib_mw_free (\r
- IN DAPL_RMR *rmr);\r
-\r
-DAT_RETURN dapls_ib_mw_bind (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_LMR *lmr,\r
- IN DAPL_EP *ep,\r
- IN DAPL_COOKIE *cookie,\r
- IN DAT_VADDR virtual_address,\r
- IN DAT_VLEN length,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN ib_bool_t is_signaled);\r
-\r
-DAT_RETURN dapls_ib_mw_unbind (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_EP *ep,\r
- IN DAPL_COOKIE *cookie,\r
- IN ib_bool_t is_signaled);\r
-\r
-DAT_RETURN dapls_ib_query_hca (\r
- IN DAPL_HCA *hca_ptr,\r
- OUT DAT_IA_ATTR *ia_attr,\r
- OUT DAT_EP_ATTR *ep_attr,\r
- OUT DAT_SOCK_ADDR6 *ip_addr);\r
-\r
-DAT_RETURN dapls_ib_completion_poll (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN ib_work_completion_t *cqe_ptr);\r
-\r
-DAT_RETURN dapls_ib_completion_notify (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN ib_notification_type_t type);\r
-\r
-DAT_RETURN\r
-dapls_ib_n_completions_notify (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN uint32_t n_cqes);\r
-\r
-DAT_RETURN\r
-dapls_ib_peek_cq (\r
- IN ib_cq_handle_t cq_handle,\r
- OUT uint32_t* p_n_cqes);\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_create (\r
- IN cl_waitobj_handle_t *p_cq_wait_obj_handle);\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_destroy (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle);\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_wakeup (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle);\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_wait (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle,\r
- IN uint32_t timeout);\r
-\r
-DAT_DTO_COMPLETION_STATUS\r
-dapls_ib_get_dto_status(\r
- IN ib_work_completion_t *cqe_ptr);\r
-\r
-DAT_RETURN \r
-dapls_ib_reinit_ep (\r
- IN DAPL_EP *ep_ptr);\r
-\r
-void dapls_ib_disconnect_clean (\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_BOOLEAN passive,\r
- IN const ib_cm_events_t ib_cm_event);\r
-\r
-DAT_RETURN dapls_ib_get_async_event(\r
- IN ib_error_record_t *cause_ptr,\r
- OUT DAT_EVENT_NUMBER *async_event);\r
-\r
-DAT_COUNT dapls_ib_private_data_size (\r
- IN DAPL_PRIVATE *prd_ptr,\r
- IN DAPL_PDATA_OP conn_op);\r
-\r
-DAT_EVENT_NUMBER dapls_ib_get_dat_event (\r
- IN const ib_cm_events_t ib_cm_event,\r
- IN DAT_BOOLEAN active);\r
-\r
-ib_cm_events_t dapls_ib_get_cm_event (\r
- IN DAT_EVENT_NUMBER dat_event_num);\r
-\r
-DAT_RETURN dapls_ib_cm_remote_addr (\r
- IN DAT_HANDLE dat_handle,\r
- IN DAPL_PRIVATE *prd_ptr,\r
- OUT DAT_SOCK_ADDR6 *remote_ia_address );\r
-\r
-/*\r
- * Values for provider DAT_NAMED_ATTR\r
- */\r
-#define IB_QP_STATE 1 /* QP state change request */\r
-\r
-\r
-#ifndef NO_NAME_SERVICE\r
-\r
-DAT_RETURN dapls_ib_ns_create_gid_map (\r
- IN DAPL_HCA *hca_ptr);\r
-\r
-DAT_RETURN dapls_ib_ns_remove_gid_map (\r
- IN DAPL_HCA *hca_ptr);\r
-\r
-DAT_RETURN dapls_ib_ns_map_gid (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_IA_ADDRESS_PTR p_ia_address,\r
- OUT GID *p_gid);\r
-\r
-DAT_RETURN dapls_ib_ns_map_ipaddr (\r
- IN DAPL_HCA *hca_ptr,\r
- IN GID gid,\r
- OUT DAT_IA_ADDRESS_PTR p_ia_address);\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-#ifdef IBAPI\r
-#include "dapl_ibapi_dto.h"\r
-#elif VAPI\r
-#include "dapl_vapi_dto.h"\r
-#else\r
-#include "dapl_ibal_dto.h"\r
-#endif\r
-\r
-\r
-#endif /* _DAPL_ADAPTER_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cno_create.c\r
- *\r
- * PURPOSE: Consumer Notification Object creation\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.2.1\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_cno_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_cno_create\r
- *\r
- * DAPL Requirements Version xxx, 6.3.4.1\r
- *\r
- * Create a consumer notification object instance\r
- *\r
- * Input:\r
- * ia_handle\r
- * wait_agent\r
- * cno_handle\r
- *\r
- * Output:\r
- * cno_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN dapl_cno_create(\r
- IN DAT_IA_HANDLE ia_handle, /* ia_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT wait_agent, /* agent */\r
- OUT DAT_CNO_HANDLE *cno_handle) /* cno_handle */\r
-\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- cno_ptr = NULL;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (ia_handle, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
-\r
- cno_ptr = dapl_cno_alloc(ia_ptr, wait_agent);\r
-\r
- if (!cno_ptr)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;\r
-\r
- dapl_ia_link_cno(ia_ptr, cno_ptr);\r
-\r
- *cno_handle = cno_ptr;\r
-\r
- bail:\r
- if (dat_status != DAT_SUCCESS && cno_ptr != NULL)\r
- {\r
- dapl_cno_dealloc(cno_ptr);\r
- }\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cno_free.c\r
- *\r
- * PURPOSE: Consumer Notification Object destruction\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.2.2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_cno_util.h"\r
-\r
-/*\r
- * dapl_cno_free\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.2\r
- *\r
- * Destroy a consumer notification object instance\r
- *\r
- * Input:\r
- * cno_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN dapl_cno_free(\r
- IN DAT_CNO_HANDLE cno_handle) /* cno_handle */\r
-\r
-{\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- cno_ptr = (DAPL_CNO *)cno_handle;\r
-\r
- if (DAPL_BAD_HANDLE (cno_handle, DAPL_MAGIC_CNO))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CNO);\r
- goto bail;\r
- }\r
-\r
- if (cno_ptr->cno_ref_count != 0\r
- || cno_ptr->cno_waiters != 0)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_CNO_IN_USE);\r
- goto bail;\r
- }\r
-\r
- dapl_ia_unlink_cno (cno_ptr->header.owner_ia, cno_ptr);\r
- dapl_cno_dealloc (cno_ptr);\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cno_modify_agent.c\r
- *\r
- * PURPOSE: Modify the wait proxy agent associted with the CNO\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.2.4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_cno_modify_agent\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.4\r
- *\r
- * Modify the wait proxy agent associted with the CNO\r
- *\r
- * Input:\r
- * cno_handle\r
- * prx_agent\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN dapl_cno_modify_agent(\r
- IN DAT_CNO_HANDLE cno_handle, /* cno_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT prx_agent ) /* agent */\r
-\r
-{\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- if ( DAPL_BAD_HANDLE (cno_handle, DAPL_MAGIC_CNO) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CNO);\r
- goto bail;\r
- }\r
-\r
- cno_ptr = (DAPL_CNO *) cno_handle;\r
- dapl_os_lock(&cno_ptr->header.lock);\r
- cno_ptr->cno_wait_agent = prx_agent;\r
- dapl_os_unlock(&cno_ptr->header.lock);\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cno_query.c\r
- *\r
- * PURPOSE: Return the consumer parameters of the CNO\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.2.5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_cno_query\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.5\r
- *\r
- * Return the consumer parameters of the CNO\r
- *\r
- * Input:\r
- * cno_handle\r
- * cno_param_mask\r
- * cno_param\r
- *\r
- * Output:\r
- * cno_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN dapl_cno_query(\r
- IN DAT_CNO_HANDLE cno_handle, /* cno_handle */\r
- IN DAT_CNO_PARAM_MASK cno_param_mask, /* cno_param_mask */\r
- OUT DAT_CNO_PARAM *cno_param ) /* cno_param */\r
-\r
-\r
-{\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (cno_handle, DAPL_MAGIC_CNO) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CNO);\r
- goto bail;\r
- }\r
-\r
- if ( NULL == cno_param )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- cno_ptr = (DAPL_CNO *) cno_handle;\r
- if ( cno_param_mask )\r
- {\r
- cno_param->ia_handle = cno_ptr->header.owner_ia;\r
- cno_param->agent = cno_ptr->cno_wait_agent;\r
- }\r
- else\r
- {\r
- dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- }\r
- bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_cno_util.c\r
- *\r
- * PURPOSE: Manage CNO Info structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ia_util.h"\r
-#include "dapl_cno_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-\r
-\r
-/*\r
- * dapl_cno_alloc\r
- *\r
- * alloc and initialize an EVD struct\r
- *\r
- * Input:\r
- * ia\r
- *\r
- * Returns:\r
- * cno_ptr, or null on failure.\r
- */\r
-DAPL_CNO *\r
-dapl_cno_alloc(\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_OS_WAIT_PROXY_AGENT wait_agent)\r
-{\r
- DAPL_CNO *cno_ptr;\r
-\r
- cno_ptr = (DAPL_CNO *) dapl_os_alloc(sizeof (DAPL_CNO));\r
- if (!cno_ptr)\r
- {\r
- return NULL;\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero(cno_ptr, sizeof(DAPL_CNO));\r
-\r
- /*\r
- * Initialize the header.\r
- */\r
- cno_ptr->header.provider = ia_ptr->header.provider;\r
- cno_ptr->header.magic = DAPL_MAGIC_CNO;\r
- cno_ptr->header.handle_type = DAT_HANDLE_TYPE_CNO;\r
- cno_ptr->header.owner_ia = ia_ptr;\r
- cno_ptr->header.user_context.as_64 = 0;\r
- cno_ptr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&cno_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&cno_ptr->header.lock);\r
-\r
- /*\r
- * Initialize the body\r
- */\r
- cno_ptr->cno_waiters = 0;\r
- cno_ptr->cno_ref_count = 0;\r
- cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;\r
- cno_ptr->cno_evd_triggered = NULL;\r
- cno_ptr->cno_wait_agent = wait_agent;\r
- dapl_os_wait_object_init(&cno_ptr->cno_wait_object); \r
-\r
- return cno_ptr;\r
-}\r
-\r
-/*\r
- * dapl_cno_dealloc\r
- *\r
- * Free the passed in CNO structure.\r
- *\r
- * Input:\r
- * cno_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_cno_dealloc(\r
- IN DAPL_CNO *cno_ptr)\r
-{\r
- dapl_os_assert (cno_ptr->header.magic == DAPL_MAGIC_CNO);\r
- dapl_os_assert (cno_ptr->cno_ref_count == 0);\r
-\r
- /*\r
- * deinitialize the header\r
- */\r
- cno_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
-\r
- dapl_os_wait_object_destroy (&cno_ptr->cno_wait_object);\r
- dapl_os_free (cno_ptr, sizeof (DAPL_CNO));\r
-}\r
-\r
- \r
-/*\r
- * dapl_cno_trigger\r
- *\r
- * DAPL Internal routine to trigger the specified CNO.\r
- * Called by the callback of some EVD associated with the CNO.\r
- *\r
- * Input:\r
- * cno_ptr\r
- * evd_ptr EVD triggering\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * None\r
- */\r
-void\r
-dapl_cno_trigger(\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- dapl_os_assert (cno_ptr != NULL );\r
- dapl_os_assert(cno_ptr->header.magic == DAPL_MAGIC_CNO);\r
- dapl_os_assert(evd_ptr == NULL || evd_ptr->header.magic == DAPL_MAGIC_EVD);\r
-\r
- dapl_os_lock(&cno_ptr->header.lock);\r
-\r
- /* Maybe I should just return, but this really shouldn't happen. */\r
- dapl_os_assert(cno_ptr->cno_state != DAPL_CNO_STATE_DEAD);\r
-\r
- if (cno_ptr->cno_state == DAPL_CNO_STATE_UNTRIGGERED)\r
- {\r
- DAT_OS_WAIT_PROXY_AGENT agent;\r
-\r
- /* Squirrel away wait agent, and delete link. */\r
- agent = cno_ptr->cno_wait_agent;\r
-\r
- /* Separate assignments for windows compiler. */\r
- cno_ptr->cno_wait_agent.instance_data = NULL;\r
- cno_ptr->cno_wait_agent.proxy_agent_func = NULL;\r
- \r
- cno_ptr->cno_evd_triggered = evd_ptr;\r
-\r
- /*\r
- * Must set to triggerred and let waiter untrigger to handle\r
- * timeout of waiter.\r
- */\r
- cno_ptr->cno_state = DAPL_CNO_STATE_TRIGGERED;\r
- if (cno_ptr->cno_waiters > 0)\r
- {\r
- dapl_os_wait_object_wakeup(&cno_ptr->cno_wait_object);\r
- }\r
-\r
- dapl_os_unlock(&cno_ptr->header.lock);\r
-\r
- /* Trigger the OS proxy wait agent, if one exists. */\r
- if (agent.proxy_agent_func != (DAT_AGENT_FUNC) NULL)\r
- {\r
- agent.proxy_agent_func (\r
- agent.instance_data, (DAT_EVD_HANDLE) evd_ptr );\r
- }\r
- }\r
- else\r
- {\r
- dapl_os_unlock(&cno_ptr->header.lock);\r
- }\r
-\r
- return;\r
-}\r
- \r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_cno_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the cno data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_CNO_UTIL_H_\r
-#define _DAPL_CNO_UTIL_H_\r
-\r
-#include "dapl.h"\r
-\r
-DAPL_CNO *\r
-dapl_cno_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_OS_WAIT_PROXY_AGENT wait_agent) ;\r
-\r
-void\r
-dapl_cno_dealloc (\r
- IN DAPL_CNO *cno_ptr) ;\r
-\r
-void\r
-dapl_cno_trigger(\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAPL_EVD *evd_ptr);\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cno_wait.c\r
- *\r
- * PURPOSE: Wait for a consumer notification event\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.2.3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_cno_wait\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.3\r
- *\r
- * Wait for a consumer notification event\r
- *\r
- * Input:\r
- * cno_handle\r
- * timeout\r
- * evd_handle\r
- *\r
- * Output:\r
- * evd_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_QUEUE_EMPTY\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN dapl_cno_wait(\r
- IN DAT_CNO_HANDLE cno_handle, /* cno_handle */\r
- IN DAT_TIMEOUT timeout, /* agent */\r
- OUT DAT_EVD_HANDLE *evd_handle) /* ia_handle */\r
-\r
-{\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- if ( DAPL_BAD_HANDLE (cno_handle, DAPL_MAGIC_CNO) )\r
- {\r
- dat_status = DAT_INVALID_HANDLE | DAT_INVALID_HANDLE_CNO;\r
- goto bail;\r
- }\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- cno_ptr = (DAPL_CNO *) cno_handle;\r
-\r
- if ( cno_ptr->cno_state == DAPL_CNO_STATE_DEAD )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_CNO_DEAD);\r
- goto bail;\r
- }\r
-\r
- dapl_os_lock ( &cno_ptr->header.lock );\r
- while (cno_ptr->cno_state == DAPL_CNO_STATE_UNTRIGGERED\r
- && DAT_GET_TYPE(dat_status) != DAT_TIMEOUT_EXPIRED)\r
- {\r
- cno_ptr->cno_waiters++;\r
- dapl_os_unlock ( &cno_ptr->header.lock );\r
- dat_status = dapl_os_wait_object_wait (\r
- &cno_ptr->cno_wait_object, timeout );\r
- dapl_os_lock ( &cno_ptr->header.lock );\r
- cno_ptr->cno_waiters--;\r
- }\r
-\r
- if ( cno_ptr->cno_state == DAPL_CNO_STATE_DEAD )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_CNO_DEAD);\r
- }\r
- else if ( dat_status == DAT_SUCCESS )\r
- {\r
- /*\r
- * After the first triggering, this will be a valid handle.\r
- * If we're racing with wakeups of other CNO waiters,\r
- * that's ok.\r
- */\r
- dapl_os_assert ( cno_ptr->cno_state == DAPL_CNO_STATE_TRIGGERED ); \r
- cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;\r
- *evd_handle = cno_ptr->cno_evd_triggered;\r
- }\r
- else if ( dat_status == DAT_TIMEOUT_EXPIRED )\r
- {\r
- cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;\r
- *evd_handle = NULL;\r
- dat_status = DAT_QUEUE_EMPTY;\r
- }\r
- else\r
- {\r
- /*\r
- * The only other reason we could have made it out of\r
- * the loop is a timeout or an interrupted system call.\r
- */\r
- dapl_os_assert(DAT_GET_TYPE(dat_status) == DAT_TIMEOUT_EXPIRED ||\r
- DAT_GET_TYPE(dat_status) == DAT_INTERRUPTED_CALL);\r
- }\r
- dapl_os_unlock ( &cno_ptr->header.lock );\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cookie.c\r
- *\r
- * PURPOSE: Manage CQE cookie structures\r
- *\r
- * The DAPL spec requires that all a cookies passed to a posting operation \r
- * be returned in the operation's corresponding completion. \r
- * \r
- * Implementing this feature is complicated by the user's ability to \r
- * suppress event generation for specific operations. When these operations \r
- * complete successfully, the provider does not have an easy way to \r
- * deallocate resources devoted to storing context data for these operations.\r
- *\r
- * To support this feature, a pool of memory is allocated up front large \r
- * enough to hold cookie data for the maximum number of operations possible \r
- * on an endpoint. \r
- *\r
- * Two pieces of information are maintained to manage cookie allocation:\r
- *\r
- * head index : index of next unallocated cookie \r
- * tail index : index of last unallocated cookie\r
- *\r
- * Each cookie store its index in this memory pool.\r
- *\r
- * When an event is received, the index stored in the event's cookie will be \r
- * used to update the tail. This will implicitly deallocate all of the cookies \r
- * "between" the old tail and the new tail.\r
- *\r
- * The implementation relies on the following assumptions:\r
- *\r
- * - there can be only 1 thread in dat_ep_post_send(), dat_ep_post_rdma_write(),\r
- * dat_ep_post_rdma_read(), or dat_rmr_bind() at a time, therefore \r
- * dapls_cb_get() does not need to be thread safe when manipulating\r
- * request data structures.\r
- *\r
- * - there can be only 1 thread in dat_ep_post_recv(), therefore \r
- * dapls_cb_get() does not need to be thread safe when manipulating\r
- * receive data structures.\r
- *\r
- * - there can be only 1 thread generating completions for a given EP's request \r
- * opeartions, therefore dapls_cb_put() does not need to be thread safe when \r
- * manipulating request data structures.\r
- *\r
- * - there can be only 1 thread generating completions for a given EP's receive \r
- * opeartions therefore dapls_cb_put() does not need to be thread safe when \r
- * manipulating receive data structures.\r
- *\r
- * - completions are delivered in order\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_cookie.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_RETURN \r
-dapls_cb_get (\r
- DAPL_COOKIE_BUFFER *buffer,\r
- DAPL_COOKIE **cookie_ptr );\r
-\r
-DAT_RETURN \r
-dapls_cb_put (\r
- DAPL_COOKIE_BUFFER *buffer,\r
- DAPL_COOKIE *cookie );\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/*\r
- * dapls_cb_create\r
- *\r
- * Given a DAPL_COOKIE_BUFFER, allocate and initialize memory for\r
- * the data structure.\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- * ep endpoint to associate with cookies\r
- * size number of elements to allocate & manage\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_cb_create (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_EP *ep,\r
- IN DAT_COUNT size )\r
-{\r
- DAT_COUNT i;\r
-\r
- /*\r
- * allocate one additional entry so that the tail \r
- * can always point at an empty location\r
- */\r
- size++; \r
-\r
- buffer->pool = dapl_os_alloc (size * sizeof (DAPL_COOKIE));\r
- if ( NULL != buffer->pool )\r
- {\r
- buffer->pool_size = size;\r
- buffer->head = 0;\r
- buffer->tail = 0;\r
- dapl_os_lock_init (&buffer->lock);\r
-\r
- for ( i = 0; i < size; i++ )\r
- {\r
-#ifdef DAPL_DBG\r
- buffer->pool[i].type = DAPL_COOKIE_TYPE_NULL;\r
-#endif\r
- buffer->pool[i].index = i;\r
- buffer->pool[i].ep = ep;\r
- }\r
-\r
- return (DAT_SUCCESS);\r
- }\r
- else\r
- {\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-}\r
-\r
-\r
-/*\r
- * dapls_cb_free\r
- *\r
- * Free the data structure\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_cb_free (\r
- IN DAPL_COOKIE_BUFFER *buffer )\r
-{\r
- dapl_os_lock ( &buffer->lock );\r
- if ( NULL != buffer->pool )\r
- {\r
- dapl_os_free (buffer->pool, buffer->pool_size * sizeof (DAPL_COOKIE));\r
- }\r
- dapl_os_unlock ( &buffer->lock );\r
-}\r
-\r
-\r
-/*\r
- * dapls_cb_get\r
- *\r
- * Remove an entry from the buffer\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- *\r
- * Output:\r
- * cookie_ptr pointer to pointer to cookie\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN \r
-dapls_cb_get (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- OUT DAPL_COOKIE **cookie_ptr )\r
-{\r
- DAT_RETURN dat_status;\r
- DAT_COUNT new_head;\r
-\r
- dapl_os_assert(NULL != cookie_ptr);\r
- dapl_os_lock ( &buffer->lock );\r
-\r
- new_head = (buffer->head + 1) % buffer->pool_size;\r
-\r
- if ( new_head == buffer->tail )\r
- {\r
- dat_status = DAT_INSUFFICIENT_RESOURCES;\r
- goto bail;\r
- }\r
- else\r
- {\r
- buffer->head = new_head;\r
-\r
- *cookie_ptr = &buffer->pool[buffer->head];\r
-\r
-#ifdef DAPL_DBG\r
- if ( buffer->pool[buffer->head].type != DAPL_COOKIE_TYPE_NULL )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsCkGet: EP %p cookie %p at %d in use as 0x%x\n", \r
- buffer->pool[buffer->head].ep,\r
- &buffer->pool[buffer->head], buffer->head,\r
- buffer->pool[buffer->head].type ); \r
- }\r
-#endif\r
- dat_status = DAT_SUCCESS;\r
- }\r
-bail:\r
- dapl_os_unlock ( &buffer->lock );\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapls_cb_put\r
- *\r
- * Add entry(s) to the buffer\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- * cookie pointer to cookie\r
- *\r
- * Output:\r
- * entry entry removed from the ring buffer\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_EMPTY\r
- *\r
- */\r
-DAT_RETURN \r
-dapls_cb_put (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_COOKIE *cookie )\r
-{\r
- dapl_os_lock ( &buffer->lock );\r
-\r
-#ifdef DAPL_DBG\r
- cookie->type = DAPL_COOKIE_TYPE_NULL;\r
-#endif\r
- buffer->tail = cookie->index;\r
-\r
- dapl_os_unlock ( &buffer->lock );\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_rmr_cookie_alloc\r
- *\r
- * Allocate an RMR Bind cookie\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- * rmr rmr to associate with the cookie\r
- * user_cookie user's cookie data \r
- *\r
- * Output:\r
- * cookie_ptr pointer to pointer to allocated cookie\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_EMPTY\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_rmr_cookie_alloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_RMR *rmr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- OUT DAPL_COOKIE **cookie_ptr )\r
-{\r
- DAPL_COOKIE *cookie;\r
- DAT_RETURN dat_status;\r
-\r
- if ( DAT_SUCCESS != dapls_cb_get (buffer, &cookie) )\r
- {\r
- *cookie_ptr = NULL;\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- \r
- dat_status = DAT_SUCCESS;\r
- cookie->type = DAPL_COOKIE_TYPE_RMR;\r
- cookie->val.rmr.rmr = rmr;\r
- cookie->val.rmr.cookie = user_cookie;\r
-\r
- *cookie_ptr = cookie;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapls_dto_cookie_alloc\r
- *\r
- * Allocate a DTO cookie\r
- *\r
- * Input:\r
- * buffer pointer to DAPL_COOKIE_BUFFER\r
- * type DTO type\r
- * user_cookie user's cookie data \r
- *\r
- * Output:\r
- * cookie_ptr pointer to pointer to allocated cookie\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_EMPTY\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_dto_cookie_alloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_DTO_TYPE type,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- OUT DAPL_COOKIE **cookie_ptr )\r
-{\r
- DAPL_COOKIE *cookie;\r
-\r
- if ( DAT_SUCCESS != dapls_cb_get (buffer, &cookie) )\r
- {\r
- *cookie_ptr = NULL;\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- \r
- cookie->type = DAPL_COOKIE_TYPE_DTO;\r
- cookie->val.dto.type = type;\r
- cookie->val.dto.cookie = user_cookie;\r
- cookie->val.dto.size = 0;\r
-/*\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsCkAlloc: %p, ck(%p,%llx,%llx) u_ck(%p,%llx,%llx)\n", \r
- cookie, \r
- cookie->val.dto.cookie.as_ptr,\r
- cookie->val.dto.cookie.as_64,\r
- cookie->val.dto.cookie.as_index, \r
- user_cookie.as_ptr, user_cookie.as_64, user_cookie.as_index );\r
-*/ \r
-\r
- *cookie_ptr = cookie;\r
- return DAT_SUCCESS;\r
-}\r
-\r
-void\r
-dapls_cookie_dealloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_COOKIE *cookie)\r
-{\r
- dapls_cb_put (buffer, cookie);\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_cookie.h\r
- *\r
- * PURPOSE: Utility defs & routines for the cookie data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_COOKIE_H\r
-#define _DAPL_COOKIE_H_\r
-\r
-#include "dapl.h"\r
-\r
-extern DAT_RETURN \r
-dapls_cb_create (\r
- DAPL_COOKIE_BUFFER *buffer,\r
- DAPL_EP *ep,\r
- DAT_COUNT size );\r
-\r
-extern void \r
-dapls_cb_free (\r
- DAPL_COOKIE_BUFFER *buffer );\r
-\r
-extern DAT_RETURN\r
-dapls_rmr_cookie_alloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_RMR *rmr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- OUT DAPL_COOKIE **cookie_ptr );\r
-\r
-extern DAT_RETURN\r
-dapls_dto_cookie_alloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_DTO_TYPE type,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- OUT DAPL_COOKIE **cookie_ptr );\r
-\r
-extern void\r
-dapls_cookie_dealloc (\r
- IN DAPL_COOKIE_BUFFER *buffer,\r
- IN DAPL_COOKIE *cookie );\r
-\r
-#endif /* _DAPL_COOKIE_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cr_accept.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_cr_util.h"\r
-/*\r
- * dapl_cr_accept\r
- *\r
- * DAPL Requirements Version xxx, 6.4.2.1\r
- *\r
- * Establish a connection between active remote side requesting Endpoint\r
- * and passic side local Endpoint.\r
- *\r
- * Input:\r
- * cr_handle\r
- * ep_handle\r
- * private_data_size\r
- * private_data\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_ATTRIBUTE\r
- */\r
-DAT_RETURN\r
-dapl_cr_accept (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT private_data_size,\r
- IN const DAT_PVOID private_data )\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAT_RETURN dat_status;\r
- DAPL_PRIVATE prd;\r
- DAPL_CR *cr_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAT_UINT32 ib_rep_pdata_size;\r
- DAT_EP_STATE entry_ep_state;\r
- DAT_EP_HANDLE entry_ep_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_cr_accept (%p, %p, %d, %p)\n",\r
- cr_handle, \r
- ep_handle, \r
- private_data_size, \r
- private_data);\r
-\r
- if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
- goto bail;\r
- }\r
-\r
- cr_ptr = (DAPL_CR *) cr_handle;\r
- \r
- /*\r
- * Return an error if we have an ep_handle and the CR already has an\r
- * EP, indicating this is an RSP connection or PSP_PROVIDER_FLAG was\r
- * specified.\r
- */\r
- if ( ep_handle != NULL &&\r
- ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) ||\r
- cr_ptr->param.local_ep_handle != NULL ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
- \r
- /* Make sure we have an EP handle in one place or another */\r
- if ( ep_handle == NULL && cr_ptr->param.local_ep_handle == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
- \r
- if ( (0 != private_data_size) && (NULL == private_data) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Verify the private data size doesn't exceed the max\r
- */\r
- ib_rep_pdata_size = private_data_size + \r
- (sizeof(DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);\r
-\r
- if (ib_rep_pdata_size > IB_MAX_REP_PDATA_SIZE) \r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * ep_handle is NULL if the user specified DAT_PSP_PROVIDER_FLAG\r
- * OR this is an RSP connection; retrieve it from the cr.\r
- */\r
- if ( ep_handle == NULL )\r
- {\r
- ep_handle = cr_ptr->param.local_ep_handle;\r
- if ( (((DAPL_EP *) ep_handle)->param.ep_state != \r
- DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING) &&\r
- (((DAPL_EP *)ep_handle)->param.ep_state != \r
- DAT_EP_STATE_PASSIVE_CONNECTION_PENDING) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_EP_NOTREADY);\r
- goto bail;\r
- }\r
- } else\r
- {\r
- /* ensure this EP isn't connected or in use*/\r
- if ( ((DAPL_EP *) ep_handle)->param.ep_state != \r
- DAT_EP_STATE_UNCONNECTED )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_EP_NOTREADY);\r
- goto bail;\r
- }\r
- }\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Verify the attributes of the EP handle before we connect it. Test\r
- * all of the handles to make sure they are currently valid.\r
- * Specifically:\r
- * pz_handle required\r
- * recv_evd_handle optional, but must be valid\r
- * request_evd_handle optional, but must be valid\r
- * connect_evd_handle required\r
- * We do all verification and state change under lock, at which\r
- * point the EP state should protect us from most races.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- if ( ep_ptr->param.pz_handle == NULL\r
- || DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ)\r
- /* test connect handle */\r
- || ep_ptr->param.connect_evd_handle == NULL\r
- || DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD)\r
- || ! (((DAPL_EVD *)ep_ptr->param.connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)\r
- /* test optional completion handles */\r
- || (ep_ptr->param.recv_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (ep_ptr->param.recv_evd_handle, DAPL_MAGIC_EVD)))\r
- || (ep_ptr->param.request_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (ep_ptr->param.request_evd_handle, DAPL_MAGIC_EVD))))\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
- {\r
- /*\r
- * If we are lazy attaching the QP then we may need to\r
- * hook it up here. Typically, we run this code only for\r
- * DAT_PSP_PROVIDER_FLAG\r
- */\r
- dat_status = dapls_ib_qp_alloc ( cr_ptr->header.owner_ia, ep_ptr, ep_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- /* This is not a great error code, but all the spec allows */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
- }\r
- else\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,"<<< CR ACCEPT:EP:%p qp_state:%#x\n", ep_ptr,ep_ptr->qp_state );\r
- if (ep_ptr->qp_state == IB_QPS_RESET ||\r
- ep_ptr->qp_state == IB_QPS_ERROR )\r
- {\r
- if (ep_ptr->qp_handle != IB_INVALID_HANDLE )\r
- {\r
- dat_status = dapls_ib_reinit_ep (ep_ptr);\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
- }\r
- }\r
- }\r
- entry_ep_state = ep_ptr->param.ep_state;\r
- entry_ep_handle = cr_ptr->param.local_ep_handle;\r
- ep_ptr->param.ep_state = DAT_EP_STATE_COMPLETION_PENDING;\r
- ep_ptr->cm_handle = cr_ptr->ib_cm_handle;\r
- ep_ptr->cr_ptr = cr_ptr;\r
- ep_ptr->param.remote_ia_address_ptr = cr_ptr->param.remote_ia_address_ptr;\r
- cr_ptr->param.local_ep_handle = ep_handle;\r
-\r
- /*\r
- * Deal with private data: we need to put the size in the header\r
- * before sending. Given that this is a reply, we don't need to\r
- * put the IP address in the header.\r
- */\r
- dapl_os_memcpy(prd.private_data, private_data, private_data_size);\r
- dapl_os_memzero (prd.private_data + private_data_size,\r
- DAPL_MAX_PRIVATE_DATA_SIZE - private_data_size);\r
-\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- dat_status = dapls_ib_accept_connection ( cr_handle,\r
- ep_handle,\r
- private_data_size,\r
- &prd );\r
-\r
- /*\r
- * If the provider failed, unwind the damage so we are back at\r
- * the initial state.\r
- */\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- if ( DAT_GET_TYPE(dat_status) == DAT_INVALID_STATE )\r
- {\r
- /* The remote connection request has disappeared; timeout,\r
- * system error, app termination, perhaps other reasons.\r
- */\r
- \r
- /* Take the CR off the list, we can't use it */\r
- sp_ptr = cr_ptr->sp_ptr;\r
-\r
- cr_ptr->header.magic = DAPL_MAGIC_CR_DESTROYED;\r
- \r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
- \r
- dapls_cr_free (cr_ptr);\r
- \r
- ep_ptr->cr_ptr = NULL;\r
- ep_ptr->param.ep_state = entry_ep_state;\r
- ep_ptr->param.remote_ia_address_ptr = NULL;\r
- dapls_ib_qp_free (ep_ptr->header.owner_ia, ep_ptr);\r
- dat_status = dapls_ib_reinit_ep (ep_ptr ); /* it will reallocate QP for EP */\r
- \r
- /* notify User */\r
- dat_status = dapls_evd_post_connection_event (\r
- ep_ptr->param.request_evd_handle,\r
- DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- 0 );\r
- } \r
- else\r
- {\r
- ep_ptr->param.ep_state = entry_ep_state;\r
- cr_ptr->param.local_ep_handle = entry_ep_handle;\r
- ep_ptr->cr_ptr = NULL;\r
- ep_ptr->param.remote_ia_address_ptr = NULL;\r
- }\r
-\r
- /*\r
- * After restoring values above, we now check if we need\r
- * to translate the error\r
- */\r
- if ( DAT_GET_TYPE(dat_status) == DAT_LENGTH_ERROR )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- }\r
-\r
- }\r
- else\r
- {\r
- /* Make this CR invalid. We need to hang on to it until\r
- * the connection terminates, but it's destroyed from\r
- * the app point of view.\r
- */\r
- cr_ptr->header.magic = DAPL_MAGIC_CR_DESTROYED;\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapls_cr_callback.c\r
- *\r
- * PURPOSE: implements passive side connection callbacks\r
- *\r
- * Description: Accepts asynchronous callbacks from the Communications Manager\r
- * for EVDs that have been specified as the connection_evd.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-\r
-/*\r
- * Prototypes\r
- */\r
-DAT_RETURN dapli_connection_request (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_PRIVATE *prd_ptr,\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_IA_ADDRESS_PTR p_remote_ia_addr);\r
-\r
-DAPL_EP * dapli_get_sp_ep ( \r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN DAPL_SP *sp_ptr,\r
- IN DAT_EVENT_NUMBER dat_event_num);\r
-\r
-\r
-/*\r
- * dapls_cr_callback\r
- *\r
- * The callback function registered with verbs for passive side of\r
- * connection requests. The interface is specified by cm_api.h\r
- *\r
- *\r
- * Input:\r
- * ib_cm_handle, Handle to CM\r
- * ib_cm_event Specific CM event\r
- * instant_data Private data with DAT ADDRESS header\r
- * context SP pointer\r
- *\r
- * Output:\r
- * None\r
- *\r
- */\r
-void \r
-dapls_cr_callback (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN const ib_cm_events_t ib_cm_event,\r
- IN const void *private_data_ptr, /* event data */\r
- IN const void *context,\r
- IN DAT_IA_ADDRESS_PTR p_remote_ia_addr)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAPL_PRIVATE *prd_ptr;\r
- DAT_EVENT_NUMBER dat_event_num;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "--> dapl_cr_callback! context: %p event: %x cm_handle %d\n",\r
- context,\r
- ib_cm_event,\r
- ib_cm_handle.cid );\r
-\r
- /*\r
- * Passive side of the connection, context is a SP and\r
- * we need to look up the EP.\r
- */\r
- sp_ptr = (DAPL_SP *) context;\r
- /*\r
- * The context pointer could have been cleaned up in a racing\r
- * CM callback, check to see if we should just exit here\r
- */\r
- if (sp_ptr->header.magic == DAPL_MAGIC_INVALID)\r
- {\r
- return;\r
- }\r
- dapl_os_assert ( sp_ptr->header.magic == DAPL_MAGIC_PSP ||\r
- sp_ptr->header.magic == DAPL_MAGIC_RSP );\r
-\r
- /* Obtain the event number from the provider layer */\r
- dat_event_num = dapls_ib_get_dat_event (ib_cm_event, DAT_FALSE);\r
-\r
- /*\r
- * CONNECT_REQUEST events create an event on the PSP\r
- * EVD, which will trigger connection processing. The\r
- * sequence is:\r
- * CONNECT_REQUEST Event to SP\r
- * CONNECTED Event to EP\r
- * DISCONNECT Event to EP\r
- *\r
- * Obtain the EP if required and set an event up on the correct\r
- * EVD.\r
- */\r
- if (dat_event_num == DAT_CONNECTION_REQUEST_EVENT)\r
- {\r
- ep_ptr = NULL;\r
- evd_ptr = sp_ptr->evd_handle;\r
- }\r
- else\r
- {\r
- /* see if there is an EP connected with this CM handle */\r
- ep_ptr = dapli_get_sp_ep ( ib_cm_handle,\r
- sp_ptr,\r
- dat_event_num );\r
-\r
- /* if we lost a race with the CM just exit. */\r
- if (ep_ptr == NULL)\r
- {\r
- return;\r
- }\r
- evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
- /* if something has happened to our EVD, bail. */\r
- if (evd_ptr == NULL)\r
- {\r
- return;\r
- }\r
- }\r
-\r
- prd_ptr = (DAPL_PRIVATE *)private_data_ptr;\r
-\r
- dat_status = DAT_INTERNAL_ERROR; /* init to ERR */\r
-\r
- switch (dat_event_num)\r
- {\r
- case DAT_CONNECTION_REQUEST_EVENT:\r
- {\r
- /*\r
- * Requests arriving on a disabled SP are immediatly rejected\r
- */\r
-\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- if ( sp_ptr->listening == DAT_FALSE )\r
- {\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- "---> dapls_cr_callback: conn event on down SP\n");\r
- (void)dapls_ib_reject_connection (ib_cm_handle,\r
- DAT_CONNECTION_EVENT_UNREACHABLE );\r
-\r
- return;\r
- }\r
-\r
- if ( sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP )\r
- {\r
- /*\r
- * RSP connections only allow a single connection. Close\r
- * it down NOW so we reject any further connections.\r
- */\r
- sp_ptr->listening = DAT_FALSE;\r
- }\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- /*\r
- * Only occurs on the passive side of a connection\r
- * dapli_connection_request will post the connection\r
- * event if appropriate.\r
- */\r
- dat_status = dapli_connection_request ( ib_cm_handle,\r
- sp_ptr,\r
- prd_ptr,\r
- evd_ptr,\r
- p_remote_ia_addr );\r
- /* Set evd_ptr = NULL so we don't generate an event below */\r
- evd_ptr = NULL;\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_ESTABLISHED:\r
- {\r
- /* This is just a notification the connection is now\r
- * established, there isn't any private data to deal with.\r
- *\r
- * Update the EP state and cache a copy of the cm handle,\r
- * then let the user know we are ready to go.\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- "--> dapls_cr_callback: CONN_EVENT_ESTABLISHED EP: %p ep_state: %x\n",ep_ptr,\r
- ep_ptr->param.ep_state);\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- if (ep_ptr->header.magic != DAPL_MAGIC_EP ||\r
- ep_ptr->param.ep_state != DAT_EP_STATE_COMPLETION_PENDING)\r
- {\r
- /* If someone pulled the plug on the EP or connection,\r
- * just exit\r
- */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_SUCCESS;\r
- break;\r
- }\r
-\r
-\r
- ep_ptr->param.ep_state = DAT_EP_STATE_CONNECTED;\r
- ep_ptr->cm_handle = ib_cm_handle;\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_DISCONNECTED:\r
- {\r
- /*\r
- * EP is now fully disconnected; initiate any post processing\r
- * to reset the underlying QP and get the EP ready for\r
- * another connection\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- "--> dapls_cr_callback: EVENT_DISCONNECTED EP: %p ep_state: %x\n",ep_ptr,\r
- ep_ptr->param.ep_state);\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- if (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED)\r
- {\r
- /* The disconnect has already occurred, we are now\r
- * cleaned up and ready to exit\r
- */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- return;\r
- }\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
- dapl_sp_remove_ep (ep_ptr);\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:\r
- case DAT_CONNECTION_EVENT_PEER_REJECTED:\r
- case DAT_CONNECTION_EVENT_UNREACHABLE:\r
- {\r
- /*\r
- * After posting an accept the requesting node has\r
- * stopped talking.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- cl_memclr( &ep_ptr->cm_handle, sizeof(ib_cm_handle_t) );\r
- ep_ptr->cm_handle.cid = 0xFFFFFFFF;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_BROKEN:\r
- {\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- break;\r
- }\r
- default:\r
- {\r
- evd_ptr = NULL;\r
- dapl_os_assert (0); /* shouldn't happen */\r
- break;\r
- }\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM," dapl_cr_callback: POST EVENT %d EP: %p EVD: %p \n",dat_event_num, ep_ptr, evd_ptr);\r
- if (evd_ptr != NULL )\r
- {\r
- dat_status = dapls_evd_post_connection_event (\r
- evd_ptr,\r
- dat_event_num,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- NULL);\r
- }\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- /* The event post failed; take appropriate action. */\r
- (void)dapls_ib_reject_connection ( ib_cm_handle,\r
- DAT_CONNECTION_EVENT_BROKEN);\r
-\r
- return;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * dapli_connection_request\r
- *\r
- * Process a connection request on the Passive side of a connection.\r
- * Create a CR record and link it on to the SP so we can update it\r
- * and free it later. Create an EP if specified by the PSP flags.\r
- *\r
- * Input:\r
- * ib_cm_handle,\r
- * sp_ptr\r
- * event_ptr\r
- * prd_ptr\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_SUCCESS\r
- *\r
- */\r
-DAT_RETURN\r
-dapli_connection_request (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_PRIVATE *prd_ptr,\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_IA_ADDRESS_PTR p_remote_ia_addr)\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- DAPL_CR *cr_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAPL_IA *ia_ptr;\r
- DAT_SP_HANDLE sp_handle;\r
-\r
- cr_ptr = dapls_cr_alloc (sp_ptr->header.owner_ia);\r
- if ( cr_ptr == NULL )\r
- {\r
- /* Invoking function will call dapls_ib_cm_reject() */\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- /*\r
- * Set up the CR\r
- */\r
- cr_ptr->sp_ptr = sp_ptr; /* maintain sp_ptr in case of reject */\r
- cr_ptr->param.remote_port_qual = 0;\r
- cr_ptr->ib_cm_handle = ib_cm_handle;\r
-\r
- /*\r
- * Copy the remote address and private data out of the private_data\r
- * payload and put them in a local structure\r
- */\r
- if (p_remote_ia_addr != NULL)\r
- {\r
- dapl_os_memcpy ((void *)&cr_ptr->remote_ia_address,\r
- (void *)p_remote_ia_addr,\r
- sizeof (DAT_SOCK_ADDR6));\r
- }\r
- cr_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR)&cr_ptr->remote_ia_address;\r
-\r
- /* \r
- * Private data size is always the max allowable by IB\r
- */\r
- cr_ptr->param.private_data_size = IB_MAX_REQ_PDATA_SIZE;\r
- cr_ptr->param.private_data = cr_ptr->private_data;\r
- dapl_os_memcpy (cr_ptr->private_data, \r
-#ifdef NO_NAME_SERVICE\r
- prd_ptr->private_data,\r
-#else\r
- (void *) prd_ptr,\r
-#endif\r
- IB_MAX_REQ_PDATA_SIZE);\r
-\r
-#ifdef DAPL_DBG\r
-#if 0\r
- {\r
- int i;\r
- \r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "--> private_data: ");\r
-\r
- for ( i = 0 ; i < IB_MAX_REQ_PDATA_SIZE ; i++ )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, \r
- "0x%x ", cr_ptr->private_data[i]);\r
- \r
- }\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "\n");\r
- \r
- }\r
-#endif\r
-#endif\r
-\r
- /* EP will be NULL unless RSP service point */\r
- ep_ptr = (DAPL_EP *) sp_ptr->ep_handle;\r
-\r
- if ( sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
- {\r
- /*\r
- * Never true for RSP connections\r
- *\r
- * Create an EP for the user. If we can't allocate an\r
- * EP we are out of resources and need to tell the\r
- * requestor that we cant help them.\r
- */\r
- ia_ptr = sp_ptr->header.owner_ia;\r
- ep_ptr = dapl_ep_alloc (ia_ptr, NULL);\r
- if ( ep_ptr == NULL )\r
- {\r
- dapls_cr_free (cr_ptr);\r
- /* Invoking function will call dapls_ib_cm_reject() */\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
- /* \r
- * Link the EP onto the IA \r
- */\r
- dapl_ia_link_ep (ia_ptr, ep_ptr);\r
- }\r
-\r
- cr_ptr->param.local_ep_handle = ep_ptr;\r
-\r
- if ( ep_ptr != NULL )\r
- {\r
- /* Assign valid EP fields: RSP and PSP_PROVIDER_FLAG only */\r
- if ( sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
- {\r
- ep_ptr->param.ep_state = \r
- DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING;\r
- }\r
- else\r
- /* RSP */\r
- {\r
- dapl_os_assert (sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP);\r
- ep_ptr->param.ep_state = \r
- DAT_EP_STATE_PASSIVE_CONNECTION_PENDING;\r
- }\r
- ep_ptr->cm_handle = ib_cm_handle;\r
- ep_ptr->cr_ptr = cr_ptr;\r
- }\r
- \r
- /* link the CR onto the SP so we can pick it up later */\r
- dapl_sp_link_cr (sp_ptr, cr_ptr);\r
-\r
- /* Post the event. */\r
- /* assign sp_ptr to union to avoid typecast errors from some compilers */\r
- sp_handle.psp_handle = (DAT_PSP_HANDLE)sp_ptr;\r
- dat_status = dapls_evd_post_cr_arrival_event (\r
- evd_ptr,\r
- DAT_CONNECTION_REQUEST_EVENT,\r
- sp_handle,\r
- (DAT_IA_ADDRESS_PTR)&sp_ptr->header.owner_ia->hca_ptr->hca_address,\r
- sp_ptr->conn_qual,\r
- (DAT_CR_HANDLE)cr_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- if ( ep_ptr != NULL )\r
- {\r
- ep_ptr->cr_ptr = NULL;\r
- }\r
- dapls_cr_free (cr_ptr);\r
- (void)dapls_ib_reject_connection (ib_cm_handle,\r
- DAT_CONNECTION_EVENT_BROKEN);\r
-\r
- /* Take the CR off the list, we can't use it */\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapli_get_sp_ep\r
- *\r
- * Passive side of a connection is now fully established. Clean\r
- * up resources and obtain the EP pointer associated with a CR in\r
- * the SP\r
- *\r
- * Input:\r
- * ib_cm_handle,\r
- * sp_ptr\r
- * connection_event\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns\r
- * ep_ptr\r
- *\r
- */\r
-DAPL_EP *\r
-dapli_get_sp_ep (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN DAPL_SP *sp_ptr,\r
- IN DAT_EVENT_NUMBER dat_event_num)\r
-{\r
- DAPL_CR *cr_ptr;\r
- DAPL_EP *ep_ptr;\r
-\r
- /*\r
- * acquire the lock, we may be racing with other threads here\r
- */\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- /* Verify under lock that the SP is still valid */\r
- if (sp_ptr->header.magic == DAPL_MAGIC_INVALID)\r
- {\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- return NULL;\r
- }\r
- /*\r
- * There are potentially multiple connections in progress. Need to\r
- * go through the list and find the one we are interested\r
- * in. There is no guarantee of order. dapl_sp_search_cr\r
- * leaves the CR on the SP queue.\r
- */\r
- cr_ptr = dapl_sp_search_cr (sp_ptr, ib_cm_handle);\r
- if ( cr_ptr == NULL )\r
- {\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- return NULL;\r
- }\r
-\r
- ep_ptr = (DAPL_EP *)cr_ptr->param.local_ep_handle;\r
-\r
-\r
- /* Quick check to ensure our EP is still valid */\r
- if ( (DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP )) )\r
- {\r
- ep_ptr = NULL;\r
- }\r
-\r
- /* The CR record is discarded in all except for the CONNECTED case,\r
- * as it will have no further relevance.\r
- */\r
- if (dat_event_num != DAT_CONNECTION_EVENT_ESTABLISHED)\r
- {\r
- /* Remove the CR from the queue */\r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
- /*\r
- * Last event, time to clean up and dispose of the resource\r
- */\r
- if (ep_ptr != NULL)\r
- {\r
- ep_ptr->cr_ptr = NULL;\r
- }\r
-\r
- /*\r
- * If this SP has been removed from service, free it\r
- * up after the last CR is removed\r
- */\r
- if ( sp_ptr->listening != DAT_TRUE && sp_ptr->cr_list_count == 0 &&\r
- sp_ptr->state != DAPL_SP_STATE_FREE )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- "--> dapli_get_sp_ep! disconnect dump sp: %p \n", sp_ptr);\r
- /* Decrement the ref count on the EVD */\r
- if (sp_ptr->evd_handle)\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- }\r
- sp_ptr->state = DAPL_SP_STATE_FREE;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- (void)dapls_ib_remove_conn_listener ( sp_ptr->header.owner_ia,\r
- sp_ptr );\r
- dapls_ia_unlink_sp ( (DAPL_IA *)sp_ptr->header.owner_ia,\r
- sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
- goto skip_unlock;\r
- }\r
-\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- /* free memory outside of the lock */\r
- dapls_cr_free (cr_ptr);\r
- }\r
- else\r
- {\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- }\r
-\r
-skip_unlock:\r
- return ep_ptr;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cr_handoff.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_cr_handoff\r
- *\r
- * DAPL Requirements Version xxx, 6.4.2.4\r
- *\r
- * Hand the connection request to another Sevice pont specified by the\r
- * Connectin Qualifier.\r
- *\r
- * Input:\r
- * cr_handle\r
- * cr_handoff\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_cr_handoff (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_CONN_QUAL cr_handoff ) /* handoff */\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_cr_handoff ( cr_handle, cr_handoff );\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cr_query.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_cr_query\r
- *\r
- * DAPL Requirements Version xxx, 6.4.2.1\r
- *\r
- * Return Connection Request args\r
- *\r
- * Input:\r
- * cr_handle\r
- * cr_param_mask\r
- *\r
- * Output:\r
- * cr_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_HANDLE\r
- */\r
-DAT_RETURN\r
-dapl_cr_query (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_CR_PARAM_MASK cr_param_mask,\r
- OUT DAT_CR_PARAM *cr_param)\r
-{\r
- DAPL_CR *cr_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_cr_query (%p, %x, %p)\n",\r
- cr_handle, \r
- cr_param_mask, \r
- cr_param);\r
-\r
- dat_status = DAT_SUCCESS;\r
- if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
- goto bail;\r
- }\r
-\r
- if (NULL == cr_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- cr_ptr = (DAPL_CR *) cr_handle;\r
-\r
- /* obtain the remote IP address */\r
- if (cr_param_mask & DAT_CR_FIELD_REMOTE_IA_ADDRESS_PTR)\r
- {\r
- dat_status = dapls_ib_cm_remote_addr ((DAT_HANDLE)cr_handle,\r
- NULL,\r
- &cr_ptr->remote_ia_address );\r
- }\r
-\r
- /* since the arguments are easily accessible, ignore the mask */\r
- dapl_os_memcpy (cr_param, &cr_ptr->param, sizeof (DAT_CR_PARAM));\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cr_reject.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_cr_reject\r
- *\r
- * DAPL Requirements Version xxx, 6.4.2.2\r
- *\r
- * Reject a connection request from the active remote side requesting\r
- * an Endpoint.\r
- *\r
- * Input:\r
- * cr_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_cr_reject (\r
- IN DAT_CR_HANDLE cr_handle )\r
-{\r
- DAPL_CR *cr_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAT_EP_STATE entry_ep_state;\r
- DAT_EP_HANDLE entry_ep_handle;\r
- DAPL_SP *sp_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_cr_reject (%p)\n", cr_handle);\r
-\r
- if ( DAPL_BAD_HANDLE (cr_handle, DAPL_MAGIC_CR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CR);\r
- goto bail;\r
- }\r
-\r
- cr_ptr = (DAPL_CR *)cr_handle;\r
-\r
- /*\r
- * Clean up provider created EP if there is one: only if\r
- * DAT_PSP_PROVIDER_FLAG was set on the PSP\r
- */\r
- ep_ptr = (DAPL_EP *)cr_ptr->param.local_ep_handle;\r
- entry_ep_handle = cr_ptr->param.local_ep_handle;\r
- entry_ep_state = 0;\r
- if ( ep_ptr != NULL )\r
- {\r
- entry_ep_state = ep_ptr->param.ep_state;\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
- cr_ptr->param.local_ep_handle = NULL;\r
- }\r
-\r
- dat_status = dapls_ib_reject_connection ( cr_ptr->ib_cm_handle,\r
- IB_CM_REJ_REASON_CONSUMER_REJ );\r
-\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- if ( ep_ptr != NULL )\r
- {\r
- /* Revert our state to the beginning */\r
- ep_ptr->param.ep_state = entry_ep_state;\r
- cr_ptr->param.local_ep_handle = entry_ep_handle;\r
- cr_ptr->param.local_ep_handle = (DAT_EP_HANDLE)ep_ptr;\r
- }\r
- }\r
- else\r
- {\r
- /* \r
- * If this EP has been allocated by the provider, clean it up;\r
- * see DAT 1.1 spec, page 100, lines 3-4 (section 6.4.3.1.1.1).\r
- * RSP and user-provided EPs are in the control of the user.\r
- */\r
- sp_ptr = cr_ptr->sp_ptr;\r
- if ( ep_ptr != NULL &&\r
- sp_ptr->psp_flags == DAT_PSP_PROVIDER_FLAG )\r
- {\r
- (void)dapl_ep_free (ep_ptr);\r
- }\r
-\r
- /* Remove the CR from the queue, then free it */\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- dapl_sp_remove_cr ( sp_ptr, cr_ptr );\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- dapls_cr_free ( cr_ptr );\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_cr_util.c\r
- *\r
- * PURPOSE: Manage CR (Connection Request) structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_cr_util.h"\r
-\r
-/*\r
- * dapls_cr_create\r
- *\r
- * Create a CR. Part of the passive side of a connection\r
- *\r
- * Input:\r
- * ia_ptr\r
- * cno_ptr\r
- * qlen\r
- * evd_flags\r
- *\r
- * Output:\r
- * evd_ptr_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-\r
-DAPL_CR *\r
-dapls_cr_alloc (\r
- DAPL_IA *ia_ptr )\r
-{\r
- DAPL_CR *cr_ptr;\r
-\r
- /* Allocate EP */\r
- cr_ptr = (DAPL_CR *)dapl_os_alloc (sizeof (DAPL_CR));\r
- if ( cr_ptr == NULL )\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (cr_ptr, sizeof (DAPL_CR));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- cr_ptr->header.provider = ia_ptr->header.provider;\r
- cr_ptr->header.magic = DAPL_MAGIC_CR;\r
- cr_ptr->header.handle_type = DAT_HANDLE_TYPE_CR;\r
- cr_ptr->header.owner_ia = ia_ptr;\r
- cr_ptr->header.user_context.as_64 = 0;\r
- cr_ptr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&cr_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&cr_ptr->header.lock);\r
-\r
- return (cr_ptr);\r
-}\r
-\r
-\r
-/*\r
- * dapls_cr_free\r
- *\r
- * Free the passed in EP structure.\r
- *\r
- * Input:\r
- * entry point pointer\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_cr_free (\r
- IN DAPL_CR *cr_ptr )\r
-{\r
- dapl_os_assert (cr_ptr->header.magic == DAPL_MAGIC_CR ||\r
- cr_ptr->header.magic == DAPL_MAGIC_CR_DESTROYED );\r
-\r
- cr_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
- dapl_os_free (cr_ptr, sizeof (DAPL_CR));\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_cr_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the CR data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_CR_UTIL_H_\r
-#define _DAPL_CR_UTIL_H_\r
-\r
-#include "dapl.h" \r
-\r
-DAPL_CR *\r
-dapls_cr_alloc (\r
- DAPL_IA *ia_ptr );\r
-\r
-void\r
-dapls_cr_free (\r
- IN DAPL_CR *cr_ptr );\r
-\r
-void\r
-dapls_cr_callback (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN const ib_cm_events_t ib_cm_event,\r
- IN const void *instant_data_p,\r
- IN const void *context,\r
- IN DAT_IA_ADDRESS_PTR p_remote_ia_addr);\r
-\r
-#endif /* _DAPL_CR_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_debug.h"\r
-#include "dapl.h"\r
-#include <stdarg.h>\r
-#include <stdlib.h>\r
-\r
-DAPL_DBG_TYPE g_dapl_dbg_type; /* initialized in dapl_init.c */\r
-DAPL_DBG_DEST g_dapl_dbg_dest; /* initialized in dapl_init.c */\r
-\r
-#ifdef DAPL_DBG\r
-\r
-void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...)\r
-{\r
- va_list args;\r
-\r
- if ( type & g_dapl_dbg_type )\r
- {\r
- va_start (args, fmt);\r
-\r
- if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest )\r
- {\r
- dapl_os_vprintf (fmt, args);\r
- }\r
-\r
- if ( DAPL_DBG_DEST_SYSLOG & g_dapl_dbg_dest )\r
- {\r
- dapl_os_syslog(fmt, args);\r
- }\r
- va_end (args);\r
- }\r
-}\r
-\r
-#endif /* DAPL_DBG */\r
-\r
-void dapl_internal_log ( DAPL_DBG_TYPE type, const char *fmt, ...)\r
-{\r
- va_list args;\r
-\r
- if ( type & g_dapl_dbg_type )\r
- {\r
- va_start (args, fmt);\r
- dapl_os_vprintf (fmt, args);\r
- va_end (args);\r
- }\r
-}\r
-\r
-\r
-#if defined(DAPL_COUNTERS)\r
-long dapl_dbg_counters[DAPL_CNTR_MAX];\r
-\r
-/*\r
- * The order of this list must match exactly with the #defines\r
- * in dapl_debug.h\r
- */\r
-char *dapl_dbg_counter_names[] = {\r
- "dapl_ep_create",\r
- "dapl_ep_free",\r
- "dapl_ep_connect",\r
- "dapl_ep_disconnect",\r
- "dapl_ep_post_send",\r
- "dapl_ep_post_recv",\r
- "dapl_ep_post_rdma_write",\r
- "dapl_ep_post_rdma_read",\r
- "dapl_evd_create",\r
- "dapl_evd_free",\r
- "dapl_evd_wait",\r
- "dapl_evd_blocked",\r
- "dapl_evd_completion_notify",\r
- "dapl_evd_dto_callback",\r
- "dapl_evd_connection_callback",\r
- "dapl_evd_dequeue",\r
- "dapl_evd_poll",\r
- "dapl_evd_found",\r
- "dapl_evd_not_found",\r
- "dapls_timer_set",\r
- "dapls_timer_cancel",\r
- 0\r
-};\r
-#endif /* DAPL_COUNTERS */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_connect.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_timer_util.h"\r
-\r
-/*\r
- * dapl_ep_connect\r
- *\r
- * DAPL Requirements Version xxx, 6.5.7\r
- *\r
- * Request a connection be established between the local Endpoint\r
- * and a remote Endpoint. This operation is used by the active/client\r
- * side of a connection\r
- *\r
- * Input:\r
- * ep_handle\r
- * remote_ia_address\r
- * remote_conn_qual\r
- * timeout\r
- * private_data_size\r
- * privaet_data\r
- * qos\r
- * connect_flags\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOUCRES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_MODLE_NOT_SUPPORTED\r
- */\r
-DAT_RETURN\r
-dapl_ep_connect (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- IN DAT_CONN_QUAL remote_conn_qual,\r
- IN DAT_TIMEOUT timeout,\r
- IN DAT_COUNT private_data_size,\r
- IN const DAT_PVOID private_data,\r
- IN DAT_QOS qos,\r
- IN DAT_CONNECT_FLAGS connect_flags )\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_PRIVATE prd;\r
- DAPL_EP alloc_ep;\r
- DAT_RETURN dat_status;\r
- DAT_COUNT ib_req_pdata_size;\r
- DAT_COUNT max_req_pdata_size;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
- "dapl_ep_connect (%p, {%u.%u.%u.%u}, %#I64x, %d, %d, %p, %x, %x)\n",\r
- ep_handle,\r
- remote_ia_address->sa_data[2],\r
- remote_ia_address->sa_data[3],\r
- remote_ia_address->sa_data[4],\r
- remote_ia_address->sa_data[5],\r
- remote_conn_qual,\r
- timeout,\r
- private_data_size,\r
- private_data,\r
- qos,\r
- connect_flags);\r
- DAPL_CNTR (DCNT_EP_CONNECT);\r
-\r
- dat_status = DAT_SUCCESS;\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Verify parameter & state. The connection handle must be good\r
- * at this point.\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- if ( DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);\r
- goto bail;\r
- }\r
-\r
- /* Can't do a connection in 0 time, reject outright */\r
- if ( timeout == 0 )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * If the endpoint needs a QP, associated the QP with it.\r
- * This needs to be done carefully, in order to:\r
- * * Avoid allocating under a lock.\r
- * * Not step on data structures being altered by\r
- * routines with which we are racing.\r
- * So we:\r
- * * Confirm that a new QP is needed and is not forbidden by the\r
- * current state.\r
- * * Allocate it into a separate EP.\r
- * * Take the EP lock.\r
- * * Reconfirm that the EP is in a state where it needs a QP.\r
- * * Assign the QP and release the lock.\r
- */\r
- if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
- {\r
- if ( ep_ptr->param.pz_handle == NULL\r
- || DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EP_NOTREADY);\r
- goto bail;\r
- }\r
- alloc_ep = *ep_ptr;\r
-\r
- dat_status = dapls_ib_qp_alloc ( ep_ptr->header.owner_ia,\r
- &alloc_ep,\r
- ep_ptr );\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- /*\r
- * PZ shouldn't have changed since we're only racing with\r
- * dapl_cr_accept()\r
- */\r
- if ( ep_ptr->qp_state != DAPL_QP_STATE_UNATTACHED )\r
- {\r
- /* Bail, cleaning up. */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = dapls_ib_qp_free ( ep_ptr->header.owner_ia,\r
- &alloc_ep );\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ep_connect: ib_qp_free failed with %x\n",\r
- dat_status);\r
- }\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- ep_ptr->qp_handle = alloc_ep.qp_handle;\r
- ep_ptr->qpn = alloc_ep.qpn;\r
- ep_ptr->qp_state = alloc_ep.qp_state;\r
-\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- }\r
-\r
- /*\r
- * We do state checks and transitions under lock.\r
- * The only code we're racing against is dapl_cr_accept.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
-\r
- /*\r
- * Verify the attributes of the EP handle before we connect it. Test\r
- * all of the handles to make sure they are currently valid.\r
- * Specifically:\r
- * pz_handle required\r
- * recv_evd_handle optional, but must be valid\r
- * request_evd_handle optional, but must be valid\r
- * connect_evd_handle required\r
- */\r
- if ( ep_ptr->param.pz_handle == NULL\r
- || DAPL_BAD_HANDLE (ep_ptr->param.pz_handle, DAPL_MAGIC_PZ)\r
- /* test connect handle */\r
- || ep_ptr->param.connect_evd_handle == NULL\r
- || DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD)\r
- || ! (((DAPL_EVD *)ep_ptr->param.connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)\r
- /* test optional completion handles */\r
- || (ep_ptr->param.recv_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (ep_ptr->param.recv_evd_handle, DAPL_MAGIC_EVD)))\r
- || (ep_ptr->param.request_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (ep_ptr->param.request_evd_handle, DAPL_MAGIC_EVD))))\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EP_NOTREADY);\r
- goto bail;\r
- }\r
-\r
- /* Check both the EP state and the QP state: if we don't have a QP\r
- * we need to attach one now.\r
- */\r
- if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
- {\r
- dat_status = dapls_ib_qp_alloc ( ep_ptr->header.owner_ia,\r
- ep_ptr, ep_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_TEP);\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ep_ptr->param.ep_state != DAT_EP_STATE_UNCONNECTED )\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- if ( qos != DAT_QOS_BEST_EFFORT ||\r
- connect_flags != DAT_CONNECT_DEFAULT_FLAG )\r
- {\r
- /*\r
- * At this point we only support one QOS level\r
- */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_MODEL_NOT_SUPPORTED, 0);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Verify the private data size doesn't exceed the max\r
- */\r
- ib_req_pdata_size = private_data_size +\r
- (sizeof (DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);\r
-\r
- max_req_pdata_size = dapls_ib_private_data_size (NULL, DAPL_PDATA_CONN_REQ);\r
-\r
- if (ib_req_pdata_size > max_req_pdata_size) \r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG5);\r
- goto bail;\r
- }\r
-\r
- /* transition the state before requesting a connection to avoid\r
- * race conditions\r
- */\r
- ep_ptr->param.ep_state = DAT_EP_STATE_ACTIVE_CONNECTION_PENDING;\r
-\r
- /*\r
- * At this point we're committed, and done with the endpoint\r
- * except for the connect, so we can drop the lock.\r
- */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- /*\r
- * Copy interesting data into the private data header\r
- */\r
-#ifdef NO_NAME_SERVICE\r
- dapl_os_memcpy (&prd.hca_address,\r
- &ep_ptr->header.owner_ia->hca_ptr->hca_address,\r
- sizeof (DAT_SOCK_ADDR));\r
-#endif \r
-\r
- /*\r
- * The spec calls for us to use the entire private data size;\r
- * put the message in and pad with NULLs\r
- */\r
- dapl_os_memcpy (prd.private_data, private_data, private_data_size);\r
- dapl_os_memzero (prd.private_data + private_data_size,\r
- DAPL_MAX_PRIVATE_DATA_SIZE - private_data_size);\r
-\r
- /* Copy the connection qualifiers */\r
- dapl_os_memcpy ( ep_ptr->param.remote_ia_address_ptr,\r
- remote_ia_address,\r
- sizeof ( DAT_SOCK_ADDR) );\r
- ep_ptr->param.remote_port_qual = remote_conn_qual;\r
-\r
- dat_status = dapls_ib_connect ( ep_handle,\r
- remote_ia_address,\r
- remote_conn_qual,\r
- private_data_size,\r
- &prd );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
-\r
- /*\r
- * Some implementations provide us with an error code that the\r
- * remote destination is unreachable, but DAT doesn't have a\r
- * synchronous error code to communicate this. So the provider\r
- * layer generates an INTERNAL_ERROR with a subtype; when\r
- * this happens, return SUCCESS and generate the event\r
- */\r
- if (dat_status == DAT_ERROR (DAT_INTERNAL_ERROR, 1) )\r
- {\r
- dapls_evd_post_connection_event (\r
- (DAPL_EVD *)ep_ptr->param.connect_evd_handle,\r
- DAT_CONNECTION_EVENT_UNREACHABLE,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- 0);\r
- dat_status = DAT_SUCCESS;\r
- }\r
- }\r
- else\r
- {\r
- /*\r
- * Acquire the lock and recheck the state of the EP; this\r
- * thread could have been descheduled after issuing the connect\r
- * request and the EP is now connected. Set up a timer if\r
- * necessary.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- if (ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING &&\r
- timeout != DAT_TIMEOUT_INFINITE )\r
- {\r
- ep_ptr->cxn_timer =\r
- (DAPL_OS_TIMER *)dapl_os_alloc (sizeof (DAPL_OS_TIMER));\r
-\r
- dapls_timer_set ( ep_ptr->cxn_timer,\r
- dapls_ep_timeout,\r
- ep_ptr,\r
- timeout );\r
- }\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- }\r
-\r
-bail:\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,\r
- "dapl_ep_connect () returns 0x%x\n",\r
- dat_status);\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_create.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the kDAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-\r
-/*\r
- * dapl_ep_create\r
- *\r
- * uDAPL Version 1.1, 6.5.3\r
- *\r
- * Create an instance of an Endpoint that is provided to the\r
- * consumer at ep_handle.\r
- *\r
- * Input:\r
- * ia_handle\r
- * pz_handle\r
- * recv_evd_handle (recv DTOs)\r
- * request_evd_handle (xmit DTOs)\r
- * connect_evd_handle\r
- * ep_attrs\r
- *\r
- * Output:\r
- * ep_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_ATTRIBUTE\r
- * DAT_MODEL_NOT_SUPPORTED\r
- */\r
-DAT_RETURN\r
-dapl_ep_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_EVD_HANDLE recv_evd_handle,\r
- IN DAT_EVD_HANDLE request_evd_handle,\r
- IN DAT_EVD_HANDLE connect_evd_handle,\r
- IN const DAT_EP_ATTR *ep_attr,\r
- OUT DAT_EP_HANDLE *ep_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAT_EP_ATTR ep_attr_limit;\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_create (%p, %p, %p, %p, %p, %p, %p)\n",\r
- ia_handle, \r
- pz_handle, \r
- recv_evd_handle, \r
- request_evd_handle,\r
- connect_evd_handle, \r
- ep_attr, \r
- ep_handle);\r
- DAPL_CNTR(DCNT_EP_CREATE);\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- /*\r
- * Verify parameters\r
- */\r
- if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Verify non-required parameters.\r
- * N.B. Assumption: any parameter that can be\r
- * modified by dat_ep_modify() is not strictly\r
- * required when the EP is created\r
- */\r
- if ( pz_handle != NULL && \r
- DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);\r
- goto bail;\r
- }\r
-\r
- /* If connect handle is !NULL verify handle is good */\r
- if (connect_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (connect_evd_handle, DAPL_MAGIC_EVD) ||\r
- ! (((DAPL_EVD *)connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG)) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CONN);\r
- goto bail;\r
- }\r
- /* If recv_evd is !NULL, verify handle is good and flags are valid */\r
- if (recv_evd_handle != DAT_HANDLE_NULL &&\r
- (DAPL_BAD_HANDLE (recv_evd_handle, DAPL_MAGIC_EVD) ||\r
- ! (((DAPL_EVD *)recv_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_RECV);\r
- goto bail;\r
- }\r
-\r
- /* If req_evd is !NULL, verify handle is good and flags are valid */\r
- if (request_evd_handle != DAT_HANDLE_NULL && \r
- (DAPL_BAD_HANDLE (request_evd_handle, DAPL_MAGIC_EVD) ||\r
- ! (((DAPL_EVD *)request_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG) ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_REQUEST);\r
- goto bail;\r
- }\r
-\r
- if ( ep_handle == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG7);\r
- goto bail;\r
- }\r
-\r
- if (( DAT_UVERYLONG _w64)ep_attr & 3)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Qualify EP Attributes are legal and make sense. Note that if one\r
- * or both of the DTO handles are NULL, then the corresponding\r
- * max_*_dtos must 0 as the user will not be able to post dto ops on\r
- * the respective queue.\r
- */\r
- if (ep_attr != NULL && \r
- (ep_attr->service_type != DAT_SERVICE_TYPE_RC ||\r
- (recv_evd_handle == DAT_HANDLE_NULL && ep_attr->max_recv_dtos != 0) ||\r
- (recv_evd_handle != DAT_HANDLE_NULL && ep_attr->max_recv_dtos == 0) ||\r
- (request_evd_handle == DAT_HANDLE_NULL && ep_attr->max_request_dtos != 0) ||\r
- (request_evd_handle != DAT_HANDLE_NULL && ep_attr->max_request_dtos == 0) ||\r
- ep_attr->max_recv_iov == 0 ||\r
- ep_attr->max_request_iov == 0 ||\r
- (DAT_SUCCESS != dapl_ep_check_recv_completion_flags (\r
- ep_attr->recv_completion_flags)) ))\r
- {\r
- dat_status = DAT_INVALID_PARAMETER | DAT_INVALID_ARG6;\r
- goto bail;\r
- }\r
-\r
- /* Verify the attributes against the transport */\r
- if (ep_attr != NULL)\r
- {\r
- dapl_os_memzero (&ep_attr_limit, sizeof (DAT_EP_ATTR));\r
- dat_status = dapls_ib_query_hca (ia_ptr->hca_ptr, \r
- NULL, &ep_attr_limit, NULL);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
- if ( ep_attr->max_mtu_size > ep_attr_limit.max_mtu_size ||\r
- ep_attr->max_rdma_size > ep_attr_limit.max_rdma_size ||\r
- ep_attr->max_recv_dtos > ep_attr_limit.max_recv_dtos ||\r
- ep_attr->max_request_dtos > ep_attr_limit.max_request_dtos ||\r
- ep_attr->max_recv_iov > ep_attr_limit.max_recv_iov ||\r
- ep_attr->max_request_iov > ep_attr_limit.max_request_iov ||\r
- ep_attr->max_rdma_read_in > ep_attr_limit.max_rdma_read_in ||\r
- ep_attr->max_rdma_read_out> ep_attr_limit.max_rdma_read_out )\r
-\r
- {\r
- dat_status = DAT_INVALID_PARAMETER | DAT_INVALID_ARG6;\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * Verify the completion flags for the EVD and the EP\r
- */\r
- /*\r
- * XXX FIXME\r
- * XXX Need to make assign the EVD to the right completion type\r
- * XXX depending on the EP attributes. Fail if the types don't\r
- * XXX match, they are mutually exclusive.\r
- */\r
- evd_ptr = (DAPL_EVD *)recv_evd_handle;\r
- if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
- {\r
- if (ep_attr != NULL && \r
- ep_attr->recv_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
- {\r
- evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
- }\r
- else\r
- {\r
- evd_ptr->completion_type = ep_attr->recv_completion_flags;\r
- }\r
- }\r
-\r
- evd_ptr = (DAPL_EVD *)request_evd_handle;\r
- if (evd_ptr != NULL && evd_ptr->completion_type == DAPL_EVD_STATE_INIT)\r
- {\r
- if (ep_attr != NULL && \r
- ep_attr->request_completion_flags == DAT_COMPLETION_DEFAULT_FLAG)\r
- {\r
- evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD;\r
- }\r
- else\r
- {\r
- evd_ptr->completion_type = ep_attr->request_completion_flags;\r
- }\r
- }\r
-\r
-\r
- /* Allocate EP */\r
- ep_ptr = dapl_ep_alloc ( ia_ptr, ep_attr );\r
- if ( ep_ptr == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Fill in the EP\r
- */\r
- ep_ptr->header.owner_ia = ia_ptr;\r
- ep_ptr->param.ia_handle = ia_handle;\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
- ep_ptr->param.local_ia_address_ptr=\r
- (DAT_IA_ADDRESS_PTR)&ia_ptr->hca_ptr->hca_address;\r
- /* Set the remote address pointer to the end of the EP struct */\r
- ep_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR) (ep_ptr + 1);\r
-\r
- ep_ptr->param.pz_handle = pz_handle;\r
- ep_ptr->param.recv_evd_handle = recv_evd_handle;\r
- ep_ptr->param.request_evd_handle = request_evd_handle;\r
- ep_ptr->param.connect_evd_handle = connect_evd_handle;\r
-\r
- /*\r
- * Make sure we handle the NULL DTO EVDs\r
- */\r
- if ( recv_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
- {\r
- ep_ptr->param.ep_attr.max_recv_dtos = 0;\r
- }\r
-\r
- if ( request_evd_handle == DAT_HANDLE_NULL && ep_attr == NULL )\r
- {\r
- ep_ptr->param.ep_attr.max_request_dtos = 0;\r
- }\r
-\r
- /*\r
- * If the user has specified a PZ handle we allocate a QP for\r
- * this EP; else we defer until it is assigned via ep_modify().\r
- * As much as possible we try to keep QP creation out of the\r
- * connect path to avoid resource errors in strange places.\r
- */\r
- if (pz_handle != DAT_HANDLE_NULL )\r
- {\r
- /* Take a reference on the PZ handle */\r
- dapl_os_atomic_inc (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
-\r
- /*\r
- * Get a QP from the IB provider\r
- */\r
- dat_status = dapls_ib_qp_alloc ( ia_ptr, ep_ptr, ep_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_PZ *)pz_handle)->pz_ref_count);\r
- dapl_ep_dealloc ( ep_ptr );\r
- goto bail;\r
- }\r
- }\r
- else\r
- {\r
- ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
- }\r
-\r
- /*\r
- * Update ref counts. See the spec where the endpoint marks\r
- * a data object as 'in use'\r
- * pz_handle: dat_pz_free, uDAPL Document, 6.6.1.2\r
- * evd_handles:\r
- *\r
- * N.B. This should really be done by a util routine.\r
- */\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)connect_evd_handle)->evd_ref_count);\r
- /* Optional handles */\r
- if (recv_evd_handle != DAT_HANDLE_NULL)\r
- {\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)recv_evd_handle)->evd_ref_count);\r
- }\r
- if (request_evd_handle != DAT_HANDLE_NULL)\r
- {\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)request_evd_handle)->evd_ref_count);\r
- }\r
-\r
- /* Link it onto the IA */\r
- dapl_ia_link_ep (ia_ptr, ep_ptr);\r
-\r
- *ep_handle = ep_ptr;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_disconnect.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_cr_util.h" /* for callback routine */\r
-\r
-/*\r
- * dapl_ep_disconnect\r
- *\r
- * DAPL Requirements Version xxx, 6.5.9\r
- *\r
- * Terminate a connection.\r
- *\r
- * Input:\r
- * ep_handle\r
- * disconnect_flags\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_ep_disconnect (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_CLOSE_FLAGS disconnect_flags)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_CR *cr_ptr;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
- "dapl_ep_disconnect (EP :%p, close flag: %x)\n",\r
- ep_handle,\r
- disconnect_flags);\r
- DAPL_CNTR(DCNT_EP_DISCONNECT);\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- \r
- /*\r
- * Verify parameter & state\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Do the verification of parameters and the state change atomically\r
- */\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- \r
- switch ( ep_ptr->param.ep_state )\r
- {\r
- case DAT_EP_STATE_DISCONNECTED:\r
- break;\r
- case DAT_EP_STATE_COMPLETION_PENDING:\r
- dapls_ib_disconnect(ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
- break;\r
- case DAT_EP_STATE_DISCONNECT_PENDING:\r
- if (disconnect_flags == DAT_CLOSE_GRACEFUL_FLAG )\r
- {\r
- break;\r
- }\r
- case DAT_EP_STATE_CONNECTED:\r
- if (disconnect_flags == DAT_CLOSE_GRACEFUL_FLAG )\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECT_PENDING;\r
- }\r
- if (ep_ptr->sent_discreq != TRUE )\r
- {\r
- dapls_ib_disconnect(ep_ptr, disconnect_flags);\r
- }\r
- break;\r
- case DAT_EP_STATE_ACTIVE_CONNECTION_PENDING:\r
- if (ep_ptr->sent_discreq != TRUE )\r
- {\r
- dapls_ib_disconnect(ep_ptr, disconnect_flags);\r
- }\r
- evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
- dapls_evd_post_connection_event(evd_ptr,\r
- DAT_CONNECTION_EVENT_DISCONNECTED,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- 0);\r
- break;\r
- default:\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,dapls_ep_state_subtype (ep_ptr));\r
- break;\r
- }\r
-\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
-bail:\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,\r
- "dapl_ep_disconnect () returns 0x%x\n", dat_status);\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_dup_connect.c \r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_timer_util.h"\r
-\r
-/*\r
- * dapl_ep_dup_connect\r
- *\r
- * DAPL Requirements Version xxx, 6.5.8\r
- *\r
- * Requst that a connection be established between the local Endpoint\r
- * and a remote Endpoint. The remote Endpoint is identified by the\r
- * dup_ep.\r
- *\r
- * Input:\r
- * ep_handle\r
- * ep_dup_handle\r
- * conn_qual\r
- * timeout\r
- * private_data_size\r
- * private_data\r
- * qos\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_MODEL_NOT_SUPPORTED\r
- */\r
-DAT_RETURN\r
-dapl_ep_dup_connect (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EP_HANDLE ep_dup_handle,\r
- IN DAT_TIMEOUT timeout,\r
- IN DAT_COUNT private_data_size,\r
- IN const DAT_PVOID private_data,\r
- IN DAT_QOS qos)\r
-{\r
- DAPL_EP *ep_dup_ptr;\r
- DAT_RETURN dat_status;\r
- DAT_IA_ADDRESS_PTR remote_ia_address_ptr;\r
- DAT_CONN_QUAL remote_conn_qual;\r
-\r
- ep_dup_ptr = (DAPL_EP *) ep_dup_handle;\r
-\r
- /*\r
- * Verify the dup handle, which must be connected. All other\r
- * parameters will be verified by dapl_ep_connect\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_dup_handle, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- /* Can't do a connection in 0 time, reject outright */\r
- if ( timeout == 0 )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- /* Check both the EP state and the QP state: if we don't have a QP\r
- * there is a problem. Do this under a lock and pull out\r
- * the connection parameters for atomicity.\r
- */\r
- dapl_os_lock ( &ep_dup_ptr->header.lock );\r
- if ( ep_dup_ptr->param.ep_state != DAT_EP_STATE_CONNECTED )\r
- {\r
- dapl_os_unlock ( &ep_dup_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,dapls_ep_state_subtype (ep_dup_ptr));\r
- goto bail;\r
- }\r
- remote_ia_address_ptr = ep_dup_ptr->param.remote_ia_address_ptr;\r
- remote_conn_qual = ep_dup_ptr->param.remote_port_qual;\r
- dapl_os_unlock ( &ep_dup_ptr->header.lock );\r
-\r
- dat_status = dapl_ep_connect ( ep_handle,\r
- remote_ia_address_ptr, \r
- remote_conn_qual, \r
- timeout,\r
- private_data_size,\r
- private_data,\r
- qos,\r
- DAT_CONNECT_DEFAULT_FLAG );\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_free.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5.4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-#include "dapl_timer_util.h"\r
-\r
-/*\r
- * dapl_ep_free\r
- *\r
- * DAPL Requirements Version xxx, 6.5.3\r
- *\r
- * Destroy an instance of the Endpoint\r
- *\r
- * Input:\r
- * ep_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN\r
-dapl_ep_free (\r
- IN DAT_EP_HANDLE ep_handle)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_IA *ia_ptr;\r
- DAT_EP_PARAM *param;\r
- ib_qp_state_t save_qp_state;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_ep_free (%p)\n", ep_handle);\r
- DAPL_CNTR(DCNT_EP_FREE);\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- param = &ep_ptr->param;\r
-\r
- /*\r
- * Verify parameter & state\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_RESERVED ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_PASSIVE_CONNECTION_PENDING ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "--> dapl_ep_free: invalid state: %x, ep %p\n",\r
- ep_ptr->param.ep_state,\r
- ep_ptr);\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,\r
- dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- ia_ptr = ep_ptr->header.owner_ia;\r
-\r
- /* If we are connected, issue a disconnect. If we are in the\r
- * disconnect_pending state, disconnect with the ABRUPT flag\r
- * set.\r
- */\r
-\r
- /*\r
- * Invoke ep_disconnect to clean up outstanding connections\r
- */\r
- (void) dapl_ep_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
- dapl_os_assert (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_UNCONNECTED);\r
-\r
- /*\r
- * Do verification of parameters and the state change atomically.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
-\r
- if (ep_ptr->cxn_timer != NULL)\r
- {\r
- dapls_timer_cancel ( ep_ptr->cxn_timer );\r
- dapl_os_free ( ep_ptr->cxn_timer, sizeof ( DAPL_OS_TIMER ) );\r
- ep_ptr->cxn_timer = NULL;\r
- }\r
-\r
- /* Remove the EP from the IA */\r
- dapl_ia_unlink_ep ( ia_ptr, ep_ptr );\r
-\r
- /*\r
- * Update ref counts. Note the user may have used ep_modify\r
- * to set handles to NULL. Set handles to NULL so this routine\r
- * is idempotent.\r
- */\r
- if ( param->pz_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_PZ *)param->pz_handle)->pz_ref_count);\r
- param->pz_handle = NULL;\r
- }\r
- if ( param->recv_evd_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->recv_evd_handle)->evd_ref_count);\r
- param->recv_evd_handle = NULL;\r
- }\r
- if ( param->request_evd_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->request_evd_handle)->evd_ref_count);\r
- param->request_evd_handle = NULL;\r
- }\r
- if ( param->connect_evd_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->connect_evd_handle)->evd_ref_count);\r
- param->connect_evd_handle = NULL;\r
- }\r
-\r
- /*\r
- * Finish tearing everything down.\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "dapl_ep_free: Free EP: %x, ep %p qp_state %x qp_handle %x\n",\r
- ep_ptr->param.ep_state,\r
- ep_ptr,\r
- ep_ptr->qp_state,\r
- ep_ptr->qp_handle);\r
- /*\r
- * Take care of the transport resource. Make a copy of the qp_state\r
- * to prevent race conditions when we exit the lock.\r
- */\r
- save_qp_state = ep_ptr->qp_state;\r
- ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- /* Free the QP. If the EP has never been used, the QP is invalid */\r
- if ( save_qp_state != DAPL_QP_STATE_UNATTACHED )\r
- {\r
- dat_status = dapls_ib_qp_free (ia_ptr, ep_ptr);\r
- /* This should always succeed, but report to the user if\r
- * there is a problem. The qp_state must be restored so\r
- * they can try it again in the face of EINTR or similar\r
- * where the QP is OK but the call couldn't complete.\r
- */\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- ep_ptr->qp_state = save_qp_state;\r
- goto bail;\r
- }\r
- }\r
-\r
- /* Free the resource */\r
- dapl_ep_dealloc (ep_ptr);\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_get_status.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-/*\r
- * dapl_ep_get_status\r
- *\r
- * DAPL Requirements Version xxx, 6.5.4\r
- *\r
- * Provide the consumer with a quick snapshot of the Endpoint.\r
- * The snapshot consists of Endpoint state and DTO information.\r
- *\r
- * Input:\r
- * ep_handle\r
- *\r
- * Output:\r
- * ep_state\r
- * in_dto_idle\r
- * out_dto_idle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_ep_get_status (\r
- IN DAT_EP_HANDLE ep_handle,\r
- OUT DAT_EP_STATE *ep_state,\r
- OUT DAT_BOOLEAN *in_dto_idle,\r
- OUT DAT_BOOLEAN *out_dto_idle)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_get_status (%p, %p, %p, %p)\n",\r
- ep_handle, \r
- ep_state, \r
- in_dto_idle, \r
- out_dto_idle);\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- /*\r
- * Verify parameter & state\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Gather state info for user\r
- */\r
- if ( ep_state != NULL )\r
- {\r
- *ep_state = ep_ptr->param.ep_state;\r
- }\r
-\r
- if ( in_dto_idle != NULL )\r
- {\r
- *in_dto_idle = (ep_ptr->recv_count) ? DAT_FALSE : DAT_TRUE;\r
- }\r
-\r
- if ( out_dto_idle != NULL )\r
- {\r
- *out_dto_idle = (ep_ptr->req_count) ? DAT_FALSE : DAT_TRUE;\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_modify.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.0 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * Internal prototypes\r
- */\r
-\r
-static _INLINE_ DAT_RETURN\r
-dapli_ep_modify_validate_parameters (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EP_PARAM_MASK ep_param_mask,\r
- IN const DAT_EP_PARAM *ep_param,\r
- OUT DAPL_IA **ia_ptr,\r
- OUT DAPL_EP **ep_ptr,\r
- OUT DAT_EP_ATTR *ep_attr_ptr );\r
-\r
-\r
-/*\r
- * dapl_ep_modify\r
- *\r
- * DAPL Requirements Version xxx, 6.5.6\r
- *\r
- * Provide the consumer parameters, including attributes and status of\r
- * the Endpoint.\r
- *\r
- * Input:\r
- * ep_handle\r
- * ep_args_mask\r
- *\r
- * Output:\r
- * ep_args\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_ATTRIBUTE\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN\r
-dapl_ep_modify (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EP_PARAM_MASK ep_param_mask,\r
- IN const DAT_EP_PARAM *ep_param )\r
-{\r
- DAPL_IA *ia;\r
- DAPL_EP *ep1, *ep2;\r
- DAT_EP_ATTR ep_attr1, ep_attr2;\r
- DAPL_EP new_ep, copy_of_old_ep;\r
- DAPL_EP alloc_ep; /* Holder for resources. */\r
- DAPL_PZ *tmp_pz;\r
- DAPL_EVD *tmp_evd;\r
- DAT_RETURN dat_status;\r
-\r
- /* Flag indicating we've allocated a new one of these. */\r
- DAT_BOOLEAN qp_allocated = DAT_FALSE;\r
- DAT_BOOLEAN rqst_cb_allocated = DAT_FALSE;\r
- DAT_BOOLEAN recv_cb_allocated = DAT_FALSE;\r
- DAT_BOOLEAN rqst_iov_allocated = DAT_FALSE;\r
- DAT_BOOLEAN recv_iov_allocated = DAT_FALSE;\r
-\r
- /* Flag indicating we've used (assigned to QP) a new one of these. */\r
- DAT_BOOLEAN qp_used = DAT_FALSE;\r
- DAT_BOOLEAN rqst_cb_used = DAT_FALSE;\r
- DAT_BOOLEAN recv_cb_used = DAT_FALSE;\r
- DAT_BOOLEAN rqst_iov_used = DAT_FALSE;\r
- DAT_BOOLEAN recv_iov_used = DAT_FALSE;\r
- \r
- dapl_os_memzero ( (void*)&alloc_ep, sizeof(DAPL_EP) );\r
- dapl_os_memzero ( (void*)&new_ep, sizeof(DAPL_EP) );\r
- dapl_os_memzero ( (void*)©_of_old_ep, sizeof(DAPL_EP) );\r
-\r
- dat_status = dapli_ep_modify_validate_parameters ( ep_handle,\r
- ep_param_mask,\r
- ep_param,\r
- &ia,\r
- &ep1,\r
- &ep_attr1);\r
- if ( DAT_SUCCESS != dat_status)\r
- {\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Setup the alloc_ep with the appropriate parameters (primarily\r
- * for allocating the QP.\r
- */\r
- alloc_ep = *ep1;\r
- alloc_ep.param.ep_attr = ep_attr1;\r
- if ( ep_param_mask & DAT_EP_FIELD_PZ_HANDLE )\r
- {\r
- alloc_ep.param.pz_handle = ep_param->pz_handle;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_RECV_EVD_HANDLE )\r
- {\r
- alloc_ep.param.recv_evd_handle = ep_param->recv_evd_handle;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_REQUEST_EVD_HANDLE )\r
- {\r
- alloc_ep.param.request_evd_handle = ep_param->request_evd_handle;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_CONNECT_EVD_HANDLE )\r
- {\r
- alloc_ep.param.connect_evd_handle = ep_param->connect_evd_handle;\r
- }\r
-\r
- /*\r
- * Allocate everything that might be needed.\r
- * We allocate separately, and into a different "holding"\r
- * ep, since we a) want the copy of the old ep into the new ep to\r
- * be atomic with the assignment back (under lock), b) want the\r
- * assignment of the allocated materials to be after the copy of the\r
- * old ep into the new ep, and c) don't want the allocation done\r
- * under lock.\r
- */\r
- dat_status = dapls_cb_create (\r
- &alloc_ep.req_buffer,\r
- ep1, /* For pointer in buffer bool. */\r
- ep_attr1.max_request_dtos );\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- goto bail;\r
- }\r
- rqst_cb_allocated = DAT_TRUE;\r
-\r
- dat_status = dapls_cb_create (\r
- &alloc_ep.recv_buffer,\r
- ep1, /* For pointer in buffer bool. */\r
- ep_attr1.max_recv_dtos );\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- goto bail;\r
- }\r
- recv_cb_allocated = DAT_TRUE;\r
-\r
- alloc_ep.send_iov_num = ep_attr1.max_request_iov;\r
- alloc_ep.send_iov = dapl_os_alloc (ep_attr1.max_request_iov\r
- * sizeof (ib_data_segment_t));\r
- if ( alloc_ep.recv_iov == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- recv_iov_allocated = DAT_TRUE;\r
-\r
- alloc_ep.recv_iov_num = ep_attr1.max_recv_iov;\r
- alloc_ep.recv_iov = dapl_os_alloc (ep_attr1.max_recv_iov\r
- * sizeof (ib_data_segment_t));\r
- if ( alloc_ep.recv_iov == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- recv_iov_allocated = DAT_TRUE;\r
-\r
- dat_status = dapls_ib_qp_alloc ( ia, &alloc_ep, ep1 );\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- goto bail;\r
- }\r
- qp_allocated = DAT_TRUE;\r
-\r
- /*\r
- * Now we atomically modify the EP, under lock\r
- * There's a lot of work done here, but there should be no\r
- * allocation or blocking.\r
- */\r
- dapl_os_lock ( &ep1->header.lock );\r
-\r
- /*\r
- * Revalidate parameters; make sure that races haven't\r
- * changed anything important.\r
- */\r
- dat_status = dapli_ep_modify_validate_parameters ( ep_handle,\r
- ep_param_mask,\r
- ep_param,\r
- &ia,\r
- &ep2,\r
- &ep_attr2 );\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- dapl_os_unlock ( &ep2->header.lock );\r
- goto bail;\r
- }\r
-\r
- /*\r
- * All of the following should be impossible, if validation\r
- * occurred. But they're important to the logic of this routine,\r
- * so we check.\r
- */\r
- dapl_os_assert ( ep1 == ep2 );\r
- dapl_os_assert ( ep_attr2.max_recv_dtos == ep_attr1.max_recv_dtos );\r
- dapl_os_assert ( ep_attr2.max_request_dtos == ep_attr1.max_request_dtos );\r
- dapl_os_assert ( ep_attr2.max_recv_iov == ep_attr1.max_recv_iov );\r
- dapl_os_assert ( ep_attr2.max_request_iov == ep_attr1.max_request_iov );\r
-\r
- copy_of_old_ep = *ep2;\r
-\r
- /*\r
- * Setup new ep.\r
- */\r
- new_ep = *ep2;\r
- new_ep.param.ep_attr = ep_attr2;\r
-\r
- /*\r
- * We can initialize the PZ and EVD handles from the alloc_ep because\r
- * the only thing that could have changed since we setup the alloc_ep\r
- * is stuff changed by dapl_cr_accept, and neither PZ nor EVD is in that\r
- * list.\r
- */\r
- new_ep.param.pz_handle = alloc_ep.param.pz_handle;\r
- new_ep.param.recv_evd_handle = alloc_ep.param.recv_evd_handle;\r
- new_ep.param.request_evd_handle = alloc_ep.param.request_evd_handle;\r
- new_ep.param.connect_evd_handle = alloc_ep.param.connect_evd_handle;\r
-\r
- /* Deal with each of the allocation fields. */\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS\r
- && (ep_param->ep_attr.max_recv_dtos\r
- != ep2->param.ep_attr.max_recv_dtos) )\r
- {\r
- new_ep.recv_buffer = alloc_ep.recv_buffer;\r
- recv_cb_used = DAT_TRUE;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS\r
- && (ep_param->ep_attr.max_request_dtos\r
- != ep2->param.ep_attr.max_request_dtos) )\r
- {\r
- new_ep.req_buffer = alloc_ep.req_buffer;\r
- rqst_cb_used = DAT_TRUE;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV\r
- && new_ep.recv_iov_num != ep2->recv_iov_num )\r
- {\r
- new_ep.recv_iov = alloc_ep.recv_iov;\r
- recv_iov_used = DAT_TRUE;\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV\r
- && new_ep.send_iov_num != ep2->send_iov_num )\r
- {\r
- new_ep.send_iov = alloc_ep.send_iov;\r
- rqst_iov_used = DAT_TRUE;\r
- }\r
-\r
- /*\r
- * We need to change the QP only if there already was a QP\r
- * (leave things the way you found them!) and one of the\r
- * following has changed: send/recv EVD, send/recv reqs/IOV max.\r
- */\r
- if ( DAPL_QP_STATE_UNATTACHED != new_ep.qp_state\r
- && (ep_param_mask\r
- & (DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV\r
- | DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV\r
- | DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS\r
- | DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS\r
- | DAT_EP_FIELD_RECV_EVD_HANDLE\r
- | DAT_EP_FIELD_REQUEST_EVD_HANDLE)) )\r
- {\r
- /*\r
- * We shouldn't be racing with connection establishment\r
- * because the parameter validate routine should protect us,\r
- * but it's an important enough point that we assert it.\r
- */\r
- dapl_os_assert ( (ep2->param.ep_state\r
- != DAT_EP_STATE_PASSIVE_CONNECTION_PENDING)\r
- && (ep2->param.ep_state\r
- != DAT_EP_STATE_ACTIVE_CONNECTION_PENDING) );\r
-\r
- new_ep.qp_handle = alloc_ep.qp_handle;\r
- new_ep.qpn = alloc_ep.qpn;\r
- }\r
-\r
- /*\r
- * The actual assignment, including modifying QP parameters.\r
- * Modifying QP parameters needs to come first, as if it fails\r
- * we need to exit. \r
- */\r
- if ( DAPL_QP_STATE_UNATTACHED != new_ep.qp_state )\r
- {\r
- dat_status = dapls_ib_qp_modify ( ia, ep2, &ep_attr2 );\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_os_unlock ( & ep2->header.lock );\r
- goto bail;\r
- }\r
- }\r
- *ep2 = new_ep;\r
-\r
- dapl_os_unlock ( &ep2->header.lock );\r
-\r
- /*\r
- * Modify reference counts, incrementing new ones\r
- * and then decrementing old ones (so if they're the same\r
- * the refcount never drops to zero).\r
- */\r
- tmp_pz = (DAPL_PZ *) new_ep.param.pz_handle;\r
- if ( NULL != tmp_pz )\r
- {\r
- dapl_os_atomic_inc (&tmp_pz->pz_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) new_ep.param.recv_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) new_ep.param.request_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) new_ep.param.connect_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_inc (&tmp_evd->evd_ref_count);\r
- }\r
-\r
- /* decreament the old reference counts */\r
- tmp_pz = (DAPL_PZ *) copy_of_old_ep.param.pz_handle;\r
- if ( NULL != tmp_pz )\r
- {\r
- dapl_os_atomic_dec (&tmp_pz->pz_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.recv_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.request_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
- }\r
-\r
- tmp_evd = (DAPL_EVD *) copy_of_old_ep.param.connect_evd_handle;\r
- if ( NULL != tmp_evd )\r
- {\r
- dapl_os_atomic_dec (&tmp_evd->evd_ref_count);\r
- }\r
-\r
-bail:\r
- if ( qp_allocated )\r
- {\r
- DAT_RETURN local_dat_status;\r
- if ( dat_status != DAT_SUCCESS || !qp_used )\r
- {\r
- local_dat_status = dapls_ib_qp_free (ia, &alloc_ep );\r
- }\r
- else\r
- {\r
- local_dat_status = dapls_ib_qp_free (ia, ©_of_old_ep );\r
- }\r
- if (local_dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ep_modify: Failed to free QP; status %x\n",\r
- local_dat_status);\r
- }\r
- }\r
-\r
- if ( rqst_cb_allocated )\r
- {\r
- if ( dat_status != DAT_SUCCESS || !rqst_cb_used )\r
- {\r
- dapls_cb_free ( &alloc_ep.req_buffer );\r
- }\r
- else\r
- {\r
- dapls_cb_free ( ©_of_old_ep.req_buffer );\r
- }\r
- }\r
-\r
- if ( recv_cb_allocated )\r
- {\r
- if ( dat_status != DAT_SUCCESS || !recv_cb_used )\r
- {\r
- dapls_cb_free ( &alloc_ep.recv_buffer );\r
- }\r
- else\r
- {\r
- dapls_cb_free ( ©_of_old_ep.recv_buffer );\r
- }\r
- }\r
-\r
- if ( rqst_iov_allocated )\r
- {\r
- if ( dat_status != DAT_SUCCESS || !rqst_iov_used )\r
- {\r
- dapl_os_free ( alloc_ep.send_iov,\r
- (alloc_ep.send_iov_num\r
- * sizeof (ib_data_segment_t)));\r
- }\r
- else\r
- {\r
- dapl_os_free ( copy_of_old_ep.send_iov,\r
- (copy_of_old_ep.send_iov_num\r
- * sizeof (ib_data_segment_t)));\r
- }\r
- }\r
-\r
- if ( recv_iov_allocated )\r
- {\r
- if ( dat_status != DAT_SUCCESS || !recv_iov_used )\r
- {\r
- dapl_os_free ( alloc_ep.recv_iov,\r
- (alloc_ep.recv_iov_num\r
- * sizeof (ib_data_segment_t)));\r
- }\r
- else\r
- {\r
- dapl_os_free ( copy_of_old_ep.recv_iov,\r
- (copy_of_old_ep.recv_iov_num\r
- * sizeof (ib_data_segment_t)));\r
- }\r
- }\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapli_ep_modify_validate_parameters\r
- *\r
- * Validate parameters\r
- *\r
- * The space for the ep_attr_ptr parameter should be allocated by the\r
- * consumer. Upon success, this parameter will contain the current ep\r
- * attribute values with the requested modifications made.\r
- *\r
- */\r
-\r
-static DAT_RETURN\r
-dapli_ep_modify_validate_parameters (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EP_PARAM_MASK ep_param_mask,\r
- IN const DAT_EP_PARAM *ep_param,\r
- OUT DAPL_IA **ia_ptr,\r
- OUT DAPL_EP **ep_ptr,\r
- OUT DAT_EP_ATTR *ep_attr_ptr )\r
-{\r
- DAPL_IA *ia;\r
- DAPL_EP *ep;\r
- DAT_EP_ATTR ep_attr;\r
- DAT_EP_ATTR ep_attr_limit;\r
- DAT_EP_ATTR ep_attr_request;\r
- DAT_RETURN dat_status;\r
-\r
- *ia_ptr = NULL;\r
- *ep_ptr = NULL;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- ep = (DAPL_EP *) ep_handle;\r
- ia = ep->header.owner_ia;\r
-\r
- /*\r
- * Verify parameters valid in current EP state\r
- */\r
- if ( ep_param_mask & (DAT_EP_FIELD_IA_HANDLE |\r
- DAT_EP_FIELD_EP_STATE |\r
- DAT_EP_FIELD_LOCAL_IA_ADDRESS_PTR |\r
- DAT_EP_FIELD_LOCAL_PORT_QUAL |\r
- DAT_EP_FIELD_REMOTE_IA_ADDRESS_PTR |\r
- DAT_EP_FIELD_REMOTE_PORT_QUAL) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Can only change the PZ handle if we are UNCONNECTED or\r
- * TENTATIVE_CONNECTION_PENDING (psp PROVIDER allocated EP)\r
- */\r
- if ( (ep_param_mask & DAT_EP_FIELD_PZ_HANDLE) &&\r
- ( ep->param.ep_state != DAT_EP_STATE_UNCONNECTED &&\r
- ep->param.ep_state != DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep));\r
- goto bail;\r
- }\r
-\r
- if ( (ep_param_mask & (DAT_EP_FIELD_RECV_EVD_HANDLE |\r
- DAT_EP_FIELD_REQUEST_EVD_HANDLE |\r
- DAT_EP_FIELD_CONNECT_EVD_HANDLE |\r
- DAT_EP_FIELD_EP_ATTR_SERVICE_TYPE |\r
- DAT_EP_FIELD_EP_ATTR_MAX_MESSAGE_SIZE |\r
- DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE |\r
- DAT_EP_FIELD_EP_ATTR_QOS |\r
- DAT_EP_FIELD_EP_ATTR_REQUEST_COMPLETION_FLAGS |\r
- DAT_EP_FIELD_EP_ATTR_RECV_COMPLETION_FLAGS |\r
- DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS |\r
- DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS |\r
- DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV |\r
- DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV )) &&\r
- ( ep->param.ep_state != DAT_EP_STATE_UNCONNECTED &&\r
- ep->param.ep_state != DAT_EP_STATE_RESERVED &&\r
- ep->param.ep_state != DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep));\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Validate handles being modified\r
- */\r
- if ( ep_param_mask & DAT_EP_FIELD_PZ_HANDLE )\r
- {\r
- if (ep_param->pz_handle != NULL &&\r
- DAPL_BAD_HANDLE (ep_param->pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_RECV_EVD_HANDLE )\r
- {\r
- if (ep_param->recv_evd_handle != NULL &&\r
- (DAPL_BAD_HANDLE (ep_param->recv_evd_handle, DAPL_MAGIC_EVD) ||\r
- ! ((DAPL_EVD *)ep_param->recv_evd_handle)->evd_flags & DAT_EVD_DTO_FLAG))\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_REQUEST_EVD_HANDLE )\r
- {\r
- if (ep_param->request_evd_handle != NULL &&\r
- DAPL_BAD_HANDLE (ep_param->request_evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_CONNECT_EVD_HANDLE )\r
- {\r
- if (ep_param->connect_evd_handle != NULL &&\r
- DAPL_BAD_HANDLE (ep_param->connect_evd_handle, DAPL_MAGIC_EVD) &&\r
- ! (((DAPL_EVD *)ep_param->connect_evd_handle)->evd_flags & DAT_EVD_CONNECTION_FLAG) )\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * Validate the attributes against the HCA limits\r
- */\r
- ep_attr = ep->param.ep_attr;\r
-\r
- dapl_os_memzero (&ep_attr_limit, sizeof (DAT_EP_ATTR));\r
- dat_status = dapls_ib_query_hca (ia->hca_ptr, NULL, &ep_attr_limit, NULL);\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- goto bail;\r
- }\r
-\r
- ep_attr_request = ep_param->ep_attr;\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_SERVICE_TYPE )\r
- {\r
- if ( ep_attr_request.service_type != DAT_SERVICE_TYPE_RC )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_MESSAGE_SIZE )\r
- {\r
- if ( ep_attr_request.max_mtu_size > ep_attr_limit.max_mtu_size)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.max_mtu_size = ep_attr_request.max_mtu_size;\r
- }\r
- }\r
-\r
- /* Do nothing if the DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE flag is */\r
- /* set. Each RDMA transport/provider may or may not have a limit */\r
- /* on the size of an RDMA DTO. For InfiniBand, this parameter is */\r
- /* validated in the implementation of the dapls_ib_qp_modify() */\r
- /* function. */\r
- /* */\r
- /* if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE ) */\r
- /* { */\r
- /* */\r
- /* } */\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_QOS )\r
- {\r
- /* Do nothing, not defined in the spec yet */\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_RECV_COMPLETION_FLAGS )\r
- {\r
- dat_status = dapl_ep_check_recv_completion_flags (\r
- ep_attr_request.recv_completion_flags);\r
- if ( dat_status != DAT_SUCCESS )\r
-\r
- {\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.recv_completion_flags =\r
- ep_attr_request.recv_completion_flags;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_REQUEST_COMPLETION_FLAGS )\r
- {\r
- dat_status = dapl_ep_check_request_completion_flags (\r
- ep_attr_request.request_completion_flags);\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.request_completion_flags =\r
- ep_attr_request.request_completion_flags;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS )\r
- {\r
- if ( ep_attr_request.max_recv_dtos > ep_attr_limit.max_recv_dtos ||\r
- ( ep_param->recv_evd_handle == DAT_HANDLE_NULL &&\r
- ( ep_attr_request.max_recv_dtos > 0 ) ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.max_recv_dtos = ep_attr_request.max_recv_dtos;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS )\r
- {\r
- if ( ep_attr_request.max_request_dtos > ep_attr_limit.max_request_dtos ||\r
- ( ep_param->request_evd_handle == DAT_HANDLE_NULL &&\r
- ( ep_attr_request.max_request_dtos > 0 ) ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.max_request_dtos = ep_attr_request.max_request_dtos;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV )\r
- {\r
- if ( ep_attr_request.max_recv_iov > ep_attr_limit.max_recv_iov)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.max_recv_iov = ep_attr_request.max_recv_iov;\r
- }\r
- }\r
-\r
- if ( ep_param_mask & DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV )\r
- {\r
- if ( ep_attr_request.max_request_iov > ep_attr_limit.max_request_iov)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- else\r
- {\r
- ep_attr.max_request_iov = ep_attr_request.max_request_iov;\r
- }\r
- }\r
-\r
- *ia_ptr = ia;\r
- *ep_ptr = ep;\r
- *ep_attr_ptr = ep_attr;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_post_rdma_read.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ep_util.h"\r
-\r
-/*\r
- * dapl_ep_post_rdma_read\r
- *\r
- * DAPL Requirements Version xxx, 6.5.12\r
- *\r
- * Request the xfer of all data specified by the remote_iov over the\r
- * connection of ep handle Endpint into the local_iov\r
- *\r
- * Input:\r
- * ep_handle\r
- * num_segments\r
- * local_iov\r
- * user_cookie\r
- * remote_iov\r
- * completion_flags\r
- *\r
- * Output:\r
- * None.\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_LENGTH_ERROR\r
- * DAT_PROTECTION_VIOLATION\r
- * DAT_PRIVILEGES_VIOLATION\r
- */\r
-DAT_RETURN\r
-dapl_ep_post_rdma_read (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN const DAT_RMR_TRIPLET *remote_iov,\r
- IN DAT_COMPLETION_FLAGS completion_flags)\r
-{\r
-\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_post_rdma_read (%p, %d, %p, %p, %p, %x)\n",\r
- ep_handle, \r
- num_segments, \r
- local_iov, \r
- user_cookie.as_64,\r
- remote_iov, \r
- completion_flags);\r
- DAPL_CNTR(DCNT_POST_RDMA_READ);\r
-\r
- dat_status = dapl_ep_post_send_req(ep_handle, \r
- num_segments, \r
- local_iov, \r
- user_cookie, \r
- remote_iov, \r
- completion_flags, \r
- DAPL_DTO_TYPE_RDMA_READ,\r
- OP_RDMA_READ);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, \r
- "dapl_ep_post_rdma_read () returns 0x%x", \r
- dat_status);\r
-\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_post_rdma_write.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ep_util.h"\r
-\r
-/*\r
- * dapl_ep_post_rdma_write\r
- *\r
- * DAPL Requirements Version xxx, 6.5.13\r
- *\r
- * Request the xfer of all data specified by the local_iov over the\r
- * connection of ep handle Endpint into the remote_iov\r
- *\r
- * Input:\r
- * ep_handle\r
- * num_segments\r
- * local_iov\r
- * user_cookie\r
- * remote_iov\r
- * compltion_flags\r
- *\r
- * Output:\r
- * None.\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_LENGTH_ERROR\r
- * DAT_PROTECTION_VIOLATION\r
- * DAT_PRIVILEGES_VIOLATION\r
- */\r
-DAT_RETURN\r
-dapl_ep_post_rdma_write (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN const DAT_RMR_TRIPLET *remote_iov,\r
- IN DAT_COMPLETION_FLAGS completion_flags )\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_post_rdma_write (%p, %d, %p, %#I64x, %p, %x)\n",\r
- ep_handle, \r
- num_segments, \r
- local_iov, \r
- user_cookie.as_64,\r
- remote_iov, \r
- completion_flags);\r
- DAPL_CNTR(DCNT_POST_RDMA_WRITE);\r
-\r
- dat_status = dapl_ep_post_send_req(ep_handle, \r
- num_segments, \r
- local_iov, \r
- user_cookie, \r
- remote_iov, \r
- completion_flags, \r
- DAPL_DTO_TYPE_RDMA_WRITE,\r
- OP_RDMA_WRITE);\r
- if (dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN,\r
- "dapl_ep_post_rdma_write () returns 0x%x", dat_status);\r
- }\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_post_recv.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_ep_post_recv\r
- *\r
- * DAPL Requirements Version xxx, 6.5.11\r
- *\r
- * Request to receive data over the connection of ep handle into\r
- * local_iov\r
- *\r
- * Input:\r
- * ep_handle\r
- * num_segments\r
- * local_iov\r
- * user_cookie\r
- * completion_flags\r
- *\r
- * Output:\r
- * None.\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_PROTECTION_VIOLATION\r
- * DAT_PROVILEGES_VIOLATION\r
- */\r
-DAT_RETURN\r
-dapl_ep_post_recv (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags )\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_COOKIE *cookie;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_post_recv (%p, %d, %p, %P, %x)\n",\r
- ep_handle,\r
- num_segments,\r
- local_iov,\r
- user_cookie.as_64,\r
- completion_flags);\r
- DAPL_CNTR (DCNT_POST_RECV);\r
-\r
- if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Synchronization ok since this buffer is only used for receive\r
- * requests, which aren't allowed to race with each other.\r
- */\r
- dat_status = dapls_dto_cookie_alloc (&ep_ptr->recv_buffer,\r
- DAPL_DTO_TYPE_RECV,\r
- user_cookie,\r
- &cookie);\r
- if ( DAT_SUCCESS != dat_status)\r
- {\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Take reference before posting to avoid race conditions with\r
- * completions\r
- */\r
- dapl_os_atomic_inc (&ep_ptr->recv_count);\r
-\r
- /*\r
- * Invoke provider specific routine to post DTO\r
- */\r
- dat_status = dapls_ib_post_recv (ep_ptr, cookie, num_segments, local_iov);\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->recv_count);\r
- dapls_cookie_dealloc (&ep_ptr->recv_buffer, cookie);\r
- }\r
-\r
-bail:\r
- if (dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_ep_post_recv () returns 0x%x\n",\r
- dat_status);\r
- }\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_post_send.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ep_util.h"\r
-\r
-/*\r
- * dapl_ep_post_send\r
- *\r
- * DAPL Requirements Version xxx, 6.5.10\r
- *\r
- * Request a transfer of all the data from the local_iov over\r
- * the connection of the ep handle Endpoint to the remote side.\r
- *\r
- * Input:\r
- * ep_handle\r
- * num_segments\r
- * local_iov\r
- * user_cookie\r
- * completion_flags\r
- *\r
- * Output:\r
- * None\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_PROTECTION_VIOLATION\r
- * DAT_PRIVILEGES_VIOLATION\r
- */\r
-DAT_RETURN\r
-dapl_ep_post_send (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags )\r
-{\r
- DAT_RMR_TRIPLET remote_iov = {0,0,0,0};\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_post_send (%p, %d, %p, %I64x, %x)\n",\r
- ep_handle, \r
- num_segments, \r
- local_iov, \r
- user_cookie.as_64,\r
- completion_flags);\r
- DAPL_CNTR(DCNT_POST_SEND);\r
-\r
- dat_status = dapl_ep_post_send_req(ep_handle,\r
- num_segments,\r
- local_iov,\r
- user_cookie,\r
- &remote_iov,\r
- completion_flags,\r
- DAPL_DTO_TYPE_SEND,\r
- OP_SEND);\r
- if (dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_ep_post_send () returns 0x%x\n",\r
- dat_status);\r
- }\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_query.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_ep_query\r
- *\r
- * DAPL Requirements Version xxx, 6.5.5\r
- *\r
- * Provide the consumer parameters, including attributes and status of\r
- * the Endpoint.\r
- *\r
- * Input:\r
- * ep_handle\r
- * ep_param_mask\r
- *\r
- * Output:\r
- * ep_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_ep_query (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EP_PARAM_MASK ep_param_mask,\r
- OUT DAT_EP_PARAM *ep_param )\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ep_query (%p, %x, %p)\n", \r
- ep_handle, \r
- ep_param_mask, \r
- ep_param);\r
-\r
- dat_status = DAT_SUCCESS;\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Verify parameter & state\r
- */\r
- if ( DAPL_BAD_HANDLE(ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- if ( ep_param == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- \r
- /*\r
- * Fill in according to user request\r
- *\r
- * N.B. Just slam all values into the user structure, there\r
- * is nothing to be gained by checking for each bit.\r
- */ \r
- if ( ep_param_mask & DAT_EP_FIELD_ALL )\r
- {\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED )\r
- {\r
- /* obtain the remote IP address */\r
- dat_status = dapls_ib_cm_remote_addr ((DAT_HANDLE)ep_handle,\r
- NULL,\r
- &ep_ptr->remote_ia_address );\r
- }\r
- ep_ptr->param.remote_ia_address_ptr = \r
- (DAT_IA_ADDRESS_PTR) &ep_ptr->remote_ia_address;\r
- *ep_param = ep_ptr->param;\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ep_reset.c\r
- *\r
- * PURPOSE: Endpoint management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 5.13\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-/*\r
- * dapl_ep_reset\r
- *\r
- * DAPL Requirements Version 1.1, 6.5.13\r
- *\r
- * Reset the QP attached to this Endpoint, transitioning back to the\r
- * INIT state\r
- *\r
- * Input:\r
- * ep_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN\r
-dapl_ep_reset (\r
- IN DAT_EP_HANDLE ep_handle)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Verify parameter & state\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- if ( ep_ptr->param.ep_state != DAT_EP_STATE_UNCONNECTED\r
- && ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED )\r
- {\r
- dat_status = dapls_ib_reinit_ep ( ep_ptr );\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ep_util.c\r
- *\r
- * PURPOSE: Manage EP Info structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ep_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-\r
-/*\r
- * Local definitions\r
- */\r
-/*\r
- * Default number of I/O operations on an end point\r
- */\r
-#define IB_IO_DEFAULT 16\r
-\r
-/*\r
- * Default number of scatter/gather entries available to a single\r
- * post send/recv\r
- */\r
-#define IB_IOV_DEFAULT 4\r
-\r
-/*\r
- * Default number of RDMA operations in progress at a time\r
- */\r
-#define IB_RDMA_DEFAULT 4 \r
-\r
-extern void dapli_ep_default_attrs (\r
- IN DAPL_EP *ep_ptr );\r
-\r
-\r
-/*\r
- * dapl_ep_alloc\r
- *\r
- * alloc and initialize an EP INFO struct\r
- *\r
- * Input:\r
- * IA INFO struct ptr\r
- *\r
- * Output:\r
- * ep_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_EP *\r
-dapl_ep_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN const DAT_EP_ATTR *ep_attr )\r
-{\r
- DAPL_EP *ep_ptr;\r
-\r
- /* Allocate EP */\r
- ep_ptr = (DAPL_EP *)dapl_os_alloc (sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR));\r
- if ( ep_ptr == NULL )\r
- {\r
- goto bail;\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (ep_ptr, sizeof (DAPL_EP)+ sizeof (DAT_SOCK_ADDR));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- ep_ptr->header.provider = ia_ptr->header.provider;\r
- ep_ptr->header.magic = DAPL_MAGIC_EP;\r
- ep_ptr->header.handle_type = DAT_HANDLE_TYPE_EP;\r
- ep_ptr->header.owner_ia = ia_ptr;\r
- ep_ptr->header.user_context.as_64 = 0;\r
- ep_ptr->header.user_context.as_ptr = NULL;\r
-\r
- dapl_llist_init_entry (&ep_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&ep_ptr->header.lock);\r
-\r
- /*\r
- * Initialize the body\r
- */\r
- dapl_os_memzero (&ep_ptr->param, sizeof (DAT_EP_PARAM));\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
- ep_ptr->param.local_ia_address_ptr = \r
- (DAT_IA_ADDRESS_PTR)&ia_ptr->hca_ptr->hca_address;\r
- /* Set the remote address pointer to the end of the EP struct */\r
- ep_ptr->param.remote_ia_address_ptr = (DAT_IA_ADDRESS_PTR)(ep_ptr + 1);\r
-\r
- /*\r
- * Set up default parameters if the user passed in a NULL\r
- */\r
- if ( ep_attr == NULL )\r
- {\r
- dapli_ep_default_attrs (ep_ptr);\r
- }\r
- else\r
- {\r
- ep_ptr->param.ep_attr = *ep_attr;\r
- }\r
-\r
- /*\r
- * IBM OS API specific fields\r
- */\r
- ep_ptr->qp_handle = IB_INVALID_HANDLE;\r
- ep_ptr->qpn = 0;\r
- ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
- cl_memclr( &ep_ptr->cm_handle, sizeof(ib_cm_handle_t) );\r
- ep_ptr->cm_handle.cid = 0xFFFFFFFF;\r
-\r
- ep_ptr->req_count = 0;\r
- ep_ptr->recv_count = 0;\r
-\r
- ep_ptr->recv_discreq = DAT_FALSE;\r
- ep_ptr->sent_discreq = DAT_FALSE;\r
-\r
- /* allocate viol event queue size = max_recv_dtos / 2 */\r
- if (DAT_SUCCESS != dapls_rbuf_alloc (\r
- &ep_ptr->viol_event_queue, \r
- ep_ptr->param.ep_attr.max_recv_dtos / 2) )\r
- {\r
- dapl_ep_dealloc (ep_ptr);\r
- ep_ptr = NULL;\r
- goto bail;\r
- }\r
- ep_ptr->viol_order = DAT_FALSE;\r
-\r
- if ( DAT_SUCCESS != dapls_cb_create (\r
- &ep_ptr->req_buffer,\r
- ep_ptr,\r
- ep_ptr->param.ep_attr.max_request_dtos) )\r
- {\r
- dapl_ep_dealloc (ep_ptr);\r
- ep_ptr = NULL;\r
- goto bail;\r
- }\r
-\r
- if ( DAT_SUCCESS != dapls_cb_create (\r
- &ep_ptr->recv_buffer,\r
- ep_ptr,\r
- ep_ptr->param.ep_attr.max_recv_dtos) )\r
- {\r
- dapl_ep_dealloc (ep_ptr);\r
- ep_ptr = NULL;\r
- goto bail;\r
- }\r
-\r
- ep_ptr->recv_iov_num = ep_ptr->param.ep_attr.max_recv_iov;\r
- ep_ptr->send_iov_num = ep_ptr->param.ep_attr.max_request_iov;\r
-\r
- ep_ptr->recv_iov = dapl_os_alloc (\r
- ep_ptr->recv_iov_num * sizeof (ib_data_segment_t));\r
-\r
- if ( NULL == ep_ptr->recv_iov )\r
- {\r
- dapl_ep_dealloc (ep_ptr);\r
- ep_ptr = NULL;\r
- goto bail;\r
- }\r
-\r
- ep_ptr->send_iov = dapl_os_alloc (\r
- ep_ptr->send_iov_num * sizeof (ib_data_segment_t));\r
-\r
- if ( NULL == ep_ptr->send_iov )\r
- {\r
- dapl_ep_dealloc (ep_ptr);\r
- ep_ptr = NULL;\r
- goto bail;\r
- }\r
-\r
- dapls_io_trc_alloc (ep_ptr);\r
-\r
-bail:\r
- return ep_ptr;\r
-}\r
-\r
-\r
-/*\r
- * dapl_ep_dealloc\r
- *\r
- * Free the passed in EP structure.\r
- *\r
- * Input:\r
- * entry point pointer\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ep_dealloc (\r
- IN DAPL_EP *ep_ptr )\r
-{\r
- dapl_os_assert (ep_ptr->header.magic == DAPL_MAGIC_EP);\r
-\r
- ep_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
-\r
- dapls_cb_free ( &ep_ptr->req_buffer );\r
- dapls_cb_free ( &ep_ptr->recv_buffer );\r
-\r
- if ( NULL != ep_ptr->recv_iov )\r
- {\r
- dapl_os_free (ep_ptr->recv_iov, ep_ptr->recv_iov_num * sizeof (ib_data_segment_t));\r
- }\r
-\r
- if ( NULL != ep_ptr->send_iov )\r
- {\r
- dapl_os_free (ep_ptr->send_iov, ep_ptr->send_iov_num * sizeof (ib_data_segment_t));\r
- }\r
-\r
- if ( NULL != ep_ptr->cxn_timer )\r
- {\r
- dapl_os_free ( ep_ptr->cxn_timer, sizeof ( DAPL_OS_TIMER ) );\r
- }\r
-\r
- dapl_os_free (ep_ptr, sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR) );\r
-}\r
-\r
-\r
-/*\r
- * dapl_ep_default_attrs\r
- *\r
- * Set default values in the parameter fields\r
- *\r
- * Input:\r
- * entry point pointer\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapli_ep_default_attrs (\r
- IN DAPL_EP *ep_ptr )\r
-{\r
- DAT_EP_ATTR *ep_attr;\r
-\r
- ep_attr = &ep_ptr->param.ep_attr;\r
- /* Set up defaults */\r
- dapl_os_memzero (ep_attr, sizeof (DAT_EP_ATTR));\r
-\r
- /* mtu and rdma sizes fixed in IB as per IBTA 1.1, 9.4.3, 9.4.4, 9.7.7. */\r
- ep_attr->max_mtu_size = 0x80000000;\r
- ep_attr->max_rdma_size = 0x80000000;\r
-\r
- ep_attr->qos = DAT_QOS_BEST_EFFORT;\r
- ep_attr->service_type = DAT_SERVICE_TYPE_RC;\r
- ep_attr->max_recv_dtos = IB_IO_DEFAULT;\r
- ep_attr->max_request_dtos = IB_IO_DEFAULT;\r
- ep_attr->max_recv_iov = IB_IOV_DEFAULT;\r
- ep_attr->max_request_iov = IB_IOV_DEFAULT;\r
- ep_attr->max_rdma_read_in = IB_RDMA_DEFAULT;\r
- ep_attr->max_rdma_read_out= IB_RDMA_DEFAULT;\r
-\r
- /*\r
- * Configure the EP as a standard completion type, which will be\r
- * used by the EVDs. A threshold of 1 is the default state of an\r
- * EVD.\r
- */\r
- ep_attr->request_completion_flags = DAT_COMPLETION_EVD_THRESHOLD_FLAG;\r
- ep_attr->recv_completion_flags = DAT_COMPLETION_EVD_THRESHOLD_FLAG;\r
- /*\r
- * Unspecified defaults:\r
- * - ep_privileges: No RDMA capabilities\r
- * - num_transport_specific_params: none\r
- * - transport_specific_params: none\r
- * - num_provider_specific_params: 0\r
- * - provider_specific_params: 0\r
- */\r
-\r
- return;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_ep_check_recv_completion_flags (\r
- DAT_COMPLETION_FLAGS flags )\r
-{\r
-\r
- /*\r
- * InfiniBand will not allow signal suppression for RECV completions,\r
- * see the 1.0.1 spec section 10.7.3.1, 10.8.6.\r
- * N.B. SIGNALLED has a different meaning in dapl than it does\r
- * in IB; IB SIGNALLED is the same as DAPL SUPPRESS. DAPL\r
- * SIGNALLED simply means the user will not get awakened when\r
- * an EVD completes, even though the dapl handler is invoked.\r
- */\r
-\r
- if (flags & DAT_COMPLETION_SUPPRESS_FLAG)\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-DAT_RETURN\r
-dapl_ep_check_request_completion_flags (\r
- DAT_COMPLETION_FLAGS flags )\r
-{\r
- UNREFERENCED_PARAMETER(flags);\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_ep_post_send_req (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN const DAT_RMR_TRIPLET *remote_iov,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- IN DAPL_DTO_TYPE dto_type,\r
- IN ib_send_op_type_t op_type)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_COOKIE *cookie = NULL;\r
- DAT_RETURN dat_status;\r
-\r
- if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /*\r
- * Synchronization ok since this buffer is only used for send\r
- * requests, which aren't allowed to race with each other.\r
- * Only if completion is expected\r
- */\r
- if (!(DAT_COMPLETION_SUPPRESS_FLAG & completion_flags))\r
- {\r
- dat_status = dapls_dto_cookie_alloc (\r
- &ep_ptr->req_buffer, \r
- dto_type,\r
- user_cookie, \r
- &cookie );\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- goto bail;\r
- }\r
- dapl_os_atomic_inc (&ep_ptr->req_count);\r
- }\r
-\r
- /*\r
- * Invoke provider specific routine to post DTO\r
- */\r
- dat_status = dapls_ib_post_send ( ep_ptr,\r
- op_type,\r
- cookie,\r
- num_segments,\r
- local_iov,\r
- remote_iov,\r
- completion_flags );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- if ( cookie != NULL )\r
- {\r
- dapls_cookie_dealloc (&ep_ptr->req_buffer, cookie);\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
- }\r
- }\r
- \r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapli_ep_timeout\r
- *\r
- * If this routine is invoked before a connection occurs, generate an\r
- * event\r
- */\r
-void\r
-dapls_ep_timeout (\r
- void *arg )\r
-{\r
- DAPL_EP *ep_ptr;\r
- ib_cm_events_t ib_cm_event;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, "--> dapls_ep_timeout! ep %lx\n", arg);\r
-\r
- ep_ptr = (DAPL_EP *)arg;\r
-\r
- /* reset the EP state */\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
-\r
- /* Clean up the EP and put the underlying QP into the ERROR state.\r
- * The disconnect_clean interface requires the provided dependent \r
- *cm event number.\r
- */\r
- ib_cm_event = dapls_ib_get_cm_event (DAT_CONNECTION_EVENT_DISCONNECTED);\r
- dapls_ib_disconnect_clean ( ep_ptr,\r
- DAT_TRUE,\r
- ib_cm_event );\r
-\r
- (void) dapls_evd_post_connection_event (\r
- (DAPL_EVD *)ep_ptr->param.connect_evd_handle,\r
- DAT_CONNECTION_EVENT_TIMED_OUT,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- 0);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ep_state_subtype\r
- *\r
- * Return the INVALID_STATE connection subtype associated with an\r
- * INVALID_STATE on an EP. Strictly for error reporting.\r
- */\r
-DAT_RETURN_SUBTYPE\r
-dapls_ep_state_subtype(\r
- IN DAPL_EP *ep_ptr )\r
-{\r
- DAT_RETURN_SUBTYPE dat_status;\r
-\r
- switch ( ep_ptr->param.ep_state )\r
- {\r
- case DAT_EP_STATE_UNCONNECTED:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_UNCONNECTED;\r
- break;\r
- }\r
- case DAT_EP_STATE_RESERVED:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_RESERVED;\r
- break;\r
- }\r
- case DAT_EP_STATE_PASSIVE_CONNECTION_PENDING:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_PASSCONNPENDING;\r
- break;\r
- }\r
- case DAT_EP_STATE_ACTIVE_CONNECTION_PENDING:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_ACTCONNPENDING;\r
- break;\r
- }\r
- case DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_TENTCONNPENDING;\r
- break;\r
- }\r
- case DAT_EP_STATE_CONNECTED:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_CONNECTED;\r
- break;\r
- }\r
- case DAT_EP_STATE_DISCONNECT_PENDING:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_DISCPENDING;\r
- break;\r
- }\r
- case DAT_EP_STATE_DISCONNECTED:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_DISCONNECTED;\r
- break;\r
- }\r
- case DAT_EP_STATE_COMPLETION_PENDING:\r
- {\r
- dat_status = DAT_INVALID_STATE_EP_COMPLPENDING;\r
- break;\r
- }\r
-\r
- default:\r
- {\r
- dat_status = 0;\r
- break;\r
- }\r
- }\r
-\r
- return dat_status;\r
-}\r
-\r
-#ifdef DAPL_DBG_IO_TRC\r
-/* allocate trace buffer */\r
-void\r
-dapls_io_trc_alloc (\r
- DAPL_EP *ep_ptr)\r
-{\r
- DAT_RETURN dat_status;\r
- int i;\r
- struct io_buf_track *ibt;\r
-\r
- ep_ptr->ibt_dumped = 0; /* bool to control how often we print */\r
- dat_status = dapls_rbuf_alloc (&ep_ptr->ibt_queue, DBG_IO_TRC_QLEN);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
- ibt = (struct io_buf_track *)dapl_os_alloc (sizeof (struct io_buf_track) * DBG_IO_TRC_QLEN);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapls_rbuf_destroy (&ep_ptr->ibt_queue);\r
- goto bail;\r
- }\r
- ep_ptr->ibt_base = ibt;\r
- dapl_os_memzero (ibt, sizeof (struct io_buf_track) * DBG_IO_TRC_QLEN);\r
-\r
- /* add events to free event queue */\r
- for (i = 0; i < DBG_IO_TRC_QLEN; i++)\r
- {\r
- dapls_rbuf_add (&ep_ptr->ibt_queue, ibt++);\r
- }\r
-bail:\r
- return;\r
-}\r
-#endif /* DAPL_DBG_IO_TRC */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_ep_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the EP data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_EP_UTIL_H_\r
-#define _DAPL_EP_UTIL_H_\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/* function prototypes */\r
-\r
-extern DAPL_EP * \r
-dapl_ep_alloc (\r
- IN DAPL_IA *ia,\r
- IN const DAT_EP_ATTR *ep_attr );\r
-\r
-extern void \r
-dapl_ep_dealloc (\r
- IN DAPL_EP *ep_ptr );\r
-\r
-extern DAT_RETURN \r
-dapl_ep_check_recv_completion_flags (\r
- DAT_COMPLETION_FLAGS flags );\r
-\r
-extern DAT_RETURN \r
-dapl_ep_check_request_completion_flags (\r
- DAT_COMPLETION_FLAGS flags );\r
-\r
-extern DAT_RETURN\r
-dapl_ep_post_send_req (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN DAT_DTO_COOKIE user_cookie,\r
- IN const DAT_RMR_TRIPLET *remote_iov,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- IN DAPL_DTO_TYPE dto_type,\r
- IN ib_send_op_type_t op_type );\r
-\r
-void dapls_ep_timeout (void *arg );\r
-\r
-DAT_RETURN_SUBTYPE\r
-dapls_ep_state_subtype(\r
- IN DAPL_EP *ep_ptr );\r
-\r
-#endif /* _DAPL_EP_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_clear_unwaitable.c\r
- *\r
- * PURPOSE: EVENT management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.4.8\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_evd_clear_unwaitable\r
- *\r
- * DAPL Requirements Version 1.1, 6.3.4.8\r
- *\r
- * Transition the Event Dispatcher into a waitable state\r
- *\r
- * Input:\r
- * evd_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-DAT_RETURN\r
-dapl_evd_clear_unwaitable (\r
- IN DAT_EVD_HANDLE evd_handle )\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- dapl_os_lock ( &evd_ptr->header.lock );\r
- evd_ptr->evd_waitable = DAT_TRUE;\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_evd_connection_callback.c\r
- *\r
- * PURPOSE: implements connection callbacks\r
- *\r
- * Description: Accepts asynchronous callbacks from the Communications Manager\r
- * for EVDs that have been specified as the connection_evd.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_timer_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-\r
-/*\r
- * dapl_evd_connection_callback\r
- *\r
- * Connection callback function for ACTIVE connection requests; callbacks\r
- * generated by the Connection Manager in response to issuing a\r
- * connect call.\r
- *\r
- * Input:\r
- * ib_cm_handle,\r
- * ib_cm_event\r
- * private_data_ptr\r
- * context (evd)\r
- * cr_pp\r
- *\r
- * Output:\r
- * None\r
- *\r
- */\r
-\r
-void\r
-dapl_evd_connection_callback (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN const ib_cm_events_t ib_cm_event,\r
- IN const void *private_data_ptr,\r
- IN const void *context)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_PRIVATE *prd_ptr;\r
- DAT_EVENT_NUMBER dat_event_num;\r
- DAT_RETURN dat_status;\r
- int private_data_size;\r
-\r
-\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "--> dapl_evd_connection_callback: ctxt: %p event: %x cm_handle %d\n",\r
- context,\r
- ib_cm_event,\r
- ib_cm_handle.cid);\r
- DAPL_CNTR(DCNT_EVD_CONN_CALLBACK);\r
-\r
- /*\r
- * Determine the type of handle passed back to us in the context\r
- * and sort out key parameters.\r
- */\r
- if ( context == NULL || ((DAPL_HEADER *)context)->magic != DAPL_MAGIC_EP)\r
- {\r
- return;\r
- }\r
-\r
- /*\r
- * Active side of the connection, context is an EP and\r
- * PSP is irrelevant.\r
- */\r
- ep_ptr = (DAPL_EP *) context;\r
- evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
-\r
- prd_ptr = (DAPL_PRIVATE *)private_data_ptr;\r
- private_data_size = 0;\r
- /*\r
- * All operations effect the EP, so lock it once and unlock\r
- * when necessary\r
- */\r
- dapl_os_lock (&ep_ptr->header.lock);\r
-\r
- /*\r
- * If a connection timer has been set up on this EP, cancel it now\r
- */\r
- if ( ep_ptr->cxn_timer != NULL )\r
- {\r
- dapls_timer_cancel ( ep_ptr->cxn_timer );\r
- dapl_os_free ( ep_ptr->cxn_timer, sizeof ( DAPL_OS_TIMER ) );\r
- ep_ptr->cxn_timer = NULL;\r
- }\r
-\r
- /* Obtain the event number from the provider layer */\r
- dat_event_num = dapls_ib_get_dat_event (ib_cm_event, DAT_TRUE);\r
-\r
- switch (dat_event_num)\r
- {\r
- case DAT_CONNECTION_EVENT_ESTABLISHED:\r
- {\r
- /* If we don't have an EP at this point we are very screwed\r
- * up\r
- */\r
- if ( ep_ptr->param.ep_state != DAT_EP_STATE_ACTIVE_CONNECTION_PENDING)\r
- {\r
- /* If someone pulled the plug on the connection, just\r
- * exit\r
- */\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dat_status = DAT_SUCCESS;\r
- break;\r
- }\r
- ep_ptr->param.ep_state = DAT_EP_STATE_CONNECTED;\r
- ep_ptr->cm_handle = ib_cm_handle;\r
- if (prd_ptr == NULL)\r
- {\r
- private_data_size = 0;\r
- }\r
- else\r
- {\r
- private_data_size = \r
- dapls_ib_private_data_size (prd_ptr, DAPL_PDATA_CONN_REP);\r
- }\r
-\r
- if (private_data_size > 0)\r
- {\r
- /* copy in the private data */\r
- dapl_os_memcpy ( ep_ptr->private_data,\r
- prd_ptr->private_data,\r
- DAPL_MIN (private_data_size, DAPL_MAX_PRIVATE_DATA_SIZE));\r
- }\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_DISCONNECTED:\r
- {\r
- /*\r
- * EP is now fully disconnected; initiate any post processing\r
- * to reset the underlying QP and get the EP ready for\r
- * another connection\r
- */\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- ep_ptr->recv_discreq = DAT_FALSE;\r
- ep_ptr->sent_discreq = DAT_FALSE;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_TRUE, ib_cm_event);\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_PEER_REJECTED:\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_TRUE, ib_cm_event);\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_UNREACHABLE:\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_TRUE, ib_cm_event);\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_TRUE, ib_cm_event);\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_EVENT_BROKEN:\r
- {\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapls_ib_disconnect_clean (ep_ptr, DAT_FALSE, ib_cm_event);\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
-\r
- break;\r
- }\r
- case DAT_CONNECTION_REQUEST_EVENT:\r
- default:\r
- {\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
- evd_ptr = NULL;\r
-\r
- dapl_os_assert (0); /* shouldn't happen */\r
- break;\r
- }\r
- }\r
-\r
- /*\r
- * Post the event\r
- * If the EP has been freed, the evd_ptr will be NULL\r
- */\r
- if ( evd_ptr != NULL )\r
- {\r
- dat_status = dapls_evd_post_connection_event (\r
- evd_ptr,\r
- dat_event_num,\r
- (DAT_HANDLE) ep_ptr,\r
- private_data_size, /* 0 except for CONNECTED */\r
- ep_ptr->private_data );\r
-\r
- if (dat_status != DAT_SUCCESS && \r
- dat_event_num == DAT_CONNECTION_EVENT_ESTABLISHED)\r
- {\r
- /* We can't tell the user we are connected, something\r
- * is wrong locally. Just kill the connection and\r
- * reset the state to DISCONNECTED as we don't\r
- * expect a callback on an ABRUPT disconnect.\r
- */\r
- dapls_ib_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
- }\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "dapl_evd_connection_callback () returns\n");\r
-\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_cq_async_error_callback.c\r
- *\r
- * PURPOSE: implements CQ async_callbacks from verbs\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-\r
-/*\r
- * dapl_evd_cq_async_error_callback\r
- *\r
- * The callback function registered with verbs for cq async errors\r
- *\r
- * Input:\r
- * ib_hca_handle,\r
- * error_ptr\r
- * context (evd)\r
- *\r
- * Output:\r
- * None\r
- *\r
- */\r
-\r
-void \r
-dapl_evd_cq_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *error_ptr,\r
- IN void *context)\r
-\r
-{\r
- DAPL_EVD *async_evd;\r
- DAPL_EVD *evd;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION ,\r
- "dapl_evd_cq_async_error_callback (%p, %p, %p)\n",\r
- ib_hca_handle, \r
- error_ptr, \r
- context);\r
-\r
- if ( NULL == context )\r
- {\r
- dapl_os_panic ("NULL == context\n");\r
- }\r
-\r
- evd = (DAPL_EVD *) context;\r
- async_evd = evd->header.owner_ia->async_error_evd;\r
-\r
- dat_status = dapls_evd_post_async_error_event(\r
- async_evd,\r
- DAT_ASYNC_ERROR_EVD_OVERFLOW,\r
- (DAT_IA_HANDLE) async_evd->header.owner_ia);\r
-\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_os_panic ("async EVD overflow\n");\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION ,\r
- "dapl_evd_cq_async_error_callback () returns\n");\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_create.c\r
- *\r
- * PURPOSE: EVENT management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-\r
-/*\r
- * dapl_evd_create\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.1\r
- *\r
- * Create and instance of Event Dispatcher.\r
- *\r
- * Input:\r
- * ia_handle\r
- * cno_handle\r
- * evd_min_qlen\r
- * evd_flags\r
- *\r
- * Output:\r
- * evd_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-\r
-/* ** REVISIT **\r
- *\r
- * Selecting the cqe handing domain must still be done.\r
- * We *probably* want one per hca, but we could have one\r
- * per provider or one per consumer.\r
- */\r
-/* Note that if there already is a cq, it is not deleted\r
- * even if it is not required. However, it will not be armed.\r
- */\r
-\r
-DAT_RETURN dapl_evd_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_COUNT evd_min_qlen,\r
- IN DAT_CNO_HANDLE cno_handle,\r
- IN DAT_EVD_FLAGS evd_flags,\r
- OUT DAT_EVD_HANDLE *evd_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
- DAT_PROVIDER_ATTR provider_attr;\r
- int i;\r
- int j;\r
- int flag_mask[6];\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_evd_create (%p, %d, %p, 0x%x, %p)\n", \r
- ia_handle, \r
- evd_min_qlen, \r
- cno_handle, \r
- evd_flags, \r
- evd_handle);\r
- DAPL_CNTR(DCNT_EVD_CREATE);\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- cno_ptr = (DAPL_CNO *)cno_handle;\r
- evd_ptr = NULL;\r
- *evd_handle = NULL;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (ia_handle, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
-\r
- if ( evd_min_qlen <= 0 )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- if ( evd_min_qlen > ia_ptr->hca_ptr->ia_attr.max_evd_qlen )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_TEVD);\r
- goto bail;\r
- }\r
-\r
- if (cno_handle != DAT_HANDLE_NULL\r
- && DAPL_BAD_HANDLE(cno_handle, DAPL_MAGIC_CNO)) \r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_CNO);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Check the merging attributes to ensure the combination of\r
- * flags requested is supported.\r
- */\r
- dapl_ia_query (ia_handle, NULL,\r
- 0, NULL,\r
- DAT_PROVIDER_FIELD_ALL, &provider_attr);\r
- \r
- /* Set up an array of flags to compare against; the EVD bits are\r
- * a sparse array that need to be mapped to the merging flags\r
- */\r
- flag_mask[0] = DAT_EVD_SOFTWARE_FLAG;\r
- flag_mask[1] = DAT_EVD_CR_FLAG;\r
- flag_mask[2] = DAT_EVD_DTO_FLAG;\r
- flag_mask[3] = DAT_EVD_CONNECTION_FLAG;\r
- flag_mask[4] = DAT_EVD_RMR_BIND_FLAG;\r
- flag_mask[5] = DAT_EVD_ASYNC_FLAG;\r
-\r
- for (i = 0; i < 6; i++)\r
- {\r
- if (flag_mask[i] & evd_flags)\r
- {\r
- for (j = 0; j < 6; j++)\r
- {\r
- if (flag_mask[j] & evd_flags)\r
- {\r
- if (provider_attr.evd_stream_merging_supported[i][j] == DAT_FALSE)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
- }\r
- } /* end for j */\r
- }\r
- } /* end for i */\r
-\r
- dat_status = dapls_evd_internal_create (ia_ptr, \r
- cno_ptr, \r
- evd_min_qlen, \r
- evd_flags,\r
- &evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- evd_ptr->evd_state = DAPL_EVD_STATE_OPEN;\r
-\r
- *evd_handle = (DAT_EVD_HANDLE) evd_ptr;\r
-\r
-bail:\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- if (evd_ptr)\r
- {\r
- dapl_evd_free (evd_ptr);\r
- }\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN,\r
- "dapl_evd_create () returns 0x%x\n", \r
- dat_status);\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_dequeue.c\r
- *\r
- * PURPOSE: Event Management\r
- *\r
- * Description: Interfaces in this file are completely described in\r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ring_buffer_util.h"\r
-#include "dapl_evd_util.h"\r
-\r
-/*\r
- * dapl_evd_dequeue\r
- * \r
- * DAPL Requirements Version xxx, 6.3.2.7\r
- * \r
- * Remove first element from an event dispatcher\r
- * \r
- * Input:\r
- * evd_handle\r
- * \r
- * Output:\r
- * event\r
- * \r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_QUEUE_EMPTY\r
- */\r
-\r
-DAT_RETURN dapl_evd_dequeue (\r
- IN DAT_EVD_HANDLE evd_handle,\r
- OUT DAT_EVENT *event)\r
-\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_EVENT *local_event;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVENT_DQ,\r
- "dapl_evd_dequeue (%p, %p)\n",\r
- evd_handle, \r
- event);\r
-\r
- DAPL_CNTR(DCNT_EVD_DEQUEUE);\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
-\r
- if (event == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * We need to dequeue under lock, as the IB OS Access API\r
- * restricts us from having multiple threads in CQ poll, and the\r
- * DAPL 1.1 API allows multiple threads in dat_evd_dequeue()\r
- */\r
- dapl_os_lock ( &evd_ptr->header.lock );\r
-\r
- /*\r
- * Make sure there are no other waiters and the evd is active.\r
- * Currently this means only the OPEN state is allowed.\r
- */\r
- if (evd_ptr->evd_state != DAPL_EVD_STATE_OPEN || \r
- evd_ptr->catastrophic_overflow)\r
- {\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Try the EVD rbuf first; poll from the CQ only if that's empty.\r
- * This keeps events in order if dat_evd_wait() has copied events\r
- * from CQ to EVD. \r
- */\r
- local_event = (DAT_EVENT *)dapls_rbuf_remove(&evd_ptr->pending_event_queue);\r
- if (local_event != NULL)\r
- {\r
- *event = *local_event;\r
- dat_status = dapls_rbuf_add (&evd_ptr->free_event_queue, local_event);\r
- DAPL_CNTR(DCNT_EVD_DEQUEUE_FOUND);\r
- }\r
- else if (evd_ptr->ib_cq_handle != IB_INVALID_HANDLE)\r
- {\r
- dat_status = dapls_evd_cq_poll_to_event(evd_ptr, event);\r
- DAPL_CNTR(DCNT_EVD_DEQUEUE_POLL);\r
- }\r
- else\r
- {\r
- dat_status = DAT_ERROR (DAT_QUEUE_EMPTY,0);\r
- DAPL_CNTR(DCNT_EVD_DEQUEUE_NOT_FOUND);\r
- }\r
-\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
- bail:\r
-\r
-#ifdef DAPL_DBG // XXX STAN\r
- if ( DAPL_DBG_TYPE_EVENT_DQ & g_dapl_dbg_type )\r
- {\r
- if ( dat_status && ((dat_status & 0xd0000) != 0xd0000) )\r
- {\r
- dapl_log (DAPL_DBG_TYPE_EVENT_DQ, "dapl_evd_dequeue () returns 0x%x\n", \r
- dat_status);\r
- }\r
- }\r
-#endif\r
-\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_disable.c\r
- *\r
- * PURPOSE: EVENT management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_evd_disable\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.5\r
- *\r
- * Modify the size fo the event queue of an Event Dispatcher\r
- *\r
- * Input:\r
- * evd_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-\r
-DAT_RETURN dapl_evd_disable (\r
- IN DAT_EVD_HANDLE evd_handle)\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
-\r
- evd_ptr->evd_enabled = DAT_FALSE;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_dto_callback.c\r
- *\r
- * PURPOSE: implements DTO callbacks from verbs\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_cno_util.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * dapl_evd_dto_callback\r
- *\r
- * Input:\r
- * hca_handle_in, \r
- * cq_handle_in, \r
- * user_context_cq_p\r
- *\r
- * Output:\r
- * none\r
- *\r
- * This is invoked for both DTO and MW bind completions. Strictly \r
- * speaking it is an event callback rather than just a DTO callback. \r
- *\r
- */\r
-\r
-void \r
-dapl_evd_dto_callback (\r
- IN ib_hca_handle_t hca_handle, \r
- IN ib_cq_handle_t cq_handle, \r
- IN void* user_context)\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
- DAPL_EVD_STATE state;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK,\r
- "dapl_evd_dto_callback(%p, %p, %p)\n",\r
- hca_handle, \r
- cq_handle, \r
- user_context);\r
- DAPL_CNTR(DCNT_EVD_DTO_CALLBACK);\r
-\r
- evd_ptr = (DAPL_EVD *) user_context;\r
-\r
- dapl_os_assert (hca_handle == evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle);\r
- dapl_os_assert (evd_ptr->ib_cq_handle == cq_handle);\r
- dapl_os_assert (evd_ptr->header.magic == DAPL_MAGIC_EVD);\r
-\r
- /* Read once. */\r
- state = *(volatile DAPL_EVD_STATE *) &evd_ptr->evd_state;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD, \r
- "--> dapl_evd_dto_callback: CQ %p, state %x\n", \r
- (void *)evd_ptr->ib_cq_handle, \r
- state);\r
-\r
- /*\r
- * This function does not dequeue from the CQ; only the consumer\r
- * can do that. Instead, it wakes up waiters if any exist.\r
- * It rearms the completion only if completions should always occur\r
- * (specifically if a CNO is associated with the EVD and the\r
- * EVD is enabled.\r
- */\r
- \r
- if (state == DAPL_EVD_STATE_WAITED)\r
- {\r
- /*\r
- * If we could, it would be best to avoid this wakeup\r
- * (and the context switch) unless the number of events/CQs\r
- * waiting for the waiter was its threshold. We don't\r
- * currently have the ability to determine that without\r
- * dequeueing the events, and we can't do that for\r
- * synchronization reasons (racing with the waiter waking\r
- * up and dequeuing, sparked by other callbacks).\r
- */\r
-\r
- /*\r
- * We don't need to worry about taking the lock for the\r
- * wakeup because wakeups are sticky.\r
- */\r
- if (evd_ptr->cq_wait_obj_handle)\r
- {\r
- dapls_ib_wait_object_wakeup(evd_ptr->cq_wait_obj_handle);\r
- }\r
- else\r
- {\r
- dapl_os_wait_object_wakeup(&evd_ptr->wait_object);\r
- }\r
- }\r
- else if (state == DAPL_EVD_STATE_OPEN)\r
- {\r
- DAPL_CNO *cno = evd_ptr->cno_ptr;\r
- if (evd_ptr->evd_enabled && (evd_ptr->cno_ptr != NULL))\r
- {\r
- /*\r
- * Re-enable callback, *then* trigger.\r
- * This guarantees we won't miss any events.\r
- */\r
- dat_status = dapls_ib_completion_notify (hca_handle, \r
- evd_ptr->ib_cq_handle, \r
- IB_NOTIFY_ON_NEXT_COMP);\r
- \r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- (void) dapls_evd_post_async_error_event(\r
- evd_ptr->header.owner_ia->async_error_evd,\r
- DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR,\r
- (DAT_IA_HANDLE) evd_ptr->header.owner_ia);\r
- }\r
-\r
- dapl_cno_trigger(cno, evd_ptr);\r
- }\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_evd_dto_callback () returns\n");\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_enable.c\r
- *\r
- * PURPOSE: EVENT management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_evd_enable\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.5\r
- *\r
- * Modify the size fo the event queue of an Event Dispatcher\r
- *\r
- * Input:\r
- * evd_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-\r
-DAT_RETURN dapl_evd_enable (\r
- IN DAT_EVD_HANDLE evd_handle)\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
-\r
- evd_ptr->evd_enabled = DAT_TRUE;\r
-\r
- /* We need to enable the callback handler if there is a CNO. */\r
- if (evd_ptr->cno_ptr != NULL && \r
- evd_ptr->ib_cq_handle != IB_INVALID_HANDLE )\r
- {\r
- dat_status = dapls_ib_completion_notify (\r
- evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle,\r
- evd_ptr->ib_cq_handle, \r
- IB_NOTIFY_ON_NEXT_COMP);\r
-\r
- /* FIXME report error */\r
- dapl_os_assert(dat_status == DAT_SUCCESS);\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_evd_free.c\r
- *\r
- * PURPOSE: Event management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_cno_util.h" /* for __KDAPL__ */\r
-\r
-/*\r
- * dapl_evd_free\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.2\r
- *\r
- * Destroy a specific instance of the Event Dispatcher\r
- *\r
- * Input:\r
- * evd_handle\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN dapl_evd_free (\r
- IN DAT_EVD_HANDLE evd_handle)\r
-\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAPL_CNO *cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_evd_free (%p)\n", evd_handle);\r
- DAPL_CNTR (DCNT_EVD_FREE);\r
-\r
- dat_status = DAT_SUCCESS;\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
-\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, 0);\r
- goto bail;\r
- }\r
-\r
- if (evd_ptr->evd_ref_count != 0)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_IN_USE);\r
- goto bail;\r
- }\r
-\r
- /* obtain the cno_ptr before the evd is released, which must occur\r
- * before deallocating the CNO\r
- */\r
- cno_ptr = evd_ptr->cno_ptr;\r
-\r
- dapl_ia_unlink_evd (evd_ptr->header.owner_ia, evd_ptr);\r
-\r
- dat_status = dapls_evd_dealloc (evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_ia_link_evd (evd_ptr->header.owner_ia, evd_ptr);\r
- }\r
-\r
- if (cno_ptr != NULL)\r
- {\r
- if (cno_ptr->cno_ref_count == 0 && cno_ptr->cno_waiters > 0)\r
- {\r
- /*\r
- * Last reference on the CNO, trigger a notice. See\r
- * uDAPL 1.1 spec 6.3.2.3\r
- */\r
- dapl_cno_trigger (cno_ptr, NULL);\r
- }\r
- }\r
-\r
-bail:\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN,\r
- "dapl_evd_free () returns 0x%x\n",\r
- dat_status);\r
-\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_evd_modify_cno.c\r
- *\r
- * PURPOSE: Event Management\r
- *\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_evd_modify_cno\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.4\r
- *\r
- * Modify the CNO associated with the EVD\r
- *\r
- * Input:\r
- * evd_handle\r
- * cno_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCSSS\r
- * DAT_INVALID_HANDLE\r
- */\r
-\r
-DAT_RETURN dapl_evd_modify_cno (\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_CNO_HANDLE cno_handle)\r
-\r
-\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAPL_CNO *cno_ptr;\r
- DAPL_CNO *old_cno_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- cno_ptr = (DAPL_CNO *)cno_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, 0);\r
- goto bail;\r
- }\r
- if (cno_handle != NULL &&\r
- DAPL_BAD_HANDLE (cno_handle, DAPL_MAGIC_CNO))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO);\r
- goto bail;\r
- }\r
- dapl_os_lock (&evd_ptr->header.lock);\r
- old_cno_ptr = evd_ptr->cno_ptr;\r
- evd_ptr->cno_ptr = cno_ptr;\r
- dapl_os_unlock (&evd_ptr->header.lock);\r
- if (cno_ptr)\r
- {\r
- dapl_os_atomic_inc ( & (cno_ptr->cno_ref_count) );\r
- }\r
- if (old_cno_ptr)\r
- {\r
- dapl_os_atomic_dec ( & (old_cno_ptr->cno_ref_count) );\r
- }\r
-\r
- /* We need to enable the callback handler if the EVD is enabled. */\r
- if (evd_ptr->evd_enabled &&\r
- cno_handle != DAT_HANDLE_NULL &&\r
- evd_ptr->ib_cq_handle != IB_INVALID_HANDLE)\r
- {\r
- dat_status = dapls_ib_completion_notify (\r
- evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle,\r
- evd_ptr->ib_cq_handle,\r
- IB_NOTIFY_ON_NEXT_COMP);\r
-\r
- /* FIXME report error */\r
- dapl_os_assert (dat_status == DAT_SUCCESS);\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_post_se.c\r
- *\r
- * PURPOSE: Event Management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_evd_post_se\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.7\r
- *\r
- * Post a software event to the Event Dispatcher event queue.\r
- *\r
- * Input:\r
- * evd_handle\r
- * event\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-\r
-\r
-DAT_RETURN dapl_evd_post_se (\r
- DAT_EVD_HANDLE evd_handle, \r
- const DAT_EVENT *event)\r
-\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- /* Only post to EVDs that are specific to software events */\r
- if ( !(evd_ptr->evd_flags & DAT_EVD_SOFTWARE_FLAG) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG1);\r
- goto bail;\r
- }\r
-\r
- if (!event)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- if (event->event_number != DAT_SOFTWARE_EVENT)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_evd_post_software_event(\r
- evd_ptr,\r
- DAT_SOFTWARE_EVENT,\r
- event->event_data.software_event_data.pointer);\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_qp_async_error_callback.c\r
- *\r
- * PURPOSE: implements QP callbacks from verbs\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_evd_qp_async_error_callback\r
- *\r
- * The callback function registered with verbs for qp async erros\r
- *\r
- * Maps to ib_async_handler_t as follow:\r
- *\r
- * typedef void (*ib_async_handler_t)(\r
- * IN ib_hca_handle_t ib_hca_handle,\r
- * IN ib_error_record_t *err_code,\r
- * IN void *context);\r
- *\r
- * Output:\r
- * None\r
- *\r
- */\r
-\r
-void \r
-dapl_evd_qp_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *err_code,\r
- IN void *context)\r
-\r
-{\r
- /*\r
- * This is an affiliated error and hence should be able to \r
- * supply us with exact information on the error type and QP. \r
- *\r
- * However IB vendor APIs for registering this callback \r
- * are different. \r
- *\r
- * Therefore we always specify the context as the asyncronous EVD \r
- * to be compatible with all APIs.\r
- */\r
-\r
- DAPL_IA *ia_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAPL_EVD *async_evd;\r
- DAT_EVENT_NUMBER async_event;\r
- DAT_RETURN dat_status;\r
- UNREFERENCED_PARAMETER(ib_hca_handle);\r
-\r
- ep_ptr = (DAPL_EP *) context;\r
- ia_ptr = ep_ptr->header.owner_ia;\r
- async_evd = (DAPL_EVD *) ia_ptr->async_error_evd;\r
-\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,\r
- "--> dapl_evd_qp_async_error_callback: ep %p qp %p (%x) state %d\n", \r
- ep_ptr, \r
- ep_ptr->qp_handle, \r
- ep_ptr->qpn,\r
- ep_ptr->param.ep_state);\r
-\r
- /*\r
- * Transition to ERROR if we are connected; other states need to\r
- * complete first (e.g. pending states)\r
- */\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED)\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_ERROR;\r
- }\r
-\r
- dapl_os_assert (async_evd != NULL);\r
-\r
- dat_status = dapls_ib_get_async_event(err_code, &async_event);\r
- if ( dat_status == DAT_SUCCESS )\r
- {\r
- /*\r
- * If dapls_ib_get_async_event is not successful,\r
- * an event has been generated by the provide that\r
- * we are not interested in.\r
- */\r
- (void) dapls_evd_post_async_error_event( async_evd,\r
- async_event,\r
- async_evd->header.owner_ia);\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,\r
- "dapl_evd_qp_async_error_callback () returns\n");\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_query.c\r
- *\r
- * PURPOSE: Event management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_evd_query\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.3\r
- *\r
- * Provides the consumer with arguments of the Event Dispatcher.\r
- *\r
- * Input:\r
- * evd_handle\r
- * evd_mask\r
- *\r
- * Output:\r
- * evd_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_evd_query (\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_EVD_PARAM_MASK evd_param_mask,\r
- OUT DAT_EVD_PARAM *evd_param )\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( NULL == evd_param )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- /* Note: the spec. allows for events to be directed to a NULL EVD */\r
- /* with handle of type DAT_HANDLE_NULL. See 6.3.1 */\r
- if ( DAT_HANDLE_NULL == evd_handle )\r
- {\r
- dapl_os_memzero (evd_param, sizeof (DAT_EVD_PARAM));\r
- }\r
- else\r
- {\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
-\r
- evd_ptr = (DAPL_EVD *) evd_handle;\r
-\r
- /*\r
- * We may be racing against the thread safe modify\r
- * calls here (dat_evd_{enable,disable,{set,clear}_unwaitable}).\r
- * They are thread safe, so our reads need to be atomic with\r
- * regard to those calls. The below is ok (a single bit\r
- * read counts as atomic; if it's in transition you'll get one\r
- * of the correct values) but we'll need to be careful\r
- * about reading the state variable atomically when we add\r
- * in waitable/unwaitable.\r
- */\r
- if (evd_param_mask & DAT_EVD_FIELD_ALL )\r
- {\r
- evd_param->evd_state =\r
- (evd_ptr->evd_enabled ? DAT_EVD_STATE_ENABLED : DAT_EVD_STATE_DISABLED);\r
- evd_param->evd_state |=\r
- (evd_ptr->evd_waitable ? DAT_EVD_STATE_WAITABLE : DAT_EVD_STATE_UNWAITABLE);\r
- evd_param->ia_handle = evd_ptr->header.owner_ia;\r
- evd_param->evd_qlen = evd_ptr->qlen;\r
- evd_param->cno_handle = (DAT_CNO_HANDLE) evd_ptr->cno_ptr;\r
- evd_param->evd_flags = evd_ptr->evd_flags;\r
- }\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_resize.c\r
- *\r
- * PURPOSE: EVENT management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API, Chapter 6, section 3\r
- *\r
- * $Id$\r
- **********************************************************************/\r
- \r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-/*\r
- * dapl_evd_resize\r
- *\r
- * DAPL Requirements Version xxx, 6.3.2.5\r
- *\r
- * Modify the size fo the event queue of an Event Dispatcher\r
- *\r
- * Input:\r
- * evd_handle\r
- * evd_qlen\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_STATE\r
- */\r
-\r
-DAT_RETURN dapl_evd_resize (\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_COUNT evd_qlen )\r
-{\r
- \r
- DAPL_EVD *evd_ptr;\r
- DAT_EVENT *event_ptr;\r
- DAT_EVENT *events;\r
- DAT_EVENT *orig_event;\r
- DAPL_RING_BUFFER free_event_queue;\r
- DAPL_RING_BUFFER pending_event_queue;\r
- DAT_COUNT i;\r
- DAT_COUNT pend_cnt;\r
-\r
- evd_ptr = (DAPL_EVD *) evd_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_evd_resize (%p, %d)\n",\r
- evd_handle, evd_qlen);\r
-\r
- if (DAPL_BAD_HANDLE (evd_ptr, DAPL_MAGIC_EVD))\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG1);\r
- }\r
- if (evd_qlen <= 0)\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- }\r
-\r
- dapl_os_lock(&evd_ptr->header.lock);\r
-\r
- if (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INVALID_STATE,0);\r
- }\r
-\r
- pend_cnt = dapls_rbuf_count(&evd_ptr->pending_event_queue);\r
- if (pend_cnt > evd_qlen) {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INVALID_STATE,0);\r
- }\r
-\r
- if (DAT_SUCCESS != dapls_ib_cq_resize(evd_ptr->header.owner_ia,\r
- evd_ptr,\r
- &evd_qlen)) {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
-\r
- /* Allocate EVENTs */\r
- events = (DAT_EVENT *) dapl_os_alloc (evd_qlen * sizeof (DAT_EVENT));\r
- if (!events)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- event_ptr = events;\r
-\r
- /* allocate free event queue */\r
- \r
- if (DAT_SUCCESS != dapls_rbuf_alloc (&free_event_queue, evd_qlen))\r
- {\r
- dapl_os_free(event_ptr, evd_qlen * sizeof (DAT_EVENT));\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
-\r
- /* allocate pending event queue */\r
- if (DAT_SUCCESS != dapls_rbuf_alloc (&pending_event_queue, evd_qlen))\r
- {\r
- dapl_os_free(event_ptr, evd_qlen * sizeof (DAT_EVENT));\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
-\r
- for (i = 0; i < pend_cnt; i++) {\r
- orig_event = dapls_rbuf_remove(&evd_ptr->pending_event_queue);\r
- if (orig_event == NULL) {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, " Inconsistent event queue\n");\r
- dapl_os_free(event_ptr, evd_qlen * sizeof (DAT_EVENT));\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- memcpy(event_ptr, orig_event, sizeof(DAT_EVENT));\r
- if (DAT_SUCCESS != dapls_rbuf_add(&pending_event_queue, event_ptr)) {\r
- dapl_os_free(event_ptr, evd_qlen * sizeof (DAT_EVENT));\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- event_ptr++;\r
- }\r
-\r
- for (i = pend_cnt; i < evd_qlen; i++)\r
- {\r
- if (DAT_SUCCESS != dapls_rbuf_add(&free_event_queue,\r
- (void *) event_ptr)) {\r
- dapl_os_free(event_ptr, evd_qlen * sizeof (DAT_EVENT));\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- event_ptr++;\r
- }\r
-\r
- dapls_rbuf_destroy (&evd_ptr->free_event_queue);\r
- dapls_rbuf_destroy (&evd_ptr->pending_event_queue);\r
- if (evd_ptr->events)\r
- {\r
- dapl_os_free (evd_ptr->events, evd_ptr->qlen * sizeof (DAT_EVENT));\r
- }\r
- evd_ptr->free_event_queue = free_event_queue;\r
- evd_ptr->pending_event_queue = pending_event_queue;\r
- evd_ptr->events = events;\r
- evd_ptr->qlen = evd_qlen;\r
-\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN,\r
- "dapl_evd_resize returns SUCCESS\n");\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_set_unwaitable.c\r
- *\r
- * PURPOSE: EVENT management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 3.4.7\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-/*\r
- * dapl_evd_set_unwaitable\r
- *\r
- * DAPL Requirements Version 1.1, 6.3.4.7\r
- *\r
- * Transition the Event Dispatcher into an unwaitable state\r
- *\r
- * Input:\r
- * evd_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-DAT_RETURN\r
-dapl_evd_set_unwaitable (\r
- IN DAT_EVD_HANDLE evd_handle )\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
-\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- dapl_os_lock ( &evd_ptr->header.lock );\r
- evd_ptr->evd_waitable = DAT_FALSE;\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- /*\r
- * If this evd is waiting, wake it up. There is an obvious race\r
- * condition here where we may wakeup the waiter before it goes to\r
- * sleep; but the wait_object allows this and will do the right\r
- * thing.\r
- */\r
- if (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED)\r
- {\r
- if (evd_ptr->cq_wait_obj_handle)\r
- {\r
- dapls_ib_wait_object_wakeup (evd_ptr->cq_wait_obj_handle);\r
- }\r
- else\r
- {\r
- dapl_os_wait_object_wakeup (&evd_ptr->wait_object);\r
- }\r
- }\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_un_async_error_callback.c\r
- *\r
- * PURPOSE: implements Unaffiliated callbacks from verbs\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_evd_un_async_error_callback\r
- *\r
- * The callback function registered with verbs for unaffiliated async errors\r
- *\r
- * Input:\r
- * ib_hca_handle,\r
- * error_ptr\r
- * context (async_evd)\r
- *\r
- * Output:\r
- * None\r
- *\r
- */\r
-\r
-void \r
-dapl_evd_un_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *error_ptr,\r
- IN void *context)\r
-\r
-{\r
- DAPL_EVD *async_evd;\r
- DAT_EVENT_NUMBER async_event;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,\r
- "dapl_evd_un_async_error_callback (%p, %p, %p)\n", \r
- ib_hca_handle, \r
- error_ptr, \r
- context);\r
-\r
- if ( NULL == context )\r
- {\r
- dapl_os_panic ("NULL == context\n");\r
- return;\r
- }\r
-\r
- async_evd = (DAPL_EVD *) context;\r
-\r
- dat_status = dapls_ib_get_async_event(error_ptr, &async_event);\r
-\r
- if ( dat_status == DAT_SUCCESS )\r
- {\r
- /*\r
- * If dapls_ib_get_async_event is not successful,\r
- * an event has been generated by the provider that\r
- * we are not interested in. E.g. LINK_UP.\r
- */\r
- dapls_evd_post_async_error_event( async_evd,\r
- async_event,\r
- async_evd->header.owner_ia);\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,\r
- "dapl_evd_un_async_error_callback () returns\n");\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_evd_util.c\r
- *\r
- * PURPOSE: Manage EVD Info structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_cno_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl.h"\r
-\r
-STATIC _INLINE_ void dapli_evd_eh_print_cqe (\r
- IN ib_work_completion_t cqe);\r
-\r
-DAT_RETURN dapli_evd_event_alloc (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAT_COUNT qlen);\r
-\r
-\r
-/*\r
- * dapls_evd_internal_create\r
- *\r
- * actually create the evd. this is called after all parameter checking\r
- * has been performed in dapl_ep_create. it is also called from dapl_ia_open\r
- * to create the default async evd.\r
- *\r
- * Input:\r
- * ia_ptr\r
- * cno_ptr\r
- * qlen\r
- * evd_flags\r
- *\r
- * Output:\r
- * evd_ptr_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-\r
-DAT_RETURN\r
-dapls_evd_internal_create (\r
- DAPL_IA *ia_ptr,\r
- DAPL_CNO *cno_ptr,\r
- DAT_COUNT min_qlen,\r
- DAT_EVD_FLAGS evd_flags,\r
- DAPL_EVD **evd_ptr_ptr)\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_COUNT cq_len;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- *evd_ptr_ptr = NULL;\r
- cq_len = min_qlen;\r
-\r
- evd_ptr = dapls_evd_alloc (ia_ptr,\r
- cno_ptr,\r
- evd_flags,\r
- min_qlen);\r
- if (!evd_ptr)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * If we are dealing with event streams besides a CQ event stream,\r
- * be conservative and set producer side locking. Otherwise, no.\r
- */\r
- evd_ptr->evd_producer_locking_needed =\r
- ((evd_flags & ~ (DAT_EVD_DTO_FLAG|DAT_EVD_RMR_BIND_FLAG)) != 0);\r
-\r
- /* Before we setup any callbacks, transition state to OPEN. */\r
- evd_ptr->evd_state = DAPL_EVD_STATE_OPEN;\r
-\r
- if (evd_flags & DAT_EVD_ASYNC_FLAG)\r
- {\r
- /*\r
- * There is no cq associate with async evd. Set it to invalid\r
- */\r
- evd_ptr->ib_cq_handle = IB_INVALID_HANDLE;\r
-\r
- }\r
- else if ( 0 != (evd_flags & ~ (DAT_EVD_SOFTWARE_FLAG\r
- | DAT_EVD_CONNECTION_FLAG\r
- | DAT_EVD_CR_FLAG) ) )\r
- {\r
-\r
-#if defined(_VENDOR_IBAL_)\r
-\r
- /* \r
- * The creation of CQ required a PD (PZ) associated with it and\r
- * we do not have a PD here; therefore, the work-around is that we\r
- * will postpone the creation of the cq till the creation of QP which\r
- * this cq will associate with.\r
- */\r
- evd_ptr->ib_cq_handle = IB_INVALID_HANDLE;\r
-\r
-#else\r
-\r
- dat_status = dapls_ib_cq_alloc (ia_ptr,\r
- evd_ptr,\r
- &cq_len);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_setup_async_callback (ia_ptr,\r
- DAPL_ASYNC_CQ_COMPLETION,\r
- (unsigned int *) evd_ptr->ib_cq_handle,\r
- (ib_async_handler_t)dapl_evd_dto_callback,\r
- evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_set_cq_notify (ia_ptr, evd_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
-#endif /* _VENDOR_IBAL_ */\r
-\r
- }\r
-\r
- /* We now have an accurate count of events, so allocate them into\r
- * the EVD\r
- */\r
- dat_status = dapli_evd_event_alloc (evd_ptr, cno_ptr, cq_len);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* We're assuming success in the following. */\r
- dapl_os_assert (dat_status == DAT_SUCCESS);\r
- dapl_ia_link_evd (ia_ptr, evd_ptr);\r
- *evd_ptr_ptr = evd_ptr;\r
-\r
-bail:\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- if (evd_ptr)\r
- {\r
- dapls_evd_dealloc (evd_ptr);\r
- }\r
- }\r
-\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * dapls_evd_alloc\r
- *\r
- * alloc and initialize an EVD struct\r
- *\r
- * Input:\r
- * ia\r
- *\r
- * Output:\r
- * evd_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_EVD *\r
-dapls_evd_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAT_EVD_FLAGS evd_flags,\r
- IN DAT_COUNT qlen)\r
-{\r
- DAPL_EVD *evd_ptr;\r
- UNREFERENCED_PARAMETER(cno_ptr);\r
- evd_ptr = NULL;\r
-\r
- /* Allocate EVD */\r
- evd_ptr = (DAPL_EVD *)dapl_os_alloc (sizeof (DAPL_EVD));\r
- if (!evd_ptr)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (evd_ptr, sizeof (DAPL_EVD));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- evd_ptr->header.provider = ia_ptr->header.provider;\r
- evd_ptr->header.magic = DAPL_MAGIC_EVD;\r
- evd_ptr->header.handle_type = DAT_HANDLE_TYPE_EVD;\r
- evd_ptr->header.owner_ia = ia_ptr;\r
- evd_ptr->header.user_context.as_64 = 0;\r
- evd_ptr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&evd_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&evd_ptr->header.lock);\r
-\r
- /*\r
- * Initialize the body\r
- */\r
- evd_ptr->evd_state = DAPL_EVD_STATE_INITIAL;\r
- evd_ptr->evd_flags = evd_flags;\r
- evd_ptr->evd_enabled = DAT_TRUE;\r
- evd_ptr->evd_waitable = DAT_TRUE;\r
- evd_ptr->evd_producer_locking_needed = 1;/* Conservative value. */\r
- evd_ptr->ib_cq_handle = IB_INVALID_HANDLE;\r
- evd_ptr->evd_ref_count = 0;\r
- evd_ptr->catastrophic_overflow = DAT_FALSE;\r
- evd_ptr->qlen = qlen;\r
- evd_ptr->completion_type = DAPL_EVD_STATE_THRESHOLD; /* FIXME: should be DAPL_EVD_STATE_INIT */\r
- dapl_os_wait_object_init (&evd_ptr->wait_object);\r
- evd_ptr->cq_wait_obj_handle = 0;\r
- //dapls_ib_wait_object_create (&evd_ptr->cq_wait_obj_handle);\r
-\r
-bail:\r
- return evd_ptr;\r
-}\r
-\r
-\r
-/*\r
- * dapls_evd_event_alloc\r
- *\r
- * alloc events into an EVD.\r
- *\r
- * Input:\r
- * evd_ptr\r
- * qlen\r
- *\r
- * Output:\r
- * NONE\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * ERROR\r
- *\r
- */\r
-DAT_RETURN\r
-dapli_evd_event_alloc (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAT_COUNT qlen)\r
-{\r
- DAT_EVENT *event_ptr;\r
- DAT_COUNT i;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- event_ptr = NULL;\r
-\r
- /* Allocate EVENTs */\r
- event_ptr = (DAT_EVENT *) dapl_os_alloc (evd_ptr->qlen * sizeof (DAT_EVENT));\r
- if (!event_ptr)\r
- {\r
- goto bail;\r
- }\r
- evd_ptr->events = event_ptr;\r
-\r
- /* allocate free event queue */\r
- dat_status = dapls_rbuf_alloc (&evd_ptr->free_event_queue, qlen);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* allocate pending event queue */\r
- dat_status = dapls_rbuf_alloc (&evd_ptr->pending_event_queue, qlen);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* add events to free event queue */\r
- for (i = 0; i < evd_ptr->qlen; i++)\r
- {\r
- dapls_rbuf_add (&evd_ptr->free_event_queue, (void *)event_ptr);\r
- event_ptr++;\r
- }\r
-\r
- evd_ptr->cq_notified = DAT_FALSE;\r
- evd_ptr->cq_notified_when = 0;\r
- evd_ptr->cno_active_count = 0;\r
- if ( cno_ptr != NULL )\r
- {\r
- /* Take a reference count on the CNO */\r
- dapl_os_atomic_inc ( &cno_ptr->cno_ref_count );\r
- }\r
- evd_ptr->cno_ptr = cno_ptr;\r
- evd_ptr->threshold = 0;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * dapls_evd_event_realloc\r
- *\r
- * realloc events into an EVD.\r
- *\r
- * Input:\r
- * evd_ptr\r
- * qlen\r
- *\r
- * Output:\r
- * NONE\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * ERROR\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_evd_event_realloc (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_COUNT qlen)\r
-{\r
- DAT_EVENT *event_ptr;\r
- DAT_COUNT i;\r
- DAT_RETURN dat_status;\r
-\r
- /* Allocate EVENTs */\r
- event_ptr = (DAT_EVENT *) dapl_os_realloc (evd_ptr->events,\r
- qlen * sizeof (DAT_EVENT));\r
- if (event_ptr == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- evd_ptr->events = event_ptr;\r
-\r
- /* allocate free event queue */\r
- dat_status = dapls_rbuf_realloc (&evd_ptr->free_event_queue, qlen);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* allocate pending event queue */\r
- dat_status = dapls_rbuf_realloc (&evd_ptr->pending_event_queue, qlen);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- evd_ptr->qlen = qlen;\r
-\r
- /*\r
- * add events to free event queue. Need to verify that an entry is\r
- * not on the current queues before putting it on the free queue\r
- */\r
- for (i = 0; i < qlen; i++, event_ptr++)\r
- {\r
- if (dapls_rbuf_contains (&evd_ptr->free_event_queue, event_ptr)\r
- || dapls_rbuf_contains (&evd_ptr->pending_event_queue, event_ptr))\r
- {\r
- continue;\r
- }\r
- dapls_rbuf_add (&evd_ptr->free_event_queue, (void *)event_ptr);\r
- }\r
-\r
-bail:\r
-\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * dapls_evd_dealloc\r
- *\r
- * Free the passed in EVD structure. If an error occurs, this function \r
- * will clean up all of the internal data structures and report the \r
- * error.\r
- *\r
- * Input:\r
- * evd_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * status\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_evd_dealloc (\r
- IN DAPL_EVD *evd_ptr )\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_IA *ia_ptr;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- dapl_os_assert (evd_ptr->header.magic == DAPL_MAGIC_EVD);\r
- dapl_os_assert (evd_ptr->evd_ref_count == 0);\r
- \r
- /*\r
- * Destroy the CQ first, to keep any more callbacks from coming\r
- * up from it.\r
- */\r
- if (evd_ptr->ib_cq_handle != IB_INVALID_HANDLE)\r
- {\r
- ia_ptr = evd_ptr->header.owner_ia;\r
-\r
- dat_status = dapls_ib_cq_free (ia_ptr, evd_ptr);\r
- \r
- if (dat_status != DAT_SUCCESS)\r
- { \r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "dapl_evd_dealloc failed to rel. CQ %p \n",\r
- evd_ptr->ib_cq_handle);\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * We should now be safe to invalidate the EVD; reset the\r
- * magic to prevent reuse.\r
- */\r
- evd_ptr->header.magic = DAPL_MAGIC_INVALID; \r
-\r
- /* Release reference on the CNO if it exists */\r
- if ( evd_ptr->cno_ptr != NULL )\r
- {\r
- dapl_os_atomic_dec ( &evd_ptr->cno_ptr->cno_ref_count );\r
- evd_ptr->cno_ptr = NULL;\r
- }\r
-\r
- /* If the ring buffer allocation failed, then the dapls_rbuf_destroy */\r
- /* function will detect that the ring buffer's internal data (ex. base */\r
- /* pointer) are invalid and will handle the situation appropriately */\r
- dapls_rbuf_destroy (&evd_ptr->free_event_queue);\r
- dapls_rbuf_destroy (&evd_ptr->pending_event_queue);\r
-\r
- if (evd_ptr->events)\r
- {\r
- dapl_os_free (evd_ptr->events, evd_ptr->qlen * sizeof (DAT_EVENT));\r
- }\r
-\r
- dapl_os_wait_object_destroy (&evd_ptr->wait_object);\r
- if (evd_ptr->cq_wait_obj_handle)\r
- dapls_ib_wait_object_destroy (evd_ptr->cq_wait_obj_handle);\r
- dapl_os_free (evd_ptr, sizeof (DAPL_EVD));\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapli_evd_eh_print_cqe\r
- *\r
- * Input:\r
- * cqe\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Prints out a CQE for debug purposes\r
- *\r
- */\r
-void\r
-dapli_evd_eh_print_cqe (\r
- IN ib_work_completion_t cqe)\r
-{\r
-#if defined(DAPL_DBG)\r
- static char *optable[] =\r
- {\r
- "INVALID_OP",\r
- "OP_SEND",\r
- "OP_RDMA_WRITE",\r
- "OP_RDMA_READ",\r
- "OP_COMP_AND_SWAP",\r
- "OP_FETCH_AND_ADD",\r
- "OP_RECEIVE",\r
- "OP_BIND_MW",\r
- "INVALID_OP"\r
- };\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, \r
- "\t >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<\n");\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, \r
- "\t dapl_evd_dto: CQE \n");\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, "\t\t work_req_id 0x" F64x "\n",\r
- DAPL_GET_CQE_WRID(&cqe)); \r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, "\t\t op_type: %s\n", \r
- optable[DAPL_GET_CQE_OPTYPE(&cqe)] );\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, "\t\t bytes_num %d\n", \r
- DAPL_GET_CQE_BYTESNUM(&cqe));\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, "\t\t status %d\n",\r
- DAPL_GET_CQE_STATUS(&cqe));\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, \r
- "\t >>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<\n");\r
-#endif /* DAPL_DBG */\r
-}\r
-\r
-\r
-\r
-\r
-/*\r
- * Event posting code follows.\r
- */\r
-\r
-/*\r
- * These next two functions (dapli_evd_get_event and dapli_evd_post_event)\r
- * are a pair. They are always called together, from one of the functions\r
- * at the end of this file (dapl_evd_post_*_event).\r
- *\r
- * Note that if producer side locking is enabled, the first one takes the\r
- * EVD lock and the second releases it.\r
- */ \r
-\r
-/* dapli_evd_get_event\r
- *\r
- * Get an event struct from the evd. The caller should fill in the event\r
- * and call dapl_evd_post_event.\r
- *\r
- * If there are no events available, an overflow event is generated to the\r
- * async EVD handler.\r
- *\r
- * If this EVD required producer locking, a successful return implies\r
- * that the lock is held.\r
- *\r
- * Input:\r
- * evd_ptr\r
- *\r
- * Output:\r
- * event\r
- *\r
- */\r
-\r
-static DAT_EVENT *\r
-dapli_evd_get_event (\r
- DAPL_EVD *evd_ptr)\r
-{\r
- DAT_EVENT *event;\r
-\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_lock(&evd_ptr->header.lock);\r
- }\r
-\r
- event = (DAT_EVENT *)dapls_rbuf_remove (&evd_ptr->free_event_queue);\r
-\r
- /* Release the lock if it was taken and the call failed. */\r
- if (!event && evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
-\r
- return event;\r
-}\r
-\r
-/* dapli_evd_post_event\r
- *\r
- * Post the <event> to the evd. If possible, invoke the evd's CNO.\r
- * Otherwise post the event on the pending queue.\r
- *\r
- * If producer side locking is required, the EVD lock must be held upon\r
- * entry to this function.\r
- *\r
- * Input:\r
- * evd_ptr\r
- * event\r
- *\r
- * Output:\r
- * none\r
- *\r
- */\r
-\r
-static void \r
-dapli_evd_post_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN const DAT_EVENT *event_ptr)\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_CNO *cno_to_trigger = NULL;\r
-\r
- dapl_dbg_log(DAPL_DBG_TYPE_EVD,\r
- "--> dapli_evd_post_event: Called with event # %x %p\n",\r
- event_ptr->event_number, event_ptr);\r
-\r
- dat_status = dapls_rbuf_add (&evd_ptr->pending_event_queue,\r
- (void *)event_ptr);\r
- dapl_os_assert (dat_status == DAT_SUCCESS);\r
-\r
- dapl_os_assert (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED\r
- || evd_ptr->evd_state == DAPL_EVD_STATE_OPEN);\r
-\r
- if (evd_ptr->evd_state == DAPL_EVD_STATE_OPEN)\r
- {\r
- /* No waiter. Arrange to trigger a CNO if it exists. */\r
-\r
- if (evd_ptr->evd_enabled)\r
- {\r
- cno_to_trigger = evd_ptr->cno_ptr;\r
- }\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock (&evd_ptr->header.lock);\r
- }\r
- }\r
- else\r
- {\r
- DAT_COUNT total_events = 0;\r
- DAT_BOOLEAN wakeup = FALSE;\r
- DAT_UINT32 num_cqes = 0;\r
-\r
- /*\r
- * We're in DAPL_EVD_STATE_WAITED. Take the lock if\r
- * we don't have it, recheck, and signal.\r
- */\r
- if (!evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_lock(&evd_ptr->header.lock);\r
- }\r
-\r
- total_events = dapls_rbuf_count (&evd_ptr->pending_event_queue);\r
-\r
- if (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED\r
- && (total_events >= evd_ptr->threshold))\r
- \r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- wakeup = TRUE;\r
- }\r
- else if (total_events < evd_ptr->threshold)\r
- {\r
- dat_status = dapls_ib_peek_cq ( evd_ptr->ib_cq_handle, &num_cqes );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "--> DiEPE: peek_cq failed to rel. CQ %p \n",\r
- evd_ptr->ib_cq_handle);\r
- }\r
- else if ( (num_cqes >= (DAT_UINT32)(evd_ptr->threshold - total_events)) )\r
- {\r
- if ( evd_ptr->evd_state == DAPL_EVD_STATE_WAITED )\r
- wakeup = TRUE;\r
- }\r
- else\r
- {\r
- if (evd_ptr->completion_type != DAPL_EVD_STATE_SOLICITED_WAIT) \r
- {\r
- dat_status = dapls_ib_n_completions_notify (\r
- evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle,\r
- evd_ptr->ib_cq_handle,\r
- evd_ptr->threshold - total_events ); \r
- }\r
- }\r
-\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
- else\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
-\r
- if (wakeup)\r
- {\r
- if (evd_ptr->cq_wait_obj_handle)\r
- {\r
- dapls_ib_wait_object_wakeup (evd_ptr->cq_wait_obj_handle);\r
- }\r
- else\r
- {\r
- dapl_os_wait_object_wakeup (&evd_ptr->wait_object);\r
- }\r
- }\r
- }\r
-\r
- if (cno_to_trigger != NULL)\r
- {\r
- dapl_cno_trigger(cno_to_trigger, evd_ptr);\r
- }\r
-}\r
-\r
-\r
-/* dapli_evd_post_event_nosignal\r
- *\r
- * Post the <event> to the evd. Do not do any wakeup processing.\r
- * This function should only be called if it is known that there are\r
- * no waiters that it is appropriate to wakeup on this EVD. An example\r
- * of such a situation is during internal dat_evd_wait() processing.\r
- *\r
- * If producer side locking is required, the EVD lock must be held upon\r
- * entry to this function.\r
- *\r
- * Input:\r
- * evd_ptr\r
- * event\r
- *\r
- * Output:\r
- * none\r
- *\r
- */\r
-\r
-static void \r
-dapli_evd_post_event_nosignal (\r
- IN DAPL_EVD *evd_ptr,\r
- IN const DAT_EVENT *event_ptr)\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD,\r
- "dapli_evd_post_event_nosignal: event # %x %p\n",\r
- event_ptr->event_number, event_ptr);\r
-\r
- dat_status = dapls_rbuf_add (&evd_ptr->pending_event_queue,\r
- (void *)event_ptr);\r
- dapl_os_assert (dat_status == DAT_SUCCESS);\r
-\r
- dapl_os_assert (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED\r
- || evd_ptr->evd_state == DAPL_EVD_STATE_OPEN);\r
-\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock (&evd_ptr->header.lock);\r
- }\r
-}\r
-\r
-/* dapli_evd_format_overflow_event\r
- *\r
- * format an overflow event for posting\r
- *\r
- * Input:\r
- * evd_ptr\r
- * event_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- */\r
-static void\r
-dapli_evd_format_overflow_event (\r
- IN DAPL_EVD *evd_ptr,\r
- OUT DAT_EVENT *event_ptr)\r
-{\r
- DAPL_IA *ia_ptr;\r
-\r
- ia_ptr = evd_ptr->header.owner_ia;\r
-\r
- event_ptr->evd_handle = (DAT_EVD_HANDLE)evd_ptr;\r
- event_ptr->event_number = DAT_ASYNC_ERROR_EVD_OVERFLOW;\r
- event_ptr->event_data.asynch_error_event_data.ia_handle = (DAT_IA_HANDLE)ia_ptr;\r
-}\r
-\r
-/* dapli_evd_post_overflow_event\r
- *\r
- * post an overflow event\r
- *\r
- * Input:\r
- * async_evd_ptr\r
- * evd_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- */\r
-static void\r
-dapli_evd_post_overflow_event (\r
- IN DAPL_EVD *async_evd_ptr,\r
- IN DAPL_EVD *overflow_evd_ptr)\r
-{\r
- DAT_EVENT *overflow_event;\r
-\r
- /* The overflow_evd_ptr mght be the same as evd.\r
- * In that case we've got a catastrophic overflow.\r
- */\r
- if (async_evd_ptr == overflow_evd_ptr)\r
- {\r
- async_evd_ptr->catastrophic_overflow = DAT_TRUE;\r
- async_evd_ptr->evd_state = DAPL_EVD_STATE_DEAD;\r
- return;\r
- }\r
-\r
- overflow_event = dapli_evd_get_event (overflow_evd_ptr);\r
- if (!overflow_event)\r
- {\r
- /* this is not good */\r
- overflow_evd_ptr->catastrophic_overflow = DAT_TRUE;\r
- overflow_evd_ptr->evd_state = DAPL_EVD_STATE_DEAD;\r
- return;\r
- }\r
- dapli_evd_format_overflow_event (overflow_evd_ptr, overflow_event);\r
- dapli_evd_post_event (overflow_evd_ptr, overflow_event);\r
-\r
- return;\r
-}\r
-\r
-static DAT_EVENT *\r
-dapli_evd_get_and_init_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number)\r
-{\r
- DAT_EVENT *event_ptr;\r
-\r
- event_ptr = dapli_evd_get_event (evd_ptr);\r
- if (NULL == event_ptr)\r
- {\r
- dapli_evd_post_overflow_event (\r
- evd_ptr->header.owner_ia->async_error_evd,\r
- evd_ptr);\r
- }\r
- else\r
- {\r
- event_ptr->evd_handle = (DAT_EVD_HANDLE) evd_ptr;\r
- event_ptr->event_number = event_number;\r
- }\r
-\r
- return event_ptr;\r
-}\r
-\r
-DAT_RETURN\r
-dapls_evd_post_cr_arrival_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_SP_HANDLE sp_handle,\r
- DAT_IA_ADDRESS_PTR ia_address_ptr,\r
- DAT_CONN_QUAL conn_qual,\r
- DAT_CR_HANDLE cr_handle)\r
-{\r
- DAT_EVENT *event_ptr;\r
- event_ptr = dapli_evd_get_and_init_event (evd_ptr, event_number);\r
- /*\r
- * Note event lock may be held on successful return\r
- * to be released by dapli_evd_post_event(), if provider side locking\r
- * is needed.\r
- */\r
-\r
- if (!event_ptr)\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- event_ptr->event_data.cr_arrival_event_data.sp_handle = sp_handle;\r
- event_ptr->event_data.cr_arrival_event_data.local_ia_address_ptr\r
- = ia_address_ptr;\r
- event_ptr->event_data.cr_arrival_event_data.conn_qual = conn_qual;\r
- event_ptr->event_data.cr_arrival_event_data.cr_handle = cr_handle;\r
-\r
- dapli_evd_post_event (evd_ptr, event_ptr);\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_evd_post_connection_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT private_data_size,\r
- IN DAT_PVOID private_data)\r
-{\r
- DAT_EVENT *event_ptr;\r
- event_ptr = dapli_evd_get_and_init_event (evd_ptr, event_number);\r
- /*\r
- * Note event lock may be held on successful return\r
- * to be released by dapli_evd_post_event(), if provider side locking\r
- * is needed.\r
- */\r
-\r
- if (!event_ptr)\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- event_ptr->event_data.connect_event_data.ep_handle = ep_handle;\r
- event_ptr->event_data.connect_event_data.private_data_size\r
- = private_data_size;\r
- event_ptr->event_data.connect_event_data.private_data = private_data;\r
-\r
- dapli_evd_post_event (evd_ptr, event_ptr);\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_evd_post_async_error_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_IA_HANDLE ia_handle)\r
-{\r
- DAT_EVENT *event_ptr;\r
- event_ptr = dapli_evd_get_and_init_event (evd_ptr, event_number);\r
- /*\r
- * Note event lock may be held on successful return\r
- * to be released by dapli_evd_post_event(), if provider side locking\r
- * is needed.\r
- */\r
-\r
- if (!event_ptr)\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- event_ptr->event_data.asynch_error_event_data.ia_handle = ia_handle;\r
-\r
- dapli_evd_post_event (evd_ptr, event_ptr);\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_evd_post_software_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_PVOID pointer)\r
-{\r
- DAT_EVENT *event_ptr;\r
- event_ptr = dapli_evd_get_and_init_event (evd_ptr, event_number);\r
- /*\r
- * Note event lock may be held on successful return\r
- * to be released by dapli_evd_post_event(), if provider side locking\r
- * is needed.\r
- */\r
-\r
- if (!event_ptr)\r
- {\r
- return DAT_QUEUE_FULL;\r
- }\r
-\r
- event_ptr->event_data.software_event_data.pointer = pointer;\r
-\r
- dapli_evd_post_event (evd_ptr, event_ptr);\r
- return DAT_SUCCESS;\r
-}\r
-\r
-/*\r
- * dapli_evd_cqe_to_event\r
- *\r
- * Convert a CQE into an event structure.\r
- *\r
- * Input:\r
- * evd_ptr\r
- * cqe_ptr\r
- *\r
- * Output:\r
- * event_ptr\r
- *\r
- * Returns:\r
- * ep_ptr\r
- *\r
- */\r
-static DAPL_EP *\r
-dapli_evd_cqe_to_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN ib_work_completion_t *cqe_ptr,\r
- OUT DAT_EVENT *event_ptr)\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_COOKIE *cookie;\r
- DAT_DTO_COMPLETION_STATUS dto_status;\r
-\r
- /*\r
- * All that can be relied on if the status is bad is the status\r
- * and WRID.\r
- */\r
- dto_status = dapls_ib_get_dto_status (cqe_ptr);\r
-\r
- cookie = (DAPL_COOKIE *) DAPL_GET_CQE_WRID (cqe_ptr);\r
- dapl_os_assert ( (NULL != cookie) );\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD,\r
- "dapli_evd_cqe_to_event: EP %p cqe %p cqe_type %#x dto_status %#x\n",\r
- cookie->ep, cookie, cookie->type, dto_status);\r
-\r
- ep_ptr = cookie->ep;\r
- dapl_os_assert ( (NULL != ep_ptr) );\r
- dapl_os_assert ( (ep_ptr->header.magic == DAPL_MAGIC_EP) ||\r
- (ep_ptr->header.magic == DAPL_MAGIC_EP_EXIT) );\r
-\r
- dapls_io_trc_update_completion (ep_ptr, cookie, dto_status);\r
-\r
- event_ptr->evd_handle = (DAT_EVD_HANDLE) evd_ptr;\r
-\r
- switch (cookie->type)\r
- {\r
- case DAPL_COOKIE_TYPE_DTO:\r
- {\r
- DAPL_COOKIE_BUFFER *buffer;\r
-\r
- if ( DAPL_DTO_TYPE_RECV == cookie->val.dto.type )\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->recv_count);\r
- buffer = &ep_ptr->recv_buffer;\r
- }\r
- else\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
- buffer = &ep_ptr->req_buffer;\r
- }\r
-\r
- event_ptr->event_number = DAT_DTO_COMPLETION_EVENT;\r
- event_ptr->event_data.dto_completion_event_data.ep_handle =\r
- cookie->ep;\r
- event_ptr->event_data.dto_completion_event_data.user_cookie =\r
- cookie->val.dto.cookie;\r
- event_ptr->event_data.dto_completion_event_data.status = dto_status;\r
-\r
-#ifdef DAPL_DBG\r
- if (dto_status == DAT_DTO_SUCCESS)\r
- {\r
- uint32_t ibtype;\r
-\r
- ibtype = DAPL_GET_CQE_OPTYPE (cqe_ptr);\r
-\r
- dapl_os_assert ((ibtype == OP_SEND &&\r
- cookie->val.dto.type == DAPL_DTO_TYPE_SEND)\r
- || (ibtype == OP_RECEIVE &&\r
- cookie->val.dto.type == DAPL_DTO_TYPE_RECV)\r
- || (ibtype == OP_RDMA_WRITE &&\r
- cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_WRITE)\r
- || (ibtype == OP_RDMA_READ &&\r
- cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_READ));\r
- }\r
-#endif /* DAPL_DBG */\r
-\r
- if ( cookie->val.dto.type == DAPL_DTO_TYPE_SEND ||\r
- cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_WRITE )\r
- {\r
- /* Get size from DTO; CQE value may be off. */\r
- event_ptr->event_data.dto_completion_event_data.transfered_length =\r
- cookie->val.dto.size;\r
- }\r
- else\r
- {\r
- event_ptr->event_data.dto_completion_event_data.transfered_length =\r
- DAPL_GET_CQE_BYTESNUM (cqe_ptr);\r
- }\r
-\r
- dapls_cookie_dealloc (buffer, cookie);\r
- break;\r
- }\r
-\r
- case DAPL_COOKIE_TYPE_RMR:\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
-\r
- event_ptr->event_number = DAT_RMR_BIND_COMPLETION_EVENT;\r
-\r
- event_ptr->event_data.rmr_completion_event_data.rmr_handle =\r
- cookie->val.rmr.rmr;\r
- event_ptr->event_data.rmr_completion_event_data.user_cookie =\r
- cookie->val.rmr.cookie;\r
- if (dto_status == DAT_DTO_SUCCESS)\r
- {\r
- event_ptr->event_data.rmr_completion_event_data.status =\r
- DAT_RMR_BIND_SUCCESS;\r
- dapl_os_assert ((DAPL_GET_CQE_OPTYPE (cqe_ptr)) == OP_BIND_MW);\r
- }\r
- else\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR,\r
- " MW bind completion ERROR: %d: op %#x ep: %p\n", \r
- dto_status, \r
- DAPL_GET_CQE_OPTYPE (cqe_ptr), ep_ptr);\r
- event_ptr->event_data.rmr_completion_event_data.status =\r
- DAT_RMR_OPERATION_FAILED;\r
- }\r
-\r
- dapls_cookie_dealloc (&ep_ptr->req_buffer, cookie);\r
- break;\r
- }\r
- default:\r
- {\r
- dapl_os_assert (!"Invalid Operation type");\r
- break;\r
- }\r
- } /* end switch */\r
-\r
- /*\r
- * Most error DTO ops result in disconnecting the EP. See\r
- * IBTA Vol 1.1, Chapter 10,Table 68, for expected effect on\r
- * state.\r
- */\r
- if ((dto_status != DAT_DTO_SUCCESS) &&\r
- (dto_status != DAT_DTO_ERR_FLUSHED))\r
- {\r
- DAPL_EVD *evd_ptr;\r
-\r
- /*\r
- * If we are connected, generate disconnect and generate an\r
- * event. We may be racing with other disconnect ops, so we\r
- * need to check. We may also be racing CM connection events,\r
- * requiring us to check for connection pending states too.\r
- */\r
- dapl_os_lock ( &ep_ptr->header.lock );\r
- if (ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_PASSIVE_CONNECTION_PENDING||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_COMPLETION_PENDING )\r
-\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- dapls_io_trc_dump (ep_ptr, cqe_ptr, dto_status);\r
-\r
- /* Let the other side know we have disconnected */\r
- (void) dapls_ib_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
-\r
- /* ... and clean up the local side */\r
- evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
- if (evd_ptr != NULL)\r
- {\r
- dapls_evd_post_connection_event (evd_ptr,\r
- DAT_CONNECTION_EVENT_BROKEN,\r
- (DAT_HANDLE) ep_ptr,\r
- 0,\r
- 0);\r
- }\r
- }\r
- else\r
- {\r
- dapl_os_unlock ( &ep_ptr->header.lock );\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR,\r
- " DTO completion ERROR: %d: op %#x (ep disconnected)\n",\r
- DAPL_GET_CQE_STATUS (cqe_ptr),\r
- DAPL_GET_CQE_OPTYPE (cqe_ptr));\r
- }\r
- return ep_ptr;\r
-}\r
-\r
-/*\r
- * dapls_evd_copy_cq\r
- *\r
- * Copy all entries on a CQ associated with the EVD onto that EVD\r
- * Up to caller to handle races, if any. Note that no EVD waiters will\r
- * be awoken by this copy.\r
- *\r
- * Input:\r
- * evd_ptr\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_evd_copy_cq (\r
- DAPL_EVD *evd_ptr)\r
-{\r
- ib_work_completion_t cur_cqe;\r
- DAT_RETURN dat_status;\r
- ib_cq_handle_t cq_handle;\r
- ib_hca_handle_t hca_handle;\r
- DAPL_EP *ep_ptr;\r
- DAT_EVENT *event;\r
-\r
- cq_handle = evd_ptr->ib_cq_handle;\r
- hca_handle = evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle;\r
-\r
- if (cq_handle == IB_INVALID_HANDLE)\r
- {\r
- /* Nothing to do if no CQ. */\r
- return;\r
- }\r
-\r
- for ( ;; )\r
- {\r
- dat_status = dapls_ib_completion_poll(hca_handle,\r
- cq_handle,\r
- &cur_cqe);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- break;\r
- }\r
-\r
- /*\r
- * Can use DAT_DTO_COMPLETION_EVENT because dapli_evd_cqe_to_event\r
- * will overwrite.\r
- */\r
- \r
- event = dapli_evd_get_and_init_event (\r
- evd_ptr, DAT_DTO_COMPLETION_EVENT );\r
- if ( event == NULL )\r
- {\r
- /* We've already attempted the overflow post; return. */\r
- return;\r
- }\r
-\r
- ep_ptr = dapli_evd_cqe_to_event ( evd_ptr, &cur_cqe, event );\r
- dapl_os_assert ( (NULL != ep_ptr) );\r
-\r
- /* For debugging. */\r
- if (DAPL_GET_CQE_STATUS(&cur_cqe))\r
- {\r
- dapli_evd_eh_print_cqe(cur_cqe);\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, \r
- "--> DsECP_ERR: EP=%p QP=%p event=%p state=0x%x \n",\r
- ep_ptr, ep_ptr->qp_handle, \r
- event, ep_ptr->param.ep_state);\r
- }\r
- \r
- if ( (ep_ptr->param.ep_state == DAT_EP_STATE_COMPLETION_PENDING) ||\r
- (ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING) )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN, \r
- "--> DsECC: EP = %p QP = %p viol_event = %p VIOL_ORDER\n",\r
- ep_ptr, ep_ptr->qp_handle, event);\r
-\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- ep_ptr->viol_order = TRUE;\r
- dapls_rbuf_add (&ep_ptr->viol_event_queue, \r
- (void *) event);\r
- \r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
- }\r
- else\r
- {\r
- dapli_evd_post_event_nosignal ( evd_ptr, event );\r
- }\r
- }\r
-\r
- if ( DAT_GET_TYPE (dat_status) != DAT_QUEUE_EMPTY)\r
- {\r
- dapl_os_printf(\r
- "dapls_evd_copy_cq: dapls_ib_completion_poll returned 0x%x\n",\r
- dat_status);\r
- //dapl_os_assert(!"Bad return from dapls_ib_completion_poll");\r
- }\r
-}\r
-\r
-/*\r
- * dapls_evd_cq_poll_to_event\r
- *\r
- * Attempt to dequeue a single CQE from a CQ and turn it into\r
- * an event.\r
- *\r
- * Input:\r
- * evd_ptr\r
- *\r
- * Output:\r
- * event\r
- *\r
- * Returns:\r
- * Status of operation\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_evd_cq_poll_to_event (\r
- IN DAPL_EVD *evd_ptr,\r
- OUT DAT_EVENT *event)\r
-{\r
- DAT_RETURN dat_status;\r
- ib_cq_handle_t cq_handle;\r
- ib_hca_handle_t hca_handle;\r
- ib_work_completion_t cur_cqe;\r
- DAPL_EP *ep_ptr;\r
- DAT_EVENT *viol_event;\r
-\r
- cq_handle = evd_ptr->ib_cq_handle;\r
- hca_handle = evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle;\r
- ep_ptr = NULL;\r
-\r
- dat_status = dapls_ib_completion_poll(hca_handle,\r
- cq_handle,\r
- &cur_cqe);\r
- if (dat_status == DAT_SUCCESS)\r
- {\r
- \r
-\r
- ep_ptr = dapli_evd_cqe_to_event ( evd_ptr, &cur_cqe, event );\r
- dapl_os_assert ( (NULL != ep_ptr) );\r
-\r
- /* For debugging. */\r
- if (DAPL_GET_CQE_STATUS(&cur_cqe))\r
- {\r
- dapli_evd_eh_print_cqe(cur_cqe);\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR, \r
- "--> DsECPTE_ERR: EP=%p QP=%p event=%p state=0x%x \n",\r
- ep_ptr, ep_ptr->qp_handle, \r
- event, ep_ptr->param.ep_state );\r
- }\r
- \r
- if ( (ep_ptr->param.ep_state == DAT_EP_STATE_COMPLETION_PENDING) ||\r
- (ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING) )\r
- {\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
-\r
- viol_event = dapli_evd_get_and_init_event (\r
- evd_ptr, DAT_DTO_COMPLETION_EVENT );\r
- if ( viol_event == NULL )\r
- {\r
- return dat_status = DAT_QUEUE_EMPTY;\r
- }\r
-\r
- *viol_event = *event;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN, \r
- "--> DsECPTE: EP = %p QP = %p viol_event = %p VIOL_ORDER\n",\r
- ep_ptr, ep_ptr->qp_handle, viol_event);\r
-\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- ep_ptr->viol_order = TRUE;\r
- dapls_rbuf_add (&ep_ptr->viol_event_queue, \r
- (void *) viol_event);\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- if (evd_ptr->evd_producer_locking_needed)\r
- {\r
- dapl_os_unlock(&evd_ptr->header.lock);\r
- }\r
- /* Overiding the status */\r
- dat_status = DAT_QUEUE_EMPTY;\r
- }\r
- }\r
-\r
- return dat_status;\r
-}\r
- \r
-\r
-DAT_RETURN\r
-dapls_evd_post_viol_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT *event_ptr)\r
-{\r
- dapli_evd_post_event(evd_ptr, event_ptr);\r
- return DAT_SUCCESS;\r
-}\r
-#ifdef DAPL_DBG_IO_TRC\r
-/*\r
- * Update I/O completions in the I/O trace buffer. I/O is posted to\r
- * the buffer, then we find it here using the cookie and mark it\r
- * completed with the completion status\r
- */\r
-void\r
-dapls_io_trc_update_completion (\r
- DAPL_EP *ep_ptr,\r
- DAPL_COOKIE *cookie,\r
- DAT_DTO_COMPLETION_STATUS dto_status)\r
-{\r
- int i;\r
- static unsigned int c_cnt = 1;\r
-\r
- for (i = 0; i < DBG_IO_TRC_QLEN; i++)\r
- {\r
- if (ep_ptr->ibt_base[i].cookie == cookie)\r
- {\r
- ep_ptr->ibt_base[i].status = dto_status;\r
- ep_ptr->ibt_base[i].done = c_cnt++;\r
- }\r
- }\r
-}\r
-\r
-/*\r
- * Dump the I/O trace buffers\r
- */\r
-void\r
-dapls_io_trc_dump (\r
- DAPL_EP *ep_ptr,\r
- ib_work_completion_t *cqe_ptr,\r
- DAT_DTO_COMPLETION_STATUS dto_status)\r
-{\r
- struct io_buf_track *ibt;\r
- int i;\r
- int cnt;\r
-\r
- dapl_os_printf ("DISCONNECTING: dto_status = %x\n", dto_status);\r
- dapl_os_printf (" OpType = %x\n",\r
- DAPL_GET_CQE_OPTYPE (cqe_ptr));\r
- dapl_os_printf (" Bytes = %x\n",\r
- DAPL_GET_CQE_BYTESNUM (cqe_ptr));\r
- dapl_os_printf (" WRID (cookie) = %llx\n",\r
- DAPL_GET_CQE_WRID (cqe_ptr));\r
-\r
- if (ep_ptr->ibt_dumped == 0)\r
- {\r
-\r
- dapl_os_printf ("EP %p (qpn %d) I/O trace buffer\n",\r
- ep_ptr, ep_ptr->qpn);\r
-\r
- ep_ptr->ibt_dumped = 1;\r
- ibt = (struct io_buf_track *)dapls_rbuf_remove (&ep_ptr->ibt_queue);\r
- cnt = DBG_IO_TRC_QLEN;\r
- while (ibt != NULL && cnt > 0)\r
- {\r
- dapl_os_printf ("%2d. %3s (%2d, %d) OP: %x cookie %p wqe %p rmv_target_addr %llx rmv_rmr_context %x\n",\r
- cnt, ibt->done == 0 ? "WRK" : "DON", ibt->status, ibt->done,\r
- ibt->op_type, ibt->cookie, ibt->wqe,\r
- ibt->remote_iov.target_address,\r
- ibt->remote_iov.rmr_context);\r
- for (i = 0; i < 3; i++)\r
- {\r
- if (ibt->iov[i].segment_length != 0)\r
- {\r
- dapl_os_printf (" (%4llx, %8x, %8llx)\n",\r
- ibt->iov[i].segment_length,\r
- ibt->iov[i].lmr_context,\r
- ibt->iov[i].virtual_address);\r
- }\r
- }\r
- ibt = (struct io_buf_track *)dapls_rbuf_remove (&ep_ptr->ibt_queue);\r
- cnt--;\r
- }\r
- }\r
-}\r
-#endif /* DAPL_DBG_IO_TRC */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_evd_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the EVD data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_EVD_UTIL_H_\r
-#define _DAPL_EVD_UTIL_H_\r
-\r
-#include "dapl.h"\r
-\r
-DAT_RETURN\r
-dapls_evd_internal_create (\r
- IN DAPL_IA *ia_ptr, \r
- IN DAPL_CNO *cno_ptr,\r
- IN DAT_COUNT min_qlen,\r
- IN DAT_EVD_FLAGS evd_flags,\r
- OUT DAPL_EVD **evd_ptr_ptr) ;\r
-\r
-DAPL_EVD *\r
-dapls_evd_alloc ( \r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_ptr,\r
- IN DAT_EVD_FLAGS evd_flags,\r
- IN DAT_COUNT qlen) ;\r
-\r
-DAT_RETURN\r
-dapls_evd_dealloc ( \r
- IN DAPL_EVD *evd_ptr) ;\r
-\r
-DAT_RETURN dapls_evd_event_realloc (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_COUNT qlen);\r
-\r
-/*\r
- * Each of these functions will retrieve a free event from\r
- * the specified EVD, fill in the elements of that event, and\r
- * post the event back to the EVD. If there is no EVD available,\r
- * an overflow event will be posted to the async EVD associated\r
- * with the EVD.\r
- *\r
- * DAT_INSUFFICIENT_RESOURCES will be returned on overflow,\r
- * DAT_SUCCESS otherwise.\r
- */\r
-\r
-DAT_RETURN\r
-dapls_evd_post_cr_arrival_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_SP_HANDLE sp_handle,\r
- DAT_IA_ADDRESS_PTR ia_address_ptr,\r
- DAT_CONN_QUAL conn_qual,\r
- DAT_CR_HANDLE cr_handle);\r
- \r
-DAT_RETURN\r
-dapls_evd_post_connection_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT private_data_size,\r
- IN DAT_PVOID private_data);\r
-\r
-DAT_RETURN\r
-dapls_evd_post_async_error_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_IA_HANDLE ia_handle);\r
-\r
-DAT_RETURN\r
-dapls_evd_post_software_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT_NUMBER event_number,\r
- IN DAT_PVOID pointer);\r
-\r
-DAT_RETURN\r
-dapls_evd_post_viol_event (\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_EVENT *event_ptr);\r
-\r
-/*************************************\r
- * dapl internal callbacks functions *\r
- *************************************/\r
-\r
-/* connection verb callback */\r
-extern void dapl_evd_connection_callback (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN const ib_cm_events_t ib_cm_events,\r
- IN const void *instant_data_p,\r
- IN const void * context );\r
-\r
-/* dto verb callback */\r
-extern void dapl_evd_dto_callback (\r
- IN ib_hca_handle_t ib_hca_handle, \r
- IN ib_cq_handle_t ib_cq_handle, \r
- IN void* context);\r
-\r
-/* async verb callbacks */\r
-extern void dapl_evd_un_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *err_code,\r
- IN void * context);\r
-\r
-extern void dapl_evd_cq_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *err_code,\r
- IN void * context);\r
-\r
-extern void dapl_evd_qp_async_error_callback (\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *err_code,\r
- IN void * context);\r
-\r
-extern void dapls_evd_copy_cq (\r
- DAPL_EVD *evd_ptr);\r
-\r
-extern DAT_RETURN dapls_evd_cq_poll_to_event (\r
- IN DAPL_EVD *evd_ptr,\r
- OUT DAT_EVENT *event);\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under one of the following licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a\r
- * copy of which is available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/gpl-license.php.\r
- *\r
- * Licensee has the right to choose one of the above licenses.\r
- *\r
- * Redistributions of source code must retain the above copyright\r
- * notice and one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_evd_wait.c\r
- *\r
- * PURPOSE: EVENT management\r
- *\r
- * Description: Interfaces in this file are completely defined in \r
- * the uDAPL 1.1 API specification\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ring_buffer_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_evd_wait\r
- *\r
- * UDAPL Requirements Version xxx, \r
- *\r
- * Wait, up to specified timeout, for notification event on EVD.\r
- * Then return first available event.\r
- *\r
- * Input:\r
- * evd_handle\r
- * timeout\r
- *\r
- * Output:\r
- * event\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- */\r
-\r
-DAT_RETURN dapl_evd_wait (\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_TIMEOUT time_out,\r
- IN DAT_COUNT threshold,\r
- OUT DAT_EVENT *event,\r
- OUT DAT_COUNT *nmore)\r
-\r
-{\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
- DAT_EVENT *local_event;\r
- DAT_BOOLEAN notify_requested = DAT_FALSE;\r
- DAT_BOOLEAN waitable;\r
- DAPL_EVD_STATE evd_state;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_evd_wait (%p, %d, %d, %p, %p)\n", \r
- evd_handle, \r
- time_out, \r
- threshold, \r
- event, \r
- nmore);\r
- DAPL_CNTR(DCNT_EVD_WAIT);\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (evd_ptr, DAPL_MAGIC_EVD))\r
- {\r
- /*\r
- * We return directly rather than bailing because\r
- * bailing attempts to update the evd, and we don't have\r
- * one.\r
- */\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- if (!event)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
- if (!nmore)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG5);\r
- goto bail;\r
- }\r
- if (threshold <= 0 ||\r
- (threshold > 1 && evd_ptr->completion_type != DAPL_EVD_STATE_THRESHOLD) ||\r
- threshold > evd_ptr->qlen)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
- if ( evd_ptr->catastrophic_overflow )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
- goto bail;\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD, \r
- "dapl_evd_wait: EVD %p, CQ %p\n", \r
- evd_ptr,\r
- (void *)evd_ptr->ib_cq_handle);\r
-\r
- /*\r
- * Make sure there are no other waiters and the evd is active.\r
- * Currently this means only the OPEN state is allowed.\r
- * Do this atomically. We need to take a lock to synchronize\r
- * with dapl_evd_dequeue(), but the atomic transition allows\r
- * non-locking synchronization with dapl_evd_query() and\r
- * dapl_evd_{query,enable,disable,{set,clear}_unwaitable}.\r
- */\r
-\r
- dapl_os_lock ( &evd_ptr->header.lock );\r
- waitable = evd_ptr->evd_waitable;\r
-\r
- dapl_os_assert ( sizeof(DAT_COUNT) == sizeof(DAPL_EVD_STATE) );\r
- evd_state = dapl_os_atomic_assign ( (DAPL_ATOMIC *)&evd_ptr->evd_state,\r
- (DAT_COUNT) DAPL_EVD_STATE_OPEN,\r
- (DAT_COUNT) DAPL_EVD_STATE_WAITED );\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- if ( evd_state != DAPL_EVD_STATE_OPEN )\r
- {\r
- /* Bogus state, bail out */\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
- goto bail;\r
- }\r
-\r
- if (!waitable)\r
- {\r
- /* This EVD is not waitable, reset the state and bail */\r
- (void) dapl_os_atomic_assign ((DAPL_ATOMIC *)&evd_ptr->evd_state,\r
- (DAT_COUNT) DAPL_EVD_STATE_WAITED,\r
- evd_state);\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_UNWAITABLE);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * We now own the EVD, even though we don't have the lock anymore,\r
- * because we're in the WAITED state.\r
- */\r
-\r
- evd_ptr->threshold = threshold;\r
-\r
- for (;;)\r
- {\r
- /*\r
- * Ideally we'd just check the number of entries on the CQ, but\r
- * we don't have a way to do that. Because we have to set *nmore\r
- * at some point in this routine, we'll need to do this copy\r
- * sometime even if threshold == 1.\r
- *\r
- * For connection evd or async evd, the function checks and\r
- * return right away if the ib_cq_handle associate with these evd\r
- * equal to IB_INVALID_HANDLE\r
- */\r
- dapls_evd_copy_cq(evd_ptr);\r
-\r
- if (dapls_rbuf_count(&evd_ptr->pending_event_queue) >= threshold)\r
- {\r
- break;\r
- }\r
-\r
- /*\r
- * Do not enable the completion notification if this evd is not \r
- * a DTO_EVD or RMR_BIND_EVD\r
- */\r
- if ( (!notify_requested) &&\r
- ((evd_ptr->evd_flags & DAT_EVD_DTO_FLAG) ||\r
- (evd_ptr->evd_flags & DAT_EVD_RMR_BIND_FLAG)) )\r
- {\r
- dat_status = dapls_ib_completion_notify (\r
- evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle,\r
- evd_ptr->ib_cq_handle,\r
- (evd_ptr->completion_type == DAPL_EVD_STATE_SOLICITED_WAIT) ?\r
- IB_NOTIFY_ON_SOLIC_COMP : IB_NOTIFY_ON_NEXT_COMP ); \r
-\r
- DAPL_CNTR(DCNT_EVD_WAIT_CMP_NTFY);\r
- /* FIXME report error */\r
- dapl_os_assert(dat_status == DAT_SUCCESS);\r
-\r
- notify_requested = DAT_TRUE;\r
-\r
- /* Try again. */\r
- continue;\r
- }\r
-\r
-\r
- /*\r
- * Unused by poster; it has no way to tell how many\r
- * items are on the queue without copying them over to the\r
- * EVD queue, and we're the only ones allowed to dequeue\r
- * from the CQ for synchronization/locking reasons.\r
- */\r
- evd_ptr->threshold = threshold; \r
-\r
- DAPL_CNTR(DCNT_EVD_WAIT_BLOCKED);\r
-\r
-#ifdef CQ_WAIT_OBJECT\r
- if (evd_ptr->cq_wait_obj_handle)\r
- dat_status = dapls_ib_wait_object_wait (\r
- evd_ptr->cq_wait_obj_handle, time_out );\r
- else\r
-#endif\r
- dat_status = dapl_os_wait_object_wait (\r
- &evd_ptr->wait_object, time_out );\r
- /*\r
- * FIXME: if the thread loops around and waits again\r
- * the time_out value needs to be updated.\r
- */\r
-\r
- notify_requested = DAT_FALSE; /* We've used it up. */\r
-\r
- /* See if we were awakened by evd_set_unwaitable */\r
- if ( !evd_ptr->evd_waitable )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
- }\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- /*\r
- * If the status is DAT_TIMEOUT, we'll break out of the\r
- * loop, *not* dequeue an event (because dat_status\r
- * != DAT_SUCCESS), set *nmore (as we should for timeout)\r
- * and return DAT_TIMEOUT.\r
- */\r
- break;\r
- }\r
- }\r
- \r
- evd_ptr->evd_state = DAPL_EVD_STATE_OPEN;\r
-\r
- if (dat_status == DAT_SUCCESS)\r
- {\r
- local_event = dapls_rbuf_remove(&evd_ptr->pending_event_queue);\r
- *event = *local_event;\r
- dapls_rbuf_add(&evd_ptr->free_event_queue, local_event);\r
- }\r
-\r
- /*\r
- * Valid if dat_status == DAT_SUCCESS || dat_status == DAT_TIMEOUT\r
- * Undefined otherwise, so ok to set it.\r
- */\r
- *nmore = dapls_rbuf_count(&evd_ptr->pending_event_queue);\r
-\r
- bail:\r
- if (dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_evd_wait () returns 0x%x\n", \r
- dat_status);\r
- }\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_get_consumer_context.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_get_consumer_context\r
- *\r
- * DAPL Requirements Version xxx, 6.2.2.2\r
- *\r
- * Gets the consumer context from the specified dat_object\r
- *\r
- * Input:\r
- * dat_handle\r
- *\r
- * Output:\r
- * context\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_get_consumer_context (\r
- IN DAT_HANDLE dat_handle,\r
- OUT DAT_CONTEXT *context )\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_HEADER *header;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- header = (DAPL_HEADER *)dat_handle;\r
- if ( ((header) == NULL) ||\r
- ((DAT_UVERYLONG)(header) & 3) ||\r
- (header->magic != DAPL_MAGIC_IA &&\r
- header->magic != DAPL_MAGIC_EVD &&\r
- header->magic != DAPL_MAGIC_EP &&\r
- header->magic != DAPL_MAGIC_LMR &&\r
- header->magic != DAPL_MAGIC_RMR &&\r
- header->magic != DAPL_MAGIC_PZ &&\r
- header->magic != DAPL_MAGIC_PSP &&\r
- header->magic != DAPL_MAGIC_RSP &&\r
- header->magic != DAPL_MAGIC_CR))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- if ( context == NULL || ((DAT_UVERYLONG)(header) & 3) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- *context = header->user_context;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_get_handle_type.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_get_handle_type\r
- *\r
- * DAPL Requirements Version xxx, 6.2.2.6\r
- *\r
- * Gets the handle type for the given dat_handle\r
- *\r
- * Input:\r
- * dat_handle\r
- *\r
- * Output:\r
- * handle_type\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-\r
-DAT_RETURN\r
-dapl_get_handle_type (\r
- IN DAT_HANDLE dat_handle,\r
- OUT DAT_HANDLE_TYPE *handle_type )\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_HEADER *header;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- header = (DAPL_HEADER *)dat_handle;\r
- if ( ((header) == NULL) ||\r
- ((DAT_UVERYLONG)(header) & 3) ||\r
- (header->magic != DAPL_MAGIC_IA &&\r
- header->magic != DAPL_MAGIC_EVD &&\r
- header->magic != DAPL_MAGIC_EP &&\r
- header->magic != DAPL_MAGIC_LMR &&\r
- header->magic != DAPL_MAGIC_RMR &&\r
- header->magic != DAPL_MAGIC_PZ &&\r
- header->magic != DAPL_MAGIC_PSP &&\r
- header->magic != DAPL_MAGIC_RSP &&\r
- header->magic != DAPL_MAGIC_CR))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- *handle_type = header->handle_type;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_hash.c\r
- *\r
- * PURPOSE: Hash Table\r
- * Description: \r
- *\r
- * Provides a generic hash table with chaining.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_hash.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Structures *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * A hash table element\r
- */\r
-typedef struct DAPL_HASH_ELEM\r
-{\r
- struct DAPL_HASH_ELEM * next_element;\r
- DAPL_HASH_KEY key;\r
- void * datum;\r
-} DAPL_HASH_ELEM;\r
-\r
-/*\r
- * The hash table\r
- */\r
-struct dapl_hash_table\r
-{\r
- unsigned long num_entries;\r
- unsigned long tbl_size;\r
- DAPL_HASH_ELEM *table;\r
- DAPL_OS_LOCK lock;\r
- /*\r
- * statistics - we tally on insert operations, counting\r
- * the number of entries in the whole hash table, as\r
- * well as the length of chains we walk to insert. This\r
- * ignores empty buckets, giving us data on overall table\r
- * occupancy, as well as max/average chain length for\r
- * the buckets used. If our hash function results in\r
- * hot buckets, this will show it.\r
- */\r
- uint64_t hash_tbl_inserts; /* total inserts ops */\r
- uint64_t hash_tbl_max; /* max in entire table */\r
- uint64_t hash_tbl_total; /* total in table */\r
- uint64_t hash_chn_max; /* longest chain */\r
- uint64_t hash_chn_total; /* total non-0 lenghts */\r
-};\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Defines *\r
- * *\r
- *********************************************************************/\r
-\r
-/* datum value in empty table slots (use 0UL or ~0UL as appropriate) */\r
-#define NO_DATUM_VALUE ((void *) 0UL)\r
-#define NO_DATUM(value) ((value) == NO_DATUM_VALUE)\r
-\r
-/* Lookup macro (which falls back to function to rehash) */\r
-#define DAPL_HASHLOOKUP( p_table, in_key, out_datum, bucket_head) \\r
- { \\r
- DAPL_HASH_KEY save_key = in_key; \\r
- DAPL_HASH_ELEM *element = \\r
- &((p_table)->table)[DAPL_DOHASH(in_key,(p_table)->tbl_size)]; \\r
- in_key = save_key; \\r
- if (NO_DATUM(element->datum)) { \\r
- (bucket_head) = (void *)0; \\r
- } else if (element->key == (DAPL_HASH_KEY) (in_key)) { \\r
- (out_datum) = element->datum; \\r
- (bucket_head) = (void *)element; \\r
- } else if (element->next_element) { \\r
- dapli_hash_rehash(element, \\r
- (in_key), \\r
- (void **)&(out_datum), \\r
- (DAPL_HASH_ELEM **)&(bucket_head)); \\r
- } else { \\r
- (bucket_head) = (void *)0; \\r
- }\\r
- }\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * Rehash the key (used by add and lookup functions)\r
- * \r
- * Inputs: element element to rehash key\r
- * key, datum datum for key head\r
- * head head for list\r
- */\r
-static void\r
-dapli_hash_rehash (\r
- DAPL_HASH_ELEM * element,\r
- DAPL_HASH_KEY key,\r
- void **datum,\r
- DAPL_HASH_ELEM ** head)\r
-{\r
- /*\r
- * assume we looked at the contents of element already,\r
- * and start with the next element.\r
- */\r
- dapl_os_assert (element->next_element);\r
- dapl_os_assert (!NO_DATUM (element->datum));\r
-\r
- *head = element;\r
- for(;;)\r
- {\r
- element = element->next_element;\r
- if (!element)\r
- {\r
- break;\r
- }\r
- if (element->key == key)\r
- {\r
- *datum = element->datum;\r
- return;\r
- }\r
- }\r
- *head = 0;\r
-}\r
-\r
-/*\r
- * Add a new key to the hash table\r
- * \r
- * Inputs:\r
- * table, key and datum to be added\r
- * allow_dup - DAT_TRUE if dups are allowed\r
- * Outputs: \r
- * report_dup - should you care to know\r
- * Returns:\r
- * DAT_TRUE on success \r
- */\r
-static DAT_BOOLEAN\r
-dapli_hash_add (\r
- DAPL_HASH_TABLEP p_table,\r
- DAPL_HASH_KEY key,\r
- void *datum,\r
- DAT_BOOLEAN allow_dup,\r
- DAT_BOOLEAN * report_dup)\r
-{\r
- void *olddatum;\r
- DAPL_HASH_KEY hashValue, save_key = key;\r
- DAPL_HASH_ELEM *found;\r
- DAT_BOOLEAN status = DAT_FALSE;\r
- unsigned int chain_len = 0;\r
-\r
- if (report_dup)\r
- {\r
- (*report_dup) = DAT_FALSE;\r
- }\r
-\r
- if (NO_DATUM (datum))\r
- {\r
- /*\r
- * Reserved value used for datum\r
- */\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_ERR,\r
- "dapli_hash_add () called with magic NO_DATA value (%p) "\r
- "used as datum!\n", datum);\r
- return DAT_FALSE;\r
- }\r
-\r
- DAPL_HASHLOOKUP (p_table, key, olddatum, found);\r
- if (found)\r
- {\r
- /*\r
- * key exists already\r
- */\r
- if (report_dup)\r
- {\r
- *report_dup = DAT_TRUE;\r
- }\r
-\r
- if (!allow_dup)\r
- {\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_ERR,\r
- "dapli_hash_add () called with duplicate key (" F64x ")\n",\r
- key);\r
- return DAT_FALSE;\r
- }\r
- }\r
-\r
- hashValue = DAPL_DOHASH (key, p_table->tbl_size);\r
- key = save_key;\r
- if (NO_DATUM (p_table->table[hashValue].datum))\r
- {\r
- /*\r
- * Empty head - just fill it in\r
- */\r
- p_table->table[hashValue].key = key;\r
- p_table->table[hashValue].datum = datum;\r
- p_table->table[hashValue].next_element = 0;\r
- p_table->num_entries++;\r
- status = DAT_TRUE;\r
- }\r
- else\r
- {\r
- DAPL_HASH_ELEM *newelement = (DAPL_HASH_ELEM *)\r
- dapl_os_alloc (sizeof (DAPL_HASH_ELEM));\r
- /*\r
- * Add an element to the end of the chain\r
- */\r
- if (newelement)\r
- {\r
- DAPL_HASH_ELEM *lastelement;\r
- newelement->key = key;\r
- newelement->datum = datum;\r
- newelement->next_element = 0;\r
- for (lastelement = &p_table->table[hashValue];\r
- lastelement->next_element;\r
- lastelement = lastelement->next_element)\r
- {\r
- /* Walk to the end of the chain */\r
- chain_len++;\r
- }\r
- lastelement->next_element = newelement;\r
- p_table->num_entries++;\r
- status = DAT_TRUE;\r
- }\r
- else\r
- {\r
- /* allocation failed - should not happen */\r
- status = DAT_FALSE;\r
- }\r
- }\r
-\r
- /*\r
- * Tally up our counters. chain_len is one less than current chain\r
- * length.\r
- */\r
- chain_len++;\r
- p_table->hash_tbl_inserts++;\r
- p_table->hash_tbl_total += p_table->num_entries;\r
- p_table->hash_chn_total += chain_len;\r
- if (p_table->num_entries > p_table->hash_tbl_max)\r
- {\r
- p_table->hash_tbl_max = p_table->num_entries;\r
- }\r
- if (chain_len > p_table->hash_chn_max)\r
- {\r
- p_table->hash_chn_max = chain_len;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/*\r
- * Remove element from hash bucket\r
- * \r
- * Inputs:\r
- * element, key to be deleted\r
- * Returns:\r
- * DAT_TRUE on success\r
- */\r
-static DAT_BOOLEAN\r
-dapl_hash_delete_element (DAPL_HASH_ELEM * element,\r
- DAPL_HASH_KEY key,\r
- DAPL_HASH_DATA *p_datum)\r
-{\r
- DAPL_HASH_ELEM *curelement;\r
- DAPL_HASH_ELEM *lastelement;\r
-\r
- lastelement = NULL;\r
- for (curelement = element;\r
- curelement;\r
- lastelement = curelement, curelement = curelement->next_element)\r
- {\r
- if (curelement->key == key)\r
- {\r
- if (p_datum)\r
- {\r
- *p_datum = curelement->datum;\r
- }\r
- if (lastelement)\r
- {\r
- /*\r
- * curelement was malloc'd; free it\r
- */\r
- lastelement->next_element = curelement->next_element;\r
- dapl_os_free ((void *) curelement, sizeof (DAPL_HASH_ELEM));\r
- }\r
- else\r
- {\r
- /*\r
- * curelement is static list head\r
- */\r
- DAPL_HASH_ELEM *n = curelement->next_element;\r
- if (n)\r
- {\r
- /*\r
- * If there is a next element, copy its contents into the\r
- * head and free the original next element.\r
- */\r
- curelement->key = n->key;\r
- curelement->datum = n->datum;\r
- curelement->next_element = n->next_element;\r
- dapl_os_free ((void *) n, sizeof (DAPL_HASH_ELEM));\r
- }\r
- else\r
- {\r
- curelement->datum = NO_DATUM_VALUE;\r
- }\r
- }\r
- break;\r
- }\r
- }\r
-\r
- return ( curelement != NULL ? DAT_TRUE : DAT_FALSE );\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/*\r
- * Create a new hash table with at least 'table_size' hash buckets.\r
- */\r
-DAT_RETURN\r
-dapls_hash_create (\r
- IN DAT_COUNT table_size,\r
- OUT DAPL_HASH_TABLE **pp_table)\r
-{\r
- DAPL_HASH_TABLE *p_table;\r
- DAT_COUNT table_length = table_size * sizeof (DAPL_HASH_ELEM);\r
- DAT_RETURN dat_status;\r
- DAT_COUNT i;\r
-\r
- dapl_os_assert (pp_table);\r
- dat_status = DAT_SUCCESS;\r
-\r
- /* Allocate hash table */\r
- p_table = dapl_os_alloc (sizeof (DAPL_HASH_TABLE));\r
- if (NULL == p_table)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- /* Init hash table, allocate and init and buckets */\r
- dapl_os_memzero (p_table, sizeof (DAPL_HASH_TABLE));\r
- p_table->tbl_size = table_size;\r
- p_table->table = (DAPL_HASH_ELEM *) dapl_os_alloc (table_length);\r
- if (NULL == p_table->table)\r
- {\r
- dapl_os_free (p_table, sizeof (DAPL_HASH_TABLE));\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_lock_init (&p_table->lock);\r
- for (i = 0; i < table_size; i++)\r
- {\r
- p_table->table[i].datum = NO_DATUM_VALUE;\r
- p_table->table[i].key = 0;\r
- p_table->table[i].next_element = 0;\r
- }\r
-\r
- *pp_table = p_table;\r
-\r
- bail:\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Destroy a hash table\r
- */\r
-DAT_RETURN\r
-dapls_hash_free (\r
- IN DAPL_HASH_TABLE *p_table)\r
-{\r
- dapl_os_assert (p_table && p_table->table);\r
-\r
- dapl_os_lock_destroy (&p_table->lock);\r
- dapl_os_free (p_table->table, sizeof (DAPL_HASH_ELEM) * p_table->tbl_size);\r
- dapl_os_free (p_table, sizeof (DAPL_HASH_TABLE));\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Returns the number of elements stored in the table\r
- */\r
-\r
-DAT_RETURN\r
-dapls_hash_size (\r
- IN DAPL_HASH_TABLE *p_table,\r
- OUT DAT_COUNT *p_size)\r
-{\r
- dapl_os_assert (p_table && p_size);\r
-\r
- *p_size = p_table->num_entries;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Inserts the specified data into the table with the given key.\r
- * Duplicates are not expected, and return in error, having done nothing.\r
- */\r
-\r
-DAT_RETURN\r
-dapls_hash_insert (\r
- IN DAPL_HASH_TABLE *p_table, \r
- IN DAPL_HASH_KEY key,\r
- IN DAPL_HASH_DATA data)\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dapl_os_assert (p_table);\r
- dat_status = DAT_SUCCESS;\r
-\r
- dapl_os_lock (&p_table->lock);\r
- if (!dapli_hash_add (p_table, key, data, DAT_FALSE, NULL))\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- }\r
- dapl_os_unlock (&p_table->lock);\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Searches for the given key. If found, \r
- * DAT_SUCCESS is returned and the associated \r
- * data is returned in the DAPL_HASH_DATA \r
- * pointer if that pointer is not NULL.\r
- */\r
-DAT_RETURN\r
-dapls_hash_search (\r
- IN DAPL_HASH_TABLE *p_table,\r
- IN DAPL_HASH_KEY key,\r
- OUT DAPL_HASH_DATA *p_data)\r
-{\r
- DAT_RETURN dat_status;\r
- void *olddatum = NULL;\r
- DAPL_HASH_ELEM *found;\r
-\r
- dapl_os_assert (p_table);\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,0);\r
-\r
- dapl_os_lock (&p_table->lock);\r
- DAPL_HASHLOOKUP (p_table, key, olddatum, found);\r
- dapl_os_unlock (&p_table->lock);\r
-\r
- if (found)\r
- {\r
- if (p_data)\r
- {\r
- *p_data = olddatum;\r
- }\r
- dat_status = DAT_SUCCESS;\r
- }\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_hash_remove (\r
- IN DAPL_HASH_TABLE *p_table,\r
- IN DAPL_HASH_KEY key,\r
- OUT DAPL_HASH_DATA *p_data)\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_HASH_KEY hashValue, save_key = key;\r
-\r
- dapl_os_assert (p_table);\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,0);\r
-\r
- if (p_table->num_entries == 0)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dapls_hash_remove () called on empty hash table!\n");\r
- return dat_status;\r
- }\r
-\r
- hashValue = DAPL_DOHASH (key, p_table->tbl_size);\r
- key = save_key;\r
- dapl_os_lock (&p_table->lock);\r
- if (dapl_hash_delete_element (&p_table->table[hashValue], key, p_data))\r
- {\r
- p_table->num_entries--;\r
- dat_status = DAT_SUCCESS;\r
- }\r
- dapl_os_unlock (&p_table->lock);\r
-\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * HEADER: dapl_hash.h\r
- *\r
- * PURPOSE: Utility defs & routines for the hash data structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_HASH_H_\r
-#define _DAPL_HASH_H_\r
-\r
-#include "dapl.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Defines *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * Hash table size.\r
- *\r
- * Default is small; use the larger sample values for hash tables\r
- * known to be heavily used. The sample values chosen are the\r
- * largest primes below 2^8, 2^9, and 2^10.\r
- */\r
-#define DAPL_DEF_HASHSIZE 251\r
-#define DAPL_MED_HASHSIZE 509\r
-#define DAPL_LRG_HASHSIZE 1021\r
-\r
-#define DAPL_HASH_TABLE_DEFAULT_CAPACITY DAPL_DEF_HASHSIZE\r
-\r
-/* The hash function */\r
-#define DAPL_DOHASH(key,hashsize) ((uint64_t)((key) % (hashsize)))\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_RETURN\r
-dapls_hash_create(\r
- IN DAT_COUNT capacity,\r
- OUT DAPL_HASH_TABLE **pp_table);\r
-\r
-extern DAT_RETURN\r
-dapls_hash_free(\r
- IN DAPL_HASH_TABLE *p_table);\r
-\r
-extern DAT_RETURN\r
-dapls_hash_size(\r
- IN DAPL_HASH_TABLE *p_table,\r
- OUT DAT_COUNT *p_size);\r
-\r
-extern DAT_RETURN\r
-dapls_hash_insert(\r
- IN DAPL_HASH_TABLE *p_table, \r
- IN DAPL_HASH_KEY key,\r
- IN DAPL_HASH_DATA data);\r
-\r
-extern DAT_RETURN\r
-dapls_hash_search(\r
- IN DAPL_HASH_TABLE *p_table,\r
- IN DAPL_HASH_KEY key,\r
- OUT DAPL_HASH_DATA *p_data);\r
-\r
-extern DAT_RETURN\r
-dapls_hash_remove(\r
- IN DAPL_HASH_TABLE *p_table,\r
- IN DAPL_HASH_KEY key,\r
- OUT DAPL_HASH_DATA *p_data);\r
-\r
-\r
-#endif /* _DAPL_HASH_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_hca_util.c\r
- *\r
- * PURPOSE: Manage HCA structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_provider.h"\r
-#include "dapl_hca_util.h"\r
-#include "dapl_hash.h"\r
-\r
-\r
-/*\r
- * dapl_hca_alloc\r
- *\r
- * alloc and initialize an HCA struct\r
- *\r
- * Input:\r
- * name\r
- * port\r
- *\r
- * Output:\r
- * hca_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_HCA *\r
-dapl_hca_alloc ( \r
- char *name,\r
- char *port )\r
-{\r
- DAPL_HCA *hca_ptr;\r
-\r
- hca_ptr = dapl_os_alloc (sizeof (DAPL_HCA));\r
- if ( NULL != hca_ptr )\r
- {\r
- dapl_os_memzero (hca_ptr, sizeof (DAPL_HCA));\r
-\r
- if ( DAT_SUCCESS == dapls_hash_create (\r
- DAPL_HASH_TABLE_DEFAULT_CAPACITY, &hca_ptr->lmr_hash_table) )\r
- {\r
- dapl_os_lock_init(&hca_ptr->lock);\r
- dapl_llist_init_head(&hca_ptr->ia_list_head);\r
- \r
- hca_ptr->name = dapl_ib_convert_name(name);\r
- hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;\r
- hca_ptr->port_num = (ib_hca_port_t)dapl_os_strtol(port, NULL, 0);\r
- hca_ptr->null_ib_cq_handle = IB_INVALID_HANDLE;\r
- }\r
- else\r
- {\r
- dapl_os_free (hca_ptr, sizeof (DAPL_HCA));\r
- hca_ptr = NULL;\r
- }\r
- }\r
- \r
- return (hca_ptr);\r
-}\r
-\r
-/*\r
- * dapl_hca_free\r
- *\r
- * free an IA INFO struct\r
- *\r
- * Input:\r
- * hca_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_hca_free ( DAPL_HCA *hca_ptr )\r
-{\r
- (void) dapls_hash_free ( hca_ptr->lmr_hash_table );\r
- dapl_os_free (hca_ptr, sizeof (DAPL_HCA));\r
-}\r
-\r
-/*\r
- * dapl_hca_link_ia\r
- *\r
- * Add an ia to the HCA structure\r
- *\r
- * Input:\r
- * hca_ptr\r
- * ia_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_hca_link_ia (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAPL_IA *ia_ptr)\r
-{\r
- dapl_os_lock (&hca_ptr->lock);\r
- dapl_llist_add_head (&hca_ptr->ia_list_head, \r
- &ia_ptr->hca_ia_list_entry, \r
- ia_ptr);\r
- dapl_os_unlock (&hca_ptr->lock);\r
-}\r
-\r
-/*\r
- * dapl_hca_unlink_ia\r
- *\r
- * Remove an ia from the hca info structure\r
- *\r
- * Input:\r
- * hca_ptr\r
- * ia_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_hca_unlink_ia (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAPL_IA *ia_ptr)\r
-{\r
- dapl_os_lock (&hca_ptr->lock);\r
- /*\r
- * If an error occurred when we were opening the IA it\r
- * will not be linked on the list; don't unlink an unlinked\r
- * list!\r
- */\r
- if ( ! dapl_llist_is_empty (&hca_ptr->ia_list_head) )\r
- {\r
- dapl_llist_remove_entry (&hca_ptr->ia_list_head, \r
- &ia_ptr->hca_ia_list_entry);\r
- }\r
- dapl_os_unlock (&hca_ptr->lock);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * HEADER: dapl_hca_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the HCA data structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_HCA_UTIL_H_\r
-#define _DAPL_HCA_UTIL_H_\r
-\r
-#include "dapl.h"\r
-\r
-DAPL_HCA *\r
-dapl_hca_alloc ( char *name,\r
- char *port ) ;\r
-\r
-void\r
-dapl_hca_free ( DAPL_HCA *hca_ptr ) ;\r
-\r
-void\r
-dapl_hca_link_ia (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAPL_IA *ia_info ) ;\r
-\r
-void\r
-dapl_hca_unlink_ia (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAPL_IA *ia_info ) ;\r
-\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ia_close.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_ia_close\r
- *\r
- * DAPL Requirements Version xxx, 6.2.1.2\r
- *\r
- * Close a provider, clean up resources, etc.\r
- *\r
- * Input:\r
- * ia_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Return Values:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_ia_close (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_CLOSE_FLAGS ia_flags)\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ia_close (%p, %d)\n",\r
- ia_handle, \r
- ia_flags);\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- \r
- if (DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
- \r
- if ( DAT_CLOSE_ABRUPT_FLAG == ia_flags )\r
- {\r
- dat_status = dapl_ia_abrupt_close (ia_ptr);\r
- }\r
- else if ( DAT_CLOSE_GRACEFUL_FLAG == ia_flags )\r
- {\r
- dat_status = dapl_ia_graceful_close (ia_ptr);\r
- }\r
- else \r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- }\r
-\r
- bail:\r
-\r
- if (dat_status)\r
- printf ("dapl_ia_close (%p, %d) RC %d\n",ia_handle,ia_flags,dat_status);\r
-\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ia_open.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_provider.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_hca_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-#ifndef NO_NAME_SERVICE\r
-#include "dapl_name_service.h"\r
-#endif\r
-\r
-/*\r
- * LOCAL PROTOTYPES\r
- */\r
-#ifdef IBHOSTS_NAMING\r
-void dapli_assign_hca_ip_address(\r
- DAPL_HCA *hca_ptr,\r
- char *device_name);\r
-#endif\r
-char *dapli_get_adapter_num (\r
- char *device_name);\r
-\r
-void dapli_setup_dummy_addr(\r
- IN DAPL_HCA *hca_ptr,\r
- IN char *hca_name);\r
-\r
-void dapli_hca_cleanup (\r
- DAPL_HCA *hca_ptr,\r
- DAT_BOOLEAN dec_ref );\r
-\r
-int32_t dapl_ib_init_complete = FALSE;\r
-\r
-/*\r
- * dapl_ia_open\r
- *\r
- * DAPL Requirements Version xxx, 6.2.1.1\r
- *\r
- * Open a provider and return a handle. The handle enables the user\r
- * to invoke operations on this provider.\r
- *\r
- * The dat_ia_open call is actually part of the DAT registration module.\r
- * That function maps the DAT_NAME parameter of dat_ia_open to a DAT_PROVIDER,\r
- * and calls this function.\r
- *\r
- * Input:\r
- * provider\r
- * async_evd_qlen\r
- * async_evd_handle_ptr\r
- *\r
- * Output:\r
- * async_evd_handle\r
- * ia_handle\r
- *\r
- * Return Values:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_HANDLE\r
- * DAT_PROVIDER_NOT_FOUND (returned by dat registry if necessary)\r
- */\r
-DAT_RETURN \r
-dapl_ia_open (\r
- IN const DAT_NAME_PTR name,\r
- IN DAT_COUNT async_evd_qlen,\r
- INOUT DAT_EVD_HANDLE *async_evd_handle_ptr,\r
- OUT DAT_IA_HANDLE *ia_handle_ptr)\r
-{\r
- DAT_RETURN dat_status;\r
- DAT_PROVIDER *provider;\r
- DAPL_HCA *hca_ptr;\r
- DAPL_IA *ia_ptr;\r
- DAPL_EVD *evd_ptr;\r
-\r
- dat_status = DAT_SUCCESS;\r
- hca_ptr = NULL;\r
- ia_ptr = NULL;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ia_open (%s, %d, %p, %p)\n",\r
- name, \r
- async_evd_qlen, \r
- async_evd_handle_ptr, \r
- ia_handle_ptr);\r
-\r
- /* Initialize IB verbs library and provider list */\r
- if ( !dapl_ib_init_complete ) \r
- {\r
- dapls_ib_init ();\r
- dapl_ib_init_complete = TRUE;\r
- \r
- /* initialize the provider list */\r
- dat_status = dapl_provider_list_create();\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "dapl_provider_list_create failed %d\n", dat_status);\r
- goto bail;\r
- }\r
- }\r
-\r
- dat_status = dapl_provider_list_search (name, &provider);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- goto bail;\r
- }\r
-\r
- /* ia_handle_ptr and async_evd_handle_ptr cannot be NULL */\r
- if (ia_handle_ptr == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
- if (async_evd_handle_ptr == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- /* initialize the caller's OUT param */\r
- *ia_handle_ptr = DAT_HANDLE_NULL;\r
-\r
- /* get the hca_ptr */\r
- hca_ptr = (DAPL_HCA *)provider->extension;\r
- \r
- /*\r
- * Open the HCA if it has not been done before. \r
- */\r
- dapl_os_lock (&hca_ptr->lock);\r
- if (hca_ptr->ib_hca_handle == IB_INVALID_HANDLE )\r
- {\r
- /* register with the HW */\r
- dat_status = dapls_ib_open_hca (hca_ptr->name,\r
- &hca_ptr->ib_hca_handle);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "dapls_ib_open_hca failed %d\n", dat_status);\r
- dapl_os_unlock (&hca_ptr->lock);\r
- goto bail;\r
- }\r
-\r
- /* create a cq domain for this HCA */\r
- dat_status = dapls_ib_cqd_create (hca_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "ERR: Cannot allocate CQD: err 0x%x\n", \r
- dat_status);\r
- dapli_hca_cleanup (hca_ptr, DAT_FALSE);\r
- dapl_os_unlock (&hca_ptr->lock);\r
- goto bail;\r
- }\r
- /*\r
- * Obtain the IP address associated with this name and HCA.\r
- */\r
-#ifdef IBHOSTS_NAMING\r
- dapli_assign_hca_ip_address (hca_ptr, name);\r
-#endif\r
- /*\r
- * Obtain IA attributes from the HCA to limit certain operations.\r
- * If using DAPL_ATS naming, ib_query_hca will also set the ip\r
- * address -- FIXME: will revisit this when add DAPL_ATS flag\r
- */\r
- dat_status = dapls_ib_query_hca (hca_ptr,\r
- &hca_ptr->ia_attr,\r
- NULL,\r
- &hca_ptr->hca_address);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "dapls_ib_query_hca failed 0x%x\n", dat_status);\r
- dapli_hca_cleanup (hca_ptr, DAT_FALSE);\r
- dapl_os_unlock (&hca_ptr->lock);\r
- goto bail;\r
- }\r
-\r
- }\r
-\r
- /* Take a reference on the hca_handle */\r
- dapl_os_atomic_inc (& hca_ptr->handle_ref_count );\r
- dapl_os_unlock (&hca_ptr->lock);\r
-\r
- /* Allocate and initialize ia structure */\r
- ia_ptr = dapl_ia_alloc (provider, hca_ptr);\r
- if (!ia_ptr)\r
- {\r
- dapl_os_lock (&hca_ptr->lock);\r
- dapli_hca_cleanup (hca_ptr, DAT_TRUE);\r
- dapl_os_unlock (&hca_ptr->lock);\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- /* we need an async EVD for this IA\r
- * use the one passed in (if non-NULL) or create one\r
- */\r
-\r
- evd_ptr = (DAPL_EVD *) *async_evd_handle_ptr;\r
- if (evd_ptr)\r
- {\r
- if (evd_ptr != DAT_EVD_ASYNC_EXISTS)\r
- {\r
- if (DAPL_BAD_HANDLE (evd_ptr, DAPL_MAGIC_EVD) ||\r
- ! (evd_ptr->evd_flags & DAT_EVD_ASYNC_FLAG))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_ASYNC);\r
- goto bail;\r
- }\r
-\r
- /* InfiniBand allows only 1 asychronous event handler per HCA */\r
- /* (see InfiniBand Spec, release 1.1, vol I, section 11.5.2, */\r
- /* page 559). */\r
- /* */\r
- /* We need only make sure that this EVD's CQ belongs to */\r
- /* the same HCA as is being opened. */\r
-\r
- if ( evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle != \r
- hca_ptr->ib_hca_handle )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_ASYNC);\r
- goto bail;\r
- }\r
-\r
- ia_ptr->cleanup_async_error_evd = DAT_FALSE;\r
- ia_ptr->async_error_evd = evd_ptr;\r
- }\r
- }\r
- else\r
- {\r
- /* \r
- * Verify we have > 0 length, and let the provider check the size\r
- */\r
- if (async_evd_qlen <= 0)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- dat_status = dapls_evd_internal_create (ia_ptr, \r
- NULL, /* CNO ptr */ \r
- async_evd_qlen,\r
- DAT_EVD_ASYNC_FLAG,\r
- &evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- /* Reference to the EVD from the IA/async event stream. */\r
- dapl_os_atomic_inc (& evd_ptr->evd_ref_count);\r
- \r
- dapl_os_lock ( &hca_ptr->lock );\r
- if ( hca_ptr->async_evd != (DAPL_EVD *) 0 )\r
- {\r
- /*\r
- * The async EVD for this HCA has already been assigned.\r
- * It's an error to try and assign another one.\r
- */\r
- \r
- dapl_os_atomic_dec ( &evd_ptr->evd_ref_count );\r
- dapl_evd_free ( evd_ptr );\r
- /*\r
- dapl_os_unlock ( &hca_ptr->lock );\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- */\r
- ia_ptr->cleanup_async_error_evd = DAT_FALSE;\r
- ia_ptr->async_error_evd = hca_ptr->async_evd;\r
- dapl_os_unlock ( &hca_ptr->lock );\r
- \r
- dat_status = DAT_SUCCESS;\r
- *async_evd_handle_ptr = hca_ptr->async_evd;\r
- }\r
- else\r
- {\r
- hca_ptr->async_evd = evd_ptr;\r
- dapl_os_unlock ( &hca_ptr->lock );\r
-\r
- ia_ptr->cleanup_async_error_evd = DAT_TRUE;\r
- ia_ptr->async_error_evd = evd_ptr;\r
-\r
- /* Register the handlers associated with the async EVD. */\r
- dat_status = dapls_ia_setup_callbacks ( ia_ptr, evd_ptr );\r
- if ( dat_status != DAT_SUCCESS ) \r
- {\r
- goto bail;\r
- }\r
- *async_evd_handle_ptr = evd_ptr;\r
- }\r
- }\r
-\r
- *ia_handle_ptr = ia_ptr;\r
-\r
-bail:\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- if (ia_ptr)\r
- {\r
- dapl_ia_close (ia_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
- }\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN,\r
- "dapl_ia_open() returns 0x%x\n", dat_status);\r
-\r
- return (dat_status);\r
-}\r
-\r
-/*\r
- * dapli_hca_cleanup\r
- *\r
- * Clean up partially allocated HCA stuff. Strictly to make cleanup\r
- * simple.\r
- */\r
-void\r
-dapli_hca_cleanup (\r
- DAPL_HCA *hca_ptr,\r
- DAT_BOOLEAN dec_ref )\r
-{\r
- dapls_ib_close_hca (hca_ptr->ib_hca_handle);\r
- hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;\r
- if ( dec_ref == DAT_TRUE )\r
- {\r
- dapl_os_atomic_dec (& hca_ptr->handle_ref_count );\r
- }\r
-}\r
-\r
-\r
-/*\r
- * dapli_assign_hca_ip_address\r
- *\r
- * Obtain the IP address of the adapter. This is a simple\r
- * scheme that creates a name that must appear available to\r
- * DNS, e.g. it must be in the local site DNS or in the local\r
- * /etc/hosts file, etc.\r
- *\r
- * <hostname>-ib<index>\r
- *\r
- * This scheme obviously doesn't work with adapters from\r
- * multiple vendors, but will suffice in common installations.\r
- *\r
- * Input:\r
- * hca_ptr Pointer to HCA structure\r
- * device_name Name of device as reported by the provider\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * char * to string number\r
- */\r
-\r
-#define NAMELEN 128\r
-\r
-void\r
-dapli_assign_hca_ip_address (\r
- DAPL_HCA *hca_ptr,\r
- char *device_name)\r
-{\r
- char *adapter_num;\r
-#ifdef IBHOSTS_NAMING\r
- struct addrinfo *addr;\r
-#endif\r
- char hostname[NAMELEN];\r
- char *str;\r
- int rc;\r
-\r
- rc = gethostname (hostname, NAMELEN);\r
-\r
- /*\r
- * Strip off domain info if it exists (e.g. mynode.mydomain.com)\r
- */\r
- for (str = hostname; *str && *str != '.'; )\r
- {\r
- str++;\r
- }\r
- if ( *str == '.' )\r
- {\r
- *str = '\0';\r
- }\r
- strcat (hostname, "_ib");\r
- adapter_num = dapli_get_adapter_num (device_name);\r
- strcat (hostname, adapter_num);\r
-\r
-#ifdef IBHOSTS_NAMING\r
- rc = dapls_osd_getaddrinfo (hostname, &addr);\r
- if(!rc)\r
- {\r
- hca_ptr->hca_address = *((DAT_SOCK_ADDR6 *)addr->ai_addr);\r
- return;\r
- }\r
- dapls_osd_freeaddrinfo(addr);\r
-#endif /* IBHOSTS_NAMING */ \r
- /* Not registered in DNS, provide a dummy value */\r
- dapli_setup_dummy_addr(hca_ptr, hostname);\r
-#if 0\r
- dapl_os_memzero (&hca_ptr->hca_address, sizeof (DAT_SOCK_ADDR6));\r
-\r
- hca_ptr->hca_address.sin6_family = AF_INET6;\r
-\r
- dapl_os_memcpy (&hca_ptr->hca_address.sin6_addr.s6_addr[12], \r
- &((struct sockaddr_in *)addr->ai_addr)->sin_addr.s_addr, \r
- 4);\r
-#endif\r
-}\r
-\r
-\r
-/*\r
- * dapli_stup_dummy_addr\r
- *\r
- * Set up a dummy local address for the HCA. Things are not going\r
- * to work too well if this happens.\r
- * We call this routine if:\r
- * - remote host adapter name is not in DNS\r
- * - IPoIB implementation is not correctly set up\r
- * - Similar nonsense.\r
- *\r
- * Input:\r
- * hca_ptr\r
- * rhost_name Name of remote adapter\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- */\r
-void\r
-dapli_setup_dummy_addr (\r
- IN DAPL_HCA *hca_ptr,\r
- IN char *rhost_name )\r
-{\r
- struct sockaddr_in *si;\r
-\r
- /* Not registered in DNS, provide a dummy value */\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "WARNING: <%s> not registered in DNS, using dummy IP value\n",\r
- rhost_name);\r
- si = (struct sockaddr_in *)&hca_ptr->hca_address;\r
- hca_ptr->hca_address.sin6_family = AF_INET;\r
- si->sin_addr.s_addr = 0x01020304;\r
-}\r
-\r
-\r
-/*\r
- * dapls_get_adapter_num\r
- *\r
- * Given a device name, return a string of the device number\r
- *\r
- * Input:\r
- * device_name Name of device as reported by the provider\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * char * to string number\r
- */\r
-char *\r
-dapli_get_adapter_num (\r
- char *device_name)\r
-{\r
- static char *zero = "0";\r
- char *p;\r
-\r
- /*\r
- * Optimisticaly simple algorithm: the device number appears at\r
- * the end of the device name string. Device that do not end\r
- * in a number are by default "0".\r
- */\r
-\r
- for (p = device_name; *p; p++)\r
- {\r
- if ( isdigit (*p) )\r
- {\r
- return p;\r
- }\r
- }\r
-\r
- return zero;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ia_query.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_vendor.h"\r
-\r
-/*\r
- * dapl_ia_query\r
- *\r
- * DAPL Requirements Version xxx, 6.2.1.3\r
- *\r
- * Provide the consumer with Interface Adapter and Provider parameters.\r
- *\r
- * Input:\r
- * ia_handle\r
- * ia_mask\r
- * provider_mask\r
- *\r
- * Output:\r
- * async_evd_handle\r
- * ia_parameters\r
- * provider_parameters\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_ia_query (\r
- IN DAT_IA_HANDLE ia_handle,\r
- OUT DAT_EVD_HANDLE *async_evd_handle,\r
- IN DAT_IA_ATTR_MASK ia_attr_mask,\r
- OUT DAT_IA_ATTR *ia_attr,\r
- IN DAT_PROVIDER_ATTR_MASK provider_attr_mask,\r
- OUT DAT_PROVIDER_ATTR *provider_attr )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAT_RETURN dat_status;\r
- struct evd_merge_type {\r
- DAT_BOOLEAN array[6][6];\r
- } *evd_merge;\r
- DAT_BOOLEAN val;\r
- int i;\r
- int j;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_ia_query (%p, %p, 0x%x, %p, 0x%x, %p)\n", \r
- ia_handle, \r
- async_evd_handle, \r
- ia_attr_mask, \r
- ia_attr, \r
- provider_attr_mask,\r
- provider_attr);\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if (DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
-\r
- if ( NULL != async_evd_handle )\r
- {\r
- *async_evd_handle = ia_ptr->async_error_evd;\r
- }\r
-\r
- if ( ia_attr_mask & DAT_IA_ALL )\r
- {\r
- if ( NULL == ia_attr )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Obtain parameters from the HCA. Protect against multiple\r
- * IAs beating on the HCA at the same time.\r
- */\r
- dat_status = dapls_ib_query_hca (ia_ptr->hca_ptr, ia_attr, NULL, NULL);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
- }\r
-\r
- if ( ia_attr_mask & ~DAT_IA_ALL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- if ( provider_attr_mask & DAT_PROVIDER_FIELD_ALL )\r
- {\r
- if ( NULL == provider_attr )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG6);\r
- goto bail;\r
- }\r
-\r
- dapl_os_memcpy ( provider_attr->provider_name, \r
- ia_ptr->header.provider->device_name, \r
- min ((int)dapl_os_strlen (ia_ptr->header.provider->device_name),(int)DAT_NAME_MAX_LENGTH ) );\r
- provider_attr->provider_version_major = VN_PROVIDER_MAJOR;\r
- provider_attr->provider_version_minor = VN_PROVIDER_MINOR;\r
- provider_attr->dapl_version_major = DAT_VERSION_MAJOR;\r
- provider_attr->dapl_version_minor = DAT_VERSION_MINOR;\r
- provider_attr->lmr_mem_types_supported = \r
- DAT_MEM_TYPE_VIRTUAL | DAT_MEM_TYPE_LMR;\r
-#if VN_MEM_SHARED_VIRTUAL_SUPPORT > 0\r
- provider_attr->lmr_mem_types_supported |= DAT_MEM_TYPE_SHARED_VIRTUAL;\r
-#endif\r
- provider_attr->iov_ownership_on_return = DAT_IOV_CONSUMER;\r
- provider_attr->dat_qos_supported = DAT_QOS_BEST_EFFORT;\r
- provider_attr->completion_flags_supported = DAT_COMPLETION_DEFAULT_FLAG;\r
- provider_attr->is_thread_safe = DAT_THREADSAFE;\r
- /*\r
- * N.B. The second part of the following equation will evaluate\r
- * to 0 unless IBHOSTS_NAMING is enabled.\r
- */\r
- provider_attr->max_private_data_size = \r
- dapls_ib_private_data_size (NULL, DAPL_PDATA_CONN_REQ) -\r
- (sizeof (DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);\r
- provider_attr->supports_multipath = DAT_FALSE;\r
- provider_attr->ep_creator = DAT_PSP_CREATES_EP_NEVER;\r
- provider_attr->optimal_buffer_alignment = DAT_OPTIMAL_ALIGNMENT;\r
- provider_attr->num_provider_specific_attr = 0;\r
- provider_attr->provider_specific_attr = NULL;\r
- /*\r
- * Set up evd_stream_merging_supported options. Note there is\r
- * one bit per allowable combination, using the ordinal\r
- * position of the DAT_EVD_FLAGS as positions in the\r
- * array. e.g.\r
- * [0][0] is DAT_EVD_SOFTWARE_FLAG | DAT_EVD_SOFTWARE_FLAG,\r
- * [0][1] is DAT_EVD_SOFTWARE_FLAG | DAT_EVD_CR_FLAG, and\r
- * [2][4] is DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG\r
- *\r
- * Most combinations are true, so initialize the array that way.\r
- * Then finish by resetting the bad combinations.\r
- *\r
- * DAT_EVD_ASYNC_FLAG is not supported. InfiniBand only allows\r
- * a single asynchronous event handle per HCA, and the first\r
- * dat_ia_open forces the creation of the only one that can be\r
- * used. We disallow the user from creating an ASYNC EVD here.\r
- */\r
-\r
- evd_merge = (struct evd_merge_type *)&provider_attr->evd_stream_merging_supported[0][0];\r
- val = DAT_TRUE;\r
- for ( i = 0; i < 6; i++)\r
- {\r
- if (i > 4)\r
- {\r
- /* ASYNC EVD is 5, so entire row will be 0 */\r
- val = DAT_FALSE;\r
- }\r
- for ( j = 0; j < 5; j++)\r
- {\r
- evd_merge->array[i][j] = val;\r
- }\r
- /* Set the ASYNC_EVD column to FALSE */\r
- evd_merge->array[i][5] = DAT_FALSE;\r
- }\r
-\r
-#ifndef DAPL_MERGE_CM_DTO\r
- /* DAT_EVD_DTO_FLAG | DAT_EVD_CONNECTION_FLAG */\r
- evd_merge->array[2][3] = DAT_FALSE;\r
- /* DAT_EVD_CONNECTION_FLAG | DAT_EVD_DTO_FLAG */\r
- evd_merge->array[3][2] = DAT_FALSE;\r
-#endif\r
- }\r
-\r
-bail:\r
- if (dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_RTN, "dapl_ia_query () returns 0x%x\n", \r
- dat_status);\r
- }\r
-\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_ia_util.c\r
- *\r
- * PURPOSE: Manage IA Info structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_hca_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_cno_util.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_adapter_util.h"\r
-#ifndef NO_NAME_SERVICE\r
-#include "dapl_name_service.h"\r
-#endif\r
-\r
-/* Internal prototype */\r
-void dapli_ia_release_hca (\r
- DAPL_HCA *hca_ptr );\r
-\r
-\r
-/*\r
- * dapl_ia_alloc\r
- *\r
- * alloc and initialize an IA INFO struct\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * ia_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_IA *\r
-dapl_ia_alloc ( DAT_PROVIDER * provider, DAPL_HCA * hca_ptr )\r
-{\r
- DAPL_IA * ia_ptr;\r
-\r
- /* Allocate IA */\r
- ia_ptr = (DAPL_IA *) dapl_os_alloc (sizeof (DAPL_IA));\r
- if (ia_ptr == NULL)\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (ia_ptr, sizeof (DAPL_IA));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- ia_ptr->header.provider = provider;\r
- ia_ptr->header.magic = DAPL_MAGIC_IA;\r
- ia_ptr->header.handle_type = DAT_HANDLE_TYPE_IA;\r
- ia_ptr->header.owner_ia = ia_ptr;\r
- ia_ptr->header.user_context.as_64 = 0;\r
- ia_ptr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&ia_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&ia_ptr->header.lock);\r
-\r
- /*\r
- * initialize the body\r
- */\r
- ia_ptr->hca_ptr = hca_ptr;\r
- ia_ptr->async_error_evd = NULL;\r
- ia_ptr->cleanup_async_error_evd = DAT_FALSE;\r
- dapl_llist_init_entry (&ia_ptr->hca_ia_list_entry);\r
- dapl_llist_init_head (&ia_ptr->ep_list_head);\r
- dapl_llist_init_head (&ia_ptr->lmr_list_head);\r
- dapl_llist_init_head (&ia_ptr->rmr_list_head);\r
- dapl_llist_init_head (&ia_ptr->pz_list_head);\r
- dapl_llist_init_head (&ia_ptr->evd_list_head);\r
- dapl_llist_init_head (&ia_ptr->cno_list_head);\r
- dapl_llist_init_head (&ia_ptr->rsp_list_head);\r
- dapl_llist_init_head (&ia_ptr->psp_list_head);\r
-\r
- dapl_hca_link_ia (hca_ptr, ia_ptr);\r
-\r
- return (ia_ptr);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ia_abrupt_close\r
- *\r
- * Performs an abrupt close of the IA\r
- *\r
- * Input:\r
- * ia_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * status\r
- *\r
- */\r
-\r
-\r
-DAT_RETURN \r
-dapl_ia_abrupt_close (\r
- IN DAPL_IA *ia_ptr ) \r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_EP *ep_ptr, *next_ep_ptr;\r
- DAPL_LMR *lmr_ptr, *next_lmr_ptr;\r
- DAPL_RMR *rmr_ptr, *next_rmr_ptr;\r
- DAPL_PZ *pz_ptr, *next_pz_ptr;\r
- DAPL_EVD *evd_ptr, *next_evd_ptr;\r
- DAPL_CNO *cno_ptr, *next_cno_ptr;\r
- DAPL_SP *sp_ptr, *next_sp_ptr; /* for PSP and RSP queues */\r
- DAPL_CR *cr_ptr, *next_cr_ptr;\r
- DAPL_HCA *hca_ptr;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API | DAPL_DBG_TYPE_CM,\r
- "dapl_ia_abrupt_close (%p)\n",ia_ptr);\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- /*\r
- * clear all the data structures associated with the IA.\r
- * this must be done in order (rmr,rsp) before (ep lmr psp) before\r
- * (pz evd)\r
- *\r
- * Note that in all the following we can leave the loop either\r
- * when we run out of entries, or when we get back to the head\r
- * if we end up skipping an entry.\r
- */\r
-\r
- rmr_ptr = (dapl_llist_is_empty (&ia_ptr->rmr_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->rmr_list_head));\r
- while (rmr_ptr != NULL)\r
- {\r
- next_rmr_ptr = dapl_llist_next_entry (&ia_ptr->rmr_list_head,\r
- &rmr_ptr->header.ia_list_entry);\r
- dat_status = dapl_rmr_free (rmr_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): rmr_free(%p) returns %x\n",\r
- rmr_ptr, \r
- dat_status );\r
- }\r
- rmr_ptr = next_rmr_ptr;\r
- }\r
-\r
- sp_ptr = (dapl_llist_is_empty (&ia_ptr->rsp_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->rsp_list_head));\r
- while (sp_ptr != NULL)\r
- {\r
- next_sp_ptr = dapl_llist_next_entry (&ia_ptr->rsp_list_head,\r
- &sp_ptr->header.ia_list_entry);\r
- dat_status = dapl_rsp_free (sp_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): rsp_free(%p) returns %x\n",\r
- sp_ptr, \r
- dat_status );\r
- }\r
- sp_ptr = next_sp_ptr;\r
- }\r
-\r
- ep_ptr = (dapl_llist_is_empty (&ia_ptr->ep_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->ep_list_head));\r
- while (ep_ptr != NULL)\r
- {\r
- next_ep_ptr = dapl_llist_next_entry (&ia_ptr->ep_list_head,\r
- &ep_ptr->header.ia_list_entry);\r
- /*\r
- * Issue a disconnect if the EP needs it\r
- */\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_ACTIVE_CONNECTION_PENDING ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_COMPLETION_PENDING ||\r
- ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECT_PENDING )\r
- {\r
- dat_status = dapl_ep_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): ep_disconnect(%p) returns %x\n",\r
- ep_ptr,\r
- dat_status );\r
- }\r
- }\r
- /* force the EP into error state to force flush all posted DTOs. */\r
- {\r
- DAT_EP_ATTR ep_attr;\r
- DAT_NAMED_ATTR ep_state;\r
-\r
- dapl_os_memzero (&ep_attr, sizeof (DAT_EP_ATTR));\r
- ep_state.name = (char *)IB_QP_STATE;\r
- ep_state.value = (char *)DAPL_QP_STATE_ERROR;\r
- ep_attr.ep_provider_specific_count = 1;\r
- ep_attr.ep_provider_specific = &ep_state;\r
-\r
- (void) dapls_ib_qp_modify (ia_ptr,\r
- ep_ptr,\r
- &ep_attr );\r
- }\r
-\r
- dat_status = dapl_ep_free (ep_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): ep_free(%p) returns %x\n",\r
- ep_ptr,\r
- dat_status );\r
- }\r
- ep_ptr = next_ep_ptr;\r
- }\r
-\r
- lmr_ptr = (dapl_llist_is_empty (&ia_ptr->lmr_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->lmr_list_head));\r
- while (lmr_ptr != NULL)\r
- {\r
- next_lmr_ptr = dapl_llist_next_entry (&ia_ptr->lmr_list_head,\r
- &lmr_ptr->header.ia_list_entry);\r
- dat_status = dapl_lmr_free (lmr_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): lmr_free(%p) returns %x\n",\r
- lmr_ptr,\r
- dat_status );\r
- }\r
- lmr_ptr = next_lmr_ptr;\r
- }\r
-\r
- sp_ptr = (dapl_llist_is_empty (&ia_ptr->psp_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->psp_list_head));\r
- while (sp_ptr != NULL)\r
- {\r
- /*\r
- * Shut down the PSP so we get no further callbacks. There\r
- * should be no competing threads after this.\r
- */\r
- dat_status = dapls_ib_remove_conn_listener (ia_ptr,\r
- sp_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): psp cannot remove listener, returns %x\n",\r
- dat_status);\r
- }\r
-\r
- next_sp_ptr = dapl_llist_next_entry (&ia_ptr->psp_list_head,\r
- &sp_ptr->header.ia_list_entry);\r
-\r
- /* Remove CR's from this PSP and clean them up */\r
- cr_ptr = dapl_llist_is_empty (&sp_ptr->cr_list_head) ? NULL :\r
- dapl_llist_peek_head (&sp_ptr->cr_list_head);\r
- while (cr_ptr != NULL)\r
- {\r
- next_cr_ptr = dapl_llist_next_entry (&sp_ptr->cr_list_head,\r
- &cr_ptr->header.ia_list_entry);\r
- /* Remove the CR from the queue & cleanup*/\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- dapls_cr_free (cr_ptr);\r
- cr_ptr = next_cr_ptr;\r
- }\r
-\r
- dat_status = dapl_psp_free (sp_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): psp_free(%p) returns %x\n",\r
- sp_ptr,\r
- dat_status );\r
- }\r
-\r
- sp_ptr = next_sp_ptr;\r
- }\r
-\r
- pz_ptr = (dapl_llist_is_empty (&ia_ptr->pz_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->pz_list_head));\r
- while (pz_ptr != NULL)\r
- {\r
- next_pz_ptr = dapl_llist_next_entry (&ia_ptr->pz_list_head,\r
- &pz_ptr->header.ia_list_entry);\r
- dat_status = dapl_pz_free (pz_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): pz_free(%p) returns %x\n",\r
- pz_ptr,\r
- dat_status );\r
- }\r
- pz_ptr = next_pz_ptr;\r
- }\r
-\r
- /*\r
- * EVDs are tricky; we want to release all except for the async\r
- * EVD. That EVD needs to stick around until after we close the\r
- * HCA, to accept any async events that occur. So we cycle through\r
- * the list with dapl_llist_next_entry instead of dapl_llist_is_empty.\r
- */\r
- evd_ptr = (dapl_llist_is_empty (&ia_ptr->evd_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->evd_list_head));\r
- while (evd_ptr != NULL)\r
- {\r
- next_evd_ptr = dapl_llist_next_entry (&ia_ptr->evd_list_head,\r
- &evd_ptr->header.ia_list_entry);\r
- if (evd_ptr == ia_ptr->async_error_evd)\r
- {\r
- /* Don't delete the EVD, but break any CNO connections. */\r
- dapl_evd_disable(evd_ptr);\r
- dapl_evd_modify_cno(evd_ptr, DAT_HANDLE_NULL);\r
- }\r
- else\r
- {\r
- /* it isn't the async EVD; delete it. */\r
- dat_status = dapl_evd_free (evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): evd_free(%p) returns %x\n",\r
- evd_ptr,\r
- dat_status );\r
- }\r
- }\r
- evd_ptr = next_evd_ptr;\r
- }\r
-\r
- cno_ptr = (dapl_llist_is_empty (&ia_ptr->cno_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->cno_list_head));\r
- while (cno_ptr != NULL)\r
- {\r
- next_cno_ptr = dapl_llist_next_entry (&ia_ptr->cno_list_head,\r
- &cno_ptr->header.ia_list_entry);\r
- if (cno_ptr->cno_waiters > 0)\r
- {\r
- /* Notify the waiter the IA is going away: see uDAPL 1.1 spec,\r
- * 6.3.2.3\r
- */\r
- dapl_cno_trigger (cno_ptr, NULL);\r
- }\r
- /* clean up the CNO */\r
- dat_status = dapl_cno_free (cno_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): cno_free(%p) returns %x\n",\r
- cno_ptr,\r
- dat_status );\r
- }\r
- cno_ptr = next_cno_ptr;\r
- }\r
-\r
- hca_ptr = ia_ptr->hca_ptr;\r
-\r
- /*\r
- * Free the async EVD, shutting down callbacks from the HCA.\r
- */\r
- if ( ia_ptr->async_error_evd &&\r
- (DAT_TRUE == ia_ptr->cleanup_async_error_evd) )\r
- {\r
- dat_status = dapls_ia_teardown_callbacks ( ia_ptr );\r
-\r
- hca_ptr->async_evd = NULL; /* It was our async EVD; nuke it. */\r
-\r
- dapl_os_atomic_dec (& ia_ptr->async_error_evd->evd_ref_count);\r
- dat_status = dapl_evd_free (ia_ptr->async_error_evd);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "ia_close(ABRUPT): evd_free(%p) returns %x\n",\r
- ia_ptr->async_error_evd,\r
- dat_status );\r
- }\r
-\r
- ia_ptr->async_error_evd = NULL;\r
- }\r
-\r
- /*\r
- * Release our reference on the hca_handle. If we are the last\r
- * one, close it\r
- */\r
- dapli_ia_release_hca (hca_ptr);\r
-\r
- dapls_ia_free (ia_ptr);\r
-\r
- return DAT_SUCCESS; /* Abrupt close can't fail. */\r
-}\r
-\r
-\r
-/*\r
- * dapl_ia_graceful_close\r
- *\r
- * Performs an graceful close of the IA\r
- *\r
- * Input:\r
- * ia_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * status\r
- *\r
- */\r
-\r
-DAT_RETURN\r
-dapl_ia_graceful_close (\r
- IN DAPL_IA *ia_ptr )\r
-{\r
- DAT_RETURN dat_status;\r
- DAT_RETURN cur_dat_status;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_LLIST_ENTRY *entry;\r
- DAPL_HCA *hca_ptr;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( !dapl_llist_is_empty (&ia_ptr->rmr_list_head) ||\r
- !dapl_llist_is_empty (&ia_ptr->rsp_list_head) ||\r
- !dapl_llist_is_empty (&ia_ptr->ep_list_head) ||\r
- !dapl_llist_is_empty (&ia_ptr->lmr_list_head) ||\r
- !dapl_llist_is_empty (&ia_ptr->psp_list_head) ||\r
- !dapl_llist_is_empty (&ia_ptr->pz_list_head) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);\r
- goto bail;\r
- }\r
-\r
- /* if the async evd does not need to be cleaned up */\r
- /* (ie. it was not created by dapl_ia_open) */\r
- /* then the evd list should be empty */\r
- if ( DAT_FALSE == ia_ptr->cleanup_async_error_evd )\r
- {\r
- if ( !dapl_llist_is_empty (&ia_ptr->evd_list_head) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);\r
- goto bail;\r
- }\r
- }\r
- /* else the async evd should be the only evd in */\r
- /* the list. */\r
- else\r
- {\r
- evd_ptr = (dapl_llist_is_empty (&ia_ptr->evd_list_head)\r
- ? NULL : dapl_llist_peek_head (&ia_ptr->evd_list_head));\r
-\r
- if ( evd_ptr != NULL &&\r
- ! (evd_ptr->evd_flags & DAT_EVD_ASYNC_FLAG) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);\r
- goto bail;\r
- }\r
-\r
- entry = ia_ptr->evd_list_head;\r
-\r
- /* if the async evd is not the only element in the list */\r
- if ( entry->blink != entry->flink )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * If the async evd has a non-unary ref count (i.e. it's in\r
- * use by someone besides us.\r
- */\r
- if ( evd_ptr->evd_ref_count != 1 )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * We've validated the call; now we can start the teardown.\r
- * Because we're in the IA close routine, we're safe from races with DAPL\r
- * consumers on this IA (operate/destroy races are disallowed in\r
- * DAPL).\r
- */\r
- hca_ptr = ia_ptr->hca_ptr;\r
-\r
- /* Tear down the async EVD if needed, first shutting down callbacks. */\r
- if ( ia_ptr->async_error_evd &&\r
- (DAT_TRUE == ia_ptr->cleanup_async_error_evd) )\r
- {\r
- cur_dat_status = dapls_ia_teardown_callbacks ( ia_ptr );\r
- if ( DAT_SUCCESS != cur_dat_status )\r
- {\r
- dat_status = cur_dat_status;\r
- }\r
- hca_ptr->async_evd = NULL;\r
- dapl_os_atomic_dec (& ia_ptr->async_error_evd->evd_ref_count);\r
- cur_dat_status = dapl_evd_free (ia_ptr->async_error_evd);\r
- if ( DAT_SUCCESS != cur_dat_status )\r
- {\r
- dat_status = cur_dat_status;\r
- }\r
-\r
- ia_ptr->async_error_evd = NULL;\r
- }\r
-\r
- dapli_ia_release_hca (hca_ptr);\r
-\r
- dapls_ia_free (ia_ptr);\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Release a reference on the HCA handle. If it is 0, close the\r
- * handle. Manipulate under lock to prevent races with threads trying to\r
- * open the HCA.\r
- */\r
-void\r
-dapli_ia_release_hca (\r
- DAPL_HCA *hca_ptr )\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dapl_os_lock (&hca_ptr->lock);\r
- dapl_os_atomic_dec (& hca_ptr->handle_ref_count );\r
- if ( hca_ptr->handle_ref_count == 0 )\r
- {\r
-\r
-#ifndef NO_NAME_SERVICE\r
- /*\r
- * Remove an record {ServiceID, IP-address} \r
- */\r
- dat_status = dapls_ns_remove_gid_map (hca_ptr);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dapls_ns_revmove_gid_map failed %d\n", dat_status);\r
- }\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
- /*\r
- * Get rid of the cqd associated with the hca.\r
- * Print out instead of status return as this routine\r
- * shouldn't fail.\r
- */\r
- dat_status = dapls_ib_cqd_destroy (hca_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ERR: Cannot free CQD: err %x\n", dat_status);\r
- }\r
-\r
- dat_status = dapls_ib_close_hca (hca_ptr->ib_hca_handle);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- /* this is not good - I mean, this is bad! */\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "<1> ERROR: hca_close failed %d\n", dat_status);\r
- }\r
- hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;\r
- }\r
- dapl_os_unlock (&hca_ptr->lock);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ia_free\r
- *\r
- * free an IA INFO struct\r
- *\r
- * Input:\r
- * ia_ptr\r
- *\r
- * Output:\r
- * one\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_ia_free ( DAPL_IA *ia_ptr )\r
-{\r
- dapl_os_assert (ia_ptr->header.magic == DAPL_MAGIC_IA);\r
-\r
- dapl_os_assert (ia_ptr->async_error_evd == NULL);\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->lmr_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->rmr_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->ep_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->evd_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->cno_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->psp_list_head));\r
- dapl_os_assert (dapl_llist_is_empty (&ia_ptr->rsp_list_head));\r
-\r
- /*\r
- * deinitialize the header\r
- */\r
- dapl_hca_unlink_ia (ia_ptr->hca_ptr, ia_ptr);\r
- ia_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
- dapl_os_lock_destroy (&ia_ptr->header.lock);\r
-\r
- dapl_os_free (ia_ptr, sizeof (DAPL_IA));\r
-}\r
-\r
-/*\r
- * dapl_ia_link_ep\r
- *\r
- * Add an ep to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * ep_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_ep (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->ep_list_head,\r
- &ep_ptr->header.ia_list_entry,\r
- ep_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_ep\r
- *\r
- * Remove an ep from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * ep_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_ep (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->ep_list_head,\r
- &ep_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_lmr\r
- *\r
- * Add an lmr to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * lmr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_lmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->lmr_list_head,\r
- &lmr_ptr->header.ia_list_entry,\r
- lmr_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_lmr\r
- *\r
- * Remove an lmr from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * lmr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_lmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->lmr_list_head,\r
- &lmr_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_rmr\r
- *\r
- * Add an rmr to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * rmr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_rmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_RMR *rmr_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->rmr_list_head,\r
- &rmr_ptr->header.ia_list_entry,\r
- rmr_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_rmr\r
- *\r
- * Remove an rmr from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * rmr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_rmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_RMR *rmr_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->rmr_list_head,\r
- &rmr_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_pz\r
- *\r
- * Add an pz to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * pz_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_pz (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_PZ *pz_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->pz_list_head,\r
- &pz_ptr->header.ia_list_entry,\r
- pz_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_pz\r
- *\r
- * Remove an pz from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * pz_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_pz (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_PZ *pz_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->pz_list_head,\r
- &pz_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_evd\r
- *\r
- * Add an evd to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * evd_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_evd (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->evd_list_head,\r
- &evd_ptr->header.ia_list_entry,\r
- evd_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_evd\r
- *\r
- * Remove an evd from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * evd_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_evd (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->evd_list_head,\r
- &evd_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_cno\r
- *\r
- * Add an cno to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * cno_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_cno (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->cno_list_head,\r
- &cno_ptr->header.ia_list_entry,\r
- cno_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_unlink_cno\r
- *\r
- * Remove an cno from the ia info structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * cno_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_unlink_cno (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (&ia_ptr->cno_list_head,\r
- &cno_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapl_ia_link_psp\r
- *\r
- * Add an psp to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * sp_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_psp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->psp_list_head,\r
- &sp_ptr->header.ia_list_entry,\r
- sp_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * daps_ia_unlink_sp\r
- *\r
- * Remove an sp from the appropriate ia rsp or psp queue\r
- *\r
- * Input:\r
- * ia_ptr\r
- * sp_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_ia_unlink_sp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_ptr)\r
-{\r
- DAPL_LLIST_HEAD *list_head;\r
-\r
- if ( sp_ptr->header.handle_type == DAT_HANDLE_TYPE_PSP )\r
- {\r
- list_head = &ia_ptr->psp_list_head;\r
- }\r
- else\r
- {\r
- dapl_os_assert (sp_ptr->header.handle_type == DAT_HANDLE_TYPE_RSP);\r
- list_head = &ia_ptr->rsp_list_head;\r
- }\r
-\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_remove_entry (list_head,\r
- &sp_ptr->header.ia_list_entry);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-/*\r
- * dapls_ia_sp_search\r
- *\r
- * Find an RSP or PSP on the IA list with a matching conn_qual value\r
- *\r
- * Input:\r
- * ia_ptr\r
- * sp_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_SP *\r
-dapls_ia_sp_search (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_CONN_QUAL conn_qual,\r
- IN DAT_BOOLEAN is_psp )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAPL_LLIST_HEAD *list_head;\r
-\r
- if ( is_psp )\r
- {\r
- list_head = &ia_ptr->psp_list_head;\r
- }\r
- else\r
- {\r
- list_head = &ia_ptr->rsp_list_head;\r
- }\r
-\r
- dapl_os_lock (&ia_ptr->header.lock);\r
-\r
- sp_ptr = (dapl_llist_is_empty (list_head) ? NULL :\r
- dapl_llist_peek_head (list_head));\r
-\r
- while (sp_ptr != NULL)\r
- {\r
- if ( sp_ptr->conn_qual == conn_qual )\r
- {\r
- break;\r
- }\r
- sp_ptr = dapl_llist_next_entry (list_head,\r
- &sp_ptr->header.ia_list_entry);\r
- }\r
-\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-\r
- return sp_ptr;\r
-}\r
-\r
-\r
-/*\r
- * dapl_ia_link_rsp\r
- *\r
- * Add an rsp to the IA structure\r
- *\r
- * Input:\r
- * ia_ptr\r
- * sp_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_ia_link_rsp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_ptr)\r
-{\r
- dapl_os_lock (&ia_ptr->header.lock);\r
- dapl_llist_add_head (&ia_ptr->rsp_list_head,\r
- &sp_ptr->header.ia_list_entry,\r
- sp_ptr);\r
- dapl_os_unlock (&ia_ptr->header.lock);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ia_setup_callbacks (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *async_evd_ptr )\r
-{\r
- dapl_ibal_ca_t *p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
-\r
- /* back reference to ia_ptr needed for DAPL_ASYNC_UNAFILIATED callback */\r
- if ( p_ca == NULL )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dapls_ia_setup_callbacks failed %d\n", dat_status);\r
- return (DAT_INVALID_HANDLE);\r
- }\r
- \r
- p_ca->ia_ptr = (DAT_PVOID*)ia_ptr;\r
-\r
- /* unaffiliated handler */\r
- dat_status =\r
- dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_UNAFILIATED,\r
- NULL,\r
- (ib_async_handler_t)dapl_evd_un_async_error_callback,\r
- async_evd_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_un_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- /* affiliated cq handler */\r
- dat_status = dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_CQ_ERROR,\r
- NULL,\r
- (ib_async_handler_t)dapl_evd_cq_async_error_callback,\r
- async_evd_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_cq_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- /* affiliated qp handler */\r
- dat_status = dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_QP_ERROR,\r
- NULL,\r
- (ib_async_handler_t)dapl_evd_qp_async_error_callback,\r
- ia_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_qp_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ia_teardown_callbacks (\r
- IN DAPL_IA *ia_ptr)\r
-{\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
-\r
- /* unaffiliated handler */\r
- dat_status =\r
- dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_UNAFILIATED,\r
- NULL,\r
- (ib_async_handler_t) 0,\r
- NULL);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_un_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- /* affiliated cq handler */\r
- dat_status = dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_CQ_ERROR,\r
- NULL,\r
- (ib_async_handler_t) 0,\r
- NULL);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_cq_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- /* affiliated qp handler */\r
- dat_status = dapls_ib_setup_async_callback (\r
- ia_ptr,\r
- DAPL_ASYNC_QP_ERROR,\r
- NULL,\r
- (ib_async_handler_t) 0,\r
- NULL);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "ib_set_qp_async_error_eh failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * HEADER: dapl_ia_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the IA data structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_IA_UTIL_H_\r
-#define _DAPL_IA_UTIL_H_\r
-\r
-#include "dapl.h"\r
-\r
-DAPL_IA *\r
-dapl_ia_alloc ( \r
- DAT_PROVIDER *provider,\r
- DAPL_HCA *hca_ptr) ;\r
-\r
-DAT_RETURN \r
-dapl_ia_abrupt_close (\r
- IN DAPL_IA *ia_ptr ) ;\r
-\r
-DAT_RETURN \r
-dapl_ia_graceful_close (\r
- IN DAPL_IA *ia_ptr ) ;\r
-\r
-void\r
-dapls_ia_free ( DAPL_IA *ia_ptr ) ;\r
-\r
-void\r
-dapl_ia_link_ep (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_ep (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_info ) ;\r
-\r
-void\r
-dapl_ia_link_lmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_lmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_LMR *lmr_info ) ;\r
-\r
-void\r
-dapl_ia_link_rmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_RMR *rmr_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_rmr (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_RMR *rmr_info ) ;\r
-\r
-void\r
-dapl_ia_link_pz (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_PZ *pz_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_pz (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_PZ *pz_info ) ;\r
-\r
-void\r
-dapl_ia_link_evd (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_evd (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_info ) ;\r
-\r
-void\r
-dapl_ia_link_cno (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_info ) ;\r
-\r
-void\r
-dapl_ia_unlink_cno (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_CNO *cno_info ) ;\r
-\r
-void\r
-dapl_ia_link_psp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_info ) ;\r
-\r
-void\r
-dapls_ia_unlink_sp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_info ) ;\r
-\r
-void\r
-dapl_ia_link_rsp (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_info ) ;\r
-\r
-DAPL_SP *\r
-dapls_ia_sp_search (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_CONN_QUAL conn_qual,\r
- IN DAT_BOOLEAN is_psp ) ;\r
-\r
-DAT_RETURN\r
-dapls_ia_setup_callbacks (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *async_evd_ptr );\r
-\r
-DAT_RETURN\r
-dapls_ia_teardown_callbacks (\r
- IN DAPL_IA *ia_ptr );\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_init.h\r
- *\r
- * PURPOSE: Prototypes for library-interface init and fini functions\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-\r
-#ifndef _DAPL_INIT_H_\r
-#define _DAPL_INIT_H_\r
-\r
-DAPL_EXPORT void DAT_API\r
-DAT_PROVIDER_INIT_FUNC_NAME (\r
- IN const DAT_PROVIDER_INFO *,\r
- IN const char * ); /* instance data */\r
-\r
-DAPL_EXPORT void DAT_API\r
-DAT_PROVIDER_FINI_FUNC_NAME (\r
- IN const DAT_PROVIDER_INFO * );\r
-\r
-extern void\r
-dapl_init ( void ) ;\r
-\r
-extern void\r
-dapl_fini ( void ) ;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_llist.c\r
- *\r
- * PURPOSE: Manage doubly linked lists within the DAPL Reference Implementation\r
- *\r
- * A link list head points to the first member of a linked list, but\r
- * is itself not a member of the list.\r
- *\r
- * +---------------------------------------------+\r
- * | entry entry entry |\r
- * HEAD -> | +-------+ +-------+ +-------+ |\r
- * +--> | flink | --> | flink | --> | flink | >--+\r
- * | data | | data | | data |\r
- * +--< | blink | <-- | blink | <-- | blink | <--|\r
- * | +-------+ +-------+ +-------+ |\r
- * | |\r
- * +---------------------------------------------+\r
- *\r
- * Note: Each of the remove functions takes an assertion failure if\r
- * an element cannot be removed from the list.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_llist_init_head()\r
- *\r
- * Purpose: initialize a linked list head\r
- */\r
-void\r
-dapl_llist_init_head (DAPL_LLIST_HEAD * head)\r
-{\r
- *head = NULL;\r
-}\r
-\r
-/*\r
- * dapl_llist_init_entry()\r
- *\r
- * Purpose: initialize a linked list entry\r
- */\r
-void\r
-dapl_llist_init_entry (DAPL_LLIST_ENTRY * entry)\r
-{\r
- entry->blink = NULL;\r
- entry->flink = NULL;\r
- entry->data = 0;\r
- entry->list_head = NULL;\r
-}\r
-\r
-/*\r
- * dapl_llist_is_empty()\r
- *\r
- * Purpose: returns TRUE if the linked list is empty\r
- */\r
-DAT_BOOLEAN\r
-dapl_llist_is_empty (DAPL_LLIST_HEAD * head)\r
-{\r
- return (*head == NULL);\r
-}\r
-\r
-/*\r
- * dapl_llist_add_head()\r
- *\r
- * Purpose: Add an entry to the head of a linked list\r
- */\r
-void\r
-dapl_llist_add_head (DAPL_LLIST_HEAD * head,\r
- DAPL_LLIST_ENTRY * entry,\r
- void * data)\r
-{\r
- DAPL_LLIST_ENTRY *first;\r
-\r
- /* deal with empty list */\r
- if (dapl_llist_is_empty (head))\r
- {\r
- entry->flink = entry;\r
- entry->blink = entry;\r
- }\r
- else\r
- {\r
- first = *head;\r
- entry->flink = first;\r
- entry->blink = first->blink;\r
- first->blink->flink = entry;\r
- first->blink = entry;\r
- }\r
-\r
- *head = entry;\r
- entry->data = data;\r
- entry->list_head = head;\r
-}\r
-\r
-/*\r
- * dapl_llist_add_tail()\r
- *\r
- * Purpose: Add an entry to the tail of a linked list\r
- */\r
-void\r
-dapl_llist_add_tail (DAPL_LLIST_HEAD * head,\r
- DAPL_LLIST_ENTRY * entry,\r
- void * data)\r
-{\r
- DAPL_LLIST_ENTRY *last;\r
-\r
- /* deal with empty list */\r
- if (dapl_llist_is_empty (head))\r
- {\r
- *head = entry;\r
- entry->flink = entry;\r
- entry->blink = entry;\r
- }\r
- else\r
- {\r
- last = (*head)->blink;\r
- entry->flink = last->flink;\r
- entry->blink = last;\r
- last->flink->blink = entry;\r
- last->flink = entry;\r
- }\r
- entry->data = data;\r
- entry->list_head = head;\r
-}\r
-\r
-\r
-/*\r
- * dapl_llist_add_entry()\r
- *\r
- * Purpose: Add an entry before an element in the list. Does\r
- * not verify the list or the validity of the entries passed in.\r
- */\r
-void\r
-dapl_llist_add_entry (DAPL_LLIST_HEAD * head,\r
- DAPL_LLIST_ENTRY * entry,\r
- DAPL_LLIST_ENTRY * new_entry,\r
- void * data)\r
-{\r
- DAPL_LLIST_ENTRY *last;\r
-\r
- /* deal with empty list */\r
- if (dapl_llist_is_empty (head))\r
- {\r
- *head = entry;\r
- entry->flink = entry;\r
- entry->blink = entry;\r
- }\r
- else\r
- {\r
- last = entry->blink;\r
- entry->blink = new_entry;\r
- last->flink = new_entry;\r
-\r
- new_entry->flink = entry;\r
- new_entry->blink = last;\r
-\r
- }\r
- new_entry->data = data;\r
- new_entry->list_head = head;\r
-}\r
-\r
-/*\r
- * dapl_llist_remove_head()\r
- *\r
- * Purpose: Remove the first entry of a linked list\r
- */\r
-void *\r
-dapl_llist_remove_head (DAPL_LLIST_HEAD *head)\r
-{\r
- DAPL_LLIST_ENTRY *first;\r
-\r
- dapl_os_assert (!dapl_llist_is_empty (head));\r
- first = *head;\r
- *head = first->flink;\r
-\r
- first->flink->blink = first->blink;\r
- first->blink->flink = first->flink;\r
-\r
- if (first->flink == first)\r
- {\r
- *head = NULL;\r
- }\r
- /* clean up the links for good measure */\r
- first->flink = NULL;\r
- first->blink = NULL;\r
- first->list_head = NULL;\r
- return (first->data);\r
-}\r
-\r
-/*\r
- * dapl_llist_remove_tail()\r
- *\r
- * Purpose: Remove the last entry of a linked list\r
- */\r
-void *\r
-dapl_llist_remove_tail (DAPL_LLIST_HEAD *head)\r
-{\r
- DAPL_LLIST_ENTRY *last;\r
-\r
- dapl_os_assert (!dapl_llist_is_empty (head));\r
- last = (*head)->blink;\r
-\r
- last->blink->flink = last->flink;\r
- last->flink->blink = last->blink;\r
-\r
- if (last->flink == last)\r
- {\r
- *head = NULL;\r
- }\r
- /* clean up the links for good measure */\r
- last->flink = NULL;\r
- last->blink = NULL;\r
- last->list_head = NULL;\r
-\r
- return (last->data);\r
-}\r
-\r
-/*\r
- * dapl_llist_remove_entry()\r
- *\r
- * Purpose: Remove the specified entry from a linked list\r
- */\r
-void *\r
-dapl_llist_remove_entry (DAPL_LLIST_HEAD *head, DAPL_LLIST_ENTRY *entry)\r
-{\r
- DAPL_LLIST_ENTRY *first;\r
-\r
- dapl_os_assert (!dapl_llist_is_empty (head));\r
- first = *head;\r
-\r
- /* if it's the first entry, pull it off */\r
- if (first == entry)\r
- {\r
- (*head) = first->flink;\r
- /* if it was the only entry, kill the list */\r
- if (first->flink == first)\r
- {\r
- (*head) = NULL;\r
- }\r
- }\r
-#ifdef VERIFY_LINKED_LIST\r
- else\r
- {\r
- DAPL_LLIST_ENTRY *try_entry;\r
-\r
- try_entry = first->flink;\r
- for (;;)\r
- {\r
- if (try_entry == first)\r
- {\r
- /* not finding the element on the list is a BAD thing */\r
- dapl_os_assert (0);\r
- break;\r
- }\r
- if (try_entry == entry)\r
- {\r
- break;\r
- }\r
- try_entry = try_entry->flink;\r
- }\r
- }\r
-#endif /* VERIFY_LINKED_LIST */\r
-\r
- dapl_os_assert ( entry->list_head == head );\r
- entry->list_head = NULL;\r
-\r
- entry->flink->blink = entry->blink;\r
- entry->blink->flink = entry->flink;\r
- entry->flink = NULL;\r
- entry->blink = NULL;\r
-\r
- return (entry->data);\r
-}\r
-\r
-/*\r
- * dapl_llist_peek_head\r
- */\r
-\r
-void *\r
-dapl_llist_peek_head (DAPL_LLIST_HEAD *head)\r
-{\r
- DAPL_LLIST_ENTRY *first;\r
-\r
- dapl_os_assert (!dapl_llist_is_empty (head));\r
- first = *head;\r
- return (first->data);\r
-}\r
-\r
-\r
-/*\r
- * dapl_llist_next_entry\r
- *\r
- * Obtain the next entry in the list, return NULL when we get to the \r
- * head\r
- */\r
-\r
-void *\r
-dapl_llist_next_entry (IN DAPL_LLIST_HEAD *head, \r
- IN DAPL_LLIST_ENTRY *cur_ent)\r
-{\r
- DAPL_LLIST_ENTRY *next;\r
-\r
- dapl_os_assert (!dapl_llist_is_empty (head));\r
- if ( cur_ent == NULL )\r
- {\r
- next = *head;\r
- } else\r
- {\r
- next = cur_ent->flink;\r
- if ( next == *head )\r
- {\r
- return NULL;\r
- }\r
- }\r
- return (next->data);\r
-}\r
-\r
-#ifdef DAPL_DBG\r
-/*\r
- * dapl_llist_debug_print_list()\r
- *\r
- * Purpose: Prints the linked list for debugging\r
- */\r
-void\r
-dapl_llist_debug_print_list (DAPL_LLIST_HEAD *head)\r
-{\r
- DAPL_LLIST_ENTRY * entry;\r
- DAPL_LLIST_ENTRY * first;\r
- first = *head;\r
- if (!first)\r
- {\r
- dapl_os_printf ("EMPTY_LIST\n");\r
- return;\r
- }\r
- dapl_os_printf ("HEAD %p\n", *head);\r
- dapl_os_printf ("Entry %p %p %p %p\n",\r
- first,\r
- first->flink,\r
- first->blink,\r
- first->data);\r
- entry = first->flink;\r
- while (entry != first)\r
- {\r
- dapl_os_printf ("Entry %p %p %p %p\n",\r
- entry,\r
- entry->flink,\r
- entry->blink,\r
- entry->data);\r
- entry = entry->flink;\r
- }\r
-}\r
-\r
-#endif /* DAPL_DBG */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_lmr_create.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_lmr_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_virtual ( \r
- IN DAPL_IA *ia,\r
- IN DAT_PVOID virt_addr,\r
- IN DAT_VLEN length,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address );\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_lmr ( \r
- IN DAPL_IA *ia,\r
- IN DAPL_LMR *original_lmr,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address );\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_shared_virtual ( \r
- IN DAPL_IA *ia,\r
- IN DAT_SHARED_MEMORY shared_memory,\r
- IN DAT_VLEN length,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address );\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_virtual ( \r
- IN DAPL_IA *ia,\r
- IN DAT_PVOID virt_addr,\r
- IN DAT_VLEN length,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address )\r
-{\r
- DAPL_LMR *lmr;\r
- DAT_REGION_DESCRIPTION reg_desc;\r
- DAT_RETURN dat_status;\r
-\r
- reg_desc.for_va = virt_addr;\r
- dat_status = DAT_SUCCESS;\r
-\r
- lmr = dapl_lmr_alloc (ia, \r
- DAT_MEM_TYPE_VIRTUAL,\r
- reg_desc,\r
- length,\r
- (DAT_PZ_HANDLE) pz, \r
- privileges);\r
-\r
- if ( NULL == lmr )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_mr_register (ia,\r
- lmr,\r
- virt_addr,\r
- length,\r
- privileges);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_lmr_dealloc (lmr);\r
- goto bail;\r
- }\r
-\r
- /* if the LMR context is already in the hash table */\r
- dat_status = dapls_hash_search (ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context,\r
- NULL);\r
- if (dat_status == DAT_SUCCESS)\r
- {\r
- (void)dapls_ib_mr_deregister (lmr);\r
- dapl_lmr_dealloc (lmr);\r
-\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_LMR_IN_USE);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_hash_insert (ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context,\r
- lmr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- (void)dapls_ib_mr_deregister (lmr);\r
- dapl_lmr_dealloc (lmr);\r
-\r
- /* The value returned by dapls_hash_insert(.) is not */\r
- /* returned to the consumer because the spec. requires */\r
- /* that dat_lmr_create(.) return only certain values. */\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_atomic_inc (&pz->pz_ref_count);\r
-\r
- if (NULL != lmr_handle)\r
- {\r
- *lmr_handle = (DAT_LMR_HANDLE) lmr;\r
- }\r
- if (NULL != lmr_context)\r
- {\r
- *lmr_context = lmr->param.lmr_context;\r
- }\r
- if (NULL != rmr_context)\r
- {\r
- *rmr_context = lmr->param.rmr_context;\r
- }\r
- if (NULL != registered_length)\r
- {\r
- *registered_length = lmr->param.registered_size;\r
- }\r
- if (NULL != registered_address)\r
- {\r
- *registered_address = lmr->param.registered_address;\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_lmr ( \r
- IN DAPL_IA *ia,\r
- IN DAPL_LMR *original_lmr,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address )\r
-{\r
- DAPL_LMR *lmr;\r
- DAT_REGION_DESCRIPTION reg_desc;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_lmr_create_lmr (%p, %p, %p, %x, %p, %p, %p, %p)\n",\r
- ia,\r
- original_lmr, \r
- pz, privileges, \r
- lmr_handle, \r
- lmr_context, \r
- registered_length, \r
- registered_address);\r
-\r
- dat_status = dapls_hash_search (ia->hca_ptr->lmr_hash_table, \r
- original_lmr->param.lmr_context, \r
- (DAPL_HASH_DATA *) &lmr);\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- reg_desc.for_lmr_handle = (DAT_LMR_HANDLE) original_lmr;\r
-\r
- lmr = dapl_lmr_alloc (ia, \r
- DAT_MEM_TYPE_LMR,\r
- reg_desc,\r
- 0, /* length is meaningless */\r
- (DAT_PZ_HANDLE) pz,\r
- privileges);\r
-\r
- if (NULL == lmr)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_mr_register_shared (ia,\r
- lmr,\r
- privileges);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_lmr_dealloc (lmr);\r
- goto bail;\r
- }\r
-\r
- /* if the LMR context is already in the hash table */\r
- dat_status = dapls_hash_search (ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context,\r
- NULL);\r
- if (dat_status == DAT_SUCCESS)\r
- {\r
- dapls_ib_mr_deregister (lmr);\r
- dapl_lmr_dealloc (lmr);\r
-\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_LMR_IN_USE);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_hash_insert (ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context,\r
- lmr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapls_ib_mr_deregister (lmr);\r
- dapl_lmr_dealloc (lmr);\r
-\r
- /* The value returned by dapls_hash_insert(.) is not */\r
- /* returned to the consumer because the spec. requires */\r
- /* that dat_lmr_create(.) return only certain values. */\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_atomic_inc (&pz->pz_ref_count);\r
-\r
- if (NULL != lmr_handle)\r
- {\r
- *lmr_handle = (DAT_LMR_HANDLE) lmr;\r
- }\r
- if (NULL != lmr_context)\r
- {\r
- *lmr_context = lmr->param.lmr_context;\r
- }\r
- if (NULL != rmr_context)\r
- {\r
- *rmr_context = lmr->param.rmr_context;\r
- }\r
- if (NULL != registered_length)\r
- {\r
- *registered_length = original_lmr->param.registered_size;\r
- }\r
- if (NULL != registered_address)\r
- {\r
- *registered_address = original_lmr->param.registered_address;\r
- }\r
-\r
- bail:\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapl_lmr_create_shared_virtual ( \r
- IN DAPL_IA *ia,\r
- IN DAT_SHARED_MEMORY shared_memory,\r
- IN DAT_VLEN length,\r
- IN DAPL_PZ *pz,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address )\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_LMR *new_lmr;\r
- DAT_REGION_DESCRIPTION reg_desc;\r
-\r
- reg_desc.for_shared_memory = shared_memory;\r
- dat_status = DAT_SUCCESS;\r
-\r
- new_lmr = dapl_lmr_alloc ( ia, \r
- DAT_MEM_TYPE_SHARED_VIRTUAL,\r
- reg_desc,\r
- length,\r
- (DAT_PZ_HANDLE) pz,\r
- privileges);\r
-\r
- if (NULL == new_lmr)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_memcpy (\r
- new_lmr->param.region_desc.for_shared_memory.shared_memory_id, \r
- shared_memory.shared_memory_id, DAT_LMR_COOKIE_SIZE );\r
-\r
-\r
- dat_status = dapls_ib_mr_register (ia,\r
- new_lmr,\r
- shared_memory.virtual_address,\r
- length,\r
- privileges);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_lmr_dealloc (new_lmr);\r
- goto bail;\r
- }\r
-\r
- /* if the LMR context is already in the hash table */\r
- dat_status = dapls_hash_search (ia->hca_ptr->lmr_hash_table, \r
- new_lmr->param.lmr_context,\r
- NULL);\r
- if (DAT_SUCCESS == dat_status)\r
- {\r
- (void)dapls_ib_mr_deregister (new_lmr);\r
- dapl_lmr_dealloc (new_lmr);\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_hash_insert (ia->hca_ptr->lmr_hash_table, \r
- new_lmr->param.lmr_context,\r
- new_lmr);\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- (void)dapls_ib_mr_deregister (new_lmr);\r
- dapl_lmr_dealloc (new_lmr);\r
- goto bail;\r
-\r
- /* The value returned by dapls_hash_insert(.) is not */\r
- /* returned to the consumer because the spec. requires */\r
- /* that dat_lmr_create(.) return only certain values. */\r
- }\r
-\r
- dat_status = dapls_ib_mr_register_shared ( ia,\r
- new_lmr,\r
- privileges );\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DLCSV: register_shared ret %x, mr_handle %p\n",\r
- dat_status, new_lmr->mr_handle);\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
-\r
- dapl_lmr_dealloc ( new_lmr );\r
- goto bail;\r
- }\r
-\r
- (void) dapl_os_atomic_inc (&pz->pz_ref_count);\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DaLmrCsv: ++ LMR(%p) pz(%p)->ref_count = %d\n", \r
- new_lmr, pz, pz->pz_ref_count );\r
-\r
- if (NULL != lmr_handle)\r
- {\r
- *lmr_handle = (DAT_LMR_HANDLE) new_lmr;\r
- }\r
- if (NULL != lmr_context)\r
- {\r
- *lmr_context = new_lmr->param.lmr_context;\r
- }\r
- if (NULL != rmr_context)\r
- {\r
- *rmr_context = new_lmr->param.rmr_context;\r
- }\r
- if (NULL != registered_length)\r
- {\r
- *registered_length = length;\r
- }\r
- if (NULL != registered_address)\r
- {\r
- *registered_address = (DAT_VADDR) ((uintptr_t) shared_memory.virtual_address);\r
- }\r
- \r
-bail: \r
- return dat_status;\r
- \r
-}\r
-\r
-\r
-\r
-/*\r
- * dapl_lmr_create\r
- *\r
- * DAPL Requirements Version xxx, 6.6.3.1\r
- *\r
- * Register a memory region with an Interface Adaptor.\r
- *\r
- * Input:\r
- * ia_handle\r
- * mem_type\r
- * region_description\r
- * length\r
- * pz_handle\r
- * privileges\r
- *\r
- * Output:\r
- * lmr_handle\r
- * lmr_context\r
- * registered_length\r
- * registered_address\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_MODEL_NOT_SUPPORTED\r
- *\r
- */\r
-DAT_RETURN\r
-dapl_lmr_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_MEM_TYPE mem_type,\r
- IN DAT_REGION_DESCRIPTION region_description,\r
- IN DAT_VLEN length,\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_MEM_PRIV_FLAGS privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address )\r
-{\r
- DAPL_IA *ia;\r
- DAPL_PZ *pz;\r
- DAT_RETURN dat_status;\r
-\r
- if ( DAPL_BAD_HANDLE (ia_handle, DAPL_MAGIC_IA) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
- if ( DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);\r
- goto bail;\r
- }\r
-\r
- ia = (DAPL_IA *) ia_handle;\r
- pz = (DAPL_PZ *) pz_handle;\r
-\r
- switch (mem_type)\r
- {\r
- case DAT_MEM_TYPE_VIRTUAL:\r
- {\r
- dat_status = dapl_lmr_create_virtual ( \r
- ia, region_description.for_va, length, pz, privileges, \r
- lmr_handle, lmr_context, rmr_context, registered_length, \r
- registered_address);\r
- break;\r
- }\r
- case DAT_MEM_TYPE_LMR:\r
- {\r
- DAPL_LMR *lmr;\r
-\r
- if ( DAPL_BAD_HANDLE (region_description.for_lmr_handle, DAPL_MAGIC_LMR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR);\r
- goto bail;\r
- }\r
-\r
- lmr = (DAPL_LMR *) region_description.for_lmr_handle;\r
-\r
- dat_status = dapl_lmr_create_lmr (\r
- ia, lmr, pz, privileges, lmr_handle, \r
- lmr_context, rmr_context, registered_length, registered_address);\r
- break;\r
- }\r
- case DAT_MEM_TYPE_SHARED_VIRTUAL:\r
- {\r
- dat_status = dapl_lmr_create_shared_virtual ( \r
- ia, region_description.for_shared_memory, length, pz, \r
- privileges, lmr_handle, lmr_context, rmr_context, \r
- registered_length, registered_address);\r
- break;\r
- }\r
- default:\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- break;\r
- }\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_lmr_free.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_lmr_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_lmr_free\r
- *\r
- * DAPL Requirements Version xxx, 6.6.3.2\r
- *\r
- * Destroy an instance of the Local Memory Region\r
- *\r
- * Input:\r
- * lmr_handle\r
- *\r
- * Output:\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE \r
- */\r
-\r
-DAT_RETURN\r
-dapl_lmr_free (\r
- IN DAT_LMR_HANDLE lmr_handle )\r
-{\r
- DAPL_LMR *lmr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_lmr_free (%p)\n", lmr_handle);\r
-\r
- if ( DAPL_BAD_HANDLE (lmr_handle, DAPL_MAGIC_LMR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_LMR);\r
- goto bail;\r
- }\r
-\r
- lmr = (DAPL_LMR *) lmr_handle;\r
-\r
- switch (lmr->param.mem_type)\r
- {\r
- case DAT_MEM_TYPE_VIRTUAL:\r
- /* fall through */\r
- case DAT_MEM_TYPE_LMR:\r
- /* fall through */\r
- case DAT_MEM_TYPE_SHARED_VIRTUAL:\r
- {\r
- DAPL_PZ *pz;\r
-\r
- if ( 0 != lmr->lmr_ref_count )\r
- {\r
- return DAT_INVALID_STATE;\r
- }\r
-\r
- dat_status = dapls_hash_remove (lmr->header.owner_ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context, NULL);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_mr_deregister (lmr);\r
-\r
- if (dat_status == DAT_SUCCESS)\r
- {\r
-\r
- pz = (DAPL_PZ *) lmr->param.pz_handle;\r
- dapl_os_atomic_dec (&pz->pz_ref_count);\r
-\r
- dapl_lmr_dealloc (lmr);\r
- }\r
- else\r
- {\r
- /*\r
- * Deregister failed; put it back in the\r
- * hash table.\r
- */\r
- dapls_hash_insert (lmr->header.owner_ia->hca_ptr->lmr_hash_table, \r
- lmr->param.lmr_context, lmr);\r
- }\r
-\r
- break;\r
- }\r
- default:\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "--> DLF: lmr_free(%p) mem_type %d mr_handle %p\n",\r
- lmr, lmr->param.mem_type, lmr->mr_handle);\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- break;\r
- }\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_lmr_query.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_lmr_query\r
- *\r
- * DAPL Requirements Version xxx, 6.6.3.3\r
- *\r
- * Provide the LMR arguments.\r
- *\r
- * Input:\r
- * lmr_handle\r
- * lmr_param_mask\r
- * lmr_param\r
- *\r
- * Output:\r
- * lmr_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_lmr_query (\r
- IN DAT_LMR_HANDLE lmr_handle,\r
- IN DAT_LMR_PARAM_MASK lmr_param_mask,\r
- IN DAT_LMR_PARAM *lmr_param )\r
-{\r
- DAPL_LMR *lmr;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_lmr_query (%p, 0x%x, %p)\n", \r
- lmr_handle, \r
- lmr_param_mask, \r
- lmr_param);\r
-\r
- if ( DAPL_BAD_HANDLE (lmr_handle, DAPL_MAGIC_LMR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_LMR);\r
- goto bail;\r
- }\r
- if (NULL == lmr_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- dat_status = DAT_SUCCESS;\r
- lmr = (DAPL_LMR *) lmr_handle;\r
-\r
- dapl_os_memcpy (lmr_param, &lmr->param, sizeof (DAT_LMR_PARAM));\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_lmr_util.c\r
- *\r
- * PURPOSE: Memory management support routines\r
- * Description: Support routines for LMR functions\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_lmr_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-DAPL_LMR *\r
-dapl_lmr_alloc (\r
- IN DAPL_IA *ia, \r
- IN DAT_MEM_TYPE mem_type, \r
- IN DAT_REGION_DESCRIPTION region_desc,\r
- IN DAT_VLEN length,\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv)\r
-{\r
- DAPL_LMR *lmr;\r
-\r
- /* Allocate LMR */\r
- lmr = (DAPL_LMR *) dapl_os_alloc (sizeof (DAPL_LMR));\r
- if (NULL == lmr)\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (lmr, sizeof (DAPL_LMR));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- lmr->header.provider = ia->header.provider;\r
- lmr->header.magic = DAPL_MAGIC_LMR;\r
- lmr->header.handle_type = DAT_HANDLE_TYPE_LMR;\r
- lmr->header.owner_ia = ia;\r
- lmr->header.user_context.as_64 = 0;\r
- lmr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&lmr->header.ia_list_entry);\r
- dapl_ia_link_lmr (ia, lmr);\r
- dapl_os_lock_init (&lmr->header.lock);\r
-\r
- /* \r
- * initialize the body \r
- */\r
- lmr->param.ia_handle = (DAT_IA_HANDLE) ia;\r
- lmr->param.mem_type = mem_type;\r
- lmr->param.region_desc = region_desc;\r
- lmr->param.length = length;\r
- lmr->param.pz_handle = pz_handle;\r
- lmr->param.mem_priv = mem_priv;\r
- lmr->lmr_ref_count = 0;\r
-\r
- if (mem_type == DAT_MEM_TYPE_SHARED_VIRTUAL)\r
- {\r
- lmr->param.region_desc.for_shared_memory.shared_memory_id = \r
- dapl_os_alloc (DAT_LMR_COOKIE_SIZE);\r
- }\r
-\r
- return (lmr);\r
-}\r
-\r
-void \r
-dapl_lmr_dealloc (\r
- IN DAPL_LMR *lmr)\r
-{\r
- lmr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
- dapl_ia_unlink_lmr (lmr->header.owner_ia, lmr);\r
- dapl_os_lock_destroy (&lmr->header.lock);\r
-\r
- if (lmr->param.mem_type == DAT_MEM_TYPE_SHARED_VIRTUAL)\r
- {\r
- dapl_os_free (lmr->param.region_desc.for_shared_memory.shared_memory_id,\r
- DAT_LMR_COOKIE_SIZE);\r
- } \r
-\r
- dapl_os_free ((void *) lmr, sizeof (DAPL_LMR));\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_lmr_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the LMR data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_LMR_UTIL_H_\r
-#define _DAPL_LMR_UTIL_H_\r
-\r
-#include "dapl_mr_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAPL_LMR *\r
-dapl_lmr_alloc (\r
- IN DAPL_IA *ia, \r
- IN DAT_MEM_TYPE mem_type, \r
- IN DAT_REGION_DESCRIPTION region_desc,\r
- IN DAT_VLEN length,\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv);\r
-\r
-extern void\r
-dapl_lmr_dealloc (\r
- IN DAPL_LMR *lmr);\r
-\r
-STATIC _INLINE_ int32_t\r
-dapl_lmr_convert_privileges (\r
- IN DAT_MEM_PRIV_FLAGS privileges);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Inline Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ int32_t\r
-dapl_lmr_convert_privileges (\r
- IN DAT_MEM_PRIV_FLAGS privileges)\r
-{\r
- int32_t value = 0;\r
-\r
- /*\r
- * if (DAT_MEM_PRIV_LOCAL_READ_FLAG & privileges)\r
- * do nothing\r
- */\r
-\r
- if (DAT_MEM_PRIV_LOCAL_WRITE_FLAG & privileges)\r
- {\r
- value |= IB_ACCESS_LOCAL_WRITE;\r
- }\r
-\r
- if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges)\r
- {\r
- value |= IB_ACCESS_REMOTE_READ;\r
- }\r
-\r
- if (DAT_MEM_PRIV_REMOTE_WRITE_FLAG & privileges)\r
- {\r
- value |= IB_ACCESS_REMOTE_WRITE;\r
- }\r
-\r
- return value;\r
-}\r
-\r
-#endif /* _DAPL_LMR_UTIL_H_*/\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_mr_util.c\r
- *\r
- * PURPOSE: Common Memory Management functions and data structures\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_mr_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * dapl_mr_get_address\r
- *\r
- * Returns the memory address associated with the given memory descriptor\r
- *\r
- */\r
-\r
-DAT_VADDR\r
-dapl_mr_get_address (DAT_REGION_DESCRIPTION desc, DAT_MEM_TYPE type)\r
-{\r
- switch (type)\r
- {\r
- case DAT_MEM_TYPE_VIRTUAL:\r
- {\r
- return (DAT_VADDR) (uintptr_t) desc.for_va;\r
- }\r
- case DAT_MEM_TYPE_LMR:\r
- {\r
- DAPL_LMR *lmr;\r
-\r
- lmr = (DAPL_LMR *) desc.for_lmr_handle;\r
-\r
- /* Since this function is recoursive we cannot inline it */\r
- return dapl_mr_get_address (lmr->param.region_desc, \r
- lmr->param.mem_type);\r
- }\r
- case DAT_MEM_TYPE_SHARED_VIRTUAL:\r
- {\r
- return (DAT_VADDR) (uintptr_t) desc.for_shared_memory.virtual_address;\r
- }\r
- default:\r
- {\r
- dapl_os_assert (0);\r
- return 0;\r
- }\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_mr_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for memory registration functions\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_MR_UTIL_H_\r
-#define _DAPL_MR_UTIL_H_\r
-\r
-#include "dapl.h"\r
-#include "dapl_hash.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_VADDR\r
-dapl_mr_get_address (\r
- IN DAT_REGION_DESCRIPTION desc, \r
- IN DAT_MEM_TYPE type);\r
-\r
-STATIC _INLINE_ DAT_BOOLEAN\r
-dapl_mr_bounds_check (\r
- IN DAT_VADDR addr_a, \r
- IN DAT_VLEN length_a,\r
- IN DAT_VADDR addr_b, \r
- IN DAT_VLEN length_b);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Inline Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * dapl_mr_bounds_check\r
- *\r
- * Returns true if region B is contained within region A\r
- * and false otherwise\r
- *\r
- */\r
-\r
-STATIC _INLINE_ DAT_BOOLEAN\r
-dapl_mr_bounds_check (DAT_VADDR addr_a, DAT_VLEN length_a,\r
- DAT_VADDR addr_b, DAT_VLEN length_b)\r
-{\r
- if ( (addr_a <= addr_b) &&\r
- (addr_b + length_b) <= (addr_a + length_a))\r
- {\r
- return DAT_TRUE;\r
- }\r
- else\r
- {\r
- return DAT_FALSE;\r
- }\r
-}\r
-\r
-#endif /* _DAPL_MR_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_provider.c\r
- *\r
- * PURPOSE: Provider function table\r
- * Description: DAT Interfaces to this provider\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_provider.h"\r
-\r
-extern DAT_RETURN dapl_not_implemented (void);\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Data *\r
- * *\r
- *********************************************************************/\r
-\r
-DAPL_PROVIDER_LIST g_dapl_provider_list;\r
-\r
-\r
-/*\r
- * the function table for this provider\r
- */\r
-\r
-DAT_PROVIDER g_dapl_provider_template =\r
-{\r
- NULL,\r
- 0,\r
- &dapl_ia_open,\r
- &dapl_ia_query,\r
- &dapl_ia_close,\r
-\r
- &dapl_set_consumer_context,\r
- &dapl_get_consumer_context,\r
- &dapl_get_handle_type,\r
-\r
- &dapl_cno_create,\r
- &dapl_cno_modify_agent,\r
- &dapl_cno_query,\r
- &dapl_cno_free,\r
- &dapl_cno_wait,\r
-\r
- &dapl_cr_query,\r
- &dapl_cr_accept,\r
- &dapl_cr_reject,\r
- &dapl_cr_handoff,\r
-\r
- &dapl_evd_create,\r
- &dapl_evd_query,\r
- &dapl_evd_modify_cno,\r
- &dapl_evd_enable,\r
- &dapl_evd_disable,\r
- &dapl_evd_wait,\r
- &dapl_evd_resize,\r
- &dapl_evd_post_se,\r
- &dapl_evd_dequeue,\r
- &dapl_evd_free,\r
-\r
- &dapl_ep_create,\r
- &dapl_ep_query,\r
- &dapl_ep_modify,\r
- &dapl_ep_connect,\r
- &dapl_ep_dup_connect,\r
- &dapl_ep_disconnect,\r
- &dapl_ep_post_send,\r
- &dapl_ep_post_recv,\r
- &dapl_ep_post_rdma_read,\r
- &dapl_ep_post_rdma_write,\r
- &dapl_ep_get_status,\r
- &dapl_ep_free,\r
-\r
- &dapl_lmr_create,\r
- &dapl_lmr_query,\r
- &dapl_lmr_free,\r
-\r
- &dapl_rmr_create,\r
- &dapl_rmr_query,\r
- &dapl_rmr_bind,\r
- &dapl_rmr_free,\r
-\r
- &dapl_psp_create,\r
- &dapl_psp_query,\r
- &dapl_psp_free,\r
-\r
- &dapl_rsp_create,\r
- &dapl_rsp_query,\r
- &dapl_rsp_free,\r
-\r
- &dapl_pz_create,\r
- &dapl_pz_query,\r
- &dapl_pz_free,\r
-\r
- &dapl_psp_create_any,\r
- &dapl_ep_reset,\r
- &dapl_evd_set_unwaitable,\r
- &dapl_evd_clear_unwaitable\r
-};\r
-\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_BOOLEAN\r
-dapl_provider_list_key_cmp (\r
- const char *name_a, \r
- const char *name_b );\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_RETURN\r
-dapl_provider_list_create ( void )\r
-{\r
- DAT_RETURN status;\r
-\r
- status = DAT_SUCCESS;\r
-\r
- /* create the head node */\r
- g_dapl_provider_list.head = dapl_os_alloc (sizeof (DAPL_PROVIDER_LIST_NODE));\r
- if ( NULL == g_dapl_provider_list.head )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_memzero (g_dapl_provider_list.head, sizeof (DAPL_PROVIDER_LIST_NODE));\r
-\r
- /* create the tail node */\r
- g_dapl_provider_list.tail = dapl_os_alloc (sizeof (DAPL_PROVIDER_LIST_NODE));\r
- if ( NULL == g_dapl_provider_list.tail )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dapl_os_memzero (g_dapl_provider_list.tail, sizeof (DAPL_PROVIDER_LIST_NODE));\r
-\r
- g_dapl_provider_list.head->next = g_dapl_provider_list.tail;\r
- g_dapl_provider_list.tail->prev = g_dapl_provider_list.head;\r
- g_dapl_provider_list.size = 0;\r
- g_dapl_provider_list.initialized = DAT_TRUE;\r
-\r
-bail:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != g_dapl_provider_list.head )\r
- {\r
- dapl_os_free (g_dapl_provider_list.head, sizeof (DAPL_PROVIDER_LIST_NODE));\r
- }\r
-\r
- if ( NULL != g_dapl_provider_list.tail )\r
- {\r
- dapl_os_free (g_dapl_provider_list.tail, sizeof (DAPL_PROVIDER_LIST_NODE));\r
- }\r
- g_dapl_provider_list.initialized = DAT_FALSE;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_provider_list_destroy ( void )\r
-{\r
- DAPL_PROVIDER_LIST_NODE *cur_node;\r
-\r
- while ( NULL != g_dapl_provider_list.head )\r
- {\r
- cur_node = g_dapl_provider_list.head;\r
- g_dapl_provider_list.head = cur_node->next;\r
-\r
- dapl_os_free (cur_node, sizeof (DAPL_PROVIDER_LIST_NODE));\r
- }\r
-\r
- g_dapl_provider_list.initialized = DAT_FALSE;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_COUNT\r
-dapl_provider_list_size ( void )\r
-{\r
- return g_dapl_provider_list.size;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_provider_list_insert (\r
- IN const char *name,\r
- IN DAT_PROVIDER **p_data )\r
-{\r
- DAPL_PROVIDER_LIST_NODE *cur_node, *prev_node, *next_node;\r
- DAT_RETURN status;\r
- unsigned int len;\r
-\r
- status = DAT_SUCCESS;\r
-\r
- cur_node = dapl_os_alloc (sizeof (DAPL_PROVIDER_LIST_NODE));\r
-\r
- if ( NULL == cur_node )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- if ( g_dapl_provider_list.initialized != DAT_TRUE )\r
- {\r
- status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- \r
- len = dapl_os_strlen(name);\r
-\r
- if ( DAT_NAME_MAX_LENGTH <= len )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- \r
- /* insert node at end of list to preserve registration order*/\r
- prev_node = g_dapl_provider_list.tail->prev;\r
- next_node = g_dapl_provider_list.tail;\r
-\r
- dapl_os_memcpy (cur_node->name, name, len);\r
- cur_node->name[len] = '\0';\r
- cur_node->data = g_dapl_provider_template;\r
- cur_node->data.device_name = cur_node->name;\r
- cur_node->next = next_node;\r
- cur_node->prev = prev_node;\r
-\r
- prev_node->next = cur_node;\r
- next_node->prev = cur_node;\r
-\r
- g_dapl_provider_list.size++;\r
-\r
- if ( NULL != p_data )\r
- {\r
- *p_data = &cur_node->data;\r
- }\r
-\r
-bail:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != cur_node )\r
- {\r
- dapl_os_free (cur_node, sizeof (DAPL_PROVIDER_LIST_NODE));\r
- }\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_provider_list_search (\r
- IN const char *name,\r
- OUT DAT_PROVIDER **p_data )\r
-{\r
- DAPL_PROVIDER_LIST_NODE *cur_node;\r
- DAT_RETURN status;\r
- \r
- status = DAT_ERROR (DAT_PROVIDER_NOT_FOUND,0);\r
-\r
- if ( g_dapl_provider_list.initialized != DAT_TRUE )\r
- {\r
- status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- \r
-\r
- for (cur_node = g_dapl_provider_list.head->next;\r
- g_dapl_provider_list.tail != cur_node;\r
- cur_node = cur_node->next)\r
- {\r
- if ( dapl_provider_list_key_cmp (cur_node->name, name) )\r
- {\r
- if ( NULL != p_data )\r
- {\r
- *p_data = &cur_node->data;\r
- }\r
- \r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
- }\r
-\r
-bail:\r
- return status;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapl_provider_list_remove (\r
- IN const char *name )\r
-{\r
- DAPL_PROVIDER_LIST_NODE *cur_node, *prev_node, *next_node;\r
- DAT_RETURN status;\r
-\r
- status = DAT_ERROR (DAT_PROVIDER_NOT_FOUND,0);\r
-\r
- if ( g_dapl_provider_list.initialized != DAT_TRUE )\r
- {\r
- status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
- \r
- for (cur_node = g_dapl_provider_list.head->next;\r
- g_dapl_provider_list.tail != cur_node;\r
- cur_node = cur_node->next)\r
- {\r
- if ( dapl_provider_list_key_cmp (cur_node->name, name) )\r
- {\r
- prev_node = cur_node->prev;\r
- next_node = cur_node->next;\r
-\r
- prev_node->next = next_node;\r
- next_node->prev = prev_node;\r
-\r
- dapl_os_free (cur_node, sizeof (DAPL_PROVIDER_LIST_NODE));\r
-\r
- g_dapl_provider_list.size--;\r
-\r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
- }\r
-\r
-bail:\r
- return status;\r
-}\r
-\r
-\r
-DAT_BOOLEAN\r
-dapl_provider_list_key_cmp (\r
- const char *name_a,\r
- const char *name_b )\r
-{\r
- unsigned int len;\r
-\r
- len = dapl_os_strlen (name_a);\r
-\r
- if ( dapl_os_strlen (name_b) != len )\r
- {\r
- return DAT_FALSE;\r
- }\r
- else if ( dapl_os_memcmp (name_a, name_b, len) )\r
- {\r
- return DAT_FALSE;\r
- }\r
- else\r
- {\r
- return DAT_TRUE;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_provider.h\r
- *\r
- * PURPOSE: Provider function table\r
- * Description: DAT Interfaces to this provider\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_PROVIDER_H_\r
-#define _DAPL_PROVIDER_H_\r
-\r
-#include "dapl.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Structures *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct DAPL_PROVIDER_LIST_NODE\r
-{\r
- char name[DAT_NAME_MAX_LENGTH];\r
- DAT_PROVIDER data;\r
- struct DAPL_PROVIDER_LIST_NODE *next;\r
- struct DAPL_PROVIDER_LIST_NODE *prev;\r
-} DAPL_PROVIDER_LIST_NODE;\r
-\r
-\r
-typedef struct DAPL_PROVIDER_LIST\r
-{\r
- DAPL_PROVIDER_LIST_NODE *head;\r
- DAPL_PROVIDER_LIST_NODE *tail;\r
- DAT_COUNT size;\r
- DAT_BOOLEAN initialized;\r
-} DAPL_PROVIDER_LIST;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Data *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAPL_PROVIDER_LIST g_dapl_provider_list;\r
-extern DAT_PROVIDER g_dapl_provider_template;\r
-extern int g_dapl_loopback_connection;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_RETURN\r
-dapl_provider_list_create( void );\r
-\r
-extern DAT_RETURN\r
-dapl_provider_list_destroy( void );\r
-\r
-extern DAT_COUNT\r
-dapl_provider_list_size( void );\r
-\r
-extern DAT_RETURN\r
-dapl_provider_list_insert(\r
- IN const char *name,\r
- OUT DAT_PROVIDER **p_data );\r
-\r
-extern DAT_RETURN\r
-dapl_provider_list_search(\r
- IN const char *name,\r
- OUT DAT_PROVIDER **p_data );\r
-\r
-extern DAT_RETURN\r
-dapl_provider_list_remove(\r
- IN const char *name );\r
-\r
-\r
-#endif /* _DAPL_PROVIDER_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_psp_create.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_psp_create\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.1.1\r
- *\r
- * Create a persistent Public Service Point that can recieve multiple\r
- * requests for connections and generate multiple connection request\r
- * instances that wil be delivered to the specified Event Dispatcher\r
- * in a notification event.\r
- *\r
- * Input:\r
- * ia_handle\r
- * conn_qual\r
- * evd_handle\r
- * psp_flags\r
- *\r
- * Output:\r
- * psp_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_CONN_QUAL_IN_USE\r
- * DAT_MODEL_NOT_SUPPORTED\r
- */\r
-DAT_RETURN\r
-dapl_psp_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_CONN_QUAL conn_qual,\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_PSP_FLAGS psp_flags,\r
- OUT DAT_PSP_HANDLE *psp_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAT_BOOLEAN sp_found;\r
- DAT_RETURN dat_status;\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- if ( psp_handle == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG5);\r
- goto bail;\r
- }\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- if ( ! (evd_ptr->evd_flags & DAT_EVD_CR_FLAG) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- if (psp_flags != DAT_PSP_CONSUMER_FLAG &&\r
- psp_flags != DAT_PSP_PROVIDER_FLAG)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
- \r
-\r
- /*\r
- * See if we have a quiescent listener to use for this PSP, else\r
- * create one and set it listening\r
- */\r
- sp_ptr = dapls_ia_sp_search (ia_ptr, conn_qual, DAT_TRUE);\r
- sp_found = DAT_TRUE;\r
- if (sp_ptr == NULL)\r
- {\r
- /* Allocate PSP */\r
- sp_found = DAT_FALSE;\r
- sp_ptr = dapls_sp_alloc ( ia_ptr, DAT_TRUE );\r
- if ( sp_ptr == NULL )\r
- {\r
- dat_status = \r
- DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- }\r
- else if (sp_ptr->listening == DAT_TRUE)\r
- {\r
- dat_status = DAT_ERROR (DAT_CONN_QUAL_IN_USE, 0);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Fill out the args for a PSP\r
- */\r
- sp_ptr->ia_handle = ia_handle;\r
- sp_ptr->conn_qual = conn_qual;\r
- sp_ptr->evd_handle = evd_handle;\r
- sp_ptr->psp_flags = psp_flags;\r
- sp_ptr->ep_handle = NULL;\r
-\r
- /*\r
- * Take a reference on the EVD handle\r
- */\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
-\r
- /* \r
- * Set up a listener for a connection. Connections can arrive\r
- * even before this call returns!\r
- */\r
- sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING;\r
- sp_ptr->listening = DAT_TRUE;\r
-\r
- /*\r
- * If this is a new sp we need to add it to the IA queue, and set up\r
- * a conn_listener.\r
- */\r
- if (sp_found == DAT_FALSE)\r
- {\r
- /* Link it onto the IA before enabling it to receive conn\r
- * requests\r
- */\r
- dapl_ia_link_psp (ia_ptr, sp_ptr);\r
-\r
- dat_status = dapls_ib_setup_conn_listener ( ia_ptr,\r
- conn_qual, \r
- sp_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- /*\r
- * Have a problem setting up the connection, something\r
- * wrong! Decrements the EVD refcount & release it.\r
- */\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> dapl_psp_create setup_conn_listener failed: %x\n", \r
- dat_status);\r
-\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * Return handle to the user\r
- */\r
- *psp_handle = (DAT_PSP_HANDLE)sp_ptr;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_psp_create.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_psp_create_any\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.3.3\r
- *\r
- * Create a persistent Public Service Point that can recieve multiple\r
- * requests for connections and generate multiple connection request\r
- * instances that wil be delivered to the specified Event Dispatcher\r
- * in a notification event. Differs from dapl_psp_create() in that\r
- * the conn_qual is selected by the implementation and returned to\r
- * the user.\r
- *\r
- * Input:\r
- * ia_handle\r
- * evd_handle\r
- * psp_flags\r
- *\r
- * Output:\r
- * conn_qual\r
- * psp_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- * DAT_CONN_QUAL_IN_USE\r
- * DAT_MODEL_NOT_SUPPORTED\r
- */\r
-DAT_RETURN\r
-dapl_psp_create_any (\r
- IN DAT_IA_HANDLE ia_handle,\r
- OUT DAT_CONN_QUAL *conn_qual,\r
- IN DAT_EVD_HANDLE evd_handle,\r
- IN DAT_PSP_FLAGS psp_flags,\r
- OUT DAT_PSP_HANDLE *psp_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAT_RETURN dat_status;\r
- static DAT_CONN_QUAL hint_conn_qual = 1000; /* seed value */\r
- DAT_CONN_QUAL limit_conn_qual;\r
-\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
- if (DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- if ( psp_handle == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG5);\r
- goto bail;\r
- }\r
- if (conn_qual == NULL)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- if ( ! (evd_ptr->evd_flags & DAT_EVD_CR_FLAG) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- if (psp_flags != DAT_PSP_CONSUMER_FLAG &&\r
- psp_flags != DAT_PSP_PROVIDER_FLAG)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
- \r
- /* Allocate PSP */\r
- sp_ptr = dapls_sp_alloc ( ia_ptr, DAT_TRUE );\r
- if ( sp_ptr == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Fill out the args for a PSP\r
- */\r
- sp_ptr->ia_handle = ia_handle;\r
- sp_ptr->evd_handle = evd_handle;\r
- sp_ptr->psp_flags = psp_flags;\r
- sp_ptr->ep_handle = NULL;\r
-\r
- /*\r
- * Take a reference on the EVD handle\r
- */\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
-\r
- /* Link it onto the IA */\r
- dapl_ia_link_psp (ia_ptr, sp_ptr);\r
-\r
- /* \r
- * Set up a listener for a connection. Connections can arrive\r
- * even before this call returns!\r
- */\r
- sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING;\r
- sp_ptr->listening = DAT_TRUE;\r
-\r
- limit_conn_qual = 0;\r
- dat_status = ~DAT_SUCCESS;\r
- \r
- while (dat_status != DAT_SUCCESS)\r
- { \r
- srand ( (DAT_UINT32)dapl_os_get_ticks () );\r
- hint_conn_qual += rand();\r
- sp_ptr->conn_qual = hint_conn_qual;\r
-\r
- dat_status = dapls_ib_setup_conn_listener ( ia_ptr,\r
- sp_ptr->conn_qual,\r
- sp_ptr );\r
- /*\r
- * If we have a big number of tries and we still haven't\r
- * found a service_ID we can use, bail out with an error,\r
- * something is wrong!\r
- */\r
- if ( limit_conn_qual++ > 100000)\r
- {\r
- dat_status = DAT_CONN_QUAL_UNAVAILABLE;\r
- break;\r
- }\r
- }\r
- \r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- /*\r
- * Have a problem setting up the connection, something wrong!\r
- */\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
-\r
- dapl_os_printf ("--> dapl_psp_create cannot set up conn listener: %x\n", dat_status);\r
-\r
- goto bail;\r
- }\r
-\r
- /*\r
- * Return handle to the user\r
- */\r
- *conn_qual = sp_ptr->conn_qual;\r
- *psp_handle = (DAT_PSP_HANDLE)sp_ptr;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_psp_free.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_psp_free\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.1.2\r
- *\r
- * Destroy a specific instance of a Service Point.\r
- *\r
- * Input:\r
- * psp_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_psp_free (\r
- IN DAT_PSP_HANDLE psp_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- sp_ptr = (DAPL_SP *) psp_handle;\r
- dat_status = DAT_SUCCESS;\r
- /*\r
- * Verify handle\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, ">>> dapl_psp_free %p\n", psp_handle);\r
-\r
- if ( DAPL_BAD_HANDLE (sp_ptr, DAPL_MAGIC_PSP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_PSP);\r
- goto bail;\r
- }\r
-\r
- /* ia_ptr = (DAPL_IA *)sp_ptr->header.owner_ia; */\r
- ia_ptr = sp_ptr->header.owner_ia;\r
- /* \r
- * Remove the connection listener if it has been established\r
- * and there are no current connections in progress.\r
- * If we defer removing the sp it becomes something of a zombie\r
- * container until the last connection is disconnected, after\r
- * which it will be cleaned up.\r
- */\r
- dapl_os_lock (&sp_ptr->header.lock);\r
-\r
- sp_ptr->listening = DAT_FALSE;\r
-\r
- /* Release reference on EVD. If an error was encountered in a previous\r
- * free the evd_handle will be NULL\r
- */\r
- if (sp_ptr->evd_handle)\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- }\r
-\r
- /*\r
- * Release the base resource if there are no outstanding\r
- * connections; else the last disconnect on this PSP will free it\r
- * up. The PSP is used to contain CR records for each connection,\r
- * which contain information necessary to disconnect.\r
- */\r
- if ( (sp_ptr->state == DAPL_SP_STATE_PSP_LISTENING ||\r
- sp_ptr->state == DAPL_SP_STATE_PSP_PENDING) &&\r
- sp_ptr->cr_list_count == 0 )\r
- {\r
- sp_ptr->state = DAPL_SP_STATE_FREE;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- dat_status = dapls_ib_remove_conn_listener ( ia_ptr,\r
- sp_ptr );\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- /* revert to entry state on error */\r
- sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING;\r
- goto bail;\r
- }\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
- }\r
- else\r
- {\r
- /* The PSP is now in the pending state, where it will sit until\r
- * the last connection terminates or the app uses the same\r
- * ServiceID again, which will reactivate it.\r
- */\r
- sp_ptr->state = DAPL_SP_STATE_PSP_PENDING;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, ">>> dapl_psp_free: PSP PENDING\n");\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_psp_query.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_psp_query\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.1.3\r
- *\r
- * Provide arguments of the public service points\r
- *\r
- * Input:\r
- * psp_handle\r
- * psp_args_mask\r
- *\r
- * Output:\r
- * psp_args\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_psp_query (\r
- IN DAT_PSP_HANDLE psp_handle,\r
- IN DAT_PSP_PARAM_MASK psp_args_mask,\r
- OUT DAT_PSP_PARAM *psp_param )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAT_RETURN dat_status;\r
- UNREFERENCED_PARAMETER(psp_args_mask);\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (psp_handle, DAPL_MAGIC_PSP) ||\r
- ((DAPL_SP *)psp_handle)->listening != DAT_TRUE )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_PSP);\r
- goto bail;\r
- }\r
-\r
- if (NULL == psp_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- sp_ptr = (DAPL_SP *) psp_handle;\r
-\r
- /*\r
- * Fill in the PSP params\r
- */\r
- psp_param->ia_handle = sp_ptr->ia_handle;\r
- psp_param->conn_qual = sp_ptr->conn_qual;\r
- psp_param->evd_handle = sp_ptr->evd_handle;\r
- psp_param->psp_flags = sp_ptr->psp_flags;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_pz_create.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_pz_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_pz_create\r
- *\r
- * DAPL Requirements Version xxx, 6.6.2.1\r
- *\r
- * Create an instance of a protection zone\r
- *\r
- * Input:\r
- * ia_handle\r
- *\r
- * Output:\r
- * pz_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_pz_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- OUT DAT_PZ_HANDLE *pz_handle)\r
-{\r
- DAPL_IA *ia;\r
- DAPL_PZ *pz;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_pz_create (%p, %p)\n",\r
- ia_handle, \r
- pz_handle);\r
-\r
- dat_status = DAT_SUCCESS;\r
- if ( DAPL_BAD_HANDLE (ia_handle, DAPL_MAGIC_IA) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
-\r
- if (NULL == pz_handle)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- ia = (DAPL_IA *) ia_handle;\r
-\r
- pz = dapl_pz_alloc (ia);\r
- if ( pz == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_pd_alloc (ia, pz);\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_pz_dealloc (pz);\r
- pz = NULL;\r
- }\r
-\r
- *pz_handle = pz;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_pz_create.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_pz_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_pz_free\r
- *\r
- * DAPL Requirements Version xxx, 6.6.2.1\r
- *\r
- * Remove an instance of a protection zone\r
- *\r
- * Input:\r
- * pz_handle\r
- *\r
- * Output:\r
- * None.\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- */\r
-DAT_RETURN\r
-dapl_pz_free (\r
- IN DAT_PZ_HANDLE pz_handle)\r
-{\r
- DAPL_PZ *pz;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_pz_free (%p)\n", pz_handle);\r
-\r
- dat_status = DAT_SUCCESS;\r
- if ( DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_PZ);\r
- goto bail;\r
- }\r
-\r
- pz = (DAPL_PZ *) pz_handle;\r
-\r
- if ( 0 != pz->pz_ref_count )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_PZ_IN_USE);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_pd_free (pz);\r
-\r
- if ( dat_status == DAT_SUCCESS )\r
- {\r
- dapl_pz_dealloc (pz);\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_pz_query.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_pz_query\r
- *\r
- * DAPL Requirements Version xxx, 6.6.2.1\r
- *\r
- * Return the ia associated with the protection zone pz\r
- *\r
- * Input:\r
- * pz_handle\r
- * pz_param_mask\r
- *\r
- * Output:\r
- * pz_param\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_pz_query (\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_PZ_PARAM_MASK pz_param_mask,\r
- OUT DAT_PZ_PARAM *pz_param)\r
-{\r
- DAPL_PZ *pz;\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_API,\r
- "dapl_pz_query (%p, %x, %p)\n", \r
- pz_handle, \r
- pz_param_mask, \r
- pz_param);\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_PZ);\r
- goto bail;\r
- }\r
- if (NULL == pz_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- pz = (DAPL_PZ *) pz_handle;\r
-\r
- /* Since the DAT_PZ_ARGS values are easily accessible, */\r
- /* don't bother checking the DAT_PZ_ARGS_MASK value */\r
- pz_param->ia_handle = (DAT_IA_HANDLE) pz->header.owner_ia;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_pz_util.c\r
- *\r
- * PURPOSE: Manage PZ structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_pz_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_pz_alloc\r
- *\r
- * alloc and initialize an PZ struct\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * pz_ptr\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAPL_PZ *\r
-dapl_pz_alloc (\r
- IN DAPL_IA *ia)\r
-{\r
- DAPL_PZ *pz;\r
-\r
- /* Allocate PZ */\r
- pz = (DAPL_PZ *) dapl_os_alloc (sizeof (DAPL_PZ));\r
- if (NULL == pz)\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (pz, sizeof (DAPL_PZ));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- pz->header.provider = ia->header.provider;\r
- pz->header.magic = DAPL_MAGIC_PZ;\r
- pz->header.handle_type = DAT_HANDLE_TYPE_PZ;\r
- pz->header.owner_ia = ia;\r
- pz->header.user_context.as_64 = 0;\r
- pz->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&pz->header.ia_list_entry);\r
- dapl_ia_link_pz (ia, pz);\r
- dapl_os_lock_init (&pz->header.lock);\r
-\r
- /* \r
- * initialize the body \r
- */\r
- pz->pz_ref_count = 0;\r
-\r
- return (pz);\r
-}\r
-\r
-/*\r
- * dapl_pz_free\r
- *\r
- * free an PZ struct\r
- *\r
- * Input:\r
- * pz_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_pz_dealloc (\r
- IN DAPL_PZ *pz)\r
-{\r
- pz->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
- dapl_ia_unlink_pz (pz->header.owner_ia, pz);\r
- dapl_os_lock_destroy (&pz->header.lock);\r
-\r
- dapl_os_free (pz, sizeof (DAPL_PZ));\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_pz_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the PZ data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_PZ_UTIL_H_\r
-#define _DAPL_PZ_UTIL_H_\r
-\r
-#include "dapl.h"\r
-\r
-extern DAPL_PZ *\r
-dapl_pz_alloc (\r
- IN DAPL_IA *ia);\r
-\r
-extern void\r
-dapl_pz_dealloc (\r
- IN DAPL_PZ *pz);\r
-\r
-#endif /* _DAPL_PZ_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ring_buffer_util.c\r
- *\r
- * PURPOSE: Ring buffer management\r
- * Description: Support and management functions for ring buffers\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-\r
-/*\r
- * dapls_rbuf_alloc\r
- *\r
- * Given a DAPL_RING_BUFFER, initialize it and provide memory for\r
- * the ringbuf itself. A passed in size will be adjusted to the next\r
- * largest power of two number to simplify management.\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- * size number of elements to allocate & manage\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_rbuf_alloc (\r
- INOUT DAPL_RING_BUFFER *rbuf,\r
- IN DAT_COUNT size )\r
-{\r
- unsigned int rsize; /* real size */\r
-\r
- /* The circular buffer must be allocated one too large.\r
- * This eliminates any need for a distinct counter, as that\r
- * having the two pointers equal always means "empty" -- never "full"\r
- */\r
- size++;\r
-\r
- /* Put size on a power of 2 boundary */\r
- rsize = 1;\r
- while ( (DAT_COUNT)rsize < size)\r
- {\r
- rsize <<= 1;\r
- }\r
-\r
- rbuf->base = (void *) dapl_os_alloc (rsize * sizeof (void *));\r
- if ( rbuf->base != NULL )\r
- {\r
- rbuf->lim = rsize - 1;\r
- rbuf->head = 0;\r
- rbuf->tail = 0;\r
- }\r
- else\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_rbuf_realloc\r
- *\r
- * Resizes an empty DAPL_RING_BUFFER. This function is not thread safe;\r
- * adding or removing elements from a ring buffer while resizing \r
- * will have indeterminate results.\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- * size number of elements to allocate & manage\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_STATE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_rbuf_realloc (\r
- INOUT DAPL_RING_BUFFER *rbuf,\r
- IN DAT_COUNT size )\r
-{\r
- int rsize; /* real size */\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- /* if the ring buffer is not empty */\r
- if ( rbuf->head != rbuf->tail )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
- goto bail;\r
- }\r
-\r
- /* Put size on a power of 2 boundary */\r
- rsize = 1;\r
- while (rsize < size)\r
- {\r
- rsize <<= 1;\r
- }\r
-\r
- rbuf->base = (void *) dapl_os_realloc (rbuf->base, rsize * sizeof (void *));\r
- if ( NULL == rbuf->base )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- rbuf->lim = rsize - 1;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapls_rbuf_destroy\r
- *\r
- * Release the buffer and reset pointers to a DAPL_RING_BUFFER\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_rbuf_destroy (\r
- IN DAPL_RING_BUFFER *rbuf)\r
-{\r
- if ( (NULL == rbuf) || \r
- (NULL == rbuf->base) )\r
- {\r
- return;\r
- }\r
-\r
- dapl_os_free (rbuf->base, (rbuf->lim + 1) * sizeof (void *));\r
- rbuf->base = NULL;\r
- rbuf->lim = 0;\r
-\r
- return;\r
-}\r
-\r
-/*\r
- * dapls_rbuf_add\r
- *\r
- * Add an entry to the ring buffer\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- * entry entry to add\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES (queue full)\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_rbuf_add (\r
- IN DAPL_RING_BUFFER *rbuf,\r
- IN void *entry)\r
-{\r
- int pos;\r
- int val;\r
-\r
- while ( ((rbuf->head + 1) & rbuf->lim) != (rbuf->tail & rbuf->lim) )\r
- {\r
- pos = rbuf->head;\r
- val = dapl_os_atomic_assign (&rbuf->head, pos, pos + 1);\r
- if ( val == pos )\r
- {\r
- pos = (pos + 1) & rbuf->lim; /* verify in range */\r
- rbuf->base[pos] = entry;\r
- return DAT_SUCCESS;\r
- }\r
- }\r
-\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
-\r
-}\r
-\r
-\r
-/*\r
- * dapls_rbuf_remove\r
- *\r
- * Remove an entry from the ring buffer\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- *\r
- * Output:\r
- * entry entry removed from the ring buffer\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_QUEUE_EMPTY\r
- \r
- */\r
-void *\r
-dapls_rbuf_remove (\r
- IN DAPL_RING_BUFFER *rbuf )\r
-{\r
- int pos;\r
- int val;\r
-\r
- while ( rbuf->head != rbuf->tail )\r
- {\r
- pos = rbuf->tail;\r
- val = dapl_os_atomic_assign (&rbuf->tail, pos, pos + 1);\r
- if ( val == pos )\r
- {\r
- pos = (pos + 1) & rbuf->lim; /* verify in range */\r
-\r
- return (rbuf->base[pos]);\r
- }\r
- }\r
-\r
- return NULL;\r
-\r
-}\r
-\r
-/*\r
- * dapli_rbuf_count\r
- *\r
- * Return the number of entries in use in the ring buffer\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- *\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * count of entries\r
- *\r
- */\r
-DAT_COUNT\r
-dapls_rbuf_count (\r
- IN DAPL_RING_BUFFER *rbuf )\r
-{\r
- DAT_COUNT count;\r
- int head;\r
- int tail;\r
-\r
- head = rbuf->head & rbuf->lim;\r
- tail = rbuf->tail & rbuf->lim;\r
- if ( head > tail )\r
- {\r
- count = head - tail;\r
- }\r
- else\r
- {\r
- /* add 1 to lim as it is a mask, number of entries - 1 */\r
- count = (rbuf->lim + 1 - tail + head) & rbuf->lim;\r
- }\r
-\r
- return count;\r
-}\r
-\r
-\r
-/*\r
- * dapls_rbuf_contains\r
- *\r
- * Return TRUE or FALSE if an element exists in a ring buffer\r
- *\r
- * Input:\r
- * rbuf pointer to DAPL_RING_BUFFER\r
- * entry entry to match\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_TRUE\r
- * DAT_FALSE\r
- \r
- */\r
-DAT_BOOLEAN\r
-dapls_rbuf_contains (\r
- IN DAPL_RING_BUFFER *rbuf,\r
- IN void *entry)\r
-{\r
- int pos;\r
-\r
- pos = rbuf->head;\r
- while ( pos != rbuf->tail )\r
- {\r
- if (rbuf->base[pos] == entry)\r
- return DAT_TRUE;\r
- pos = (pos + 1) & rbuf->lim; /* verify in range */\r
- }\r
-\r
- return DAT_FALSE;\r
-\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_ring_buffer_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the ring buffer data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_RING_BUFFER_H_\r
-#define _DAPL_RING_BUFFER_H_\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * Prototypes\r
- */\r
-DAT_RETURN dapls_rbuf_alloc (\r
- DAPL_RING_BUFFER *rbuf,\r
- DAT_COUNT size );\r
-\r
-DAT_RETURN dapls_rbuf_realloc (\r
- DAPL_RING_BUFFER *rbuf,\r
- DAT_COUNT size );\r
-\r
-void dapls_rbuf_destroy (\r
- DAPL_RING_BUFFER *rbuf);\r
-\r
-DAT_RETURN dapls_rbuf_add (\r
- DAPL_RING_BUFFER *rbuf,\r
- void *entry);\r
-\r
-void * dapls_rbuf_remove (\r
- DAPL_RING_BUFFER *rbuf);\r
-\r
-DAT_COUNT dapls_rbuf_count (\r
- DAPL_RING_BUFFER *rbuf );\r
-\r
-DAT_BOOLEAN dapls_rbuf_contains (\r
- IN DAPL_RING_BUFFER *rbuf,\r
- IN void *entry);\r
-\r
-\r
-/*\r
- * Simple functions\r
- */\r
-#define dapls_rbuf_empty(rbuf) (rbuf->head == rbuf->tail)\r
-\r
-\r
-#endif /* _DAPL_RING_BUFFER_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_rmr_bind.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapli_rmr_bind_fuse (\r
- IN DAPL_RMR *rmr,\r
- IN const DAT_LMR_TRIPLET *lmr_triplet,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- OUT DAT_RMR_CONTEXT *rmr_context );\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapli_rmr_bind_unfuse (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapli_rmr_bind_fuse (\r
- IN DAPL_RMR *rmr,\r
- IN const DAT_LMR_TRIPLET* lmr_triplet,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- OUT DAT_RMR_CONTEXT *rmr_context )\r
-{\r
- DAPL_LMR *lmr;\r
- DAPL_COOKIE *cookie;\r
- DAT_RETURN dat_status;\r
- ib_bool_t is_signaled;\r
-\r
- dat_status = dapls_hash_search (rmr->header.owner_ia->hca_ptr->lmr_hash_table,\r
- lmr_triplet->lmr_context,\r
- (DAPL_HASH_DATA *) &lmr);\r
- if ( DAT_SUCCESS != dat_status)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- /* if the ep in unconnected return an error. IB requires that the */\r
- /* QP be connected to change a memory window binding since: */\r
- /* */\r
- /* - memory window bind operations are WQEs placed on a QP's */\r
- /* send queue */\r
- /* */\r
- /* - QP's only process WQEs on the send queue when the QP is in */\r
- /* the RTS state */\r
- if (DAT_EP_STATE_CONNECTED != ep_ptr->param.ep_state)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- if ( DAT_FALSE == dapl_mr_bounds_check (\r
- dapl_mr_get_address (lmr->param.region_desc, lmr->param.mem_type),\r
- lmr->param.length,\r
- lmr_triplet->virtual_address,\r
- lmr_triplet->segment_length) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- /* If the LMR, RMR, and EP are not in the same PZ, there is an error */\r
- if ( (ep_ptr->param.pz_handle != lmr->param.pz_handle) ||\r
- (ep_ptr->param.pz_handle != rmr->param.pz_handle) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
-\r
- if ( !dapl_rmr_validate_completion_flag (DAT_COMPLETION_SUPPRESS_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) ||\r
- !dapl_rmr_validate_completion_flag (DAT_COMPLETION_UNSIGNALLED_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) ||\r
- !dapl_rmr_validate_completion_flag (DAT_COMPLETION_BARRIER_FENCE_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_rmr_cookie_alloc (&ep_ptr->req_buffer,\r
- rmr,\r
- user_cookie,\r
- &cookie);\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- goto bail;\r
- }\r
-\r
- is_signaled = (completion_flags & DAT_COMPLETION_SUPPRESS_FLAG) ? false : true;\r
-\r
- /*\r
- * Take reference before posting to avoid race conditions with\r
- * completions\r
- */\r
- dapl_os_atomic_inc (&ep_ptr->req_count);\r
-\r
- dat_status = dapls_ib_mw_bind (rmr,\r
- lmr,\r
- ep_ptr,\r
- cookie,\r
- lmr_triplet->virtual_address,\r
- lmr_triplet->segment_length,\r
- mem_priv,\r
- is_signaled);\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
- dapls_cookie_dealloc (&ep_ptr->req_buffer, cookie);\r
- goto bail;\r
- }\r
-\r
- dapl_os_atomic_inc (&lmr->lmr_ref_count);\r
-\r
- /* if the RMR was previously bound */\r
- if ( NULL != rmr->lmr )\r
- {\r
- dapl_os_atomic_dec (&rmr->lmr->lmr_ref_count);\r
- }\r
-\r
- rmr->param.mem_priv = mem_priv;\r
- rmr->param.lmr_triplet = *lmr_triplet;\r
- rmr->ep = ep_ptr;\r
- rmr->lmr = lmr;\r
-\r
- if ( NULL != rmr_context )\r
- {\r
- *rmr_context = rmr->param.rmr_context;\r
- }\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-STATIC _INLINE_ DAT_RETURN\r
-dapli_rmr_bind_unfuse (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags)\r
-{\r
- DAPL_COOKIE *cookie;\r
- DAT_RETURN dat_status;\r
- ib_bool_t is_signaled;\r
-\r
- dat_status = DAT_SUCCESS;\r
- /*\r
- * if the ep in unconnected return an error. IB requires that the\r
- * QP be connected to change a memory window binding since:\r
- *\r
- * - memory window bind operations are WQEs placed on a QP's\r
- * send queue\r
- *\r
- * - QP's only process WQEs on the send queue when the QP is in\r
- * the RTS state\r
- */\r
- if (DAT_EP_STATE_CONNECTED != ep_ptr->param.ep_state)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE, dapls_ep_state_subtype (ep_ptr));\r
- goto bail1;\r
- }\r
-\r
- /* If the RMR and EP are not in the same PZ, there is an error */\r
- if ( ep_ptr->param.pz_handle != rmr->param.pz_handle )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail1;\r
- }\r
-\r
- if ( !dapl_rmr_validate_completion_flag (DAT_COMPLETION_SUPPRESS_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) ||\r
- !dapl_rmr_validate_completion_flag (DAT_COMPLETION_UNSIGNALLED_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) ||\r
- !dapl_rmr_validate_completion_flag (DAT_COMPLETION_BARRIER_FENCE_FLAG,\r
- ep_ptr->param.ep_attr.request_completion_flags,\r
- completion_flags) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- goto bail1;\r
- }\r
-\r
- dat_status = dapls_rmr_cookie_alloc (&ep_ptr->req_buffer,\r
- rmr,\r
- user_cookie,\r
- &cookie);\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- goto bail1;\r
- }\r
-\r
- is_signaled = (completion_flags & DAT_COMPLETION_UNSIGNALLED_FLAG) ? false : true;\r
-\r
- /*\r
- * Take reference before posting to avoid race conditions with \r
- * completions \r
- */\r
- dapl_os_atomic_inc (&ep_ptr->req_count);\r
-\r
- dat_status = dapls_ib_mw_unbind (rmr,\r
- ep_ptr,\r
- cookie,\r
- is_signaled);\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
- dapls_cookie_dealloc (&ep_ptr->req_buffer, cookie);\r
- goto bail1;\r
- }\r
-\r
- /* if the RMR was previously bound */\r
- if ( NULL != rmr->lmr )\r
- {\r
- dapl_os_atomic_dec (&rmr->lmr->lmr_ref_count);\r
- }\r
-\r
- rmr->param.mem_priv = DAT_MEM_PRIV_NONE_FLAG;\r
- rmr->param.lmr_triplet.lmr_context = 0;\r
- rmr->param.lmr_triplet.virtual_address = 0;\r
- rmr->param.lmr_triplet.segment_length = 0;\r
- rmr->ep = ep_ptr;\r
- rmr->lmr = NULL;\r
-\r
-bail1:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapl_rmr_bind\r
- *\r
- * DAPL Requirements Version xxx, 6.6.4.4\r
- *\r
- * Bind the RMR to the specified memory region within the LMR and\r
- * provide a new rmr_context value.\r
- *\r
- * Input:\r
- * Output:\r
- */\r
-DAT_RETURN\r
-dapl_rmr_bind (\r
- IN DAT_RMR_HANDLE rmr_handle,\r
- IN const DAT_LMR_TRIPLET *lmr_triplet,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- OUT DAT_RMR_CONTEXT *rmr_context )\r
-{\r
- DAPL_RMR *rmr;\r
- DAPL_EP *ep_ptr;\r
-\r
- if ( DAPL_BAD_HANDLE (rmr_handle, DAPL_MAGIC_RMR) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_RMR);\r
- }\r
- if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);\r
- }\r
-\r
- rmr = (DAPL_RMR *) rmr_handle;\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
-\r
- /* if the rmr should be bound */\r
- if (0 != lmr_triplet->segment_length)\r
- {\r
- return dapli_rmr_bind_fuse (rmr,\r
- lmr_triplet,\r
- mem_priv,\r
- ep_ptr,\r
- user_cookie,\r
- completion_flags,\r
- rmr_context);\r
- }\r
- else /* the rmr should be unbound */\r
- {\r
- return dapli_rmr_bind_unfuse (rmr,\r
- ep_ptr,\r
- user_cookie,\r
- completion_flags);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rmr_create.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_rmr_create\r
- *\r
- * DAPL Requirements Version xxx, 6.6.4.1\r
- *\r
- * Create a remote memory region for the specified protection zone\r
- *\r
- * Input:\r
- * pz_handle\r
- *\r
- * Output:\r
- * rmr_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_rmr_create (\r
- IN DAT_PZ_HANDLE pz_handle,\r
- OUT DAT_RMR_HANDLE *rmr_handle)\r
-{\r
- DAPL_PZ *pz;\r
- DAPL_RMR *rmr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (pz_handle, DAPL_MAGIC_PZ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_PZ);\r
- goto bail;\r
- }\r
-\r
- pz = (DAPL_PZ *) pz_handle;\r
-\r
- rmr = dapl_rmr_alloc (pz);\r
-\r
- if ( rmr == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_status = dapls_ib_mw_alloc (rmr);\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_rmr_dealloc (rmr);\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY_REGION);\r
- goto bail;\r
- }\r
-\r
- dapl_os_atomic_inc (&pz->pz_ref_count);\r
-\r
- *rmr_handle = rmr;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rmr_free.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-/*\r
- * dapl_rmr_free\r
- *\r
- * DAPL Requirements Version xxx, 6.6.4.2\r
- *\r
- * Destroy an instance of the Remote Memory Region\r
- *\r
- * Input:\r
- * rmr_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_rmr_free (\r
- IN DAT_RMR_HANDLE rmr_handle )\r
-{\r
- DAPL_RMR *rmr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (rmr_handle, DAPL_MAGIC_RMR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_RMR);\r
- goto bail;\r
- }\r
-\r
- rmr = (DAPL_RMR *) rmr_handle;\r
-\r
- /*\r
- * If the user did not perform an unbind op, release\r
- * counts here.\r
- */\r
- if ( rmr->param.lmr_triplet.virtual_address != 0 )\r
- {\r
- dapl_os_atomic_dec (&rmr->lmr->lmr_ref_count); \r
- rmr->param.lmr_triplet.virtual_address = 0;\r
- }\r
-\r
- dat_status = dapls_ib_mw_free (rmr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- goto bail;\r
- }\r
-\r
- dapl_os_atomic_dec (&rmr->pz->pz_ref_count);\r
-\r
- dapl_rmr_dealloc (rmr);\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rmr_query.c\r
- *\r
- * PURPOSE: Memory management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 6\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_rmr_query\r
- *\r
- * DAPL Requirements Version xxx, 6.6.4.3\r
- *\r
- * Provide the RMR arguments.\r
- *\r
- * Input:\r
- * rmr_handle\r
- * rmr_args_mask\r
- *\r
- * Output:\r
- * rmr_args\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_rmr_query (\r
- IN DAT_RMR_HANDLE rmr_handle,\r
- IN DAT_RMR_PARAM_MASK rmr_param_mask,\r
- IN DAT_RMR_PARAM *rmr_param )\r
-{\r
- DAPL_RMR *rmr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (rmr_handle, DAPL_MAGIC_RMR) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_RMR);\r
- goto bail;\r
- }\r
- if (NULL == rmr_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- rmr = (DAPL_RMR *) rmr_handle;\r
-\r
- /* If the RMR is unbound, there is no LMR triplet associated with */\r
- /* this RMR. If the consumer requests this field, return an error. */\r
- if ( (rmr_param_mask & DAT_RMR_FIELD_LMR_TRIPLET) && (NULL == rmr->lmr) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
- goto bail;\r
- }\r
-\r
- dapl_os_memcpy (rmr_param, &rmr->param, sizeof (DAT_RMR_PARAM));\r
-\r
- bail:\r
- return dat_status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_rmr_util.c\r
- *\r
- * PURPOSE: Utility defs & routines for the RMR data structure\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_ia_util.h"\r
-\r
-DAPL_RMR *\r
-dapl_rmr_alloc(\r
- IN DAPL_PZ *pz)\r
-{\r
- DAPL_RMR *rmr;\r
-\r
- /* Allocate LMR */\r
- rmr = (DAPL_RMR *) dapl_os_alloc(sizeof(DAPL_RMR));\r
- if (NULL == rmr)\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero(rmr, sizeof(DAPL_RMR));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- rmr->header.provider = pz->header.provider;\r
- rmr->header.magic = DAPL_MAGIC_RMR;\r
- rmr->header.handle_type = DAT_HANDLE_TYPE_RMR;\r
- rmr->header.owner_ia = pz->header.owner_ia;\r
- rmr->header.user_context.as_64 = 0;\r
- rmr->header.user_context.as_ptr = 0;\r
- dapl_llist_init_entry (&rmr->header.ia_list_entry);\r
- dapl_ia_link_rmr(rmr->header.owner_ia, rmr);\r
- dapl_os_lock_init(&rmr->header.lock);\r
-\r
- /* \r
- * initialize the body \r
- */\r
- rmr->param.ia_handle = (DAT_IA_HANDLE) pz->header.owner_ia;\r
- rmr->param.pz_handle = (DAT_PZ_HANDLE) pz;\r
- rmr->param.lmr_triplet.lmr_context = 0;\r
- rmr->param.lmr_triplet.pad = 0;\r
- rmr->param.lmr_triplet.virtual_address = 0;\r
- rmr->param.lmr_triplet.segment_length = 0;\r
-\r
- rmr->param.mem_priv = 0;\r
- rmr->pz = pz;\r
- rmr->lmr = NULL;\r
- \r
- return (rmr);\r
-}\r
-\r
-\r
-void\r
-dapl_rmr_dealloc(\r
- IN DAPL_RMR *rmr)\r
-{\r
- rmr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
-\r
- dapl_ia_unlink_rmr(rmr->header.owner_ia, rmr);\r
- dapl_os_lock_destroy(&rmr->header.lock);\r
- \r
- dapl_os_free((void *) rmr, sizeof(DAPL_RMR));\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_rmr_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the RMR data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_RMR_UTIL_H_\r
-#define _DAPL_RMR_UTIL_H_\r
-\r
-#include "dapl_mr_util.h"\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAPL_RMR *\r
-dapl_rmr_alloc (\r
- IN DAPL_PZ *pz);\r
-\r
-extern void\r
-dapl_rmr_dealloc (\r
- IN DAPL_RMR *rmr);\r
-\r
-STATIC _INLINE_ DAT_BOOLEAN \r
-dapl_rmr_validate_completion_flag (\r
- IN DAT_COMPLETION_FLAGS mask,\r
- IN DAT_COMPLETION_FLAGS allow,\r
- IN DAT_COMPLETION_FLAGS request);\r
-\r
-STATIC _INLINE_ int32_t\r
-dapl_rmr_convert_privileges (\r
- IN DAT_MEM_PRIV_FLAGS privileges);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Inline Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC _INLINE_ DAT_BOOLEAN \r
-dapl_rmr_validate_completion_flag (\r
- IN DAT_COMPLETION_FLAGS mask,\r
- IN DAT_COMPLETION_FLAGS allow,\r
- IN DAT_COMPLETION_FLAGS request)\r
-{\r
- if ( (mask & request ) && ! (mask & allow) )\r
- {\r
- return DAT_FALSE;\r
- }\r
- else\r
- {\r
- return DAT_TRUE;\r
- }\r
-}\r
-\r
-STATIC _INLINE_ int32_t\r
-dapl_rmr_convert_privileges (\r
- IN DAT_MEM_PRIV_FLAGS privileges)\r
-{\r
- int32_t value = 0;\r
-\r
- if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges)\r
- {\r
- value |= IB_ACCESS_REMOTE_READ;\r
- }\r
-\r
- if (DAT_MEM_PRIV_REMOTE_WRITE_FLAG & privileges)\r
- {\r
- value |= IB_ACCESS_REMOTE_WRITE;\r
- }\r
-\r
- return value;\r
-}\r
-\r
-#endif /* _DAPL_RMR_UTIL_H_*/\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rsp_create.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_rsp_create\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.3.4.1\r
- *\r
- * Create a Resereved Service Point with the specified Endpoint\r
- * that generates at most one Connection Request that is\r
- * delivered to the specified Event Dispatcher in a notification\r
- * event\r
- *\r
- * Input:\r
- * ia_handle\r
- * conn_qual\r
- * ep_handle\r
- * evd_handle\r
- *\r
- * Output:\r
- * rsp_handle\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- * DAT_INVALID_STATE\r
- * DAT_CONN_QUAL_IN_USE\r
- */\r
-DAT_RETURN\r
-dapl_rsp_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_CONN_QUAL conn_qual,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_EVD_HANDLE evd_handle,\r
- OUT DAT_RSP_HANDLE *rsp_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAT_BOOLEAN sp_found;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- ia_ptr = (DAPL_IA *)ia_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- ">>> dapl_rsp_free conn_qual: %x EP: %p\n", \r
- conn_qual, ep_handle);\r
-\r
- if ( DAPL_BAD_HANDLE (ia_ptr, DAPL_MAGIC_IA) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
- goto bail;\r
- }\r
- if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EP);\r
- goto bail;\r
- }\r
- if ( DAPL_BAD_HANDLE (evd_handle, DAPL_MAGIC_EVD) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- if ( rsp_handle == NULL )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG5);\r
- goto bail;\r
- }\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- if ( ep_ptr->param.ep_state != DAT_EP_STATE_UNCONNECTED )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_STATE,dapls_ep_state_subtype (ep_ptr));\r
- goto bail;\r
- }\r
-\r
- evd_ptr = (DAPL_EVD *)evd_handle;\r
- if ( ! (evd_ptr->evd_flags & DAT_EVD_CR_FLAG) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_EVD_CR);\r
- goto bail;\r
- }\r
-\r
- sp_ptr = dapls_ia_sp_search (ia_ptr, conn_qual, DAT_FALSE);\r
- sp_found = DAT_TRUE;\r
- if (sp_ptr == NULL)\r
- {\r
- sp_found = DAT_FALSE;\r
-\r
- /* Allocate RSP */\r
- sp_ptr = dapls_sp_alloc ( ia_ptr, DAT_FALSE );\r
- if ( sp_ptr == NULL )\r
- {\r
- dat_status = \r
- DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * Fill out the RSP args\r
- */\r
- sp_ptr->ia_handle = ia_handle;\r
- sp_ptr->conn_qual = conn_qual;\r
- sp_ptr->evd_handle = evd_handle;\r
- sp_ptr->psp_flags = 0;\r
- sp_ptr->ep_handle = ep_handle;\r
-\r
- /*\r
- * Take a reference on the EVD handle\r
- */\r
- dapl_os_atomic_inc (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
-\r
- /*\r
- * Update the EP state indicating the provider now owns it\r
- */\r
- ep_ptr->param.ep_state = DAT_EP_STATE_RESERVED;\r
-\r
- /* \r
- * Set up a listener for a connection. Connections can arrive\r
- * even before this call returns!\r
- */\r
- sp_ptr->state = DAPL_SP_STATE_RSP_LISTENING;\r
- sp_ptr->listening = DAT_TRUE;\r
-\r
- if (sp_found == DAT_FALSE)\r
- {\r
- /* Link it onto the IA */\r
- dapl_ia_link_rsp (ia_ptr, sp_ptr);\r
-\r
- dat_status = dapls_ib_setup_conn_listener ( ia_ptr,\r
- conn_qual, \r
- sp_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- /*\r
- * Have a problem setting up the connection, something\r
- * wrong! Decrements the EVD refcount & release it. Set \r
- * the state to FREE, so we know the call failed.\r
- */\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- sp_ptr->state = DAPL_SP_STATE_FREE;\r
- dapls_ia_unlink_sp (ia_ptr, sp_ptr);\r
- dapls_sp_free_sp (sp_ptr);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> dapl_rsp_create setup_conn_listener failed: %x\n", \r
- dat_status);\r
-\r
- goto bail;\r
- }\r
- }\r
-\r
- /*\r
- * Return handle to the user\r
- */\r
- *rsp_handle = (DAT_RSP_HANDLE)sp_ptr;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rsp_free.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * dapl_rsp_free\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.3.5\r
- *\r
- * Destroy a specific instance of a Reserved Service Point.\r
- *\r
- * Input:\r
- * rsp_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-DAT_RETURN\r
-dapl_rsp_free (\r
- IN DAT_RSP_HANDLE rsp_handle )\r
-{\r
- DAPL_IA *ia_ptr;\r
- DAPL_SP *sp_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- sp_ptr = (DAPL_SP *) rsp_handle;\r
- /*\r
- * Verify handle\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- ">>> dapl_rsp_free %p\n", \r
- rsp_handle);\r
- if ( DAPL_BAD_HANDLE (sp_ptr, DAPL_MAGIC_RSP ) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_RSP);\r
- goto bail;\r
- }\r
-\r
- /* ia_ptr = (DAPL_IA *)sp_ptr->header.owner_ia; */\r
- ia_ptr = sp_ptr->header.owner_ia;\r
-\r
- /*\r
- * Remove the connection listener if there are no connections. If\r
- * we defer removing the sp it becomes something of a zombie\r
- * container until disconnection, after which it will be cleaned up.\r
- */\r
- dapl_os_lock (&sp_ptr->header.lock);\r
-\r
- /*\r
- * Make sure we don't leave a dangling EP. If the state is still\r
- * RESERVED then the RSP still owns it.\r
- */\r
- ep_ptr = (DAPL_EP *)sp_ptr->ep_handle;\r
- if ( ep_ptr != NULL && ep_ptr->param.ep_state == DAT_EP_STATE_RESERVED )\r
- {\r
- ep_ptr->param.ep_state = DAT_EP_STATE_UNCONNECTED;\r
- }\r
- sp_ptr->ep_handle = NULL;\r
-\r
- /* Release reference on EVD. If an error was encountered in a previous\r
- * free the evd_handle will be NULL\r
- */\r
- if (sp_ptr->evd_handle)\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
- sp_ptr->evd_handle = NULL;\r
- }\r
-\r
- /*\r
- * Release the base resource if there are no outstanding connections;\r
- * else the last disconnect on this RSP will free it up. The RSP\r
- * is used to contain CR records for each connection, which \r
- * contain information necessary to disconnect.\r
- * sp_ptr->listening will be DAT_TRUE if there has never been a\r
- * connection event, and DAT_FALSE if a connection attempt resulted\r
- * in a reject.\r
- */\r
- if ( sp_ptr->cr_list_count == 0 )\r
- {\r
- /* This RSP has never been used. Clean it up */\r
- sp_ptr->listening = DAT_FALSE;\r
- sp_ptr->state = DAPL_SP_STATE_FREE;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- dat_status = dapls_ib_remove_conn_listener ( ia_ptr,\r
- sp_ptr );\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- sp_ptr->state = DAPL_SP_STATE_RSP_LISTENING;\r
- goto bail;\r
- }\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
- }\r
- else\r
- {\r
- /* The RSP is now in the pending state, where it will sit until\r
- * the connection terminates or the app uses the same\r
- * ServiceID again, which will reactivate it.\r
- */\r
- sp_ptr->state = DAPL_SP_STATE_RSP_PENDING;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- }\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_rsp_query.c\r
- *\r
- * PURPOSE: Connection management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 4\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_rsp_query\r
- *\r
- * uDAPL: User Direct Access Program Library Version 1.1, 6.4.1.6\r
- *\r
- * Provide arguments of the reserved service points\r
- *\r
- * Input:\r
- * rsp_handle\r
- * rsp_args_mask\r
- *\r
- * Output:\r
- * rsp_args\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapl_rsp_query (\r
- IN DAT_RSP_HANDLE rsp_handle,\r
- IN DAT_RSP_PARAM_MASK rsp_mask,\r
- OUT DAT_RSP_PARAM *rsp_param )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAT_RETURN dat_status;\r
- UNREFERENCED_PARAMETER(rsp_mask);\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- if ( DAPL_BAD_HANDLE (rsp_handle, DAPL_MAGIC_RSP) )\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_RSP);\r
- goto bail;\r
- }\r
-\r
- if (NULL == rsp_param)\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- sp_ptr = (DAPL_SP *) rsp_handle;\r
-\r
- /*\r
- * Fill in the RSP params\r
- */\r
- rsp_param->ia_handle = sp_ptr->ia_handle;\r
- rsp_param->conn_qual = sp_ptr->conn_qual;\r
- rsp_param->evd_handle = sp_ptr->evd_handle;\r
- rsp_param->ep_handle = sp_ptr->ep_handle;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * c-brace-offset: -4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_set_consumer_context.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-\r
-/*\r
- * dapl_set_consumer_context\r
- *\r
- * DAPL Requirements Version xxx, 6.2.2.1\r
- *\r
- * Set a consumer context in the provided dat_handle\r
- *\r
- * Input:\r
- * dat_handle\r
- * context\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- */\r
-DAT_RETURN\r
-dapl_set_consumer_context (\r
- IN DAT_HANDLE dat_handle,\r
- IN DAT_CONTEXT context )\r
-{\r
- DAT_RETURN dat_status;\r
- DAPL_HEADER *header;\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- header = (DAPL_HEADER *)dat_handle;\r
- if ( ((header) == NULL) ||\r
- (((DAT_UVERYLONG)header) & 3) ||\r
- (header->magic != DAPL_MAGIC_IA &&\r
- header->magic != DAPL_MAGIC_EVD &&\r
- header->magic != DAPL_MAGIC_EP &&\r
- header->magic != DAPL_MAGIC_LMR &&\r
- header->magic != DAPL_MAGIC_RMR &&\r
- header->magic != DAPL_MAGIC_PZ &&\r
- header->magic != DAPL_MAGIC_PSP &&\r
- header->magic != DAPL_MAGIC_RSP &&\r
- header->magic != DAPL_MAGIC_CR))\r
- {\r
- dat_status = DAT_ERROR (DAT_INVALID_HANDLE,0);\r
- goto bail;\r
- }\r
- header->user_context = context;\r
-\r
-bail:\r
- return dat_status;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_sp_util.c\r
- *\r
- * PURPOSE: Manage PSP Info structure\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_cr_util.h"\r
-\r
-/*\r
- * Local definitions\r
- */\r
-\r
-\r
-/*\r
- * dapl_sp_alloc\r
- *\r
- * alloc and initialize a PSP INFO struct\r
- *\r
- * Input:\r
- * IA INFO struct ptr\r
- *\r
- * Output:\r
- * sp_ptr\r
- *\r
- * Returns:\r
- * NULL\r
- * pointer to sp info struct\r
- *\r
- */\r
-DAPL_SP *\r
-dapls_sp_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_BOOLEAN is_psp )\r
-{\r
- DAPL_SP *sp_ptr;\r
-\r
- /* Allocate EP */\r
- sp_ptr = (DAPL_SP *)dapl_os_alloc (sizeof (DAPL_SP));\r
- if ( sp_ptr == NULL )\r
- {\r
- return (NULL);\r
- }\r
-\r
- /* zero the structure */\r
- dapl_os_memzero (sp_ptr, sizeof (DAPL_SP));\r
-\r
- /*\r
- * initialize the header\r
- */\r
- sp_ptr->header.provider = ia_ptr->header.provider;\r
- if ( is_psp )\r
- {\r
- sp_ptr->header.magic = DAPL_MAGIC_PSP;\r
- sp_ptr->header.handle_type = DAT_HANDLE_TYPE_PSP;\r
- }\r
- else\r
- {\r
- sp_ptr->header.magic = DAPL_MAGIC_RSP;\r
- sp_ptr->header.handle_type = DAT_HANDLE_TYPE_RSP;\r
- }\r
- sp_ptr->header.owner_ia = ia_ptr;\r
- sp_ptr->header.user_context.as_64 = 0;\r
- sp_ptr->header.user_context.as_ptr = NULL;\r
- dapl_llist_init_entry (&sp_ptr->header.ia_list_entry);\r
- dapl_os_lock_init (&sp_ptr->header.lock);\r
- dapl_os_wait_object_init( &sp_ptr->wait_object );\r
-\r
- /*\r
- * Initialize the Body (set to NULL above)\r
- */\r
- dapl_llist_init_head (&sp_ptr->cr_list_head);\r
-\r
- return ( sp_ptr );\r
-}\r
-\r
-\r
-/*\r
- * dapl_sp_free\r
- *\r
- * Free the passed in PSP structure.\r
- *\r
- * Input:\r
- * entry point pointer\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapls_sp_free_sp (\r
- IN DAPL_SP *sp_ptr )\r
-{\r
- dapl_os_assert (sp_ptr->header.magic == DAPL_MAGIC_PSP ||\r
- sp_ptr->header.magic == DAPL_MAGIC_RSP);\r
- dapl_os_assert (dapl_llist_is_empty(&sp_ptr->cr_list_head));\r
-\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- sp_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- dapl_os_wait_object_destroy (&sp_ptr->wait_object);\r
- dapl_os_free (sp_ptr, sizeof (DAPL_SP));\r
-}\r
-\r
-\r
-/*\r
- * dapl_cr_link_cr\r
- *\r
- * Add a cr to a PSP structure\r
- *\r
- * Input:\r
- * sp_ptr\r
- * cr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-void\r
-dapl_sp_link_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_CR *cr_ptr )\r
-{\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- dapl_llist_add_tail (&sp_ptr->cr_list_head,\r
- &cr_ptr->header.ia_list_entry,\r
- cr_ptr);\r
- sp_ptr->cr_list_count++;\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-}\r
-\r
-\r
-/*\r
- * dapl_sp_search_cr\r
- *\r
- * Search for a CR on the PSP cr_list with a matching cm_handle. When\r
- * found, remove it from the list and update fields.\r
- *\r
- * Must be called with the sp_ptr lock taken.\r
- *\r
- * Input:\r
- * sp_ptr\r
- * ib_cm_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * cr_ptr_fnd Pointer to matching DAPL_CR\r
- *\r
- */\r
-DAPL_CR *\r
-dapl_sp_search_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN ib_cm_handle_t ib_cm_handle )\r
-{\r
- DAPL_CR *cr_ptr;\r
- DAPL_CR *cr_ptr_fnd;\r
-\r
- dapl_os_lock (&sp_ptr->header.lock);\r
- if ( dapl_llist_is_empty (&sp_ptr->cr_list_head) )\r
- {\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- return NULL;\r
- }\r
- cr_ptr_fnd = NULL;\r
- cr_ptr = (DAPL_CR *) dapl_llist_peek_head (&sp_ptr->cr_list_head);\r
-\r
- do \r
- {\r
- if ( cr_ptr->ib_cm_handle.cid == ib_cm_handle.cid )\r
- {\r
- cr_ptr_fnd = cr_ptr;\r
-\r
- break;\r
- }\r
- cr_ptr = cr_ptr->header.ia_list_entry.flink->data;\r
- } while ((void *)cr_ptr != (void *)sp_ptr->cr_list_head->data);\r
-\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- return cr_ptr_fnd;\r
-}\r
-\r
-\r
-\r
-/*\r
- * dapl_sp_remove_cr\r
- *\r
- * Remove the CR from the PSP. Done prior to freeing the CR resource.\r
- *\r
- * Must be called with the sp_ptr lock taken.\r
- *\r
- * Input:\r
- * sp_ptr\r
- * cr_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * void\r
- *\r
- */\r
-void\r
-dapl_sp_remove_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_CR *cr_ptr )\r
-{\r
- dapl_os_lock (&sp_ptr->header.lock);\r
-\r
- if ( dapl_llist_is_empty(&sp_ptr->cr_list_head) )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "***dapl_sp_remove_cr: removing from empty queue! sp %p\n", \r
- sp_ptr );\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
- return;\r
- }\r
-\r
- dapl_llist_remove_entry (&sp_ptr->cr_list_head, \r
- &cr_ptr->header.ia_list_entry);\r
- sp_ptr->cr_list_count--;\r
-\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-}\r
-\r
-\r
-\r
-/*\r
- * dapl_sp_remove_ep\r
- *\r
- * Remove a CR from a PSP, given an EP.\r
- *\r
- *\r
- * Input:\r
- * ep_ptr\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * void\r
- *\r
- */\r
-void\r
-dapl_sp_remove_ep (\r
- IN DAPL_EP *ep_ptr )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAPL_CR *cr_ptr;\r
-\r
- cr_ptr = ep_ptr->cr_ptr;\r
-\r
- if (cr_ptr != NULL)\r
- {\r
- sp_ptr = cr_ptr->sp_ptr;\r
-\r
- dapl_os_lock (&sp_ptr->header.lock);\r
-\r
- /* Remove the CR from the queue */\r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
-\r
- dapl_os_unlock (&sp_ptr->header.lock);\r
-\r
- /* free memory outside of the lock */\r
- dapls_cr_free (cr_ptr);\r
-\r
- return;\r
- }\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * HEADER: dapl_sp_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for the PSP & RSP data structure\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_PSP_UTIL_H_\r
-#define _DAPL_PSP_UTIL_H_\r
-\r
-DAPL_SP *dapls_sp_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_BOOLEAN is_psp );\r
-\r
-void dapls_sp_free_sp (\r
- IN DAPL_SP *sp_ptr );\r
-\r
-void dapl_sp_link_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_CR *cr_ptr );\r
-\r
-DAPL_CR *dapl_sp_search_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN ib_cm_handle_t ib_cm_handle );\r
-\r
-void dapl_sp_remove_cr (\r
- IN DAPL_SP *sp_ptr,\r
- IN DAPL_CR *cr_ptr );\r
-\r
-void dapl_sp_remove_ep (\r
- IN DAPL_EP *ep_ptr );\r
-\r
-#endif /* _DAPL_PSP_UTIL_H_ */\r
+++ /dev/null
-DIRS=udapl\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_cm.c\r
- *\r
- * PURPOSE: IB Connection routines for access to IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_ibal_util.h"\r
-#include "dapl_name_service.h"\r
-\r
-#define IB_INFINITE_SERVICE_LEASE 0xFFFFFFFF\r
-#define DAPL_ATS_SERVICE_ID ATS_SERVICE_ID //0x10000CE100415453\r
-#define DAPL_ATS_NAME ATS_NAME\r
-#define HCA_IPV6_ADDRESS_LENGTH 16\r
-\r
-int g_dapl_loopback_connection = 0;\r
-extern dapl_ibal_root_t dapl_ibal_root;\r
-\r
-/*\r
- * Prototypes\r
- */\r
-static void AL_API\r
-dapli_ib_sa_query_cb (\r
- IN ib_query_rec_t *p_query_rec );\r
-\r
-\r
-\r
-#ifndef NO_NAME_SERVICE\r
-\r
-static void \r
-dapli_ib_reg_svc_cb (\r
- IN ib_reg_svc_rec_t *p_reg_svc_rec )\r
-{\r
- DAPL_HCA *hca_ptr;\r
-\r
- hca_ptr = (DAPL_HCA *) p_reg_svc_rec->svc_context;\r
-\r
- dapl_os_assert (hca_ptr);\r
-\r
- if (IB_SUCCESS == p_reg_svc_rec->req_status)\r
- {\r
- hca_ptr->name_service_handle = (void *) p_reg_svc_rec->h_reg_svc;\r
-\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiRScb: register to SA successfully for port %d\n",\r
- hca_ptr->port_num);\r
-\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiRScb: reg_service_handle %p\n",\r
- hca_ptr->name_service_handle);\r
-\r
- }\r
- else\r
- {\r
- hca_ptr->name_service_handle = IB_INVALID_HANDLE;\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DiRScb: Register service to SA failed = %s\n", \r
- ib_get_err_str(p_reg_svc_rec->req_status));\r
- }\r
- \r
-}\r
-\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_ns_map_gid (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_IA_ADDRESS_PTR p_ia_address,\r
- OUT GID *p_gid)\r
-{\r
- ib_user_query_t user_query;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
- ib_service_record_t service_rec;\r
- ib_api_status_t ib_status;\r
- ib_query_req_t query_req;\r
- DAT_SOCK_ADDR6 ipv6_addr;\r
-\r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (NULL == p_ca)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMG: There is no HCA = %d\n", __LINE__);\r
- return (DAT_INVALID_HANDLE);\r
- }\r
-\r
- /*\r
- * We are using the first active port in the list for\r
- * communication. We have to get back here when we decide to support\r
- * fail-over and high-availability.\r
- */\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMG: Port %d is not available = %d\n",\r
- hca_ptr->port_num, __LINE__);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- if (p_active_port->p_attr->lid == 0) \r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMG: Port %d has no LID assigned; can not operate\n", \r
- p_active_port->p_attr->port_num);\r
- return (DAT_INVALID_STATE);\r
- }\r
- else \r
- {\r
- if (!dapl_os_memcmp (p_ia_address,\r
- &hca_ptr->hca_address,\r
- HCA_IPV6_ADDRESS_LENGTH))\r
- {\r
- /* \r
- * We are operating in the LOOPBACK mode \r
- */\r
- p_gid->guid = \r
- p_active_port->p_attr->p_gid_table[0].unicast.interface_id;\r
- p_gid->gid_prefix = \r
- p_active_port->p_attr->p_gid_table[0].unicast.prefix;\r
- return DAT_SUCCESS;\r
- }\r
- else if (p_active_port->p_attr->link_state != IB_LINK_ACTIVE)\r
- {\r
- /* \r
- * Port is DOWN; can not send or recv messages\r
- */\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMG: Port %d is DOWN; can not send to fabric\n", \r
- p_active_port->p_attr->port_num);\r
- return (DAT_INVALID_STATE);\r
- }\r
- }\r
-\r
- dapl_os_memzero (&user_query, sizeof (ib_user_query_t));\r
- dapl_os_memzero (&service_rec, sizeof (ib_service_record_t));\r
- dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
- dapl_os_memzero (&ipv6_addr, sizeof (DAT_SOCK_ADDR6));\r
-\r
- if (p_ia_address->sa_family == AF_INET)\r
- {\r
- dapl_os_memcpy (&ipv6_addr.sin6_addr.s6_addr[12], \r
- &((struct sockaddr_in *)p_ia_address)->sin_addr.s_addr, \r
- 4);\r
-#ifdef DAPL_DBG\r
- {\r
- int rval;\r
-\r
- rval = ((struct sockaddr_in *) p_ia_address)->sin_addr.s_addr;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DsNMG: Remote ia_address = %d.%d.%d.%d \n", \r
- (rval >> 0) & 0xff,\r
- (rval >> 8) & 0xff,\r
- (rval >> 16) & 0xff,\r
- (rval >> 24) & 0xff);\r
- }\r
-#endif\r
-\r
- }\r
- else\r
- {\r
- /*\r
- * Assume IPv6 address\r
- */\r
- dapl_os_assert (p_ia_address->sa_family == AF_INET6);\r
- dapl_os_memcpy (ipv6_addr.sin6_addr.s6_addr,\r
- ((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_addr.s6_addr, \r
- HCA_IPV6_ADDRESS_LENGTH);\r
-#ifdef DAPL_DBG\r
- {\r
- int i;\r
- uint8_t *tmp = ipv6_addr.sin6_addr.s6_addr;\r
-\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM, \r
- "--> DsNMG: Remote ia_address - ");\r
-\r
- for ( i = 1; i < HCA_IPV6_ADDRESS_LENGTH; i++)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%x:", \r
- tmp[i-1] );\r
- }\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%x\n",\r
- tmp[i-1] );\r
- }\r
-#endif\r
-\r
- }\r
-\r
- /*\r
- * query SA for GID\r
- */\r
- //service_rec.service_id = CL_HTON64 (DAPL_ATS_SERVICE_ID);\r
- dapl_os_memcpy ( service_rec.service_name, ATS_NAME, __min(sizeof(ATS_NAME),sizeof(ib_svc_name_t)));\r
- dapl_os_memcpy (&service_rec.service_data8[0], \r
- ipv6_addr.sin6_addr.s6_addr,\r
- HCA_IPV6_ADDRESS_LENGTH);\r
- service_rec.service_lease = IB_INFINITE_SERVICE_LEASE;\r
- service_rec.service_pkey = IB_DEFAULT_PKEY;\r
-\r
- user_query.method = IB_MAD_METHOD_GETTABLE;\r
- user_query.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
- user_query.comp_mask = IB_SR_COMPMASK_SPKEY |\r
- IB_SR_COMPMASK_SLEASE |\r
- IB_SR_COMPMASK_SNAME |\r
- IB_SR_COMPMASK_SDATA8_0 |\r
- IB_SR_COMPMASK_SDATA8_1 |\r
- IB_SR_COMPMASK_SDATA8_2 |\r
- IB_SR_COMPMASK_SDATA8_3 |\r
- IB_SR_COMPMASK_SDATA8_4 |\r
- IB_SR_COMPMASK_SDATA8_5 |\r
- IB_SR_COMPMASK_SDATA8_6 |\r
- IB_SR_COMPMASK_SDATA8_7 |\r
- IB_SR_COMPMASK_SDATA8_8 |\r
- IB_SR_COMPMASK_SDATA8_9 |\r
- IB_SR_COMPMASK_SDATA8_10 |\r
- IB_SR_COMPMASK_SDATA8_11 |\r
- IB_SR_COMPMASK_SDATA8_12 |\r
- IB_SR_COMPMASK_SDATA8_13 |\r
- IB_SR_COMPMASK_SDATA8_14 |\r
- IB_SR_COMPMASK_SDATA8_15;\r
-\r
- user_query.attr_size = sizeof (ib_service_record_t);\r
- user_query.p_attr = (void *)&service_rec;\r
-\r
- query_req.query_type = IB_QUERY_USER_DEFINED;\r
- query_req.p_query_input = (void *)&user_query;\r
- query_req.flags = IB_FLAGS_SYNC; /* this is a blocking call */\r
- query_req.timeout_ms = 1 * 1000; /* 1 second */\r
- query_req.retry_cnt = 5;\r
- /* query SA using this port */\r
- query_req.port_guid = p_active_port->p_attr->port_guid;\r
- query_req.query_context = (void *) &user_query;\r
- query_req.pfn_query_cb = dapli_ib_sa_query_cb;\r
- \r
- ib_status = ib_query (dapl_ibal_root.h_al, &query_req, NULL);\r
- \r
- if (ib_status != IB_SUCCESS) \r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"ns_map_gid: status %s @line = %d\n", \r
- ib_get_err_str(ib_status), __LINE__);\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
- else if (service_rec.service_gid.unicast.interface_id == 0)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> %s: query SA found no record\n","DsNMG"); \r
- return DAT_INVALID_PARAMETER;\r
- }\r
- \r
- /* \r
- * return the GID\r
- */ \r
- p_gid->guid = service_rec.service_gid.unicast.interface_id;\r
- p_gid->gid_prefix = service_rec.service_gid.unicast.prefix;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_ns_map_ipaddr (\r
- IN DAPL_HCA *hca_ptr,\r
- IN GID gid,\r
- OUT DAT_IA_ADDRESS_PTR p_ia_address)\r
-{\r
- ib_user_query_t user_query;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
- ib_service_record_t service_rec;\r
- ib_api_status_t ib_status;\r
- ib_query_req_t query_req;\r
-\r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (NULL == p_ca)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> DsNMI: NULL HCA @ line# %d?\n", __LINE__ );\r
- return (DAT_INVALID_HANDLE);\r
- }\r
-\r
- /*\r
- * We are using the first active port in the list for\r
- * communication. We have to get back here when we decide to support\r
- * fail-over and high-availability.\r
- */\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> DsNMI: Port %d !available @ line# %d\n",\r
- hca_ptr->port_num, __LINE__);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- if (p_active_port->p_attr->lid == 0) \r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsNMI: Port %d has no LID "\r
- "assigned; can not operate\n", \r
- p_active_port->p_attr->port_num );\r
- return (DAT_INVALID_STATE);\r
- }\r
- /*else \r
- {\r
- // \r
- // We are operating in the LOOPBACK mode\r
- //\r
- if ((gid.gid_prefix ==\r
- p_active_port->p_attr->p_gid_table[0].unicast.prefix) &&\r
- (gid.guid == \r
- p_active_port->p_attr->p_gid_table[0].unicast.interface_id))\r
- {\r
- dapl_os_memcpy (((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_addr.s6_addr, \r
- hca_ptr->hca_address.sin6_addr.s6_addr,\r
- HCA_IPV6_ADDRESS_LENGTH);\r
- return DAT_SUCCESS;\r
- }\r
- \r
- }*/\r
- if (p_active_port->p_attr->link_state != IB_LINK_ACTIVE)\r
- {\r
- /* \r
- * Port is DOWN; can not send or recv messages\r
- */\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsNMI: Port %d is DOWN; "\r
- "can not send/recv to/from fabric\n", \r
- p_active_port->p_attr->port_num );\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- dapl_os_memzero (&user_query, sizeof (ib_user_query_t));\r
- dapl_os_memzero (&service_rec, sizeof (ib_service_record_t));\r
- dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
-\r
- /*\r
- * query SA for IPAddress\r
- */\r
- //service_rec.service_id = CL_HTON64 (DAPL_ATS_SERVICE_ID);\r
- dapl_os_memcpy ( service_rec.service_name,\r
- ATS_NAME,\r
- __min (sizeof(ATS_NAME), sizeof(ib_svc_name_t)) );\r
- service_rec.service_gid.unicast.interface_id = gid.guid;\r
- service_rec.service_gid.unicast.prefix = gid.gid_prefix;\r
- service_rec.service_pkey = IB_DEFAULT_PKEY;\r
- service_rec.service_lease = IB_INFINITE_SERVICE_LEASE;\r
-\r
- user_query.method = IB_MAD_METHOD_GETTABLE;\r
- user_query.attr_id = IB_MAD_ATTR_SERVICE_RECORD;\r
-\r
- user_query.comp_mask = IB_SR_COMPMASK_SGID |\r
- IB_SR_COMPMASK_SPKEY |\r
- IB_SR_COMPMASK_SLEASE | \r
- IB_SR_COMPMASK_SNAME;\r
-\r
- user_query.attr_size = sizeof (ib_service_record_t);\r
- user_query.p_attr = (void *)&service_rec;\r
-\r
- query_req.query_type = IB_QUERY_USER_DEFINED;\r
- query_req.p_query_input = (void *)&user_query;\r
- query_req.flags = IB_FLAGS_SYNC; /* this is a blocking call */\r
- query_req.timeout_ms = 1 * 1000; /* 1 second */\r
- query_req.retry_cnt = 5;\r
-\r
- /* query SA using this port */\r
- query_req.port_guid = p_active_port->p_attr->port_guid;\r
- query_req.query_context = (void *) &user_query;\r
- query_req.pfn_query_cb = dapli_ib_sa_query_cb;\r
-\r
- ib_status = ib_query (dapl_ibal_root.h_al, &query_req, NULL);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "ns_map_ipaddr: exits status %s @line %d\n", \r
- ib_get_err_str(ib_status), __LINE__);\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
- \r
- /* ***********************\r
- * return the IP_address\r
- *************************/ \r
- dapl_os_memcpy (\r
- (void *)&((struct sockaddr_in *)p_ia_address)->sin_addr.s_net,\r
- (const void *)&service_rec.service_data8[ATS_IPV4_OFFSET],\r
- 4 ); //HCA_IPV6_ADDRESS_LENGTH);\r
- ((DAT_SOCK_ADDR6 *)p_ia_address)->sin6_family = AF_INET;\r
- \r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_ns_create_gid_map()\r
- *\r
- * Register a ServiceRecord containing uDAPL_svc_id, IP address and GID to SA\r
- * Other nodes can look it up by quering the SA\r
- *\r
- * Input:\r
- * hca_ptr HCA device pointer\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapls_ib_ns_create_gid_map (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- UNUSED_PARAM( hca_ptr );\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_ns_remove_gid_map (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- UNUSED_PARAM( hca_ptr );\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-\r
-static void AL_API\r
-dapli_ib_sa_query_cb (\r
- IN ib_query_rec_t *p_query_rec )\r
-{\r
- ib_api_status_t ib_status;\r
-\r
- if (IB_SUCCESS != p_query_rec->status)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: SA query callback failed status %s\n",\r
- ib_get_err_str(p_query_rec->status) );\r
- return;\r
- }\r
-\r
- if (!p_query_rec->p_result_mad)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: SA query callback [no mad] @line %d\n",\r
- __LINE__ );\r
- return;\r
- }\r
-\r
- switch (p_query_rec->query_type)\r
- {\r
- case IB_QUERY_PATH_REC_BY_GIDS:\r
- {\r
- ib_path_rec_t *p_path_rec;\r
-\r
- p_path_rec = ib_get_query_path_rec (p_query_rec->p_result_mad, 0);\r
- if (p_path_rec) \r
- {\r
- dapl_os_memcpy ((void *) p_query_rec->query_context, \r
- (void *) p_path_rec,\r
- sizeof (ib_path_rec_t));\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "sa_query_cb: path {slid: 0x%x, dlid: 0x%x}\n",\r
- p_path_rec->slid, p_path_rec->dlid );\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: NULL path_rec? @line %d\n",\r
- __LINE__ );\r
- return;\r
- }\r
- break;\r
- }\r
-\r
- case IB_QUERY_SVC_REC_BY_ID:\r
- {\r
- ib_service_record_t *p_svc_rec;\r
-\r
- p_svc_rec = ib_get_query_svc_rec (p_query_rec->p_result_mad, 0);\r
- if (p_svc_rec) \r
- {\r
- dapl_os_memcpy ((void *) p_query_rec->query_context, \r
- (void *) p_svc_rec,\r
- sizeof (ib_service_record_t));\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "sa_query_cb: SER{0x%I64x, 0x%I64x}\n",\r
- cl_hton64 (p_svc_rec->service_gid.unicast.prefix),\r
- cl_hton64 (p_svc_rec->service_gid.unicast.interface_id));\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: return NULL? @line %d\n",__LINE__);\r
- return;\r
- }\r
- break;\r
-\r
- }\r
-\r
- case IB_QUERY_USER_DEFINED:\r
- {\r
- ib_user_query_t *p_user_query;\r
-\r
- p_user_query =(ib_user_query_t *)p_query_rec->query_context;\r
- if (p_user_query)\r
- {\r
- switch (p_user_query->attr_id)\r
- {\r
- case IB_MAD_ATTR_SERVICE_RECORD:\r
- {\r
- ib_service_record_t *p_svc_rec;\r
-\r
- p_svc_rec = ib_get_query_svc_rec (p_query_rec->p_result_mad, 0);\r
- if (p_svc_rec) \r
- {\r
- dapl_os_memcpy ((void *) p_user_query->p_attr, \r
- (void *) p_svc_rec,\r
- sizeof (ib_service_record_t));\r
- dapl_dbg_log (\r
- DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,\r
- "sa_query_cb: GID{0x" F64x ", 0x" F64x "} record count %d\n",\r
- cl_hton64(p_svc_rec->service_gid.unicast.prefix),\r
- cl_hton64(p_svc_rec->service_gid.unicast.interface_id ),\r
- p_query_rec->result_cnt);\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: NULL svc_rec? @line %d\n",\r
- __LINE__);\r
- return;\r
- }\r
- break;\r
-\r
- }\r
- default:\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: USER_DEFINED %d\n",\r
- p_user_query->attr_id );\r
- break;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: NULL user_query? @line %d\n",\r
- __LINE__ );\r
- return;\r
- }\r
- break;\r
- }\r
-\r
- default:\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "sa_query_cb: unsupported TYPE %d?\n",\r
- p_query_rec->query_type );\r
- break;\r
- }\r
-\r
- }\r
-\r
- if ((ib_status = ib_put_mad (p_query_rec->p_result_mad)) != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "sa_query_cb: can not free MAD %s\n", \r
- ib_get_err_str(ib_status) );\r
- } \r
-}\r
-\r
-static void \r
-dapli_ib_cm_apr_cb (\r
- IN ib_cm_apr_rec_t *p_cm_apr_rec )\r
-{\r
- UNUSED_PARAM( p_cm_apr_rec );\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCAcb: CM callback APR (Alternate Path Request)\n");\r
-}\r
-\r
-static void \r
-dapli_ib_cm_lap_cb (\r
- IN ib_cm_lap_rec_t *p_cm_lap_rec )\r
-{\r
- UNUSED_PARAM( p_cm_lap_rec );\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCLcb: CM callback LAP (Load Alternate Path)\n");\r
-}\r
-\r
-static void \r
-dapli_ib_cm_dreq_cb (\r
- IN ib_cm_dreq_rec_t *p_cm_dreq_rec )\r
-{\r
- ib_cm_drep_t cm_drep;\r
- DAPL_SP *sp_ptr;\r
- DAPL_EP *ep_ptr;\r
- \r
- dapl_os_assert (p_cm_dreq_rec);\r
-\r
- ep_ptr = (DAPL_EP *) p_cm_dreq_rec->qp_context;\r
-\r
- if ( ep_ptr == NULL ||\r
- ep_ptr->header.magic == DAPL_MAGIC_INVALID )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "--> DiCDcb: EP = %p invalid or FREED\n", ep_ptr);\r
- return;\r
- }\r
-\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCDcb: EP = %p QP = %p in state = %d\n",\r
- ep_ptr, ep_ptr->qp_handle, ep_ptr->param.ep_state);\r
-\r
- if (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED)\r
- {\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
- return;\r
- }\r
-\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECT_PENDING;\r
- ep_ptr->recv_discreq = DAT_TRUE;\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- dapl_os_memzero (&cm_drep, sizeof ( ib_cm_drep_t));\r
- \r
- /* Could fail if we received reply from other side, no need to retry */\r
- /* Wait for any transaction in process holding reference */\r
- while ( ep_ptr->req_count )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCDcb: WAIT for EP=%p req_count(%d) == 0 \n", \r
- ep_ptr, ep_ptr->req_count);\r
- dapl_os_sleep_usec (1000); /* 1 ms */\r
- }\r
-\r
- ib_cm_drep (p_cm_dreq_rec->h_cm_dreq, &cm_drep);\r
-\r
- /* CM puts QP in reset state */\r
- ep_ptr->qp_state = IB_QPS_RESET;\r
- \r
- if (ep_ptr->cr_ptr)\r
- {\r
- sp_ptr = ((DAPL_CR *) ep_ptr->cr_ptr)->sp_ptr;\r
-\r
- dapls_cr_callback ( p_cm_dreq_rec->h_cm_dreq,\r
- IB_CME_DISCONNECTED,\r
- (void *) p_cm_dreq_rec->p_dreq_pdata,\r
- (void *) sp_ptr,\r
- NULL);\r
- }\r
- else\r
- {\r
- sp_ptr = NULL;\r
-\r
- dapl_evd_connection_callback ( p_cm_dreq_rec->h_cm_dreq,\r
- IB_CME_DISCONNECTED,\r
- (void *) p_cm_dreq_rec->p_dreq_pdata,\r
- p_cm_dreq_rec->qp_context);\r
- }\r
-}\r
-\r
-static void \r
-dapli_ib_cm_drep_cb (\r
- IN ib_cm_drep_rec_t *p_cm_drep_rec )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAPL_EP *ep_ptr;\r
- \r
- dapl_os_assert (p_cm_drep_rec != NULL);\r
-\r
- ep_ptr = (DAPL_EP *) p_cm_drep_rec->qp_context;\r
-\r
- if (ep_ptr)\r
- {\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCDpcb: EP = %p QP = %p in state = %d\n",\r
- ep_ptr, ep_ptr->qp_handle, ep_ptr->param.ep_state);\r
-\r
- if ( ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "--> DiCDpcb: EP = %p QP = %p already disconnected\n",\r
- ep_ptr, ep_ptr->qp_handle);\r
- return;\r
- }\r
-\r
- if (ep_ptr->cr_ptr)\r
- {\r
- sp_ptr = ((DAPL_CR *) ep_ptr->cr_ptr)->sp_ptr;\r
-\r
- dapls_cr_callback ( ep_ptr->cm_handle,\r
- IB_CME_DISCONNECTED,\r
- (void *) p_cm_drep_rec->p_drep_pdata,\r
- (void *) sp_ptr,\r
- NULL);\r
- }\r
- else\r
- {\r
- sp_ptr = NULL;\r
-\r
- dapl_evd_connection_callback ( ep_ptr->cm_handle,\r
- IB_CME_DISCONNECTED,\r
- (void *) p_cm_drep_rec->p_drep_pdata,\r
- p_cm_drep_rec->qp_context);\r
- }\r
- }\r
-}\r
-\r
-\r
-static void \r
-dapli_ib_cm_rep_cb (\r
- IN ib_cm_rep_rec_t *p_cm_rep_rec )\r
-{\r
- ib_api_status_t ib_status; \r
- ib_cm_rtu_t cm_rtu;\r
- uint8_t cm_cb_op;\r
- DAPL_PRIVATE *prd_ptr;\r
- DAPL_EP *ep_ptr;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- dapl_os_assert (p_cm_rep_rec != NULL);\r
-\r
- dapl_os_memzero (&cm_rtu, sizeof ( ib_cm_rtu_t ));\r
-\r
- dapl_os_assert ( ((DAPL_HEADER *) p_cm_rep_rec->qp_context)->magic == \r
- DAPL_MAGIC_EP );\r
- \r
- ep_ptr = (DAPL_EP *) p_cm_rep_rec->qp_context;\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCRpcb: EP = %p local_max_rdma_read_in %d\n", \r
- ep_ptr, p_cm_rep_rec->resp_res);\r
-\r
- p_ca = (dapl_ibal_ca_t *) \r
- ep_ptr->header.owner_ia->hca_ptr->ib_hca_handle;\r
-\r
- cm_rtu.pfn_cm_apr_cb = dapli_ib_cm_apr_cb;\r
- cm_rtu.pfn_cm_dreq_cb = dapli_ib_cm_dreq_cb;\r
- cm_rtu.p_rtu_pdata = NULL;\r
- cm_rtu.access_ctrl = IB_AC_LOCAL_WRITE|IB_AC_RDMA_WRITE|IB_AC_MW_BIND;\r
- if ((ep_ptr->param.ep_attr.max_rdma_read_in > 0) || \r
- (ep_ptr->param.ep_attr.max_rdma_read_out > 0))\r
- {\r
- cm_rtu.access_ctrl |= IB_AC_RDMA_READ;\r
- }\r
- \r
- cm_rtu.rq_depth = 0;\r
- cm_rtu.sq_depth = 0;\r
- \r
- ib_status = ib_cm_rtu (p_cm_rep_rec->h_cm_rep, &cm_rtu);\r
-\r
- if (ib_status == IB_SUCCESS)\r
- {\r
- cm_cb_op = IB_CME_CONNECTED;\r
- }\r
- else\r
- {\r
- cm_cb_op = IB_CME_LOCAL_FAILURE;\r
- }\r
-\r
- prd_ptr = (DAPL_PRIVATE *) p_cm_rep_rec->p_rep_pdata;\r
-\r
-#ifdef DAPL_DBG\r
-#if 0\r
- {\r
- int i;\r
- \r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "--> DiCRpcb: private_data: ");\r
-\r
- for ( i = 0 ; i < IB_MAX_REP_PDATA_SIZE ; i++ )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, \r
- "0x%x ", prd_ptr->private_data[i]);\r
- \r
- }\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "\n");\r
- \r
- }\r
-#endif\r
-#endif\r
-\r
- dapl_evd_connection_callback ( \r
- p_cm_rep_rec->h_cm_rep,\r
- cm_cb_op,\r
- (void *) prd_ptr,\r
- (void *) p_cm_rep_rec->qp_context);\r
-}\r
-\r
-\r
-static void \r
-dapli_ib_cm_rej_cb (\r
- IN ib_cm_rej_rec_t *p_cm_rej_rec )\r
-{\r
- DAPL_EP *ep_ptr;\r
- ib_cm_events_t cm_event;\r
-\r
- dapl_os_assert (p_cm_rej_rec);\r
-\r
- ep_ptr = (DAPL_EP *) p_cm_rej_rec->qp_context;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCRjcb: EP = %p QP = %p rej reason = 0x%x\n", \r
- ep_ptr, ep_ptr->qp_handle, CL_NTOH16(p_cm_rej_rec->rej_status));\r
-\r
- switch (p_cm_rej_rec->rej_status)\r
- {\r
- case IB_REJ_INSUF_RESOURCES:\r
- case IB_REJ_INSUF_QP:\r
- case IB_REJ_INVALID_COMM_ID:\r
- case IB_REJ_INVALID_COMM_INSTANCE:\r
- case IB_REJ_INVALID_PKT_RATE:\r
- case IB_REJ_INVALID_ALT_GID:\r
- case IB_REJ_INVALID_ALT_LID:\r
- case IB_REJ_INVALID_ALT_SL:\r
- case IB_REJ_INVALID_ALT_TRAFFIC_CLASS:\r
- case IB_REJ_INVALID_ALT_PKT_RATE:\r
- case IB_REJ_INVALID_ALT_HOP_LIMIT:\r
- case IB_REJ_INVALID_ALT_FLOW_LBL:\r
- case IB_REJ_INVALID_GID:\r
- case IB_REJ_INVALID_LID:\r
- case IB_REJ_INVALID_SID:\r
- case IB_REJ_INVALID_SL:\r
- case IB_REJ_INVALID_TRAFFIC_CLASS:\r
- case IB_REJ_PORT_REDIRECT:\r
- case IB_REJ_INVALID_MTU:\r
- case IB_REJ_INSUFFICIENT_RESP_RES:\r
- case IB_REJ_INVALID_CLASS_VER:\r
- case IB_REJ_INVALID_FLOW_LBL:\r
- cm_event = IB_CME_DESTINATION_REJECT;\r
- break;\r
-\r
- case IB_REJ_TIMEOUT:\r
- cm_event = IB_CME_DESTINATION_UNREACHABLE;\r
- break;\r
-\r
- case IB_REJ_USER_DEFINED:\r
- cm_event = IB_CME_DESTINATION_REJECT;\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCRjcb: user defined rej reason %s\n",\r
- p_cm_rej_rec->p_ari);\r
- break;\r
-\r
- default:\r
- cm_event = IB_CME_LOCAL_FAILURE;\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DiCRjcb: with unknown status %x\n", \r
- p_cm_rej_rec->rej_status);\r
- break;\r
- }\r
-\r
- /* FIXME - Vu\r
- * We do not take care off the user defined rej reason with additional \r
- * rejection information (p_ari)\r
- */\r
-\r
- if (ep_ptr->cr_ptr)\r
- {\r
- dapls_cr_callback ( ep_ptr->cm_handle,\r
- cm_event,\r
- (void *) p_cm_rej_rec->p_rej_pdata,\r
- (void *) ((DAPL_CR *) ep_ptr->cr_ptr)->sp_ptr,\r
- NULL);\r
- }\r
- else\r
- {\r
- dapl_evd_connection_callback ( ep_ptr->cm_handle,\r
- cm_event,\r
- (void *) p_cm_rej_rec->p_rej_pdata,\r
- (void *) p_cm_rej_rec->qp_context);\r
- }\r
-\r
-}\r
-\r
-static void \r
-dapli_ib_cm_req_cb (\r
- IN ib_cm_req_rec_t *p_cm_req_rec )\r
-{\r
- DAPL_SP *sp_ptr;\r
- DAT_SOCK_ADDR6 dest_ia_addr;\r
-\r
-\r
- dapl_os_assert (p_cm_req_rec);\r
-\r
- sp_ptr = (DAPL_SP *) p_cm_req_rec->context;\r
-\r
- dapl_os_assert (sp_ptr);\r
-\r
-\r
- /*\r
- * Save the cm_srvc_handle to avoid the race condition between\r
- * the return of the ib_cm_listen and the notification of a conn req\r
- */\r
- if (sp_ptr->cm_srvc_handle != p_cm_req_rec->h_cm_listen)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiCRqcb: cm_service_handle is changed\n"); \r
- sp_ptr->cm_srvc_handle = p_cm_req_rec->h_cm_listen;\r
- }\r
-\r
- dapl_os_memzero (&dest_ia_addr, sizeof (dest_ia_addr));\r
-\r
-#ifdef NO_NAME_SERVICE\r
-\r
- {\r
- DAPL_PRIVATE *prd_ptr;\r
- \r
- prd_ptr = (DAPL_PRIVATE *)p_cm_req_rec->p_req_pdata;\r
-\r
- dapl_os_memcpy ((void *)&dest_ia_addr,\r
- (void *)&prd_ptr->hca_address,\r
- sizeof (DAT_SOCK_ADDR6)); \r
- }\r
- \r
-#else\r
-\r
- {\r
- GID dest_gid;\r
-\r
- dapl_os_memzero (&dest_gid, sizeof (dest_gid));\r
-\r
- dest_gid.guid = p_cm_req_rec->primary_path.dgid.unicast.interface_id;\r
- dest_gid.gid_prefix = p_cm_req_rec->primary_path.dgid.unicast.prefix;\r
-\r
- if (DAT_SUCCESS != dapls_ns_map_ipaddr (\r
- sp_ptr->header.owner_ia->hca_ptr,\r
- dest_gid,\r
- (DAT_IA_ADDRESS_PTR)&dest_ia_addr))\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"cm_req_cb: SP = %p failed mapping GID-IPaddr\n",\r
- sp_ptr);\r
- }\r
- }\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-#ifdef DAPL_DBG\r
- {\r
- int rval;\r
- \r
- rval = ((struct sockaddr_in *) &(dest_ia_addr))->sin_addr.s_addr;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM|DAPL_DBG_TYPE_CALLBACK, \r
- "cm_req_cb: query SA for RemoteAddr: %d.%d.%d.%d\n",\r
- (rval >> 0) & 0xff,\r
- (rval >> 8) & 0xff,\r
- (rval >> 16) & 0xff,\r
- (rval >> 24) & 0xff);\r
- }\r
-#endif\r
-\r
- /* FIXME - Vu\r
- * We have NOT used/saved the primary and alternative path record\r
- * ie. p_cm_req_rec->p_primary_path and p_cm_req_rec->p_alt_path\r
- * We should cache some fields in path record in the Name Service DB\r
- * such as: dgid, dlid\r
- * Also we do not save resp_res (ie. max_oustanding_rdma_read/atomic)\r
- * rnr_retry_cnt and flow_ctrl fields\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "cm_req_cb: SP = %p rem_max_rdma_read_in %d\n", \r
- sp_ptr, p_cm_req_rec->resp_res);\r
-\r
- dapls_cr_callback ( p_cm_req_rec->h_cm_req,\r
- IB_CME_CONNECTION_REQUEST_PENDING,\r
- (void *) p_cm_req_rec->p_req_pdata,\r
- (void *) p_cm_req_rec->context,\r
- (DAT_IA_ADDRESS_PTR)&dest_ia_addr);\r
-}\r
-\r
-\r
-static void \r
-dapli_ib_cm_mra_cb (\r
- IN ib_cm_mra_rec_t *p_cm_mra_rec )\r
-{\r
- UNUSED_PARAM( p_cm_mra_rec );\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiCMcb: CM callback MRA\n");\r
-}\r
-\r
-static void \r
-dapli_ib_cm_rtu_cb (\r
- IN ib_cm_rtu_rec_t *p_cm_rtu_rec )\r
-{\r
- DAPL_EP *ep_ptr;\r
-\r
- dapl_os_assert (p_cm_rtu_rec != NULL);\r
- \r
- ep_ptr = (DAPL_EP *) p_cm_rtu_rec->qp_context;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiCRucb: EP = %p QP = %p\n", ep_ptr, ep_ptr->qp_handle); \r
-\r
- if (ep_ptr->cr_ptr)\r
- {\r
- DAPL_SP *sp_ptr;\r
-\r
- sp_ptr = ((DAPL_CR *) ep_ptr->cr_ptr)->sp_ptr;\r
-\r
- dapls_cr_callback ( ep_ptr->cm_handle,\r
- IB_CME_CONNECTED,\r
- (void *) p_cm_rtu_rec->p_rtu_pdata,\r
- (void *) sp_ptr,\r
- NULL);\r
- \r
- }\r
- else\r
- {\r
- dapl_evd_connection_callback ( \r
- ep_ptr->cm_handle,\r
- IB_CME_CONNECTED,\r
- (void *) p_cm_rtu_rec->p_rtu_pdata,\r
- (void *) ep_ptr);\r
- }\r
-}\r
-\r
-static void\r
-dapli_ib_cm_cancel_cb( void *context )\r
-{\r
- DAPL_SP *sp_ptr;\r
-\r
- sp_ptr = (DAPL_SP *) context;\r
- dapl_os_assert ( sp_ptr );\r
- dapl_os_assert ( sp_ptr->header.magic == DAPL_MAGIC_PSP || \r
- sp_ptr->header.magic == DAPL_MAGIC_RSP );\r
-\r
- dapl_os_wait_object_wakeup( &sp_ptr->wait_object );\r
-}\r
-\r
-DAT_RETURN\r
-dapls_ib_cm_remote_addr (\r
- IN DAT_HANDLE dat_handle,\r
- IN DAPL_PRIVATE *prd_ptr,\r
- OUT DAT_SOCK_ADDR6 *remote_ia_address )\r
-{\r
- UNUSED_PARAM( dat_handle );\r
- UNUSED_PARAM( prd_ptr );\r
- UNUSED_PARAM( remote_ia_address );\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_connect\r
- *\r
- * Initiate a connection with the passive listener on another node\r
- *\r
- * Input:\r
- * ep_handle,\r
- * remote_ia_address,\r
- * remote_conn_qual,\r
- * prd_size size of private data and structure\r
- * prd_prt pointer to private data structure\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_connect (\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- IN DAT_CONN_QUAL remote_conn_qual,\r
- IN DAT_COUNT prd_size,\r
- IN DAPL_PRIVATE *prd_ptr )\r
-{\r
- DAPL_EP *ep_ptr;\r
- DAPL_IA *ia_ptr;\r
- ib_api_status_t ib_status;\r
- dapl_ibal_port_t *p_active_port;\r
- dapl_ibal_ca_t *p_ca;\r
- ib_cm_req_t cm_req;\r
- ib_path_rec_t path_rec;\r
- GID dest_GID;\r
- ib_query_req_t query_req;\r
- ib_gid_pair_t gid_pair;\r
- ib_service_record_t service_rec;\r
- int retry_cnt;\r
- DAT_RETURN dat_status;\r
-\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- ia_ptr = ep_ptr->header.owner_ia;\r
- ep_ptr->cr_ptr = NULL;\r
- retry_cnt = 0;\r
- dat_status = DAT_SUCCESS;\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
-\r
- /*\r
- * We are using the first active port in the list for\r
- * communication. We have to get back here when we decide to support\r
- * fail-over and high-availability.\r
- */\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)ia_ptr->hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsC: Port %d is not available = %d\n",\r
- ia_ptr->hca_ptr->port_num, __LINE__);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- dapl_os_memzero (&dest_GID, sizeof (GID));\r
- dapl_os_memzero (&cm_req, sizeof (ib_cm_req_t));\r
- dapl_os_memzero (&path_rec, sizeof (ib_path_rec_t));\r
- dapl_os_memzero (&service_rec, sizeof (ib_service_record_t));\r
- dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
- dapl_os_memzero (&gid_pair, sizeof (ib_gid_pair_t));\r
- dapl_os_memzero (&ep_ptr->remote_ia_address, sizeof (DAT_SOCK_ADDR6));\r
-\r
- dapl_os_memcpy (&ep_ptr->remote_ia_address, \r
- remote_ia_address, \r
- sizeof (ep_ptr->remote_ia_address));\r
-\r
-\r
-#ifdef NO_NAME_SERVICE\r
-\r
- if (DAT_SUCCESS !=\r
- (dat_status = dapls_ns_lookup_address (\r
- ia_ptr,\r
- remote_ia_address,\r
- &dest_GID )))\r
- {\r
- /*\r
- * Remote address not in the table, this is a\r
- * strange return code!\r
- */\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsC: exits status = %x\n", dat_status);\r
- return dat_status;\r
- }\r
-\r
- dest_GID.guid = CL_HTON64 (dest_GID.guid);\r
- dest_GID.gid_prefix = CL_HTON64 (dest_GID.gid_prefix);\r
-\r
-#else\r
-\r
- /*\r
- * We query the SA to get the dest_gid with the \r
- * {uDAPL_svc_id, IP-address} as the key to get GID.\r
- */\r
- if (DAT_SUCCESS !=\r
- (dat_status = dapls_ns_map_gid (ia_ptr->hca_ptr, \r
- remote_ia_address,\r
- &dest_GID)))\r
- \r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsC: fail to map remote_ia_addr (sa_family %d) to gid\n",\r
- remote_ia_address->sa_family); \r
- return dat_status;\r
- }\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
- gid_pair.dest_gid.unicast.interface_id = dest_GID.guid;\r
- gid_pair.dest_gid.unicast.prefix = dest_GID.gid_prefix;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "dapls_ib_connect: EP = %p QP = %p SERVER GID{0x" F64x ", 0x" F64x "}\n", \r
- ep_ptr, ep_ptr->qp_handle, cl_hton64 (gid_pair.dest_gid.unicast.prefix),\r
- cl_hton64 (gid_pair.dest_gid.unicast.interface_id));\r
-\r
- gid_pair.src_gid = p_active_port->p_attr->p_gid_table[0];\r
-/*\r
- if ((gid_pair.src_gid.unicast.interface_id == \r
- gid_pair.dest_gid.unicast.interface_id ) &&\r
- (gid_pair.src_gid.unicast.prefix == \r
- gid_pair.dest_gid.unicast.prefix ))\r
- {\r
- path_rec.dgid = gid_pair.dest_gid;\r
- path_rec.sgid = gid_pair.src_gid;\r
- path_rec.slid = path_rec.dlid = p_active_port->p_attr->lid;\r
- path_rec.pkey = p_active_port->p_attr->p_pkey_table[0];\r
- path_rec.mtu = p_active_port->p_attr->mtu;\r
- path_rec.pkt_life = 18; // 1 sec\r
- path_rec.rate = IB_PATH_RECORD_RATE_10_GBS;\r
- \r
- }\r
- else\r
- {\r
- */ /*\r
- * Query SA to get the path record from pair of GIDs\r
- */\r
- dapl_os_memzero (&query_req, sizeof (ib_query_req_t));\r
- query_req.query_type = IB_QUERY_PATH_REC_BY_GIDS;\r
- query_req.p_query_input = (void *) &gid_pair;\r
- query_req.flags = IB_FLAGS_SYNC; \r
- query_req.timeout_ms = 1 * 1000; /* 1 second */\r
- query_req.retry_cnt = 3;\r
- /* query SA using this port */\r
- query_req.port_guid = p_active_port->p_attr->port_guid;\r
- query_req.query_context = (void *) &path_rec;\r
- query_req.pfn_query_cb = dapli_ib_sa_query_cb;\r
- \r
- ib_status = ib_query (dapl_ibal_root.h_al, &query_req, NULL);\r
-\r
- if ((ib_status != IB_SUCCESS) || (!path_rec.dlid))\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsC: EP = %p QP = %p query pair_gids status = %s\n", \r
- ep_ptr, ep_ptr->qp_handle, ib_get_err_str(ib_status));\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- //}\r
-\r
- /*\r
- * Tavor has a HW bug that causes bandwidth with 2K MTU to be less than\r
- * with 1K MTU. Cap the MTU based on device ID to compensate for this.\r
- */\r
- if( (p_ca->p_ca_attr->dev_id == 0x5A44) &&\r
- (ib_path_rec_mtu( &path_rec ) > IB_MTU_LEN_1024) )\r
- {\r
- /* Local endpoint is Tavor - cap MTU to 1K for extra bandwidth. */\r
- path_rec.mtu &= IB_PATH_REC_SELECTOR_MASK;\r
- path_rec.mtu |= IB_MTU_LEN_1024;\r
- }\r
-\r
- /* \r
- * prepare the Service ID from conn_qual \r
- */\r
- cm_req.svc_id = remote_conn_qual;\r
- cm_req.p_primary_path = &path_rec;\r
- cm_req.p_alt_path = NULL;\r
- cm_req.h_qp = ep_ptr->qp_handle;\r
- cm_req.qp_type = IB_QPT_RELIABLE_CONN;\r
- cm_req.p_req_pdata = (uint8_t *) prd_ptr;\r
- cm_req.req_length = (uint8_t)prd_size;\r
- /* cm retry to send this request messages, IB max of 4 bits */\r
- cm_req.max_cm_retries = 15; /* timer outside of call, s/be infinite */\r
- /* qp retry to send any wr */\r
- cm_req.retry_cnt = 5;\r
- /* max num of oustanding RDMA read/atomic support */\r
- cm_req.resp_res = (uint8_t)ep_ptr->param.ep_attr.max_rdma_read_in;\r
- /* max num of oustanding RDMA read/atomic will use */\r
- cm_req.init_depth = (uint8_t)ep_ptr->param.ep_attr.max_rdma_read_out;\r
-\r
- /* time wait before retrying a pkt after receiving a RNR NAK */\r
- cm_req.rnr_nak_timeout = IB_RNR_NAK_TIMEOUT; /* dapl_ibal_util.h */\r
- \r
- /* \r
- * number of time local QP should retry after receiving RNR NACK before\r
- * reporting an error\r
- */\r
- cm_req.rnr_retry_cnt = IB_RNR_RETRY_CNT;\r
-\r
- cm_req.remote_resp_timeout = 16; /* 250ms */\r
- cm_req.local_resp_timeout = 16; /* 250ms */\r
- \r
- cm_req.flow_ctrl = TRUE;\r
- cm_req.flags = 0;\r
- /*\r
- * We do not use specific data buffer to check for specific connection\r
- */\r
- cm_req.p_compare_buffer = NULL;\r
- cm_req.compare_offset = 0;\r
- cm_req.compare_length = 0;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DsConn: EP=%p QP=%p rio=%d,%d, pl=%d, mtu=%d slid=%#x dlid=%#x\n", \r
- ep_ptr, ep_ptr->qp_handle, cm_req.resp_res, \r
- cm_req.init_depth,\r
- ib_path_rec_pkt_life(&path_rec),\r
- ib_path_rec_mtu(&path_rec),\r
- cm_req.p_primary_path->slid,\r
- cm_req.p_primary_path->dlid);\r
-\r
- /*\r
- * We do not support peer_to_peer; therefore, we set pfn_cm_req_cb = NULL\r
- */\r
- cm_req.pfn_cm_req_cb = NULL;\r
- cm_req.pfn_cm_rep_cb = dapli_ib_cm_rep_cb;\r
- cm_req.pfn_cm_rej_cb = dapli_ib_cm_rej_cb;\r
- /* callback when a message received acknowledgement is received */\r
- cm_req.pfn_cm_mra_cb = dapli_ib_cm_mra_cb;\r
-\r
- ib_status = ib_cm_req (&cm_req);\r
- \r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsC: EP = %p QP = %p conn_request failed = %s\n", \r
- ep_ptr, ep_ptr->qp_handle, ib_get_err_str(ib_status));\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_disconnect\r
- *\r
- * Disconnect an EP\r
- *\r
- * Input:\r
- * ep_handle,\r
- * disconnect_flags\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
- dapls_ib_disconnect (\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_CLOSE_FLAGS disconnect_flags)\r
-{\r
- ib_api_status_t ib_status = IB_SUCCESS;\r
- ib_cm_dreq_t cm_dreq;\r
-\r
- UNUSED_PARAM( disconnect_flags );\r
-\r
- dapl_os_memzero(&cm_dreq, sizeof(ib_cm_dreq_t));\r
-\r
- cm_dreq.qp_type = IB_QPT_RELIABLE_CONN;\r
- cm_dreq.h_qp = ep_ptr->qp_handle;\r
- cm_dreq.pfn_cm_drep_cb = dapli_ib_cm_drep_cb;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- "--> DsD: EP=%p QP=%p ep_state=%d, dr %d, ds %d\n", \r
- ep_ptr, ep_ptr->qp_handle, \r
- ep_ptr->param.ep_state,\r
- ep_ptr->recv_discreq, ep_ptr->sent_discreq );\r
-\r
- /* \r
- * Currently we do not send any disconnect private data to\r
- * the other endpoint because DAT 1.0 & 1.1 does not support \r
- */\r
- cm_dreq.p_dreq_pdata = NULL;\r
-\r
- if ( (ep_ptr->recv_discreq == DAT_FALSE )\r
- && (ep_ptr->sent_discreq == DAT_FALSE ) )\r
- //(disconnect_flags == DAT_CLOSE_ABRUPT_FLAG ) )\r
- {\r
- ep_ptr->sent_discreq = DAT_TRUE;\r
- ib_status = ib_cm_dreq ( &cm_dreq );\r
- \r
- /* tolerate INVALID_STATE error as the other side can race ahead and\r
- * generate a DREQ before we do.\r
- */ \r
- if ( ib_status == IB_INVALID_STATE )\r
- ib_status = IB_SUCCESS;\r
-\r
- if (ib_status )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "--> DsD: EP=%p QP= %p DREQ SEND status %s\n", \r
- ep_ptr, ep_ptr->qp_handle,ib_get_err_str(ib_status));\r
- }\r
- }\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_setup_conn_listener\r
- *\r
- * Have the CM set up a connection listener.\r
- *\r
- * Input:\r
- * ibm_hca_handle HCA handle\r
- * qp_handle QP handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_setup_conn_listener (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_UINT64 ServiceID,\r
- IN DAPL_SP *sp_ptr )\r
-{\r
- ib_api_status_t ib_status;\r
- ib_cm_listen_t cm_listen;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
-\r
- /*\r
- * We are using the first active port in the list for\r
- * communication. We have to get back here when we decide to support\r
- * fail-over and high-availability.\r
- */\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)ia_ptr->hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"setup_conn_listener: SP = %p port %d is not available\n",\r
- sp_ptr, ia_ptr->hca_ptr->port_num);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- if (p_active_port->p_attr->lid == 0)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsSCL: SP = %p SID = 0x" F64x " port %d\n", \r
- sp_ptr, cl_hton64(ServiceID), p_active_port->p_attr->port_num);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "Setup_conn_listener: SP = %p port %d GID{0x" F64x ", 0x" F64x "} and SID 0x" F64x "\n", \r
- sp_ptr, p_active_port->p_attr->port_num,\r
- cl_hton64 (p_active_port->p_attr->p_gid_table[0].unicast.prefix),\r
- cl_hton64 (p_active_port->p_attr->p_gid_table[0].unicast.interface_id),\r
- cl_hton64 (ServiceID));\r
- \r
- dapl_os_memzero (&cm_listen, sizeof (ib_cm_listen_t));\r
-\r
- /*\r
- * Listen for all request on this specific CA\r
- */\r
- cm_listen.ca_guid = (p_ca->p_ca_attr->ca_guid);\r
- cm_listen.svc_id = ServiceID;\r
- cm_listen.qp_type = IB_QPT_RELIABLE_CONN; \r
-\r
- /*\r
- * We do not use specific data buffer to check for specific connection\r
- */\r
- cm_listen.p_compare_buffer = NULL;//(uint8_t*)&sp_ptr->conn_qual;\r
- cm_listen.compare_offset = 0;//IB_MAX_REQ_PDATA_SIZE - sizeof(DAT_CONN_QUAL);\r
- cm_listen.compare_length = 0;//sizeof(DAT_CONN_QUAL);\r
-\r
- /*\r
- * We can pick a port here for communication and the others are reserved\r
- * for fail-over / high-availability - TBD\r
- */\r
- cm_listen.port_guid = p_active_port->p_attr->port_guid;\r
- cm_listen.lid = p_active_port->p_attr->lid;\r
- cm_listen.pkey = p_active_port->p_attr->p_pkey_table[0];\r
-\r
- /*\r
- * Register request or mra callback functions\r
- */\r
- cm_listen.pfn_cm_req_cb = dapli_ib_cm_req_cb;\r
-\r
- ib_status = ib_cm_listen ( dapl_ibal_root.h_al,\r
- &cm_listen,\r
- (void *) sp_ptr,\r
- &sp_ptr->cm_srvc_handle);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"setup_conn_listener: SP = %p SID = 0x" F64x " listen failed = %s\n", \r
- sp_ptr, cl_hton64 (ServiceID), ib_get_err_str(ib_status));\r
- }\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-/*\r
- * dapl_ib_remove_conn_listener\r
- *\r
- * Have the CM remove a connection listener.\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * ServiceID IB Channel Service ID\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN dapls_ib_remove_conn_listener (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_SP *sp_ptr)\r
-{\r
- ib_api_status_t ib_status;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
- \r
- UNUSED_PARAM( ia_ptr );\r
-\r
- if (sp_ptr->cm_srvc_handle)\r
- {\r
- ib_status = ib_cm_cancel (sp_ptr->cm_srvc_handle, \r
- dapli_ib_cm_cancel_cb );\r
- \r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsRCL: SP = %p ib_cm_cancel failed = %s\n", \r
- sp_ptr, ib_get_err_str(ib_status));\r
- return (DAT_INVALID_PARAMETER);\r
- }\r
- dat_status = dapl_os_wait_object_wait (\r
- &sp_ptr->wait_object, DAT_TIMEOUT_INFINITE );\r
-\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsRCL: SP = %p wait failed = 0x%x\n", \r
- sp_ptr, dat_status );\r
- return dat_status;\r
- }\r
-\r
- sp_ptr->cm_srvc_handle = NULL;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-/*\r
- * dapls_ib_reject_connection\r
- *\r
- * Perform necessary steps to reject a connection\r
- *\r
- * Input:\r
- * cr_handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_reject_connection (\r
- IN ib_cm_handle_t ib_cm_handle,\r
- IN int reject_reason )\r
-{\r
- ib_api_status_t ib_status;\r
- ib_cm_rej_t cm_rej;\r
- static char *rej_table[] =\r
- {\r
- "INVALID_REJ_REASON",\r
- "INVALID_REJ_REASON",\r
- "INVALID_REJ_REASON",\r
- "INVALID_REJ_REASON",\r
- "INVALID_REJ_REASON",\r
- "IB_CME_DESTINATION_REJECT",\r
- "IB_CME_DESTINATION_REJECT_PRIVATE_DATA",\r
- "IB_CME_DESTINATION_UNREACHABLE",\r
- "IB_CME_TOO_MANY_CONNECTION_REQUESTS",\r
- "IB_CME_LOCAL_FAILURE",\r
- "IB_CM_LOCAL_FAILURE"\r
- };\r
-\r
-#define REJ_TABLE_SIZE IB_CM_LOCAL_FAILURE\r
-\r
- reject_reason = __min( reject_reason & 0xff, REJ_TABLE_SIZE);\r
-\r
- cm_rej.rej_status = IB_REJ_USER_DEFINED;\r
- cm_rej.p_ari = (ib_ari_t *)&rej_table[reject_reason]; \r
- cm_rej.ari_length = (uint8_t)strlen (rej_table[reject_reason]);\r
- cm_rej.p_rej_pdata = NULL;\r
- cm_rej.rej_length = 0;\r
-\r
- ib_status = ib_cm_rej ( ib_cm_handle, &cm_rej);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsRjC: cm_handle = %p reject failed = %s\n", \r
- &ib_cm_handle, ib_get_err_str(ib_status));\r
- }\r
-\r
- return ( dapl_ib_status_convert ( ib_status ) );\r
-\r
-}\r
-\r
-\r
-\r
-\r
-/*\r
- * dapls_ib_accept_connection\r
- *\r
- * Perform necessary steps to accept a connection\r
- *\r
- * Input:\r
- * cr_handle\r
- * ep_handle\r
- * private_data_size\r
- * private_data\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_accept_connection (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_COUNT private_data_size,\r
- IN DAPL_PRIVATE *prd_ptr )\r
-{\r
- DAPL_CR *cr_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAPL_IA *ia_ptr;\r
- DAT_RETURN dat_status;\r
- ib_api_status_t ib_status;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
- ib_cm_rep_t cm_rep;\r
-\r
- cr_ptr = (DAPL_CR *) cr_handle;\r
- ep_ptr = (DAPL_EP *) ep_handle;\r
- ia_ptr = ep_ptr->header.owner_ia;\r
-\r
- if ( ep_ptr->qp_state == DAPL_QP_STATE_UNATTACHED )\r
- {\r
- /*\r
- * If we are lazy attaching the QP then we may need to\r
- * hook it up here. Typically, we run this code only for\r
- * DAT_PSP_PROVIDER_FLAG\r
- */\r
- dat_status = dapls_ib_qp_alloc ( ia_ptr, ep_ptr, ep_ptr );\r
-\r
- if ( dat_status != DAT_SUCCESS)\r
- {\r
- /* This is not a great error code, but all the spec allows */\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsAC: CR = %p EP = %p alloc QP failed = 0x%x\n", \r
- cr_ptr, ep_ptr, dat_status);\r
- return (dat_status);\r
- }\r
- }\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)ia_ptr->hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsAC: CR = %p EP = %p port %d is not available\n",\r
- cr_ptr, ep_ptr, ia_ptr->hca_ptr->port_num);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- cr_ptr->param.local_ep_handle = ep_handle;\r
- ep_ptr->cm_handle = cr_ptr->ib_cm_handle;\r
- ep_ptr->qp_state = IB_QPS_INIT;\r
- ep_ptr->cr_ptr = cr_ptr;\r
-\r
- dapl_os_memzero ( &cm_rep, sizeof (ib_cm_rep_t) );\r
-\r
- cm_rep.h_qp = ep_ptr->qp_handle;\r
- cm_rep.qp_type = IB_QPT_RELIABLE_CONN;\r
- cm_rep.p_rep_pdata = (uint8_t *) prd_ptr->private_data;\r
- cm_rep.rep_length = (uint8_t) private_data_size;\r
-\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM, \r
- "--> DsAC: CR = %p EP = %p QP = %p cm_handle = %p\n", \r
- cr_ptr, ep_ptr, ep_ptr->qp_handle, ep_ptr->cm_handle );\r
-\r
-#ifdef DAPL_DBG\r
-#if 0\r
- {\r
- int i;\r
- \r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "--> DsAC: private_data: ");\r
-\r
- for ( i = 0 ; i < IB_MAX_REP_PDATA_SIZE ; i++ )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, \r
- "0x%x ", prd_ptr->private_data[i]);\r
- \r
- }\r
- dapl_dbg_log ( DAPL_DBG_TYPE_EP, "\n");\r
- \r
- }\r
-#endif\r
-#endif\r
-\r
- cm_rep.pfn_cm_rej_cb = dapli_ib_cm_rej_cb;\r
- cm_rep.pfn_cm_mra_cb = dapli_ib_cm_mra_cb;\r
- cm_rep.pfn_cm_rtu_cb = dapli_ib_cm_rtu_cb;\r
- cm_rep.pfn_cm_lap_cb = dapli_ib_cm_lap_cb;\r
- cm_rep.pfn_cm_dreq_cb = dapli_ib_cm_dreq_cb;\r
-\r
- /*\r
- * FIXME - Vu\r
- * Play attention to the attributes. \r
- * Some of them are desirably set by DAT consumers\r
- */\r
- /*\r
- * We enable the qp associate with this connection ep all the access right\r
- * We enable the flow_ctrl, retry till success\r
- * We will limit the access right and flow_ctrl upon DAT consumers \r
- * requirements\r
- */\r
- cm_rep.access_ctrl = IB_AC_LOCAL_WRITE|IB_AC_RDMA_WRITE|IB_AC_MW_BIND;\r
- if ((ep_ptr->param.ep_attr.max_rdma_read_in > 0) \r
- || (ep_ptr->param.ep_attr.max_rdma_read_out > 0))\r
- {\r
- cm_rep.access_ctrl |= IB_AC_RDMA_READ;\r
- }\r
-\r
- cm_rep.sq_depth = 0;\r
- cm_rep.rq_depth = 0;\r
- /* max num of oustanding RDMA read/atomic will use */\r
- cm_rep.init_depth = (uint8_t)ep_ptr->param.ep_attr.max_rdma_read_out;\r
- cm_rep.flow_ctrl = TRUE;\r
- cm_rep.flags = 0;\r
- cm_rep.failover_accepted = IB_FAILOVER_ACCEPT_UNSUPPORTED;\r
- cm_rep.target_ack_delay = 14;\r
- /* see dapl_ibal_util.h for IB_RNR_XXX */;\r
- cm_rep.rnr_nak_timeout = IB_RNR_NAK_TIMEOUT;\r
- cm_rep.rnr_retry_cnt = IB_RNR_RETRY_CNT;\r
- cm_rep.p_recv_wr = NULL;\r
- cm_rep.pp_recv_failure = NULL;\r
- \r
- ib_status = ib_cm_rep ( cr_ptr->ib_cm_handle, &cm_rep);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsAC: EP = %p QP = %p cm_handle = %p reply failed = %#x\n", \r
- ep_ptr, ep_ptr->qp_handle, ep_ptr->cm_handle, ib_status );\r
- }\r
- \r
- return ( dapl_ib_status_convert ( ib_status ) );\r
-}\r
-\r
-\r
-\r
-/*\r
- * dapls_ib_disconnect_clean\r
- *\r
- * Clean up outstanding connection data. This routine is invoked\r
- * after the final disconnect callback has occurred. Only on the\r
- * ACTIVE side of a connection.\r
- *\r
- * Input:\r
- * ep_ptr DAPL_EP\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * void\r
- *\r
- */\r
-void\r
-dapls_ib_disconnect_clean (\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_BOOLEAN active,\r
- IN const ib_cm_events_t ib_cm_event )\r
-{\r
- DAPL_IA *ia_ptr;\r
- ib_qp_attr_t qp_attr;\r
- ib_api_status_t ib_status;\r
-\r
- ia_ptr = ep_ptr->header.owner_ia;\r
- \r
- if ( ia_ptr == NULL || ia_ptr->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return;\r
- }\r
- dapl_os_assert ( ep_ptr->header.magic == DAPL_MAGIC_EP ||\r
- ep_ptr->header.magic == DAPL_MAGIC_EP_EXIT );\r
- \r
- /* \r
- * Query the QP to get the current state */\r
- ib_status = ib_query_qp ( ep_ptr->qp_handle, &qp_attr );\r
- \r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, ">>>DSCONN_CLEAN(%s): Query QP failed = %#x\n",\r
- (active?"Act":"Pas"),ib_status );\r
- return;\r
- }\r
- \r
- ep_ptr->qp_state = qp_attr.state;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,">>>DSCONN_CLEAN(%s): cm_event: %d ep_ptr=%p ep_state:%d qp_state: %#x\n", \r
- (active?"A":"P"),\r
- ib_cm_event,\r
- ep_ptr,\r
- ep_ptr->param.ep_state,\r
- ep_ptr->qp_state);\r
- if ( ep_ptr->qp_state != IB_QPS_ERROR &&\r
- ep_ptr->qp_state != IB_QPS_RESET &&\r
- ep_ptr->qp_state != IB_QPS_INIT )\r
- {\r
- ep_ptr->qp_state = IB_QPS_ERROR;\r
- dapls_modify_qp_state_to_error (ep_ptr->qp_handle);\r
- }\r
- return;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_cr_handoff\r
- *\r
- * Hand off the connection request to another service point \r
- *\r
- * Input:\r
- * cr_handle DAT_CR_HANDLE\r
- * handoff_serv_id DAT_CONN_QUAL\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN \r
-dapls_ib_cr_handoff (\r
- IN DAT_CR_HANDLE cr_handle,\r
- IN DAT_CONN_QUAL handoff_serv_id )\r
-{\r
- DAPL_CR *cr_ptr;\r
- ib_api_status_t ib_status;\r
- \r
- cr_ptr = (DAPL_CR *) cr_handle;\r
-\r
- if (cr_ptr->ib_cm_handle.cid == 0xFFFFFFFF)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsCH: CR = %p invalid cm handle\n", cr_ptr);\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- if (cr_ptr->sp_ptr == IB_INVALID_HANDLE)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsCH: CR = %p invalid psp handle\n", cr_ptr);\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- ib_status = ib_cm_handoff (cr_ptr->ib_cm_handle, handoff_serv_id);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,"--> DsCH: CR = %p handoff failed = %s\n", \r
- cr_ptr, ib_get_err_str(ib_status));\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- /* Remove the CR from the queue */\r
- dapl_sp_remove_cr (cr_ptr->sp_ptr, cr_ptr);\r
-\r
- /*\r
- * If this SP has been removed from service, free it\r
- * up after the last CR is removed\r
- */\r
- dapl_os_lock (&cr_ptr->sp_ptr->header.lock);\r
- if ( cr_ptr->sp_ptr->listening != DAT_TRUE && \r
- cr_ptr->sp_ptr->cr_list_count == 0 &&\r
- cr_ptr->sp_ptr->state != DAPL_SP_STATE_FREE )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, \r
- "--> DsCH: CR = %p disconnect dump SP = %p \n", \r
- cr_ptr, cr_ptr->sp_ptr);\r
- /* Decrement the ref count on the EVD */\r
- if (cr_ptr->sp_ptr->evd_handle)\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)cr_ptr->sp_ptr->evd_handle)->evd_ref_count);\r
- cr_ptr->sp_ptr->evd_handle = NULL;\r
- }\r
- cr_ptr->sp_ptr->state = DAPL_SP_STATE_FREE;\r
- dapl_os_unlock (&cr_ptr->sp_ptr->header.lock);\r
- (void)dapls_ib_remove_conn_listener ( cr_ptr->sp_ptr->header.owner_ia,\r
- cr_ptr->sp_ptr );\r
- dapls_ia_unlink_sp ( (DAPL_IA *)cr_ptr->sp_ptr->header.owner_ia,\r
- cr_ptr->sp_ptr );\r
- dapls_sp_free_sp ( cr_ptr->sp_ptr );\r
- }\r
- else\r
- {\r
- dapl_os_unlock (&cr_ptr->sp_ptr->header.lock);\r
- }\r
-\r
- /*\r
- * Clean up and dispose of the resource\r
- */\r
- dapls_cr_free (cr_ptr);\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-/*\r
- * dapls_ib_private_data_size\r
- *\r
- * Return the size of private data given a connection op type\r
- *\r
- * Input:\r
- * prd_ptr private data pointer\r
- * conn_op connection operation type\r
- *\r
- * If prd_ptr is NULL, this is a query for the max size supported by\r
- * the provider, otherwise it is the actual size of the private data\r
- * contained in prd_ptr.\r
- *\r
- * Infiniband has fixed size private data, so prd_ptr is ignored.\r
- *\r
- * Output:\r
- * None\r
- *\r
- * Returns:\r
- * length of private data\r
- *\r
- */\r
-DAT_COUNT\r
-dapls_ib_private_data_size (\r
- IN DAPL_PRIVATE *prd_ptr,\r
- IN DAPL_PDATA_OP conn_op)\r
-{\r
- int size;\r
-\r
- UNUSED_PARAM( prd_ptr );\r
-\r
- switch (conn_op)\r
- {\r
- case DAPL_PDATA_CONN_REQ:\r
- {\r
- size = IB_MAX_REQ_PDATA_SIZE;\r
- break;\r
- }\r
- case DAPL_PDATA_CONN_REP:\r
- {\r
- size = IB_MAX_REP_PDATA_SIZE;\r
- break;\r
- }\r
- case DAPL_PDATA_CONN_REJ:\r
- {\r
- size = IB_MAX_REJ_PDATA_SIZE;\r
- break;\r
- }\r
- case DAPL_PDATA_CONN_DREQ:\r
- {\r
- size = IB_MAX_DREQ_PDATA_SIZE;\r
- break;\r
- }\r
- case DAPL_PDATA_CONN_DREP:\r
- {\r
- size = IB_MAX_DREP_PDATA_SIZE;\r
- break;\r
- }\r
- default:\r
- {\r
- size = 0;\r
- }\r
- } /* end case */\r
-\r
- return size;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_dto.h\r
- *\r
- * PURPOSE: Utility routines for data transfer operations using the\r
- * IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_IBAL_DTO_H\r
-#define _DAPL_IBAL_DTO_H\r
-\r
-#include "dapl_ibal_util.h"\r
-\r
-STATIC _INLINE_ int\r
-dapls_cqe_opcode_convert (ib_work_completion_t *cqe_p);\r
-\r
-extern DAT_RETURN\r
-dapls_ib_cq_late_alloc (\r
- IN ib_pd_handle_t pd_handle,\r
- IN DAPL_EVD *evd_ptr);\r
-\r
-#define DAPL_DEFAULT_DS_ENTRIES 8\r
-\r
-/*\r
- * dapls_ib_post_recv\r
- *\r
- * Provider specific Post RECV function\r
- */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapls_ib_post_recv (\r
- IN DAPL_EP *ep_ptr,\r
- IN DAPL_COOKIE *cookie,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov)\r
-{\r
- ib_api_status_t ib_status;\r
- ib_recv_wr_t recv_wr, *failed_wr_p;\r
- ib_local_ds_t ds_array[DAPL_DEFAULT_DS_ENTRIES], *ds_array_p;\r
- DAT_COUNT i, total_len;\r
-\r
- dapl_os_memzero(&recv_wr, sizeof(ib_recv_wr_t));\r
-#ifndef _WIN64\r
- // Fix MS compiler warning C4826: Conversion from 'DAPL_COOKIE *' to\r
- // 'DAT_UINT64' sign-extends; This may cause unexpected runtime behavior.\r
- recv_wr.wr_id = (DAT_UINT64) (DAT_UINT32) cookie;\r
-#else\r
- recv_wr.wr_id = (DAT_UINT64) cookie;\r
-#endif\r
- recv_wr.num_ds = num_segments;\r
-\r
- if( num_segments <= DAPL_DEFAULT_DS_ENTRIES )\r
- {\r
- ds_array_p = ds_array;\r
- }\r
- else\r
- {\r
- ds_array_p = dapl_os_alloc( num_segments * sizeof(ib_local_ds_t) );\r
- }\r
- recv_wr.ds_array = ds_array_p;\r
-\r
- if (NULL == ds_array_p)\r
- {\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- total_len = 0;\r
-\r
- for (i = 0; i < num_segments; i++, ds_array_p++)\r
- {\r
- ds_array_p->length = (uint32_t)local_iov[i].segment_length;\r
- ds_array_p->lkey = local_iov[i].lmr_context;\r
- ds_array_p->vaddr = local_iov[i].virtual_address;\r
- total_len += ds_array_p->length;\r
- }\r
-\r
- if (cookie != NULL)\r
- {\r
- cookie->val.dto.size = total_len;\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsPR: EP = %p QP = %p cookie= %p, num_seg= %d\n", \r
- ep_ptr, ep_ptr->qp_handle, cookie, num_segments);\r
- }\r
- recv_wr.p_next = NULL;\r
-\r
- ib_status = ib_post_recv( ep_ptr->qp_handle, &recv_wr, &failed_wr_p );\r
-\r
- if( num_segments > DAPL_DEFAULT_DS_ENTRIES )\r
- dapl_os_free( recv_wr.ds_array, num_segments * sizeof(ib_local_ds_t) );\r
-\r
- if (IB_SUCCESS == ib_status)\r
- {\r
- return DAT_SUCCESS;\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR,\r
- "--> DsPR: post_recv status %s\n",\r
- ib_get_err_str(ib_status));\r
- /*\r
- * Moving QP to error state; \r
- */\r
- (void) dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
- ep_ptr->qp_state = IB_QPS_ERROR;\r
-\r
- return (dapl_ib_status_convert (ib_status));\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_post_send\r
- *\r
- * Provider specific Post SEND function\r
- */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapls_ib_post_send (\r
- IN DAPL_EP *ep_ptr,\r
- IN ib_send_op_type_t op_type,\r
- IN DAPL_COOKIE *cookie,\r
- IN DAT_COUNT num_segments,\r
- IN DAT_LMR_TRIPLET *local_iov,\r
- IN const DAT_RMR_TRIPLET *remote_iov,\r
- IN DAT_COMPLETION_FLAGS completion_flags )\r
-{\r
- ib_api_status_t ib_status;\r
- ib_send_wr_t send_wr, *failed_wr_p;\r
- ib_local_ds_t ds_array[DAPL_DEFAULT_DS_ENTRIES], *ds_array_p;\r
- DAT_COUNT i, total_len;\r
-\r
- if (ep_ptr->param.ep_state != DAT_EP_STATE_CONNECTED)\r
- {\r
- ib_qp_attr_t qp_attr;\r
-\r
- (void) ib_query_qp ( ep_ptr->qp_handle, &qp_attr );\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "--> DsPS: !CONN EP (%p) ep_state=%d QP_state=%d\n", \r
- ep_ptr, ep_ptr->param.ep_state, qp_attr.state );\r
-\r
- return(DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_EP_DISCONNECTED));\r
- }\r
- dapl_os_memzero (&send_wr, sizeof(ib_send_wr_t));\r
-\r
- send_wr.wr_type = op_type;\r
- send_wr.num_ds = num_segments;\r
-\r
- if( num_segments <= DAPL_DEFAULT_DS_ENTRIES )\r
- {\r
- ds_array_p = ds_array;\r
- }\r
- else\r
- {\r
- ds_array_p = dapl_os_alloc( num_segments * sizeof(ib_local_ds_t) );\r
- }\r
- send_wr.ds_array = ds_array_p;\r
-\r
- if (NULL == ds_array_p)\r
- {\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- total_len = 0;\r
-\r
- for (i = 0; i < num_segments; i++, ds_array_p++)\r
- {\r
- ds_array_p->length = (uint32_t)local_iov[i].segment_length;\r
- ds_array_p->lkey = local_iov[i].lmr_context;\r
- ds_array_p->vaddr = local_iov[i].virtual_address;\r
- total_len += ds_array_p->length;\r
- }\r
-\r
- /* NULL cookie is OK if no Completion event is requested */\r
- if (cookie != NULL)\r
- {\r
- dapl_os_assert( cookie->ep == ep_ptr );\r
- cookie->val.dto.size = total_len;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsPS: EVD=%p EP=%p QP=%p type=%d "\r
- "sg=%d ln=%d ck=%p 0x" F64x "\n", \r
- ep_ptr->param.request_evd_handle, ep_ptr, ep_ptr->qp_handle, \r
- op_type, num_segments, total_len,\r
- cookie, cookie->val.dto.cookie.as_64 );\r
- }\r
-#ifndef _WIN64\r
- // Fix MS compiler warning C4826: Conversion from 'DAPL_COOKIE *' to\r
- // 'DAT_UTIN64' sign-extends; This may cause unexpected runtime behavior.\r
- send_wr.wr_id = (DAT_UINT64) (DAT_UINT32)cookie;\r
-#else\r
- send_wr.wr_id = (DAT_UINT64) cookie;\r
-#endif\r
-\r
- /* RC for now */\r
- if (total_len > 0)\r
- {\r
- send_wr.remote_ops.vaddr = remote_iov->target_address;\r
- send_wr.remote_ops.rkey = remote_iov->rmr_context;\r
- }\r
-\r
- send_wr.send_opt = 0;\r
-\r
- send_wr.send_opt |= (DAT_COMPLETION_BARRIER_FENCE_FLAG & \r
- completion_flags) ? IB_SEND_OPT_FENCE : 0;\r
- send_wr.send_opt |= (DAT_COMPLETION_SUPPRESS_FLAG & \r
- completion_flags) ? 0 : IB_SEND_OPT_SIGNALED;\r
- send_wr.send_opt |= (DAT_COMPLETION_SOLICITED_WAIT_FLAG & \r
- completion_flags) ? IB_SEND_OPT_SOLICITED : 0;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, "--> DsPS: EP=%p QP=%p send_opt=0x%x,"\r
- "rem_addr=%p, rem_rkey=0x%x completion_flags=0x%x\n",\r
- ep_ptr, ep_ptr->qp_handle, \r
- send_wr.send_opt, (void *)(uintptr_t) send_wr.remote_ops.vaddr,\r
- send_wr.remote_ops.rkey, completion_flags);\r
-\r
- send_wr.p_next = NULL;\r
-\r
- /* hold reference for QP command serialization on destruction */\r
- dapl_os_atomic_inc (&ep_ptr->req_count);\r
- ib_status = ib_post_send( ep_ptr->qp_handle, &send_wr, &failed_wr_p );\r
- dapl_os_atomic_dec (&ep_ptr->req_count);\r
-\r
- if( num_segments > DAPL_DEFAULT_DS_ENTRIES )\r
- dapl_os_free( send_wr.ds_array, num_segments * sizeof(ib_local_ds_t) );\r
-\r
- if (IB_SUCCESS == ib_status)\r
- {\r
- return DAT_SUCCESS;\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_DTO_COMP_ERR,\r
- "--> DsPS: EP=%p post_send status %s\n", \r
- ep_ptr, ib_get_err_str(ib_status));\r
- /*\r
- * Moving QP to error state; \r
- */\r
- (void) dapls_modify_qp_state_to_error ( ep_ptr->qp_handle);\r
- ep_ptr->qp_state = IB_QPS_ERROR;\r
-\r
- return (dapl_ib_status_convert (ib_status));\r
-}\r
-\r
-/*\r
- * dapls_ib_optional_prv_dat\r
- *\r
- * Allocate space for private data to be used in CR calls\r
- *\r
- * Input:\r
- * cr_ptr CR handle\r
- * event_data data provided by the provider callback function\r
- * cr_pp Pointer for private data\r
- *\r
- * Output:\r
- * cr_pp Area \r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-STATIC _INLINE_ DAT_RETURN\r
-dapls_ib_optional_prv_dat (\r
- IN DAPL_CR *cr_ptr,\r
- IN const void *event_data,\r
- OUT DAPL_CR **cr_pp)\r
-{\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
- DAPL_PRIVATE *p_prv_data = (DAPL_PRIVATE *)event_data;\r
-\r
- if ( ! cr_ptr->param.private_data_size )\r
- {\r
- cr_ptr->param.private_data_size = sizeof(cr_ptr->private_data);\r
- cr_ptr->param.private_data = cr_ptr->private_data;\r
- dapl_os_memcpy(cr_ptr->private_data, p_prv_data->private_data, cr_ptr->param.private_data_size );\r
- *cr_pp = (DAPL_CR *)cr_ptr->param.private_data;\r
- }\r
- return dat_status;\r
-}\r
-\r
-\r
-STATIC _INLINE_ int\r
-dapls_cqe_opcode_convert (ib_work_completion_t *cqe_p)\r
-{\r
- switch (((ib_work_completion_t *)cqe_p)->wc_type)\r
- {\r
- case IB_WC_SEND:\r
- {\r
- return (OP_SEND);\r
- }\r
- case IB_WC_RDMA_WRITE:\r
- case IB_WC_RECV_RDMA_WRITE:\r
- {\r
- return (OP_RDMA_WRITE);\r
- }\r
- case IB_WC_RDMA_READ:\r
- {\r
- return (OP_RDMA_READ);\r
- }\r
- case IB_WC_COMPARE_SWAP:\r
- {\r
- return (OP_COMP_AND_SWAP);\r
- }\r
- case IB_WC_FETCH_ADD:\r
- {\r
- return (OP_FETCH_AND_ADD);\r
- }\r
- case IB_WC_MW_BIND:\r
- {\r
- return (OP_BIND_MW);\r
- }\r
- case IB_WC_RECV: \r
- {\r
- return (OP_RECEIVE);\r
- }\r
- default : \r
- {\r
- /* error */ \r
- return (IB_ERROR);\r
- }\r
- }\r
-}\r
-\r
-#define DAPL_GET_CQE_WRID(cqe_p) ((ib_work_completion_t *)cqe_p)->wr_id\r
-#define DAPL_GET_CQE_OPTYPE(cqe_p) dapls_cqe_opcode_convert(cqe_p)\r
-#define DAPL_GET_CQE_BYTESNUM(cqe_p) ((ib_work_completion_t *)cqe_p)->length\r
-#define DAPL_GET_CQE_STATUS(cqe_p) ((ib_work_completion_t *)cqe_p)->status\r
-\r
-#endif /* _DAPL_IBAL_DTO_H */\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_kmod.h\r
- *\r
- * PURPOSE: Utility defs & routines for access to Intel IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_IBAL_KMOD_H_\r
-#define _DAPL_IBAL_KMOD_H_\r
-\r
-#include <complib/comp_lib.h>\r
-#include <iba/ib_types.h>\r
-#include <dapl_ibal_mrdb.h>\r
-\r
-#define MVDAPL_DEV_KEY 'm'\r
-#define MVDAPL_GET_ANY_SVID _IO ( MVDAPL_DEV_KEY, psp_get_any_svid )\r
-#define MVDAPL_MRDB_RECORD_INSERT _IO ( MVDAPL_DEV_KEY, mrdb_record_insert )\r
-#define MVDAPL_MRDB_RECORD_DEC _IO ( MVDAPL_DEV_KEY, mrdb_record_dec )\r
-#define MVDAPL_MRDB_RECORD_QUERY _IO ( MVDAPL_DEV_KEY, mrdb_record_query )\r
-#define MVDAPL_MRDB_RECORD_UPDATE _IO ( MVDAPL_DEV_KEY, mrdb_record_update )\r
-\r
-typedef enum \r
-{\r
- psp_get_any_svid,\r
- mrdb_record_insert,\r
- mrdb_record_dec,\r
- mrdb_record_query,\r
- mrdb_record_update,\r
- mvdapl_max_ops\r
-} mvdapl_dev_ops_t;\r
-\r
-typedef struct _mvdapl_user_ctx\r
-{\r
- cl_spinlock_t oust_mrdb_lock;\r
- cl_qlist_t oust_mrdb_head;\r
-} mvdapl_user_ctx_t; \r
-\r
-\r
-typedef struct _mvdapl_ca_t\r
-{\r
- cl_spinlock_t mrdb_lock;\r
- cl_qlist_t mrdb_head;\r
- boolean_t initialized;\r
- cl_dev_handle_t mrdb_dev_handle;\r
- ib_net64_t ca_guid;\r
-} mvdapl_ca_t;\r
-\r
-\r
-typedef struct _mvdapl_root\r
-{\r
- ib_al_handle_t h_al;\r
- intn_t guid_count;\r
- mvdapl_ca_t *mvdapl_ca_tbl;\r
-\r
-} mvdapl_root_t;\r
-\r
-typedef struct _mrdb_record_t\r
-{\r
- cl_list_item_t next;\r
- ib_lmr_cookie_t key_cookie;\r
- void *mr_handle;\r
- int ib_shmid;\r
- uint32_t ref_count;\r
- boolean_t initialized;\r
- cl_spinlock_t record_lock;\r
-} mrdb_record_t;\r
-\r
-\r
-typedef struct _oust_mrdb_rec\r
-{\r
- cl_list_item_t next;\r
- mrdb_record_t *p_record;\r
- uint32_t ref_count;\r
-} oust_mrdb_rec_t;\r
-\r
-\r
-#endif /* _DAPL_IBAL_KMOD_H_ */\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_mrdb.c\r
- *\r
- * PURPOSE: Utility routines for access to IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_ibal_kmod.h"\r
-#include "dapl_ibal_mrdb.h"\r
-\r
-DAT_RETURN dapls_mrdb_init (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- cl_status_t cl_status;\r
- char name[32];\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsMI");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- sprintf (name, \r
- "/dev/mvdapl%x", \r
- (uint32_t) cl_ntoh64 (p_ca->p_ca_attr->ca_guid));\r
-\r
- cl_status = cl_open_device ( (cl_dev_name_t) name, &p_ca->mlnx_device);\r
-\r
- if (cl_status != CL_SUCCESS)\r
- {\r
- /* dapl_dbg_log ( DAPL_DBG_TYPE_UTIL, \r
- "--> DsMI: Init MRDB failed = 0x%x\n", cl_status); */\r
- p_ca->mlnx_device = 0;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN dapls_mrdb_exit (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsME");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- if (p_ca->mlnx_device)\r
- {\r
- cl_close_device (p_ca->mlnx_device);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN dapls_mrdb_record_insert (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_LMR_COOKIE shared_mem_id,\r
- OUT int *p_ib_shmid)\r
-{\r
- cl_status_t cl_status;\r
- mrdb_rec_insert_ioctl_t ioctl_buf;\r
- uintn_t bytes_ret;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsMRI");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- bytes_ret = 0;\r
- cl_memclr (&ioctl_buf, sizeof (ioctl_buf));\r
- cl_memcpy (ioctl_buf.shared_mem_id, shared_mem_id, IBAL_LMR_COOKIE_SIZE);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRI: MVDAPL_MRDB_REC_INSERT mem_cookie %p\n",\r
- shared_mem_id);\r
-#if defined(DAPL_DBG)\r
- {\r
- int i;\r
- char *c = (char *) shared_mem_id;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRI: mem_cookie: \n");\r
-\r
- for ( i = 0; i < IBAL_LMR_COOKIE_SIZE ; i++)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "0x%x ", *(c+i));\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "\n");\r
- \r
- }\r
-#endif /* DAPL_DBG */\r
- \r
- cl_status = cl_ioctl_device ( p_ca->mlnx_device, \r
- MVDAPL_MRDB_RECORD_INSERT,\r
- &ioctl_buf,\r
- sizeof (mrdb_rec_insert_ioctl_t), \r
- &bytes_ret);\r
- if ((cl_status != CL_SUCCESS) ||\r
- (ioctl_buf.status == IB_INSUFFICIENT_MEMORY))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsMRI: Failed to IOCTL record_insert 0x%x\n", cl_status);\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- *p_ib_shmid = (int) ioctl_buf.inout_f;\r
-\r
- if (ioctl_buf.status == IB_ERROR)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRI: There is a record with shmid 0x%x\n", \r
- *p_ib_shmid);\r
- return DAT_INVALID_STATE;\r
- }\r
- else\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRI: Insert new mrdb record with shmid 0x%x\n", \r
- *p_ib_shmid);\r
- }\r
- \r
- return DAT_SUCCESS;\r
-}\r
-\r
-DAT_RETURN dapls_mrdb_record_dec (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_LMR_COOKIE shared_mem_id)\r
-{\r
- cl_status_t cl_status;\r
- mrdb_rec_dec_ioctl_t ioctl_buf;\r
- uintn_t bytes_ret;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsMRD");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- bytes_ret = 0;\r
- cl_memclr (&ioctl_buf, sizeof (ioctl_buf));\r
- cl_memcpy (ioctl_buf.shared_mem_id, shared_mem_id, IBAL_LMR_COOKIE_SIZE);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRD: MVDAPL_MRDB_REC_DEC mem_cookie 0x%p\n",\r
- shared_mem_id);\r
-#if defined(DAPL_DBG)\r
- {\r
- int i;\r
- char *c = (char *) shared_mem_id;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRD: mem_cookie: \n");\r
-\r
- for ( i = 0; i < IBAL_LMR_COOKIE_SIZE ; i++)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "0x%x ", *(c+i));\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "\n");\r
- \r
- }\r
-#endif /* DAPL_DBG */\r
- \r
- cl_status = cl_ioctl_device ( p_ca->mlnx_device, \r
- MVDAPL_MRDB_RECORD_DEC,\r
- &ioctl_buf,\r
- sizeof (mrdb_rec_dec_ioctl_t), \r
- &bytes_ret);\r
- if ((cl_status != CL_SUCCESS) ||\r
- (ioctl_buf.status != IB_SUCCESS))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsMRD: IOCTL failed 'cause there is no record %s\n",\r
- ib_get_err_str(ioctl_buf.status));\r
- return DAT_INVALID_STATE;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-DAT_RETURN dapls_mrdb_record_update (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_LMR_COOKIE shared_mem_id,\r
- IN struct _ib_mr* mr_handle)\r
-{\r
- cl_status_t cl_status;\r
- mrdb_rec_update_ioctl_t ioctl_buf;\r
- uintn_t bytes_ret;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsMRU");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- bytes_ret = 0;\r
- cl_memclr (&ioctl_buf, sizeof (ioctl_buf));\r
- cl_memcpy (ioctl_buf.shared_mem_id, shared_mem_id, IBAL_LMR_COOKIE_SIZE);\r
- ioctl_buf.mr_handle = mr_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRU: MVDAPL_MRDB_REC_UPDATE mr_handle %p\n", mr_handle);\r
-#if defined(DAPL_DBG) \r
- {\r
- int i;\r
- char *c = (char *) shared_mem_id;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRU: mem_cookie: \n");\r
-\r
- for ( i = 0; i < IBAL_LMR_COOKIE_SIZE ; i++)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "0x%x ", *(c+i));\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "\n");\r
- \r
- }\r
-#endif /* DAPL_DBG */\r
-\r
- cl_status = cl_ioctl_device ( p_ca->mlnx_device, \r
- MVDAPL_MRDB_RECORD_UPDATE,\r
- &ioctl_buf,\r
- sizeof (mrdb_rec_update_ioctl_t), \r
- &bytes_ret);\r
- if ((cl_status != CL_SUCCESS) ||\r
- (ioctl_buf.status != IB_SUCCESS))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsMRU: IOCTL update_record failed %s\n",\r
- ib_get_err_str(ioctl_buf.status));\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- \r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN dapls_mrdb_record_query (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_LMR_COOKIE shared_mem_id,\r
- OUT int *p_ib_shmid,\r
- OUT struct _ib_mr* *p_mr_handle)\r
-{\r
- cl_status_t cl_status;\r
- mrdb_rec_query_ioctl_t ioctl_buf;\r
- uintn_t bytes_ret;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsMRQ");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- bytes_ret = 0;\r
- cl_memclr (&ioctl_buf, sizeof (ioctl_buf));\r
-\r
- cl_memcpy (ioctl_buf.shared_mem_id, shared_mem_id, IBAL_LMR_COOKIE_SIZE);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRQ: MVDAPL_MRDB_REC_QUERY mem_cookie 0x%p\n",\r
- shared_mem_id);\r
- #if defined(DAPL_DBG) \r
- {\r
- int i;\r
- char *c = (char *) shared_mem_id;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRQ: mem_cookie: \n");\r
-\r
- for ( i = 0; i < IBAL_LMR_COOKIE_SIZE ; i++)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "0x%x ", *(c+i));\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "\n");\r
- \r
- }\r
- #endif \r
- \r
- cl_status = cl_ioctl_device ( p_ca->mlnx_device, \r
- MVDAPL_MRDB_RECORD_QUERY,\r
- &ioctl_buf,\r
- sizeof (mrdb_rec_query_ioctl_t), \r
- &bytes_ret);\r
- if ((cl_status != CL_SUCCESS) ||\r
- (ioctl_buf.status != IB_SUCCESS))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsMRQ: IOCTL query_record failed %s\n",\r
- ib_get_err_str(ioctl_buf.status));\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- \r
- *p_mr_handle = ioctl_buf.mr_handle; \r
- *p_ib_shmid = (int) ioctl_buf.inout_f; \r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsMRQ: MVDAPL_MRDB_REC_QUERY mr_handle 0x%p shmid 0x%x\n", \r
- *p_mr_handle, *p_ib_shmid);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN dapls_ib_get_any_svid (\r
- IN DAPL_HCA *hca_ptr,\r
- OUT DAT_CONN_QUAL *p_svid)\r
-{\r
- cl_status_t cl_status;\r
- psp_get_any_svid_ioctl_t ioctl_buf;\r
- uintn_t bytes_ret;\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: p_ca is NULL\n","DsPGAS");\r
- return DAT_INVALID_PARAMETER;\r
- }\r
-\r
- bytes_ret = 0;\r
- cl_memclr (&ioctl_buf, sizeof (ioctl_buf));\r
-\r
- cl_status = cl_ioctl_device ( p_ca->mlnx_device, \r
- MVDAPL_GET_ANY_SVID,\r
- &ioctl_buf,\r
- sizeof (psp_get_any_svid_ioctl_t), \r
- &bytes_ret);\r
- if ((cl_status != CL_SUCCESS) ||\r
- (ioctl_buf.status != IB_SUCCESS))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsMRQ: IOCTL query_record failed %s\n",\r
- ib_get_err_str(ioctl_buf.status));\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- \r
- *p_svid = (DAT_CONN_QUAL) ioctl_buf.inout_f; \r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsPGAS: new ServiceID 0x%x\n", \r
- *p_svid);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_mrdb.h\r
- *\r
- * PURPOSE: Utility defs & routines for access to Intel IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_IBAL_MRDB_H_\r
-#define _DAPL_IBAL_MRDB_H_\r
-\r
-#include <complib/comp_lib.h>\r
-#include <iba/ib_types.h>\r
-\r
-#define MVDAPL_BASE_SHMID 0xF00\r
-#define MVDAPL_BASE_SVID 0xF\r
-#define MVDAPL_MAX_SHMID 0xFFFFFFFF\r
-#define MVDAPL_MAX_SVID 0xEFFFFFFF\r
-\r
-#define IBAL_LMR_COOKIE_SIZE 40\r
-typedef char (* ib_lmr_cookie_t)[IBAL_LMR_COOKIE_SIZE];\r
-\r
-typedef struct _mrdb_record_ioctl\r
-{\r
- char *shared_mem_id[IBAL_LMR_COOKIE_SIZE];\r
- void *mr_handle;\r
- ib_net64_t inout_f;\r
- ib_api_status_t status;\r
-} mrdb_record_ioctl_t;\r
-\r
-typedef mrdb_record_ioctl_t mrdb_rec_dec_ioctl_t;\r
-typedef mrdb_record_ioctl_t mrdb_rec_insert_ioctl_t;\r
-typedef mrdb_record_ioctl_t mrdb_rec_query_ioctl_t;\r
-typedef mrdb_record_ioctl_t mrdb_rec_update_ioctl_t;\r
-typedef mrdb_record_ioctl_t psp_get_any_svid_ioctl_t;\r
-\r
-\r
-#endif /* _DAPL_IBAL_MRDB_H_ */\r
-\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_qp.c\r
- *\r
- * PURPOSE: IB QP routines for access to IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_ibal_util.h"\r
-\r
-#define DAPL_IBAL_QKEY 0\r
-#define DAPL_IBAL_START_PSN 0\r
-\r
-static void\r
-dapli_ib_qp_async_error_cb(\r
- IN ib_async_event_rec_t* p_err_rec )\r
-{\r
- DAPL_EP *ep_ptr = (DAPL_EP *)p_err_rec->context;\r
- DAPL_EVD *evd_ptr;\r
- DAPL_IA *ia_ptr;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_evd_cb_t *evd_cb;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC QP error %d for qp context %p\n", \r
- p_err_rec->code, p_err_rec->context);\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC qp_handle %p qpn %u\n", \r
- ((DAPL_EP *)p_err_rec->context)->qp_handle, \r
- ((DAPL_EP *)p_err_rec->context)->qpn);\r
-\r
- /*\r
- * Verify handles EP, EVD, and hca_handle\r
- */\r
- if ( DAPL_BAD_HANDLE (ep_ptr, DAPL_MAGIC_EP ) ||\r
- DAPL_BAD_HANDLE (ep_ptr->param.connect_evd_handle, DAPL_MAGIC_EVD) )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC: invalid EP %p \n", ep_ptr);\r
- return;\r
- }\r
- ia_ptr = ep_ptr->header.owner_ia;\r
- evd_ptr = ia_ptr->async_error_evd;\r
-\r
- if (DAPL_BAD_HANDLE (evd_ptr, DAPL_MAGIC_EVD) ||\r
- ! (evd_ptr->evd_flags & DAT_EVD_ASYNC_FLAG))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC: invalid EVD %p \n", evd_ptr);\r
- return;\r
- }\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC: can't find %s HCA\n", \r
- (ia_ptr->header.provider)->device_name);\r
- return;\r
- }\r
-\r
- /* find QP error callback using ia_ptr for context */\r
- evd_cb = dapli_find_evd_cb_by_context (ia_ptr, p_ca);\r
- if ((evd_cb == NULL) || (evd_cb->pfn_async_qp_err_cb == NULL))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiQpAEC: no ERROR cb on %p found \n", p_ca);\r
- return;\r
- }\r
-\r
- dapl_os_lock (&ep_ptr->header.lock);\r
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECT_PENDING;\r
- dapl_os_unlock (&ep_ptr->header.lock);\r
-\r
- /* force disconnect, QP error state, to insure DTO's get flushed */\r
- dapls_ib_disconnect ( ep_ptr, DAT_CLOSE_ABRUPT_FLAG );\r
- \r
- /* maps to dapl_evd_qp_async_error_callback(), context is EP */\r
- evd_cb->pfn_async_qp_err_cb( (ib_hca_handle_t)p_ca, \r
- (ib_error_record_t*)&p_err_rec->code, ep_ptr);\r
-}\r
-\r
-/*\r
- * dapl_ib_qp_alloc\r
- *\r
- * Alloc a QP\r
- *\r
- * Input:\r
- * *ia_ptr pointer to DAPL IA\r
- * *ep_ptr pointer to DAPL EP\r
- * *ep_ctx_ptr pointer to DAPL EP context\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_qp_alloc (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAPL_EP *ep_ctx_ptr)\r
-{\r
- DAT_EP_ATTR *attr;\r
- DAPL_EVD *recv_evd_ptr, *request_evd_ptr;\r
- DAT_RETURN dat_status;\r
- ib_api_status_t ib_status;\r
- ib_qp_create_t qp_create;\r
- ib_pd_handle_t ib_pd_handle;\r
- ib_cq_handle_t cq_recv;\r
- ib_cq_handle_t cq_send;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
- ib_qp_attr_t qp_attr;\r
-\r
- attr = &ep_ptr->param.ep_attr;\r
-\r
- dapl_os_assert ( ep_ptr->param.pz_handle != NULL );\r
-\r
- ib_pd_handle = ((DAPL_PZ *)ep_ptr->param.pz_handle)->pd_handle;\r
- recv_evd_ptr = (DAPL_EVD *) ep_ptr->param.recv_evd_handle;\r
- request_evd_ptr = (DAPL_EVD *) ep_ptr->param.request_evd_handle;\r
- \r
- cq_recv = IB_INVALID_HANDLE;\r
- cq_send = IB_INVALID_HANDLE;\r
-\r
- dapl_os_assert ( recv_evd_ptr != DAT_HANDLE_NULL );\r
- {\r
- cq_recv = (ib_cq_handle_t) recv_evd_ptr->ib_cq_handle;\r
- \r
- if ((cq_recv == IB_INVALID_HANDLE) && \r
- ( 0 != (recv_evd_ptr->evd_flags & ~DAT_EVD_SOFTWARE_FLAG) ))\r
- {\r
- dat_status = dapls_ib_cq_late_alloc (\r
- ib_pd_handle,\r
- recv_evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: failed to create CQ\n","DsQA");\r
- return (dat_status);\r
- }\r
-\r
- dat_status = dapls_set_cq_notify (ia_ptr, recv_evd_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: failed to enable notify CQ\n","DsQA");\r
- return (dat_status);\r
- }\r
- \r
- cq_recv = (ib_cq_handle_t) recv_evd_ptr->ib_cq_handle;\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQA: alloc_recv_CQ = %p\n", cq_recv); \r
- \r
- }\r
- }\r
-\r
- dapl_os_assert ( request_evd_ptr != DAT_HANDLE_NULL );\r
- {\r
- cq_send = (ib_cq_handle_t) request_evd_ptr->ib_cq_handle;\r
- \r
- if ((cq_send == IB_INVALID_HANDLE) && \r
- ( 0 != (request_evd_ptr->evd_flags & ~DAT_EVD_SOFTWARE_FLAG) ))\r
- {\r
- dat_status = dapls_ib_cq_late_alloc (\r
- ib_pd_handle,\r
- request_evd_ptr);\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: failed to create CQ\n","DsQA");\r
- return (dat_status);\r
- }\r
-\r
- dat_status = dapls_set_cq_notify (ia_ptr, request_evd_ptr);\r
-\r
- if (dat_status != DAT_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: failed to enable notify CQ\n","DsQA");\r
- return (dat_status);\r
- }\r
-\r
- cq_send = (ib_cq_handle_t) request_evd_ptr->ib_cq_handle;\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQA: alloc_send_CQ = %p\n", cq_send); \r
- }\r
- }\r
-\r
- /*\r
- * Get the CA structure\r
- */\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
-\r
- dapl_os_memzero (&qp_create, sizeof (qp_create));\r
- qp_create.qp_type = IB_QPT_RELIABLE_CONN;\r
- qp_create.sq_depth = attr->max_request_dtos;\r
- qp_create.rq_depth = attr->max_recv_dtos;\r
- qp_create.sq_sge = attr->max_recv_iov;\r
- qp_create.rq_sge = attr->max_request_iov; \r
- qp_create.h_sq_cq = cq_send;\r
- qp_create.h_rq_cq = cq_recv;\r
- qp_create.sq_signaled = FALSE;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQA: sqd,iov=%d,%d rqd,iov=%d,%d\n", \r
- attr->max_request_dtos, attr->max_request_iov,\r
- attr->max_recv_dtos, attr->max_recv_iov); \r
- \r
- ib_status = ib_create_qp ( \r
- ib_pd_handle,\r
- &qp_create,\r
- (void *) ep_ctx_ptr /* context */,\r
- dapli_ib_qp_async_error_cb,\r
- &ep_ptr->qp_handle);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "--> DsQA: Create QP failed = %s\n", ib_get_err_str(ib_status));\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQA: EP=%p, tEVD=%p, rEVD=%p QP=%p\n", \r
- ep_ptr, ep_ptr->param.request_evd_handle,\r
- ep_ptr->param.recv_evd_handle,\r
- ep_ptr->qp_handle ); \r
-\r
- ep_ptr->qp_state = IB_QPS_RESET;\r
-\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)ia_ptr->hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsQA: Port %d is not available = %d\n",\r
- ia_ptr->hca_ptr->port_num, __LINE__);\r
- return (DAT_INVALID_STATE);\r
- }\r
-\r
- ib_status = dapls_modify_qp_state_to_init ( \r
- ep_ptr->qp_handle, \r
- &ep_ptr->param.ep_attr, p_active_port);\r
-\r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsQA: Change QP state to INIT failed = %s\n",\r
- ib_get_err_str(ib_status));\r
- return (DAT_INVALID_HANDLE);\r
- }\r
- ib_status = ib_query_qp ( ep_ptr->qp_handle, &qp_attr );\r
-\r
- ep_ptr->qp_state = qp_attr.state;\r
- ep_ptr->qpn = qp_attr.num;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQAQA: EP:%p new_QP = %p state = %#x\n", ep_ptr, ep_ptr->qp_handle, ep_ptr->qp_state);\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_qp_free\r
- *\r
- * Free a QP\r
- *\r
- * Input:\r
- * *ia_ptr pointer to IA structure\r
- * *ep_ptr pointer to EP structure\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_qp_free (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr )\r
-{\r
-\r
- ib_qp_handle_t qp_handle;\r
- UNREFERENCED_PARAMETER(ia_ptr);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQF: free %p, state=%d\n", \r
- ep_ptr->qp_handle,ep_ptr->qp_state ); \r
-\r
- if (( ep_ptr->qp_handle != IB_INVALID_HANDLE ) &&\r
- ( ep_ptr->qp_state != DAPL_QP_STATE_UNATTACHED ))\r
- {\r
- qp_handle = ep_ptr->qp_handle;\r
- ep_ptr->qp_handle = IB_INVALID_HANDLE;\r
- ep_ptr->qp_state = DAPL_QP_STATE_UNATTACHED;\r
- ib_destroy_qp ( qp_handle, NULL /* callback */);\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP, \r
- "--> DsQF: freed QP %p\n", qp_handle ); \r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_qp_modify\r
- *\r
- * Set the QP to the parameters specified in an EP_PARAM\r
- *\r
- * We can't be sure what state the QP is in so we first obtain the state\r
- * from the driver. The EP_PARAM structure that is provided has been\r
- * sanitized such that only non-zero values are valid.\r
- *\r
- * Input:\r
- * *ia_ptr pointer to DAPL IA\r
- * *ep_ptr pointer to DAPL EP\r
- * *ep_attr pointer to DAT EP attribute\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_qp_modify (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EP *ep_ptr,\r
- IN DAT_EP_ATTR *ep_attr )\r
-{\r
- ib_qp_attr_t qp_attr;\r
- ib_api_status_t ib_status;\r
- ib_qp_handle_t qp_handle;\r
- ib_qp_state_t qp_state;\r
- ib_qp_mod_t qp_mod;\r
- ib_av_attr_t *p_av_attr;\r
- ib_qp_opts_t *p_qp_opts;\r
- uint32_t *p_sq_depth, *p_rq_depth;\r
- DAT_BOOLEAN need_modify;\r
- DAT_RETURN dat_status;\r
-\r
- qp_handle = ep_ptr->qp_handle;\r
- need_modify = DAT_FALSE;\r
- dat_status = DAT_SUCCESS;\r
- if ( ia_ptr == NULL || ia_ptr->header.magic != DAPL_MAGIC_IA )\r
- {\r
- dat_status = DAT_INVALID_HANDLE;\r
- goto bail;\r
- }\r
- /* \r
- * Query the QP to get the current state */\r
- ib_status = ib_query_qp ( qp_handle, &qp_attr );\r
- \r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsIQM: Query QP failed = %s\n", ib_get_err_str(ib_status));\r
- dat_status = DAT_INTERNAL_ERROR;\r
- goto bail;\r
- }\r
-\r
- qp_state = qp_attr.state;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM: modify qp state=%d\n",qp_state);\r
- /*\r
- * Check if we have the right qp_state or not\r
- */\r
- if ( (qp_state != IB_QPS_RTR ) && \r
- (qp_state != IB_QPS_RTS ) )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM: postpone to modify qp to EP values later\n");\r
- dat_status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- if (qp_state == IB_QPS_RTR)\r
- {\r
- p_av_attr = &qp_mod.state.rtr.primary_av;\r
- p_qp_opts = &qp_mod.state.rtr.opts;\r
- p_sq_depth = &qp_mod.state.rtr.sq_depth;\r
- p_rq_depth = &qp_mod.state.rtr.rq_depth;\r
- }\r
- else\r
- {\r
- /*\r
- * RTS does not have primary_av field\r
- */\r
- p_av_attr = &qp_mod.state.rts.alternate_av;\r
- p_qp_opts = &qp_mod.state.rts.opts;\r
- p_sq_depth = &qp_mod.state.rts.sq_depth;\r
- p_rq_depth = &qp_mod.state.rts.rq_depth;\r
- }\r
-\r
- if ( (ep_attr->max_recv_dtos > 0) &&\r
- ((DAT_UINT32)ep_attr->max_recv_dtos != qp_attr.rq_depth) )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM: rq_depth modified (%d,%d)\n",\r
- qp_attr.rq_depth, ep_attr->max_recv_dtos);\r
-\r
- *p_rq_depth = ep_attr->max_recv_dtos;\r
- *p_qp_opts |= IB_MOD_QP_RQ_DEPTH;\r
- need_modify = DAT_TRUE;\r
- }\r
-\r
- if ( (ep_attr->max_request_dtos > 0) &&\r
- ((DAT_UINT32)ep_attr->max_request_dtos != qp_attr.sq_depth) ) \r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM: sq_depth modified (%d,%d)\n",\r
- qp_attr.sq_depth, ep_attr->max_request_dtos);\r
-\r
- *p_sq_depth = ep_attr->max_request_dtos;\r
- *p_qp_opts |= IB_MOD_QP_SQ_DEPTH;\r
- need_modify = DAT_TRUE;\r
- }\r
-\r
- qp_mod.req_state = qp_state;\r
-\r
- if ( need_modify == DAT_TRUE )\r
- {\r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
-\r
- if ( ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> %s: ib_status = %d\n", "DsIQM", ib_status);\r
- dat_status = DAT_INTERNAL_ERROR;\r
- }\r
- }\r
-\r
-bail:\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-ib_api_status_t \r
-dapls_modify_qp_state_to_error (\r
- ib_qp_handle_t qp_handle )\r
-{\r
- ib_qp_mod_t qp_mod;\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "--> DsIQM_ERR: QP state change\n");\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- qp_mod.req_state = IB_QPS_ERROR;\r
-\r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
-\r
- return (ib_status);\r
-}\r
-\r
-\r
-ib_api_status_t \r
-dapls_modify_qp_state_to_reset (\r
- ib_qp_handle_t qp_handle )\r
-{\r
- ib_qp_mod_t qp_mod;\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM_RESET: QP state change\n");\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- qp_mod.req_state = IB_QPS_RESET;\r
-\r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
-\r
- return (ib_status);\r
-}\r
-\r
-\r
-ib_api_status_t \r
-dapls_modify_qp_state_to_init (\r
- IN ib_qp_handle_t qp_handle,\r
- IN DAT_EP_ATTR *p_attr,\r
- IN dapl_ibal_port_t *p_port )\r
-{\r
- ib_qp_mod_t qp_mod;\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM_INIT: QP state change\n");\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- qp_mod.req_state = IB_QPS_INIT;\r
- qp_mod.state.init.primary_port = p_port->p_attr->port_num;\r
- qp_mod.state.init.qkey = DAPL_IBAL_QKEY;\r
- qp_mod.state.init.pkey_index = 0;\r
- qp_mod.state.init.access_ctrl = \r
- IB_AC_LOCAL_WRITE|IB_AC_RDMA_WRITE|IB_AC_MW_BIND;\r
- if ((p_attr->max_rdma_read_in > 0) ||\r
- (p_attr->max_rdma_read_out > 0))\r
- {\r
- qp_mod.state.init.access_ctrl |= IB_AC_RDMA_READ;\r
- }\r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
-\r
- return (ib_status);\r
-}\r
-\r
-ib_api_status_t \r
-dapls_modify_qp_state_to_rtr (\r
- ib_qp_handle_t qp_handle,\r
- ib_net32_t dest_qp,\r
- ib_lid_t dest_lid,\r
- dapl_ibal_port_t *p_port)\r
-{\r
- ib_qp_mod_t qp_mod;\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM_RTR: QP state change\n");\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- qp_mod.req_state = IB_QPS_RTR;\r
- qp_mod.state.rtr.rq_psn = DAPL_IBAL_START_PSN;\r
- qp_mod.state.rtr.dest_qp = dest_qp;\r
- qp_mod.state.rtr.resp_res = 4; // in-flight RDMAs\r
- qp_mod.state.rtr.rnr_nak_timeout = IB_RNR_NAK_TIMEOUT;\r
- qp_mod.state.rtr.primary_av.sl = 0;\r
- qp_mod.state.rtr.primary_av.dlid = dest_lid;\r
- qp_mod.state.rtr.primary_av.port_num = p_port->p_attr->port_num;\r
- qp_mod.state.rtr.primary_av.grh_valid = 0; /* FALSE */\r
- qp_mod.state.rtr.primary_av.path_bits = 0;\r
- qp_mod.state.rtr.primary_av.static_rate = IB_PATH_RECORD_RATE_10_GBS;\r
- qp_mod.state.rtr.primary_av.conn.path_mtu = p_port->p_attr->mtu;\r
- qp_mod.state.rtr.primary_av.conn.rnr_retry_cnt = IB_RNR_RETRY_CNT;\r
- qp_mod.state.rtr.primary_av.conn.local_ack_timeout = 7;\r
- qp_mod.state.rtr.primary_av.conn.seq_err_retry_cnt = 7;\r
- \r
- qp_mod.state.rtr.opts = IB_MOD_QP_PRIMARY_AV | IB_MOD_QP_RESP_RES;\r
- \r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
- \r
- return (ib_status);\r
-}\r
-\r
-ib_api_status_t \r
-dapls_modify_qp_state_to_rts (\r
- ib_qp_handle_t qp_handle )\r
-{\r
- ib_qp_mod_t qp_mod;\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM_RTS: QP state change\n");\r
-\r
- dapl_os_memzero (&qp_mod, sizeof (ib_qp_mod_t));\r
-\r
- qp_mod.req_state = IB_QPS_RTS;\r
- qp_mod.state.rts.sq_psn = DAPL_IBAL_START_PSN;\r
- qp_mod.state.rts.retry_cnt = 7;\r
- /* see dapl_ibal_util.h for IB_RNR_XXX */\r
- qp_mod.state.rts.rnr_retry_cnt = IB_RNR_RETRY_CNT;\r
- qp_mod.state.rts.rnr_nak_timeout = IB_RNR_NAK_TIMEOUT;\r
- qp_mod.state.rts.local_ack_timeout = 7;\r
- qp_mod.state.rts.init_depth = 4; \r
-\r
- ib_status = ib_modify_qp (qp_handle, &qp_mod);\r
-\r
- return (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_reinit_ep\r
- *\r
- * Move the QP to INIT state again.\r
- *\r
- * Input:\r
- * ep_ptr DAPL_EP\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * void\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_reinit_ep (\r
- IN DAPL_EP *ep_ptr)\r
-{\r
- DAPL_IA *ia_ptr;\r
- ib_api_status_t ib_status;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_port_t *p_active_port;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIQM_REINIT: EP(%p) QP(%p) state change\n", \r
- ep_ptr, ep_ptr->qp_handle );\r
-\r
- if ( ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DsIRE: EP invalid state(%d)\n", ep_ptr->param.ep_state);\r
- return DAT_INVALID_STATE;\r
- }\r
-\r
- ia_ptr = ep_ptr->header.owner_ia;\r
-\r
- /* Re-create QP if cleaned up, alloc will return init state */\r
- if ( ep_ptr->qp_handle == IB_INVALID_HANDLE )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_EP,\r
- "--> DsIRE: !EP(%p)->qp_handle, re-create QP\n",ep_ptr);\r
- return ( dapls_ib_qp_alloc ( ia_ptr, ep_ptr, ep_ptr ) );\r
- }\r
-\r
- ib_status = dapls_modify_qp_state_to_reset ( ep_ptr->qp_handle);\r
-\r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DsIRE: failed to move qp to RESET status = %s\n", \r
- ib_get_err_str(ib_status));\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- ep_ptr->qp_state = IB_QPS_RESET;\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
- p_active_port = dapli_ibal_get_port ( p_ca, (uint8_t)ia_ptr->hca_ptr->port_num );\r
-\r
- if (NULL == p_active_port)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DsIRE: Port %d is not available = %d\n",\r
- ia_ptr->hca_ptr->port_num, __LINE__);\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- /* May fail if QP still RESET and in timewait, keep in reset state */\r
- ib_status = dapls_modify_qp_state_to_init ( ep_ptr->qp_handle,\r
- &ep_ptr->param.ep_attr,\r
- p_active_port);\r
- if ( ib_status != IB_SUCCESS )\r
- {\r
- ep_ptr->qp_state = IB_QPS_RESET;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> DsIRE: failed to move qp to INIT status = %s\n", \r
- ib_get_err_str(ib_status));\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- ep_ptr->qp_state = IB_QPS_INIT;\r
-\r
- return DAT_SUCCESS;\r
-\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_util.c\r
- *\r
- * PURPOSE: Utility routines for access to IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_lmr_util.h"\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_cookie.h"\r
-#include "dapl_ring_buffer_util.h"\r
-\r
-#ifndef NO_NAME_SERVICE\r
-#include "dapl_name_service.h"\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-#define DAPL_IBAL_MAX_CA 4\r
-#define DAT_ADAPTER_NAME "InfiniHost (Tavor)"\r
-#define DAT_VENDOR_NAME "Mellanox Technolgy Inc."\r
-\r
-/*\r
- * Root data structure for DAPL_IIBA.\r
- */\r
-dapl_ibal_root_t dapl_ibal_root;\r
-DAPL_HCA_NAME dapl_ibal_hca_name_array [DAPL_IBAL_MAX_CA] = \r
- {"IbalHca0", "IbalHca1", "IbalHca2", "IbalHca3"};\r
-ib_net64_t *gp_ibal_ca_guid_tbl = NULL;\r
-\r
-/*\r
- * DAT spec does not tie max_mtu_size with IB MTU\r
- *\r
-static ib_net32_t dapl_ibal_mtu_table[6] = {0, 256, 512, 1024, 2048, 4096};\r
- */\r
- \r
-int g_loopback_connection = 0;\r
-\r
-\r
-static cl_status_t\r
-dapli_init_root_ca_list(\r
- IN dapl_ibal_root_t *root )\r
-{\r
- cl_status_t status;\r
-\r
- cl_qlist_init (&root->ca_head);\r
- status = cl_spinlock_init (&root->ca_lock);\r
-\r
- if (status == CL_SUCCESS)\r
- {\r
- /*\r
- * Get the time ready to go but don't start here\r
- */\r
- root->shutdown = FALSE;\r
- root->initialized = TRUE;\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DiIRCL: cl_spinlock_init returned %d\n", status);\r
- root->initialized = FALSE;\r
- }\r
- \r
- root->h_al = NULL;\r
-\r
- return (status);\r
-}\r
-\r
-\r
-static cl_status_t\r
-dapli_destroy_root_ca_list(\r
- IN dapl_ibal_root_t *root )\r
-{\r
-\r
- root->initialized = FALSE;\r
-\r
- /* \r
- * At this point the lock should not be necessary\r
- */\r
- if (!cl_is_qlist_empty (&root->ca_head) )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> Destroying nonempty ca list (%s)\n",\r
- "DiDRCL");\r
- }\r
- cl_spinlock_destroy (&root->ca_lock);\r
-\r
- return CL_SUCCESS;\r
-}\r
-\r
-\r
-static void\r
-dapli_shutdown_port_access(\r
- IN dapl_ibal_ca_t *ca )\r
-{\r
- dapl_ibal_port_t *p_port;\r
-\r
- TAKE_LOCK( ca->port_lock );\r
- {\r
- while ( ! cl_is_qlist_empty( &ca->port_head ) )\r
- {\r
- p_port = (dapl_ibal_port_t *)cl_qlist_remove_head( &ca->port_head );\r
- RELEASE_LOCK( ca->port_lock );\r
- {\r
- REMOVE_REFERENCE( &p_port->refs );\r
- REMOVE_REFERENCE( &p_port->ca->refs );\r
-\r
- dapl_os_free (p_port, sizeof (dapl_ibal_port_t));\r
- }\r
- TAKE_LOCK( ca->port_lock );\r
- }\r
- }\r
- RELEASE_LOCK( ca->port_lock );\r
-}\r
-\r
-\r
-static void dapli_shutdown_ca_access (void)\r
-{\r
- dapl_ibal_ca_t *ca;\r
-\r
- if ( dapl_ibal_root.initialized == FALSE )\r
- {\r
- goto destroy_root;\r
- }\r
-\r
- TAKE_LOCK (dapl_ibal_root.ca_lock);\r
- {\r
- while ( ! cl_is_qlist_empty (&dapl_ibal_root.ca_head) )\r
- {\r
- ca = (dapl_ibal_ca_t *) cl_qlist_remove_head (&dapl_ibal_root.ca_head);\r
-\r
- if (ca->p_ca_attr)\r
- {\r
- dapl_os_free (ca->p_ca_attr, sizeof (ib_ca_attr_t));\r
- }\r
-\r
-\r
- RELEASE_LOCK (dapl_ibal_root.ca_lock);\r
- {\r
- dapli_shutdown_port_access (ca);\r
- REMOVE_REFERENCE (&ca->refs);\r
- }\r
- TAKE_LOCK (dapl_ibal_root.ca_lock);\r
- }\r
- }\r
- RELEASE_LOCK (dapl_ibal_root.ca_lock);\r
-\r
-destroy_root:\r
- /*\r
- * Destroy the root CA list and list lock\r
- */\r
- dapli_destroy_root_ca_list (&dapl_ibal_root);\r
-\r
- /*\r
- * Signal we're all done and wake any waiter\r
- */\r
- dapl_ibal_root.shutdown = FALSE;\r
-}\r
-\r
-\r
-dapl_ibal_evd_cb_t *\r
-dapli_find_evd_cb_by_context(\r
- IN void *context,\r
- IN dapl_ibal_ca_t *ca)\r
-{\r
- dapl_ibal_evd_cb_t *evd_cb = NULL;\r
-\r
- TAKE_LOCK( ca->evd_cb_lock );\r
-\r
- evd_cb = (dapl_ibal_evd_cb_t *) cl_qlist_head( &ca->evd_cb_head );\r
- while ( &evd_cb->next != cl_qlist_end( &ca->evd_cb_head ) )\r
- {\r
- if ( context == evd_cb->context)\r
- {\r
- goto found;\r
- }\r
-\r
- /*\r
- * Try again\r
- */\r
- evd_cb = (dapl_ibal_evd_cb_t *) cl_qlist_next( &evd_cb->next );\r
- }\r
- /*\r
- * No joy\r
- */\r
- evd_cb = NULL;\r
-\r
-found:\r
-\r
- RELEASE_LOCK( ca->evd_cb_lock );\r
-\r
- return ( evd_cb );\r
-}\r
-\r
-\r
-static cl_status_t\r
-dapli_init_ca_evd_cb_list(\r
- IN dapl_ibal_ca_t *ca )\r
-{\r
- cl_status_t status;\r
-\r
- cl_qlist_init( &ca->evd_cb_head );\r
- status = cl_spinlock_init( &ca->evd_cb_lock );\r
- if ( status != CL_SUCCESS )\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DiICECL: cl_spinlock_init returned %d\n", status);\r
- return ( status );\r
-}\r
-\r
-\r
-static cl_status_t\r
-dapli_init_ca_port_list(\r
- IN dapl_ibal_ca_t *ca )\r
-{\r
- cl_status_t status;\r
-\r
- cl_qlist_init( &ca->port_head );\r
- status = cl_spinlock_init( &ca->port_lock );\r
- if ( status != CL_SUCCESS )\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DiICPL: cl_spinlock_init returned %d\n", status);\r
- return ( status );\r
-}\r
-\r
-dapl_ibal_port_t *\r
-dapli_ibal_get_port (\r
- IN dapl_ibal_ca_t *p_ca,\r
- IN uint8_t port_num)\r
-{\r
- cl_list_item_t *p_active_port = NULL;\r
- \r
- TAKE_LOCK (p_ca->port_lock);\r
- for ( p_active_port = cl_qlist_head( &p_ca->port_head );\r
- p_active_port != cl_qlist_end ( &p_ca->port_head);\r
- p_active_port = cl_qlist_next ( p_active_port ) )\r
- {\r
- if (((dapl_ibal_port_t *)p_active_port)->p_attr->port_num == port_num)\r
- break; \r
- }\r
- RELEASE_LOCK (p_ca->port_lock);\r
-\r
- return (dapl_ibal_port_t *)p_active_port;\r
-}\r
-\r
-static void\r
-dapli_ibal_cq_async_error_callback(\r
- IN ib_async_event_rec_t* p_err_rec )\r
-{\r
- DAPL_EVD *evd_ptr = (DAPL_EVD*)((void *)p_err_rec->context);\r
- DAPL_EVD *async_evd_ptr;\r
- DAPL_IA *ia_ptr;\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_evd_cb_t *evd_cb;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: CQ error %d for EVD context %p\n", \r
- p_err_rec->code, p_err_rec->context);\r
-\r
- if (DAPL_BAD_HANDLE (evd_ptr, DAPL_MAGIC_EVD))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: invalid EVD %p \n", evd_ptr);\r
- return;\r
- }\r
- \r
- ia_ptr = evd_ptr->header.owner_ia;\r
- async_evd_ptr = ia_ptr->async_error_evd;\r
- if (async_evd_ptr == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: can't find async_error_evd on %s HCA\n", \r
- (ia_ptr->header.provider)->device_name );\r
- return;\r
- }\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: can't find %s HCA\n", \r
- (ia_ptr->header.provider)->device_name);\r
- return;\r
- }\r
-\r
- /* find CQ error callback using ia_ptr for context */\r
- evd_cb = dapli_find_evd_cb_by_context ( async_evd_ptr, p_ca );\r
- if ((evd_cb == NULL) || (evd_cb->pfn_async_cq_err_cb == NULL))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: no ERROR cb on %p found \n", p_ca);\r
- return;\r
- }\r
-\r
- /* maps to dapl_evd_cq_async_error_callback(), context is EVD */\r
- evd_cb->pfn_async_cq_err_cb( (ib_hca_handle_t)p_ca, \r
- (ib_error_record_t*)&p_err_rec->code, evd_ptr);\r
-\r
-}\r
-\r
-void\r
-dapli_ibal_ca_async_error_callback(\r
- IN ib_async_event_rec_t* p_err_rec )\r
-{\r
- dapl_ibal_ca_t *p_ca = (dapl_ibal_ca_t*)((void *)p_err_rec->context);\r
- dapl_ibal_evd_cb_t *evd_cb;\r
- DAPL_IA *ia_ptr;\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCaAEC: CA error %d for context %p\n", \r
- p_err_rec->code, p_err_rec->context);\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCaAEC: invalid p_ca(%p)in async event rec\n",p_ca);\r
- return;\r
- }\r
- \r
- ia_ptr = (DAPL_IA*)p_ca->ia_ptr;\r
- if (ia_ptr == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCaAEC: invalid ia_ptr in %p ca \n", p_ca );\r
- return;\r
- }\r
-\r
- if (ia_ptr->async_error_evd == NULL)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCqAEC: can't find async_error_evd on %s HCA\n", \r
- (ia_ptr->header.provider)->device_name );\r
- return;\r
- }\r
-\r
- /* find QP error callback using p_ca for context */\r
- evd_cb = dapli_find_evd_cb_by_context (ia_ptr->async_error_evd, p_ca);\r
- if ((evd_cb == NULL) || (evd_cb->pfn_async_err_cb == NULL))\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"--> DiCaAEC: no ERROR cb on %p found \n", p_ca);\r
- return;\r
- }\r
-\r
- /* maps to dapl_evd_un_async_error_callback(), context is async_evd */\r
- evd_cb->pfn_async_err_cb( (ib_hca_handle_t)p_ca, \r
- (ib_error_record_t*)&p_err_rec->code, \r
- ia_ptr->async_error_evd);\r
-\r
-}\r
-\r
-\r
-static dapl_ibal_port_t *\r
-dapli_alloc_port(\r
- IN dapl_ibal_ca_t *ca,\r
- IN ib_port_attr_t *ib_port )\r
-{\r
- dapl_ibal_port_t *p_port = NULL;\r
- if (ca->h_ca == NULL )\r
- {\r
- return NULL;\r
- }\r
- /*\r
- * Allocate the port structure memory. This will also deal with the\r
- * copying ib_port_attr_t including GID and P_Key tables\r
- */\r
- p_port = dapl_os_alloc ( sizeof(dapl_ibal_port_t ) );\r
-\r
- if ( p_port )\r
- {\r
- dapl_os_memzero (p_port, sizeof(dapl_ibal_port_t ) );\r
-\r
- /*\r
- * We're good to go after initializing reference.\r
- */\r
- INIT_REFERENCE( &p_port->refs, 1, p_port, NULL /* pfn_destructor */ );\r
- \r
- p_port->p_attr = ib_port;\r
- }\r
- return ( p_port );\r
-}\r
-\r
-static void\r
-dapli_add_active_port( IN dapl_ibal_ca_t *ca)\r
-{\r
- dapl_ibal_port_t *p_port;\r
- ib_port_attr_t *p_port_attr;\r
- ib_ca_attr_t *p_ca_attr;\r
- int i;\r
-\r
- p_ca_attr = ca->p_ca_attr;\r
-\r
- dapl_os_assert (p_ca_attr != NULL);\r
-\r
- for (i = 0; i < p_ca_attr->num_ports; i++)\r
- {\r
- p_port_attr = &p_ca_attr->p_port_attr[i];\r
-\r
- {\r
- p_port = dapli_alloc_port( ca, p_port_attr );\r
- if ( p_port )\r
- {\r
- TAKE_REFERENCE (&ca->refs);\r
-\r
- /*\r
- * Record / update attribues\r
- */\r
- p_port->p_attr = p_port_attr;\r
-\r
- /*\r
- * Remember the parant CA keeping the reference we took above\r
- */\r
- p_port->ca = ca;\r
-\r
- /*\r
- * We're good to go - Add the new port to the list on the CA\r
- */\r
- LOCK_INSERT_TAIL( ca->port_lock, ca->port_head, p_port->next );\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: Could not allocate "\r
- "dapl_ibal_port_t\n", "DiAAP");\r
- }\r
- }\r
- dapl_dbg_log( DAPL_DBG_TYPE_UTIL, "--> DiAAP: Port %d logical link is %s lid = %#x\n",\r
- p_port_attr->port_num,\r
- ( p_port_attr->link_state != IB_LINK_ACTIVE ? "DOWN": "UP" ),\r
- CL_HTON16(p_port_attr->lid) );\r
-\r
- } /* for loop */\r
-\r
- return;\r
-}\r
-\r
-static dapl_ibal_ca_t *\r
-dapli_alloc_ca(\r
- IN ib_al_handle_t h_al,\r
- IN ib_net64_t ca_guid)\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
- ib_api_status_t status;\r
- uint32_t attr_size;\r
-\r
- /*\r
- * Allocate the CA structure\r
- */\r
- p_ca = dapl_os_alloc( sizeof(dapl_ibal_ca_t) );\r
- dapl_os_memzero (p_ca, sizeof(dapl_ibal_ca_t) );\r
-\r
- if ( p_ca )\r
- {\r
- /*\r
- * Now we pass dapli_ibal_ca_async_error_callback as the \r
- * async error callback\r
- */\r
- status = ib_open_ca( h_al,\r
- ca_guid,\r
- dapli_ibal_ca_async_error_callback,\r
- p_ca,\r
- &p_ca->h_ca );\r
- if ( status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DiAC: ib_open_ca returned %d\n", status);\r
- dapl_os_free (p_ca, sizeof (dapl_ibal_ca_t));\r
- return (NULL);\r
- }\r
-\r
- /*\r
- * Get port list lock and list head initialized\r
- */\r
- if (( dapli_init_ca_port_list( p_ca ) != CL_SUCCESS ) ||\r
- ( dapli_init_ca_evd_cb_list( p_ca ) != CL_SUCCESS ))\r
- { \r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: dapli_init_ca_port_list returned failed\n",\r
- "DiAC");\r
- goto close_and_free_ca;\r
- }\r
-\r
- attr_size = 0;\r
- status = ib_query_ca (p_ca->h_ca, NULL, &attr_size);\r
- if (status != IB_INSUFFICIENT_MEMORY)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> DiAC: ib_query_ca returned failed status = %d\n", \r
- status);\r
- goto close_and_free_ca;\r
- }\r
-\r
- p_ca->p_ca_attr = dapl_os_alloc ((int)attr_size);\r
- if (p_ca->p_ca_attr == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> %s: dapli_alloc_ca failed to alloc memory\n",\r
- "DiAC");\r
- goto close_and_free_ca;\r
- }\r
-\r
- status = ib_query_ca (\r
- p_ca->h_ca,\r
- p_ca->p_ca_attr,\r
- &attr_size);\r
- if (status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> ib_query_ca returned failed status = %d\n",\r
- status);\r
- dapl_os_free (p_ca->p_ca_attr, (int)attr_size);\r
- goto close_and_free_ca;\r
- }\r
- \r
- p_ca->ca_attr_size = attr_size;\r
-\r
- INIT_REFERENCE( &p_ca->refs, 1, p_ca, NULL /* pfn_destructor */ );\r
-\r
- dapli_add_active_port (p_ca);\r
-\r
- /*\r
- * We're good to go\r
- */\r
- return ( p_ca );\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: Error allocating CA structure\n","DiAC");\r
- return ( NULL );\r
- }\r
-\r
-close_and_free_ca:\r
- /*\r
- * Close the CA.\r
- */\r
- (void) ib_close_ca ( p_ca->h_ca, NULL /* callback */);\r
- dapl_os_free (p_ca, sizeof (dapl_ibal_ca_t));\r
-\r
- /*\r
- * If we get here, there was an initialization failure\r
- */\r
- return ( NULL );\r
-}\r
-\r
-\r
-static dapl_ibal_ca_t *\r
-dapli_add_ca(\r
- IN ib_al_handle_t h_al,\r
- IN ib_net64_t ca_guid)\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
-\r
- /*\r
- * Allocate a CA structure\r
- */\r
- p_ca = dapli_alloc_ca( h_al, ca_guid );\r
- if ( p_ca )\r
- {\r
- /*\r
- * Add the new CA to the list\r
- */\r
- LOCK_INSERT_TAIL( dapl_ibal_root.ca_lock, \r
- dapl_ibal_root.ca_head, p_ca->next );\r
- }\r
- else\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: Could not allocate dapl_ibal_ca_t \n","DiAA");\r
- }\r
-\r
- return ( p_ca );\r
-}\r
-\r
-\r
-int32_t dapls_ib_init (void)\r
-{\r
- ib_api_status_t status;\r
-\r
- /*\r
- * Initialize the root structure\r
- */\r
- if (dapli_init_root_ca_list (&dapl_ibal_root) == CL_SUCCESS)\r
- {\r
- /*\r
- * Register with the access layer\r
- */\r
- status = ib_open_al (&dapl_ibal_root.h_al);\r
-\r
- if (status == IB_SUCCESS)\r
- {\r
- intn_t guid_count;\r
-\r
- status = ib_get_ca_guids (dapl_ibal_root.h_al, NULL, &(size_t)guid_count);\r
- if (status != IB_INSUFFICIENT_MEMORY)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsII: ib_get_ca_guids failed = %d\n", status);\r
- return -1;\r
- }\r
-\r
- if (guid_count == 0)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: found NO HCA in the system\n",\r
- "DsII");\r
- return -1;\r
- }\r
-\r
- if (guid_count > DAPL_IBAL_MAX_CA)\r
- {\r
- guid_count = DAPL_IBAL_MAX_CA;\r
- }\r
-\r
- gp_ibal_ca_guid_tbl = ( ib_net64_t*)dapl_os_alloc ((int)(guid_count * \r
- sizeof (ib_net64_t)) );\r
-\r
- if (gp_ibal_ca_guid_tbl == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: can not alloc gp_ibal_ca_guid_tbl\n",\r
- "DsII");\r
- \r
- return -1;\r
- }\r
-\r
- status = ib_get_ca_guids ( dapl_ibal_root.h_al, \r
- gp_ibal_ca_guid_tbl, \r
- &(size_t)guid_count );\r
- \r
-\r
- if ( status != IB_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsII: ib_get_ca_guids failed = %s\n", \r
- ib_get_err_str(status) );\r
- return -1;\r
- }\r
-\r
- dapl_dbg_log ( DAPL_DBG_TYPE_UTIL, \r
- "--> DsII: Success open AL & found %d HCA avail\n",\r
- guid_count);\r
- return 0;\r
- }\r
- else\r
- { \r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsII: ib_open_al returned %s\n", ib_get_err_str(status));\r
- /*\r
- * Undo CA list\r
- */\r
- dapli_destroy_root_ca_list (&dapl_ibal_root);\r
- }\r
- }\r
- return -1;\r
-}\r
-\r
-\r
-int32_t dapls_ib_release (void)\r
-{\r
- dapl_ibal_root.shutdown = TRUE;\r
-\r
- dapli_shutdown_ca_access();\r
-\r
- /*\r
- * If shutdown not complete, wait for it\r
- */\r
- if (dapl_ibal_root.shutdown)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIR: timeout waiting for completion\n");\r
- }\r
-\r
- if ( dapl_ibal_root.h_al != NULL )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIR: ib_close_al called\n");\r
- ib_close_al (dapl_ibal_root.h_al);\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIR: ib_close_al return\n");\r
- dapl_ibal_root.h_al = NULL;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_enum_hcas\r
- *\r
- * Enumerate all HCAs on the system\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * hca_names Array of hca names\r
- * total_hca_count \r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_enum_hcas (\r
- OUT DAPL_HCA_NAME **hca_names,\r
- OUT DAT_COUNT *total_hca_count,\r
- IN const char *vendor )\r
-{\r
- intn_t guid_count;\r
- ib_api_status_t ib_status;\r
- UNREFERENCED_PARAMETER(vendor);\r
-\r
- ib_status = ib_get_ca_guids (dapl_ibal_root.h_al, NULL, &(size_t)guid_count);\r
- if (ib_status != IB_INSUFFICIENT_MEMORY)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIEH: ib_get_ca_guids failed status = %d\n", ib_status);\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- if (guid_count == 0)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: ib_get_ca_guids no HCA in the system\n",\r
- "DsIEH");\r
- return (DAT_PROVIDER_NOT_FOUND);\r
- }\r
-\r
- if (guid_count > DAPL_IBAL_MAX_CA)\r
- {\r
- guid_count = DAPL_IBAL_MAX_CA;\r
- }\r
-\r
- gp_ibal_ca_guid_tbl = (ib_net64_t *)dapl_os_alloc ((int)(guid_count * sizeof (ib_net64_t)) );\r
-\r
- if (gp_ibal_ca_guid_tbl == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: can not alloc resources @line%d\n",\r
- "DsIEH", __LINE__);\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- ib_status = ib_get_ca_guids (\r
- dapl_ibal_root.h_al, gp_ibal_ca_guid_tbl, &(size_t)guid_count);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIEH: ib_get_ca_guids failed status = %s\n", \r
- ib_get_err_str(ib_status));\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- *hca_names = (DAPL_HCA_NAME*)dapl_os_alloc ((int)(guid_count * sizeof (DAPL_HCA_NAME)) );\r
-\r
- if (*hca_names == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: can not alloc resources @line%d\n",\r
- "DsIEH", __LINE__);\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- dapl_os_memcpy (*hca_names, \r
- dapl_ibal_hca_name_array, \r
- (int)(guid_count * sizeof (DAPL_HCA_NAME)) );\r
-\r
- *total_hca_count = (DAT_COUNT)guid_count;\r
-\r
- {\r
- int i;\r
-\r
- for (i = 0; i < guid_count; i++)\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIEH: %d) hca_names = %s\n", \r
- i, dapl_ibal_hca_name_array[i]);\r
- }\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-\r
-IB_HCA_NAME\r
-dapl_ib_convert_name(\r
- IN char *name)\r
-{\r
- int i;\r
-\r
- if (gp_ibal_ca_guid_tbl == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DICN: found no HCA with name %s\n", name);\r
- return 0;\r
- }\r
-\r
- for (i = 0; i < DAPL_IBAL_MAX_CA; i++)\r
- {\r
- if (strcmp (name, dapl_ibal_hca_name_array[i]) == 0)\r
- {\r
- break;\r
- }\r
- }\r
-\r
- if (i >= DAPL_IBAL_MAX_CA)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DICN: can't find any HCA with name %s\n", name);\r
- return 0;\r
- }\r
- \r
- return (gp_ibal_ca_guid_tbl[i]); \r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_open_hca\r
- *\r
- * Open HCA\r
- *\r
- * Input:\r
- * *hca_name pointer to provider device name\r
- * *ib_hca_handle_p pointer to provide HCA handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Return:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN dapls_ib_open_hca (\r
- IN IB_HCA_NAME hca_name,\r
- OUT ib_hca_handle_t *p_ib_hca_handle)\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
-\r
- if (gp_ibal_ca_guid_tbl == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIOH: found no HCA with ca_guid" F64x "\n", hca_name);\r
- return (DAT_PROVIDER_NOT_FOUND);\r
- }\r
-\r
- p_ca = dapli_add_ca (dapl_ibal_root.h_al, hca_name);\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIOH: can not create ca with ca_guid" F64x "\n", hca_name);\r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
-\r
- *p_ib_hca_handle = (ib_hca_handle_t) p_ca;\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_close_hca\r
- *\r
- * Open HCA\r
- *\r
- * Input:\r
- * ib_hca_handle provide HCA handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Return:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN dapls_ib_close_hca (\r
- IN ib_hca_handle_t ib_hca_handle)\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
- \r
- p_ca = (dapl_ibal_ca_t *) ib_hca_handle;\r
- \r
- /*\r
- * Remove it from the list\r
- */\r
- TAKE_LOCK (dapl_ibal_root.ca_lock);\r
- {\r
- cl_qlist_remove_item (&dapl_ibal_root.ca_head, &p_ca->next);\r
- }\r
- RELEASE_LOCK (dapl_ibal_root.ca_lock);\r
-\r
- dapli_shutdown_port_access (p_ca);\r
- \r
- /*\r
- * Remove the constructor reference\r
- */\r
- REMOVE_REFERENCE (&p_ca->refs);\r
-\r
- cl_spinlock_destroy (&p_ca->port_lock);\r
- cl_spinlock_destroy (&p_ca->evd_cb_lock);\r
-\r
- if (p_ca->p_ca_attr)\r
- dapl_os_free (p_ca->p_ca_attr, sizeof (ib_ca_attr_t));\r
-\r
- (void) ib_close_ca (p_ca->h_ca, NULL /* close_callback */);\r
-\r
- dapl_os_free (p_ca, sizeof (dapl_ibal_ca_t));\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-/*\r
- * dapli_ibal_cq_competion_callback\r
- *\r
- * Completion callback for a CQ\r
- *\r
- * Input:\r
- * cq_context User context\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- */\r
-static void\r
-dapli_ib_cq_completion_cb (\r
- IN const ib_cq_handle_t h_cq,\r
- IN void *cq_context )\r
-{\r
- DAPL_EVD *evd_ptr;\r
- dapl_ibal_ca_t *p_ca;\r
-\r
- evd_ptr = (DAPL_EVD *) cq_context;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_CALLBACK, \r
- "--> DiICCC: cq_completion_cb evd %p CQ %p\n", \r
- evd_ptr, evd_ptr->ib_cq_handle);\r
-\r
- dapl_os_assert (evd_ptr != DAT_HANDLE_NULL);\r
-\r
- p_ca = (dapl_ibal_ca_t *) evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle;\r
-\r
- dapl_os_assert( h_cq == evd_ptr->ib_cq_handle );\r
-\r
- dapl_evd_dto_callback (\r
- (ib_hca_handle_t) p_ca,\r
- h_cq,\r
- cq_context);\r
- return;\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_cq_late_alloc\r
- *\r
- * Alloc a CQ\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * evd_ptr pointer to EVD struct\r
- * cqlen minimum QLen\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_cq_late_alloc (\r
- IN ib_pd_handle_t pd_handle,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- ib_cq_create_t cq_create;\r
- ib_api_status_t ib_status;\r
- DAT_RETURN dat_status;\r
- dapl_ibal_ca_t *ibal_ca = (dapl_ibal_ca_t *)evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle;\r
- \r
- dat_status = DAT_SUCCESS;\r
- cq_create.size = evd_ptr->qlen;\r
- \r
- \r
- if (evd_ptr->cq_wait_obj_handle)\r
- {\r
- cq_create.h_wait_obj = evd_ptr->cq_wait_obj_handle;\r
- cq_create.pfn_comp_cb = NULL;\r
- }\r
- else \r
- {\r
- cq_create.h_wait_obj = NULL;\r
- cq_create.pfn_comp_cb = dapli_ib_cq_completion_cb;\r
- }\r
-\r
- ib_status = ib_create_cq (\r
- (ib_ca_handle_t)ibal_ca->h_ca,\r
- &cq_create,\r
- evd_ptr /* context */,\r
- dapli_ibal_cq_async_error_callback,\r
- &evd_ptr->ib_cq_handle);\r
-\r
- dat_status = dapl_ib_status_convert (ib_status);\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsICLA: failed to create CQ for EVD %p\n", evd_ptr);\r
- goto bail;\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsCQ_alloc: pd=%p cq=%p Csz=%d Qln=%d \n",\r
- pd_handle, evd_ptr->ib_cq_handle,\r
- cq_create.size, evd_ptr->qlen );\r
-\r
-\r
- if ( cq_create.size > (uint32_t)evd_ptr->qlen )\r
- {\r
- DAT_COUNT pending_cnt, free_cnt;\r
- DAT_EVENT *event_ptr;\r
- DAT_COUNT i;\r
-\r
- dapl_os_lock ( &evd_ptr->header.lock );\r
-\r
- pending_cnt = dapls_rbuf_count ( &evd_ptr->pending_event_queue );\r
- free_cnt = dapls_rbuf_count ( &evd_ptr->free_event_queue );\r
- \r
- if ( pending_cnt == 0 ) \r
- {\r
- dat_status = dapls_rbuf_realloc ( &evd_ptr->pending_event_queue,\r
- cq_create.size );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsICLA: failed to resize EVD pending_event_queue" \r
- "from %d to %d\n",\r
- evd_ptr->qlen, cq_create.size );\r
- dat_status = DAT_SUCCESS;\r
- }\r
-\r
- }\r
-\r
-\r
- for (i = 0; i < free_cnt; i++)\r
- {\r
- event_ptr = (DAT_EVENT *)\r
- dapls_rbuf_remove ( &evd_ptr->free_event_queue );\r
- }\r
-\r
- dat_status = dapls_rbuf_realloc ( &evd_ptr->free_event_queue,\r
- cq_create.size );\r
-\r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsICLA: failed to resize EVD free_event_queue" \r
- "from %d to %d\n",\r
- evd_ptr->qlen, cq_create.size );\r
-\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- dapls_ib_cq_free ( evd_ptr->header.owner_ia, evd_ptr);\r
-\r
- goto bail;\r
- }\r
-\r
- if (evd_ptr->events)\r
- {\r
- evd_ptr->events = (void *)\r
- dapl_os_realloc ( \r
- evd_ptr->events, \r
- cq_create.size * sizeof (DAT_EVENT));\r
- }\r
- else\r
- {\r
- evd_ptr->events = (void *)\r
- dapl_os_alloc ( \r
- cq_create.size * sizeof (DAT_EVENT));\r
- }\r
-\r
- if ( evd_ptr->events == NULL )\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsICLA: failed to resize EVD events buffers" \r
- "from %d to %d\n",\r
- evd_ptr->qlen, cq_create.size );\r
- dat_status = DAT_INSUFFICIENT_RESOURCES;\r
-\r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- dapls_ib_cq_free ( evd_ptr->header.owner_ia, evd_ptr);\r
-\r
- goto bail;\r
- }\r
- \r
- event_ptr = evd_ptr->events;\r
- \r
- /* add events to free event queue */\r
- for (i = 0; (uint32_t)i < cq_create.size; i++)\r
- {\r
- dapls_rbuf_add (&evd_ptr->free_event_queue, (void *)event_ptr);\r
- event_ptr++;\r
- }\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD, \r
- "--> DsICLA: resize EVD events buffers from %d to %d\n", \r
- evd_ptr->qlen, cq_create.size);\r
-\r
- evd_ptr->qlen = cq_create.size;\r
- \r
- dapl_os_unlock ( &evd_ptr->header.lock );\r
-\r
- }\r
- \r
-bail: \r
- return dat_status;\r
-}\r
-\r
-/*\r
- * dapl_ib_cq_free\r
- *\r
- * Dealloc a CQ\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * evd_ptr pointer to EVD struct\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_cq_free (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- ib_api_status_t ib_status;\r
- \r
- if ( ia_ptr == NULL || ia_ptr->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
-\r
- ib_status = ib_destroy_cq (evd_ptr->ib_cq_handle, \r
- /* destroy_callback */ NULL);\r
- \r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-/*\r
- * dapls_cq_resize\r
- *\r
- * Resize CQ completion notifications\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * evd_ptr pointer to EVD struct\r
- * cqlen minimum QLen \r
- *\r
- * Output:\r
- * cqlen may round up for optimal memory boundaries \r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-\r
-DAT_RETURN\r
-dapls_ib_cq_resize (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr,\r
- IN DAT_COUNT *cqlen )\r
-{\r
- ib_api_status_t ib_status = IB_SUCCESS;\r
- if ( ia_ptr == NULL || ia_ptr->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- /* \r
- * Resize CQ only if CQ handle is valid, may be delayed waiting\r
- * for PZ allocation with IBAL \r
- */\r
-#if defined(_VENDOR_IBAL_)\r
- if ( evd_ptr->ib_cq_handle != IB_INVALID_HANDLE ) \r
-#endif /* _VENDOR_IBAL_ */\r
- {\r
- ib_status = ib_modify_cq ( evd_ptr->ib_cq_handle, \r
- (uint32_t *)cqlen );\r
- dapl_dbg_log (DAPL_DBG_TYPE_EVD,\r
- "ib_modify_cq ( new cqlen = %d, status=%d ) \n",\r
- *cqlen, ib_status );\r
- } \r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapl_set_cq_notify\r
- *\r
- * Set up CQ completion notifications\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * evd_ptr pointer to EVD struct\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_set_cq_notify (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_EVD *evd_ptr)\r
-{\r
- ib_api_status_t ib_status;\r
- if ( ia_ptr == NULL || ia_ptr->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- ib_status = ib_rearm_cq ( \r
- evd_ptr->ib_cq_handle,\r
- FALSE /* next event but not solicited event */ );\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_cqd_create\r
- *\r
- * Set up CQ notification event thread\r
- *\r
- * Input:\r
- * ia_handle HCA handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_cqd_create (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- /*\r
- * We do not have CQD concept\r
- */\r
- hca_ptr->ib_cqd_handle = IB_INVALID_HANDLE;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapl_cqd_destroy\r
- *\r
- * Destroy CQ notification event thread\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_HANDLE\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_cqd_destroy (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- hca_ptr->ib_cqd_handle = IB_INVALID_HANDLE;\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_pd_alloc\r
- *\r
- * Alloc a PD\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * PZ_ptr pointer to PZEVD struct\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_pd_alloc (\r
- IN DAPL_IA *ia,\r
- IN DAPL_PZ *pz)\r
-{\r
- ib_api_status_t ib_status;\r
- dapl_ibal_ca_t *p_ca;\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia->hca_ptr->ib_hca_handle;\r
- ib_status = ib_alloc_pd (\r
- p_ca->h_ca,\r
- IB_PDT_NORMAL,\r
- ia,\r
- &pz->pd_handle);\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_pd_free\r
- *\r
- * Free a PD\r
- *\r
- * Input:\r
- * PZ_ptr pointer to PZ struct\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_pd_free (\r
- IN DAPL_PZ *pz)\r
-{\r
- ib_api_status_t ib_status;\r
-\r
- ib_status = ib_dealloc_pd (pz->pd_handle, /* destroy_callback */ NULL);\r
-\r
- pz->pd_handle = IB_INVALID_HANDLE;\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_mr_register\r
- *\r
- * Register a virtual memory region\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * lmr pointer to dapl_lmr struct\r
- * virt_addr virtual address of beginning of mem region\r
- * length length of memory region\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mr_register (\r
- IN DAPL_IA *ia,\r
- IN DAPL_LMR *lmr,\r
- IN DAT_PVOID virt_addr,\r
- IN DAT_VLEN length,\r
- IN DAT_MEM_PRIV_FLAGS privileges)\r
-{\r
- ib_api_status_t ib_status;\r
- ib_mr_handle_t mr_handle;\r
- ib_mr_create_t mr_create;\r
- uint32_t l_key, r_key; \r
-\r
- if ( ia == NULL || ia->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- mr_create.vaddr = (void *) virt_addr;\r
- mr_create.length = (size_t)length;\r
- mr_create.access_ctrl = dapl_lmr_convert_privileges (privileges);\r
- mr_create.access_ctrl |= IB_AC_MW_BIND;\r
- \r
- if (lmr->param.mem_type == DAT_MEM_TYPE_SHARED_VIRTUAL)\r
- {\r
- ib_status = ib_reg_shmid (\r
- ((DAPL_PZ *)lmr->param.pz_handle)->pd_handle,\r
- (const uint8_t*)&lmr->ib_shmid,\r
- &mr_create,\r
- (uint64_t *)&virt_addr,\r
- &l_key,\r
- &r_key,\r
- &mr_handle);\r
- }\r
- else \r
- {\r
- ib_status = ib_reg_mem (\r
- ((DAPL_PZ *)lmr->param.pz_handle)->pd_handle,\r
- &mr_create,\r
- &l_key,\r
- &r_key,\r
- &mr_handle);\r
- }\r
- \r
- if (ib_status != IB_SUCCESS)\r
- {\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
- \r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "--> DsIMR: lmr (%p) lkey 0x%x r_key %#x "\r
- "mr_handle %p vaddr 0x%LX len 0x%LX\n", \r
- lmr, l_key, r_key, mr_handle, virt_addr, length);\r
-\r
- lmr->param.lmr_context = l_key;\r
- lmr->param.rmr_context = r_key;\r
- lmr->param.registered_size = length;\r
-#ifndef _WIN64\r
- // Fix MS compiler warning C4826: Conversion from 'DAT_PVOID' to 'DAT_VADDR'\r
- // is sign-extended. This may cause unexpected runtime behavior.\r
- lmr->param.registered_address = (DAT_VADDR) (DAT_UINT32) virt_addr;\r
-#else\r
- lmr->param.registered_address = (DAT_VADDR)virt_addr;\r
-#endif\r
- lmr->mr_handle = mr_handle;\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_mr_deregister\r
- *\r
- * Free a memory region\r
- *\r
- * Input:\r
- * lmr pointer to dapl_lmr struct\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mr_deregister (\r
- IN DAPL_LMR *lmr)\r
-{\r
- ib_api_status_t ib_status;\r
-\r
- ib_status = ib_dereg_mr (lmr->mr_handle);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- lmr->param.lmr_context = 0;\r
- lmr->mr_handle = IB_INVALID_HANDLE;\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapl_ib_mr_register_shared\r
- *\r
- * Register a virtual memory region\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * lmr pointer to dapl_lmr struct\r
- * virt_addr virtual address of beginning of mem region\r
- * length length of memory region\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mr_register_shared (\r
- IN DAPL_IA *ia,\r
- IN DAPL_LMR *lmr,\r
- IN DAT_MEM_PRIV_FLAGS privileges)\r
-{\r
- DAT_VADDR virt_addr;\r
- ib_mr_handle_t mr_handle;\r
- ib_api_status_t ib_status;\r
- ib_mr_handle_t new_mr_handle;\r
- ib_access_t access_ctrl;\r
- uint32_t l_key, r_key; \r
- ib_mr_create_t mr_create;\r
- if ( ia == NULL || ia->header.magic != DAPL_MAGIC_IA )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- virt_addr = dapl_mr_get_address (lmr->param.region_desc,\r
- lmr->param.mem_type);\r
-\r
- access_ctrl = dapl_lmr_convert_privileges (privileges);\r
- access_ctrl |= IB_AC_MW_BIND;\r
-\r
- mr_create.vaddr = (void *) virt_addr;\r
- mr_create.access_ctrl = access_ctrl;\r
- mr_handle = (ib_mr_handle_t) lmr->mr_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMRS: orig mr_handle %p vaddr %p\n", \r
- mr_handle, virt_addr);\r
-\r
- if (lmr->param.mem_type == DAT_MEM_TYPE_SHARED_VIRTUAL)\r
- {\r
- ib_status = ib_reg_shmid (\r
- ((DAPL_PZ *)lmr->param.pz_handle)->pd_handle,\r
- (const uint8_t*)&lmr->ib_shmid,\r
- &mr_create,\r
- &virt_addr,\r
- &l_key,\r
- &r_key,\r
- &new_mr_handle);\r
- }\r
- else\r
- { \r
-\r
- ib_status = ib_reg_shared (\r
- mr_handle,\r
- ((DAPL_PZ *)lmr->param.pz_handle)->pd_handle,\r
- access_ctrl,\r
- /* in/out */(DAT_UINT64 *)&virt_addr,\r
- &l_key,\r
- &r_key,\r
- &new_mr_handle);\r
- }\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
- /*\r
- * FIXME - Vu\r
- * What if virt_addr as an OUTPUT having the actual virtual address\r
- * assigned to the register region\r
- */\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMRS: lmr (%p) lkey = 0x%x new mr_handle %p vaddr %p\n", \r
- lmr, l_key, new_mr_handle, virt_addr);\r
-\r
- lmr->param.lmr_context = l_key;\r
- lmr->param.rmr_context = r_key;\r
- lmr->param.registered_address = (DAT_VADDR) (uintptr_t) virt_addr;\r
- lmr->mr_handle = new_mr_handle;\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_mw_alloc\r
- *\r
- * Bind a protection domain to a memory window\r
- *\r
- * Input:\r
- * rmr Initialized rmr to hold binding handles\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mw_alloc (\r
- IN DAPL_RMR *rmr)\r
-{\r
- ib_api_status_t ib_status;\r
- uint32_t r_key;\r
- ib_mw_handle_t mw_handle;\r
-\r
- ib_status = ib_create_mw (\r
- ((DAPL_PZ *)rmr->param.pz_handle)->pd_handle,\r
- &r_key,\r
- &mw_handle);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIMA: create MW failed = %s\n", ib_get_err_str(ib_status));\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- rmr->mw_handle = mw_handle;\r
- rmr->param.rmr_context = (DAT_RMR_CONTEXT) r_key;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMA: mw_handle %p r_key = 0x%x\n", \r
- mw_handle, r_key);\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_mw_free\r
- *\r
- * Release bindings of a protection domain to a memory window\r
- *\r
- * Input:\r
- * rmr Initialized rmr to hold binding handles\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mw_free (\r
- IN DAPL_RMR *rmr)\r
-{\r
- ib_api_status_t ib_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMF: mw_handle %p\n", rmr->mw_handle);\r
-\r
- ib_status = ib_destroy_mw (rmr->mw_handle);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIMF: Free MW failed = %s\n", ib_get_err_str(ib_status));\r
- return dapl_ib_status_convert (ib_status);\r
- }\r
-\r
- rmr->param.rmr_context = 0;\r
- rmr->mw_handle = IB_INVALID_HANDLE;\r
-\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-/*\r
- * dapls_ib_mw_bind\r
- *\r
- * Bind a protection domain to a memory window\r
- *\r
- * Input:\r
- * rmr Initialized rmr to hold binding handles\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mw_bind (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_LMR *lmr,\r
- IN DAPL_EP *ep,\r
- IN DAPL_COOKIE *cookie,\r
- IN DAT_VADDR virtual_address,\r
- IN DAT_VLEN length,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN ib_bool_t is_signaled)\r
-{\r
- ib_api_status_t ib_status;\r
- ib_bind_wr_t bind_wr_prop;\r
- uint32_t new_rkey;\r
- \r
- bind_wr_prop.local_ds.vaddr = virtual_address;\r
- bind_wr_prop.local_ds.length = (uint32_t)length;\r
- bind_wr_prop.local_ds.lkey = lmr->param.lmr_context;\r
- bind_wr_prop.current_rkey = rmr->param.rmr_context;\r
- bind_wr_prop.access_ctrl = dapl_rmr_convert_privileges (mem_priv);\r
- bind_wr_prop.send_opt = (is_signaled == TRUE) ? \r
- IB_SEND_OPT_SIGNALED : 0;\r
- bind_wr_prop.wr_id = (uint64_t) ((uintptr_t) cookie);\r
- bind_wr_prop.h_mr = lmr->mr_handle;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMB: mr_handle %p, mw_handle %p vaddr %#I64x length %#I64x\n", \r
- lmr->mr_handle, rmr->mw_handle, virtual_address, length);\r
-\r
- ib_status = ib_bind_mw (\r
- rmr->mw_handle,\r
- ep->qp_handle,\r
- &bind_wr_prop,\r
- &new_rkey);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIMB: Bind MW failed = %s\n", \r
- ib_get_err_str(ib_status));\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
-\r
- rmr->param.rmr_context = (DAT_RMR_CONTEXT) new_rkey;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMB: new_rkey = 0x%x\n",new_rkey);\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-/*\r
- * dapls_ib_mw_unbind\r
- *\r
- * Unbind a memory window\r
- *\r
- * Input:\r
- * rmr Initialized rmr to hold binding handles\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_mw_unbind (\r
- IN DAPL_RMR *rmr,\r
- IN DAPL_EP *ep,\r
- IN DAPL_COOKIE *cookie,\r
- IN ib_bool_t is_signaled)\r
-{\r
- ib_api_status_t ib_status;\r
- ib_bind_wr_t bind_wr_prop;\r
- uint32_t new_rkey;\r
- \r
- bind_wr_prop.local_ds.vaddr = 0;\r
- bind_wr_prop.local_ds.length = 0;\r
- bind_wr_prop.local_ds.lkey = 0;\r
- bind_wr_prop.access_ctrl = 0;\r
- bind_wr_prop.send_opt = (is_signaled == TRUE) ? \r
- IB_SEND_OPT_SIGNALED : 0;\r
- bind_wr_prop.wr_id = (uint64_t) ((uintptr_t) cookie);\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMU: mw_handle = %p\n", rmr->mw_handle);\r
-\r
- ib_status = ib_bind_mw (\r
- rmr->mw_handle,\r
- ep->qp_handle,\r
- &bind_wr_prop,\r
- &new_rkey);\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIMU: Unbind MW failed = %s\n", \r
- ib_get_err_str(ib_status));\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
-\r
- rmr->param.rmr_context = (DAT_RMR_CONTEXT) new_rkey;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> DsIMU: unbind new_rkey = 0x%x\n", new_rkey);\r
- return (DAT_SUCCESS);\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_setup_async_callback\r
- *\r
- * Set up an asynchronous callbacks of various kinds\r
- *\r
- * Input:\r
- * ia_handle IA handle\r
- * handler_type type of handler to set up\r
- * callback_handle handle param for completion callbacks\r
- * callback callback routine pointer\r
- * context argument for callback routine\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_ib_setup_async_callback (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAPL_ASYNC_HANDLER_TYPE handler_type,\r
- IN unsigned int *callback_handle,\r
- IN ib_async_handler_t callback,\r
- IN void *context )\r
-{\r
- dapl_ibal_ca_t *p_ca;\r
- dapl_ibal_evd_cb_t *evd_cb;\r
- UNREFERENCED_PARAMETER(callback_handle);\r
-\r
- p_ca = (dapl_ibal_ca_t *) ia_ptr->hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsISAC: can't find %s HCA\n", \r
- (ia_ptr->header.provider)->device_name);\r
- return (DAT_INVALID_HANDLE);\r
- }\r
- \r
- if (handler_type != DAPL_ASYNC_CQ_COMPLETION)\r
- {\r
- evd_cb = dapli_find_evd_cb_by_context (context, p_ca);\r
- \r
- if (evd_cb == NULL)\r
- {\r
- /* \r
- * No record for this evd. We allocate one\r
- */\r
- evd_cb = dapl_os_alloc (sizeof (dapl_ibal_evd_cb_t));\r
- dapl_os_memzero (evd_cb, sizeof(dapl_ibal_evd_cb_t));\r
-\r
- if (evd_cb == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> %s: can't alloc res\n","DsISAC"); \r
- return (DAT_INSUFFICIENT_RESOURCES);\r
- }\r
- \r
- evd_cb->context = context;\r
- \r
- /*\r
- * Add the new EVD CB to the list\r
- */\r
- LOCK_INSERT_TAIL( p_ca->evd_cb_lock, \r
- p_ca->evd_cb_head,\r
- evd_cb->next );\r
- }\r
-\r
- switch (handler_type)\r
- {\r
- case DAPL_ASYNC_UNAFILIATED:\r
- evd_cb->pfn_async_err_cb = callback;\r
- break;\r
- case DAPL_ASYNC_CQ_ERROR:\r
- evd_cb->pfn_async_cq_err_cb = callback;\r
- break;\r
- case DAPL_ASYNC_QP_ERROR:\r
- evd_cb->pfn_async_qp_err_cb = callback;\r
- break;\r
- default:\r
- break;\r
- }\r
-\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_query_hca\r
- *\r
- * Query the hca attribute\r
- *\r
- * Input:\r
- * hca_handl hca handle \r
- * ep_attr attribute of the ep\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-\r
-DAT_RETURN dapls_ib_query_hca (\r
- IN DAPL_HCA *hca_ptr,\r
- OUT DAT_IA_ATTR *ia_attr,\r
- OUT DAT_EP_ATTR *ep_attr,\r
- OUT DAT_SOCK_ADDR6 *ip_addr)\r
-{\r
- ib_ca_attr_t *p_hca_attr;\r
- dapl_ibal_ca_t *p_ca;\r
- ib_api_status_t ib_status;\r
- ib_hca_port_t port_num;\r
- GID gid;\r
- DAT_SOCK_ADDR6 *p_sock_addr;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
-\r
- port_num = hca_ptr->port_num;\r
-\r
- p_ca = (dapl_ibal_ca_t *) hca_ptr->ib_hca_handle;\r
-\r
- if (p_ca == NULL)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR, "--> DsIQH: invalid handle %p",\r
- hca_ptr );\r
- return (DAT_INVALID_HANDLE);\r
- }\r
-\r
- ib_status = ib_query_ca ( p_ca->h_ca,\r
- p_ca->p_ca_attr,\r
- &p_ca->ca_attr_size );\r
-\r
- if (ib_status != IB_SUCCESS)\r
- {\r
- dapl_dbg_log ( DAPL_DBG_TYPE_ERR,\r
- "--> DsIQH: ib_query_ca returned failed status = %s\n", \r
- ib_get_err_str(ib_status));\r
- return (dapl_ib_status_convert (ib_status));\r
- }\r
-\r
- p_hca_attr = p_ca->p_ca_attr;\r
-\r
- if (ip_addr != NULL)\r
- {\r
- p_sock_addr = dapl_os_alloc(sizeof(DAT_SOCK_ADDR6));\r
- if ( !p_sock_addr )\r
- {\r
- dat_status = DAT_INSUFFICIENT_RESOURCES;\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- " Query Hca alloc Err: status %d\n", dat_status);\r
- return dat_status;\r
- }\r
- dapl_os_memzero(p_sock_addr, sizeof(DAT_SOCK_ADDR6));\r
-\r
- gid.gid_prefix =\r
- p_hca_attr->p_port_attr[port_num-1].p_gid_table->unicast.prefix;\r
-\r
- gid.guid =\r
- p_hca_attr->p_port_attr[port_num-1].p_gid_table->unicast.interface_id;\r
- \r
- dat_status = dapls_ns_map_ipaddr(hca_ptr, gid,\r
- (DAT_IA_ADDRESS_PTR)p_sock_addr);\r
- \r
- if ( dat_status != DAT_SUCCESS )\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- " SA Query for local IP failed= %d\n",\r
- dat_status );\r
- /* what to do next ? */\r
- }\r
- else\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM, "SA query GID for IP: ");\r
- dapl_dbg_log ( DAPL_DBG_TYPE_CM, "%0d:%d:%d:%d\n", \r
- (uint8_t)((DAT_IA_ADDRESS_PTR )p_sock_addr)->sa_data[2]&0xff,\r
- (uint8_t)((DAT_IA_ADDRESS_PTR )p_sock_addr)->sa_data[3]&0xff,\r
- (uint8_t)((DAT_IA_ADDRESS_PTR )p_sock_addr)->sa_data[4]&0xff,\r
- (uint8_t)((DAT_IA_ADDRESS_PTR )p_sock_addr)->sa_data[5]&0xff);\r
- }\r
-\r
- hca_ptr->hca_address = *p_sock_addr;\r
-\r
- /* if structure address not from our hca_ptr */\r
- if ( ip_addr != &hca_ptr->hca_address )\r
- {\r
- *ip_addr = *p_sock_addr;\r
- }\r
- dapl_os_free (p_sock_addr, sizeof(DAT_SOCK_ADDR6));\r
- } /* ip_addr != NULL */\r
-\r
- if ( ia_attr != NULL )\r
- {\r
- dapl_os_memzero (ia_attr->adapter_name,\r
- (int)sizeof(ia_attr->adapter_name ));\r
- dapl_os_memcpy (ia_attr->adapter_name,\r
- DAT_ADAPTER_NAME, \r
- min ( (int)dapl_os_strlen(DAT_ADAPTER_NAME),\r
- (int)(DAT_NAME_MAX_LENGTH)-1 ) );\r
-\r
- dapl_os_memzero (ia_attr->vendor_name,\r
- (int)sizeof(ia_attr->vendor_name));\r
- dapl_os_memcpy(ia_attr->vendor_name, \r
- DAT_VENDOR_NAME,\r
- min ((int)dapl_os_strlen(DAT_VENDOR_NAME),\r
- (int)(DAT_NAME_MAX_LENGTH)-1 ));\r
- \r
- /* FIXME : Vu\r
- * this value should be revisited\r
- * It can be set by DAT consumers\r
- */\r
- ia_attr->ia_address_ptr = (DAT_PVOID)&hca_ptr->hca_address;\r
- ia_attr->hardware_version_major = p_hca_attr->dev_id;\r
- ia_attr->hardware_version_minor = p_hca_attr->revision;\r
- ia_attr->max_eps = p_hca_attr->max_qps;\r
- ia_attr->max_dto_per_ep = p_hca_attr->max_wrs;\r
- ia_attr->max_rdma_read_per_ep = p_hca_attr->max_qp_resp_res;\r
- ia_attr->max_evds = p_hca_attr->max_cqs;\r
- ia_attr->max_evd_qlen = p_hca_attr->max_cqes;\r
- ia_attr->max_iov_segments_per_dto = p_hca_attr->max_sges;\r
- ia_attr->max_lmrs = p_hca_attr->init_regions;\r
- ia_attr->max_lmr_block_size = p_hca_attr->init_region_size;\r
- ia_attr->max_rmrs = p_hca_attr->init_windows;\r
- ia_attr->max_lmr_virtual_address = p_hca_attr->max_addr_handles;\r
- ia_attr->max_rmr_target_address = p_hca_attr->max_addr_handles;\r
- ia_attr->max_pzs = p_hca_attr->max_pds;\r
- /*\r
- * DAT spec does not tie max_mtu_size with IB MTU\r
- *\r
- ia_attr->max_mtu_size = \r
- dapl_ibal_mtu_table[p_hca_attr->p_port_attr->mtu];\r
- */\r
- ia_attr->max_mtu_size = \r
- p_hca_attr->p_port_attr->max_msg_size;\r
- ia_attr->max_rdma_size = \r
- p_hca_attr->p_port_attr->max_msg_size;\r
- ia_attr->num_transport_attr = 0;\r
- ia_attr->transport_attr = NULL;\r
- ia_attr->num_vendor_attr = 0;\r
- ia_attr->vendor_attr = NULL;\r
- \r
- dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " --> DsIMU_qHCA: (ver=%x) ep %d "\r
- "ep_q %d evd %d evd_q %d\n", \r
- ia_attr->hardware_version_major,\r
- ia_attr->max_eps, ia_attr->max_dto_per_ep,\r
- ia_attr->max_evds, ia_attr->max_evd_qlen );\r
- dapl_dbg_log(DAPL_DBG_TYPE_UTIL, \r
- " --> DsIMU_qHCA: mtu %llu rdma %llu iov %d lmr %d rmr %d"\r
- " rdma_io %d\n", \r
- ia_attr->max_mtu_size, ia_attr->max_rdma_size,\r
- ia_attr->max_iov_segments_per_dto, ia_attr->max_lmrs, \r
- ia_attr->max_rmrs, ia_attr->max_rdma_read_per_ep );\r
- }\r
-\r
- if ( ep_attr != NULL )\r
- {\r
- /*\r
- * DAT spec does not tie max_mtu_size with IB MTU\r
- *\r
- ep_attr->max_mtu_size = \r
- dapl_ibal_mtu_table[p_hca_attr->p_port_attr->mtu];\r
- */\r
- ep_attr->max_mtu_size = p_hca_attr->p_port_attr->max_msg_size;\r
- ep_attr->max_rdma_size = p_hca_attr->p_port_attr->max_msg_size;\r
- ep_attr->max_recv_dtos = p_hca_attr->max_wrs;\r
- ep_attr->max_request_dtos = p_hca_attr->max_wrs;\r
- ep_attr->max_recv_iov = p_hca_attr->max_sges;\r
- ep_attr->max_request_iov = p_hca_attr->max_sges;\r
- ep_attr->max_rdma_read_in = p_hca_attr->max_qp_resp_res;\r
- ep_attr->max_rdma_read_out= p_hca_attr->max_qp_resp_res;\r
- \r
- dapl_dbg_log(DAPL_DBG_TYPE_UTIL, \r
- " --> DsIMU_qHCA: msg %llu dto %d iov %d rdma i%d,o%d\n", \r
- ep_attr->max_mtu_size,\r
- ep_attr->max_recv_dtos, ep_attr->max_recv_iov,\r
- ep_attr->max_rdma_read_in, ep_attr->max_rdma_read_out);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_completion_poll (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN ib_work_completion_t* cqe_ptr)\r
-{\r
- ib_api_status_t ib_status;\r
- ib_work_completion_t *cqe_filled;\r
- \r
- /*\r
- * FIXME - Vu\r
- * Now we only poll for one cqe. We can poll for more than\r
- * one completions later for better. However, this requires\r
- * to change the logic in dapl_evd_dto_callback function\r
- * to process more than one completion.\r
- */\r
- cqe_ptr->p_next = NULL;\r
- cqe_filled = NULL;\r
- if ( !hca_handle )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- ib_status = ib_poll_cq (cq_handle, &cqe_ptr, &cqe_filled);\r
-\r
- if ( ib_status == IB_INVALID_CQ_HANDLE )\r
- ib_status = IB_NOT_FOUND;\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_completion_notify (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN ib_notification_type_t type)\r
-{\r
- ib_api_status_t ib_status;\r
- DAT_BOOLEAN solic_notify;\r
- if ( !hca_handle )\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- solic_notify = (type == IB_NOTIFY_ON_SOLIC_COMP) ? DAT_TRUE : DAT_FALSE; \r
- ib_status = ib_rearm_cq ( cq_handle, solic_notify );\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_n_completions_notify (\r
- IN ib_hca_handle_t hca_handle,\r
- IN ib_cq_handle_t cq_handle,\r
- IN uint32_t n_cqes)\r
-{\r
- ib_api_status_t ib_status;\r
- UNREFERENCED_PARAMETER(hca_handle);\r
-\r
- ib_status = ib_rearm_n_cq ( \r
- cq_handle,\r
- n_cqes );\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_peek_cq (\r
- IN ib_cq_handle_t cq_handle,\r
- OUT uint32_t* p_n_cqes)\r
-{\r
- ib_api_status_t ib_status;\r
-\r
- ib_status = ib_peek_cq ( \r
- cq_handle,\r
- p_n_cqes );\r
-\r
- return dapl_ib_status_convert (ib_status);\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_create (\r
- IN cl_waitobj_handle_t* p_cq_wait_obj_handle)\r
-{\r
- cl_status_t cl_status;\r
-\r
- cl_status = cl_waitobj_create (FALSE /* auto_reset */, p_cq_wait_obj_handle);\r
-\r
- if (cl_status == CL_SUCCESS)\r
- return DAT_SUCCESS;\r
-\r
- return DAT_INTERNAL_ERROR;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_destroy (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle)\r
-{\r
- cl_status_t cl_status;\r
-\r
- cl_status = cl_waitobj_destroy (cq_wait_obj_handle);\r
-\r
- if (cl_status == CL_SUCCESS)\r
- return DAT_SUCCESS;\r
-\r
- return DAT_INTERNAL_ERROR;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_wakeup (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle)\r
-{\r
- cl_status_t cl_status;\r
-\r
- cl_status = cl_waitobj_signal (cq_wait_obj_handle);\r
-\r
- if (cl_status == CL_SUCCESS)\r
- return DAT_SUCCESS;\r
-\r
- return DAT_INTERNAL_ERROR;\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ib_wait_object_wait (\r
- IN cl_waitobj_handle_t cq_wait_obj_handle,\r
- IN uint32_t timeout)\r
-{\r
- cl_status_t cl_status;\r
-\r
- cl_status = cl_waitobj_wait_on (cq_wait_obj_handle, timeout, TRUE ); \r
-\r
- switch (cl_status)\r
- {\r
- case CL_SUCCESS: \r
- return DAT_SUCCESS;\r
- case CL_TIMEOUT: \r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> wait_object_wait: cl_timeout: %d\n", timeout);\r
- return DAT_TIMEOUT_EXPIRED;\r
- case CL_NOT_DONE: \r
- return DAT_SUCCESS;\r
- default: \r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "--> wait_object_wait: cl_error: %d\n", cl_status);\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_get_async_event\r
- *\r
- * Translate an asynchronous event type to the DAT event.\r
- * Note that different providers have different sets of errors.\r
- *\r
- * Input:\r
- * cause_ptr provider event cause\r
- *\r
- * Output:\r
- * async_event DAT mapping of error\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_NOT_IMPLEMENTED Caller is not interested this event\r
- */\r
-\r
-DAT_RETURN dapls_ib_get_async_event(\r
- IN ib_async_event_rec_t *cause_ptr,\r
- OUT DAT_EVENT_NUMBER *async_event)\r
-{\r
- ib_async_event_t event_id;\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- event_id = cause_ptr->code;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN, \r
- "--> DsAE: event_id = %d%d\n", event_id);\r
-\r
- switch (event_id )\r
- {\r
- case IB_AE_SQ_ERROR:\r
- case IB_AE_SQ_DRAINED:\r
- case IB_AE_RQ_ERROR:\r
- {\r
- *async_event = DAT_ASYNC_ERROR_EP_BROKEN;\r
- break;\r
- }\r
-\r
-\r
-\r
- /* INTERNAL errors */\r
- case IB_AE_QP_FATAL:\r
- case IB_AE_CQ_ERROR:\r
- case IB_AE_LOCAL_FATAL:\r
- case IB_AE_WQ_REQ_ERROR:\r
- case IB_AE_WQ_ACCESS_ERROR:\r
- {\r
- *async_event = DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR;\r
- break;\r
- }\r
-\r
- /* CATASTROPHIC errors */\r
- case IB_AE_FLOW_CTRL_ERROR:\r
- case IB_AE_BUF_OVERRUN:\r
- {\r
- *async_event = DAT_ASYNC_ERROR_IA_CATASTROPHIC;\r
- break;\r
- }\r
- default:\r
- {\r
- /*\r
- * Errors we are not interested in reporting:\r
- * IB_AE_QP_APM\r
- * IB_AE_PKEY_TRAP\r
- * IB_AE_QKEY_TRAP\r
- * IB_AE_MKEY_TRAP\r
- * IB_AE_PORT_TRAP\r
- * IB_AE_QP_APM_ERROR\r
- * IB_AE_PORT_ACTIVE\r
- * ...\r
- */\r
- dat_status = DAT_NOT_IMPLEMENTED;\r
- }\r
-\r
- }\r
- \r
- return dat_status;\r
-}\r
-\r
-/*\r
- * dapls_ib_get_dto_status\r
- *\r
- * Return the DAT status of a DTO operation\r
- *\r
- * Input:\r
- * cqe_ptr pointer to completion queue entry\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * Value from ib_status_map table above\r
- */\r
-\r
-DAT_DTO_COMPLETION_STATUS\r
-dapls_ib_get_dto_status(\r
- IN ib_work_completion_t *cqe_ptr)\r
-{\r
- ib_uint32_t ib_status;\r
-\r
- ib_status = DAPL_GET_CQE_STATUS (cqe_ptr);\r
-\r
- switch (ib_status)\r
- {\r
- case IB_COMP_ST_SUCCESS :\r
- return DAT_DTO_SUCCESS;\r
- case IB_COMP_ST_LOCAL_LEN_ERR:\r
- return DAT_DTO_ERR_LOCAL_LENGTH;\r
- case IB_COMP_ST_LOCAL_OP_ERR:\r
- return DAT_DTO_ERR_LOCAL_EP;\r
- case IB_COMP_ST_LOCAL_PROTECT_ERR:\r
- return DAT_DTO_ERR_LOCAL_PROTECTION;\r
- case IB_COMP_ST_WR_FLUSHED_ERR: \r
- return DAT_DTO_ERR_FLUSHED;\r
- case IB_COMP_ST_MW_BIND_ERR:\r
- return DAT_RMR_OPERATION_FAILED;\r
- case IB_COMP_ST_REM_ACC_ERR:\r
- return DAT_DTO_ERR_REMOTE_ACCESS;\r
- case IB_COMP_ST_REM_OP_ERR:\r
- return DAT_DTO_ERR_REMOTE_RESPONDER;\r
- case IB_COMP_ST_RNR_COUNTER:\r
- return DAT_DTO_ERR_RECEIVER_NOT_READY;\r
- case IB_COMP_ST_TRANSP_COUNTER:\r
- return DAT_DTO_ERR_TRANSPORT;\r
- case IB_COMP_ST_REM_REQ_ERR:\r
- return DAT_DTO_ERR_REMOTE_RESPONDER;\r
- case IB_COMP_ST_BAD_RESPONSE_ERR:\r
- return DAT_DTO_ERR_BAD_RESPONSE;\r
- case IB_COMP_ST_EE_STATE_ERR:\r
- case IB_COMP_ST_EE_CTX_NO_ERR:\r
- return DAT_DTO_ERR_TRANSPORT;\r
- default:\r
- return DAT_DTO_FAILURE;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * Map all IBAPI DTO completion codes to the DAT equivelent.\r
- *\r
- * dapls_ib_get_dat_event\r
- *\r
- * Return a DAT connection event given a provider CM event.\r
- *\r
- * N.B. Some architectures combine async and CM events into a\r
- * generic async event. In that case, dapls_ib_get_dat_event()\r
- * and dapls_ib_get_async_event() should be entry points that\r
- * call into a common routine.\r
- *\r
- * Input:\r
- * ib_cm_event event provided to the dapl callback routine\r
- * active switch indicating active or passive connection\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_EVENT_NUMBER of translated provider value\r
- */\r
-\r
-DAT_EVENT_NUMBER\r
-dapls_ib_get_dat_event (\r
- IN const ib_cm_events_t ib_cm_event,\r
- IN DAT_BOOLEAN active)\r
-{\r
- DAT_EVENT_NUMBER dat_event_num = 0;\r
- UNREFERENCED_PARAMETER (active);\r
-\r
- switch ( ib_cm_event)\r
- {\r
- case IB_CME_CONNECTED:\r
- dat_event_num = DAT_CONNECTION_EVENT_ESTABLISHED;\r
- break;\r
- case IB_CME_DISCONNECTED:\r
- dat_event_num = DAT_CONNECTION_EVENT_DISCONNECTED;\r
- break;\r
- case IB_CME_DISCONNECTED_ON_LINK_DOWN:\r
- dat_event_num = DAT_CONNECTION_EVENT_DISCONNECTED;\r
- break;\r
- case IB_CME_CONNECTION_REQUEST_PENDING:\r
- dat_event_num = DAT_CONNECTION_REQUEST_EVENT;\r
- break;\r
- case IB_CME_CONNECTION_REQUEST_PENDING_PRIVATE_DATA:\r
- dat_event_num = DAT_CONNECTION_REQUEST_EVENT;\r
- break;\r
- case IB_CME_DESTINATION_REJECT:\r
- dat_event_num = DAT_CONNECTION_EVENT_NON_PEER_REJECTED;\r
- break;\r
- case IB_CME_DESTINATION_REJECT_PRIVATE_DATA:\r
- dat_event_num = DAT_CONNECTION_EVENT_PEER_REJECTED;\r
- break;\r
- case IB_CME_DESTINATION_UNREACHABLE:\r
- dat_event_num = DAT_CONNECTION_EVENT_UNREACHABLE;\r
- break;\r
- case IB_CME_TOO_MANY_CONNECTION_REQUESTS:\r
- dat_event_num = DAT_CONNECTION_EVENT_NON_PEER_REJECTED;\r
- break;\r
- case IB_CME_LOCAL_FAILURE:\r
- dat_event_num = DAT_CONNECTION_EVENT_BROKEN;\r
- break;\r
- case IB_CME_REPLY_RECEIVED:\r
- case IB_CME_REPLY_RECEIVED_PRIVATE_DATA:\r
- default:\r
- break;\r
- }\r
- dapl_dbg_log (DAPL_DBG_TYPE_CM,\r
- " dapls_ib_get_dat_event: event translation: (%s) "\r
- "ib_event 0x%x dat_event 0x%x\n",\r
- active ? "active" : "passive",\r
- ib_cm_event,\r
- dat_event_num);\r
-\r
- return dat_event_num;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ib_get_dat_event\r
- *\r
- * Return a DAT connection event given a provider CM event.\r
- *\r
- * N.B. Some architectures combine async and CM events into a\r
- * generic async event. In that case, dapls_ib_get_cm_event()\r
- * and dapls_ib_get_async_event() should be entry points that\r
- * call into a common routine.\r
- *\r
- * WARNING: In this implementation, there are multiple CM\r
- * events that map to a single DAT event. Be very careful\r
- * with provider routines that depend on this reverse mapping,\r
- * they may have to accomodate more CM events than they\r
- * 'naturally' would.\r
- *\r
- * Input:\r
- * dat_event_num DAT event we need an equivelent CM event for\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * ib_cm_event of translated DAPL value\r
- */\r
-ib_cm_events_t\r
-dapls_ib_get_cm_event (\r
- IN DAT_EVENT_NUMBER dat_event_num)\r
-{\r
- ib_cm_events_t ib_cm_event = 0;\r
-\r
- switch (dat_event_num)\r
- {\r
- case DAT_CONNECTION_EVENT_ESTABLISHED:\r
- ib_cm_event = IB_CME_CONNECTED;\r
- break;\r
- case DAT_CONNECTION_EVENT_DISCONNECTED:\r
- ib_cm_event = IB_CME_DISCONNECTED;\r
- break;\r
- case DAT_CONNECTION_REQUEST_EVENT:\r
- ib_cm_event = IB_CME_CONNECTION_REQUEST_PENDING;\r
- break;\r
- case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:\r
- ib_cm_event = IB_CME_DESTINATION_REJECT;\r
- break;\r
- case DAT_CONNECTION_EVENT_PEER_REJECTED:\r
- ib_cm_event = IB_CME_DESTINATION_REJECT_PRIVATE_DATA;\r
- break;\r
- case DAT_CONNECTION_EVENT_UNREACHABLE:\r
- ib_cm_event = IB_CME_DESTINATION_UNREACHABLE;\r
- break;\r
- case DAT_CONNECTION_EVENT_BROKEN:\r
- ib_cm_event = IB_CME_LOCAL_FAILURE;\r
- break;\r
- default:\r
- break;\r
- }\r
-\r
- return ib_cm_event;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_ibal_util.h\r
- *\r
- * PURPOSE: Utility defs & routines for access to Intel IBAL APIs\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_IBAL_UTIL_H_\r
-#define _DAPL_IBAL_UTIL_H_\r
-\r
-#include <iba/ib_al.h>\r
-#include <complib/cl_spinlock.h>\r
-#include <complib/cl_qlist.h>\r
-#include <complib/cl_atomic.h>\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_ib_status_convert (\r
- IN int32_t ib_status);\r
-\r
-/*\r
- * Typedefs to map IBAL types to more generic 'ib' types\r
- */\r
-typedef ib_net64_t IB_HCA_NAME;\r
-typedef ib_listen_handle_t ib_cm_srvc_handle_t;\r
-typedef ib_ca_handle_t ib_hca_handle_t;\r
-typedef DAT_PVOID ib_cqd_handle_t;\r
-typedef ib_async_event_rec_t ib_error_record_t;\r
-typedef ib_wr_type_t ib_send_op_type_t;\r
-typedef ib_wc_t ib_work_completion_t;\r
-typedef uint32_t ib_hca_port_t;\r
-typedef uint32_t ib_uint32_t;\r
-typedef uint32_t ib_comp_handle_t;\r
-typedef ib_local_ds_t ib_data_segment_t;\r
-\r
-typedef unsigned __int3264 cl_dev_handle_t;\r
-\r
-typedef void (*ib_async_handler_t)(\r
- IN ib_hca_handle_t ib_hca_handle,\r
- IN ib_error_record_t *err_code,\r
- IN void *context);\r
-\r
-typedef ib_net64_t ib_guid_t;\r
-typedef ib_net16_t ib_lid_t;\r
-typedef boolean_t ib_bool_t;\r
-\r
-typedef struct _GID\r
-{\r
- uint64_t gid_prefix;\r
- uint64_t guid;\r
-} GID;\r
-\r
-typedef enum \r
-{\r
- IB_CME_CONNECTED,\r
- IB_CME_DISCONNECTED,\r
- IB_CME_DISCONNECTED_ON_LINK_DOWN,\r
- IB_CME_CONNECTION_REQUEST_PENDING,\r
- IB_CME_CONNECTION_REQUEST_PENDING_PRIVATE_DATA,\r
- IB_CME_DESTINATION_REJECT,\r
- IB_CME_DESTINATION_REJECT_PRIVATE_DATA,\r
- IB_CME_DESTINATION_UNREACHABLE,\r
- IB_CME_TOO_MANY_CONNECTION_REQUESTS,\r
- IB_CME_LOCAL_FAILURE,\r
- IB_CME_REPLY_RECEIVED,\r
- IB_CME_REPLY_RECEIVED_PRIVATE_DATA,\r
- IB_CM_LOCAL_FAILURE\r
-} ib_cm_events_t;\r
-\r
-typedef enum\r
-{\r
- IB_NOTIFY_ON_NEXT_COMP,\r
- IB_NOTIFY_ON_SOLIC_COMP\r
-} ib_notification_type_t;\r
-\r
-typedef struct _ib_hca_name\r
-{\r
- DAT_NAME_PTR hca_name[DAT_NAME_MAX_LENGTH];\r
-} ib_hca_name_t;\r
-\r
-\r
-#define IB_INVALID_HANDLE NULL\r
-#define true TRUE\r
-#define false FALSE\r
-\r
-#define IB_MAX_REQ_PDATA_SIZE 92\r
-#define IB_MAX_REP_PDATA_SIZE 196\r
-#define IB_MAX_REJ_PDATA_SIZE 148\r
-#define IB_MAX_DREQ_PDATA_SIZE 220\r
-#define IB_MAX_DREP_PDATA_SIZE 224\r
-\r
-/* Resource Not Ready\r
- 1-6 is an actual retry count which is decremented to zero before\r
- an error condition is set.\r
- 7 is 'magic' in that it implies Infinite retry, just keeps trying.\r
-*/\r
-#define IB_RNR_RETRY_CNT 7\r
-\r
-/*\r
-IB 1.2 spec, page 331, table 45, RNR NAK timeout encoding (5-bits)\r
- \r
-00000=655.36ms(milliseconds)\r
-00001=0.01ms\r
-00010=0.02ms\r
-00011=0.03ms\r
-00100=0.04ms\r
-00101=0.06ms\r
-00110=0.08ms\r
-00111=0.12ms\r
-\r
-11100=163.84ms 28d\r
-11101=245.76ms 29d\r
-11110=327.68ms 30d\r
-11111=491.52ms 31d\r
-*/\r
-#define IB_RNR_NAK_TIMEOUT 0\r
-\r
-typedef void\r
-(*dapl_ibal_pfn_destructor_t)(\r
- IN void* context );\r
-\r
-typedef struct _dapl_ibal_refs\r
-{\r
- atomic32_t count; // number of references\r
- void* context; // context for destructor\r
- dapl_ibal_pfn_destructor_t destructor; // called when reference goes to zero\r
-\r
-} dapl_ibal_refs_t;\r
-\r
-\r
-typedef struct _dapl_ibal_root\r
-{\r
- ib_al_handle_t h_al; // handle to Access Layer\r
- cl_spinlock_t ca_lock; // CA list lock\r
- cl_qlist_t ca_head; // list head of CAs\r
- boolean_t shutdown; // when true, driver is shutting down\r
- boolean_t initialized; // when true, lib is initialized \r
-\r
-} dapl_ibal_root_t;\r
-\r
-\r
-typedef struct _dapl_ibal_ca\r
-{\r
- cl_list_item_t next; // peer CA list\r
- ib_ca_handle_t h_ca; // handle to open CA\r
- ib_ca_attr_t *p_ca_attr; // CA attributes\r
- uint32_t ca_attr_size;// size of ca attribute\r
- dapl_ibal_refs_t refs; // reference counting\r
- cl_spinlock_t port_lock; // port list lock\r
- cl_qlist_t port_head; // port list head for this CA\r
- cl_spinlock_t evd_cb_lock; // EVD async error cb list lock\r
- cl_qlist_t evd_cb_head; // EVD async error cb list head for this CA\r
- cl_dev_handle_t mlnx_device;\r
- DAT_PVOID *ia_ptr; // hook for CA async callbacks\r
-\r
-} dapl_ibal_ca_t;\r
-\r
-\r
-typedef struct _dapl_ibal_port\r
-{\r
- cl_list_item_t next; // peer CA list\r
- dapl_ibal_ca_t *ca; // pointer to parent CA\r
- ib_port_attr_t *p_attr; // port attributes\r
- dapl_ibal_refs_t refs; // reference counting\r
-} dapl_ibal_port_t;\r
-\r
-typedef struct _dapl_ibal_evd_cb\r
-{\r
- cl_list_item_t next; // peer CA list\r
- ib_async_handler_t pfn_async_err_cb;\r
- ib_async_handler_t pfn_async_qp_err_cb;\r
- ib_async_handler_t pfn_async_cq_err_cb;\r
- void *context;\r
-} dapl_ibal_evd_cb_t;\r
-\r
-/*\r
- * Definitions to map DTO OPs\r
- */\r
-#define OP_RDMA_READ WR_RDMA_READ\r
-#define OP_RDMA_WRITE WR_RDMA_WRITE\r
-#define OP_SEND WR_SEND\r
-#define OP_COMP_AND_SWAP WR_COMPARE_SWAP\r
-#define OP_FETCH_AND_ADD WR_FETCH_ADD\r
-#define OP_RECEIVE 6 /* no-equip */\r
-#define OP_BIND_MW 7 /* no-equip */\r
-\r
-/*\r
- * Definitions to map QP state\r
- */\r
-#define IB_QP_STATE_RESET IB_QPS_RESET\r
-#define IB_QP_STATE_INIT IB_QPS_INIT\r
-#define IB_QP_STATE_RTR IB_QPS_RTR\r
-#define IB_QP_STATE_RTS IB_QPS_RTS\r
-#define IB_QP_STATE_SQE IB_QPS_SQERR\r
-#define IB_QP_STATE_SQD IB_QPS_SQD\r
-#define IB_QP_STATE_ERROR IB_QPS_ERROR\r
-\r
-/*\r
- * Definitions to map Memory OPs\r
- */\r
-#define IB_ACCESS_LOCAL_WRITE IB_AC_LOCAL_WRITE\r
-#define IB_ACCESS_REMOTE_READ IB_AC_RDMA_READ\r
-#define IB_ACCESS_REMOTE_WRITE IB_AC_RDMA_WRITE\r
-\r
-/*\r
- * CQE status \r
- */\r
-enum _dapl_comp_status\r
-{\r
- IB_COMP_ST_SUCCESS = IB_WCS_SUCCESS,\r
- IB_COMP_ST_LOCAL_LEN_ERR = IB_WCS_LOCAL_LEN_ERR,\r
- IB_COMP_ST_LOCAL_OP_ERR = IB_WCS_LOCAL_OP_ERR,\r
- IB_COMP_ST_LOCAL_PROTECT_ERR = IB_WCS_LOCAL_PROTECTION_ERR,\r
- IB_COMP_ST_WR_FLUSHED_ERR = IB_WCS_WR_FLUSHED_ERR,\r
- IB_COMP_ST_MW_BIND_ERR = IB_WCS_MEM_WINDOW_BIND_ERR,\r
- IB_COMP_ST_REM_ACC_ERR = IB_WCS_REM_ACCESS_ERR,\r
- IB_COMP_ST_REM_OP_ERR = IB_WCS_REM_OP_ERR,\r
- IB_COMP_ST_RNR_COUNTER = IB_WCS_RNR_RETRY_ERR,\r
- IB_COMP_ST_TRANSP_COUNTER = IB_WCS_TIMEOUT_RETRY_ERR,\r
- IB_COMP_ST_REM_REQ_ERR = IB_WCS_REM_INVALID_REQ_ERR,\r
- IB_COMP_ST_BAD_RESPONSE_ERR = IB_WCS_UNMATCHED_RESPONSE,\r
- IB_COMP_ST_EE_STATE_ERR,\r
- IB_COMP_ST_EE_CTX_NO_ERR\r
-};\r
-\r
-\r
-/*\r
- * Macro to check the state of an EP/QP\r
- */\r
-#define DAPLIB_NEEDS_INIT(ep) ((ep)->qp_state == IB_QPS_ERROR)\r
-\r
-\r
-/*\r
- * Resolve IBAL return codes to their DAPL equivelent.\r
- * Do not return invalid Handles, the user is not able\r
- * to deal with them.\r
- */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_ib_status_convert (\r
- IN int32_t ib_status)\r
-{\r
- switch ( ib_status )\r
- {\r
- case IB_SUCCESS:\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- case IB_INSUFFICIENT_RESOURCES:\r
- case IB_INSUFFICIENT_MEMORY:\r
- case IB_RESOURCE_BUSY:\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
- case IB_INVALID_CA_HANDLE:\r
- case IB_INVALID_CQ_HANDLE:\r
- case IB_INVALID_QP_HANDLE:\r
- case IB_INVALID_PD_HANDLE:\r
- case IB_INVALID_MR_HANDLE:\r
- case IB_INVALID_MW_HANDLE:\r
- case IB_INVALID_AL_HANDLE:\r
- case IB_INVALID_AV_HANDLE:\r
- {\r
- return DAT_INVALID_HANDLE;\r
- }\r
- case IB_INVALID_PKEY:\r
- {\r
- return DAT_PROTECTION_VIOLATION;\r
- }\r
- case IB_INVALID_LKEY:\r
- case IB_INVALID_RKEY:\r
- case IB_INVALID_PERMISSION:\r
- {\r
- return DAT_PRIVILEGES_VIOLATION;\r
- }\r
- case IB_INVALID_MAX_WRS:\r
- case IB_INVALID_MAX_SGE:\r
- case IB_INVALID_CQ_SIZE:\r
- case IB_INVALID_SETTING:\r
- case IB_INVALID_SERVICE_TYPE:\r
- case IB_INVALID_GID:\r
- case IB_INVALID_LID:\r
- case IB_INVALID_GUID:\r
- case IB_INVALID_PARAMETER:\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
- case IB_INVALID_QP_STATE:\r
- case IB_INVALID_APM_STATE:\r
- case IB_INVALID_PORT_STATE:\r
- case IB_INVALID_STATE:\r
- {\r
- return DAT_INVALID_STATE;\r
- }\r
- case IB_NOT_FOUND:\r
- {\r
- return DAT_QUEUE_EMPTY;\r
- }\r
- case IB_OVERFLOW:\r
- {\r
- return DAT_QUEUE_FULL;\r
- }\r
- case IB_UNSUPPORTED:\r
- {\r
- return DAT_NOT_IMPLEMENTED;\r
- }\r
- case IB_TIMEOUT:\r
- {\r
- return DAT_TIMEOUT_EXPIRED;\r
- }\r
- case IB_CANCELED:\r
- {\r
- return DAT_ABORT;\r
- }\r
- default:\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
-}\r
- \r
-#define TAKE_LOCK( lock ) \\r
- cl_spinlock_acquire( &(lock) )\r
-\r
-#define RELEASE_LOCK( lock ) \\r
- cl_spinlock_release( &(lock) )\r
-\r
-#define LOCK_INSERT_HEAD( lock, head, item ) \\r
-{ \\r
- TAKE_LOCK( lock ); \\r
- cl_qlist_insert_head( &head, (cl_list_item_t*)(&item) ); \\r
- RELEASE_LOCK( lock ); \\r
-}\r
-\r
-#define LOCK_INSERT_TAIL( lock, tail, item ) \\r
-{ \\r
- TAKE_LOCK( lock ); \\r
- cl_qlist_insert_tail( &tail, (cl_list_item_t*)(&item) ); \\r
- RELEASE_LOCK( lock ); \\r
-}\r
-\r
-#define INIT_REFERENCE( p_ref, n, con, destruct ) \\r
-{ \\r
- (p_ref)->count = n; \\r
- (p_ref)->context = con; \\r
- (p_ref)->destructor = destruct; \\r
-}\r
-\r
-#define TAKE_REFERENCE( p_ref ) \\r
- cl_atomic_inc( &(p_ref)->count )\r
-\r
-#define REMOVE_REFERENCE( p_ref ) \\r
-{ \\r
- if ( cl_atomic_dec( &(p_ref)->count ) == 0 ) \\r
- if ( (p_ref)->destructor ) \\r
- (p_ref)->destructor( (p_ref)->context ); \\r
-}\r
-\r
-\r
-/*\r
- * Prototype\r
- */\r
-\r
-extern ib_api_status_t \r
-dapls_modify_qp_state_to_error (\r
- ib_qp_handle_t qp_handle );\r
-\r
-extern ib_api_status_t \r
-dapls_modify_qp_state_to_reset (\r
- ib_qp_handle_t);\r
-\r
-extern ib_api_status_t \r
-dapls_modify_qp_state_to_init ( \r
- ib_qp_handle_t, DAT_EP_ATTR *, dapl_ibal_port_t *);\r
-\r
-extern ib_api_status_t \r
-dapls_modify_qp_state_to_rtr (\r
- ib_qp_handle_t, ib_net32_t, ib_lid_t, dapl_ibal_port_t *);\r
-\r
-extern ib_api_status_t \r
-dapls_modify_qp_state_to_rts (\r
- ib_qp_handle_t);\r
-\r
-extern void\r
-dapli_ibal_ca_async_error_callback(\r
- IN ib_async_event_rec_t* p_err_rec );\r
-\r
-extern dapl_ibal_port_t *\r
-dapli_ibal_get_port (\r
- IN dapl_ibal_ca_t *p_ca,\r
- IN uint8_t port_num);\r
-\r
-extern int32_t dapls_ib_init (void);\r
-extern int32_t dapls_ib_release (void);\r
-\r
-extern dapl_ibal_evd_cb_t *\r
-dapli_find_evd_cb_by_context(\r
- IN void *context,\r
- IN dapl_ibal_ca_t *ca);\r
-\r
-extern IB_HCA_NAME\r
-dapl_ib_convert_name(\r
- IN char *name);\r
-\r
-#endif /* _DAPL_IBAL_UTIL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl.h\r
- *\r
- * PURPOSE: defines common data structures for the DAPL reference implemenation\r
- *\r
- * Description: This file describes the working data structures used within\r
- * DAPL RI.\r
- *\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_H_\r
-#define _DAPL_H_\r
-\r
-#include <dat/udat.h>\r
-#include <dat/dat_registry.h>\r
-#include "dapl_osd.h"\r
-#include "dapl_debug.h"\r
-\r
-#ifdef IBAPI\r
-#include "dapl_ibapi_util.h"\r
-#elif VAPI\r
-#include "dapl_vapi_util.h"\r
-#else\r
-#include "dapl_ibal_util.h"\r
-#endif\r
-\r
-/*********************************************************************\r
- * *\r
- * Enumerations *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef enum dapl_magic\r
-{\r
- /* magic number values for verification & debug */\r
- DAPL_MAGIC_IA = 0xCafeF00d,\r
- DAPL_MAGIC_EVD = 0xFeedFace,\r
- DAPL_MAGIC_EP = 0xDeadBabe,\r
- DAPL_MAGIC_LMR = 0xBeefCafe,\r
- DAPL_MAGIC_RMR = 0xABadCafe,\r
- DAPL_MAGIC_PZ = 0xDeafBeef,\r
- DAPL_MAGIC_PSP = 0xBeadeD0c,\r
- DAPL_MAGIC_RSP = 0xFab4Feed,\r
- DAPL_MAGIC_CR = 0xBe12Cee1,\r
- DAPL_MAGIC_CR_DESTROYED = 0xB12bDead,\r
- DAPL_MAGIC_CNO = 0xDeadF00d,\r
- DAPL_MAGIC_EP_EXIT = 0xBabeDead,\r
- DAPL_MAGIC_INVALID = 0xFFFFFFFF\r
-} DAPL_MAGIC;\r
-\r
-typedef enum dapl_evd_state\r
-{\r
- DAPL_EVD_STATE_TERMINAL,\r
- DAPL_EVD_STATE_INITIAL,\r
- DAPL_EVD_STATE_OPEN,\r
- DAPL_EVD_STATE_WAITED,\r
- DAPL_EVD_STATE_DEAD = 0xDEAD\r
-} DAPL_EVD_STATE;\r
-\r
-typedef enum dapl_evd_completion\r
-{\r
- DAPL_EVD_STATE_INIT,\r
- DAPL_EVD_STATE_SOLICITED_WAIT,\r
- DAPL_EVD_STATE_THRESHOLD,\r
- DAPL_EVD_STATE_UNSIGNALLED\r
-} DAPL_EVD_COMPLETION;\r
-\r
-typedef enum dapl_cno_state\r
-{\r
- DAPL_CNO_STATE_UNTRIGGERED,\r
- DAPL_CNO_STATE_TRIGGERED,\r
- DAPL_CNO_STATE_DEAD = 0xDeadFeed,\r
-} DAPL_CNO_STATE;\r
-\r
-typedef enum dapl_qp_state\r
-{\r
- DAPL_QP_STATE_UNCONNECTED,\r
- DAPL_QP_STATE_RESERVED,\r
- DAPL_QP_STATE_PASSIVE_CONNECTION_PENDING,\r
- DAPL_QP_STATE_ACTIVE_CONNECTION_PENDING,\r
- DAPL_QP_STATE_TENTATIVE_CONNECTION_PENDING,\r
- DAPL_QP_STATE_CONNECTED,\r
- DAPL_QP_STATE_DISCONNECT_PENDING,\r
- DAPL_QP_STATE_ERROR,\r
- DAPL_QP_STATE_NOT_REUSABLE,\r
- DAPL_QP_STATE_FREE\r
-} DAPL_QP_STATE;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Constants *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * number of HCAs allowed\r
- */\r
-#define DAPL_MAX_HCA_COUNT 4\r
-\r
-/*\r
- * Configures the RMR bind evd restriction\r
- */\r
-\r
-#define DAPL_RMR_BIND_EVD_RESTRICTION DAT_RMR_EVD_SAME_AS_REQUEST_EVD\r
-\r
-/*\r
- * special qp_state indicating the EP does not have a QP attached yet\r
- */\r
-#define DAPL_QP_STATE_UNATTACHED 0xFFF0\r
-\r
-#define DAPL_MAX_PRIVATE_DATA_SIZE 256\r
-\r
-/*********************************************************************\r
- * *\r
- * Macros *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * Simple macro to verify a handle is bad. Conditions:\r
- * - pointer is NULL\r
- * - pointer is not word aligned\r
- * - pointer's magic number is wrong\r
- */\r
-#define DAPL_BAD_HANDLE(h, magicNum) ( \\r
- ((h) == NULL) || \\r
- ((DAT_UVERYLONG)(h) & 3) || \\r
- (((DAPL_HEADER *)(h))->magic != (magicNum)))\r
-\r
-#define DAPL_MIN(a, b) ((a < b) ? (a) : (b))\r
-#define DAPL_MAX(a, b) ((a > b) ? (a) : (b))\r
-\r
-#if NDEBUG > 0\r
-#define DEBUG_IS_BAD_HANDLE(h, magicNum) (DAPL_BAD_HANDLE(h, magicNum))\r
-#else\r
-#define DEBUG_IS_BAD_HANDLE(h, magicNum) (0)\r
-#endif\r
-\r
-#define DAT_ERROR(Type, SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))\r
-\r
-/*********************************************************************\r
- * *\r
- * Typedefs *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct dapl_llist_entry DAPL_LLIST_ENTRY;\r
-typedef DAPL_LLIST_ENTRY * DAPL_LLIST_HEAD;\r
-typedef struct dapl_ring_buffer DAPL_RING_BUFFER;\r
-typedef struct dapl_cookie_buffer DAPL_COOKIE_BUFFER;\r
-\r
-typedef struct dapl_hash_table DAPL_HASH_TABLE;\r
-typedef struct dapl_hash_table *DAPL_HASH_TABLEP;\r
-typedef DAT_UINT64 DAPL_HASH_KEY;\r
-typedef void * DAPL_HASH_DATA;\r
-\r
-typedef struct dapl_hca DAPL_HCA;\r
-\r
-typedef struct dapl_header DAPL_HEADER;\r
-\r
-typedef struct dapl_ia DAPL_IA;\r
-typedef struct dapl_cno DAPL_CNO;\r
-typedef struct dapl_evd DAPL_EVD;\r
-typedef struct dapl_ep DAPL_EP;\r
-typedef struct dapl_pz DAPL_PZ;\r
-typedef struct dapl_lmr DAPL_LMR;\r
-typedef struct dapl_rmr DAPL_RMR;\r
-typedef struct dapl_sp DAPL_SP;\r
-typedef struct dapl_cr DAPL_CR;\r
-\r
-typedef struct dapl_cookie DAPL_COOKIE;\r
-typedef struct dapl_dto_cookie DAPL_DTO_COOKIE;\r
-typedef struct dapl_rmr_cookie DAPL_RMR_COOKIE;\r
-\r
-typedef struct dapl_private DAPL_PRIVATE;\r
-\r
-typedef void (*DAPL_CONNECTION_STATE_HANDLER) (\r
- IN DAPL_EP *,\r
- IN ib_cm_events_t,\r
- IN const void *,\r
- OUT DAT_EVENT *);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Structures *\r
- * *\r
- *********************************************************************/\r
-\r
-struct dapl_llist_entry\r
-{\r
- struct dapl_llist_entry *flink;\r
- struct dapl_llist_entry *blink;\r
- void *data;\r
- DAPL_LLIST_HEAD *list_head; /* for consistency checking */\r
-};\r
-\r
-struct dapl_ring_buffer\r
-{\r
- void **base; /* base of element array */\r
- DAT_COUNT lim; /* mask, number of entries - 1 */\r
- DAPL_ATOMIC head; /* head pointer index */\r
- DAPL_ATOMIC tail; /* tail pointer index */\r
-};\r
-\r
-struct dapl_cookie_buffer\r
-{\r
- DAPL_OS_LOCK lock;\r
- DAPL_COOKIE *pool;\r
- DAT_COUNT pool_size;\r
- DAPL_ATOMIC head;\r
- DAPL_ATOMIC tail;\r
-};\r
-\r
-struct dapl_hca\r
-{\r
- DAPL_OS_LOCK lock;\r
- DAPL_LLIST_HEAD ia_list_head;\r
- DAPL_EVD *async_evd;\r
- DAPL_EVD *async_error_evd;\r
- DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/\r
- /* Values specific to IB OS API */\r
- IB_HCA_NAME name;\r
- ib_hca_handle_t ib_hca_handle;\r
- DAPL_ATOMIC handle_ref_count; /* count of ia_opens on handle */\r
- ib_hca_port_t port_num; /* number of physical port */\r
- ib_uint32_t partition_max;\r
- ib_guid_t node_GUID;\r
- ib_lid_t lid;\r
- ib_cqd_handle_t ib_cqd_handle; /* cq domain handle */\r
- ib_cq_handle_t null_ib_cq_handle; /* CQ handle with 0 entries */\r
- /* Memory Subsystem Support */\r
- DAPL_HASH_TABLE *lmr_hash_table;\r
- /* Limits & useful HCA attributes */\r
- DAT_IA_ATTR ia_attr;\r
- /* Name service support */\r
- void *name_service_handle; /* handle to name service */\r
-};\r
-\r
-/* DAPL Objects always have the following header */\r
-struct dapl_header\r
-{\r
- DAT_PROVIDER *provider; /* required by DAT - must be first */\r
- DAPL_MAGIC magic; /* magic number for verification */\r
- DAT_HANDLE_TYPE handle_type; /* struct type */\r
- DAPL_IA *owner_ia; /* ia which owns this stuct */\r
- DAPL_LLIST_ENTRY ia_list_entry; /* link entry on ia struct */\r
- DAT_CONTEXT user_context; /* user context - opaque to DAPL */\r
- DAPL_OS_LOCK lock; /* lock - in header for easier macros */\r
-};\r
-\r
-/* DAPL_IA maps to DAT_IA_HANDLE */\r
-struct dapl_ia\r
-{\r
- DAPL_HEADER header;\r
- DAPL_HCA *hca_ptr;\r
- DAPL_EVD *async_error_evd;\r
- DAT_BOOLEAN cleanup_async_error_evd;\r
-\r
- DAPL_LLIST_ENTRY hca_ia_list_entry; /* HCAs list of IAs */\r
- DAPL_LLIST_HEAD ep_list_head; /* EP queue */\r
- DAPL_LLIST_HEAD lmr_list_head; /* LMR queue */\r
- DAPL_LLIST_HEAD rmr_list_head; /* RMR queue */\r
- DAPL_LLIST_HEAD pz_list_head; /* PZ queue */\r
- DAPL_LLIST_HEAD evd_list_head; /* EVD queue */\r
- DAPL_LLIST_HEAD cno_list_head; /* CNO queue */\r
- DAPL_LLIST_HEAD psp_list_head; /* PSP queue */\r
- DAPL_LLIST_HEAD rsp_list_head; /* RSP queue */\r
-};\r
-\r
-/* DAPL_CNO maps to DAT_CNO_HANDLE */\r
-struct dapl_cno\r
-{\r
- DAPL_HEADER header;\r
-\r
- /* A CNO cannot be freed while it is referenced elsewhere. */\r
- DAPL_ATOMIC cno_ref_count;\r
- DAPL_CNO_STATE cno_state;\r
-\r
- DAT_COUNT cno_waiters;\r
- DAPL_EVD *cno_evd_triggered;\r
- DAT_OS_WAIT_PROXY_AGENT cno_wait_agent;\r
-\r
- DAPL_OS_WAIT_OBJECT cno_wait_object;\r
-};\r
-\r
-/* DAPL_EVD maps to DAT_EVD_HANDLE */\r
-struct dapl_evd\r
-{\r
- DAPL_HEADER header;\r
-\r
- DAPL_EVD_STATE evd_state;\r
- DAT_EVD_FLAGS evd_flags;\r
- DAT_BOOLEAN evd_enabled; /* For attached CNO. */\r
- DAT_BOOLEAN evd_waitable; /* EVD state. */\r
-\r
- /* Derived from evd_flags; see dapls_evd_internal_create. */\r
- DAT_BOOLEAN evd_producer_locking_needed;\r
-\r
- /* Every EVD has a CQ unless it is a SOFTWARE_EVENT only EVD */\r
- ib_cq_handle_t ib_cq_handle;\r
-\r
- /* Mellanox Specific completion handle for registration/de-registration */\r
- ib_comp_handle_t ib_comp_handle;\r
-\r
- /* An Event Dispatcher cannot be freed while\r
- * it is referenced elsewhere.\r
- */\r
- DAPL_ATOMIC evd_ref_count;\r
-\r
- /* Set if there has been a catastrophic overflow */\r
- DAT_BOOLEAN catastrophic_overflow;\r
-\r
- /* the actual events */\r
- DAT_COUNT qlen;\r
- DAT_EVENT *events;\r
- DAPL_RING_BUFFER free_event_queue;\r
- DAPL_RING_BUFFER pending_event_queue;\r
-\r
- /* CQ Completions are not placed into 'deferred_events'\r
- ** rather they are simply left on the Completion Queue\r
- ** and the fact that there was a notification is flagged.\r
- */\r
- DAT_BOOLEAN cq_notified;\r
- DAPL_OS_TICKS cq_notified_when;\r
- cl_waitobj_handle_t cq_wait_obj_handle;\r
-\r
- DAT_COUNT cno_active_count;\r
- DAPL_CNO *cno_ptr;\r
-\r
- DAPL_OS_WAIT_OBJECT wait_object;\r
- DAT_COUNT threshold;\r
- DAPL_EVD_COMPLETION completion_type;\r
-};\r
-\r
-\r
-\r
-/* uDAPL timer entry, used to queue timeouts */\r
-struct dapl_timer_entry\r
-{\r
- DAPL_LLIST_ENTRY list_entry; /* link entry on ia struct */\r
- DAPL_OS_TIMEVAL expires;\r
- void (*function)(void*);\r
- void *data;\r
-};\r
-\r
-#ifdef DAPL_DBG_IO_TRC\r
-\r
-#define DBG_IO_TRC_QLEN 32 /* length of trace buffer */\r
-#define DBG_IO_TRC_IOV 3 /* iov elements we keep track of */\r
-\r
-struct io_buf_track\r
-{\r
- Ib_send_op_type op_type;\r
- DAPL_COOKIE *cookie;\r
- DAT_LMR_TRIPLET iov[DBG_IO_TRC_IOV];\r
- DAT_RMR_TRIPLET remote_iov;\r
- unsigned int done; /* count to track completion ordering */\r
- int status;\r
- void *wqe;\r
-};\r
-\r
-#endif /* DAPL_DBG_IO_TRC */\r
-\r
-/* DAPL_EP maps to DAT_EP_HANDLE */\r
-struct dapl_ep\r
-{\r
- DAPL_HEADER header;\r
- /* What the DAT Consumer asked for */\r
- DAT_EP_PARAM param;\r
-\r
- /* The RC Queue Pair (IBM OS API) */\r
- ib_qp_handle_t qp_handle;\r
- unsigned int qpn; /* qp number */\r
- ib_qp_state_t qp_state;\r
-\r
- /* communications manager handle (IBM OS API) */\r
- ib_cm_handle_t cm_handle;\r
- /* store the remote IA address here, reference from the param\r
- * struct which only has a pointer, no storage\r
- */\r
- DAT_SOCK_ADDR6 remote_ia_address;\r
-\r
- /* For passive connections we maintain a back pointer to the CR */\r
- void * cr_ptr;\r
-\r
- /* pointer to connection timer, if set */\r
- struct dapl_timer_entry *cxn_timer;\r
-\r
- /* private data container */\r
- unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];\r
-\r
- /* DTO data */\r
- DAPL_ATOMIC req_count;\r
- DAPL_ATOMIC recv_count;\r
-\r
- DAPL_COOKIE_BUFFER req_buffer;\r
- DAPL_COOKIE_BUFFER recv_buffer;\r
-\r
- ib_data_segment_t *recv_iov;\r
- DAT_COUNT recv_iov_num;\r
-\r
- ib_data_segment_t *send_iov;\r
- DAT_COUNT send_iov_num;\r
- DAT_BOOLEAN recv_discreq;\r
- DAT_BOOLEAN sent_discreq;\r
- DAT_BOOLEAN viol_order;\r
- DAPL_RING_BUFFER viol_event_queue;\r
-#ifdef DAPL_DBG_IO_TRC\r
- int ibt_dumped;\r
- struct io_buf_track *ibt_base;\r
- DAPL_RING_BUFFER ibt_queue;\r
-#endif /* DAPL_DBG_IO_TRC */\r
-};\r
-\r
-/* DAPL_PZ maps to DAT_PZ_HANDLE */\r
-struct dapl_pz\r
-{\r
- DAPL_HEADER header;\r
- ib_pd_handle_t pd_handle;\r
- DAPL_ATOMIC pz_ref_count;\r
-};\r
-\r
-/* DAPL_LMR maps to DAT_LMR_HANDLE */\r
-struct dapl_lmr\r
-{\r
- DAPL_HEADER header;\r
- DAT_LMR_PARAM param;\r
- ib_mr_handle_t mr_handle;\r
- DAPL_ATOMIC lmr_ref_count;\r
- ib_shmid_t ib_shmid;\r
-};\r
-\r
-/* DAPL_RMR maps to DAT_RMR_HANDLE */\r
-struct dapl_rmr\r
-{\r
- DAPL_HEADER header;\r
- DAT_RMR_PARAM param;\r
- DAPL_EP *ep;\r
- DAPL_PZ *pz;\r
- DAPL_LMR *lmr;\r
- ib_mw_handle_t mw_handle;\r
-};\r
-\r
-/* SP types, indicating the state and queue */\r
-typedef enum dapl_sp_state\r
-{\r
- DAPL_SP_STATE_FREE,\r
- DAPL_SP_STATE_PSP_LISTENING,\r
- DAPL_SP_STATE_PSP_PENDING,\r
- DAPL_SP_STATE_RSP_LISTENING,\r
- DAPL_SP_STATE_RSP_PENDING\r
-} DAPL_SP_STATE;\r
-\r
-/* DAPL_SP maps to DAT_PSP_HANDLE and DAT_RSP_HANDLE */\r
-struct dapl_sp\r
-{\r
- DAPL_HEADER header;\r
- DAPL_SP_STATE state; /* type and queue of the SP */\r
-\r
- /* PSP/RSP PARAM fields */\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_CONN_QUAL conn_qual;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_PSP_FLAGS psp_flags;\r
- DAT_EP_HANDLE ep_handle;\r
-\r
- /* wait object needed for SP destroy */\r
- DAPL_OS_WAIT_OBJECT wait_object;\r
-\r
- /* maintenence fields */\r
- DAT_BOOLEAN listening; /* PSP is registered & active */\r
- ib_cm_srvc_handle_t cm_srvc_handle; /* Used by VAPI CM */\r
- DAPL_LLIST_HEAD cr_list_head; /* CR pending queue */\r
- DAT_COUNT cr_list_count; /* count of CRs on queue */\r
-};\r
-\r
-/* DAPL_CR maps to DAT_CR_HANDLE */\r
-struct dapl_cr\r
-{\r
- DAPL_HEADER header;\r
-\r
- /* for convenience the data is kept as a DAT_CR_PARAM.\r
- * however, the "local_endpoint" field is always NULL\r
- * so this wastes a pointer. This is probably ok to\r
- * simplify code, espedially dat_cr_query.\r
- */\r
- DAT_CR_PARAM param;\r
- /* IB specific fields */\r
- ib_cm_handle_t ib_cm_handle;\r
-\r
- DAT_SOCK_ADDR6 remote_ia_address;\r
- /* Assuming that the maximum private data size is small.\r
- * If it gets large, use of a pointer may be appropriate.\r
- */\r
- unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];\r
- /*\r
- * Need to be able to associate the CR back to the PSP for\r
- * dapl_cr_reject.\r
- */\r
- DAPL_SP *sp_ptr;\r
-};\r
-\r
-typedef enum dapl_dto_type\r
-{\r
- DAPL_DTO_TYPE_SEND,\r
- DAPL_DTO_TYPE_RECV,\r
- DAPL_DTO_TYPE_RDMA_WRITE,\r
- DAPL_DTO_TYPE_RDMA_READ,\r
-} DAPL_DTO_TYPE;\r
-\r
-typedef enum dapl_cookie_type\r
-{\r
- DAPL_COOKIE_TYPE_NULL,\r
- DAPL_COOKIE_TYPE_DTO,\r
- DAPL_COOKIE_TYPE_RMR,\r
-} DAPL_COOKIE_TYPE;\r
-\r
-/* DAPL_DTO_COOKIE used as context for DTO WQEs */\r
-struct dapl_dto_cookie\r
-{\r
- DAPL_DTO_TYPE type;\r
- DAT_DTO_COOKIE cookie;\r
- DAT_COUNT size; /* used for SEND and RDMA write */\r
-};\r
-\r
-/* DAPL_RMR_COOKIE used as context for bind WQEs */\r
-struct dapl_rmr_cookie\r
-{\r
- DAPL_RMR *rmr;\r
- DAT_RMR_COOKIE cookie;\r
-};\r
-\r
-/* DAPL_COOKIE used as context for WQEs */\r
-struct dapl_cookie\r
-{\r
- DAPL_COOKIE_TYPE type; /* Must be first, to define struct. */\r
- DAPL_EP *ep;\r
- DAT_COUNT index;\r
- union\r
- {\r
- DAPL_DTO_COOKIE dto;\r
- DAPL_RMR_COOKIE rmr;\r
- } val;\r
-};\r
-\r
-/* DAPL_PRIVATE used to pass private data in a connection */\r
-struct dapl_private\r
-{\r
-#ifdef NO_NAME_SERVICE\r
- DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/\r
-#endif\r
- unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];\r
-};\r
-\r
-/*\r
- * Private Data operations. Used to obtain the size of the private\r
- * data from the provider layer.\r
- */\r
-typedef enum dapl_private_data_op\r
-{\r
- DAPL_PDATA_CONN_REQ = 0, /* connect request */\r
- DAPL_PDATA_CONN_REP = 1, /* connect reply */\r
- DAPL_PDATA_CONN_REJ = 2, /* connect reject */\r
- DAPL_PDATA_CONN_DREQ = 3, /* disconnect request */\r
- DAPL_PDATA_CONN_DREP = 4, /* disconnect reply */\r
-} DAPL_PDATA_OP;\r
-\r
-\r
-/*\r
- * Generic HCA name field\r
- */\r
-#define DAPL_HCA_NAME_MAX_LEN 260\r
-typedef char DAPL_HCA_NAME[DAPL_HCA_NAME_MAX_LEN+1];\r
-\r
-#ifdef NO_NAME_SERVICE\r
-\r
-/*\r
- * Simple mapping table to match IP addresses to GIDs. Loaded\r
- * by dapl_init.\r
- */\r
-typedef struct _dapl_gid_map_table {\r
- uint32_t ip_address;\r
- GID gid;\r
-} DAPL_GID_MAP;\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-/*\r
- * IBTA defined reason for reject message: See IBTA 1.1 specification,\r
- * 12.6.7.2 REJECTION REASON section.\r
- */\r
-#define IB_CM_REJ_REASON_CONSUMER_REJ 0x001C\r
-\r
-\r
-#if defined(DAPL_DBG_IO_TRC)\r
-/*********************************************************************\r
- * *\r
- * Debug I/O tracing support prototypes *\r
- * *\r
- *********************************************************************/\r
-/*\r
- * I/O tracing support\r
- */\r
-void dapls_io_trc_alloc (\r
- DAPL_EP *ep_ptr);\r
-\r
-void dapls_io_trc_update_completion (\r
- DAPL_EP *ep_ptr,\r
- DAPL_COOKIE *cookie,\r
- ib_uint32_t ib_status );\r
-\r
-void dapls_io_trc_dump (\r
- DAPL_EP *ep_ptr,\r
- ib_work_completion_t *cqe_ptr,\r
- ib_uint32_t ib_status);\r
-\r
-#else /* DAPL_DBG_IO_TRC */\r
-\r
-#define dapls_io_trc_alloc(a)\r
-#define dapls_io_trc_update_completion(a, b, c)\r
-#define dapls_io_trc_dump(a, b, c)\r
-\r
-#endif /* DAPL_DBG_IO_TRC */\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * DAT Mandated functions\r
- */\r
-\r
-extern DAT_RETURN DAT_API dapl_ia_open (\r
- IN const DAT_NAME_PTR, /* name */\r
- IN DAT_COUNT, /* asynch_evd_qlen */\r
- INOUT DAT_EVD_HANDLE *, /* asynch_evd_handle */\r
- OUT DAT_IA_HANDLE * ); /* ia_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_ia_close (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CLOSE_FLAGS ); /* ia_flags */\r
-\r
-\r
-extern DAT_RETURN DAT_API dapl_ia_query (\r
- IN DAT_IA_HANDLE, /* ia handle */\r
- OUT DAT_EVD_HANDLE *, /* async_evd_handle */\r
- IN DAT_IA_ATTR_MASK, /* ia_params_mask */\r
- OUT DAT_IA_ATTR *, /* ia_params */\r
- IN DAT_PROVIDER_ATTR_MASK, /* provider_params_mask */\r
- OUT DAT_PROVIDER_ATTR * ); /* provider_params */\r
-\r
-\r
-/* helper functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_set_consumer_context (\r
- IN DAT_HANDLE, /* dat handle */\r
- IN DAT_CONTEXT); /* context */\r
-\r
-extern DAT_RETURN DAT_API dapl_get_consumer_context (\r
- IN DAT_HANDLE, /* dat handle */\r
- OUT DAT_CONTEXT * ); /* context */\r
-\r
-extern DAT_RETURN DAT_API dapl_get_handle_type (\r
- IN DAT_HANDLE,\r
- OUT DAT_HANDLE_TYPE * );\r
-\r
-/* CNO functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT, /* agent */\r
- OUT DAT_CNO_HANDLE *); /* cno_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_modify_agent (\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT); /* agent */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_query (\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_CNO_PARAM_MASK, /* cno_param_mask */\r
- OUT DAT_CNO_PARAM * ); /* cno_param */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_free (\r
- IN DAT_CNO_HANDLE); /* cno_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_wait (\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_TIMEOUT, /* timeout */\r
- OUT DAT_EVD_HANDLE *); /* evd_handle */\r
-\r
-/* CR Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_cr_query (\r
- IN DAT_CR_HANDLE, /* cr_handle */\r
- IN DAT_CR_PARAM_MASK, /* cr_args_mask */\r
- OUT DAT_CR_PARAM * ); /* cwr_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_cr_accept (\r
- IN DAT_CR_HANDLE, /* cr_handle */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID ); /* private_data */\r
-\r
-extern DAT_RETURN DAT_API dapl_cr_reject (\r
- IN DAT_CR_HANDLE );\r
-\r
-extern DAT_RETURN DAT_API dapl_cr_handoff (\r
- IN DAT_CR_HANDLE, /* cr_handle */\r
- IN DAT_CONN_QUAL); /* handoff */\r
-\r
-/* EVD Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_COUNT, /* evd_min_qlen */\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_EVD_FLAGS, /* evd_flags */\r
- OUT DAT_EVD_HANDLE * ); /* evd_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_query (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_EVD_PARAM_MASK, /* evd_args_mask */\r
- OUT DAT_EVD_PARAM * ); /* evd_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_modify_cno (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_CNO_HANDLE); /* cno_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_enable (\r
- IN DAT_EVD_HANDLE); /* evd_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_disable (\r
- IN DAT_EVD_HANDLE); /* evd_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_wait (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_TIMEOUT, /* timeout */\r
- IN DAT_COUNT, /* threshold */\r
- OUT DAT_EVENT *, /* event */\r
- OUT DAT_COUNT *); /* nmore */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_resize (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_COUNT ); /* evd_qlen */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_wait (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_TIMEOUT, /* timeout */\r
- IN DAT_COUNT, /* threshold */\r
- OUT DAT_EVENT *, /* event */\r
- OUT DAT_COUNT *); /* nmore */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_post_se (\r
- DAT_EVD_HANDLE, /* evd_handle */\r
- const DAT_EVENT * ); /* event */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_dequeue (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- OUT DAT_EVENT * ); /* event */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_free (\r
- IN DAT_EVD_HANDLE );\r
-\r
-extern DAT_RETURN DAT_API\r
-dapl_evd_set_unwaitable (\r
- IN DAT_EVD_HANDLE evd_handle );\r
-\r
-extern DAT_RETURN DAT_API\r
-dapl_evd_clear_unwaitable (\r
- IN DAT_EVD_HANDLE evd_handle );\r
-\r
-/* EP functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_EVD_HANDLE, /* in_dto_completion_evd_handle */\r
- IN DAT_EVD_HANDLE, /* out_dto_completion_evd_handle */\r
- IN DAT_EVD_HANDLE, /* connect_evd_handle */\r
- IN const DAT_EP_ATTR *, /* ep_parameters */\r
- OUT DAT_EP_HANDLE * ); /* ep_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_query (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_PARAM_MASK, /* ep_args_mask */\r
- OUT DAT_EP_PARAM * ); /* ep_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_modify (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_PARAM_MASK, /* ep_args_mask */\r
- IN const DAT_EP_PARAM * ); /* ep_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_connect (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_IA_ADDRESS_PTR, /* remote_ia_address */\r
- IN DAT_CONN_QUAL, /* remote_conn_qual */\r
- IN DAT_TIMEOUT, /* timeout */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID, /* private_data */\r
- IN DAT_QOS, /* quality_of_service */\r
- IN DAT_CONNECT_FLAGS ); /* connect_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_dup_connect (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_HANDLE, /* ep_dup_handle */\r
- IN DAT_TIMEOUT, /* timeout*/\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID, /* private_data */\r
- IN DAT_QOS); /* quality_of_service */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_disconnect (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_CLOSE_FLAGS ); /* disconnect_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_post_send (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_post_recv (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_post_rdma_read (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN const DAT_RMR_TRIPLET *, /* remote_iov */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_post_rdma_write (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN const DAT_RMR_TRIPLET *, /* remote_iov */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_get_status (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- OUT DAT_EP_STATE *, /* ep_state */\r
- OUT DAT_BOOLEAN *, /* in_dto_idle */\r
- OUT DAT_BOOLEAN * ); /* out_dto_idle */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_free (\r
- IN DAT_EP_HANDLE); /* ep_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_reset (\r
- IN DAT_EP_HANDLE); /* ep_handle */\r
-\r
-/* LMR functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_lmr_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_MEM_TYPE, /* mem_type */\r
- IN DAT_REGION_DESCRIPTION, /* region_description */\r
- IN DAT_VLEN, /* length */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_MEM_PRIV_FLAGS, /* privileges */\r
- OUT DAT_LMR_HANDLE *, /* lmr_handle */\r
- OUT DAT_LMR_CONTEXT *, /* lmr_context */\r
- OUT DAT_RMR_CONTEXT *, /* rmr_context */\r
- OUT DAT_VLEN *, /* registered_length */\r
- OUT DAT_VADDR * ); /* registered_address */\r
-\r
-extern DAT_RETURN DAT_API dapl_lmr_query (\r
- IN DAT_LMR_HANDLE,\r
- IN DAT_LMR_PARAM_MASK,\r
- OUT DAT_LMR_PARAM *);\r
-\r
-extern DAT_RETURN DAT_API dapl_lmr_free (\r
- IN DAT_LMR_HANDLE);\r
-\r
-/* RMR Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_rmr_create (\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- OUT DAT_RMR_HANDLE *); /* rmr_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_rmr_query (\r
- IN DAT_RMR_HANDLE, /* rmr_handle */\r
- IN DAT_RMR_PARAM_MASK, /* rmr_args_mask */\r
- OUT DAT_RMR_PARAM *); /* rmr_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_rmr_bind (\r
- IN DAT_RMR_HANDLE, /* rmr_handle */\r
- IN const DAT_LMR_TRIPLET *, /* lmr_triplet */\r
- IN DAT_MEM_PRIV_FLAGS, /* mem_priv */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_RMR_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS, /* completion_flags */\r
- INOUT DAT_RMR_CONTEXT * ); /* context */\r
-\r
-extern DAT_RETURN DAT_API dapl_rmr_free (\r
- IN DAT_RMR_HANDLE);\r
-\r
-/* PSP Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_psp_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CONN_QUAL, /* conn_qual */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_PSP_FLAGS, /* psp_flags */\r
- OUT DAT_PSP_HANDLE * ); /* psp_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_psp_create_any (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- OUT DAT_CONN_QUAL *, /* conn_qual */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_PSP_FLAGS, /* psp_flags */\r
- OUT DAT_PSP_HANDLE *); /* psp_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_psp_query (\r
- IN DAT_PSP_HANDLE,\r
- IN DAT_PSP_PARAM_MASK,\r
- OUT DAT_PSP_PARAM * );\r
-\r
-extern DAT_RETURN DAT_API dapl_psp_free (\r
- IN DAT_PSP_HANDLE ); /* psp_handle */\r
-\r
-/* RSP Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_rsp_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CONN_QUAL, /* conn_qual */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- OUT DAT_RSP_HANDLE * ); /* rsp_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_rsp_query (\r
- IN DAT_RSP_HANDLE,\r
- IN DAT_RSP_PARAM_MASK,\r
- OUT DAT_RSP_PARAM * );\r
-\r
-extern DAT_RETURN DAT_API dapl_rsp_free (\r
- IN DAT_RSP_HANDLE ); /* rsp_handle */\r
-\r
-/* PZ Functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_pz_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- OUT DAT_PZ_HANDLE * ); /* pz_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_pz_query (\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_PZ_PARAM_MASK, /* pz_args_mask */\r
- OUT DAT_PZ_PARAM * ); /* pz_args */\r
-\r
-extern DAT_RETURN DAT_API dapl_pz_free (\r
- IN DAT_PZ_HANDLE ); /* pz_handle */\r
-\r
-/*\r
- * DAPL internal utility function prototpyes\r
- */\r
-\r
-extern void dapl_llist_init_head (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-extern void dapl_llist_init_entry (\r
- DAPL_LLIST_ENTRY * entry);\r
-\r
-extern DAT_BOOLEAN dapl_llist_is_empty (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-extern void dapl_llist_add_head (\r
- DAPL_LLIST_HEAD * head, \r
- DAPL_LLIST_ENTRY * entry, \r
- void * data);\r
-\r
-extern void dapl_llist_add_tail (\r
- DAPL_LLIST_HEAD * head, \r
- DAPL_LLIST_ENTRY * entry, \r
- void * data);\r
-\r
-extern void dapl_llist_add_entry (\r
- DAPL_LLIST_HEAD * head, \r
- DAPL_LLIST_ENTRY * entry, \r
- DAPL_LLIST_ENTRY * new_entry, \r
- void * data);\r
-\r
-extern void * dapl_llist_remove_head (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-extern void * dapl_llist_remove_tail (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-extern void * dapl_llist_remove_entry (\r
- DAPL_LLIST_HEAD * head,\r
- DAPL_LLIST_ENTRY * entry);\r
-\r
-extern void * dapl_llist_peek_head (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-extern void * dapl_llist_next_entry (\r
- IN DAPL_LLIST_HEAD *head, \r
- IN DAPL_LLIST_ENTRY *cur_ent);\r
-\r
-extern void dapl_llist_debug_print_list (\r
- DAPL_LLIST_HEAD * head);\r
-\r
-\r
-#endif /* _DAPL_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_debug.h\r
- *\r
- * PURPOSE: defines common deuggging flags & data for the DAPL reference\r
- * implemenation\r
- *\r
- * Description:\r
- *\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_DEBUG_H_\r
-#define _DAPL_DEBUG_H_\r
-\r
-/*\r
- * Debug level switches\r
- *\r
- * Use these bits to enable various tracing/debug options. Each bit\r
- * represents debugging in a particular subsystem or area of the code.\r
- *\r
- * The ERR bit should always be on unless someone disables it for a\r
- * reason: The ERR flag is used sparingly and will print useful\r
- * information if it fires.\r
- */\r
-typedef enum\r
-{\r
- DAPL_DBG_TYPE_ERR = 0x0001,\r
- DAPL_DBG_TYPE_WARN = 0x0002,\r
- DAPL_DBG_TYPE_EVD = 0x0004,\r
- DAPL_DBG_TYPE_CM = 0x0008,\r
- DAPL_DBG_TYPE_EP = 0x0010,\r
- DAPL_DBG_TYPE_UTIL = 0x0020,\r
- DAPL_DBG_TYPE_CALLBACK = 0x0040,\r
- DAPL_DBG_TYPE_DTO_COMP_ERR = 0x0080,\r
- DAPL_DBG_TYPE_API = 0x0100,\r
- DAPL_DBG_TYPE_RTN = 0x0200,\r
- DAPL_DBG_TYPE_EXCEPTION = 0x0400,\r
- DAPL_DBG_TYPE_EVENT_DQ = 0x0800\r
-} DAPL_DBG_TYPE;\r
-\r
-typedef enum\r
-{\r
- DAPL_DBG_DEST_STDOUT = 0x0001,\r
- DAPL_DBG_DEST_SYSLOG = 0x0002,\r
-} DAPL_DBG_DEST;\r
-\r
-\r
-extern DAPL_DBG_TYPE g_dapl_dbg_type;\r
-extern DAPL_DBG_DEST g_dapl_dbg_dest;\r
-\r
-#if defined(DAPL_DBG)\r
-\r
-#define dapl_dbg_log g_dapl_dbg_type==0 ? (void) 1 : dapl_internal_dbg_log\r
-extern void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...);\r
-\r
-#else /* !DAPL_DBG */\r
-\r
-#define dapl_dbg_log\r
-\r
-#endif /* !DAPL_DBG */\r
-\r
-#define dapl_log g_dapl_dbg_type==0 ? (void) 1 : dapl_internal_log\r
-extern void dapl_internal_log ( DAPL_DBG_TYPE type, const char *fmt, ...);\r
-\r
-\r
-/*\r
- * Counters\r
- */\r
-#define DCNT_EP_CREATE 0\r
-#define DCNT_EP_FREE 1\r
-#define DCNT_EP_CONNECT 2\r
-#define DCNT_EP_DISCONNECT 3\r
-#define DCNT_POST_SEND 4\r
-#define DCNT_POST_RECV 5\r
-#define DCNT_POST_RDMA_WRITE 6\r
-#define DCNT_POST_RDMA_READ 7\r
-#define DCNT_EVD_CREATE 8\r
-#define DCNT_EVD_FREE 9\r
-#define DCNT_EVD_WAIT 10\r
-#define DCNT_EVD_WAIT_BLOCKED 11\r
-#define DCNT_EVD_WAIT_CMP_NTFY 12\r
-#define DCNT_EVD_DTO_CALLBACK 13\r
-#define DCNT_EVD_CONN_CALLBACK 14\r
-#define DCNT_EVD_DEQUEUE 15\r
-#define DCNT_EVD_DEQUEUE_POLL 16\r
-#define DCNT_EVD_DEQUEUE_FOUND 17\r
-#define DCNT_EVD_DEQUEUE_NOT_FOUND 18\r
-#define DCNT_TIMER_SET 19\r
-#define DCNT_TIMER_CANCEL 20\r
-#define DCNT_LAST_COUNTER 22 /* Always the last counter */\r
-\r
-#if defined(DAPL_COUNTERS)\r
-#include "dapl_counters.h"\r
-\r
-#define DAPL_CNTR(cntr) dapl_os_atomic_inc (&dapl_dbg_counters[cntr]);\r
-#else\r
-\r
-#define DAPL_CNTR(cntr)\r
-#define DAPL_COUNTERS_INIT()\r
-#define DAPL_COUNTERS_NEW(__tag, __id)\r
-#define DAPL_COUNTERS_RESET(__id, __incr)\r
-#define DAPL_COUNTERS_INCR(__id, __incr)\r
-\r
-#endif /* DAPL_COUNTERS */\r
-\r
-\r
-#endif /* _DAPL_DEBUG_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: ipoib_naming.h\r
- *\r
- * PURPOSE: Defines flags and prototypes for IPoIB API\r
- *\r
- * Description: \r
- * This defines a simple naming interface for discovering\r
- * the IP addresses available to a provider, then a set\r
- * of query mechanisms useful to map an IP address to\r
- * a provider specific address; a GID in InfiniBand.\r
- *\r
- * NOTE: As implementations mature this may not be necessary.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _IPOIB_NAMING_H_\r
-#define _IPOIB_NAMING_H_\r
-\r
-typedef enum _ipoib_port_num {\r
- HCA_PORT_1= 1,\r
- HCA_PORT_2,\r
- HCA_PORT_ANY\r
-} IPOIB_PORT_NUM;\r
-\r
-typedef struct if_query_info\r
-{\r
- uint64_t guid;\r
- uint32_t port_num;\r
- uint32_t state;\r
-}IF_QUERY_INFO;\r
-\r
-/***********************************************************************\r
- * ipoib_enum_if()\r
- *\r
- * PURPOSE\r
- * Returns count of IP interfaces. \r
- *\r
- * ARGUMENTS\r
- * hca_index: index of HCA in the provider library. In general\r
- * terms, the index represents the HCA number, e.g. \r
- * 1 == First HCA, 2 == Second HCA, etc.\r
- *\r
- * port: an enum of\r
- * HCA_PORT_0\r
- * HCA_PORT_1\r
- * HCA_PORT_ANY\r
- * HCA_PORT_ANY enum value returns all IP instances assigned to the HCA.\r
- *\r
- * RETURNS\r
- * count of IP interfaces supported on physical port\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_enum_if(\r
- IN uint32_t hca_index, \r
- IN IPOIB_PORT_NUM port);\r
-\r
- \r
-/***********************************************************************\r
- * ipoib_get_if()\r
- *\r
- * PURPOSE\r
- * Returns array of IP Addresses of all instances. Port parameter may\r
- * restrict instances of interest.\r
- * \r
- * ARGUMENTS\r
- * hca_index: index of HCA in the provider library.\r
- *\r
- * port: IPOIB_PORT_NUM as described above\r
- *\r
- * ip_addr_list: pointer to user-allocated space in which an array of\r
- * IP addresses found for this hca and port will be returned\r
- *\r
- * ip_addr_count: number of returned addresses\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_get_if(\r
- IN uint32_t hca_index,\r
- IN IPOIB_PORT_NUM port,\r
- OUT struct sockaddr **ip_addr_list,\r
- OUT int *ip_addr_count);\r
-\r
-/***********************************************************************\r
- *\r
- * PURPOSE \r
- * Returns a handle to this interface, to be used for subsequent\r
- * operations\r
- * \r
- * ARGUMENTS\r
- * ip_address: input IP address\r
- *\r
- * ipoib_handle: handle to be used in subsequent operations.\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_open_if(\r
- IN struct sockaddr *ip_address,\r
- OUT void *ipoib_handle);\r
-\r
-/***********************************************************************\r
- * ipoib_query_if()\r
- *\r
- * PURPOSE\r
- * if_query_if returns information on local ipoib_handle such as GID,\r
- * Port number, IPoIB state, anything interesting\r
- *\r
- * ARGUMENTS\r
- * ipoib_handle: handle for instance\r
- *\r
- * if_qry_info: info struct. Looks like:\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_query_if(\r
- IN void *ipoib_handle, \r
- OUT IF_QUERY_INFO *if_qry_info);\r
-\r
-/***********************************************************************\r
- *\r
- *\r
- * PURPOSE\r
- * Obtain a GID from an IP Address. Used by the active side of\r
- * a connection.\r
- *\r
- * The behavior of this routine is specified to provide control\r
- * over the underlying implementation.\r
- * Returns immediately if the remote information is available. If\r
- * callback_routine_ptr is NULL then it will block until information is\r
- * available or known to be unavailable. If callback_routine_ptr is\r
- * specified then it will be invoked when remote information is\r
- * available or known to be unavailable. Remote_Addr_info contains\r
- * remote GID information.\r
- *\r
- * ARGUMENTS\r
- * ipoib_handle: handle for instance\r
- *\r
- * remote_ip_address: IP address of remote instance\r
- *\r
- * callback_routine_ptr: routine to invoke for asynch callback. If\r
- * NULL ipoib_getaddrinfo() will block.\r
- *\r
- * context: argument to pass to asynch callback_routine.\r
- *\r
- * Remote_Addr_info: Remote GID\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_getaddrinfo(\r
- IN void *ipoib_handle,\r
- IN struct sockaddr *remote_ip_address,\r
- IN void *callback_routine_ptr,\r
- IN void *context,\r
- OUT void *Remote_Addr_info );\r
-\r
-/***********************************************************************\r
- *\r
- *\r
- * PURPOSE\r
- * Obtain an IP Address from a GID. Used by the passive side of a\r
- * connection.\r
- *\r
- * The behavior of this routine is specified to provide control over\r
- * the underlying implementation. Returns immediately if the remote\r
- * information is available. If callback_routine_ptr is NULL then it\r
- * will block until information is available or known to be\r
- * unavailable. If callback_routine_ptr is specified then it will be\r
- * invoked when remote information is available or known to be\r
- * unavailable.\r
- *\r
- * ARGUMENTS\r
- * ipoib_handle: handle for instance\r
- *\r
- * remote_gidAddr: Remote GID. It is not defined on how the application\r
- * will obtain this GID from the connection manager.\r
- *\r
- * callback_routine_ptr: \r
- * routine to invoke for async callback. If NULL\r
- * ipoib_getgidinfo() will block.\r
- *\r
- * context: argument to pass to asynch callback_routine.\r
- *\r
- * remote_ip_address:\r
- * IP address of remote instance\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_getgidinfo(\r
- IN void *ipoib_handle,\r
- IN GID *remote_gid,\r
- IN void *callback_routine_ptr,\r
- IN void *context,\r
- OUT struct sockaddr *remote_ip_address);\r
-\r
-/***********************************************************************\r
- *\r
- * PURPOSE\r
- * Release handle.\r
- *\r
- * ARGUMENTS\r
- * ipoib_handle: handle for instance\r
- *\r
- * RETURNS\r
- * 0 for SUCCESS\r
- * !0 for failure\r
- *\r
- ***********************************************************************/\r
-int\r
-ipoib_close(\r
- IN void *ipoib_handle);\r
- \r
-\r
-#endif /* _IPOIB_NAMING_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_vendor.h\r
- *\r
- * PURPOSE: \r
- * Vendor provides values for their implementation. Most of\r
- * these values are returned in the DAT_IA_ATTR parameter of\r
- * dat_ia_query()\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-/**********************************************************************\r
- * DAT_IA_ATTR attributes\r
- *\r
- * These values are used in the provider support routine\r
- * dapls_ib_query_hca (). Many of the values there are HW\r
- * specific, the the vendor should look to make sure they are\r
- * appropriate for their implementation. Specifically, \r
- * vendors are encouraged to update transport and vendor\r
- * attributes: the reference implementation sets these to NULL.\r
- */\r
-\r
-/*\r
- * Product name of the adapter.\r
- * Returned in DAT_IA_ATTR.adapter_name\r
- */\r
-#define VN_ADAPTER_NAME "Generic InfiniBand HCA"\r
-\r
-\r
-/*\r
- * Vendor name\r
- * Returned in DAT_IA_ATTR.vendor_name\r
- */\r
-#define VN_VENDOR_NAME "DAPL Reference Implementation"\r
-\r
-\r
-/**********************************************************************\r
- * PROVIDER Attributes\r
- *\r
- * These values are used in ./common/dapl_ia_query.c, in dapl_ia_query ().\r
- * The values below are the most common for vendors to change, but\r
- * there are several other values that may be updated once the\r
- * implementation becomes mature.\r
- *\r
- */\r
-\r
-/*\r
- * Provider Versions\r
- * Returned in DAT_PROVIDER_ATTR.provider_version_major and\r
- * DAT_PROVIDER_ATTR.provider_version_minor\r
- */\r
-\r
-#define VN_PROVIDER_MAJOR 1\r
-#define VN_PROVIDER_MINOR 0\r
-\r
-/*\r
- * Provider support for memory types. The reference implementation\r
- * always supports DAT_MEM_TYPE_VIRTUAL and DAT_MEM_TYPE_LMR, so\r
- * the vendor must indicate if they support DAT_MEM_TYPE_SHARED_VIRTUAL.\r
- * Set this value to '1' if DAT_MEM_TYPE_SHARED_VIRTUAL is supported.\r
- *\r
- * Returned in DAT_PROVIDER_ATTR.lmr_mem_types_supported\r
- */\r
-\r
-#define VN_MEM_SHARED_VIRTUAL_SUPPORT 1\r
-\r
-\r
-/**********************************************************************\r
- *\r
- * This value will be assigned to dev_name_prefix in ./udapl/dapl_init.c.\r
- *\r
- * DAT is designed to support multiple DAPL instances simultaneously,\r
- * with different dapl libraries originating from different providers.\r
- * There is always the possibility of name conflicts, so a dat name\r
- * prefix is provided to make a vendor's name unique. This is\r
- * especially true of the IBM Access API, which returns adapter\r
- * names that are simply ordinal numbers (e.g. 0, 1, 2). If\r
- * a vendor doesn't need or want a prefix, it should be left\r
- * as a NULL.\r
- * This works by setting up a _VENDOR_ variable in the Makefile\r
- * Values that might be used:\r
- * #define VN_PREFIX "jni" (JNI: OS Acces API)\r
- * #define VN_PREFIX "ibm" (IBM: OS Acces API)\r
- * #define VN_PREFIX "" (Mellanox: VAPI)\r
- * #define VN_PREFIX "" (Intel: IB Common API)\r
- */\r
-#if defined(_VENDOR_JNI_)\r
-#define VN_PREFIX "jni"\r
-#elif defined(_VENDOR_MELLANOX_)\r
-#define VN_PREFIX ""\r
-#elif defined(_VENDOR_IBAL_)\r
-#define VN_PREFIX ""\r
-#elif defined(_VENDOR_IBM_)\r
-#define VN_PREFIX "ibm"\r
-#else\r
-#define VN_PREFIX ""\r
-#error "Must define _VENDOR_=<vendor string> in Makefile"\r
-#endif\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#**********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for dapl reference provider for CYGWIN environment\r
-#\r
-#*********************************************************************/\r
-\r
-\r
-##############################################################\r
-# Application variables\r
-#\r
-\r
-CP = cp -p -u\r
-AS = $(CROSS_COMPILE)as\r
-LD = $(CROSS_COMPILE)link.exe\r
-CC = $(CROSS_COMPILE)cl.exe\r
-CPP = $(CC) \r
-AR = $(CROSS_COMPILE)ar\r
-NM = $(CROSS_COMPILE)nm\r
-STRIP = $(CROSS_COMPILE)strip\r
-OBJCOPY = $(CROSS_COMPILE)objcopy\r
-OBJDUMP = $(CROSS_COMPILE)objdump\r
-RANLIB = $(CROSS_COMPILE)ranlib\r
-MKDIR = mkdir -p \r
-SED = /bin/sed\r
-SHELL = /bin/sh\r
-\r
-TOPDIR = .\r
-\r
-COMMON = $(TOPDIR)/../common\r
-WINDOWS = $(TOPDIR)/windows\r
-\r
-ifeq ($(VERBS),mellanox)\r
-PROVIDER = $(TOPDIR)/../tavor\r
-PROVIDER_INCDIRS = $(MTHOME)/include\r
-else\r
-PROVIDER = $(TOPDIR)/../torrent\r
-PROVIDER_INCDIRS := ../include/ib/IBM \\r
- ../include/ib/IBM/us\r
-endif\r
-\r
-OBJ_DIR = $(TOPDIR)/Obj\r
-TARGET_DIR = $(TOPDIR)/Target\r
-\r
-SRCDIRS := \\r
- $(TOPDIR) \\r
- $(COMMON) \\r
- $(WINDOWS) \\r
- $(PROVIDER)\r
-\r
-INCDIRS := \\r
- $(SRCDIRS) \\r
- ../include \\r
- ../../dat/include \\r
- $(PROVIDER_INCDIRS)\r
-\r
-vpath %.c . ${SRCDIRS}\r
-vpath %.h . ${INCDIRS}\r
-\r
-\r
-##################################################\r
-# targets\r
-TARLIBS = dapl\r
-TARSHLIBS = dapl\r
-\r
-# data for user libraries\r
-dapl_SOURCES = $(COMMON_SRCS) $(WIN_SRCS) $(PROVIDER_SRCS) $(UDAPL_SRCS)\r
-\r
-\r
-ifeq ($(VERBS),mellanox)\r
-PROVIDER_SRCS = dapl_tavor_util.c dapl_tavor_qp.c dapl_tavor_cm.c\r
-else\r
-PROVIDER_SRCS = dapl_torrent_util.c dapl_torrent_qp.c dapl_torrent_cm.c\r
-endif\r
-\r
-UDAPL_SRCS = dapl_init.c dapl_name_service.c\r
-\r
-WIN_SRCS = dapl_osd.c\r
-\r
-COMMON_SRCS = dapl_cookie.c \\r
- dapl_cr_accept.c \\r
- dapl_cr_query.c \\r
- dapl_cr_reject.c \\r
- dapl_cr_util.c \\r
- dapl_cr_callback.c \\r
- dapl_cr_handoff.c \\r
- dapl_ep_connect.c \\r
- dapl_ep_create.c \\r
- dapl_ep_disconnect.c \\r
- dapl_ep_dup_connect.c \\r
- dapl_ep_free.c \\r
- dapl_ep_get_status.c \\r
- dapl_ep_modify.c \\r
- dapl_ep_post_rdma_read.c \\r
- dapl_ep_post_rdma_write.c \\r
- dapl_ep_post_recv.c \\r
- dapl_ep_post_send.c \\r
- dapl_ep_query.c \\r
- dapl_ep_util.c \\r
- dapl_evd_create.c \\r
- dapl_evd_dequeue.c \\r
- dapl_evd_disable.c \\r
- dapl_evd_enable.c \\r
- dapl_evd_free.c \\r
- dapl_evd_modify_cno.c \\r
- dapl_evd_post_se.c \\r
- dapl_evd_query.c \\r
- dapl_evd_resize.c \\r
- dapl_evd_wait.c \\r
- dapl_evd_util.c \\r
- dapl_evd_cq_async_error_callb.c \\r
- dapl_evd_qp_async_error_callb.c \\r
- dapl_evd_un_async_error_callb.c \\r
- dapl_evd_connection_callb.c \\r
- dapl_evd_dto_callb.c \\r
- dapl_evd_set_unwaitable.c \\r
- dapl_evd_clear_unwaitable.c \\r
- dapl_extension_util.c \\r
- dapl_get_consumer_context.c \\r
- dapl_get_handle_type.c \\r
- dapl_hash.c \\r
- dapl_hca_util.c \\r
- dapl_ia_close.c \\r
- dapl_ia_open.c \\r
- dapl_ia_query.c \\r
- dapl_ia_util.c \\r
- dapl_llist.c \\r
- dapl_lmr_create.c \\r
- dapl_lmr_free.c \\r
- dapl_lmr_query.c \\r
- dapl_lmr_util.c \\r
- dapl_mr_util.c \\r
- dapl_provider.c \\r
- dapl_sp_util.c \\r
- dapl_psp_create.c \\r
- dapl_psp_free.c \\r
- dapl_psp_query.c \\r
- dapl_pz_create.c \\r
- dapl_pz_free.c \\r
- dapl_pz_query.c \\r
- dapl_pz_util.c \\r
- dapl_rmr_create.c \\r
- dapl_rmr_free.c \\r
- dapl_rmr_bind.c \\r
- dapl_rmr_query.c \\r
- dapl_rmr_util.c \\r
- dapl_rsp_create.c \\r
- dapl_rsp_free.c \\r
- dapl_rsp_query.c \\r
- dapl_cno_create.c \\r
- dapl_cno_modify_agent.c \\r
- dapl_cno_free.c \\r
- dapl_cno_wait.c \\r
- dapl_cno_query.c \\r
- dapl_cno_util.c \\r
- dapl_set_consumer_context.c \\r
- dapl_ring_buffer_util.c \\r
- dapl_debug.c\r
-\r
-\r
-\r
-####################################################\r
-# compiler options CFLAGS\r
-#\r
-\r
-# common flags\r
-UOPTIONS += /nologo /MDd /W3 /GX /Od /FD /GZ /Gm /Zi\r
-\r
-# common defines\r
-UCOMDEFS += /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "_DEBUG" \\r
- -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 \r
-# other options: /FR /Fd\r
-\r
-# private defines\r
-UPRIVDEFS += /D "__WIN__" /D "__MSC__" /D "__i386__"\r
-\r
-CFLAGS += $(UOPTIONS) $(UCOMDEFS) $(UPRIVDEFS) \r
-\r
-#\r
-# Provider specific CFLAGS definition\r
-#\r
-\r
-CFLAGS += -DDAPL_DBG \r
-\r
-ifeq ($(VERBS),mellanox)\r
-CFLAGS += -DSMR_BUSTED -DNO_NAME_SERVICE -DCM_BUSTED # -DPOLLING_COMPLETIONS # -DMW_BUSTED \r
-CFLAGS += -DMTL_MODULE=M_dapl # -DMAX_TRACE=8 -DMAX_DEBUG=8 -DMAX_ERROR=8\r
-else\r
-CFLAGS += -DNO_NAME_SERVICE # -DCM_BUSTED\r
-endif\r
-\r
-###########################################################\r
-# common included libraries\r
-#\r
-ULDLIBS += kernel32 user32 gdi32 winspool \\r
- comdlg32 advapi32 shell32 ole32 oleaut32 \\r
- uuid odbc32 odbccp32 Ws2_32 dat\r
-\r
-#\r
-# Provider specific included libraries\r
-#\r
-ifeq ($(VERBS),mellanox)\r
-ULDLIBS += vapi mtl_common mosal mtib \\r
- mpga vapi_common mtgetopt \r
-else\r
-ULDLIBS += VerbsLibrary\r
-endif\r
-\r
-\r
-\r
-#########################################################\r
-# link options LDFLAGS\r
-#\r
-\r
-MTARFLAGS= -cr\r
-\r
-TARFLAGS += cr\r
-\r
-# common flags\r
-ULDOPTIONS += /nologo /incremental:no /machine:I386 /debug\r
-\r
-# common directories\r
-ULDDIRS += /LIBPATH:"$(OBJ_DIR)"\r
-ULDDIRS += /LIBPATH:"$(TOPDIR)/../../dat/udat/Target" \r
-\r
-# module entry\r
-ULDENTRY = /entry:DllMain\r
-\r
-# specific DLL flags\r
-ifndef NO_DEF_FILE\r
-USE_DEF_FILE = /def:$(WINDOWS)/dapl_win.def\r
-endif\r
-\r
-ifndef NO_LIB_FILE\r
-USE_LIB_FILE = $(@:%.dll=/implib:%.lib)\r
-endif\r
-\r
-ifndef NO_PDB_FILE\r
-USE_PDB_FILE = $(@:%.dll=/PDB:%.pdb)\r
-endif\r
-\r
-DLLFLAGS += $(USE_DEF_FILE) $(USE_LIB_FILE) $(USE_PDB_FILE)\r
-\r
-# DLL flags\r
-UDLLFLAGS += /dll $(DLLFLAGS) \r
-\r
-LDFLAGS += $(ULDOPTIONS) $(ULDENTRY) $(ULDDIRS) $(ULDLIBS:%=%.lib) \r
-\r
-#\r
-# Provider specific ULDFLAGS\r
-#\r
-LDFLAGS += /LIBPATH:"$(MTHOME)/lib"\r
-\r
-# user DLL\r
-LDSHFLAGS += $(LDFLAGS) $(UDLLFLAGS)\r
-\r
-\r
-\r
-#############################################################\r
-# Local functions\r
-#\r
-bsndir = $(notdir $(basename $1))\r
-\r
-############################################################\r
-# Common rules\r
-# \r
-define COMPILE\r
-$(CC) -c $(strip ${CFLAGS}) $(strip $(INCDIRS:%=-I%)) $(EXTRA_CFLAGS) $($(@:${OBJ_DIR}/%.obj=%.c_CFLAGS)) /Fo"$@" $<\r
-endef\r
-\r
-define DEF_SET_VAR_SRCS\r
-@echo "$@_VAR_SRCS += $($(basename $(call bsndir,$@))_SOURCES)" >> $@\r
-endef\r
-\r
-define DEF_SET_VAR_OBJS\r
-@echo "$@_VAR_OBJS += $($(basename $(call bsndir,$@))_OBJECTS)" >> $@\r
-endef\r
-\r
-\r
-\r
-###########################################################################\r
-# Start rules\r
-# \r
-\r
-all: $(TARSHLIBS:%=${TARGET_DIR}/%.dll) $(TAROBJS:%=${OBJ_DIR}/%.obj) $(TARLIBS:%=${TARGET_DIR}/%.lib) \r
-\r
-\r
-##########################################################################\r
-# Simple objects (user) \r
-\r
-$(TAROBJS:%=${OBJ_DIR}/%.obj): ${OBJ_DIR}/%.obj: %.c\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- $(COMPILE)\r
-\r
-$(OBJ_DIR)/%.obj: %.c\r
- $(COMPILE)\r
-\r
-\r
-##########################################################################\r
-# Static libraries \r
-# \r
-$(TARLIBS:%=$(TARGET_DIR)/%.lib): % : %.mk\r
-$(TARLIBS:%=$(TARGET_DIR)/%.lib.mk): Makefile.cygwin\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- @if [ ! -d $(TARGET_DIR) ]; then mkdir -p $(TARGET_DIR); fi\r
- @echo "# Do not edit. Automatically generated file." > $@\r
- @\r
- @${DEF_SET_VAR_OBJS}\r
- @${DEF_SET_VAR_SRCS}\r
- @\r
- @echo "SOURCES += \$$($@_VAR_SRCS)" >> $@\r
- @\r
- @echo "$(@:%.mk=%): \$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) " >> $@\r
- @echo "$(@:%.mk=%): \$$($@_VAR_OBJS:%.c=$(OBJ_DIR)/%.obj) " >> $@\r
- @echo -e "\t\$$(AR) \$$(MTARFLAGS) \$$@ \c" >> $@\r
- @echo -e "\$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) \c" >> $@\r
- @echo "\$$($@_VAR_OBJS) \$$(\$$(@:$(OBJ_DIR)/%.lib=%)_ARFLAGS) " >> $@\r
- @echo -e "\t\$$(RANLIB) \$$@" >> $@\r
-\r
-\r
-ifneq ($(MAKECMDGOALS), clean)\r
-ifneq ($(strip $(TARLIBS)),)\r
--include $(patsubst %,$(OBJ_DIR)/%.lib.mk,$(TARLIBS))\r
-endif\r
-endif\r
-\r
-\r
-##########################################################################\r
-# Shared libraries \r
-# \r
-$(TARSHLIBS:%=$(TARGET_DIR)/%.dll): % : %.mk\r
-$(TARSHLIBS:%=$(TARGET_DIR)/%.dll.mk): Makefile.cygwin\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- @if [ ! -d $(TARGET_DIR) ]; then mkdir -p $(TARGET_DIR); fi\r
- @echo "# Do not edit. Automatically generated file." > $@\r
- @\r
- @${DEF_SET_VAR_OBJS}\r
- @${DEF_SET_VAR_SRCS}\r
- @\r
- @echo "SOURCES += \$$($@_VAR_SRCS)" >> $@\r
- @\r
- @echo "$(@:%.mk=%): \$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo "$(@:%.mk=%): \$$($@_VAR_OBJS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo -e "\t\$$(LD) \$$(LDSHFLAGS) /out:\"\$$@\" \c" >> $@ \r
- @echo -e "\$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) \c" >> $@\r
- @echo -e "\$$($@_VAR_OBJS) \c" >> $@\r
- @echo -e "\$$(LDSHLIBS:%=%) \$$(LIBSHDIRS:%=/LIBPATH:%) \c" >> $@\r
-\r
-\r
-ifneq ($(MAKECMDGOALS), clean)\r
-ifneq ($(strip $(TARSHLIBS)),)\r
--include $(patsubst %,$(TARGET_DIR)/%.dll.mk,$(TARSHLIBS))\r
-endif\r
-endif\r
-\r
-\r
-##########################################################################\r
-# Clean rules \r
-# \r
-CLEANDIRS = $(OBJ_DIR) $(TARGET_DIR)\r
-\r
-CLEANFILES = *.obj *.dll *.lib *.sys *.pdb *.idb *.exp *.ilk *.sbr *.mk\r
-\r
-clean: $(CLEANDIRS)\r
- @echo deleting dump files at $(shell pwd)\r
- @rm -f $(CLEANFILES) \r
- @if [ -d $(OBJ_DIR) ] ; then rm -f $(CLEANFILES:%=$(OBJ_DIR)/%); fi\r
- @if [ -d $(TARGET_DIR) ] ; then rm -f $(CLEANFILES:%=$(TARGET_DIR)/%); fi\r
-\r
+++ /dev/null
- #\r
- # Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- #\r
- # This Software is licensed under either one of the following two licenses:\r
- #\r
- # 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- # in the file LICENSE.txt in the root directory. The license is also\r
- # available from the Open Source Initiative, see\r
- # http://www.opensource.org/licenses/cpl.php.\r
- # OR\r
- #\r
- # 2) under the terms of the "The BSD License" a copy of which is in the file\r
- # LICENSE2.txt in the root directory. The license is also available from\r
- # the Open Source Initiative, see\r
- # http://www.opensource.org/licenses/bsd-license.php.\r
- #\r
- # Licensee has the right to choose either one of the above two licenses.\r
- #\r
- # Redistributions of source code must retain both the above copyright\r
- # notice and either one of the license notices.\r
- #\r
- # Redistributions in binary form must reproduce both the above copyright\r
- # notice, either one of the license notices in the documentation\r
- # and/or other materials provided with the distribution.\r
- #\r
-\r
-#**********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for dapl reference provider\r
-#\r
-#*********************************************************************/\r
-\r
-TOPDIR = $(shell /bin/pwd)\r
-\r
-SRC_PATH = $(TOPDIR)\r
-COMMON = $(TOPDIR)/../common\r
-LINUX = $(TOPDIR)/../udapl/linux\r
-IBA_HOME = ../../..\r
-PROVIDER = $(TOPDIR)/../ibal\r
-VERBS=ibal\r
-\r
-#\r
-# Set DAPL_EXPOSE_HCA_PORTS to 1 if you want to expose HCA ports as real\r
-# names in the dat registry. This results in 3 entries for each HCA: the\r
-# basename, port 1 and port 2. For example, if my basename is "foo" the\r
-# result will be "foo", "fooa", and "foob". "foo" and "fooa" are\r
-# synonyms, they even share the same data structures.\r
-# NOTE: If DAT is using the static registry, you will need to update\r
-# dat.conf with entries for the ports; "fooa" and "foob" in our example.\r
-#\r
-DAPL_EXPOSE_HCA_PORTS=0\r
-\r
-SO_TARGET = libdapl.so.0.0\r
-SO_NAME = libdapl.so\r
-L_TARGET := libdapl.a\r
-\r
-#\r
-# CFLAGS definition\r
-#\r
-EXTRA_CFLAGS = -O $(CPPFLAGS)\r
-ifeq ($(BLD),debug)\r
-EXTRA_CFLAGS += -DDAPL_DBG\r
-endif\r
-EXTRA_CFLAGS += -DIBAL -DOLD_QP_STATE_TO_INIT # -DNO_NAME_SERVICE # \r
-EXTRA_CFLAGS += -I. \r
-EXTRA_CFLAGS += -I.. \r
-EXTRA_CFLAGS += -I../../dat/include \r
-EXTRA_CFLAGS += -I../include \r
-EXTRA_CFLAGS += -I$(PROVIDER)\r
-EXTRA_CFLAGS += -I../udapl/linux \r
-EXTRA_CFLAGS += -I../common \r
-EXTRA_CFLAGS += -Wall\r
-EXTRA_CFLAGS += -Wstrict-prototypes\r
-#EXTRA_CFLAGS += -Wmissing-prototypes\r
-#EXTRA_CFLAGS += -Wmissing-declarations\r
-EXTRA_CFLAGS += -Werror\r
-EXTRA_CFLAGS += -g3\r
-ifdef GPROF\r
-EXTRA_CFLAGS += -pg\r
-endif\r
-EXTRA_CFLAGS += -D_VENDOR_IBAL_\r
-\r
-ifeq ($(DAPL_EXPOSE_HCA_PORTS),1)\r
-EXTRA_CFLAGS += -DDAPL_EXPOSE_HCA_PORTS\r
-endif\r
-\r
-\r
-#\r
-# EXTRA_LDFLAGS definition\r
-#\r
-EXTRA_LDFLAGS += -init dapl_init\r
-EXTRA_LDFLAGS += -fini dapl_fini\r
-EXTRA_LDFLAGS += -L${IBA_HOME}/al -R${IBA_HOME}/al\r
-EXTRA_LDFLAGS += -L${IBA_HOME}/complib -R${IBA_HOME}/complib\r
-EXTRA_LDFLAGS += -lallib\r
-EXTRA_LDFLAGS += -lcomplib\r
-EXTRA_LDFLAGS += -ldl -lpthread\r
-\r
-PROVIDER_SRCS = dapl_ibal_util.c dapl_ibal_qp.c dapl_ibal_cm.c dapl_ibal_mrdb.c\r
-VPATH = $(SRC_PATH) $(COMMON) $(LINUX) $(PROVIDER)\r
-\r
-UDAPL_SRCS = dapl_init.c dapl_name_service.c dapl_timer_util.c\r
-\r
-COMMON_SRCS = dapl_cookie.c \\r
- dapl_cr_accept.c \\r
- dapl_cr_query.c \\r
- dapl_cr_reject.c \\r
- dapl_cr_util.c \\r
- dapl_cr_callback.c \\r
- dapl_cr_handoff.c \\r
- dapl_ep_connect.c \\r
- dapl_ep_create.c \\r
- dapl_ep_disconnect.c \\r
- dapl_ep_dup_connect.c \\r
- dapl_ep_free.c \\r
- dapl_ep_get_status.c \\r
- dapl_ep_modify.c \\r
- dapl_ep_post_rdma_read.c \\r
- dapl_ep_post_rdma_write.c \\r
- dapl_ep_post_recv.c \\r
- dapl_ep_post_send.c \\r
- dapl_ep_query.c \\r
- dapl_ep_reset.c \\r
- dapl_ep_util.c \\r
- dapl_evd_create.c \\r
- dapl_evd_dequeue.c \\r
- dapl_evd_disable.c \\r
- dapl_evd_enable.c \\r
- dapl_evd_free.c \\r
- dapl_evd_modify_cno.c \\r
- dapl_evd_post_se.c \\r
- dapl_evd_query.c \\r
- dapl_evd_resize.c \\r
- dapl_evd_wait.c \\r
- dapl_evd_util.c \\r
- dapl_evd_cq_async_error_callb.c \\r
- dapl_evd_qp_async_error_callb.c \\r
- dapl_evd_un_async_error_callb.c \\r
- dapl_evd_connection_callb.c \\r
- dapl_evd_dto_callb.c \\r
- dapl_evd_set_unwaitable.c \\r
- dapl_evd_clear_unwaitable.c \\r
- dapl_get_consumer_context.c \\r
- dapl_get_handle_type.c \\r
- dapl_hash.c \\r
- dapl_hca_util.c \\r
- dapl_ia_close.c \\r
- dapl_ia_open.c \\r
- dapl_ia_query.c \\r
- dapl_ia_util.c \\r
- dapl_llist.c \\r
- dapl_lmr_create.c \\r
- dapl_lmr_free.c \\r
- dapl_lmr_query.c \\r
- dapl_lmr_util.c \\r
- dapl_mr_util.c \\r
- dapl_provider.c \\r
- dapl_sp_util.c \\r
- dapl_psp_create.c \\r
- dapl_psp_create_any.c \\r
- dapl_psp_free.c \\r
- dapl_psp_query.c \\r
- dapl_pz_create.c \\r
- dapl_pz_free.c \\r
- dapl_pz_query.c \\r
- dapl_pz_util.c \\r
- dapl_rmr_create.c \\r
- dapl_rmr_free.c \\r
- dapl_rmr_bind.c \\r
- dapl_rmr_query.c \\r
- dapl_rmr_util.c \\r
- dapl_rsp_create.c \\r
- dapl_rsp_free.c \\r
- dapl_rsp_query.c \\r
- dapl_cno_create.c \\r
- dapl_cno_modify_agent.c \\r
- dapl_cno_free.c \\r
- dapl_cno_wait.c \\r
- dapl_cno_query.c \\r
- dapl_cno_util.c \\r
- dapl_set_consumer_context.c \\r
- dapl_ring_buffer_util.c \\r
- dapl_debug.c\r
-\r
-LINUX_SRCS = dapl_osd.c\r
-\r
-UDAPL_OBJS = $(UDAPL_SRCS:%.c=%.o)\r
-COMMON_OBJS = $(COMMON_SRCS:%.c=%.o)\r
-LINUX_OBJS = $(LINUX_SRCS:%.c=%.o)\r
-PROVIDER_OBJS = $(PROVIDER_SRCS:%.c=%.o)\r
-\r
-DAPL_OBJS = $(UDAPL_OBJS) $(COMMON_OBJS) $(LINUX_OBJS) $(PROVIDER_OBJS)\r
-\r
-S_OBJS = $(DAPL_OBJS)\r
-L_OBJS = $(S_OBJS)\r
-\r
-include $(IBA_HOME)/Makefile.config\r
-include $(IBA_HOME)/Makefile.rules\r
+++ /dev/null
-#\r
-# Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
-# \r
-# This Software is licensed under the terms of the "IBM Common Public\r
-# License 1.0" a copy of which is in the file LICENSE.txt in the\r
-# root directory. The license is also available from the Open Source\r
-# Initiative, see http://www.opensource.org/licenses/ibmpl.html.\r
-#\r
-#\r
-\r
-#**********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for dapl reference provider\r
-#\r
-# $Id$\r
-#*********************************************************************/\r
-\r
-TOPDIR = $(shell /bin/pwd)\r
-\r
-SRC_PATH = $(TOPDIR)\r
-OBJ_PATH = $(TOPDIR)/Obj\r
-TARGET_PATH = $(TOPDIR)/Target\r
-\r
-TARGET = $(TARGET_PATH)/libdapl.so\r
-STATIC = $(TARGET_PATH)/libdapl.a\r
-COMMON = $(TOPDIR)/../common\r
-LINUX = $(TOPDIR)/../udapl/linux\r
-\r
-CC = gcc\r
-\r
-#\r
-# Set DAPL_EXPOSE_HCA_PORTS to 1 if you want to expose HCA ports as real\r
-# names in the dat registry. This results in 3 entries for each HCA: the\r
-# basename, port 1 and port 2. For example, if my basename is "foo" the\r
-# result will be "foo", "fooa", and "foob". "foo" and "fooa" are\r
-# synonyms, they even share the same data structures.\r
-# NOTE: If DAT is using the static registry, you will need to update\r
-# dat.conf with entries for the ports; "fooa" and "foob" in our example.\r
-#\r
-DAPL_EXPOSE_HCA_PORTS=0\r
-\r
-\r
-#\r
-# CFLAGS definition\r
-#\r
-\r
-CFLAGS = -O $(CPPFLAGS) -DDAPL_DBG\r
-ifeq ($(VERBS),mellanox)\r
-DAPL_IBLIB_DIR = /usr/mellanox/lib\r
-PROVIDER = $(TOPDIR)/../vapi\r
-CFLAGS += -DVAPI -DSMR_BUSTED -DNO_NAME_SERVICE -DOLD_QP_STATE_TO_INIT # -DCM_BUSTED # -DMW_BUSTED \r
-else\r
-ifeq ($(VERBS),ibal)\r
-DAPL_IBLIB_DIR = $(LD_LIBRARY_PATH)\r
-KERVER =$(shell uname -r)\r
-PROVIDER = $(TOPDIR)/../ibal\r
-CFLAGS += -DIBAL -DOLD_QP_STATE_TO_INIT # -DNO_NAME_SERVICE \r
-else\r
-PROVIDER = $(TOPDIR)/../ibapi\r
-CFLAGS += -DIBAPI #-DNO_NAME_SERVICE # -DCM_BUSTED\r
-endif\r
-endif\r
-\r
-CFLAGS += -I. \r
-CFLAGS += -I.. \r
-CFLAGS += -I../../dat/include \r
-CFLAGS += -I../include \r
-\r
-ifeq ($(VERBS),mellanox)\r
-CFLAGS += -I/usr/mellanox/include\r
-#CFLAGS += -I../include/ib/MELLANOX\r
-else\r
-ifeq ($(VERBS),ibal)\r
-CFLAGS += -I../include/ib/IBAL/\r
-CFLAGS += -I../include/ib/IBAL/iba\r
-CFLAGS += -I/usr/src/linux-$(KERVER)/include\r
-CFLAGS += -DCONFIG_X86\r
-else\r
-CFLAGS += -I../include/ib/IBM \r
-CFLAGS += -I../include/ib/IBM/us\r
-endif\r
-endif\r
-\r
-CFLAGS += -I$(PROVIDER)\r
-CFLAGS += -I../udapl/linux \r
-CFLAGS += -I../common \r
-CFLAGS += -Wall\r
-CFLAGS += -Wstrict-prototypes\r
-CFLAGS += -Wmissing-prototypes\r
-CFLAGS += -Wmissing-declarations\r
-CFLAGS += -Werror\r
-CFLAGS += -g3\r
-ifdef GPROF\r
-CFLAGS += -pg\r
-endif\r
-\r
-LD = ld\r
-\r
-#\r
-# LDFLAGS definition\r
-#\r
-LDFLAGS = -shared\r
-LDFLAGS += -lpthread\r
-LDFLAGS += -init dapl_init\r
-LDFLAGS += -fini dapl_fini\r
-\r
-AR = ar\r
-#\r
-# ARFLAGS definition\r
-#\r
-ARFLAGS = r\r
-\r
-#\r
-# To build with IBM verbs: make VERBS=ibm\r
-# To build with JNI verbs: make VERBS=jni [default]\r
-# To build with PSC verbs: make VERBS=psc\r
-#\r
-# Verb libraries should be in /usr/lib\r
-#\r
-#\r
-# Vendor string, _VENDOR_<vendor name>: define for HCA vendor. If you\r
-# add a new vendor name, you must add a new prefix to dev_name_prefix in\r
-# dapl_init.c\r
-#\r
-\r
-# Allow specification in the environment of a location for the\r
-# verbs library, to allow running DAPL without installing \r
-# the verbs library in /usr/lib. For development.\r
-ifneq (${DAPL_IBLIB_DIR},)\r
-LDFLAGS += -L${DAPL_IBLIB_DIR} -R${DAPL_IBLIB_DIR}\r
-endif\r
-\r
-ifeq ($(VERBS),ibm)\r
-CFLAGS += -D_VENDOR_IBM_\r
-CFLAGS += -D_IBM -DIBM\r
-LDFLAGS += -lIBusd\r
-LDFLAGS += -lIBlueHCAd \r
-LDFLAGS += -ldl\r
-PROVIDER_SRCS = dapl_ibapi_util.c dapl_ibapi_qp.c dapl_ibapi_cm.c\r
-else \r
-ifeq ($(VERBS),mellanox)\r
-CFLAGS += -D_VENDOR_MELLANOX_\r
-CFLAGS += -DMTL_MODULE=M_dapl -DMAX_TRACE=8 -DMAX_DEBUG=8 -DMAX_ERROR=8\r
-PROVIDER_SRCS = dapl_vapi_util.c dapl_vapi_qp.c dapl_vapi_cm.c\r
-LDFLAGS += -lvapi\r
-LDFLAGS += -lmpga\r
-LDFLAGS += -lmtl_common\r
-LDFLAGS += -lcm\r
-else\r
-ifeq ($(VERBS),ibal)\r
-CFLAGS += -D_VENDOR_IBAL_\r
-PROVIDER_SRCS = dapl_ibal_util.c dapl_ibal_qp.c dapl_ibal_cm.c \r
-PROVIDER_SRCS += dapl_ibal_mrdb.c\r
-LDFLAGS += -lallib\r
-LDFLAGS += -lcomplib\r
-LDFLAGS += -ldl\r
-else\r
-CFLAGS += -D_VENDOR_JNI_ # -DIPOIB_NAMING\r
-CFLAGS += -DJNI # -DPOLLING_COMPLETIONS\r
-LDFLAGS += -lJniTavorVerbs\r
-LDFLAGS += -lpthread\r
-PROVIDER_SRCS = dapl_ibapi_util.c dapl_ibapi_qp.c dapl_ibapi_cm.c\r
-endif\r
-endif\r
-endif\r
-\r
-ifeq ($(DAPL_EXPOSE_HCA_PORTS),1)\r
-CFLAGS += -DDAPL_EXPOSE_HCA_PORTS\r
-endif\r
-\r
-UDAPL_SRCS = dapl_init.c dapl_name_service.c dapl_timer_util.c\r
-\r
-COMMON_SRCS = dapl_cookie.c \\r
- dapl_cr_accept.c \\r
- dapl_cr_query.c \\r
- dapl_cr_reject.c \\r
- dapl_cr_util.c \\r
- dapl_cr_callback.c \\r
- dapl_cr_handoff.c \\r
- dapl_ep_connect.c \\r
- dapl_ep_create.c \\r
- dapl_ep_disconnect.c \\r
- dapl_ep_dup_connect.c \\r
- dapl_ep_free.c \\r
- dapl_ep_get_status.c \\r
- dapl_ep_modify.c \\r
- dapl_ep_post_rdma_read.c \\r
- dapl_ep_post_rdma_write.c \\r
- dapl_ep_post_recv.c \\r
- dapl_ep_post_send.c \\r
- dapl_ep_query.c \\r
- dapl_ep_reset.c \\r
- dapl_ep_util.c \\r
- dapl_evd_create.c \\r
- dapl_evd_dequeue.c \\r
- dapl_evd_disable.c \\r
- dapl_evd_enable.c \\r
- dapl_evd_free.c \\r
- dapl_evd_modify_cno.c \\r
- dapl_evd_post_se.c \\r
- dapl_evd_query.c \\r
- dapl_evd_resize.c \\r
- dapl_evd_wait.c \\r
- dapl_evd_util.c \\r
- dapl_evd_cq_async_error_callb.c \\r
- dapl_evd_qp_async_error_callb.c \\r
- dapl_evd_un_async_error_callb.c \\r
- dapl_evd_connection_callb.c \\r
- dapl_evd_dto_callb.c \\r
- dapl_extension_util.c \\r
- dapl_get_consumer_context.c \\r
- dapl_get_handle_type.c \\r
- dapl_hash.c \\r
- dapl_hca_util.c \\r
- dapl_ia_close.c \\r
- dapl_ia_open.c \\r
- dapl_ia_query.c \\r
- dapl_ia_util.c \\r
- dapl_llist.c \\r
- dapl_lmr_create.c \\r
- dapl_lmr_free.c \\r
- dapl_lmr_query.c \\r
- dapl_lmr_util.c \\r
- dapl_mr_util.c \\r
- dapl_provider.c \\r
- dapl_sp_util.c \\r
- dapl_psp_create.c \\r
- dapl_psp_create_any.c \\r
- dapl_psp_free.c \\r
- dapl_psp_query.c \\r
- dapl_pz_create.c \\r
- dapl_pz_free.c \\r
- dapl_pz_query.c \\r
- dapl_pz_util.c \\r
- dapl_rmr_create.c \\r
- dapl_rmr_free.c \\r
- dapl_rmr_bind.c \\r
- dapl_rmr_query.c \\r
- dapl_rmr_util.c \\r
- dapl_rsp_create.c \\r
- dapl_rsp_free.c \\r
- dapl_rsp_query.c \\r
- dapl_cno_create.c \\r
- dapl_cno_modify_agent.c \\r
- dapl_cno_free.c \\r
- dapl_cno_wait.c \\r
- dapl_cno_query.c \\r
- dapl_cno_util.c \\r
- dapl_set_consumer_context.c \\r
- dapl_ring_buffer_util.c\r
-\r
-LINUX_SRCS = dapl_osd.c\r
-\r
-SRCS = $(UDAPL_SRCS) $(COMMON_SRCS) $(LINUX_SRCS) $(PROVIDER_SRCS)\r
-\r
-\r
-UDAPL_OBJS = $(UDAPL_SRCS:%.c=$(OBJ_PATH)/%.o)\r
-COMMON_OBJS = $(COMMON_SRCS:%.c=$(OBJ_PATH)/%.o)\r
-LINUX_OBJS = $(LINUX_SRCS:%.c=$(OBJ_PATH)/%.o)\r
-PROVIDER_OBJS = $(PROVIDER_SRCS:%.c=$(OBJ_PATH)/%.o)\r
-\r
-OBJS = $(UDAPL_OBJS) $(COMMON_OBJS) $(LINUX_OBJS) $(PROVIDER_OBJS)\r
-\r
-\r
-all: mkdirs $(TARGET) $(STATIC)\r
-\r
-mkdirs:\r
- @[ -d $(TARGET_PATH) ] || /bin/mkdir -p $(TARGET_PATH)\r
- @[ -d $(OBJ_PATH) ] || /bin/mkdir -p $(OBJ_PATH)\r
-\r
-$(UDAPL_OBJS): $(OBJ_PATH)/%.o : %.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(COMMON_OBJS): $(OBJ_PATH)/%.o : $(COMMON)/%.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(LINUX_OBJS): $(OBJ_PATH)/%.o : $(LINUX)/%.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(PROVIDER_OBJS): $(OBJ_PATH)/%.o : $(PROVIDER)/%.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(TARGET): $(OBJS)\r
- @echo Linking $(TARGET)\r
- $(LD) $(LDFLAGS) $^ -o $(TARGET)\r
-\r
-$(STATIC): $(OBJS)\r
- @echo Archiving $(STATIC)\r
- @$(AR) $(ARFLAGS) $(STATIC) $^\r
-\r
-clean: \r
- rm -f $(OBJS)\r
- rm -f $(TARGET) $(STATIC)\r
-\r
-tidy:\r
- rm -f *~\r
- rm -f ../common/*~\r
- rm -f ../include/*~\r
- rm -f linux/*~\r
+++ /dev/null
-!if $(FREEBUILD)\r
-TARGETNAME=dapl\r
-!else\r
-TARGETNAME=dapld\r
-!endif\r
-TARGETPATH=..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
-TARGETTYPE=DYNLINK\r
-DLLENTRY=_DllMainCRTStartup\r
-!if $(_NT_TOOLS_VERSION) == 0x700\r
-# DDK\r
-DLLDEF=$O\udapl_exports.def\r
-!else\r
-# WDK\r
-DLLDEF=$(OBJ_PATH)\$O\udapl_exports.def\r
-!endif\r
-USE_MSVCRT=1\r
-\r
-SOURCES=udapl.rc \\r
- dapl_init.c \\r
- dapl_name_service.c \\r
- dapl_timer_util.c \\r
- udapl_sources.c\r
-\r
-INCLUDES=..\include;..\common;windows;..\ibal;..\..\dat\include;\\r
- ..\..\..\..\inc;..\..\..\..\inc\user;\r
-\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DEXPORT_DAPL_SYMBOLS -D_VENDOR_IBAL_ -DDAPL_MERGE_CM_DTO\r
-!if !$(FREEBUILD)\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DDAPL_DBG\r
-!endif\r
-\r
-TARGETLIBS= \\r
- $(SDK_LIB_PATH)\kernel32.lib \\r
- $(SDK_LIB_PATH)\ws2_32.lib \\r
-!if $(FREEBUILD)\r
- $(TARGETPATH)\*\dat.lib \\r
- $(TARGETPATH)\*\complib.lib \\r
- $(TARGETPATH)\*\ibal.lib\r
-!else\r
- $(TARGETPATH)\*\datd.lib \\r
- $(TARGETPATH)\*\complibd.lib \\r
- $(TARGETPATH)\*\ibald.lib\r
-!endif\r
-\r
-MSC_WARNING_LEVEL= /W3\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_init.c\r
- *\r
- * PURPOSE: Interface Adapter management\r
- * Description: Interfaces in this file are completely described in\r
- * the DAPL 1.1 API, Chapter 6, section 2\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_hca_util.h"\r
-#include "dapl_init.h"\r
-#include "dapl_provider.h"\r
-#include "dapl_mr_util.h"\r
-#include "dapl_osd.h" /* needed for g_daplDebugLevel */\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_name_service.h"\r
-#include "dapl_timer_util.h"\r
-#include "dapl_vendor.h"\r
-\r
-\r
-/*\r
- * If DAPL_EXPOSE_HCA_PORTS is defined then extra entries are placed\r
- * in the registry for each port of the HCA. For example, without\r
- * this option only "jni0" will be registered; but with it, you will\r
- * get "jni0a" and "jni0b".\r
- */\r
-/*\r
- * DHCA_PORT_COUNT is the number of ports on an HCA. If you are not\r
- * exposing the ports, this is always 1\r
- */\r
-#ifdef DAPL_EXPOSE_HCA_PORTS\r
-#define DHCA_PORT_COUNT 2\r
-#else\r
-#define DHCA_PORT_COUNT 1\r
-#endif /* DAPL_EXPOSE_HCA_PORTS */\r
-\r
-extern int32_t dapl_ib_init_complete;\r
-\r
-/*\r
- * dapl_init\r
- *\r
- * initialize this provider\r
- * includes initialization of all global variables\r
- * as well as registering all supported IAs with the dat registry\r
- *\r
- * This function needs to be called once when the provider is loaded.\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Return Values:\r
- */\r
-void \r
-dapl_init ( void )\r
-{\r
- DAT_RETURN dat_status;\r
-\r
-#if defined(DAPL_DBG)\r
- /* set up debug level */\r
- g_dapl_dbg_type = dapl_os_get_env_val ( "DAPL_DBG_TYPE",\r
- DAPL_DBG_TYPE_ERR | DAPL_DBG_TYPE_WARN); \r
- /* set up debug level */\r
- g_dapl_dbg_dest = dapl_os_get_env_val ( "DAPL_DBG_DEST",\r
- DAPL_DBG_DEST_STDOUT);\r
-#endif /* DAPL_DBG */\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "DAPL: Started (dapl_init)\n");\r
-\r
- /* See if the user is on a loopback setup */\r
- g_dapl_loopback_connection = dapl_os_get_env_bool ( "DAPL_LOOPBACK" );\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, \r
- "--> %s Setting loopback\n", \r
- g_dapl_loopback_connection ? "" : "NOT" );\r
-\r
- /* initialize the timer */\r
- dapls_timer_init();\r
-\r
- dat_status = dapls_ns_init ();\r
-\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "dapls_ns_init failed %d\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- return;\r
-\r
-bail:\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, "ERROR: dapl_init failed\n");\r
- dapl_fini ();\r
- return;\r
-}\r
-\r
-/*\r
- * dapl_fini\r
- *\r
- * finalize this provider\r
- * includes freeing of all global variables\r
- * as well as deregistering all supported IAs from the dat registry\r
- *\r
- * This function needs to be called once when the provider is loaded.\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Return Values:\r
- */\r
-void \r
-dapl_fini ( void )\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dapl_dbg_log (DAPL_DBG_TYPE_UTIL, "DAPL: Stopped (dapl_fini)\n");\r
- \r
- dat_status = dapl_provider_list_destroy ();\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dapl_provider_list_destroy failed %d\n", dat_status);\r
- }\r
-\r
- dapls_ib_release ();\r
-\r
- return;\r
-}\r
-\r
-\r
-/*\r
- *\r
- * This function is called by the registry to initialize a provider\r
- *\r
- * The instance data string is expected to have the following form:\r
- *\r
- * <hca name> <port number>\r
- *\r
- */\r
-void\r
-DAT_PROVIDER_INIT_FUNC_NAME ( \r
- IN const DAT_PROVIDER_INFO *provider_info,\r
- IN const char *instance_data )\r
-{\r
- DAT_PROVIDER *provider;\r
- DAPL_HCA *hca_ptr;\r
- DAT_RETURN dat_status;\r
- char * data;\r
- char * name;\r
- char * port;\r
- unsigned int len = 0;\r
- unsigned int i;\r
-\r
- data = NULL;\r
- provider = NULL;\r
- hca_ptr = NULL;\r
- \r
- dapl_init();\r
- /* Initialize IB verbs library and provider list */\r
- if ( !dapl_ib_init_complete ) \r
- {\r
- dapls_ib_init ();\r
- dapl_ib_init_complete = TRUE;\r
- \r
- /* initialize the provider list */\r
- dat_status = dapl_provider_list_create();\r
- if (DAT_SUCCESS != dat_status)\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "dapl_provider_list_create failed %d\n", dat_status);\r
- goto bail;\r
- }\r
- }\r
-\r
- dat_status = dapl_provider_list_insert(provider_info->ia_name, &provider);\r
- if ( DAT_SUCCESS != dat_status ) \r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR, \r
- "dat_provider_list_insert failed: %x\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- data = dapl_os_strdup(instance_data);\r
- if ( NULL == data )\r
- {\r
- goto bail;\r
- }\r
- \r
- len = dapl_os_strlen(data);\r
- \r
- for ( i = 0; i < len; i++ )\r
- {\r
- if ( ' ' == data[i] ) \r
- { \r
- data[i] = '\0';\r
- break; \r
- }\r
- }\r
-\r
- /* if the instance data did not have a valid format */\r
- if ( i == len ) \r
- {\r
- goto bail;\r
- }\r
-\r
- name = data;\r
- port = data + (i + 1);\r
-\r
- hca_ptr = dapl_hca_alloc (name, port);\r
- if ( NULL == hca_ptr )\r
- {\r
- goto bail;\r
- }\r
- \r
- provider->extension = hca_ptr;\r
- \r
- /* register providers with dat_registry */\r
- dat_status = dat_registry_add_provider (provider, provider_info);\r
- if ( DAT_SUCCESS != dat_status ) \r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dat_registry_add_provider failed: %x\n", dat_status);\r
- goto bail;\r
- }\r
-\r
- bail:\r
- if ( NULL != data )\r
- {\r
- dapl_os_free(data, len + 1);\r
- }\r
- \r
- if ( DAT_SUCCESS != dat_status ) \r
- {\r
- if ( NULL != provider )\r
- {\r
- (void) dapl_provider_list_remove(provider_info->ia_name);\r
- }\r
- \r
- if ( NULL != hca_ptr )\r
- {\r
- dapl_hca_free (hca_ptr);\r
- }\r
- }\r
-}\r
-\r
-\r
-/*\r
- *\r
- * This function is called by the registry to de-initialize a provider\r
- *\r
- */\r
-void\r
-DAT_PROVIDER_FINI_FUNC_NAME (\r
- IN const DAT_PROVIDER_INFO *provider_info )\r
-{\r
- DAT_PROVIDER *provider;\r
- DAT_RETURN dat_status;\r
- \r
- dat_status = dapl_provider_list_search(provider_info->ia_name, &provider);\r
- if ( DAT_SUCCESS != dat_status ) \r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dat_provider_list_search failed: %x\n", dat_status);\r
- return;\r
- }\r
- \r
- dat_status = dat_registry_remove_provider (provider, provider_info);\r
- if ( DAT_SUCCESS != dat_status ) \r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,\r
- "dat_registry_remove_provider failed: %x\n", dat_status);\r
- }\r
-\r
- (void) dapl_provider_list_remove(provider_info->ia_name);\r
- dapl_fini();\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_name_service.c\r
- *\r
- * PURPOSE: Provide simple, file base name services in the absence\r
- * of DNS hooks for a particular transport type. If an\r
- * InfiniBand implementation supports IPoIB, this should\r
- * not be used.\r
- *\r
- * Description: Interfaces in this file are completely described in\r
- * dapl_name_service.h\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-/*\r
- * Include files for setting up a network name\r
- */\r
-#include "dapl.h"\r
-#include "dapl_name_service.h"\r
-\r
-/*\r
- * Prototypes\r
- */\r
-#ifdef NO_NAME_SERVICE\r
-DAT_RETURN dapli_ns_create_gid_map(void);\r
-\r
-DAT_RETURN dapls_ns_add_address(\r
- IN DAPL_GID_MAP *gme);\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-/*\r
- * dapls_ns_init\r
- *\r
- * Initialize naming services\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapls_ns_init (void)\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
-#ifdef NO_NAME_SERVICE\r
- dat_status = dapli_ns_create_gid_map ();\r
-#endif \r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-#ifdef NO_NAME_SERVICE\r
-\r
-#define MAX_GID_ENTRIES 32\r
-DAPL_GID_MAP g_gid_map_table[MAX_GID_ENTRIES];\r
-\r
-#ifdef _WIN32\r
-#define MAP_FILE "C:/WINDOWS/system32/drivers/etc/ibhosts"\r
-#else\r
-#define MAP_FILE "/etc/dapl/ibhosts"\r
-#endif\r
-\r
-\r
-/*\r
- * dapli_ns_create_gid_map()\r
- *\r
- * Read /usr/local/etc/ibhosts to obtain host names and GIDs.\r
- * Create a table containing IP addresses and GIDs which can\r
- * be used for lookups.\r
- *\r
- * This implementation is a simple method providing name services\r
- * when more advanced mechanisms do not exist. The proper way\r
- * to obtain these mappings is to use a name service such as is\r
- * provided by IPoIB on InfiniBand.\r
- *\r
- * Input:\r
- * device_name Name of device as reported by the provider\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * char * to string number\r
- */\r
-DAT_RETURN\r
-dapli_ns_create_gid_map (void)\r
-{\r
- FILE *f;\r
- GID gid;\r
- char hostname[128];\r
- char tmp_buf[512];\r
- int rc = 0;\r
- struct addrinfo *addr;\r
- struct sockaddr_in *si;\r
- DAPL_GID_MAP gmt;\r
-\r
- f = fopen (MAP_FILE, "r");\r
- if ( f == NULL )\r
- {\r
- dapl_os_printf ("ERROR: Must have file <%s> for IP/GID mappings\n",\r
- MAP_FILE);\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- dapl_os_memzero(tmp_buf,sizeof(tmp_buf));\r
- \r
- while ( rc != EOF )\r
- { \r
- if(feof(f))\r
- break;\r
-\r
- if (fgets(tmp_buf,sizeof(tmp_buf),f) != NULL)\r
- {\r
- if(tmp_buf[0] == '#' || tmp_buf[0] == '\n' || tmp_buf[0] == 0x20)\r
- {\r
- continue;\r
- }\r
- if ( (rc = sscanf ( tmp_buf, "%s " F64x " " F64x , hostname, &gid.gid_prefix, &gid.guid) ) != 3 )\r
- {\r
- continue;\r
- }\r
- }\r
- //rc = fscanf ( f, "%s " F64x " " F64x , hostname, &gid.gid_prefix, &gid.guid);\r
- rc = dapls_osd_getaddrinfo (hostname, &addr);\r
-\r
- if ( rc != 0 )\r
- {\r
- /* \r
- * hostname not registered in DNS, provide a dummy value\r
- */\r
- int err = WSAGetLastError();\r
- dapl_os_printf ("WARNING: <%s> not registered in DNS err = %u, using dummy IP value\n",\r
- hostname, err);\r
- /*dapl_os_memcpy(hca_ptr->hca_address.sa_data, "0x01020304", 4);*/\r
- gmt.ip_address = 0x01020304;\r
- }\r
- else\r
- {\r
- /*\r
- * Load into the ip/gid mapping table\r
- */\r
- si = (struct sockaddr_in *)addr->ai_addr;\r
- if ( AF_INET == addr->ai_addr->sa_family )\r
- {\r
- gmt.ip_address = si->sin_addr.s_addr;\r
- }\r
- else\r
- {\r
- dapl_dbg_log (DAPL_DBG_TYPE_WARN,\r
- "WARNING: <%s> Address family not supported, using dummy IP value\n",\r
- hostname);\r
- gmt.ip_address = 0x01020304;\r
- }\r
- dapls_osd_freeaddrinfo (addr);\r
- }\r
- gmt.gid.gid_prefix = gid.gid_prefix;\r
- gmt.gid.guid = gid.guid;\r
-\r
- dapls_ns_add_address (&gmt);\r
- //rc = fscanf ( f, "%s " F64x " " F64x , hostname, &gid.gid_prefix, &gid.guid);\r
- }\r
-\r
- fclose (f);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ns_add_address\r
- *\r
- * Add a table entry to the gid_map_table.\r
- *\r
- * Input:\r
- * remote_ia_address remote IP address\r
- * gid pointer to output gid\r
- *\r
- * Output:\r
- * gid filled in GID\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapls_ns_add_address (\r
- IN DAPL_GID_MAP *gme)\r
-{\r
- DAPL_GID_MAP *gmt;\r
- int count;\r
-\r
- gmt = g_gid_map_table;\r
-\r
- for ( count = 0, gmt = g_gid_map_table; gmt->ip_address; gmt++ )\r
- {\r
- count++;\r
- }\r
-\r
- if ( count > MAX_GID_ENTRIES )\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- *gmt = *gme;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_ns_lookup_address\r
- *\r
- * Look up the provided IA_ADDRESS in the gid_map_table. Return\r
- * the gid if found.\r
- *\r
- * Input:\r
- * remote_ia_address remote IP address\r
- * gid pointer to output gid\r
- *\r
- * Output:\r
- * gid filled in GID\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dapls_ns_lookup_address (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- OUT GID *gid)\r
-{\r
- DAPL_GID_MAP *gmt;\r
- struct sockaddr_in *si;\r
-\r
- ia_ptr = ia_ptr; /* unused here */\r
-\r
- si = (struct sockaddr_in *)remote_ia_address;\r
-\r
- for ( gmt = g_gid_map_table; gmt->ip_address; gmt++ )\r
- {\r
- if (gmt->ip_address == si->sin_addr.s_addr)\r
- {\r
- gid->guid = gmt->gid.guid;\r
- gid->gid_prefix = gmt->gid.gid_prefix;\r
-\r
- return DAT_SUCCESS;\r
- }\r
- }\r
-\r
- return DAT_INVALID_PARAMETER;\r
-}\r
-\r
-#else /* NO_NAME_SERVICE */\r
-\r
-DAT_RETURN\r
-dapls_ns_create_gid_map (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- return (dapls_ib_ns_create_gid_map (hca_ptr));\r
-}\r
-\r
-\r
-DAT_RETURN\r
-dapls_ns_remove_gid_map (\r
- IN DAPL_HCA *hca_ptr)\r
-{\r
- return (dapls_ib_ns_remove_gid_map (hca_ptr));\r
-}\r
-\r
-\r
-DAT_RETURN dapls_ns_map_gid (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- OUT GID *gid)\r
-{\r
- return (dapls_ib_ns_map_gid (hca_ptr, remote_ia_address, gid));\r
-}\r
-\r
-DAT_RETURN dapls_ns_map_ipaddr (\r
- IN DAPL_HCA *hca_ptr,\r
- IN GID gid,\r
- OUT DAT_IA_ADDRESS_PTR remote_ia_address)\r
-{\r
- return (dapls_ib_ns_map_ipaddr (hca_ptr, gid, remote_ia_address));\r
-}\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_name_service.h\r
- *\r
- * PURPOSE: Utility defs & routines supporting name services\r
- *\r
- * $Id$\r
- *\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_adapter_util.h"\r
-\r
-/*\r
- * Prototypes for name service routines\r
- */\r
-\r
-DAT_RETURN dapls_ns_init (void);\r
-\r
-#ifdef NO_NAME_SERVICE\r
-\r
-DAT_RETURN dapls_ns_lookup_address (\r
- IN DAPL_IA *ia_ptr,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- OUT GID *gid);\r
-\r
-\r
-#else\r
-\r
-DAT_RETURN dapls_ns_create_gid_map(DAPL_HCA *hca_ptr);\r
-DAT_RETURN dapls_ns_remove_gid_map(DAPL_HCA *hca_ptr);\r
-\r
-DAT_RETURN dapls_ns_map_gid (\r
- IN DAPL_HCA *hca_ptr,\r
- IN DAT_IA_ADDRESS_PTR remote_ia_address,\r
- OUT GID *gid);\r
-\r
-DAT_RETURN dapls_ns_map_ipaddr (\r
- IN DAPL_HCA *hca_ptr,\r
- IN GID gid,\r
- OUT DAT_IA_ADDRESS_PTR remote_ia_address);\r
-\r
-#endif /* NO_NAME_SERVICE */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dapl_timer_util.c\r
- *\r
- * PURPOSE: DAPL timer management\r
- * Description: Routines to add and cancel timer records. A timer record\r
- * is put on the global timer queue. If the timer thread is\r
- * not running, start it. The timer thread will sleep\r
- * until a timer event or until a process wakes it up\r
- * to notice a new timer is available; we use a DAPL_WAIT_OBJ\r
- * for synchronization.\r
- *\r
- * If a timer is cancelled, it is simlpy removed from the\r
- * queue. The timer may wakeup and notice there is no timer\r
- * record to awaken at this time, so it will reset for the\r
- * next entry. When there are no timer records to manage,\r
- * the timer thread just sleeps until awakened.\r
- *\r
- * This file also contains the timer handler thread,\r
- * embodied in dapls_timer_thread().\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl.h"\r
-#include "dapl_timer_util.h"\r
-\r
-\r
-struct timer_head\r
-{\r
- DAPL_LLIST_HEAD timer_list_head;\r
- DAPL_OS_LOCK lock;\r
- DAPL_OS_WAIT_OBJECT wait_object;\r
- DAPL_OS_THREAD timeout_thread_handle;\r
-} g_daplTimerHead;\r
-\r
-typedef struct timer_head DAPL_TIMER_HEAD;\r
-\r
-\r
-void dapls_timer_thread (void *arg );\r
-\r
-void\r
-dapls_timer_init ()\r
-{\r
- /*\r
- * Set up the timer thread elements. The timer thread isn't\r
- * started until it is actually needed\r
- */\r
- g_daplTimerHead.timer_list_head = NULL;\r
- dapl_os_lock_init ( &g_daplTimerHead.lock );\r
- dapl_os_wait_object_init ( &g_daplTimerHead.wait_object );\r
- g_daplTimerHead.timeout_thread_handle = 0;\r
-}\r
-\r
-\r
-/*\r
- * dapls_timer_set\r
- *\r
- * Set a timer. The timer will invoke the specified function\r
- * after a number of useconds expires.\r
- *\r
- * Input:\r
- * timer User provided timer structure\r
- * func Function to invoke when timer expires\r
- * data Argument passed to func()\r
- * expires microseconds until timer fires\r
- *\r
- * Returns:\r
- * no return value\r
- *\r
- */\r
-DAT_RETURN\r
-dapls_timer_set (\r
- IN DAPL_OS_TIMER *timer,\r
- IN void (*func) (void*),\r
- IN void *data,\r
- IN DAPL_OS_TIMEVAL expires )\r
-{\r
- DAPL_OS_TIMER *list_ptr;\r
- DAPL_OS_TIMEVAL cur_time;\r
- DAT_BOOLEAN wakeup_tmo_thread;\r
-\r
- DAPL_CNTR(DCNT_TIMER_SET);\r
- /*\r
- * Start the timer thread the first time we need a timer\r
- */\r
- if ( g_daplTimerHead.timeout_thread_handle == 0 )\r
- {\r
- dapl_os_thread_create ( dapls_timer_thread,\r
- &g_daplTimerHead,\r
- &g_daplTimerHead.timeout_thread_handle );\r
- }\r
-\r
- dapl_llist_init_entry ( &timer->list_entry);\r
- wakeup_tmo_thread = false;\r
- dapl_os_get_time ( &cur_time );\r
- timer->expires = cur_time + expires; /* calculate future time */\r
- timer->function = func;\r
- timer->data = data;\r
-\r
- /*\r
- * Put the element on the queue: sorted by wakeup time, eariliest\r
- * first.\r
- */\r
- dapl_os_lock ( &g_daplTimerHead.lock );\r
- /*\r
- * Deal with 3 cases due to our list structure:\r
- * 1) list is empty: become the list head\r
- * 2) New timer is sooner than list head: become the list head\r
- * 3) otherwise, sort the timer into the list, no need to wake\r
- * the timer thread up\r
- */\r
- if ( dapl_llist_is_empty ( &g_daplTimerHead.timer_list_head) )\r
- {\r
- /* Case 1: add entry to head of list */\r
- dapl_llist_add_head ( &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&timer->list_entry,\r
- timer );\r
- wakeup_tmo_thread = true;\r
- }\r
- else\r
- {\r
- list_ptr = (DAPL_OS_TIMER *)\r
- dapl_llist_peek_head (&g_daplTimerHead.timer_list_head);\r
-\r
- if ( timer->expires < list_ptr->expires )\r
- {\r
- /* Case 2: add entry to head of list */\r
- dapl_llist_add_head ( &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&timer->list_entry,\r
- timer );\r
- wakeup_tmo_thread = true;\r
- }\r
- else\r
- {\r
- /* Case 3: figure out where entry goes in sorted list */\r
- list_ptr = dapl_llist_next_entry (\r
- &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&list_ptr->list_entry);\r
-\r
- while (list_ptr != NULL)\r
- {\r
- if ( timer->expires < list_ptr->expires )\r
- {\r
- dapl_llist_add_entry ( &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&list_ptr->list_entry,\r
- (DAPL_LLIST_ENTRY *)&timer->list_entry,\r
- timer );\r
- break;\r
-\r
- }\r
- list_ptr = dapl_llist_next_entry (\r
- &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&list_ptr->list_entry);\r
- }\r
- if (list_ptr == NULL)\r
- {\r
- /* entry goes to the end of the list */\r
- dapl_llist_add_tail ( &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&timer->list_entry,\r
- timer );\r
- }\r
- }\r
-\r
- }\r
- dapl_os_unlock ( &g_daplTimerHead.lock );\r
-\r
- if ( wakeup_tmo_thread )\r
- {\r
- dapl_os_wait_object_wakeup (&g_daplTimerHead.wait_object);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_os_timer_cancel\r
- *\r
- * Cancel a timer. Simply deletes the timer with no function invocations\r
- *\r
- * Input:\r
- * timer User provided timer structure\r
- *\r
- * Returns:\r
- * no return value\r
- */\r
-void\r
-dapls_timer_cancel (\r
- IN DAPL_OS_TIMER *timer)\r
-{\r
- DAPL_CNTR(DCNT_TIMER_CANCEL);\r
- dapl_os_lock ( &g_daplTimerHead.lock );\r
- /*\r
- * make sure the entry has not been removed by another thread\r
- */\r
- if ( ! dapl_llist_is_empty ( &g_daplTimerHead.timer_list_head ) &&\r
- timer->list_entry.list_head == &g_daplTimerHead.timer_list_head )\r
- {\r
- dapl_llist_remove_entry ( &g_daplTimerHead.timer_list_head,\r
- (DAPL_LLIST_ENTRY *)&timer->list_entry );\r
- }\r
- /*\r
- * If this was the first entry on the queue we could awaken the\r
- * thread and have it reset the list; but it will just wake up\r
- * and find that the timer entry has been removed, then go back\r
- * to sleep, so don't bother.\r
- */\r
- dapl_os_unlock ( &g_daplTimerHead.lock );\r
-}\r
-\r
-\r
-/*\r
- * dapls_timer_thread\r
- *\r
- * Core worker thread dealing with all timers. Basic algorithm:\r
- * - Sleep until work shows up\r
- * - Take first element of sorted timer list and wake\r
- * invoke the callback if expired\r
- * - Sleep for the timeout period if not expired\r
- *\r
- * Input:\r
- * timer_head Timer head structure to manage timer lists\r
- *\r
- * Returns:\r
- * no return value\r
- */\r
-void\r
-dapls_timer_thread (\r
- void *arg )\r
-{\r
- DAPL_OS_TIMER *list_ptr;\r
- DAPL_OS_TIMEVAL cur_time;\r
- DAT_RETURN dat_status = DAT_SUCCESS;\r
- DAPL_TIMER_HEAD *timer_head;\r
-\r
- timer_head = arg;\r
-\r
- for (;;)\r
- {\r
- if ( dapl_llist_is_empty ( &timer_head->timer_list_head ) )\r
- {\r
- dat_status = dapl_os_wait_object_wait (&timer_head->wait_object,\r
- DAT_TIMEOUT_INFINITE );\r
- }\r
-\r
- /*\r
- * Lock policy:\r
- * While this thread is accessing the timer list, it holds the\r
- * lock. Otherwise, it doesn't.\r
- */\r
- dapl_os_lock ( &timer_head->lock );\r
- while ( ! dapl_llist_is_empty ( &timer_head->timer_list_head) )\r
- {\r
- list_ptr = (DAPL_OS_TIMER *)\r
- dapl_llist_peek_head ( &g_daplTimerHead.timer_list_head );\r
- dapl_os_get_time ( &cur_time );\r
-\r
- if ( list_ptr->expires <= cur_time )\r
- {\r
- /*\r
- * Remove the entry from the list. Sort out how much\r
- * time we need to sleep for the next one\r
- */\r
- list_ptr = dapl_llist_remove_head ( &timer_head->timer_list_head );\r
- dapl_os_unlock ( &timer_head->lock );\r
-\r
- /*\r
- * Invoke the user callback\r
- */\r
- list_ptr->function ( list_ptr->data );\r
- /* timer structure was allocated by caller, we don't\r
- * free it here.\r
- */\r
-\r
- /* reacquire the lock */\r
- dapl_os_lock ( &timer_head->lock );\r
- }\r
- else\r
- {\r
- dapl_os_unlock( &timer_head->lock );\r
- dat_status = \r
- dapl_os_wait_object_wait ( &timer_head->wait_object,\r
- (DAT_TIMEOUT)(list_ptr->expires - cur_time) );\r
- dapl_os_lock( &timer_head->lock );\r
- }\r
- }\r
- /*\r
- * release the lock before going back to the top to sleep\r
- */\r
- dapl_os_unlock( &timer_head->lock );\r
-\r
- if ( dat_status == DAT_INTERNAL_ERROR )\r
- {\r
- /*\r
- * XXX What do we do here?\r
- */\r
- }\r
- } /* for (;;) */\r
-}\r
-\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * HEADER: dapl_timer_util.h\r
- *\r
- * PURPOSE: DAPL timer management\r
- * Description: support for dapl_timer.h\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-void dapls_timer_init ( void );\r
-\r
-DAT_RETURN dapls_timer_set (\r
- IN DAPL_OS_TIMER *timer,\r
- IN void (*func) (void*),\r
- IN void *data,\r
- IN DAPL_OS_TIMEVAL expires );\r
-\r
-void dapls_timer_cancel (\r
- IN DAPL_OS_TIMER *timer);\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_osd.c\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description: \r
- * Provide OS dependent functions with a canonical DAPL\r
- * interface. Designed to be portable and hide OS specific quirks\r
- * of common functions.\r
- * \r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dapl_osd.h"\r
-#include "dapl.h"\r
-#include "dapl_hca_util.h"\r
-#include "dapl_ia_util.h"\r
-#include "dapl_rmr_util.h"\r
-#include "dapl_lmr_util.h"\r
-#include "dapl_pz_util.h"\r
-#include "dapl_ep_util.h"\r
-#include "dapl_cr_util.h"\r
-#include "dapl_evd_util.h"\r
-#include "dapl_sp_util.h"\r
-#include "dapl_adapter_util.h"\r
-#include "dapl_provider.h"\r
-#include "dapl_hash.h"\r
-#include "dapl_timer_util.h"\r
-#include "dapl_debug.h"\r
-\r
-#include <sys/time.h>\r
-#include <stdlib.h> /* needed for getenv() */\r
-#include <pthread.h> /* needed for pthread_atfork() */\r
-#include <signal.h> /* needed for thread setup */\r
-\r
-static void dapls_osd_fork_cleanup (void);\r
-\r
-/*\r
- * dapl_osd_init\r
- *\r
- * Do Linux initialization:\r
- * - Set up fork handler to clean up DAPL resources in the child\r
- * process after a fork().\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-void\r
-dapl_os_init ( )\r
-{\r
- int status;\r
-\r
- /*\r
- * Set up fork control\r
- */\r
- status = pthread_atfork ( NULL, NULL, dapls_osd_fork_cleanup );\r
- if ( status != 0 )\r
- {\r
- dapl_os_printf ("WARNING: pthread_atfork %d\n", status);\r
- }\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get_time\r
- *\r
- * Return 64 bit value of current time in microseconds.\r
- *\r
- * Input:\r
- * loc User location to place current time\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-\r
-DAT_RETURN\r
-dapl_os_get_time (\r
- OUT DAPL_OS_TIMEVAL * loc)\r
-{\r
- struct timeval tv;\r
- struct timezone tz;\r
-\r
-\r
- gettimeofday (&tv, &tz);\r
- *loc = ((DAT_UINT64) (tv.tv_sec) * 1000000L) + (DAT_UINT64) tv.tv_usec;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get__env_bool\r
- *\r
- * Return boolean value of passed in environment variable: 1 if present,\r
- * 0 if not\r
- *\r
- * Input:\r
- * \r
- *\r
- * Returns:\r
- * TRUE or FALSE\r
- */\r
-int\r
-dapl_os_get_env_bool (\r
- char *env_str )\r
-{\r
- char *env_var;\r
-\r
- env_var = getenv (env_str);\r
- if (env_var != NULL)\r
- {\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get_env_val\r
- *\r
- * Update val to value of passed in environment variable if present\r
- *\r
- * Input:\r
- * env_str\r
- * def_val default value if environment variable does not exist\r
- *\r
- * Returns:\r
- * TRUE or FALSE\r
- */\r
-int\r
-dapl_os_get_env_val (\r
- char *env_str,\r
- int def_val )\r
-{\r
- char *env_var;\r
-\r
- env_var = getenv (env_str);\r
- if ( env_var != NULL )\r
- {\r
- def_val = strtol (env_var, NULL, 0);\r
- }\r
-\r
- return def_val;\r
-}\r
-\r
-\r
-/*\r
- * Wait object routines\r
- */\r
-\r
-/*\r
- * dapl_os_wait_object_init\r
- *\r
- * Initialize a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INTERNAL_ERROR\r
- */\r
-DAT_RETURN \r
-dapl_os_wait_object_init (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- wait_obj->signaled = DAT_FALSE;\r
- if ( 0 != pthread_cond_init ( &wait_obj->cv, NULL ) )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- /* Always returns 0. */\r
- pthread_mutex_init ( &wait_obj->lock, NULL );\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/* Wait on the supplied wait object, up to the specified time_out.\r
- * A timeout of DAT_TIMEOUT_INFINITE will wait indefinitely.\r
- * Timeout should be specified in micro seconds.\r
- *\r
- * Functional returns:\r
- * DAT_SUCCESS -- another thread invoked dapl_os_wait object_wakeup\r
- * DAT_INVALID_STATE -- someone else is already waiting in this wait\r
- * object.\r
- * only one waiter is allowed at a time.\r
- * DAT_ABORT -- another thread invoked dapl_os_wait_object_destroy\r
- * DAT_TIMEOUT -- the specified time limit was reached.\r
- */\r
-\r
-DAT_RETURN \r
-dapl_os_wait_object_wait (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj, \r
- IN DAT_TIMEOUT timeout_val)\r
-{\r
- DAT_RETURN dat_status;\r
- int pthread_status;\r
- struct timespec future;\r
-\r
- dat_status = DAT_SUCCESS;\r
- pthread_status = 0;\r
-\r
- if ( timeout_val != DAT_TIMEOUT_INFINITE )\r
- {\r
- struct timeval now;\r
- struct timezone tz;\r
- unsigned int microsecs;\r
-\r
- gettimeofday (&now, &tz);\r
- microsecs = now.tv_usec + (timeout_val % 1000000);\r
- if (microsecs > 1000000)\r
- {\r
- now.tv_sec = now.tv_sec + timeout_val / 1000000 + 1;\r
- now.tv_usec = microsecs - 1000000;\r
- }\r
- else\r
- {\r
- now.tv_sec = now.tv_sec + timeout_val / 1000000;\r
- now.tv_usec = microsecs;\r
- }\r
-\r
- /* Convert timeval to timespec */\r
- future.tv_sec = now.tv_sec;\r
- future.tv_nsec = now.tv_usec * 1000;\r
-\r
- pthread_mutex_lock (&wait_obj->lock);\r
- while ( wait_obj->signaled == DAT_FALSE && pthread_status == 0)\r
- {\r
- pthread_status = pthread_cond_timedwait (\r
- &wait_obj->cv , &wait_obj->lock , &future );\r
-\r
- /*\r
- * No need to reset &future if we go around the loop;\r
- * It's an absolute time.\r
- */\r
- }\r
- /* Reset the signaled status if we were woken up. */\r
- if (pthread_status == 0)\r
- {\r
- wait_obj->signaled = DAT_FALSE;\r
- }\r
- pthread_mutex_unlock (&wait_obj->lock);\r
- }\r
- else\r
- {\r
- pthread_mutex_lock (&wait_obj->lock);\r
- while ( wait_obj->signaled == DAT_FALSE && pthread_status == 0)\r
- {\r
- pthread_status = pthread_cond_wait (\r
- &wait_obj->cv , &wait_obj->lock );\r
- }\r
- /* Reset the signaled status if we were woken up. */\r
- if (pthread_status == 0)\r
- {\r
- wait_obj->signaled = DAT_FALSE;\r
- }\r
- pthread_mutex_unlock (&wait_obj->lock);\r
- }\r
-\r
- if (ETIMEDOUT == pthread_status)\r
- {\r
- dat_status = DAT_ERROR (DAT_TIMEOUT_EXPIRED,0);\r
- }\r
- else if ( 0 != pthread_status)\r
- {\r
- dat_status = DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- return dat_status;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_wait_object_wakeup\r
- *\r
- * Wakeup a thread waiting on a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INTERNAL_ERROR\r
- */\r
-DAT_RETURN \r
-dapl_os_wait_object_wakeup (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- pthread_mutex_lock ( &wait_obj->lock );\r
- wait_obj->signaled = DAT_TRUE;\r
- pthread_mutex_unlock ( &wait_obj->lock );\r
- if ( 0 != pthread_cond_signal ( &wait_obj->cv ) )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_wait_object_destroy\r
- *\r
- * Destroy a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INTERNAL_ERROR\r
- */\r
-DAT_RETURN \r
-dapl_os_wait_object_destroy (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- if ( 0 != pthread_cond_destroy ( &wait_obj->cv ) )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
- if ( 0 != pthread_mutex_destroy ( &wait_obj->lock ) )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapls_osd_fork_cleanup\r
- *\r
- * Update val to value of passed in environment variable if present\r
- *\r
- * Input:\r
- * env_str\r
- * val Updated if environment variable exists\r
- *\r
- * Returns:\r
- * TRUE or FALSE\r
- */\r
-void dapls_osd_fork_cleanup (void)\r
-{\r
- DAPL_PROVIDER_LIST_NODE *cur_node;\r
- DAPL_HCA *hca_ptr;\r
- DAPL_IA *ia_ptr;\r
- DAPL_LMR *lmr_ptr;\r
- DAPL_RMR *rmr_ptr;\r
- DAPL_PZ *pz_ptr;\r
- DAPL_CR *cr_ptr;\r
- DAPL_EP *ep_ptr;\r
- DAPL_EVD *evd_ptr;\r
- DAT_EP_PARAM *param;\r
- DAPL_SP *sp_ptr;\r
- \r
- while ( NULL != g_dapl_provider_list.head )\r
- {\r
- cur_node = g_dapl_provider_list.head;\r
- g_dapl_provider_list.head = cur_node->next;\r
-\r
- hca_ptr = (DAPL_HCA *) cur_node->data.extension;\r
-\r
- /*\r
- * Walk the list of IA ptrs & clean up. This is purposely\r
- * a destructive list walk, we really don't want to preserve\r
- * any of it.\r
- */\r
- while (!dapl_llist_is_empty ( &hca_ptr->ia_list_head ) )\r
- {\r
- ia_ptr = (DAPL_IA *)\r
- dapl_llist_peek_head ( &hca_ptr->ia_list_head );\r
-\r
- /*\r
- * The rest of the cleanup code is similar to dapl_ia_close,\r
- * the big difference is that we don't release IB resources,\r
- * only memory; the underlying IB subsystem doesn't deal\r
- * with fork at all, so leave IB handles alone.\r
- */\r
- while (!dapl_llist_is_empty ( &ia_ptr->rmr_list_head ) )\r
- {\r
- rmr_ptr = (DAPL_RMR *)\r
- dapl_llist_peek_head (&ia_ptr->rmr_list_head);\r
- if ( rmr_ptr->param.lmr_triplet.virtual_address != 0 )\r
- {\r
- (void) dapl_os_atomic_dec (&rmr_ptr->lmr->lmr_ref_count); \r
- rmr_ptr->param.lmr_triplet.virtual_address = 0;\r
- }\r
- dapl_os_atomic_dec ( &rmr_ptr->pz->pz_ref_count );\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"FC_421:rmr- pz=%p,ref=0x%x\n",\r
- rmr_ptr->pz,rmr_ptr->pz->pz_ref_count);\r
- \r
- dapl_rmr_dealloc ( rmr_ptr );\r
- }\r
-\r
- while (!dapl_llist_is_empty ( &ia_ptr->rsp_list_head ))\r
- {\r
- sp_ptr = (DAPL_SP *)\r
- dapl_llist_peek_head ( &ia_ptr->rsp_list_head );\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapls_sp_free_sp ( sp_ptr );\r
- }\r
-\r
- while (!dapl_llist_is_empty ( &ia_ptr->ep_list_head ) )\r
- {\r
- ep_ptr = (DAPL_EP *)\r
- dapl_llist_peek_head ( &ia_ptr->ep_list_head );\r
- param = &ep_ptr->param;\r
- if ( param->pz_handle != NULL )\r
- {\r
- dapl_os_atomic_dec ( & ((DAPL_PZ *)param->pz_handle)->pz_ref_count );\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"FC_441:ep- pz=%p,ref=0x%x\n",\r
- ((DAPL_PZ *)param->pz_handle), \r
- ((DAPL_PZ *)param->pz_handle)->pz_ref_count);\r
- }\r
- if ( param->recv_evd_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->recv_evd_handle)->evd_ref_count);\r
- }\r
- if ( param->request_evd_handle )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->request_evd_handle)->evd_ref_count);\r
- }\r
- if ( param->connect_evd_handle != NULL )\r
- {\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)param->connect_evd_handle)->evd_ref_count);\r
- }\r
-\r
- /* ...and free the resource */\r
- dapl_ia_unlink_ep ( ia_ptr, ep_ptr );\r
- dapl_ep_dealloc ( ep_ptr );\r
- }\r
-\r
- while ( !dapl_llist_is_empty (&ia_ptr->lmr_list_head) )\r
- {\r
- lmr_ptr = (DAPL_LMR *)\r
- dapl_llist_peek_head ( &ia_ptr->lmr_list_head );\r
-\r
- (void) dapls_hash_remove ( lmr_ptr->header.owner_ia->hca_ptr->lmr_hash_table, \r
- lmr_ptr->param.lmr_context, \r
- NULL );\r
- \r
- pz_ptr = (DAPL_PZ *) lmr_ptr->param.pz_handle;\r
- dapl_os_atomic_dec ( &pz_ptr->pz_ref_count );\r
- dapl_dbg_log (DAPL_DBG_TYPE_ERR,"FC_471:lmr- pz=%p,ref=0x%x\n",\r
- pz_ptr, pz_ptr->pz_ref_count);\r
- dapl_lmr_dealloc ( lmr_ptr );\r
- }\r
-\r
- while ( !dapl_llist_is_empty ( &ia_ptr->psp_list_head ) )\r
- {\r
- sp_ptr = (DAPL_SP *)\r
- dapl_llist_peek_head ( &ia_ptr->psp_list_head );\r
- while ( !dapl_llist_is_empty (&sp_ptr->cr_list_head) )\r
- {\r
- cr_ptr = (DAPL_CR *)\r
- dapl_llist_peek_head ( &sp_ptr->cr_list_head );\r
- dapl_sp_remove_cr (sp_ptr, cr_ptr);\r
- dapls_cr_free (cr_ptr);\r
- }\r
-\r
- dapls_ia_unlink_sp ( ia_ptr, sp_ptr );\r
- dapl_os_atomic_dec (& ((DAPL_EVD *)sp_ptr->evd_handle)->evd_ref_count);\r
- dapls_sp_free_sp ( sp_ptr );\r
- }\r
-\r
- while (!dapl_llist_is_empty ( &ia_ptr->pz_list_head ) )\r
- {\r
- pz_ptr = (DAPL_PZ *)\r
- dapl_llist_peek_head ( &ia_ptr->pz_list_head );\r
- dapl_pz_dealloc ( pz_ptr );\r
- }\r
-\r
- while (!dapl_llist_is_empty (&ia_ptr->evd_list_head))\r
- {\r
- evd_ptr = (DAPL_EVD *)\r
- dapl_llist_peek_head ( &ia_ptr->evd_list_head );\r
- dapl_ia_unlink_evd ( evd_ptr->header.owner_ia, evd_ptr );\r
- /* reset the cq_handle to avoid having it removed */\r
- evd_ptr->ib_cq_handle = IB_INVALID_HANDLE;\r
- dapls_evd_dealloc ( evd_ptr );\r
- }\r
-\r
- dapl_hca_unlink_ia ( ia_ptr->hca_ptr, ia_ptr );\r
- /* asycn error evd was taken care of above, reset the pointer */\r
- ia_ptr->async_error_evd = NULL;\r
- dapls_ia_free ( ia_ptr );\r
- } /* end while ( ia_ptr != NULL ) */\r
-\r
-\r
- dapl_os_free (cur_node, sizeof (DAPL_PROVIDER_LIST_NODE));\r
- } /* end while (NULL != g_dapl_provider_list.head) */\r
-}\r
-\r
-\r
-/*\r
- * Structure to contain all elements of a thread in order to enable a\r
- * local routine to intercept and do some necessary initialization.\r
- */\r
-struct thread_draft\r
-{\r
- void (*func) (void *); /* start routine */\r
- void *data; /* argument to start routine */\r
-};\r
-\r
-void dapli_thread_init ( struct thread_draft *thread_draft);\r
-\r
-/*\r
- * dapls_os_thread_create\r
- *\r
- * Create a thread for dapl\r
- *\r
- * Input:\r
- * func function to invoke thread\r
- * f_arg argument to pass to function\r
- *\r
- * Output\r
- * thread_id handle for thread\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-DAT_RETURN \r
-dapl_os_thread_create (\r
- IN void (*func) (void *),\r
- IN void *data,\r
- OUT DAPL_OS_THREAD *thread_id )\r
-{\r
- pthread_attr_t thread_attr;\r
- struct thread_draft *thread_draft;\r
- int status;\r
-\r
- /*\r
- * Get default set of thread attributes\r
- */\r
- status = pthread_attr_init ( &thread_attr );\r
- if ( status != 0 )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- /* Create dapl threads as detached from this process */\r
- status = pthread_attr_setdetachstate ( &thread_attr, \r
- PTHREAD_CREATE_DETACHED );\r
- if ( status != 0 )\r
- {\r
- return DAT_ERROR (DAT_INTERNAL_ERROR,0);\r
- }\r
-\r
- thread_draft = dapl_os_alloc (sizeof ( struct thread_draft));\r
-\r
- thread_draft->func = func;\r
- thread_draft->data = data;\r
-\r
- /* Create the thread. Observe that we first invoke a local\r
- * routine to set up OS parameters, before invoking the user\r
- * specified routine.\r
- */\r
- status = pthread_create ( thread_id,\r
- &thread_attr, \r
- (void * (*) (void *))dapli_thread_init,\r
- (void *)thread_draft );\r
-\r
- /* clean up resources */\r
- (void) pthread_attr_destroy ( &thread_attr );\r
-\r
- if ( status != 0 )\r
- {\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,0);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-/*\r
- * dapli_thread_init\r
- *\r
- * Need to mask all signals from this thread in order to be a good\r
- * citizen. Signals will arrive randomly and will be processed by\r
- * whatever thread is running unless they are specifically blocked; and\r
- * this should be a user thread, not a dapl thread\r
- */\r
-\r
-void\r
-dapli_thread_init (\r
- struct thread_draft *thread_draft)\r
-{\r
- sigset_t sigset;\r
- void (*func) (void *);\r
- void *data;\r
-\r
- sigfillset (&sigset);\r
- pthread_sigmask ( SIG_BLOCK, &sigset, NULL);\r
-\r
- func = thread_draft->func;\r
- data = thread_draft->data;\r
- dapl_os_free (thread_draft, sizeof ( struct thread_draft ));\r
-\r
- (*func) (data);\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_osd.h\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description:\r
- * Provide OS dependent data structures & functions with\r
- * a canonical DAPL interface. Designed to be portable\r
- * and hide OS specific quirks of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_OSD_H_\r
-#define _DAPL_OSD_H_\r
-\r
-/*\r
- * This file is defined for Linux systems only, including it on any\r
- * other build will cause an error\r
- */\r
-#ifndef __linux__\r
-#error UNDEFINED OS TYPE\r
-#endif /* __linux__ */\r
-\r
-#ifdef __IA64__\r
-#define IA64\r
-#endif\r
-\r
-#if !defined (__i386__) && !defined (IA64)\r
-#error UNDEFINED ARCH\r
-#endif\r
-\r
-\r
-#include <dat/udat.h>\r
-#include <assert.h>\r
-#include <errno.h>\r
-#include <pthread.h>\r
-#include <semaphore.h>\r
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <stdarg.h> /* for printf */\r
-#include <sys/time.h>\r
-#include <syslog.h>\r
-#include <netdb.h> /* for getaddrinfo */\r
-\r
-#include "dapl_debug.h"\r
-\r
-/*\r
- * Include files for setting up a network name\r
- */\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-#include <sys/socket.h>\r
-#include <ctype.h>\r
-\r
-#ifdef IA64\r
-#include <asm/atomic.h>\r
-#include <asm/system.h>\r
-#endif\r
-\r
-\r
-/* Useful debug definitions */\r
-#ifndef STATIC\r
-#define STATIC static\r
-#endif /* STATIC */\r
-#ifndef _INLINE_\r
-#define _INLINE_ __inline__\r
-#endif /* _INLINE_ */\r
-\r
-void dapl_os_init ( void ); /* initialization function */\r
-\r
-#define dapl_os_panic(...) \\r
- do { \\r
- fprintf(stderr, "PANIC in %s:%i:%s\n", __FILE__, __LINE__, __func__); \\r
- fprintf(stderr, __VA_ARGS__); \\r
- exit(1); \\r
- } while(0)\r
-\r
-#define dapl_ip_addr6(sockaddr) (((struct sockaddr_in6 *)sockaddr)->sin6_addr.s6_addr32)\r
-\r
-/*\r
- * Atomic operations\r
- */\r
-\r
-typedef volatile DAT_COUNT DAPL_ATOMIC;\r
-\r
-/* atomic function prototypes */\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_inc (\r
- INOUT DAPL_ATOMIC *v);\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_dec ( \r
- INOUT DAPL_ATOMIC *v);\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_assign (\r
- INOUT DAPL_ATOMIC *v,\r
- IN DAT_COUNT match_value,\r
- IN DAT_COUNT new_value );\r
-\r
-int dapl_os_get_env_bool (\r
- char *env_str );\r
-\r
-int dapl_os_get_env_val (\r
- char *env_str,\r
- int def_val );\r
-\r
-\r
-\r
-/* atomic functions */\r
-\r
-/* dapl_os_atomic_inc\r
- *\r
- * get the current value of '*v', and then increment it.\r
- *\r
- * This is equivalent to an IB atomic fetch and add of 1,\r
- * except that a DAT_COUNT might be 32 bits, rather than 64\r
- * and it occurs in local memory.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_inc (\r
- INOUT DAPL_ATOMIC *v)\r
-{\r
- DAT_COUNT old_value;\r
-\r
- /* \r
- * Use the Pentium Exchange and Add instruction.\r
- * The assembler doesn't deal with xadd so forge it.\r
- */\r
-#ifdef IA64\r
-IA64_FETCHADD (old_value,v,1,4);\r
-\r
-#else\r
- __asm__ __volatile__ (\r
- ".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)\r
- : "=a" (old_value)\r
- : "0" (+1), "m" (*v), "d" (v)\r
- : "memory");\r
-#endif\r
- return old_value;\r
-}\r
-\r
-\r
-/* dapl_os_atomic_dec\r
- *\r
- * decrement the current value of '*v'. No return value is required.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_dec ( \r
- INOUT DAPL_ATOMIC *v)\r
-{\r
- DAT_COUNT old_value;\r
-\r
- assert(*v != 0);\r
-\r
- /* \r
- * Use the Pentium Exchange and Add instruction.\r
- * The assembler doesn't deal with xadd so forge it\r
- */\r
-\r
-#ifdef IA64\r
-IA64_FETCHADD (old_value,v,-1,4);\r
-\r
-#else\r
- __asm__ __volatile__ (\r
- ".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx)\r
- : "=a" (old_value)\r
- : "0" (-1), "m" (*v), "d" (v)\r
- : "memory");\r
-\r
-#endif\r
- return old_value;\r
-}\r
-\r
-\r
-/* dapl_os_atomic_assign\r
- *\r
- * assign 'new_value' to '*v' if the current value\r
- * matches the provided 'match_value'.\r
- *\r
- * Make no assignment if there is no match.\r
- *\r
- * Return the current value in any case.\r
- *\r
- * This matches the IBTA atomic operation compare & swap\r
- * except that it is for local memory and a DAT_COUNT may\r
- * be only 32 bits, rather than 64.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_assign (\r
- INOUT DAPL_ATOMIC *v,\r
- IN DAT_COUNT match_value,\r
- IN DAT_COUNT new_value )\r
-{\r
- DAT_COUNT current_value;\r
-\r
- /*\r
- * Use the Pentium compare and exchange instruction\r
- */\r
-\r
-#ifdef IA64\r
-\r
-current_value = ia64_cmpxchg("acq",v,match_value,new_value,4);\r
-\r
-#else\r
- __asm__ __volatile__ (\r
- "lock; cmpxchgl %1, %2"\r
- : "=a" (current_value)\r
- : "q" (new_value), "m" (*v), "0" (match_value)\r
- : "memory");\r
-#endif\r
- return current_value;\r
-}\r
-\r
-/*\r
- * Thread Functions\r
- */\r
-typedef pthread_t DAPL_OS_THREAD;\r
-\r
-DAT_RETURN \r
-dapl_os_thread_create (\r
- IN void (*func) (void *),\r
- IN void *data,\r
- OUT DAPL_OS_THREAD *thread_id );\r
-\r
-\r
-/*\r
- * Lock Functions\r
- */\r
-\r
-typedef pthread_mutex_t DAPL_OS_LOCK;\r
-\r
-/* function prototypes */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_init (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_unlock (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_destroy (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-/* lock functions */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_init (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- /* pthread_mutex_init always returns 0 */\r
- pthread_mutex_init (m, NULL);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_lock (m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_unlock (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_unlock (m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_destroy (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_destroy (m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * Wait Objects\r
- */\r
-\r
-/*\r
- * The wait object invariant: Presuming a call to dapl_os_wait_object_wait\r
- * occurs at some point, there will be at least one wakeup after each call\r
- * to dapl_os_wait_object_signal. I.e. Signals are not ignored, though\r
- * they may be coallesced.\r
- */\r
-\r
-typedef struct\r
-{\r
- DAT_BOOLEAN signaled;\r
- pthread_cond_t cv;\r
- pthread_mutex_t lock;\r
-} DAPL_OS_WAIT_OBJECT;\r
-\r
-/* function prototypes */\r
-DAT_RETURN \r
-dapl_os_wait_object_init (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-\r
-DAT_RETURN \r
-dapl_os_wait_object_wait (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj, \r
- IN DAT_TIMEOUT timeout_val);\r
-\r
-DAT_RETURN \r
-dapl_os_wait_object_wakeup (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-\r
-DAT_RETURN \r
-dapl_os_wait_object_destroy (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-\r
-/*\r
- * Memory Functions\r
- */\r
-\r
-/* function prototypes */\r
-STATIC _INLINE_ void *dapl_os_alloc (int size);\r
-\r
-STATIC _INLINE_ void *dapl_os_realloc (void *ptr, int size);\r
-\r
-STATIC _INLINE_ void dapl_os_free (void *ptr, int size);\r
-\r
-STATIC _INLINE_ void * dapl_os_memzero (void *loc, int size);\r
-\r
-STATIC _INLINE_ void * dapl_os_memcpy (void *dest, const void *src, int len);\r
-\r
-STATIC _INLINE_ int dapl_os_memcmp (const void *mem1, const void *mem2, int len);\r
-\r
-/* memory functions */\r
-\r
-\r
-STATIC _INLINE_ void *dapl_os_alloc (int size)\r
-{\r
- return malloc (size);\r
-}\r
-\r
-STATIC _INLINE_ void *dapl_os_realloc (void *ptr, int size)\r
-{\r
- return realloc(ptr, size);\r
-}\r
-\r
-STATIC _INLINE_ void dapl_os_free (void *ptr, int size)\r
-{\r
- free (ptr);\r
-}\r
-\r
-STATIC _INLINE_ void * dapl_os_memzero (void *loc, int size)\r
-{\r
- return memset (loc, 0, size);\r
-}\r
-\r
-STATIC _INLINE_ void * dapl_os_memcpy (void *dest, const void *src, int len)\r
-{\r
- return memcpy (dest, src, len);\r
-}\r
-\r
-STATIC _INLINE_ int dapl_os_memcmp (const void *mem1, const void *mem2, int len)\r
-{\r
- return memcmp (mem1, mem2, len);\r
-}\r
-\r
-/*\r
- * String Functions\r
- */\r
-\r
-STATIC _INLINE_ unsigned int dapl_os_strlen(const char *str)\r
-{\r
- return strlen(str);\r
-}\r
-\r
-STATIC _INLINE_ char * dapl_os_strdup(const char *str)\r
-{\r
- return strdup(str);\r
-}\r
-\r
-\r
-/*\r
- * Timer Functions\r
- */\r
-\r
-typedef DAT_UINT64 DAPL_OS_TIMEVAL;\r
-\r
-\r
-typedef struct dapl_timer_entry DAPL_OS_TIMER;\r
-typedef unsigned long long int DAPL_OS_TICKS;\r
-\r
-/* function prototypes */\r
-\r
-/*\r
- * Sleep for the number of micro seconds specified by the invoking\r
- * function\r
- */\r
-STATIC _INLINE_ void dapl_os_sleep_usec (int sleep_time)\r
-{\r
- struct timespec sleep_spec, rem;\r
-\r
- /*\r
- * Sleep for the specified number of microseconds\r
- */\r
- sleep_spec.tv_sec = sleep_time / 100000;\r
- sleep_spec.tv_nsec = sleep_time % 100000 * 1000;\r
- nanosleep (&sleep_spec, &rem);\r
-}\r
-\r
-STATIC _INLINE_ DAPL_OS_TICKS dapl_os_get_ticks (void);\r
-\r
-STATIC _INLINE_ int dapl_os_ticks_to_seconds (DAPL_OS_TICKS ticks);\r
-\r
-\r
-DAT_RETURN dapl_os_get_time (DAPL_OS_TIMEVAL *);\r
-/* timer functions */\r
-\r
-STATIC _INLINE_ DAPL_OS_TICKS dapl_os_get_ticks (void)\r
-{\r
- DAPL_OS_TICKS x; \r
- __asm__ volatile(".byte 0x0f,0x31" : "=A" (x));\r
- return x;\r
-}\r
-\r
-STATIC _INLINE_ int dapl_os_ticks_to_seconds (DAPL_OS_TICKS ticks)\r
-{\r
- /* NOT YET IMPLEMENTED IN USER-SPACE */\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_timer_cancel()\r
- *\r
- * Cancel a running timer. The timer will invoke the specified\r
- * function after a number of useconds expires.\r
- *\r
- * Input:\r
- * timer Running timer\r
- *\r
- * Returns:\r
- * no return value\r
- *\r
- */\r
-void dapl_os_timer_cancel ( DAPL_OS_TIMER *timer );\r
-\r
-\r
-/*\r
- *\r
- * Name Service Helper functions\r
- *\r
- */\r
-#define dapls_osd_getaddrinfo(name, addr_ptr) getaddrinfo(name,NULL,NULL,addr_ptr)\r
-#define dapls_osd_freeaddrinfo(addr) freeaddrinfo (addr)\r
-\r
-/*\r
- * *printf format helpers. We use the C string constant concatenation\r
- * ability to define 64 bit formats, which unfortunatly are non standard\r
- * in the C compiler world. E.g. %llx for gcc, %I64x for Windows\r
- */\r
-#define F64d "%lld"\r
-#define F64u "%llu"\r
-#define F64x "%llx"\r
-#define F64X "%llX"\r
-\r
-\r
-/*\r
- * Conversion Functions\r
- */\r
-\r
-STATIC _INLINE_ long int\r
-dapl_os_strtol(const char *nptr, char **endptr, int base)\r
-{\r
- return strtol(nptr, endptr, base);\r
-}\r
-\r
-\r
-/*\r
- * Helper Functions\r
- */\r
-\r
-\r
-#define dapl_os_assert(expression) assert(expression)\r
-#define dapl_os_printf(...) fprintf(stderr,__VA_ARGS__)\r
-#define dapl_os_vprintf(fmt,args) vfprintf(stderr, fmt, args);\r
-#define dapl_os_syslog(fmt,args) vsyslog (LOG_USER | LOG_DEBUG,fmt,args)\r
-\r
-\r
-\r
-#endif /* _DAPL_OSD_H_ */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-#\r
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source\r
-# file to this component. This file merely indirects to the real make file\r
-# that is shared by all the driver components of the OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\..\inc\openib.def\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#*********************************************************************\r
-# \r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module\r
-#\r
-#*********************************************************************\r
-\r
-#*********************************************************************\r
-# \r
-# Dot Directives\r
-#\r
-#*********************************************************************/\r
-\r
-.SUFFIXES : # clear the .SUFFIXES list\r
-.SUFFIXES : .c # initialize .SUFFIXES list\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Macros\r
-#\r
-#*********************************************************************/\r
-\r
-UDAPL = .\r
-UDAPL_INCLUDE = $(UDAPL)/../include\r
-UDAPL_COMMON = $(UDAPL)/../common\r
-UDAPL_WINDOWS = $(UDAPL)/windows\r
-\r
-OBJ_PATH = $(UDAPL)/Obj\r
-TARGET_PATH = $(UDAPL)/Target\r
-\r
-OBJS = $(OBJ_PATH)/dapl_init.obj \\r
- $(OBJ_PATH)/dapl_timer_util.obj \\r
- $(OBJ_PATH)/dapl_name_service.obj \\r
- $(OBJ_PATH)/dapl_osd.obj \\r
- $(OBJ_PATH)/dapl_cookie.obj \\r
- $(OBJ_PATH)/dapl_cr_accept.obj \\r
- $(OBJ_PATH)/dapl_cr_query.obj \\r
- $(OBJ_PATH)/dapl_cr_reject.obj \\r
- $(OBJ_PATH)/dapl_cr_util.obj \\r
- $(OBJ_PATH)/dapl_cr_callback.obj \\r
- $(OBJ_PATH)/dapl_cr_handoff.obj \\r
- $(OBJ_PATH)/dapl_ep_connect.obj \\r
- $(OBJ_PATH)/dapl_ep_create.obj \\r
- $(OBJ_PATH)/dapl_ep_disconnect.obj \\r
- $(OBJ_PATH)/dapl_ep_dup_connect.obj \\r
- $(OBJ_PATH)/dapl_ep_free.obj \\r
- $(OBJ_PATH)/dapl_ep_reset.obj \\r
- $(OBJ_PATH)/dapl_ep_get_status.obj \\r
- $(OBJ_PATH)/dapl_ep_modify.obj \\r
- $(OBJ_PATH)/dapl_ep_post_rdma_read.obj \\r
- $(OBJ_PATH)/dapl_ep_post_rdma_write.obj \\r
- $(OBJ_PATH)/dapl_ep_post_recv.obj \\r
- $(OBJ_PATH)/dapl_ep_post_send.obj \\r
- $(OBJ_PATH)/dapl_ep_query.obj \\r
- $(OBJ_PATH)/dapl_ep_util.obj \\r
- $(OBJ_PATH)/dapl_evd_create.obj \\r
- $(OBJ_PATH)/dapl_evd_dequeue.obj \\r
- $(OBJ_PATH)/dapl_evd_disable.obj \\r
- $(OBJ_PATH)/dapl_evd_enable.obj \\r
- $(OBJ_PATH)/dapl_evd_free.obj \\r
- $(OBJ_PATH)/dapl_evd_modify_cno.obj \\r
- $(OBJ_PATH)/dapl_evd_post_se.obj \\r
- $(OBJ_PATH)/dapl_evd_query.obj \\r
- $(OBJ_PATH)/dapl_evd_resize.obj \\r
- $(OBJ_PATH)/dapl_evd_wait.obj \\r
- $(OBJ_PATH)/dapl_evd_util.obj \\r
- $(OBJ_PATH)/dapl_evd_cq_async_error_callb.obj \\r
- $(OBJ_PATH)/dapl_evd_qp_async_error_callb.obj \\r
- $(OBJ_PATH)/dapl_evd_un_async_error_callb.obj \\r
- $(OBJ_PATH)/dapl_evd_connection_callb.obj \\r
- $(OBJ_PATH)/dapl_evd_dto_callb.obj \\r
- $(OBJ_PATH)/dapl_evd_set_unwaitable.obj \\r
- $(OBJ_PATH)/dapl_evd_clear_unwaitable.obj \\r
- $(OBJ_PATH)/dapl_get_consumer_context.obj \\r
- $(OBJ_PATH)/dapl_get_handle_type.obj \\r
- $(OBJ_PATH)/dapl_hash.obj \\r
- $(OBJ_PATH)/dapl_hca_util.obj \\r
- $(OBJ_PATH)/dapl_ia_close.obj \\r
- $(OBJ_PATH)/dapl_ia_open.obj \\r
- $(OBJ_PATH)/dapl_ia_query.obj \\r
- $(OBJ_PATH)/dapl_ia_util.obj \\r
- $(OBJ_PATH)/dapl_llist.obj \\r
- $(OBJ_PATH)/dapl_lmr_create.obj \\r
- $(OBJ_PATH)/dapl_lmr_free.obj \\r
- $(OBJ_PATH)/dapl_lmr_query.obj \\r
- $(OBJ_PATH)/dapl_lmr_util.obj \\r
- $(OBJ_PATH)/dapl_mr_util.obj \\r
- $(OBJ_PATH)/dapl_provider.obj \\r
- $(OBJ_PATH)/dapl_sp_util.obj \\r
- $(OBJ_PATH)/dapl_psp_create.obj \\r
- $(OBJ_PATH)/dapl_psp_create_any.obj \\r
- $(OBJ_PATH)/dapl_psp_free.obj \\r
- $(OBJ_PATH)/dapl_psp_query.obj \\r
- $(OBJ_PATH)/dapl_pz_create.obj \\r
- $(OBJ_PATH)/dapl_pz_free.obj \\r
- $(OBJ_PATH)/dapl_pz_query.obj \\r
- $(OBJ_PATH)/dapl_pz_util.obj \\r
- $(OBJ_PATH)/dapl_rmr_create.obj \\r
- $(OBJ_PATH)/dapl_rmr_free.obj \\r
- $(OBJ_PATH)/dapl_rmr_bind.obj \\r
- $(OBJ_PATH)/dapl_rmr_query.obj \\r
- $(OBJ_PATH)/dapl_rmr_util.obj \\r
- $(OBJ_PATH)/dapl_rsp_create.obj \\r
- $(OBJ_PATH)/dapl_rsp_free.obj \\r
- $(OBJ_PATH)/dapl_rsp_query.obj \\r
- $(OBJ_PATH)/dapl_cno_create.obj \\r
- $(OBJ_PATH)/dapl_cno_modify_agent.obj \\r
- $(OBJ_PATH)/dapl_cno_free.obj \\r
- $(OBJ_PATH)/dapl_cno_wait.obj \\r
- $(OBJ_PATH)/dapl_cno_query.obj \\r
- $(OBJ_PATH)/dapl_cno_util.obj \\r
- $(OBJ_PATH)/dapl_set_consumer_context.obj \\r
- $(OBJ_PATH)/dapl_ring_buffer_util.obj \\r
- $(OBJ_PATH)/dapl_debug.obj\r
-\r
-LIBRARY = $(TARGET_PATH)/dapl.dll\r
-\r
-#\r
-# Provider specific flags & files\r
-#\r
-\r
-PROVIDER_LIB = $(SYSTEMROOT)\VerbsLibrary.lib\r
-\r
-# Define Provider for this build\r
-#IBAPI=1 \r
-# VAPI=1\r
-IBAL=1\r
-!if defined(VAPI)\r
-\r
-PROVIDER = $(UDAPL)/../vapi\r
-\r
-PROVIDER_OBJS = \\r
- $(OBJDIR)/dapl_vapi_util.obj \\r
- $(OBJDIR)/dapl_vapi_qp.obj \\r
- $(OBJDIR)/dapl_vapi_cm.obj\r
-\r
-PROVIDER_INCLUDES = \\r
- /I $(PROVIDER) \\r
- /I $(MTHOME)/include \r
-# /I $(DAPL_BASE)/include/ib/MELLANOX\r
-\r
-PROVIDER_CFLAGS = -DMTL_MODULE=M_dapl -DMAX_TRACE=8 -DMAX_DEBUG=8 -DMAX_ERROR=8 -DDAPL_DBG -DVAPI\r
-\r
-!endif\r
-\r
-!if defined(IBAPI)\r
-\r
-PROVIDER = $(UDAPL)/../ibapi\r
-\r
-PROVIDER_OBJS = $(OBJ_PATH)/dapl_ibapi_cm.obj \\r
- $(OBJ_PATH)/dapl_ibapi_qp.obj \\r
- $(OBJ_PATH)/dapl_ibapi_util.obj\r
-\r
-PROVIDER_INCLUDES = \\r
- /I $(PROVIDER) \\r
- /I $(UDAPL_INCLUDE)/ib/IBM \\r
- /I $(UDAPL_INCLUDE)/ib/IBM/us\r
-\r
-PROVIDER_CFLAGS = -DIBAPI -DDAPL_ATS\r
-\r
-!endif\r
-!if defined(IBAL)\r
-\r
-PROVIDER = $(UDAPL)/../ibal\r
-\r
-PROVIDER_OBJS = $(OBJ_PATH)/dapl_ibal_cm.obj \\r
- $(OBJ_PATH)/dapl_ibal_qp.obj \\r
- $(OBJ_PATH)/dapl_ibal_util.obj\r
-\r
-PROVIDER_INCLUDES = \\r
- /I $(PROVIDER) \\r
- /I $(UDAPL_INCLUDE)/../../../winuser/include/ \\r
- /I $(UDAPL_INCLUDE)/../../../shared/include/ \\r
- /I $(UDAPL_INCLUDE)/../../../shared/include/iba\r
-\r
-PROVIDER_CFLAGS = /DIBAL /DDAPL_ATS /D_VENDOR_IBAL_ /DDAPL_DBG\r
-\r
-!endif\r
-\r
-#\r
-# Compiler \r
-#\r
-\r
-CC = cl\r
-\r
-INC_FLAGS = \\r
- /I ../../dat/include \\r
- /I $(UDAPL) \\r
- /I $(UDAPL_INCLUDE) \\r
- /I $(UDAPL_COMMON) \\r
- /I $(UDAPL_WINDOWS) \\r
- $(PROVIDER_INCLUDES)\r
-\r
-CC_FLAGS = \\r
- /nologo /Zel /Gy /W3 /Gd /QIfdiv- /QIf /QI0f /GB /Gi- /Gm- \\r
- /GX- /GR- /GF /Z7 /Od /Oi /Oy- /DWIN32 /D_X86_ /D__i386__ \\r
- $(INC_FLAGS) $(PROVIDER_CFLAGS)\r
-\r
-#\r
-# Linker\r
-#\r
-\r
-LINK = link\r
-\r
-LIBS = libc.lib ws2_32.lib $(PROVIDER_LIB) ../../dat/udat/Target/dat.lib\r
-\r
-LINK_FLAGS = \\r
- /nologo /dll /DEF:$(UDAPL_WINDOWS)/dapl_win.def \\r
- /DEBUG /incremental:no /machine:I386 $(LIBS)\r
-\r
-#\r
-# System Utilities\r
-#\r
-\r
-RM = rm -f\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Inference Rules\r
-#\r
-#*********************************************************************/\r
-\r
-{$(UDAPL)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-{$(UDAPL_COMMON)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-{$(UDAPL_WINDOWS)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-{$(PROVIDER)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-\r
-#*********************************************************************\r
-#\r
-# Description Blocks\r
-#\r
-#*********************************************************************/\r
-\r
-all : mkdirs $(LIBRARY)\r
-\r
-mkdirs:\r
- if not exist "$(OBJ_PATH)" mkdir "$(OBJ_PATH)"\r
- if not exist "$(TARGET_PATH)" mkdir "$(TARGET_PATH)"\r
-\r
-$(LIBRARY) : $(OBJS) $(PROVIDER_OBJS)\r
- $(LINK) $(LINK_FLAGS) /out:$(LIBRARY) $(OBJS) $(PROVIDER_OBJS)\r
-\r
-clean: \r
- $(RM) $(OBJS) $(PROVIDER_OBJS)\r
- $(RM) $(LIBRARY) \r
- $(RM) $(TARGET_PATH)/*.pdb $(TARGET_PATH)/*.exp $(TARGET_PATH)/*.lib\r
+++ /dev/null
-/*\r
- * Copyright (c) 2007 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE VFT_DLL\r
-#define VER_FILESUBTYPE VFT2_UNKNOWN\r
-\r
-#if DBG\r
-#define VER_FILEDESCRIPTION_STR "Direct Access Provider Library v1.1 (Debug)"\r
-#define VER_INTERNALNAME_STR "dapld.dll"\r
-#define VER_ORIGINALFILENAME_STR "dapld.dll"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR "Direct Access Provider Library v1.1"\r
-#define VER_INTERNALNAME_STR "dapl.dll"\r
-#define VER_ORIGINALFILENAME_STR "dapl.dll"\r
-#endif\r
-\r
-#include <common.ver>\r
+++ /dev/null
-#if DBG\r
-LIBRARY dapld.dll\r
-#else\r
-LIBRARY dapl.dll\r
-#endif\r
-\r
-#ifndef _WIN64\r
-EXPORTS\r
-dat_provider_init\r
-dat_provider_fini\r
-#endif\r
+++ /dev/null
-/*\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/* \r
- * Include all files that are not in children directories.\r
- */\r
-\r
-#include "..\common\dapl_cno_create.c"\r
-#include "..\common\dapl_cno_free.c"\r
-#include "..\common\dapl_cno_modify_agent.c"\r
-#include "..\common\dapl_cno_query.c"\r
-#include "..\common\dapl_cno_util.c"\r
-#include "..\common\dapl_cno_wait.c"\r
-#include "..\common\dapl_cookie.c"\r
-#include "..\common\dapl_cr_accept.c"\r
-#include "..\common\dapl_cr_callback.c"\r
-#include "..\common\dapl_cr_handoff.c"\r
-#include "..\common\dapl_cr_query.c"\r
-#include "..\common\dapl_cr_reject.c"\r
-#include "..\common\dapl_cr_util.c"\r
-#include "..\common\dapl_debug.c"\r
-#include "..\common\dapl_ep_connect.c"\r
-#include "..\common\dapl_ep_create.c"\r
-#include "..\common\dapl_ep_disconnect.c"\r
-#include "..\common\dapl_ep_dup_connect.c"\r
-#include "..\common\dapl_ep_free.c"\r
-#include "..\common\dapl_ep_get_status.c"\r
-#include "..\common\dapl_ep_modify.c"\r
-#include "..\common\dapl_ep_post_rdma_read.c"\r
-#include "..\common\dapl_ep_post_rdma_write.c"\r
-#include "..\common\dapl_ep_post_recv.c"\r
-#include "..\common\dapl_ep_post_send.c"\r
-#include "..\common\dapl_ep_query.c"\r
-#include "..\common\dapl_ep_reset.c"\r
-#include "..\common\dapl_ep_util.c"\r
-#include "..\common\dapl_evd_clear_unwaitable.c"\r
-#include "..\common\dapl_evd_connection_callb.c"\r
-#include "..\common\dapl_evd_cq_async_error_callb.c"\r
-#include "..\common\dapl_evd_create.c"\r
-#include "..\common\dapl_evd_dequeue.c"\r
-#include "..\common\dapl_evd_disable.c"\r
-#include "..\common\dapl_evd_dto_callb.c"\r
-#include "..\common\dapl_evd_enable.c"\r
-#include "..\common\dapl_evd_free.c"\r
-#include "..\common\dapl_evd_modify_cno.c"\r
-#include "..\common\dapl_evd_post_se.c"\r
-#include "..\common\dapl_evd_qp_async_error_callb.c"\r
-#include "..\common\dapl_evd_query.c"\r
-#include "..\common\dapl_evd_resize.c"\r
-#include "..\common\dapl_evd_set_unwaitable.c"\r
-#include "..\common\dapl_evd_un_async_error_callb.c"\r
-#include "..\common\dapl_evd_util.c"\r
-#include "..\common\dapl_evd_wait.c"\r
-#include "..\common\dapl_get_consumer_context.c"\r
-#include "..\common\dapl_get_handle_type.c"\r
-#include "..\common\dapl_hash.c"\r
-#include "..\common\dapl_hca_util.c"\r
-#include "..\common\dapl_ia_close.c"\r
-#include "..\common\dapl_ia_open.c"\r
-#include "..\common\dapl_ia_query.c"\r
-#include "..\common\dapl_ia_util.c"\r
-#include "..\common\dapl_llist.c"\r
-#include "..\common\dapl_lmr_create.c"\r
-#include "..\common\dapl_lmr_free.c"\r
-#include "..\common\dapl_lmr_query.c"\r
-#include "..\common\dapl_lmr_util.c"\r
-#include "..\common\dapl_mr_util.c"\r
-#include "..\common\dapl_provider.c"\r
-#include "..\common\dapl_psp_create.c"\r
-#include "..\common\dapl_psp_create_any.c"\r
-#include "..\common\dapl_psp_free.c"\r
-#include "..\common\dapl_psp_query.c"\r
-#include "..\common\dapl_pz_create.c"\r
-#include "..\common\dapl_pz_free.c"\r
-#include "..\common\dapl_pz_query.c"\r
-#include "..\common\dapl_pz_util.c"\r
-#include "..\common\dapl_ring_buffer_util.c"\r
-#include "..\common\dapl_rmr_bind.c"\r
-#include "..\common\dapl_rmr_create.c"\r
-#include "..\common\dapl_rmr_free.c"\r
-#include "..\common\dapl_rmr_query.c"\r
-#include "..\common\dapl_rmr_util.c"\r
-#include "..\common\dapl_rsp_create.c"\r
-#include "..\common\dapl_rsp_free.c"\r
-#include "..\common\dapl_rsp_query.c"\r
-#include "..\common\dapl_set_consumer_context.c"\r
-#include "..\common\dapl_sp_util.c"\r
-#include "..\ibal\dapl_ibal_cm.c"\r
-#include "..\ibal\dapl_ibal_qp.c"\r
-#include "..\ibal\dapl_ibal_util.c"\r
-#include "windows\dapl_osd.c"\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dapl_osd.c\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description: \r
- * Provide OS dependent functions with a canonical DAPL\r
- * interface. Designed to be portable and hide OS specific quirks\r
- * of common functions.\r
- * \r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-/*\r
- * MUST have the Microsoft Platform SDK installed for Windows to build\r
- * and work properly\r
- */\r
-#include "dapl.h"\r
-#include "dapl_osd.h"\r
-#include <sys/timeb.h>\r
-#include <stdlib.h> /* needed for getenv() */\r
-\r
-\r
-\r
-/*\r
- * DllMain\r
- *\r
- * Primary Windows entry point\r
- *\r
- * Input:\r
- * hDllHandle handle to DLL module\r
- * fdwReason reason for calling function\r
- * lpReserved reserved\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-\r
-BOOL WINAPI\r
-DllMain (\r
- IN HINSTANCE hDllHandle,\r
- IN DWORD fdwReason,\r
- IN LPVOID lpReserved )\r
-{\r
- UNREFERENCED_PARAMETER(lpReserved);\r
- switch( fdwReason ) \r
- { \r
- case DLL_PROCESS_ATTACH:\r
- /*\r
- * We don't attach/detach threads that need any sort\r
- * of initialization, so disable this ability to optimize\r
- * the working set size of the DLL. Also allows us to\r
- * remove two case statemens:\r
- * DLL_THREAD_DETACH and DLL_THREAD_ATTACH\r
- */\r
- if ( (DisableThreadLibraryCalls( hDllHandle )) != 0)\r
- {\r
- //fprintf(stderr, "DAPL dll_PROCESS_attach!\n");\r
- //dapl_init ();\r
- break;\r
- }\r
- else\r
- {\r
- DWORD err = GetLastError();\r
- dapl_os_printf("DAPL Init Failed with code %u\n", err);\r
- break;\r
- }\r
- case DLL_PROCESS_DETACH:\r
- /* \r
- * Do library cleanup\r
- */\r
- //dapl_fini ();\r
- break;\r
- }\r
- return TRUE; \r
-}\r
-\r
-\r
-/*\r
- * dapl_osd_init\r
- *\r
- * Do Windows specific initialization:\r
- * - nothing at this time\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Returns:\r
- * none\r
- */\r
-void\r
-dapl_osd_init ( )\r
-{\r
- return;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get_time\r
- *\r
- * Return 64 bit value of current time in microseconds.\r
- *\r
- * Input:\r
- * loc User location to place current time\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-\r
-DAT_RETURN\r
-dapl_os_get_time (\r
- OUT DAPL_OS_TIMEVAL * loc)\r
-{\r
- struct _timeb tb;\r
- \r
- _ftime ( &tb );\r
-\r
- *loc = ((DAT_UINT64) (tb.time * 1000000L) + (DAT_UINT64) tb.millitm * 1000);\r
- \r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get_bool_env\r
- *\r
- * Return boolean value of passed in environment variable: 1 if present,\r
- * 0 if not\r
- *\r
- * Input:\r
- * \r
- *\r
- * Returns:\r
- * TRUE or FALSE\r
- */\r
-int\r
-dapl_os_get_env_bool (\r
- char *env_str )\r
-{\r
- char *env_var;\r
-\r
- env_var = getenv (env_str);\r
- if (env_var != NULL)\r
- {\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
- * dapl_os_get_val_env\r
- *\r
- * Update val to value of passed in environment variable if present\r
- *\r
- * Input:\r
- * env_str\r
- * def_val default value if environment variable does not exist\r
- *\r
- * Returns:\r
- * TRUE or FALSE\r
- */\r
-int\r
-dapl_os_get_env_val (\r
- char *env_str,\r
- int def_val )\r
-{\r
- char *env_var;\r
-\r
- env_var = getenv (env_str);\r
- if ( env_var != NULL )\r
- {\r
- def_val = strtol (env_var, NULL, 0);\r
- }\r
-\r
- return def_val;\r
-}\r
-\r
-\r
-/*\r
- * dapls_os_thread_create\r
- *\r
- * Create a thread for dapl\r
- *\r
- * Input:\r
- * func function to invoke thread\r
- * data argument to pass to function\r
- *\r
- * Output\r
- * thread_id handle for thread\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-DAT_RETURN \r
-dapl_os_thread_create (\r
- IN void (*func) (void *),\r
- IN void *data,\r
- OUT DAPL_OS_THREAD *thread_id )\r
-{\r
-\r
- *thread_id = CreateThread(\r
- NULL, /* &thread security attrs */\r
- 8 * 1024, /* initial thread stack size */\r
- (LPTHREAD_START_ROUTINE)func, /* &thread function */\r
- data, /* argument for new thread */\r
- 0, /* creation flags */\r
- NULL); /* thread ID (ignore) */\r
-\r
- if ( *thread_id == NULL )\r
- {\r
- return DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, 0);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dapl_osd.h\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description:\r
- * Provide OS dependent data structures & functions with\r
- * a canonical DAPL interface. Designed to be portable\r
- * and hide OS specific quirks of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_OSD_H_\r
-#define _DAPL_OSD_H_\r
-\r
-/*\r
- * This file is defined for Linux systems only, including it on any\r
- * other build will cause an error\r
- */\r
-#ifndef _WIN32\r
-#error UNDEFINED OS TYPE\r
-#endif /* WIN32 */\r
-\r
-#include <stddef.h>\r
-#include <complib/cl_types.h>\r
-#pragma warning ( push, 3 )\r
-#include <winioctl.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <winsock2.h>\r
-#include <Ws2tcpip.h>\r
-#include <stdlib.h>\r
-#pragma warning ( pop )\r
-\r
-#include "dapl_debug.h"\r
-\r
-/* Export Header */\r
-#ifdef EXPORT_DAPL_SYMBOLS /* 1 when building DAPL DLL, 0 for clients */\r
-#define DAPL_EXPORT __declspec( dllexport )\r
-#else\r
-#define DAPL_EXPORT __declspec( dllimport )\r
-#endif\r
-\r
-/* Useful debug definitions */\r
-#ifndef STATIC\r
-#define STATIC static\r
-#endif /* STATIC */\r
-#ifndef _INLINE_\r
-#define _INLINE_ __inline\r
-#endif /* _INLINE_ */\r
-/*\r
-typedef int * intptr_t;\r
-typedef unsigned int * uintptr_t;\r
-typedef __int64 int64_t;\r
-typedef unsigned __int64 uint64_t;\r
-typedef __int32 int32_t;\r
-typedef unsigned __int32 uint32_t;\r
-*/\r
-#define dapl_ip_addr6(sockaddr) (((struct sockaddr_in6 *)sockaddr)->sin6_addr.s6_addr)\r
-\r
-\r
-#define dapl_os_panic(str) \\r
- { \\r
- fprintf(stderr, "PANIC in %s:%i:%s\n", __FILE__, __LINE__); \\r
- fprintf(stderr, str); \\r
- exit(1); \\r
- }\r
-\r
-/*\r
- * Atomic operations\r
- */\r
-\r
-typedef volatile DAT_COUNT DAPL_ATOMIC;\r
-\r
-/* atomic function prototypes */\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_inc (\r
- INOUT DAPL_ATOMIC *v);\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_dec ( \r
- INOUT DAPL_ATOMIC *v);\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_assign (\r
- INOUT DAPL_ATOMIC *v,\r
- IN DAT_COUNT match_value,\r
- IN DAT_COUNT new_value );\r
-\r
-int dapl_os_get_env_bool (\r
- char *env_str );\r
-\r
-int dapl_os_get_env_val (\r
- char *env_str,\r
- int def_val );\r
-\r
-\r
-/* atomic functions */\r
-\r
-/* dapl_os_atomic_inc\r
- *\r
- * get the current value of '*v', and then increment it.\r
- *\r
- * This is equivalent to an IB atomic fetch and add of 1,\r
- * except that a DAT_COUNT might be 32 bits, rather than 64\r
- * and it occurs in local memory.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_inc (\r
- INOUT DAPL_ATOMIC *v)\r
-{\r
- return InterlockedIncrement( v );\r
-}\r
-\r
-\r
-/* dapl_os_atomic_dec\r
- *\r
- * decrement the current value of '*v'. No return value is required.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_dec ( \r
- INOUT DAPL_ATOMIC *v)\r
-{\r
- return InterlockedDecrement( v );\r
-}\r
-\r
-\r
-/* dapl_os_atomic_assign\r
- *\r
- * assign 'new_value' to '*v' if the current value\r
- * matches the provided 'match_value'.\r
- *\r
- * Make no assignment if there is no match.\r
- *\r
- * Return the current value in any case.\r
- *\r
- * This matches the IBTA atomic operation compare & swap\r
- * except that it is for local memory and a DAT_COUNT may\r
- * be only 32 bits, rather than 64.\r
- */\r
-\r
-STATIC _INLINE_ DAT_COUNT\r
-dapl_os_atomic_assign (\r
- INOUT DAPL_ATOMIC *v,\r
- IN DAT_COUNT match_value,\r
- IN DAT_COUNT new_value )\r
-{\r
- return InterlockedCompareExchange((LPLONG)v, \r
- new_value,\r
- match_value);\r
-}\r
-\r
-\r
-/*\r
- * Thread Functions\r
- */\r
-typedef HANDLE DAPL_OS_THREAD; /* XXX Need to implement! */\r
-\r
-DAT_RETURN \r
-dapl_os_thread_create (\r
- IN void (*func) (void *),\r
- IN void *data,\r
- OUT DAPL_OS_THREAD *thread_id );\r
-\r
-\r
-/*\r
- * Lock Functions\r
- */\r
-typedef HANDLE DAPL_OS_LOCK;\r
-\r
-/* function prototypes */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_init (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_unlock (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_destroy (\r
- IN DAPL_OS_LOCK *m);\r
-\r
-/* lock functions */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_init (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- *m = CreateMutex (0, FALSE, 0);\r
-\r
- return *m ? DAT_SUCCESS : (DAT_CLASS_ERROR | DAT_INSUFFICIENT_RESOURCES);\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- WaitForSingleObject (*m, INFINITE);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_unlock (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- ReleaseMutex (*m);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_lock_destroy (\r
- IN DAPL_OS_LOCK *m)\r
-{\r
- CloseHandle (*m);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Wait Objects\r
- */\r
-\r
-/*\r
- * The wait object invariant: Presuming a call to dapl_os_wait_object_wait\r
- * occurs at some point, there will be at least one wakeup after each call\r
- * to dapl_os_wait_object_signal. I.e. Signals are not ignored, though\r
- * they may be coallesced.\r
- */\r
-\r
-typedef HANDLE DAPL_OS_WAIT_OBJECT;\r
-\r
-/* function prototypes */\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_init (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_wait (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj, \r
- IN DAT_TIMEOUT timeout_val);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_wakeup (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_destroy (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj);\r
-/* wait_object functions */\r
-\r
-/* Initialize a wait object to an empty state\r
- */\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_init (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- *wait_obj = CreateEvent(NULL,FALSE,FALSE,NULL);\r
-\r
- if ( *wait_obj == NULL )\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/* Wait on the supplied wait object, up to the specified time_out,\r
- * and reacquiring it after the wait ends.\r
- * A timeout of DAT_TIMEOUT_INFINITE will wait indefinitely.\r
- * Timeout should be specified in micro seconds.\r
- *\r
- * Functional returns:\r
- * DAT_SUCCESS -- another thread invoked dapl_os_wait object_wakeup\r
- * DAT_INVALID_STATE -- someone else is already waiting in this wait\r
- * object.\r
- * only one waiter is allowed at a time.\r
- * DAT_ABORT -- another thread invoked dapl_os_wait_object_destroy\r
- * DAT_TIMEOUT -- the specified time limit was reached.\r
- */\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_wait (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj, \r
- IN DAT_TIMEOUT timeout_val)\r
-{\r
- DAT_RETURN status;\r
- DWORD op_status;\r
-\r
- status = DAT_SUCCESS;\r
-\r
- if ( DAT_TIMEOUT_INFINITE == timeout_val )\r
- {\r
- op_status = WaitForSingleObject(*wait_obj, INFINITE);\r
- }\r
- else\r
- {\r
- /* convert to milliseconds */\r
- op_status = WaitForSingleObject(*wait_obj, timeout_val/1000);\r
- }\r
-\r
- if (op_status == WAIT_TIMEOUT)\r
- {\r
- status = DAT_CLASS_ERROR | DAT_TIMEOUT_EXPIRED;\r
- }\r
- else if ( op_status == WAIT_FAILED)\r
- {\r
- status = DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_wakeup (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- DWORD op_status;\r
-\r
- op_status = SetEvent(*wait_obj);\r
- if ( op_status == 0 )\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC _INLINE_ DAT_RETURN \r
-dapl_os_wait_object_destroy (\r
- IN DAPL_OS_WAIT_OBJECT *wait_obj)\r
-{\r
- DWORD op_status;\r
- DAT_RETURN status = DAT_SUCCESS;\r
-\r
- op_status = CloseHandle(*wait_obj);\r
-\r
- if ( op_status == 0 )\r
- {\r
- status = DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/*\r
- * Memory Functions\r
- */\r
-\r
-/* function prototypes */\r
-STATIC _INLINE_ void *dapl_os_alloc (int size);\r
-\r
-STATIC _INLINE_ void *dapl_os_realloc (void *ptr, int size);\r
-\r
-STATIC _INLINE_ void dapl_os_free (void *ptr, int size);\r
-\r
-STATIC _INLINE_ void * dapl_os_memzero (void *loc, int size);\r
-\r
-STATIC _INLINE_ void * dapl_os_memcpy (void *dest, const void *src, int len);\r
-\r
-STATIC _INLINE_ int dapl_os_memcmp (const void *mem1, const void *mem2, int len);\r
-\r
-/* memory functions */\r
-\r
-\r
-STATIC _INLINE_ void *dapl_os_alloc (int size)\r
-{\r
- return malloc (size);\r
-}\r
-\r
-STATIC _INLINE_ void *dapl_os_realloc (void *ptr, int size)\r
-{\r
- return realloc(ptr, size);\r
-}\r
-\r
-STATIC _INLINE_ void dapl_os_free (void *ptr, int size)\r
-{\r
- size = size;\r
- free (ptr);\r
- ptr = NULL;\r
-}\r
-\r
-STATIC _INLINE_ void * dapl_os_memzero (void *loc, int size)\r
-{\r
- return memset (loc, 0, size);\r
-}\r
-\r
-STATIC _INLINE_ void * dapl_os_memcpy (void *dest, const void *src, int len)\r
-{\r
- return memcpy (dest, src, len);\r
-}\r
-\r
-STATIC _INLINE_ int dapl_os_memcmp (const void *mem1, const void *mem2, int len)\r
-{\r
- return memcmp (mem1, mem2, len);\r
-}\r
-\r
-\r
-STATIC _INLINE_ unsigned int dapl_os_strlen(const char *str)\r
-{\r
- return ((unsigned int)strlen(str));\r
-}\r
-\r
-STATIC _INLINE_ char * dapl_os_strdup(const char *str)\r
-{\r
- return _strdup(str);\r
-}\r
-\r
-\r
-/*\r
- * Timer Functions\r
- */\r
-\r
-typedef DAT_UINT64 DAPL_OS_TIMEVAL;\r
-typedef struct dapl_timer_entry DAPL_OS_TIMER;\r
-typedef unsigned long DAPL_OS_TICKS;\r
-\r
-/* function prototypes */\r
-\r
-/*\r
- * Sleep for the number of micro seconds specified by the invoking\r
- * function\r
- */\r
-STATIC _INLINE_ void dapl_os_sleep_usec (int sleep_time)\r
-{\r
- Sleep(sleep_time/1000);\r
-}\r
-\r
-STATIC _INLINE_ DAPL_OS_TICKS dapl_os_get_ticks (void);\r
-\r
-STATIC _INLINE_ int dapl_os_ticks_to_seconds (DAPL_OS_TICKS ticks);\r
-\r
-DAT_RETURN dapl_os_get_time (DAPL_OS_TIMEVAL *);\r
-/* timer functions */\r
-\r
-STATIC _INLINE_ DAPL_OS_TICKS dapl_os_get_ticks (void)\r
-{\r
- return GetTickCount ();\r
-}\r
-\r
-STATIC _INLINE_ int dapl_os_ticks_to_seconds (DAPL_OS_TICKS ticks)\r
-{\r
- ticks = ticks;\r
- /* NOT YET IMPLEMENTED IN USER-SPACE */\r
- return 0;\r
-}\r
-\r
-\r
-/*\r
- *\r
- * Name Service Helper functions\r
- *\r
- */\r
-#ifdef IBHOSTS_NAMING\r
-#define dapls_osd_getaddrinfo(name, addr_ptr) getaddrinfo(name,NULL,NULL,addr_ptr)\r
-#define dapls_osd_freeaddrinfo(addr) freeaddrinfo (addr)\r
-\r
-#endif /* IBHOSTS_NAMING */\r
-\r
-/*\r
- * *printf format helpers. We use the C string constant concatenation\r
- * ability to define 64 bit formats, which unfortunatly are non standard\r
- * in the C compiler world. E.g. %llx for gcc, %I64x for Windows\r
- */\r
-#define F64d "%I64d"\r
-#define F64u "%I64u"\r
-#define F64x "%I64x"\r
-#define F64X "%I64X"\r
-\r
-/*\r
- * Conversion Functions\r
- */\r
-\r
-STATIC _INLINE_ long int\r
-dapl_os_strtol(const char *nptr, char **endptr, int base)\r
-{\r
- return strtol(nptr, endptr, base);\r
-}\r
-\r
-\r
-/*\r
- * Debug Helper Functions\r
- */\r
-\r
-#define dapl_os_assert(expression) CL_ASSERT(expression)\r
-\r
-#define dapl_os_printf printf\r
-#define dapl_os_vprintf(fmt,args) vprintf(fmt,args)\r
-#define dapl_os_syslog(fmt,args) /* XXX Need log routine call */\r
-\r
-\r
-#endif /* _DAPL_OSD_H_ */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-EXPORTS\r
-\r
-dapl_ia_open\r
-dapl_ia_close\r
-dapl_ia_query\r
-dapl_set_consumer_context\r
-dapl_get_consumer_context\r
-dapl_get_handle_type\r
-dapl_cno_create\r
-dapl_cno_modify_agent\r
-dapl_cno_query\r
-dapl_cno_free\r
-dapl_cno_wait\r
-dapl_cr_query\r
-dapl_cr_accept\r
-dapl_cr_reject\r
-dapl_cr_handoff\r
-dapl_evd_create\r
-dapl_evd_query\r
-dapl_evd_modify_cno\r
-dapl_evd_enable\r
-dapl_evd_disable\r
-dapl_evd_wait\r
-dapl_evd_post_se\r
-dapl_evd_dequeue\r
-dapl_evd_free\r
-dapl_ep_create\r
-dapl_ep_query\r
-dapl_ep_modify\r
-dapl_ep_connect\r
-dapl_ep_dup_connect\r
-dapl_ep_disconnect\r
-dapl_ep_post_send\r
-dapl_ep_post_recv\r
-dapl_ep_post_rdma_read\r
-dapl_ep_post_rdma_write\r
-dapl_ep_get_status\r
-dapl_ep_free\r
-dapl_lmr_create\r
-dapl_lmr_query\r
-dapl_lmr_free\r
-dapl_rmr_create\r
-dapl_rmr_query\r
-dapl_rmr_bind\r
-dapl_rmr_free\r
-dapl_psp_create\r
-dapl_psp_query\r
-dapl_psp_free\r
-dapl_rsp_create\r
-dapl_rsp_query\r
-dapl_rsp_free\r
-dapl_pz_create\r
-dapl_pz_query\r
-dapl_pz_free\r
-dapl_init\r
-dapl_fini\r
-\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#include <windows.h>\r
-\r
-#ifdef _WIN32\r
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
-#pragma code_page(1252)\r
-#endif //_WIN32\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Update Version info for each release\r
-//\r
-\r
-VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 0,0,0,5\r
- PRODUCTVERSION 0,0,0,5\r
- FILEFLAGSMASK 0x3fL\r
-#ifdef _DEBUG\r
- FILEFLAGS 0x1L\r
-#else\r
- FILEFLAGS 0x0L\r
-#endif\r
- FILEOS 0x40004L\r
- FILETYPE 0x1L\r
- FILESUBTYPE 0x0L\r
-BEGIN\r
- BLOCK "StringFileInfo"\r
- BEGIN\r
- BLOCK "040904b0"\r
- BEGIN\r
- VALUE "Comments", "DAPL Reference Implementation, available at https://sourceforge.net/projects/dapl/ \0"\r
- VALUE "CompanyName", "DAT Collaborative\0"\r
- VALUE "FileDescription", "dapl.dll\0"\r
- VALUE "FileVersion", "0, 0, 0, 4\0"\r
- VALUE "InternalName", "dapl.dll\0"\r
- VALUE "LegalCopyright", "Common Public License 1.0 or The BSD License\0"\r
- VALUE "LegalTrademarks", "\0"\r
- VALUE "OriginalFilename", "dapl.dll\0"\r
- VALUE "PrivateBuild", "\0"\r
- VALUE "ProductName", "DAPL Reference Implementation\0"\r
- VALUE "ProductVersion", "0, 0, 0, 4\0"\r
- VALUE "SpecialBuild", "\0"\r
- END\r
- END\r
- BLOCK "VarFileInfo"\r
- BEGIN\r
- VALUE "Translation", 0x409, 1200\r
- END\r
-END\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_dictionary.c\r
- *\r
- * PURPOSE: dictionary data structure\r
- *\r
- **********************************************************************/\r
-\r
-\r
-#include "dat_dictionary.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Structures *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct DAT_DICTIONARY_NODE\r
-{\r
- DAT_PROVIDER_INFO key;\r
- DAT_DICTIONARY_DATA data;\r
- struct DAT_DICTIONARY_NODE *prev;\r
- struct DAT_DICTIONARY_NODE *next;\r
-} DAT_DICTIONARY_NODE;\r
-\r
-\r
-struct DAT_DICTIONARY\r
-{\r
- DAT_DICTIONARY_NODE *head;\r
- DAT_DICTIONARY_NODE *tail;\r
- DAT_COUNT size;\r
-};\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_RETURN\r
-dat_dictionary_key_dup (\r
- const DAT_PROVIDER_INFO *old_key,\r
- DAT_PROVIDER_INFO *new_key );\r
-\r
-static DAT_BOOLEAN\r
-dat_dictionary_key_is_equal (\r
- const DAT_PROVIDER_INFO *key_a,\r
- const DAT_PROVIDER_INFO *key_b );\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_create\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_create (\r
- OUT DAT_DICTIONARY **pp_dictionary)\r
-{\r
- DAT_DICTIONARY *p_dictionary;\r
- DAT_RETURN status;\r
-\r
- dat_os_assert ( NULL != pp_dictionary);\r
-\r
- status = DAT_SUCCESS;\r
- \r
- /* create the dictionary */\r
- p_dictionary = dat_os_alloc (sizeof (DAT_DICTIONARY));\r
- if (NULL == p_dictionary)\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- \r
- dat_os_memset (p_dictionary, '\0', sizeof (DAT_DICTIONARY));\r
-\r
- /* create the head node */\r
- p_dictionary->head = dat_os_alloc (sizeof (DAT_DICTIONARY_NODE));\r
- if (NULL == p_dictionary->head)\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_os_memset (p_dictionary->head, '\0', sizeof (DAT_DICTIONARY_NODE));\r
-\r
- /* create the tail node */\r
- p_dictionary->tail = dat_os_alloc (sizeof (DAT_DICTIONARY_NODE));\r
- if (NULL == p_dictionary->tail)\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_os_memset (p_dictionary->tail, '\0', sizeof (DAT_DICTIONARY_NODE));\r
-\r
- p_dictionary->head->next = p_dictionary->tail;\r
- p_dictionary->tail->prev = p_dictionary->head;\r
-\r
- *pp_dictionary = p_dictionary;\r
-\r
- bail:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != p_dictionary )\r
- {\r
- dat_os_free (p_dictionary, sizeof (DAT_DICTIONARY));\r
- \r
- if ( NULL != p_dictionary->head )\r
- {\r
- dat_os_free (p_dictionary->head, sizeof (DAT_DICTIONARY_NODE));\r
- }\r
-\r
- if ( NULL != p_dictionary->tail )\r
- {\r
- dat_os_free (p_dictionary->tail, sizeof (DAT_DICTIONARY_NODE));\r
- }\r
- }\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_destroy\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_destroy (\r
- IN DAT_DICTIONARY *p_dictionary)\r
-{\r
- DAT_DICTIONARY_NODE *cur_node;\r
-\r
- dat_os_assert (NULL != p_dictionary);\r
- \r
- while (NULL != p_dictionary->head)\r
- {\r
- cur_node = p_dictionary->head;\r
- p_dictionary->head = cur_node->next;\r
-\r
- dat_os_free (cur_node, sizeof (DAT_DICTIONARY_NODE));\r
- }\r
-\r
- dat_os_free (p_dictionary, sizeof (DAT_DICTIONARY));\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_size\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_size (\r
- IN DAT_DICTIONARY *p_dictionary,\r
- OUT DAT_COUNT *p_size)\r
-{\r
- dat_os_assert (NULL != p_dictionary);\r
- dat_os_assert (NULL != p_size);\r
-\r
- *p_size = p_dictionary->size;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_entry_create\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_entry_create (\r
- OUT DAT_DICTIONARY_ENTRY *p_entry)\r
-{\r
- DAT_DICTIONARY_NODE *node;\r
- DAT_RETURN dat_status;\r
-\r
- dat_os_assert (NULL != p_entry);\r
-\r
- dat_status = DAT_SUCCESS;\r
-\r
- node = dat_os_alloc (sizeof (DAT_DICTIONARY_NODE));\r
- if (NULL == node)\r
- {\r
- dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- *p_entry = node;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_entry_destroy\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_entry_destroy (\r
- OUT DAT_DICTIONARY_ENTRY entry)\r
-{\r
- dat_os_free (entry, sizeof (DAT_DICTIONARY_NODE));\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_insert\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_insert (\r
- IN DAT_DICTIONARY *p_dictionary, \r
- IN DAT_DICTIONARY_ENTRY entry,\r
- IN const DAT_PROVIDER_INFO *key,\r
- IN DAT_DICTIONARY_DATA data)\r
-{\r
- DAT_RETURN dat_status;\r
- DAT_DICTIONARY_NODE *cur_node, *prev_node, *next_node;\r
-\r
- dat_os_assert (NULL != p_dictionary);\r
- dat_os_assert (NULL != entry);\r
-\r
- cur_node = entry;\r
-\r
- if ( DAT_SUCCESS == dat_dictionary_search (p_dictionary, key, NULL) )\r
- {\r
- dat_status = DAT_ERROR (DAT_PROVIDER_ALREADY_REGISTERED,0);\r
- goto bail;\r
- }\r
-\r
- dat_status = dat_dictionary_key_dup ( key, &cur_node->key );\r
- if ( DAT_SUCCESS != dat_status )\r
- {\r
- goto bail;\r
- }\r
-\r
- /* insert node at end of list to preserve registration order*/\r
- prev_node = p_dictionary->tail->prev;\r
- next_node = p_dictionary->tail;\r
-\r
- cur_node->data = data;\r
- cur_node->next = next_node;\r
- cur_node->prev = prev_node;\r
-\r
- prev_node->next = cur_node;\r
- next_node->prev = cur_node;\r
-\r
- p_dictionary->size++;\r
-\r
- bail:\r
- return dat_status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_search\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_search (\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN const DAT_PROVIDER_INFO *key,\r
- OUT DAT_DICTIONARY_DATA *p_data)\r
-{\r
- DAT_DICTIONARY_NODE *cur_node;\r
- DAT_RETURN status;\r
- \r
- dat_os_assert (NULL != p_dictionary);\r
- \r
- status = DAT_ERROR (DAT_PROVIDER_NOT_FOUND,0);\r
-\r
- for (cur_node = p_dictionary->head->next;\r
- p_dictionary->tail != cur_node;\r
- cur_node = cur_node->next)\r
- {\r
- if ( DAT_TRUE == dat_dictionary_key_is_equal (&cur_node->key, key) )\r
- {\r
- if ( NULL != p_data )\r
- {\r
- *p_data = cur_node->data;\r
- }\r
- \r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
- }\r
- \r
- bail:\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_enumerate\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_enumerate (\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN DAT_DICTIONARY_DATA array[],\r
- IN DAT_COUNT array_size)\r
-{\r
- DAT_DICTIONARY_NODE *cur_node;\r
- DAT_COUNT i;\r
- DAT_RETURN status;\r
-\r
- dat_os_assert (NULL != p_dictionary);\r
- dat_os_assert (NULL != array);\r
-\r
- status = DAT_SUCCESS;\r
-\r
- if ( array_size < p_dictionary->size )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,0);\r
- goto bail;\r
- }\r
-\r
- for (cur_node = p_dictionary->head->next, i = 0;\r
- p_dictionary->tail != cur_node;\r
- cur_node = cur_node->next, i++)\r
- {\r
- array[i] = cur_node->data;\r
- }\r
-\r
- bail:\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_remove\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_remove (\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN DAT_DICTIONARY_ENTRY *p_entry,\r
- IN const DAT_PROVIDER_INFO *key,\r
- OUT DAT_DICTIONARY_DATA *p_data)\r
-{\r
- DAT_DICTIONARY_NODE *cur_node, *prev_node, *next_node;\r
- DAT_RETURN status;\r
-\r
- dat_os_assert (NULL != p_dictionary);\r
- dat_os_assert (NULL != p_entry);\r
-\r
- status = DAT_ERROR (DAT_PROVIDER_NOT_FOUND,0);\r
-\r
- for (cur_node = p_dictionary->head->next;\r
- p_dictionary->tail != cur_node;\r
- cur_node = cur_node->next)\r
- {\r
- if ( DAT_TRUE == dat_dictionary_key_is_equal (&cur_node->key, key) )\r
- {\r
- if ( NULL != p_data )\r
- {\r
- *p_data = cur_node->data;\r
- }\r
-\r
- prev_node = cur_node->prev;\r
- next_node = cur_node->next;\r
-\r
- prev_node->next = next_node;\r
- next_node->prev = prev_node;\r
-\r
- *p_entry = cur_node;\r
-\r
- p_dictionary->size--;\r
-\r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
- }\r
-\r
- bail:\r
- return status;\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_key_create\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_dictionary_key_dup (\r
- const DAT_PROVIDER_INFO *old_key,\r
- DAT_PROVIDER_INFO *new_key )\r
-{\r
- dat_os_assert (NULL != old_key);\r
- dat_os_assert (NULL != new_key);\r
-\r
- dat_os_strncpy (new_key->ia_name, old_key->ia_name, DAT_NAME_MAX_LENGTH);\r
- new_key->dapl_version_major = old_key->dapl_version_major;\r
- new_key->dapl_version_minor = old_key->dapl_version_minor;\r
- new_key->is_thread_safe = old_key->is_thread_safe;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_dictionary_key_is_equal\r
- ***********************************************************************/\r
-\r
-DAT_BOOLEAN\r
-dat_dictionary_key_is_equal (\r
- const DAT_PROVIDER_INFO *key_a,\r
- const DAT_PROVIDER_INFO *key_b )\r
-{\r
- if ( ( dat_os_strlen (key_a->ia_name) == dat_os_strlen (key_b->ia_name) ) &&\r
- ( !dat_os_strncmp (key_a->ia_name, key_b->ia_name, dat_os_strlen (key_a->ia_name)) ) &&\r
- ( key_a->dapl_version_major == key_b->dapl_version_major ) &&\r
- ( key_a->dapl_version_minor == key_b->dapl_version_minor ) &&\r
- ( key_a->is_thread_safe == key_b->is_thread_safe ) )\r
- {\r
- return DAT_TRUE;\r
- }\r
- else\r
- {\r
- return DAT_FALSE;\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_dictionary.h\r
- *\r
- * PURPOSE: dictionary data structure \r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_DICTIONARY_H_\r
-#define _DAT_DICTIONARY_H_\r
-\r
-\r
-#include "dat_osd.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/*********************************************************************\r
- * *\r
- * Typedefs *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct DAT_DICTIONARY DAT_DICTIONARY;\r
-typedef void * DAT_DICTIONARY_DATA;\r
-typedef void * DAT_DICTIONARY_ENTRY;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_create(\r
- OUT DAT_DICTIONARY **pp_dictionary);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_destroy(\r
- IN DAT_DICTIONARY *p_dictionary);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_size(\r
- IN DAT_DICTIONARY *p_dictionary,\r
- OUT DAT_COUNT *p_size);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_entry_create(\r
- OUT DAT_DICTIONARY_ENTRY *p_entry);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_entry_destroy(\r
- IN DAT_DICTIONARY_ENTRY entry);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_insert(\r
- IN DAT_DICTIONARY *p_dictionary, \r
- IN DAT_DICTIONARY_ENTRY entry,\r
- IN const DAT_PROVIDER_INFO *key,\r
- IN DAT_DICTIONARY_DATA data);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_search(\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN const DAT_PROVIDER_INFO *key,\r
- OUT DAT_DICTIONARY_DATA *p_data);\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_enumerate(\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN DAT_DICTIONARY_DATA array[],\r
- IN DAT_COUNT array_size);\r
-\r
-\r
-extern DAT_RETURN\r
-dat_dictionary_remove(\r
- IN DAT_DICTIONARY *p_dictionary,\r
- IN DAT_DICTIONARY_ENTRY *p_entry,\r
- IN const DAT_PROVIDER_INFO *key,\r
- OUT DAT_DICTIONARY_DATA *p_data);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_dr.c\r
- *\r
- * PURPOSE: dynamic registry implementation\r
- *\r
- **********************************************************************/\r
-\r
-\r
-#include "dat_dr.h"\r
-\r
-#include "dat_dictionary.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_OS_LOCK g_dr_lock;\r
-static DAT_DICTIONARY *g_dr_dictionary = NULL;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_init\r
-//***********************************************************************\r
-\r
-DAT_RETURN\r
-dat_dr_init ( void )\r
-{\r
- DAT_RETURN status;\r
-\r
- status = dat_os_lock_init (&g_dr_lock);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- status = dat_dictionary_create (&g_dr_dictionary);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_ERROR, \r
- "DAT Registry: DR Init Failed\n");\r
- return status;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_fini\r
-//***********************************************************************\r
-\r
-DAT_RETURN\r
-dat_dr_fini ( void )\r
-{\r
- DAT_RETURN status;\r
- \r
- status = dat_os_lock_destroy (&g_dr_lock);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- status = dat_dictionary_destroy (g_dr_dictionary);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_insert\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_dr_insert (\r
- IN const DAT_PROVIDER_INFO *info,\r
- IN DAT_DR_ENTRY *entry )\r
-{\r
- DAT_RETURN status;\r
- DAT_DICTIONARY_ENTRY dict_entry = NULL;\r
- DAT_DR_ENTRY *data;\r
- \r
- data = dat_os_alloc (sizeof (DAT_DR_ENTRY));\r
- if ( NULL == data )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- *data = *entry;\r
- \r
- status = dat_dictionary_entry_create (&dict_entry);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- goto bail;\r
- }\r
-\r
- dat_os_lock (&g_dr_lock);\r
-\r
- status = dat_dictionary_insert (g_dr_dictionary, \r
- dict_entry,\r
- info, \r
- (DAT_DICTIONARY_DATA *) data);\r
-\r
- dat_os_unlock (&g_dr_lock);\r
-\r
-bail:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != data )\r
- {\r
- dat_os_free (data, sizeof (DAT_DR_ENTRY));\r
- }\r
-\r
- \r
- if ( NULL != dict_entry )\r
- {\r
- (void) dat_dictionary_entry_destroy(dict_entry);\r
- }\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_remove\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_dr_remove (\r
- IN const DAT_PROVIDER_INFO *info )\r
-{\r
- DAT_DR_ENTRY *data;\r
- DAT_DICTIONARY_ENTRY dict_entry = NULL;\r
- DAT_RETURN status;\r
-\r
- dat_os_lock (&g_dr_lock);\r
-\r
- status = dat_dictionary_search ( g_dr_dictionary, \r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- /* return status from dat_dictionary_search() */\r
- goto bail;\r
- }\r
-\r
- if ( 0 != data->ref_count )\r
- {\r
- status = DAT_ERROR (DAT_PROVIDER_IN_USE, 0);\r
- goto bail;\r
- }\r
-\r
- status = dat_dictionary_remove ( g_dr_dictionary, \r
- &dict_entry,\r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- /* return status from dat_dictionary_remove() */\r
- goto bail;\r
- }\r
-\r
- dat_os_free (data, sizeof (DAT_DR_ENTRY));\r
-\r
-bail:\r
- dat_os_unlock (&g_dr_lock);\r
-\r
- if ( NULL != dict_entry )\r
- {\r
- (void) dat_dictionary_entry_destroy(dict_entry);\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_provider_open\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_dr_provider_open (\r
- IN const DAT_PROVIDER_INFO *info,\r
- OUT DAT_IA_OPEN_FUNC *p_ia_open_func )\r
-{\r
- DAT_RETURN status;\r
- DAT_DR_ENTRY *data;\r
-\r
- dat_os_lock (&g_dr_lock);\r
-\r
- status = dat_dictionary_search ( g_dr_dictionary, \r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
- \r
- dat_os_unlock (&g_dr_lock);\r
-\r
- if ( DAT_SUCCESS == status )\r
- {\r
- data->ref_count++;\r
- *p_ia_open_func = data->ia_open_func;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_provider_close\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_dr_provider_close (\r
- IN const DAT_PROVIDER_INFO *info )\r
-{\r
- DAT_RETURN status;\r
- DAT_DR_ENTRY *data;\r
-\r
- dat_os_lock (&g_dr_lock);\r
-\r
- status = dat_dictionary_search ( g_dr_dictionary, \r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
-\r
- dat_os_unlock (&g_dr_lock);\r
-\r
- if ( DAT_SUCCESS == status )\r
- {\r
- data->ref_count--;\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_size\r
-//***********************************************************************\r
-\r
-DAT_RETURN\r
-dat_dr_size (\r
- OUT DAT_COUNT *size )\r
-{\r
- return dat_dictionary_size (g_dr_dictionary, size);\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_dr_list\r
-//***********************************************************************\r
-\r
-DAT_RETURN\r
-dat_dr_list (\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO * (dat_provider_list[]) )\r
-{\r
- DAT_DR_ENTRY **array;\r
- DAT_COUNT array_size;\r
- DAT_COUNT i;\r
- DAT_RETURN status;\r
-\r
- array = NULL;\r
- status = DAT_SUCCESS;\r
-\r
- /* The dictionary size may increase between the call to */\r
- /* dat_dictionary_size() and dat_dictionary_enumerate(). */\r
- /* Therefore we loop until a successful enumeration is made. */\r
- *entries_returned = 0;\r
- for (;;) \r
- {\r
- status = dat_dictionary_size (g_dr_dictionary, &array_size);\r
- if ( status != DAT_SUCCESS )\r
- {\r
- goto bail;\r
- }\r
-\r
- if (array_size == 0)\r
- {\r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
-\r
- array = dat_os_alloc (array_size * sizeof (DAT_DR_ENTRY *));\r
- if ( array == NULL )\r
- {\r
- status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_os_lock (&g_dr_lock);\r
- \r
- status = dat_dictionary_enumerate (g_dr_dictionary,\r
- (DAT_DICTIONARY_DATA *) array,\r
- array_size);\r
- \r
- dat_os_unlock (&g_dr_lock);\r
- \r
- if ( DAT_SUCCESS == status )\r
- {\r
- break;\r
- }\r
- else \r
- {\r
- dat_os_free (array, array_size * sizeof (DAT_DR_ENTRY *));\r
- array = NULL;\r
- continue;\r
- }\r
- }\r
- \r
- for ( i = 0; (i < max_to_return) && (i < array_size); i++)\r
- {\r
- if ( NULL == dat_provider_list[i] )\r
- {\r
- status = DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- *dat_provider_list[i] = array[i]->info;\r
- }\r
-\r
- *entries_returned = i;\r
-\r
-bail:\r
- if ( NULL != array )\r
- {\r
- dat_os_free (array, array_size * sizeof (DAT_DR_ENTRY *));\r
- }\r
- \r
- return status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_dr.h\r
- *\r
- * PURPOSE: dynamic registry interface declarations\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef __DAT_DR_H__\r
-#define __DAT_DR_H__\r
-\r
-\r
-#include "dat_osd.h" \r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/*********************************************************************\r
- * *\r
- * Strucutres *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct \r
-{\r
- DAT_COUNT ref_count;\r
- DAT_IA_OPEN_FUNC ia_open_func;\r
- DAT_PROVIDER_INFO info;\r
-} DAT_DR_ENTRY;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_RETURN\r
-dat_dr_init( void );\r
-\r
-extern DAT_RETURN\r
-dat_dr_fini( void );\r
-\r
-extern DAT_RETURN\r
-dat_dr_insert (\r
- IN const DAT_PROVIDER_INFO *info,\r
- IN DAT_DR_ENTRY *entry );\r
-\r
-extern DAT_RETURN\r
-dat_dr_remove (\r
- IN const DAT_PROVIDER_INFO *info );\r
-\r
-\r
-extern DAT_RETURN\r
-dat_dr_provider_open (\r
- IN const DAT_PROVIDER_INFO *info,\r
- OUT DAT_IA_OPEN_FUNC *p_ia_open_func );\r
-\r
-extern DAT_RETURN\r
-dat_dr_provider_close (\r
- IN const DAT_PROVIDER_INFO *info);\r
-\r
-extern DAT_RETURN\r
-dat_dr_size (\r
- OUT DAT_COUNT *size);\r
-\r
-extern DAT_RETURN\r
-dat_dr_list (\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO * (dat_provider_list[]) );\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_init.c\r
- *\r
- * PURPOSE: DAT registry implementation for uDAPL\r
- * Description: init and fini functions for DAT module.\r
- *\r
- **********************************************************************/\r
-\r
-#include "dat_init.h"\r
-\r
-#include "dat_dr.h"\r
-#include "dat_osd.h"\r
-\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
-#include "dat_sr.h"\r
-#endif\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * Ideally, the following two rules could be enforced:\r
- *\r
- * - The DAT Registry's initialization function is executed before that \r
- * of any DAT Providers and hence all calls into the registry occur \r
- * after the registry module is initialized.\r
- *\r
- * - The DAT Registry's deinitialization function is executed after that \r
- * of any DAT Providers and hence all calls into the registry occur \r
- * before the registry module is deinitialized.\r
- *\r
- * However, on many platforms few guarantees are provided regarding the \r
- * order in which modules initialization and deinitialization functions \r
- * are invoked. \r
- *\r
- * To understand why these rules are difficult to enforce using only \r
- * features common to all platforms, consider the Linux platform. The order \r
- * in which Linux shared libraries are loaded into a process's address space \r
- * is undefined. When a DAT consumer explicitly links to DAT provider \r
- * libraries, the order in which library initialization and deinitialization \r
- * functions are invoked becomes important. For example if the DAPL provider \r
- * calls dat_registry_add_provider() before the registry has been initialized,\r
- * an error will occur.\r
- * \r
- * We assume that modules are loaded with a single thread. Given \r
- * this assumption, we can use a simple state variable to determine \r
- * the state of the DAT registry. \r
- */\r
-\r
-static DAT_MODULE_STATE g_module_state = DAT_MODULE_STATE_UNINITIALIZED;\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_module_get_state\r
-//***********************************************************************\r
-\r
-DAT_MODULE_STATE\r
-dat_module_get_state ( void )\r
-{\r
- return g_module_state;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_init\r
-//***********************************************************************\r
-\r
-void \r
-dat_init ( void )\r
-{\r
- DAT_RETURN status= DAT_SUCCESS;\r
- if ( DAT_MODULE_STATE_UNINITIALIZED == g_module_state )\r
- {\r
- /*\r
- * update the module state flag immediately in case there \r
- * is a recursive call to dat_init().\r
- */\r
- g_module_state = DAT_MODULE_STATE_INITIALIZING;\r
-\r
- dat_os_dbg_init ();\r
-\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_GENERIC, \r
- "DAT Registry: Started (dat_init)\n");\r
-\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- dat_sr_init ();\r
-#endif\r
- status = dat_dr_init ();\r
- if (status != DAT_SUCCESS)\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_GENERIC, \r
- "DAT Registry: (dat_init) failed\n");\r
- g_module_state = DAT_MODULE_STATE_UNINITIALIZED;\r
- return;\r
- }\r
- g_module_state = DAT_MODULE_STATE_INITIALIZED;\r
- }\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_fini\r
-//***********************************************************************\r
-\r
-void \r
-dat_fini ( void )\r
-{\r
- if ( DAT_MODULE_STATE_INITIALIZED == g_module_state )\r
- {\r
- g_module_state = DAT_MODULE_STATE_DEINITIALIZING;\r
-\r
- dat_dr_fini ();\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- dat_sr_fini ();\r
-#endif\r
-\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_GENERIC, "DAT Registry: Stopped (dat_fini)\n");\r
-\r
- g_module_state = DAT_MODULE_STATE_DEINITIALIZED;\r
- }\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_init.h\r
- *\r
- * PURPOSE: DAT registry global data\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_INIT_H_\r
-#define _DAT_INIT_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/*********************************************************************\r
- * *\r
- * Enumerations *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef enum\r
-{\r
- DAT_MODULE_STATE_UNINITIALIZED,\r
- DAT_MODULE_STATE_INITIALIZING,\r
- DAT_MODULE_STATE_INITIALIZED,\r
- DAT_MODULE_STATE_DEINITIALIZING,\r
- DAT_MODULE_STATE_DEINITIALIZED\r
-} DAT_MODULE_STATE;\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Prototypes *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_MODULE_STATE\r
-dat_module_get_state ( void ) ;\r
-\r
-void\r
-dat_init ( void ) ;\r
-\r
-void\r
-dat_fini ( void ) ;\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_sr.c\r
- *\r
- * PURPOSE: static registry implementation\r
- *\r
- **********************************************************************/\r
-\r
-\r
-#include "dat_sr.h"\r
-\r
-#include "dat_dictionary.h"\r
-#include "udat_sr_parser.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_OS_LOCK g_sr_lock;\r
-static DAT_DICTIONARY *g_sr_dictionary = NULL;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_init\r
-//***********************************************************************\r
-\r
-DAT_RETURN\r
-dat_sr_init ( void )\r
-{\r
- DAT_RETURN status;\r
-\r
- status = dat_os_lock_init (&g_sr_lock);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- status = dat_dictionary_create (&g_sr_dictionary);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- /* \r
- * Since DAT allows providers to be loaded by either the static \r
- * registry or explicitly through OS dependent methods, do not \r
- * return an error if no providers are loaded via the static registry.\r
- */\r
-\r
- status = dat_sr_load ();\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_GENERIC, \r
- "DAT Registry: SR Load return %#x\n", status);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_fini\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_fini ( void )\r
-{\r
- DAT_RETURN status;\r
-\r
- status = dat_os_lock_destroy (&g_sr_lock);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- status = dat_dictionary_destroy (g_sr_dictionary);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- return status;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_insert\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_insert (\r
- IN const DAT_PROVIDER_INFO *info,\r
- IN DAT_SR_ENTRY *entry )\r
-{\r
- DAT_RETURN status;\r
- DAT_SR_ENTRY *data;\r
- DAT_UINT32 lib_path_size = 0;\r
- DAT_UINT32 lib_path_len = 0;\r
- DAT_UINT32 ia_params_size = 0;\r
- DAT_UINT32 ia_params_len = 0;\r
- DAT_DICTIONARY_ENTRY dict_entry = NULL;\r
-\r
- if ( NULL == (data = dat_os_alloc (sizeof (DAT_SR_ENTRY))) )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- \r
- lib_path_len = (DAT_UINT32)dat_os_strlen (entry->lib_path);\r
- lib_path_size = (lib_path_len + 1) * sizeof (char);\r
-\r
- if ( NULL == (data->lib_path = dat_os_alloc (lib_path_size)) )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_os_strncpy (data->lib_path, entry->lib_path, lib_path_len);\r
- data->lib_path[lib_path_len] = '\0';\r
-\r
- ia_params_len = (DAT_UINT32)dat_os_strlen (entry->ia_params);\r
- ia_params_size = (ia_params_len + 1) * sizeof (char);\r
-\r
- if ( NULL == (data->ia_params = dat_os_alloc (ia_params_size)) )\r
- {\r
- status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
-\r
- dat_os_strncpy (data->ia_params, entry->ia_params, ia_params_len);\r
- data->ia_params[ia_params_len] = '\0';\r
-\r
- data->info = entry->info;\r
- data->lib_handle = entry->lib_handle;\r
- data->ref_count = entry->ref_count;\r
-\r
- dict_entry = NULL;\r
- status = dat_dictionary_entry_create (&dict_entry);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- goto bail;\r
- }\r
-\r
- dat_os_lock (&g_sr_lock);\r
- \r
- status = dat_dictionary_insert (g_sr_dictionary, \r
- dict_entry,\r
- info,\r
- (DAT_DICTIONARY_DATA *) data);\r
- dat_os_unlock (&g_sr_lock);\r
-\r
-bail:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != data )\r
- {\r
- if ( NULL != data->lib_path )\r
- {\r
- dat_os_free (data->lib_path, lib_path_size);\r
- }\r
-\r
- if ( NULL != data->ia_params )\r
- {\r
- dat_os_free (data->ia_params, ia_params_size);\r
- }\r
-\r
- dat_os_free (data, sizeof (DAT_SR_ENTRY));\r
- }\r
-\r
- if ( NULL != dict_entry )\r
- {\r
- (void) dat_dictionary_entry_destroy(dict_entry);\r
- }\r
- }\r
-\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "DAT Registry: insert to sr_dictionary for %s : 0x%x\n",\r
- entry->info.ia_name, status);\r
- \r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_size\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_size (\r
- OUT DAT_COUNT *size )\r
-{\r
- return dat_dictionary_size (g_sr_dictionary, size);\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_list\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_list (\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO * (dat_provider_list[]) )\r
-{\r
- DAT_SR_ENTRY **array;\r
- DAT_COUNT array_size;\r
- DAT_COUNT i;\r
- DAT_RETURN status;\r
-\r
- array = NULL;\r
- status = DAT_SUCCESS;\r
-\r
- /* The dictionary size may increase between the call to */\r
- /* dat_dictionary_size() and dat_dictionary_enumerate(). */\r
- /* Therefore we loop until a successful enumeration is made. */\r
- *entries_returned = 0;\r
- for (;;) \r
- {\r
- status = dat_dictionary_size (g_sr_dictionary, &array_size);\r
- if ( DAT_SUCCESS != status )\r
- {\r
- goto bail;\r
- }\r
- \r
- if (array_size == 0)\r
- {\r
- status = DAT_SUCCESS;\r
- goto bail;\r
- }\r
-\r
- array = dat_os_alloc (array_size * sizeof (DAT_SR_ENTRY *));\r
- if ( array == NULL )\r
- {\r
- status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);\r
- goto bail;\r
- }\r
- \r
- dat_os_lock (&g_sr_lock);\r
- \r
- status = dat_dictionary_enumerate (g_sr_dictionary,\r
- (DAT_DICTIONARY_DATA *) array,\r
- array_size);\r
- \r
- dat_os_unlock (&g_sr_lock);\r
-\r
- if ( DAT_SUCCESS == status )\r
- {\r
- break;\r
- }\r
- else \r
- {\r
- dat_os_free (array, array_size * sizeof (DAT_SR_ENTRY *));\r
- array = NULL;\r
- continue;\r
- }\r
- }\r
-\r
- for ( i = 0; (i < max_to_return) && (i < array_size); i++)\r
- {\r
- if ( NULL == dat_provider_list[i] )\r
- {\r
- status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG3);\r
- goto bail;\r
- }\r
-\r
- *dat_provider_list[i] = array[i]->info;\r
- }\r
-\r
- *entries_returned = i;\r
-\r
-bail:\r
- if ( NULL != array )\r
- {\r
- dat_os_free (array, array_size * sizeof (DAT_SR_ENTRY *));\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_provider_open\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_provider_open (\r
- IN const DAT_PROVIDER_INFO *info )\r
-{\r
- DAT_RETURN status;\r
- DAT_SR_ENTRY *data;\r
- \r
- dat_os_lock (&g_sr_lock);\r
-\r
- status = dat_dictionary_search (g_sr_dictionary, \r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
- \r
- if ( DAT_SUCCESS == status )\r
- {\r
- if ( 0 == data->ref_count )\r
- {\r
- status = dat_os_library_load (data->lib_path, &data->lib_handle);\r
- if ( status == DAT_SUCCESS )\r
- {\r
- data->ref_count++;\r
- }\r
- else\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_SR, \r
- "DAT Registry: static registry unable to "\r
- "load library %s\n", data->lib_path);\r
- goto bail;\r
- }\r
- \r
- data->init_func = (DAT_PROVIDER_INIT_FUNC)dat_os_library_sym (data->lib_handle, DAT_PROVIDER_INIT_FUNC_STR);\r
- data->fini_func = (DAT_PROVIDER_FINI_FUNC)dat_os_library_sym (data->lib_handle, DAT_PROVIDER_FINI_FUNC_STR);\r
-\r
- if ( NULL != data->init_func )\r
- {\r
- (*data->init_func)(&data->info, data->ia_params);\r
- }\r
- }\r
- else\r
- {\r
- data->ref_count++;\r
- }\r
- }\r
-\r
- bail:\r
- dat_os_unlock (&g_sr_lock);\r
-\r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_sr_provider_close\r
-//***********************************************************************\r
-\r
-extern DAT_RETURN\r
-dat_sr_provider_close (\r
- IN const DAT_PROVIDER_INFO *info )\r
-{\r
- DAT_RETURN status;\r
- DAT_SR_ENTRY *data;\r
-\r
- dat_os_lock (&g_sr_lock);\r
-\r
- status = dat_dictionary_search (g_sr_dictionary, \r
- info, \r
- (DAT_DICTIONARY_DATA *) &data);\r
-\r
- if ( DAT_SUCCESS == status )\r
- {\r
- if ( 1 == data->ref_count )\r
- {\r
- if ( NULL != data->fini_func )\r
- {\r
- (*data->fini_func)(&data->info);\r
- }\r
- \r
- status = dat_os_library_unload (data->lib_handle);\r
- if ( status == DAT_SUCCESS )\r
- {\r
- data->ref_count--;\r
- }\r
- }\r
- else\r
- {\r
- data->ref_count--;\r
- }\r
- }\r
-\r
- dat_os_unlock (&g_sr_lock);\r
-\r
- return status;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_sr.h\r
- *\r
- * PURPOSE: static registry (SR) inteface declarations\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_SR_H_\r
-#define _DAT_SR_H_\r
-\r
-\r
-#include <dat/udat.h>\r
-#include <dat/dat_registry.h>\r
-\r
-#include "dat_osd.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/*********************************************************************\r
- * *\r
- * Strucutres *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct \r
-{\r
- DAT_PROVIDER_INFO info;\r
- char * lib_path;\r
- char * ia_params;\r
- DAT_OS_LIBRARY_HANDLE lib_handle;\r
- DAT_PROVIDER_INIT_FUNC init_func;\r
- DAT_PROVIDER_FINI_FUNC fini_func;\r
- DAT_COUNT ref_count;\r
-} DAT_SR_ENTRY;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-extern DAT_RETURN\r
-dat_sr_init( void );\r
-\r
-extern DAT_RETURN\r
-dat_sr_fini( void );\r
-\r
-extern DAT_RETURN\r
-dat_sr_insert (\r
- IN const DAT_PROVIDER_INFO *info,\r
- IN DAT_SR_ENTRY *entry );\r
-\r
-extern DAT_RETURN\r
-dat_sr_size (\r
- OUT DAT_COUNT *size);\r
-\r
-extern DAT_RETURN\r
-dat_sr_list (\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[]) );\r
-\r
-extern DAT_RETURN\r
-dat_sr_provider_open (\r
- IN const DAT_PROVIDER_INFO *info );\r
-\r
-extern DAT_RETURN\r
-dat_sr_provider_close (\r
- IN const DAT_PROVIDER_INFO *info );\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_strerror.c\r
- *\r
- * PURPOSE: Convert DAT_RETURN values to humman readable string\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include <dat/udat.h>\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_strerror_major (\r
- IN DAT_RETURN value,\r
- OUT const char **message );\r
-\r
-DAT_RETURN \r
-dat_strerror_minor (\r
- IN DAT_RETURN value,\r
- OUT const char **message );\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_strerror_major (\r
- IN DAT_RETURN value,\r
- OUT const char **message )\r
-{\r
- switch ( DAT_GET_TYPE(value) )\r
- {\r
- case DAT_SUCCESS:\r
- {\r
- *message = "DAT_SUCCESS";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_ABORT:\r
- {\r
- *message = "DAT_ABORT";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_CONN_QUAL_IN_USE:\r
- {\r
- *message = "DAT_CONN_QUAL_IN_USE";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INSUFFICIENT_RESOURCES:\r
- {\r
- *message = "DAT_INSUFFICIENT_RESOURCES";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INTERNAL_ERROR:\r
- {\r
- *message = "DAT_INTERNAL_ERROR";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INVALID_HANDLE:\r
- {\r
- *message = "DAT_INVALID_HANDLE";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INVALID_PARAMETER:\r
- {\r
- *message = "DAT_INVALID_PARAMETER";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INVALID_STATE:\r
- {\r
- *message = "DAT_INVALID_STATE";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_LENGTH_ERROR:\r
- {\r
- *message = "DAT_LENGTH_ERROR";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_MODEL_NOT_SUPPORTED:\r
- {\r
- *message = "DAT_MODEL_NOT_SUPPORTED";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_PROVIDER_NOT_FOUND:\r
- {\r
- *message = "DAT_PROVIDER_NOT_FOUND";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_PRIVILEGES_VIOLATION:\r
- {\r
- *message = "DAT_PRIVILEGES_VIOLATION";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_PROTECTION_VIOLATION:\r
- {\r
- *message = "DAT_PROTECTION_VIOLATION";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_QUEUE_EMPTY:\r
- {\r
- *message = "DAT_QUEUE_EMPTY";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_QUEUE_FULL:\r
- {\r
- *message = "DAT_QUEUE_FULL";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_TIMEOUT_EXPIRED:\r
- {\r
- *message = "DAT_TIMEOUT_EXPIRED";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_PROVIDER_ALREADY_REGISTERED:\r
- {\r
- *message = "DAT_PROVIDER_ALREADY_REGISTERED";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_PROVIDER_IN_USE:\r
- {\r
- *message = "DAT_PROVIDER_IN_USE";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INVALID_ADDRESS:\r
- {\r
- *message = "DAT_INVALID_ADDRESS";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_INTERRUPTED_CALL:\r
- {\r
- *message = "DAT_INTERRUPTED_CALL";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_NOT_IMPLEMENTED:\r
- {\r
- *message = "DAT_NOT_IMPLEMENTED";\r
- return DAT_SUCCESS;\r
- }\r
- default:\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
- }\r
-}\r
-\r
-\r
-DAT_RETURN \r
-dat_strerror_minor (\r
- IN DAT_RETURN value,\r
- OUT const char **message )\r
-{\r
- switch ( DAT_GET_SUBTYPE(value) )\r
- { \r
-\r
- case DAT_NO_SUBTYPE: /* NO subtype */\r
- {\r
- *message = "";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_SUB_INTERRUPTED:\r
- {\r
- *message = "DAT_SUB_INTERRUPTED";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_RESOURCE_MEMORY:\r
- {\r
- *message = "DAT_RESOURCE_MEMORY";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_RESOURCE_DEVICE:\r
- {\r
- *message = "DAT_RESOURCE_DEVICE";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_RESOURCE_TEP:\r
- {\r
- *message = "DAT_RESOURCE_TEP";\r
- return DAT_SUCCESS;\r
- }\r
- case DAT_RESOURCE_TEVD:\r
- {\r
- *message = "DAT_RESOURCE_TEVD";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_RESOURCE_PROTECTION_DOMAIN:\r
- {\r
- *message = "DAT_RESOURCE_PROTECTION_DOMAIN";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_RESOURCE_MEMORY_REGION:\r
- {\r
- *message = "DAT_RESOURCE_MEMORY_REGION";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_RESOURCE_ERROR_HANDLER:\r
- {\r
- *message = "DAT_RESOURCE_ERROR_HANDLER";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_RESOURCE_CREDITS:\r
- {\r
- *message = "DAT_RESOURCE_CREDITS";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_IA:\r
- {\r
- *message = "DAT_INVALID_HANDLE_IA";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EP:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EP";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_LMR:\r
- {\r
- *message = "DAT_INVALID_HANDLE_LMR";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_RMR:\r
- {\r
- *message = "DAT_INVALID_HANDLE_RMR";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_PZ:\r
- {\r
- *message = "DAT_INVALID_HANDLE_PZ";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_PSP:\r
- {\r
- *message = "DAT_INVALID_HANDLE_PSP";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_RSP:\r
- {\r
- *message = "DAT_INVALID_HANDLE_RSP";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_CR:\r
- {\r
- *message = "DAT_INVALID_HANDLE_CR";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_CNO:\r
- {\r
- *message = "DAT_INVALID_HANDLE_CNO";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EVD_CR:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EVD_CR";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EVD_REQUEST:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EVD_REQUEST";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EVD_RECV:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EVD_RECV";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EVD_CONN:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EVD_CONN";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_HANDLE_EVD_ASYNC:\r
- {\r
- *message = "DAT_INVALID_HANDLE_EVD_ASYNC";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG1:\r
- {\r
- *message = "DAT_INVALID_ARG1";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG2:\r
- {\r
- *message = "DAT_INVALID_ARG2";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG3:\r
- {\r
- *message = "DAT_INVALID_ARG3";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG4:\r
- {\r
- *message = "DAT_INVALID_ARG4";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG5:\r
- {\r
- *message = "DAT_INVALID_ARG5";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG6:\r
- {\r
- *message = "DAT_INVALID_ARG6";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG7:\r
- {\r
- *message = "DAT_INVALID_ARG7";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG8:\r
- {\r
- *message = "DAT_INVALID_ARG8";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG9:\r
- {\r
- *message = "DAT_INVALID_ARG9";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ARG10:\r
- {\r
- *message = "DAT_INVALID_ARG10";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_UNCONNECTED:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_UNCONNECTED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_ACTCONNPENDING:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_ACTCONNPENDING";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_PASSCONNPENDING:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_PASSCONNPENDING";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_TENTCONNPENDING:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_TENTCONNPENDING";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_CONNECTED:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_CONNECTED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_DISCONNECTED:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_DISCONNECTED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_RESERVED:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_RESERVED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_COMPLPENDING:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_COMPLPENDING";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_DISCPENDING:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_DISCPENDING";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_PROVIDERCONTROL:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_PROVIDERCONTROL";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EP_NOTREADY:\r
- {\r
- *message = "DAT_INVALID_STATE_EP_NOTREADY";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_CNO_IN_USE:\r
- {\r
- *message = "DAT_INVALID_STATE_CNO_IN_USE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_CNO_DEAD:\r
- {\r
- *message = "DAT_INVALID_STATE_CNO_DEAD";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_OPEN:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_OPEN";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_ENABLED:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_ENABLED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_DISABLED:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_DISABLED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_WAITABLE:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_WAITABLE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_UNWAITABLE:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_UNWAITABLE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_IN_USE:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_IN_USE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_CONFIG_NOTIFY:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_CONFIG_NOTIFY";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_CONFIG_SOLICITED:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_CONFIG_SOLICITED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_WAITER:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_WAITER";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_EVD_ASYNC:\r
- {\r
- *message = "DAT_INVALID_STATE_EVD_ASYNC";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_IA_IN_USE:\r
- {\r
- *message = "DAT_INVALID_STATE_IA_IN_USE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_LMR_IN_USE:\r
- {\r
- *message = "DAT_INVALID_STATE_LMR_IN_USE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_LMR_FREE:\r
- {\r
- *message = "DAT_INVALID_STATE_LMR_FREE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_PZ_IN_USE:\r
- {\r
- *message = "DAT_INVALID_STATE_PZ_IN_USE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_STATE_PZ_FREE:\r
- {\r
- *message = "DAT_INVALID_STATE_PZ_FREE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PRIVILEGES_READ:\r
- {\r
- *message = "DAT_PRIVILEGES_READ";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PRIVILEGES_WRITE:\r
- {\r
- *message = "DAT_PRIVILEGES_WRITE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PRIVILEGES_RDMA_READ:\r
- {\r
- *message = "DAT_PRIVILEGES_RDMA_READ";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PRIVILEGES_RDMA_WRITE:\r
- {\r
- *message = "DAT_PRIVILEGES_RDMA_WRITE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PROTECTION_READ:\r
- {\r
- *message = "DAT_PROTECTION_READ";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PROTECTION_WRITE:\r
- {\r
- *message = "DAT_PROTECTION_WRITE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PROTECTION_RDMA_READ:\r
- {\r
- *message = "DAT_PROTECTION_RDMA_READ";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_PROTECTION_RDMA_WRITE:\r
- {\r
- *message = "DAT_PROTECTION_RDMA_WRITE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ADDRESS_UNSUPPORTED:\r
- {\r
- *message = "DAT_INVALID_ADDRESS_UNSUPPORTED";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ADDRESS_UNREACHABLE:\r
- {\r
- *message = "DAT_INVALID_ADDRESS_UNREACHABLE";\r
- return DAT_SUCCESS;\r
- } \r
- case DAT_INVALID_ADDRESS_MALFORMED:\r
- {\r
- *message = "DAT_INVALID_ADDRESS_MALFORMED";\r
- return DAT_SUCCESS;\r
- } \r
- default:\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
- }\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_RETURN DAT_API \r
-dat_strerror (\r
- IN DAT_RETURN value,\r
- OUT const char **major_message,\r
- OUT const char **minor_message )\r
-{\r
- /*\r
- * The DAT specification contains a note to implementers \r
- * suggesting that the consumer's DAT_RETURN value be used \r
- * as an index into a table of text strings. However, \r
- * the DAT_RETURN values are not consecutive. Therefore this \r
- * implementation does not follow the suggested implementation.\r
- */\r
-\r
- if ( DAT_SUCCESS != dat_strerror_major(value, major_message) )\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
- else if ( DAT_SUCCESS != dat_strerror_minor(value, minor_message) )\r
- {\r
- return DAT_INVALID_PARAMETER;\r
- }\r
- else \r
- {\r
- return DAT_SUCCESS;\r
- }\r
-}\r
+++ /dev/null
-DIRS=udat\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat.h\r
- *\r
- * PURPOSE: defines the common DAT API for uDAPL and kDAPL.\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_H_\r
-#define _DAT_H_\r
-\r
-#include <dat/dat_error.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/* Generic DAT types */\r
-\r
-typedef char * DAT_NAME_PTR; /* Format for ia_name and attributes */\r
-#define DAT_NAME_MAX_LENGTH 256 \r
-\r
-/*\r
- * Used for provider, vendor, transport, hardware specific attributes\r
- * definitions.\r
- */\r
-\r
-typedef struct dat_named_attr\r
- {\r
- const char * name; /* Name of attribute */\r
- const char * value; /* Value of attribute */\r
- } DAT_NAMED_ATTR;\r
-\r
-typedef enum dat_boolean\r
- {\r
- DAT_FALSE = 0,\r
- DAT_TRUE = 1\r
- } DAT_BOOLEAN;\r
-\r
-typedef union dat_context\r
- {\r
- DAT_PVOID as_ptr;\r
- DAT_UINT64 as_64;\r
- DAT_UVERYLONG as_index;\r
- } DAT_CONTEXT;\r
-\r
-typedef DAT_CONTEXT DAT_DTO_COOKIE;\r
-typedef DAT_CONTEXT DAT_RMR_COOKIE;\r
-\r
-typedef enum dat_completion_flags\r
- {\r
- /* Completes with notification */\r
- DAT_COMPLETION_DEFAULT_FLAG = 0x00,\r
-\r
- /* Completions suppressed if successful */\r
- DAT_COMPLETION_SUPPRESS_FLAG = 0x01,\r
-\r
- /* Sender controlled notification for recv completion */\r
- DAT_COMPLETION_SOLICITED_WAIT_FLAG = 0x02,\r
-\r
- /* Completions with unsignaled notifications */\r
- DAT_COMPLETION_UNSIGNALLED_FLAG = 0x04,\r
-\r
- /* Do not start processing until all previous RDMA reads complete. */ \r
- DAT_COMPLETION_BARRIER_FENCE_FLAG = 0x08,\r
-\r
- /* Only valid for uDAPL as EP attribute for Recv Completion flags. \r
- * Waiter unblocking is controlled by Threshold value of dat_evd_wait. \r
- * UNSIGNALLED for RECV not allowed when EP has this attribute */ \r
- DAT_COMPLETION_EVD_THRESHOLD_FLAG = 0x10\r
-\r
- } DAT_COMPLETION_FLAGS;\r
-\r
-\r
-typedef DAT_UINT32 DAT_TIMEOUT; /* microseconds */\r
-\r
-/* timeout = infinity */\r
-#define DAT_TIMEOUT_INFINITE ((DAT_TIMEOUT) ~0) \r
-\r
-/* dat handles */\r
-typedef DAT_PVOID DAT_HANDLE;\r
-typedef DAT_HANDLE DAT_CR_HANDLE;\r
-typedef DAT_HANDLE DAT_EP_HANDLE;\r
-typedef DAT_HANDLE DAT_EVD_HANDLE;\r
-typedef DAT_HANDLE DAT_IA_HANDLE;\r
-typedef DAT_HANDLE DAT_LMR_HANDLE;\r
-typedef DAT_HANDLE DAT_PSP_HANDLE;\r
-typedef DAT_HANDLE DAT_PZ_HANDLE;\r
-typedef DAT_HANDLE DAT_RMR_HANDLE;\r
-typedef DAT_HANDLE DAT_RSP_HANDLE;\r
-\r
-\r
-/* dat NULL handles */\r
-#define DAT_HANDLE_NULL ((DAT_HANDLE)NULL)\r
-\r
-typedef DAT_SOCK_ADDR * DAT_IA_ADDRESS_PTR;\r
-\r
-typedef DAT_UINT64 DAT_CONN_QUAL;\r
-typedef DAT_UINT64 DAT_PORT_QUAL;\r
-\r
-/* QOS definitions */\r
-typedef enum dat_qos\r
- {\r
- DAT_QOS_BEST_EFFORT = 0x00,\r
- DAT_QOS_HIGH_THROUGHPUT = 0x01,\r
- DAT_QOS_LOW_LATENCY = 0x02,\r
- /* not low latency, nor high throughput */\r
- DAT_QOS_ECONOMY = 0x04,\r
- /* both low latency and high throughput */\r
- DAT_QOS_PREMIUM = 0x08 \r
- } DAT_QOS;\r
-\r
-/* \r
- * FLAGS\r
- */\r
-\r
-typedef enum dat_connect_flags\r
- {\r
- DAT_CONNECT_DEFAULT_FLAG = 0x00,\r
- DAT_CONNECT_MULTIPATH_FLAG = 0x01\r
- } DAT_CONNECT_FLAGS;\r
-\r
-typedef enum dat_close_flags\r
- {\r
- DAT_CLOSE_ABRUPT_FLAG = 0x00,\r
- DAT_CLOSE_GRACEFUL_FLAG = 0x01\r
- } DAT_CLOSE_FLAGS;\r
-\r
-#define DAT_CLOSE_DEFAULT DAT_CLOSE_ABRUPT_FLAG\r
-\r
-typedef enum dat_evd_flags\r
- {\r
- DAT_EVD_SOFTWARE_FLAG = 0x01,\r
- DAT_EVD_CR_FLAG = 0x10,\r
- DAT_EVD_DTO_FLAG = 0x20,\r
- DAT_EVD_CONNECTION_FLAG = 0x40,\r
- DAT_EVD_RMR_BIND_FLAG = 0x80,\r
- DAT_EVD_ASYNC_FLAG = 0x100,\r
- /* DAT events only, no software events */\r
- DAT_EVD_DEFAULT_FLAG = 0x1F0 \r
- } DAT_EVD_FLAGS;\r
-\r
-typedef enum dat_psp_flags\r
- {\r
- DAT_PSP_CONSUMER_FLAG = 0x00, /* Consumer creates an endpoint */\r
- DAT_PSP_PROVIDER_FLAG = 0x01 /* Provider creates an endpoint */\r
-\r
- } DAT_PSP_FLAGS;\r
-\r
-/*\r
- * Memory Buffers\r
- *\r
- * Both LMR and RMR triplets specify 64-bit addresses in the local host's byte\r
- * order, even when that exceeds the size of a DAT_PVOID for the host\r
- * architecture.\r
- */\r
-\r
-typedef DAT_UINT32 DAT_LMR_CONTEXT;\r
-typedef DAT_UINT32 DAT_RMR_CONTEXT;\r
-\r
-typedef DAT_UINT64 DAT_VLEN;\r
-typedef DAT_UINT64 DAT_VADDR;\r
-\r
-/* It is legal for Consumer to specify zero for segment_length \r
- * of the dat_lmr_triplet. When 0 is specified for the \r
- * segment_length then the other two elements of the \r
- * dat_lmr_triplet are irrelevant and can be invalid. */\r
-\r
-typedef struct dat_lmr_triplet\r
- {\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_UINT32 pad;\r
- DAT_VADDR virtual_address;\r
- DAT_VLEN segment_length;\r
- } DAT_LMR_TRIPLET;\r
-\r
-typedef struct dat_rmr_triplet\r
- {\r
- DAT_RMR_CONTEXT rmr_context;\r
- DAT_UINT32 pad;\r
- DAT_VADDR target_address;\r
- DAT_VLEN segment_length;\r
- } DAT_RMR_TRIPLET;\r
-\r
-\r
-/* Memory privileges */\r
-\r
-typedef enum dat_mem_priv_flags\r
- {\r
- DAT_MEM_PRIV_NONE_FLAG = 0x00,\r
- DAT_MEM_PRIV_LOCAL_READ_FLAG = 0x01,\r
- DAT_MEM_PRIV_REMOTE_READ_FLAG = 0x02,\r
- DAT_MEM_PRIV_LOCAL_WRITE_FLAG = 0x10,\r
- DAT_MEM_PRIV_REMOTE_WRITE_FLAG = 0x20,\r
- DAT_MEM_PRIV_ALL_FLAG = 0x33\r
- } DAT_MEM_PRIV_FLAGS;\r
-\r
-/* For backwards compatibility with DAT-1.0 memory privileges values are supported */ \r
-#define DAT_MEM_PRIV_READ_FLAG (DAT_MEM_PRIV_LOCAL_READ_FLAG | DAT_MEM_PRIV_REMOTE_READ_FLAG)\r
-#define DAT_MEM_PRIV_WRITE_FLAG (DAT_MEM_PRIV_LOCAL_WRITE_FLAG | DAT_MEM_PRIV_REMOTE_WRITE_FLAG)\r
-\r
-/* LMR Arguments Mask */\r
-\r
-typedef enum dat_lmr_param_mask\r
- {\r
- DAT_LMR_FIELD_IA_HANDLE = 0x001,\r
- DAT_LMR_FIELD_MEM_TYPE = 0x002,\r
- DAT_LMR_FIELD_REGION_DESC = 0x004,\r
- DAT_LMR_FIELD_LENGTH = 0x008,\r
- DAT_LMR_FIELD_PZ_HANDLE = 0x010,\r
- DAT_LMR_FIELD_MEM_PRIV = 0x020,\r
- DAT_LMR_FIELD_LMR_CONTEXT = 0x040,\r
- DAT_LMR_FIELD_RMR_CONTEXT = 0x080,\r
- DAT_LMR_FIELD_REGISTERED_SIZE = 0x100,\r
- DAT_LMR_FIELD_REGISTERED_ADDRESS = 0x200,\r
-\r
- DAT_LMR_FIELD_ALL = 0x3FF\r
- } DAT_LMR_PARAM_MASK;\r
-\r
-/* RMR Argumments & RMR Arguments Mask */\r
-\r
-typedef struct dat_rmr_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_LMR_TRIPLET lmr_triplet;\r
- DAT_MEM_PRIV_FLAGS mem_priv;\r
- DAT_RMR_CONTEXT rmr_context;\r
- } DAT_RMR_PARAM;\r
-\r
-typedef enum dat_rmr_param_mask\r
- {\r
- DAT_RMR_FIELD_IA_HANDLE = 0x01,\r
- DAT_RMR_FIELD_PZ_HANDLE = 0x02,\r
- DAT_RMR_FIELD_LMR_TRIPLET = 0x04,\r
- DAT_RMR_FIELD_MEM_PRIV = 0x08,\r
- DAT_RMR_FIELD_RMR_CONTEXT = 0x10,\r
-\r
- DAT_RMR_FIELD_ALL = 0x1F\r
- } DAT_RMR_PARAM_MASK;\r
-\r
-/* Provider attributes */\r
-\r
-typedef enum dat_iov_ownership\r
- {\r
- /* Not modification by provider, consumer can use anytime. */\r
- DAT_IOV_CONSUMER = 0x0, \r
-\r
- /* Provider does not modify returned IOV DTO on completion. */\r
- DAT_IOV_PROVIDER_NOMOD = 0x1, \r
-\r
- /* Provider may modify IOV DTO on completion, can't trust it. */\r
- DAT_IOV_PROVIDER_MOD = 0x2 \r
-\r
- } DAT_IOV_OWNERSHIP;\r
-\r
-typedef enum dat_ep_creator_for_psp\r
- {\r
- DAT_PSP_CREATES_EP_NEVER, /* provider never creates endpoint */\r
- DAT_PSP_CREATES_EP_IFASKED, /* provider creates endpoint if asked */\r
- DAT_PSP_CREATES_EP_ALWAYS /* provider always creates endpoint */\r
- } DAT_EP_CREATOR_FOR_PSP;\r
-\r
-/* Endpoint attributes */\r
-\r
-typedef enum dat_service_type\r
- {\r
- DAT_SERVICE_TYPE_RC /* reliable connections */\r
- } DAT_SERVICE_TYPE;\r
-\r
-typedef struct dat_ep_attr {\r
- DAT_SERVICE_TYPE service_type;\r
- DAT_VLEN max_mtu_size;\r
- DAT_VLEN max_rdma_size;\r
- DAT_QOS qos;\r
- DAT_COMPLETION_FLAGS recv_completion_flags;\r
- DAT_COMPLETION_FLAGS request_completion_flags;\r
- DAT_COUNT max_recv_dtos;\r
- DAT_COUNT max_request_dtos;\r
- DAT_COUNT max_recv_iov;\r
- DAT_COUNT max_request_iov;\r
- DAT_COUNT max_rdma_read_in; \r
- DAT_COUNT max_rdma_read_out;\r
- DAT_COUNT ep_transport_specific_count;\r
- DAT_NAMED_ATTR * ep_transport_specific;\r
- DAT_COUNT ep_provider_specific_count;\r
- DAT_NAMED_ATTR * ep_provider_specific;\r
- } DAT_EP_ATTR;\r
-\r
-/* Endpoint Parameters */\r
-\r
-/* For backwards compatability */ \r
-#define DAT_EP_STATE_ERROR DAT_EP_STATE_DISCONNECTED\r
-\r
-typedef enum dat_ep_state\r
- {\r
- DAT_EP_STATE_UNCONNECTED, /* quiescent state */\r
- DAT_EP_STATE_RESERVED,\r
- DAT_EP_STATE_PASSIVE_CONNECTION_PENDING,\r
- DAT_EP_STATE_ACTIVE_CONNECTION_PENDING,\r
- DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING,\r
- DAT_EP_STATE_CONNECTED,\r
- DAT_EP_STATE_DISCONNECT_PENDING,\r
- DAT_EP_STATE_DISCONNECTED, \r
- DAT_EP_STATE_COMPLETION_PENDING\r
- } DAT_EP_STATE;\r
-\r
-typedef struct dat_ep_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_EP_STATE ep_state;\r
- DAT_IA_ADDRESS_PTR local_ia_address_ptr;\r
- DAT_PORT_QUAL local_port_qual;\r
- DAT_IA_ADDRESS_PTR remote_ia_address_ptr;\r
- DAT_PORT_QUAL remote_port_qual;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EVD_HANDLE recv_evd_handle;\r
- DAT_EVD_HANDLE request_evd_handle;\r
- DAT_EVD_HANDLE connect_evd_handle;\r
- DAT_EP_ATTR ep_attr;\r
- } DAT_EP_PARAM;\r
-\r
-typedef enum dat_ep_param_mask\r
- {\r
- DAT_EP_FIELD_IA_HANDLE = 0x00000001,\r
- DAT_EP_FIELD_EP_STATE = 0x00000002,\r
- DAT_EP_FIELD_LOCAL_IA_ADDRESS_PTR = 0x00000004,\r
- DAT_EP_FIELD_LOCAL_PORT_QUAL = 0x00000008,\r
- DAT_EP_FIELD_REMOTE_IA_ADDRESS_PTR = 0x00000010,\r
- DAT_EP_FIELD_REMOTE_PORT_QUAL = 0x00000020,\r
- DAT_EP_FIELD_PZ_HANDLE = 0x00000040,\r
- DAT_EP_FIELD_RECV_EVD_HANDLE = 0x00000080,\r
- DAT_EP_FIELD_REQUEST_EVD_HANDLE = 0x00000100,\r
- DAT_EP_FIELD_CONNECT_EVD_HANDLE = 0x00000200,\r
-\r
- /* Remainder of values from EP_ATTR, 0x00001000 and up */\r
-\r
- DAT_EP_FIELD_EP_ATTR_SERVICE_TYPE = 0x00001000,\r
- DAT_EP_FIELD_EP_ATTR_MAX_MESSAGE_SIZE = 0x00002000,\r
- DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE = 0x00004000,\r
- DAT_EP_FIELD_EP_ATTR_QOS = 0x00008000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_RECV_COMPLETION_FLAGS = 0x00010000,\r
- DAT_EP_FIELD_EP_ATTR_REQUEST_COMPLETION_FLAGS = 0x00020000,\r
- DAT_EP_FIELD_EP_ATTR_MAX_RECV_DTOS = 0x00040000,\r
- DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_DTOS = 0x00080000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_MAX_RECV_IOV = 0x00100000,\r
- DAT_EP_FIELD_EP_ATTR_MAX_REQUEST_IOV = 0x00200000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_MAX_RDMA_READ_IN = 0x00400000, \r
- DAT_EP_FIELD_EP_ATTR_MAX_RDMA_READ_OUT = 0x00800000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_NUM_TRANSPORT_ATTR = 0x01000000,\r
- DAT_EP_FIELD_EP_ATTR_TRANSPORT_SPECIFIC_ATTR = 0x02000000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_NUM_PROVIDER_ATTR = 0x04000000,\r
- DAT_EP_FIELD_EP_ATTR_PROVIDER_SPECIFIC_ATTR = 0x08000000,\r
-\r
- DAT_EP_FIELD_EP_ATTR_ALL = 0x0FFFF000,\r
- DAT_EP_FIELD_ALL = 0x0FFFF5FF\r
- } DAT_EP_PARAM_MASK;\r
-\r
-/* PZ Parameters */\r
-\r
-typedef struct dat_pz_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- } DAT_PZ_PARAM;\r
-\r
-typedef enum dat_pz_param_mask\r
- {\r
- DAT_PZ_FIELD_IA_HANDLE = 0x01,\r
-\r
- DAT_PZ_FIELD_ALL = 0x01\r
- } DAT_PZ_PARAM_MASK;\r
-\r
-/* PSP Parameters */\r
-\r
-typedef struct dat_psp_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_CONN_QUAL conn_qual;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_PSP_FLAGS psp_flags;\r
- } DAT_PSP_PARAM;\r
-\r
-typedef enum dat_psp_param_mask\r
- {\r
- DAT_PSP_FIELD_IA_HANDLE = 0x01,\r
- DAT_PSP_FIELD_CONN_QUAL = 0x02,\r
- DAT_PSP_FIELD_EVD_HANDLE = 0x04,\r
- DAT_PSP_FIELD_PSP_FLAGS = 0x08,\r
-\r
- DAT_PSP_FIELD_ALL = 0x0F\r
- } DAT_PSP_PARAM_MASK;\r
-\r
-/* RSP Parameters */\r
-\r
-typedef struct dat_rsp_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_CONN_QUAL conn_qual;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- } DAT_RSP_PARAM;\r
-\r
-typedef enum dat_rsp_param_mask\r
- {\r
- DAT_RSP_FIELD_IA_HANDLE = 0x01,\r
- DAT_RSP_FIELD_CONN_QUAL = 0x02,\r
- DAT_RSP_FIELD_EVD_HANDLE = 0x04,\r
- DAT_RSP_FIELD_EP_HANDLE = 0x08,\r
-\r
- DAT_RSP_FIELD_ALL = 0x0F\r
- } DAT_RSP_PARAM_MASK;\r
-\r
-/* Connection Request Parameters.\r
- * \r
- * The Connection Request does not provide Remote Endpoint attributes. \r
- * If a local Consumer needs this information, the remote Consumer should \r
- * encode it into Private Data.\r
- */\r
-\r
-typedef struct dat_cr_param\r
- {\r
- /* Remote IA whose Endpoint requested the connection. */\r
- DAT_IA_ADDRESS_PTR remote_ia_address_ptr;\r
-\r
- /* Port qualifier of the remote Endpoint of the requested connection. */\r
- DAT_PORT_QUAL remote_port_qual;\r
-\r
- /* Size of the Private Data. */\r
- DAT_COUNT private_data_size;\r
-\r
- /* Pointer to the Private Data passed by remote side in the Connection\r
- * Request. */\r
- DAT_PVOID private_data;\r
-\r
- /* The local Endpoint provided by the Service Point for the requested \r
- * connection. It is the only Endpoint that can accept a Connection \r
- * Request on this Service Point. The value DAT_HANDLE_NULL represents \r
- * that there is no associated local Endpoint for the requested \r
- * connection. */\r
- DAT_EP_HANDLE local_ep_handle;\r
-\r
- } DAT_CR_PARAM;\r
-\r
-typedef enum dat_cr_param_mask\r
- {\r
- DAT_CR_FIELD_REMOTE_IA_ADDRESS_PTR = 0x01,\r
- DAT_CR_FIELD_REMOTE_PORT_QUAL = 0x02,\r
- DAT_CR_FIELD_PRIVATE_DATA_SIZE = 0x04,\r
- DAT_CR_FIELD_PRIVATE_DATA = 0x08,\r
- DAT_CR_FIELD_LOCAL_EP_HANDLE = 0x10,\r
-\r
- DAT_CR_FIELD_ALL = 0x1F\r
- } DAT_CR_PARAM_MASK;\r
-\r
-/************************** Events ******************************************/\r
-\r
-/* Completion status flags */\r
-\r
- /* dto completion status */\r
-\r
- /* For backwards compatability */ \r
-#define DAT_DTO_LENGTH_ERROR DAT_DTO_ERR_LOCAL_LENGTH \r
-#define DAT_DTO_FAILURE DAT_DTO_ERR_FLUSHED\r
-\r
-typedef enum dat_dto_completion_status\r
- {\r
- DAT_DTO_SUCCESS = 0,\r
- DAT_DTO_ERR_FLUSHED = 1, \r
- DAT_DTO_ERR_LOCAL_LENGTH = 2, \r
- DAT_DTO_ERR_LOCAL_EP = 3, \r
- DAT_DTO_ERR_LOCAL_PROTECTION = 4, \r
- DAT_DTO_ERR_BAD_RESPONSE = 5, \r
- DAT_DTO_ERR_REMOTE_ACCESS = 6, \r
- DAT_DTO_ERR_REMOTE_RESPONDER = 7, \r
- DAT_DTO_ERR_TRANSPORT = 8, \r
- DAT_DTO_ERR_RECEIVER_NOT_READY = 9, \r
- DAT_DTO_ERR_PARTIAL_PACKET = 10, \r
- DAT_RMR_OPERATION_FAILED = 11\r
- } DAT_DTO_COMPLETION_STATUS;\r
-\r
- /* rmr completion status */\r
-\r
- /* For backwards compatability */ \r
-#define DAT_RMR_BIND_SUCCESS DAT_DTO_SUCCESS \r
-#define DAT_RMR_BIND_FAILURE DAT_DTO_ERR_FLUSHED\r
-\r
-#define DAT_RMR_BIND_COMPLETION_STATUS DAT_DTO_COMPLETION_STATUS\r
-\r
-/* Completion group structs (six total) */\r
-\r
- /* DTO completion event data */\r
-typedef struct dat_dto_completion_event_data\r
- {\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_DTO_COOKIE user_cookie;\r
- DAT_DTO_COMPLETION_STATUS status;\r
- DAT_VLEN transfered_length;\r
- } DAT_DTO_COMPLETION_EVENT_DATA;\r
-\r
- /* rmr bind completion event data */\r
-typedef struct dat_rmr_bind_completion_event_data\r
- {\r
- DAT_RMR_HANDLE rmr_handle;\r
- DAT_RMR_COOKIE user_cookie;\r
- DAT_RMR_BIND_COMPLETION_STATUS status;\r
- } DAT_RMR_BIND_COMPLETION_EVENT_DATA;\r
-\r
-typedef union dat_sp_handle\r
-{\r
- DAT_RSP_HANDLE rsp_handle;\r
- DAT_PSP_HANDLE psp_handle;\r
-} DAT_SP_HANDLE;\r
-\r
- /* Connection Request Arrival event data */\r
-typedef struct dat_cr_arrival_event_data\r
- {\r
- /* Handle to the Service Point that received the Connection Request from \r
- * the remote side. If the Service Point was Reserved, sp is DAT_HANDLE_NULL\r
- * because the reserved Service Point is automatically destroyed upon \r
- * generating this event. Can be PSP or RSP. */\r
- DAT_SP_HANDLE sp_handle;\r
-\r
- /* Address of the IA on which the Connection Request arrived. */\r
- DAT_IA_ADDRESS_PTR local_ia_address_ptr;\r
-\r
- /* Connection Qualifier of the IA on which the Service Point received a \r
- * Connection Request. */\r
- DAT_CONN_QUAL conn_qual;\r
-\r
- /* The Connection Request instance created by a Provider for the arrived \r
- * Connection Request. Consumers can find out private_data passed by a remote\r
- * Consumer from cr_handle. It is up to a Consumer to dat_cr_accept or \r
- * dat_cr_reject of the Connection Request. */\r
- DAT_CR_HANDLE cr_handle;\r
-\r
- } DAT_CR_ARRIVAL_EVENT_DATA;\r
-\r
-\r
- /* Connection event data */\r
-typedef struct dat_connection_event_data\r
- {\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_COUNT private_data_size;\r
- DAT_PVOID private_data;\r
- } DAT_CONNECTION_EVENT_DATA;\r
-\r
- /* Async Error event data */\r
-typedef struct dat_asynch_error_event_data\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- } DAT_ASYNCH_ERROR_EVENT_DATA;\r
-\r
- /* SE completion event data */\r
-typedef struct dat_software_event_data\r
- {\r
- DAT_PVOID pointer;\r
- } DAT_SOFTWARE_EVENT_DATA;\r
-\r
-typedef enum dat_event_number \r
- {\r
- DAT_DTO_COMPLETION_EVENT = 0x00001,\r
-\r
- DAT_RMR_BIND_COMPLETION_EVENT = 0x01001,\r
-\r
- DAT_CONNECTION_REQUEST_EVENT = 0x02001,\r
- \r
- DAT_CONNECTION_EVENT_ESTABLISHED = 0x04001,\r
- DAT_CONNECTION_EVENT_PEER_REJECTED = 0x04002,\r
- DAT_CONNECTION_EVENT_NON_PEER_REJECTED = 0x04003,\r
- DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR = 0x04004,\r
- DAT_CONNECTION_EVENT_DISCONNECTED = 0x04005,\r
- DAT_CONNECTION_EVENT_BROKEN = 0x04006,\r
- DAT_CONNECTION_EVENT_TIMED_OUT = 0x04007,\r
- DAT_CONNECTION_EVENT_UNREACHABLE = 0x04008,\r
-\r
- DAT_ASYNC_ERROR_EVD_OVERFLOW = 0x08001,\r
- DAT_ASYNC_ERROR_IA_CATASTROPHIC = 0x08002,\r
- DAT_ASYNC_ERROR_EP_BROKEN = 0x08003,\r
- DAT_ASYNC_ERROR_TIMED_OUT = 0x08004,\r
- DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR = 0x08005,\r
-\r
- DAT_SOFTWARE_EVENT = 0x10001\r
- } DAT_EVENT_NUMBER;\r
-\r
-/* Union for event Data */\r
-\r
-typedef union dat_event_data\r
- {\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_completion_event_data;\r
- DAT_RMR_BIND_COMPLETION_EVENT_DATA rmr_completion_event_data;\r
- DAT_CR_ARRIVAL_EVENT_DATA cr_arrival_event_data;\r
- DAT_CONNECTION_EVENT_DATA connect_event_data;\r
- DAT_ASYNCH_ERROR_EVENT_DATA asynch_error_event_data;\r
- DAT_SOFTWARE_EVENT_DATA software_event_data;\r
- } DAT_EVENT_DATA;\r
-\r
-/* Event struct that holds all event information */\r
-\r
-typedef struct dat_event\r
- {\r
- DAT_EVENT_NUMBER event_number;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_EVENT_DATA event_data;\r
- } DAT_EVENT;\r
-\r
-/* Provider/registration info */\r
-\r
-typedef struct dat_provider_info {\r
- char ia_name[DAT_NAME_MAX_LENGTH];\r
- DAT_UINT32 dapl_version_major;\r
- DAT_UINT32 dapl_version_minor;\r
- DAT_BOOLEAN is_thread_safe;\r
- } DAT_PROVIDER_INFO ;\r
-\r
-/****************************************************************************\r
- * FUNCTION PROTOTYPES\r
- ****************************************************************************/\r
-/*\r
- * IA functions\r
- *\r
- * Note that there are actual 'dat_ia_open' and 'dat_ia_close'\r
- * functions, it is not just a re-directing #define. That is\r
- * because the functions may have to ensure that the provider\r
- * library is loaded before it can call it, and may choose to\r
- * unload the library after the last close.\r
- */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_IA_OPEN_FUNC)(\r
- IN const DAT_NAME_PTR, /* provider */\r
- IN DAT_COUNT, /* asynch_evd_min_qlen */\r
- INOUT DAT_EVD_HANDLE *, /* asynch_evd_handle */\r
- OUT DAT_IA_HANDLE *); /* ia_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_IA_OPENV_FUNC)(\r
- IN const DAT_NAME_PTR, /* provider */\r
- IN DAT_COUNT, /* asynch_evd_min_qlen */\r
- INOUT DAT_EVD_HANDLE *, /* asynch_evd_handle */\r
- OUT DAT_IA_HANDLE *, /* ia_handle */\r
- IN DAT_UINT32, /* dat major version number */ \r
- IN DAT_UINT32, /* dat minor version number */ \r
- IN DAT_BOOLEAN); /* dat thread safety */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_IA_CLOSE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CLOSE_FLAGS ); /* close_flags */ \r
-\r
-/* helper functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_SET_CONSUMER_CONTEXT_FUNC)(\r
- IN DAT_HANDLE, /* dat handle */\r
- IN DAT_CONTEXT); /* context */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_GET_CONSUMER_CONTEXT_FUNC)(\r
- IN DAT_HANDLE, /* dat handle */\r
- OUT DAT_CONTEXT * ); /* context */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_GET_HANDLE_TYPE_FUNC)(\r
- IN DAT_HANDLE,\r
- OUT DAT_HANDLE_TYPE * );\r
-\r
-/* CR Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CR_QUERY_FUNC)(\r
- IN DAT_CR_HANDLE, /* cr_handle */\r
- IN DAT_CR_PARAM_MASK, /* cr_param_mask */\r
- OUT DAT_CR_PARAM * ); /* cr_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CR_ACCEPT_FUNC)(\r
- IN DAT_CR_HANDLE, /* cr_handle */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID ); /* private_data */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CR_REJECT_FUNC)(\r
- IN DAT_CR_HANDLE );\r
-\r
-/* For DAT-1.1 this function is defined for both uDAPL and kDAPL. \r
- * For DAT-1.0 it was only defined for uDAPL. \r
- */ \r
-typedef DAT_RETURN (DAT_API *DAT_CR_HANDOFF_FUNC)( \r
- IN DAT_CR_HANDLE, /* cr_handle */ \r
- IN DAT_CONN_QUAL); /* handoff */\r
-\r
-/* EVD Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_RESIZE_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_COUNT ); /* evd_min_qlen */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_POST_SE_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN const DAT_EVENT * ); /* event */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_DEQUEUE_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- OUT DAT_EVENT * ); /* event */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_FREE_FUNC)(\r
- IN DAT_EVD_HANDLE );\r
-\r
-/* ep functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_EVD_HANDLE, /* recv_completion_evd_handle */\r
- IN DAT_EVD_HANDLE, /* request_completion_evd_handle */\r
- IN DAT_EVD_HANDLE, /* connect_evd_handle */\r
- IN const DAT_EP_ATTR *, /* ep_attributes */\r
- OUT DAT_EP_HANDLE * ); /* ep_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_QUERY_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_PARAM_MASK, /* ep_param_mask */\r
- OUT DAT_EP_PARAM * ); /* ep_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_MODIFY_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_PARAM_MASK, /* ep_param_mask */\r
- IN const DAT_EP_PARAM * ); /* ep_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_CONNECT_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_IA_ADDRESS_PTR, /* remote_ia_address */\r
- IN DAT_CONN_QUAL, /* remote_conn_qual */\r
- IN DAT_TIMEOUT, /* timeout */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID, /* private_data */\r
- IN DAT_QOS, /* quality_of_service */\r
- IN DAT_CONNECT_FLAGS ); /* connect_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_DUP_CONNECT_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EP_HANDLE, /* ep_dup_handle */\r
- IN DAT_TIMEOUT, /* timeout */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID, /* private_data */\r
- IN DAT_QOS); /* quality_of_service */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_DISCONNECT_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_CLOSE_FLAGS ); /* close_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_POST_SEND_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_POST_RECV_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_POST_RDMA_READ_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN const DAT_RMR_TRIPLET *,/* remote_iov */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_POST_RDMA_WRITE_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE, /* user_cookie */\r
- IN const DAT_RMR_TRIPLET *,/* remote_iov */\r
- IN DAT_COMPLETION_FLAGS ); /* completion_flags */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_GET_STATUS_FUNC)(\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- OUT DAT_EP_STATE *, /* ep_state */\r
- OUT DAT_BOOLEAN *, /* recv_idle */\r
- OUT DAT_BOOLEAN * ); /* request_idle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_FREE_FUNC)(\r
- IN DAT_EP_HANDLE); /* ep_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EP_RESET_FUNC)( \r
- IN DAT_EP_HANDLE); /* ep_handle */\r
-\r
-/* LMR functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_LMR_FREE_FUNC)(\r
- IN DAT_LMR_HANDLE);\r
-\r
-/* RMR Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RMR_CREATE_FUNC)(\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- OUT DAT_RMR_HANDLE *); /* rmr_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RMR_QUERY_FUNC)(\r
- IN DAT_RMR_HANDLE, /* rmr_handle */\r
- IN DAT_RMR_PARAM_MASK, /* rmr_param_mask */\r
- OUT DAT_RMR_PARAM *); /* rmr_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RMR_BIND_FUNC)(\r
- IN DAT_RMR_HANDLE, /* rmr_handle */\r
- IN const DAT_LMR_TRIPLET *,/* lmr_triplet */\r
- IN DAT_MEM_PRIV_FLAGS, /* mem_priv */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_RMR_COOKIE, /* user_cookie */\r
- IN DAT_COMPLETION_FLAGS, /* completion_flags */\r
- OUT DAT_RMR_CONTEXT * ); /* context */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RMR_FREE_FUNC)(\r
- IN DAT_RMR_HANDLE);\r
-\r
-/* PSP Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PSP_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CONN_QUAL, /* conn_qual */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_PSP_FLAGS, /* psp_flags */\r
- OUT DAT_PSP_HANDLE * ); /* psp_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PSP_CREATE_ANY_FUNC)( \r
- IN DAT_IA_HANDLE, /* ia_handle */ \r
- OUT DAT_CONN_QUAL *, /* conn_qual */ \r
- IN DAT_EVD_HANDLE, /* evd_handle */ \r
- IN DAT_PSP_FLAGS, /* psp_flags */ \r
- OUT DAT_PSP_HANDLE * ); /* psp_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PSP_QUERY_FUNC)(\r
- IN DAT_PSP_HANDLE,\r
- IN DAT_PSP_PARAM_MASK,\r
- OUT DAT_PSP_PARAM * );\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PSP_FREE_FUNC)(\r
- IN DAT_PSP_HANDLE ); /* psp_handle */\r
-\r
-/* RSP Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RSP_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CONN_QUAL, /* conn_qual */\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- OUT DAT_RSP_HANDLE * ); /* rsp_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RSP_QUERY_FUNC) (\r
- IN DAT_RSP_HANDLE,\r
- IN DAT_RSP_PARAM_MASK,\r
- OUT DAT_RSP_PARAM * );\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_RSP_FREE_FUNC)(\r
- IN DAT_RSP_HANDLE ); /* rsp_handle */\r
-\r
-/* PZ Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PZ_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- OUT DAT_PZ_HANDLE * ); /* pz_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PZ_QUERY_FUNC)(\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_PZ_PARAM_MASK, /* pz_param_mask */\r
- OUT DAT_PZ_PARAM *); /* pz_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_PZ_FREE_FUNC)(\r
- IN DAT_PZ_HANDLE ); /* pz_handle */\r
-\r
-/*\r
- * DAT registry functions. \r
- *\r
- * Note the dat_ia_open and dat_ia_close functions are linked to\r
- * registration code which "redirects" to the appropriate provider.\r
- */\r
-\r
-DAT_EXPORT DAT_RETURN DAT_API dat_ia_openv ( \r
- IN const DAT_NAME_PTR, /* device name */ \r
- IN DAT_COUNT, /* async_evd_qlen */ \r
- INOUT DAT_EVD_HANDLE *, /* async_evd_handle */ \r
- OUT DAT_IA_HANDLE *, /* ia_handle */ \r
- IN DAT_UINT32, /* dat major version number */ \r
- IN DAT_UINT32, /* dat minor version number */ \r
- IN DAT_BOOLEAN); /* dat thread safety */\r
-\r
-#define dat_ia_open(name,qlen,async_evd,ia) \\r
- dat_ia_openv((name), (qlen), (async_evd), (ia), \\r
- DAT_VERSION_MAJOR, DAT_VERSION_MINOR, \\r
- DAT_THREADSAFE)\r
-\r
-DAT_EXPORT DAT_RETURN DAT_API dat_ia_close (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_CLOSE_FLAGS ); /* close_flags */ \r
-\r
-DAT_EXPORT DAT_RETURN DAT_API dat_registry_list_providers(\r
- IN DAT_COUNT, /* max_to_return */\r
- OUT DAT_COUNT *, /* entries_returned */\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[]) ); /* dat_provider_list */\r
-\r
-typedef DAT_RETURN ( DAT_API *DAT_REGISTRY_LIST_PROVIDERS_FUNC)(\r
- IN DAT_COUNT, /* max_to_return */\r
- OUT DAT_COUNT *, /* entries_returned */\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[])); /* dat_provider_list */\r
-\r
-/* \r
- * DAT error functions. \r
- */ \r
-DAT_EXPORT DAT_RETURN DAT_API dat_strerror ( \r
- IN DAT_RETURN, /* dat function return */ \r
- OUT const char ** , /* major message string */ \r
- OUT const char ** ); /* minor message string */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _DAT_H_ */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/***********************************************************\r
- * \r
- * HEADER: dat_error.h\r
- *\r
- * PURPOSE: DAT return codes\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules: Major error codes occupies upper 16 of a 32 bit field.\r
- * detailed error code occupies lower 16 bits.\r
- * \r
- *\r
- *********************************************************/\r
-\r
-#ifndef _DAT_ERROR_H_\r
-#define _DAT_ERROR_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/*\r
- *\r
- * All return codes are actually a 3-way tuple: \r
- * \r
- * type: CLASS DAT_TYPE_STATUS DAT_SUBTYPE_STATUS \r
- * bits: 31-30 29-16 15-0 \r
- * \r
- * +----------------------------------------------------------------------+ \r
- * |3130 | 29282726252423222120191817 | 1615141312111009080706054003020100| \r
- * |CLAS | DAT_TYPE_STATUS | SUBTYPE_STATUS | \r
- * +----------------------------------------------------------------------+ \r
- */ \r
-\r
-/* \r
- * Class Bits \r
- */ \r
-#define DAT_CLASS_ERROR 0x80000000 \r
-#define DAT_CLASS_WARNING 0x40000000 \r
-#define DAT_CLASS_SUCCESS 0x00000000 \r
-\r
-/* \r
- * DAT Error bits \r
- */ \r
-#define DAT_TYPE_MASK 0x3fff0000 /* mask for DAT_TYPE_STATUS bits */ \r
-#define DAT_SUBTYPE_MASK 0x0000FFFF /* mask for DAT_SUBTYPE_STATUS bits */ \r
-\r
-/* \r
- * Determining the success of an operation is best done with a macro, \r
- * each of these returns a boolean value.\r
- */ \r
-#define DAT_IS_SUCCESS(status) ((int)(status) >= 0) \r
-#define DAT_IS_WARNING(status) ((DAT_UINT32)(status) & DAT_CLASS_ WARNING) \r
-\r
-#define DAT_GET_TYPE(status) ((DAT_UINT32)(status) & DAT_TYPE_MASK) \r
-#define DAT_GET_SUBTYPE(status) ((DAT_UINT32)(status) & DAT_SUBTYPE_MASK)\r
-\r
-/*\r
- * DAT return types. The ERROR bit is enabled for these definitions\r
- */\r
-typedef enum dat_return\r
- {\r
- /* The operation was successful. */\r
- DAT_SUCCESS = 0x000000,\r
-\r
- /* The operation was aborted because IA was closed or EVD was *\r
- * destroyed. */\r
- DAT_ABORT = 0x00010000,\r
-\r
- /* The specified Connection Qualifier was in use. */\r
- DAT_CONN_QUAL_IN_USE = 0x00020000,\r
- \r
- /* The operation failed due to resource limitations. */\r
- DAT_INSUFFICIENT_RESOURCES = 0x00030000,\r
-\r
- /* Provider internal error. This error can be returned by any *\r
- * operation when the Provider have detected an internal error. *\r
- * This error does no mask any error causes by Consumer. */\r
- DAT_INTERNAL_ERROR = 0x00040000,\r
-\r
- /* One of the DAT handles was invalid. */\r
- DAT_INVALID_HANDLE = 0x00050000,\r
-\r
- /* One of the parameters was invalid. */\r
- DAT_INVALID_PARAMETER = 0x00060000,\r
-\r
- /* One of the parameters was invalid for this operation. There *\r
- * are Event Streams associated with the Event Dispatcher feeding *\r
- * it. */\r
- DAT_INVALID_STATE = 0x00070000,\r
-\r
- /* The size of the receiving buffer is too small for sending *\r
- * buffer data. The size of the local buffer is too small for *\r
- * the data of the remote buffer. */\r
- DAT_LENGTH_ERROR = 0x00080000,\r
-\r
- /* The requested Model was not supported by the Provider. */\r
- DAT_MODEL_NOT_SUPPORTED = 0x00090000,\r
-\r
- /* The specified IA name was not found in the list of registered *\r
- * Providers. */\r
-\r
- DAT_PROVIDER_NOT_FOUND = 0x000A0000,\r
-\r
- /* Protection violation for local or remote memory *\r
- * access. Protection Zone mismatch between an LMR of one of the *\r
- * local_iov segments and the local Endpoint. */\r
- DAT_PRIVILEGES_VIOLATION = 0x000B0000,\r
-\r
- /* Privileges violation for local or re-mote memory access. One *\r
- * of the LMRs used in local_iov was either invalid or did not *\r
- * have the local read privileges. */\r
- DAT_PROTECTION_VIOLATION = 0x000C0000,\r
- \r
- /* The operation timed out without a notification. */\r
- DAT_QUEUE_EMPTY = 0x000D0000,\r
-\r
- /* The Event Dispatcher queue is full. */\r
- DAT_QUEUE_FULL = 0x000E0000,\r
- \r
- /* The operation timed out. UDAPL ONLY */\r
- DAT_TIMEOUT_EXPIRED = 0x000F0000, \r
-\r
- /* The provider name was already registered */\r
- DAT_PROVIDER_ALREADY_REGISTERED = 0x00100000,\r
-\r
- /* The provider is "in-use" and cannot be closed at this time */\r
- DAT_PROVIDER_IN_USE = 0x00110000,\r
-\r
- /* The requested remote address is not valid or not reachable */\r
- DAT_INVALID_ADDRESS = 0x00120000, \r
-\r
- /* [Unix only] dat_evd_wait or dat_cno_wait has been interrupted. */\r
- DAT_INTERRUPTED_CALL = 0x00130000,\r
-\r
- /* No Connection Qualifiers are available */\r
- DAT_CONN_QUAL_UNAVAILABLE = 0x00140000,\r
- DAT_NOT_IMPLEMENTED = 0x0FFF0000\r
-\r
- } DAT_RETURN;\r
-\r
-\r
-/* \r
- * DAT_RETURN_SUBTYPE\r
- * \r
- * The 16 bits of subtype information allow for 256 different \r
- * values.\r
- */ \r
-\r
-typedef enum dat_return_subtype \r
- { \r
- /* First element is no subtype */\r
- DAT_NO_SUBTYPE,\r
- /* ABORT sub types */ \r
- /* call was interrupted by a signal, or otherwise */ \r
- DAT_SUB_INTERRUPTED,\r
-\r
- /* DAT_CONN_QUAL_IN_USE has no subtypes */ \r
-\r
- /* INSUFFICIENT_RESOURCES subtypes */ \r
- DAT_RESOURCE_MEMORY,\r
- DAT_RESOURCE_DEVICE, \r
- DAT_RESOURCE_TEP, /* transport endpoint, e.g. QP */ \r
- DAT_RESOURCE_TEVD, /* transport EVD, e.g. CQ */ \r
- DAT_RESOURCE_PROTECTION_DOMAIN, \r
- DAT_RESOURCE_MEMORY_REGION, /* HCA memory for LMR or RMR */ \r
- DAT_RESOURCE_ERROR_HANDLER,\r
- DAT_RESOURCE_CREDITS, /* e.g outstanding RDMA Read credit as target */ \r
-\r
- /* DAT_INTERNAL_ERROR has no subtypes */ \r
-\r
- /* INVALID_HANDLE subtypes */\r
- DAT_INVALID_HANDLE_IA, \r
- DAT_INVALID_HANDLE_EP, \r
- DAT_INVALID_HANDLE_LMR, \r
- DAT_INVALID_HANDLE_RMR, \r
- DAT_INVALID_HANDLE_PZ, \r
- DAT_INVALID_HANDLE_PSP, \r
- DAT_INVALID_HANDLE_RSP, \r
- DAT_INVALID_HANDLE_CR, \r
- DAT_INVALID_HANDLE_CNO, \r
- DAT_INVALID_HANDLE_EVD_CR, \r
- DAT_INVALID_HANDLE_EVD_REQUEST, \r
- DAT_INVALID_HANDLE_EVD_RECV, \r
- DAT_INVALID_HANDLE_EVD_CONN, \r
- DAT_INVALID_HANDLE_EVD_ASYNC, \r
-\r
- /* DAT_INVALID_PARAMETER subtypes */ \r
- DAT_INVALID_ARG1, \r
- DAT_INVALID_ARG2, \r
- DAT_INVALID_ARG3, \r
- DAT_INVALID_ARG4, \r
- DAT_INVALID_ARG5, \r
- DAT_INVALID_ARG6, \r
- DAT_INVALID_ARG7, \r
- DAT_INVALID_ARG8, \r
- DAT_INVALID_ARG9, \r
- DAT_INVALID_ARG10, \r
-\r
- /* DAT_INVALID_EP_STATE subtypes */ \r
- DAT_INVALID_STATE_EP_UNCONNECTED,\r
- DAT_INVALID_STATE_EP_ACTCONNPENDING,\r
- DAT_INVALID_STATE_EP_PASSCONNPENDING,\r
- DAT_INVALID_STATE_EP_TENTCONNPENDING,\r
- DAT_INVALID_STATE_EP_CONNECTED,\r
- DAT_INVALID_STATE_EP_DISCONNECTED,\r
- DAT_INVALID_STATE_EP_RESERVED,\r
- DAT_INVALID_STATE_EP_COMPLPENDING,\r
- DAT_INVALID_STATE_EP_DISCPENDING,\r
- DAT_INVALID_STATE_EP_PROVIDERCONTROL,\r
- DAT_INVALID_STATE_EP_NOTREADY,\r
-\r
- DAT_INVALID_STATE_CNO_IN_USE,\r
- DAT_INVALID_STATE_CNO_DEAD, \r
-\r
- /* EVD states. Enabled/Disabled, Waitable/Unwaitable, *\r
- * and Notify/Solicited/Threshold are 3 orthogonal *\r
- * bands of EVD state.The Threshold one is uDAPL specific. */\r
- DAT_INVALID_STATE_EVD_OPEN, \r
- /* EVD can be either in enabled or disabled but not both *\r
- * or neither at the same time */\r
- DAT_INVALID_STATE_EVD_ENABLED,\r
- DAT_INVALID_STATE_EVD_DISABLED,\r
- /* EVD can be either in waitable or unwaitable but not *\r
- * both or neither at the same time */ \r
- DAT_INVALID_STATE_EVD_WAITABLE, \r
- DAT_INVALID_STATE_EVD_UNWAITABLE, \r
- /* Do not release an EVD if it is in use */\r
- DAT_INVALID_STATE_EVD_IN_USE,\r
-\r
- /* EVD can be either in notify or solicited or threshold *\r
- * but not any pair, or all, or none at the same time. *\r
- * The threshold one is for uDAPL only */ \r
- DAT_INVALID_STATE_EVD_CONFIG_NOTIFY, \r
- DAT_INVALID_STATE_EVD_CONFIG_SOLICITED, \r
- DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD, \r
- DAT_INVALID_STATE_EVD_WAITER, \r
- DAT_INVALID_STATE_EVD_ASYNC, /* Async EVD required */\r
- DAT_INVALID_STATE_IA_IN_USE, \r
- DAT_INVALID_STATE_LMR_IN_USE, \r
- DAT_INVALID_STATE_LMR_FREE, \r
- DAT_INVALID_STATE_PZ_IN_USE, \r
- DAT_INVALID_STATE_PZ_FREE, \r
-\r
- /* DAT_LENGTH_ERROR has no subtypes */ \r
- /* DAT_MODEL_NOT_SUPPORTED has no subtypes */\r
-\r
- /* DAT_PROVIDER_NOT_FOUND has no subtypes */\r
-\r
- /* DAT_PRIVILEGES_VIOLATION subtypes */ \r
- DAT_PRIVILEGES_READ, \r
- DAT_PRIVILEGES_WRITE, \r
- DAT_PRIVILEGES_RDMA_READ, \r
- DAT_PRIVILEGES_RDMA_WRITE, \r
-\r
- /* DAT_PROTECTION_VIOLATION subtypes */ \r
- DAT_PROTECTION_READ, \r
- DAT_PROTECTION_WRITE, \r
- DAT_PROTECTION_RDMA_READ, \r
- DAT_PROTECTION_RDMA_WRITE, \r
-\r
- /* DAT_QUEUE_EMPTY has no subtypes */\r
- /* DAT_QUEUE_FULL has no subtypes */ \r
- /* DAT_TIMEOUT_EXPIRED has no subtypes */ \r
- /* DAT_PROVIDER_ALREADY_REGISTERED has no subtypes */ \r
- /* DAT_PROVIDER_IN_USE has no subtypes */ \r
-\r
- /* DAT_INVALID_ADDRESS subtypes */ \r
- /* Unsupported addresses - those that are not Malformed, *\r
- * but are incorrect for use in DAT (regardless of local *\r
- * routing capabilities): IPv6 Multicast Addresses (ff/8) *\r
- * IPv4 Broadcast/Multicast Addresses */\r
- DAT_INVALID_ADDRESS_UNSUPPORTED, \r
- /* Unreachable addresses - A Provider may know that certain *\r
- * addresses are unreachable immediately. One examples would *\r
- * be an IPv6 addresses on an IPv4-only system. This may also *\r
- * be returned if it is known that there is no route to the *\r
- * host. A Provider is not obligated to check for this \r
- * condition. */ \r
- DAT_INVALID_ADDRESS_UNREACHABLE, \r
- /* Malformed addresses -- these cannot be valid in any context.* \r
- * Those listed in RFC1884 section 2.3 as "Reserved" or\r
- * "Unassigned". */ \r
- DAT_INVALID_ADDRESS_MALFORMED, \r
-\r
- /* DAT_INTERRUPTED_CALL */ \r
-\r
- /* DAT_PROVIDER_NOT_FOUND subtypes. Erratta to the 1.1 spec */\r
- DAT_NAME_NOT_REGISTERED,\r
- DAT_MAJOR_NOT_FOUND,\r
- DAT_MINOR_NOT_FOUND,\r
- DAT_THREAD_SAFETY_NOT_FOUND,\r
-\r
-\r
- } DAT_RETURN_SUBTYPE;\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _DAT_ERROR_H_ */\r
-\r
-\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
- \r
-/**********************************************************************\r
- * \r
- * HEADER: dat_platform_specific.h\r
- *\r
- * PURPOSE: defines Platform specific types.\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * \r
- **********************************************************************/\r
-\r
-#ifndef _DAT_PLATFORM_SPECIFIC_H_\r
-#define _DAT_PLATFORM_SPECIFIC_H_\r
-\r
-/* OS, processor, compiler type definitions. Add OS's as needed. */\r
-\r
-/* \r
- * This captures the alignment for the bus transfer from the HCA/IB chip\r
- * to the main memory.\r
- */\r
-#ifndef DAT_OPTIMAL_ALIGNMENT\r
-#define DAT_OPTIMAL_ALIGNMENT 256 /* Performance optimal alignment */\r
-#endif /* DAT_OPTIMAL_ALIGNMENT */\r
-\r
-/* Assume all O/Ss use sockaddr, for address family: IPv4 == AF_INET,\r
- * IPv6 == AF_INET6. Use of "namelen" field indicated.\r
- *\r
- * The Interface Adaptor Address names an Interface Adaptor local or\r
- * remote that is used for connection management and Name\r
- * Service. The format of the dat_ia_address_ptr follows the normal\r
- * socket programming practice of struct sockaddr *. DAT supports both\r
- * IPv4 and IPv6 address families. Allocation and initialization of\r
- * DAT IA address structures must follow normal Sockets programming\r
- * procedures. The underlying type of the DAT IA address is the native\r
- * struct sockaddr for each target operating system. In all cases,\r
- * storage appropriate for the address family in use by the target\r
- * Provider must be allocated. For instance, when IPv6 addressing is\r
- * in use, this should be allocated as struct sockaddr_net6 . The\r
- * sockaddr sa_family and, if present, sa_len fields must be\r
- * initialized appropriately, as well as the address information.\r
- * When passed across the DAPL API this storage is cast to the\r
- * DAT_IA_ADDRESS_PTR type. It is the responsibility of the callee to\r
- * verify that the sockaddr contains valid data for the requested\r
- * operation. It is always the responsibility of the caller to manage\r
- * the storage.\r
- *\r
- * Code example for Linux:\r
- *\r
- * #include <stdio.h>\r
- * #include <sys/socket.h>\r
- * #include <netinet/in.h>\r
- * #include <udat.h>\r
- *\r
- * struct sockaddr_in6 addr;\r
- * DAT_IA_ADDRESS_PTR ia_addr;\r
- * int status, i;\r
- *\r
- * // Note: linux pton requires explicit encoding of IPv4 in IPv6 \r
- *\r
- * addr.sin6_family = AF_INET6;\r
- * if (inet_pton(AF_INET6, "0:0:0:0:0:FFFF:192.168.0.1", \r
- * &addr.sin6_addr) <= 0) \r
- * return(-1); // Bad address or no address family support\r
- *\r
- * // initialize other necessary fields such as port, flow, etc\r
- *\r
- * ia_addr = (DAT_IA_ADDRESS_PTR) &addr;\r
- * dat_ep_connect(ep_handle, ia_addr, conn_qual, timeout, 0, NULL, \r
- * qos, DAT_CONNECT_DEFAULT_FLAG);\r
- *\r
- */\r
-\r
-#if defined(sun) || defined(__sun) || defined (_sun_) || defined (__solaris__) /* Solaris */\r
-#include <sys/types.h>\r
-\r
-typedef uint32_t DAT_UINT32; /* Unsigned host order, 32 bits */\r
-typedef uint64_t DAT_UINT64; /* unsigned host order, 64 bits */\r
-typedef unsigned long long DAT_UVERYLONG; /* unsigned longest native to compiler */\r
-\r
-typedef void * DAT_PVOID;\r
-typedef int DAT_COUNT;\r
-\r
-#include <sys/socket.h>\r
-#include <netinet/in.h>\r
-typedef struct sockaddr DAT_SOCK_ADDR; /* Socket address header native to OS */\r
-typedef struct sockaddr_in6 DAT_SOCK_ADDR6; /* Socket address header native to OS */\r
-\r
-#define DAT_AF_INET AF_INET\r
-#define DAT_AF_INET6 AF_INET6\r
-\r
-#define DAT_API\r
-#define DAT_EXPORT extern\r
-\r
-/* Solaris */\r
-\r
-#elif defined(__linux__) /* Linux */\r
-#include <sys/types.h>\r
-\r
-typedef u_int32_t DAT_UINT32; /* unsigned host order, 32 bits */\r
-typedef u_int64_t DAT_UINT64; /* unsigned host order, 64 bits */\r
-typedef unsigned long long DAT_UVERYLONG; /* unsigned longest native to compiler */\r
-\r
-typedef void * DAT_PVOID;\r
-typedef int DAT_COUNT;\r
-\r
-#include <sys/socket.h>\r
-typedef struct sockaddr DAT_SOCK_ADDR; /* Socket address header native to OS */\r
-typedef struct sockaddr_in6 DAT_SOCK_ADDR6; /* Socket address header native to OS */\r
-\r
-#define DAT_AF_INET AF_INET\r
-#define DAT_AF_INET6 AF_INET6\r
-\r
-#define DAT_API\r
-#define DAT_EXPORT extern\r
-\r
-/* Linux */\r
-\r
-#elif defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64)\r
-/* NT. MSC compiler, Win32 platform */\r
-#include <basetsd.h>\r
-typedef unsigned __int32 DAT_UINT32; /* Unsigned host order, 32 bits */\r
-typedef unsigned __int64 DAT_UINT64; /* unsigned host order, 64 bits */\r
-typedef unsigned __int16 DAT_UINT16;\r
-typedef unsigned __int8 DAT_UINT8;\r
-typedef unsigned __int3264 __w64 DAT_UVERYLONG; /* unsigned longest native to compiler */\r
-\r
-typedef void * DAT_PVOID;\r
-typedef long DAT_COUNT;\r
-\r
-typedef struct sockaddr DAT_SOCK_ADDR; /* Socket address header native to OS */\r
-typedef struct sockaddr_in6 DAT_SOCK_ADDR6; /* Socket address header native to OS */\r
-\r
-#define DAT_AF_INET AF_INET\r
-#define DAT_AF_INET6 AF_INET6\r
-\r
-#ifdef EXPORT_DAT_SYMBOLS\r
-#define DAT_EXPORT __declspec( dllexport )\r
-#else\r
-#define DAT_EXPORT __declspec( dllimport )\r
-#endif\r
-\r
-#define DAT_API __stdcall\r
-\r
-/* Windoze */\r
-\r
-#else\r
-#error dat_platform_specific.h : OS type not defined\r
-#endif\r
-\r
-#ifndef IN\r
-#define IN\r
-#endif\r
-#ifndef OUT\r
-#define OUT\r
-#endif\r
-#ifndef INOUT\r
-#define INOUT\r
-#endif\r
-\r
-#endif /* _DAT_PLATFORM_SPECIFIC_H_ */\r
-\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_redirection.h\r
- *\r
- * PURPOSE: Defines the common redirection macros\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- * \r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_REDIRECTION_H_\r
-#define _DAT_REDIRECTION_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-typedef struct dat_provider DAT_PROVIDER;\r
-\r
-#ifndef DAT_HANDLE_TO_PROVIDER\r
-\r
-/* A utility macro to fetch the Provider Library for any object\r
- *\r
- * An alternate version could be defined for single library systems.\r
- * it would look something like:\r
- * extern const struct dat_ia my_single_ia_provider;\r
- * #define DAT_HANDLE_TO_PROVIDER(ignore) &my_single_ia_provider\r
- *\r
- * This would allow a good compiler to avoid indirection overhead when\r
- * making function calls.\r
- */\r
-\r
-#define DAT_HANDLE_TO_PROVIDER(handle) (*(DAT_PROVIDER **)(handle))\r
-#endif\r
-\r
-#define dat_ia_query(ia,evd,ia_msk,ia_ptr,p_msk,p_ptr) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->ia_query_func)(\\r
- (ia),\\r
- (evd),\\r
- (ia_msk),\\r
- (ia_ptr),\\r
- (p_msk),\\r
- (p_ptr))\r
-\r
-#define dat_set_consumer_context(handle,context) \\r
- (*DAT_HANDLE_TO_PROVIDER(handle)->set_consumer_context_func)(\\r
- (handle),\\r
- (context))\r
-\r
-#define dat_get_consumer_context(handle,context) \\r
- (*DAT_HANDLE_TO_PROVIDER(handle)->get_consumer_context_func)(\\r
- (handle),\\r
- (context))\r
-\r
-#define dat_get_handle_type(handle,handle_type) \\r
- (*DAT_HANDLE_TO_PROVIDER(handle)->get_handle_type_func)(\\r
- (handle),\\r
- (handle_type))\r
-\r
-#define dat_cr_query(cr,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(cr)->cr_query_func)(\\r
- (cr),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_cr_accept(cr,ep,size,pdata) \\r
- (*DAT_HANDLE_TO_PROVIDER(cr)->cr_accept_func)(\\r
- (cr),\\r
- (ep),\\r
- (size),\\r
- (pdata))\r
-\r
-#define dat_cr_reject(cr) \\r
- (*DAT_HANDLE_TO_PROVIDER(cr)->cr_reject_func)(\\r
- (cr))\r
-\r
-#define dat_evd_query(evd,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_query_func)(\\r
- (evd),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_evd_resize(evd,qsize) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_resize_func)(\\r
- (evd),\\r
- (qsize))\r
-\r
-#define dat_evd_post_se(evd,event) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_post_se_func)(\\r
- (evd),\\r
- (event))\r
-\r
-#define dat_evd_dequeue(evd,event) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_dequeue_func)(\\r
- (evd),\\r
- (event))\r
-\r
-#define dat_evd_free(evd)\\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_free_func)(\\r
- (evd))\r
-\r
-#define dat_ep_create(ia,pz,in_evd,out_evd,connect_evd,attr,ep) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->ep_create_func)(\\r
- (ia),\\r
- (pz),\\r
- (in_evd),\\r
- (out_evd),\\r
- (connect_evd),\\r
- (attr),\\r
- (ep))\r
-\r
-#define dat_ep_query(ep,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_query_func)(\\r
- (ep),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_ep_modify(ep,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_modify_func)(\\r
- (ep),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_ep_connect(ep,ia_addr,conn_qual,timeout,psize,pdata,qos,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_connect_func)(\\r
- (ep),\\r
- (ia_addr),\\r
- (conn_qual),\\r
- (timeout),\\r
- (psize),\\r
- (pdata),\\r
- (qos),\\r
- (flags))\r
-\r
-#define dat_ep_dup_connect(ep,dup,timeout,psize,pdata,qos) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_dup_connect_func)(\\r
- (ep),\\r
- (dup),\\r
- (timeout),\\r
- (psize),\\r
- (pdata),\\r
- (qos))\r
-\r
-#define dat_ep_disconnect(ep,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_disconnect_func)(\\r
- (ep),\\r
- (flags))\r
-\r
-#define dat_ep_post_send(ep,size,lbuf,cookie,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_post_send_func)(\\r
- (ep),\\r
- (size),\\r
- (lbuf),\\r
- (cookie),\\r
- (flags))\r
-\r
-#define dat_ep_post_recv(ep,size,lbuf,cookie,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_post_recv_func)(\\r
- (ep),\\r
- (size),\\r
- (lbuf),\\r
- (cookie),\\r
- (flags))\r
-\r
-#define dat_ep_post_rdma_read(ep,size,lbuf,cookie,rbuf,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_post_rdma_read_func)(\\r
- (ep),\\r
- (size),\\r
- (lbuf),\\r
- (cookie),\\r
- (rbuf),\\r
- (flags))\r
-\r
-#define dat_ep_post_rdma_write(ep,size,lbuf,cookie,rbuf,flags) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_post_rdma_write_func)(\\r
- (ep),\\r
- (size),\\r
- (lbuf),\\r
- (cookie),\\r
- (rbuf),\\r
- (flags))\r
-\r
-#define dat_ep_get_status(ep,ep_state,recv_idle,request_idle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_get_status_func)(\\r
- (ep),\\r
- (ep_state),\\r
- (recv_idle),\\r
- (request_idle))\r
-\r
-#define dat_ep_free(ep)\\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_free_func)(\\r
- (ep))\r
-\r
-#define dat_ep_reset(ep)\\r
- (*DAT_HANDLE_TO_PROVIDER(ep)->ep_reset_func)(\\r
- (ep))\r
-\r
-#define dat_lmr_query(lmr,mask,param)\\r
- (*DAT_HANDLE_TO_PROVIDER(lmr)->lmr_query_func)(\\r
- (lmr),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_lmr_free(lmr)\\r
- (*DAT_HANDLE_TO_PROVIDER(lmr)->lmr_free_func)(\\r
- (lmr))\r
-\r
-#define dat_rmr_create(pz,rmr) \\r
- (*DAT_HANDLE_TO_PROVIDER(pz)->rmr_create_func)(\\r
- (pz),\\r
- (rmr))\r
-\r
-#define dat_rmr_query(rmr,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(rmr)->rmr_query_func)(\\r
- (rmr),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_rmr_bind(rmr,lmr,mem_priv,ep,cookie,flags,context) \\r
- (*DAT_HANDLE_TO_PROVIDER(rmr)->rmr_bind_func)(\\r
- (rmr),\\r
- (lmr),\\r
- (mem_priv),\\r
- (ep),\\r
- (cookie),\\r
- (flags),\\r
- (context))\r
-\r
-#define dat_rmr_free(rmr)\\r
- (*DAT_HANDLE_TO_PROVIDER(rmr)->rmr_free_func)(\\r
- (rmr))\r
-\r
-#define dat_psp_create(ia,conn_qual,evd,flags,handle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->psp_create_func)(\\r
- (ia),\\r
- (conn_qual),\\r
- (evd),\\r
- (flags),\\r
- (handle))\r
-\r
-#define dat_psp_create_any(ia,conn_qual,evd,flags,handle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->psp_create_any_func)(\\r
- (ia),\\r
- (conn_qual),\\r
- (evd),\\r
- (flags),\\r
- (handle))\r
-\r
-#define dat_psp_query(psp,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(psp)->psp_query_func)(\\r
- (psp),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_psp_free(psp)\\r
- (*DAT_HANDLE_TO_PROVIDER(psp)->psp_free_func)(\\r
- (psp))\r
-\r
-#define dat_rsp_create(ia,conn_qual,ep,evd,handle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->rsp_create_func)(\\r
- (ia),\\r
- (conn_qual),\\r
- (ep),\\r
- (evd),\\r
- (handle))\r
-\r
-#define dat_rsp_query(rsp,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(rsp)->rsp_query_func)(\\r
- (rsp),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_rsp_free(rsp)\\r
- (*DAT_HANDLE_TO_PROVIDER(rsp)->rsp_free_func)(\\r
- (rsp))\r
-\r
-#define dat_pz_create(ia,pz) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->pz_create_func)(\\r
- (ia),\\r
- (pz))\r
-\r
-#define dat_pz_query(pz,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(pz)->pz_query_func)(\\r
- (pz),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_pz_free(pz) \\r
- (*DAT_HANDLE_TO_PROVIDER(pz)->pz_free_func)(\\r
- (pz))\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _DAT_REDIRECTION_H_ */\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_registry.h\r
- *\r
- * PURPOSE: DAT registration API signatures\r
- *\r
- * Description: Contains registration external reference signatures for\r
- * dat registry functions. This file is *only* included by\r
- * providers, not consumers.\r
- *\r
- * Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
-\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- * \r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_REGISTRY_H_\r
-#define _DAT_REGISTRY_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-/* \r
- * dat registration API.\r
- *\r
- * Technically the dat_ia_open is part of the registration API. This\r
- * is so the registration module can map the device name to a provider\r
- * structure and then call the provider dat_ia_open function.\r
- * dat_is_close is also part of the registration API so that the\r
- * registration code can be aware when an ia is no longer in use.\r
- *\r
- * \r
- */\r
-\r
-DAT_EXPORT DAT_RETURN DAT_API dat_registry_add_provider( \r
- IN DAT_PROVIDER*, /* provider */ \r
- IN const DAT_PROVIDER_INFO* ); /* provider info */\r
-\r
-DAT_EXPORT DAT_RETURN DAT_API dat_registry_remove_provider(\r
- IN DAT_PROVIDER*, /* provider */\r
- IN const DAT_PROVIDER_INFO* ); /* provider info */\r
-\r
-/* \r
- * Provider initialization APIs. \r
- * \r
- * Providers that support being automatically loaded by the Registry must \r
- * implement these APIs and export them as public symbols. \r
- */ \r
-\r
-#define DAT_PROVIDER_INIT_FUNC_NAME dat_provider_init\r
-#define DAT_PROVIDER_FINI_FUNC_NAME dat_provider_fini\r
-\r
-#define DAT_PROVIDER_INIT_FUNC_STR "dat_provider_init"\r
-#define DAT_PROVIDER_FINI_FUNC_STR "dat_provider_fini"\r
-\r
-typedef void (DAT_API *DAT_PROVIDER_INIT_FUNC)( \r
- IN const DAT_PROVIDER_INFO *, \r
- IN const char *); /* instance data */ \r
-\r
-typedef void (DAT_API *DAT_PROVIDER_FINI_FUNC) ( \r
- IN const DAT_PROVIDER_INFO *);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _DAT_REGISTRY_H_ */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
- \r
-/**********************************************************************\r
- * \r
- * HEADER: dat_vendor_specific.h\r
- *\r
- * PURPOSE: \r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_VENDOR_SPECIFIC_H_\r
-#define _DAT_VENDOR_SPECIFIC_H_\r
-\r
-\r
-/* General Interface Adapter attributes. These apply to both udat and kdat. */\r
-\r
-/* To support backwards compatibility for DAPL-1.0 */ \r
-#define max_rdma_read_per_ep max_rdma_read_per_ep_in \r
-#define DAT_IA_FIELD_IA_MAX_DTO_PER_OP DAT_IA_FIELD_IA_ MAX_DTO_PER_EP_IN\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-#if defined(__ia64__) || defined(_M_IA64) \r
-#define _ALIGN8 __declspec(align(8))\r
-#else\r
-#define _ALIGN8\r
-#endif\r
-\r
-typedef _ALIGN8 struct dat_ia_attr\r
- {\r
- char adapter_name[DAT_NAME_MAX_LENGTH];\r
- char vendor_name[DAT_NAME_MAX_LENGTH];\r
- DAT_UINT32 hardware_version_major;\r
- DAT_UINT32 hardware_version_minor;\r
- DAT_UINT32 firmware_version_major; \r
- DAT_UINT32 firmware_version_minor;\r
- DAT_IA_ADDRESS_PTR ia_address_ptr;\r
- DAT_COUNT max_eps;\r
- DAT_COUNT max_dto_per_ep;\r
- DAT_COUNT max_rdma_read_per_ep_in;\r
- DAT_COUNT max_rdma_read_per_ep_out;\r
- DAT_COUNT max_evds;\r
- DAT_COUNT max_evd_qlen;\r
- DAT_COUNT max_iov_segments_per_dto;\r
- DAT_COUNT max_lmrs;\r
- DAT_VLEN max_lmr_block_size;\r
- DAT_VADDR max_lmr_virtual_address; \r
- DAT_COUNT max_pzs;\r
- DAT_VLEN max_mtu_size;\r
- DAT_VLEN max_rdma_size;\r
- DAT_COUNT max_rmrs;\r
- DAT_VADDR max_rmr_target_address;\r
- DAT_COUNT num_transport_attr;\r
- DAT_NAMED_ATTR *transport_attr;\r
- DAT_COUNT num_vendor_attr;\r
- DAT_NAMED_ATTR *vendor_attr;\r
- } DAT_IA_ATTR;\r
-\r
-typedef enum dat_ia_attr_mask\r
- {\r
- DAT_IA_FIELD_IA_ADAPTER_NAME = 0x000001,\r
- DAT_IA_FIELD_IA_VENDOR_NAME = 0x000002,\r
- DAT_IA_FIELD_IA_HARDWARE_MAJOR_VERSION = 0x000004,\r
- DAT_IA_FIELD_IA_HARDWARE_MINOR_VERSION = 0x000008,\r
- DAT_IA_FIELD_IA_FIRMWARE_MAJOR_VERSION = 0x000010, \r
- DAT_IA_FIELD_IA_FIRMWARE_MINOR_VERSION = 0x000020, \r
- DAT_IA_FIELD_IA_ADDRESS_PTR = 0x000040,\r
- DAT_IA_FIELD_IA_MAX_EPS = 0x000080,\r
- DAT_IA_FIELD_IA_MAX_DTO_PER_EP = 0x000100,\r
- DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_IN = 0x000200,\r
- DAT_IA_FIELD_IA_MAX_RDMA_READ_PER_EP_OUT = 0x000400,\r
- DAT_IA_FIELD_IA_MAX_EVDS = 0x000800,\r
- DAT_IA_FIELD_IA_MAX_EVD_QLEN = 0x001000,\r
- DAT_IA_FIELD_IA_MAX_IOV_SEGMENTS_PER_DTO = 0x002000,\r
- DAT_IA_FIELD_IA_MAX_LMRS = 0x004000,\r
- DAT_IA_FIELD_IA_MAX_LMR_BLOCK_SIZE = 0x008000,\r
- DAT_IA_FIELD_IA_MAX_LMR_VIRTUAL_ADDRESS = 0x010000,\r
- DAT_IA_FIELD_IA_MAX_PZS = 0x020000,\r
- DAT_IA_FIELD_IA_MAX_MTU_SIZE = 0x040000,\r
- DAT_IA_FIELD_IA_MAX_RDMA_SIZE = 0x080000,\r
- DAT_IA_FIELD_IA_MAX_RMRS = 0x100000,\r
- DAT_IA_FIELD_IA_MAX_RMR_TARGET_ADDRESS = 0x200000,\r
- DAT_IA_FIELD_IA_NUM_TRANSPORT_ATTR = 0x400000,\r
- DAT_IA_FIELD_IA_TRANSPORT_ATTR = 0x800000,\r
- DAT_IA_FIELD_IA_NUM_VENDOR_ATTR = 0x1000000,\r
- DAT_IA_FIELD_IA_VENDOR_ATTR = 0x2000000,\r
- \r
- DAT_IA_ALL = 0x3FFFFFF\r
- } DAT_IA_ATTR_MASK;\r
-\r
-\r
-/* Vendor Specific extensions */\r
-\r
-#if defined(_JNI)\r
-\r
-#elif defined(_INTEL)\r
-\r
-#elif defined(_INFINISWITCH)\r
-\r
-#elif defined(_MELLANOX)\r
-\r
-#elif defined(_INFINICON)\r
-\r
-#elif defined(_TOPSPIN)\r
-\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _VENDOR_SPECIFIC_H_ */\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: kdat.h\r
- *\r
- * PURPOSE: defines the KDAT API\r
- *\r
- * Description: \r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- * \r
- **********************************************************************/\r
-\r
-#ifndef _KDAT_H_\r
-#define _KDAT_H_\r
-\r
-#include <dat/dat_platform_specific.h>\r
-\r
-typedef enum dat_mem_type\r
- {\r
- /* Shared between udat and kdat */\r
- DAT_MEM_TYPE_VIRTUAL = 0x00,\r
- DAT_MEM_TYPE_LMR = 0x01,\r
- /* kdat specific */\r
- DAT_MEM_TYPE_PHYSICAL = 0x10,\r
- DAT_MEM_TYPE_PLATFORM = 0x20,\r
- DAT_MEM_TYPE_IA = 0x40,\r
- DAT_MEM_TYPE_BYPASS = 0x80\r
- } DAT_MEM_TYPE;\r
-\r
-/* dat handle types */\r
-typedef enum dat_handle_type\r
- {\r
- DAT_HANDLE_TYPE_CR,\r
- DAT_HANDLE_TYPE_EP,\r
- DAT_HANDLE_TYPE_EVD,\r
- DAT_HANDLE_TYPE_IA,\r
- DAT_HANDLE_TYPE_LMR,\r
- DAT_HANDLE_TYPE_PSP,\r
- DAT_HANDLE_TYPE_PZ,\r
- DAT_HANDLE_TYPE_RMR,\r
- DAT_HANDLE_TYPE_RSP\r
- } DAT_HANDLE_TYPE;\r
-\r
-typedef enum dat_evd_param_mask\r
- {\r
- DAT_EVD_FIELD_IA_HANDLE = 0x01,\r
- DAT_EVD_FIELD_EVD_QLEN = 0x02,\r
- DAT_EVD_FIELD_UPCALL_POLICY = 0x04,\r
- DAT_EVD_FIELD_UPCALL = 0x08,\r
- DAT_EVD_FIELD_EVD_FLAGS = 0x10,\r
-\r
- DAT_EVD_FIELD_ALL = 0x1F\r
-\r
- } DAT_EVD_PARAM_MASK;\r
-\r
-\r
-#include <dat/udat_config.h>\r
-\r
-#include <dat/dat.h>\r
-\r
-/* Upcall support */\r
-\r
-typedef enum dat_upcall_policy\r
- {\r
- DAT_UPCALL_DISABLE = 0, /* support no_upcalls */\r
- DAT_UPCALL_SINGLE_INSTANCE = 1, /* support only one upcall */\r
- DAT_UPCALL_MANY = 100 /* support multiple upcalls */\r
- } DAT_UPCALL_POLICY;\r
-\r
-typedef void (*DAT_UPCALL_FUNC)(\r
- DAT_PVOID, /* instance_data */\r
- const DAT_EVENT *, /* event */\r
- DAT_BOOLEAN); /* more_events */\r
-\r
-typedef struct dat_upcall_object\r
- {\r
- DAT_PVOID instance_data;\r
- DAT_UPCALL_FUNC upcall_func;\r
- } DAT_UPCALL_OBJECT;\r
-\r
-/* Define NULL upcall */\r
-\r
-#define DAT_UPCALL_NULL(DAT_UPCALL_OBJECT) \\r
- {(DAT_PVOID) NULL, \\r
- (DAT_UPCALL_FUNC) NULL}\r
-\r
-typedef struct dat_evd_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_COUNT evd_qlen;\r
- DAT_UPCALL_POLICY upcall_policy;\r
- DAT_UPCALL_OBJECT upcall;\r
- DAT_EVD_FLAGS evd_flags;\r
- } DAT_EVD_PARAM;\r
-\r
-#include <dat/kdat_vendor_specific.h>\r
-\r
-/*\r
- * Memory types\r
- *\r
- * Specifing memory type for LMR create. A consumer must use a single\r
- * value when registering memory. The union of any of these\r
- * flags is used in the provider parameter to indicate what memory\r
- * type provider supports for LMR memory creation.\r
- */\r
-\r
-/* memory data types */\r
-\r
-typedef enum dat_mem_optimize_flags\r
- {\r
- DAT_MEM_OPTIMIZE_DONT_CARE = 0x00,\r
- DAT_MEM_OPTIMIZE_IA = 0x01,\r
- DAT_MEM_OPTIMIZE_MIN_EXPOSURE = 0x02,\r
- DAT_MEM_OPTIMIZE_EXACT_EXPOSURE = 0x04\r
- } DAT_MEM_OPTIMIZE_FLAGS;\r
-\r
-\r
-typedef union dat_region_description\r
- {\r
- DAT_PVOID for_va;\r
- DAT_LMR_HANDLE for_lmr_handle; \r
- void * for_pointer; /* For kdapl only */\r
- void * for_array; /* For kdapl only */\r
- } DAT_REGION_DESCRIPTION;\r
-\r
-typedef struct dat_lmr_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_MEM_TYPE mem_type;\r
- DAT_REGION_DESCRIPTION region_desc;\r
- DAT_VLEN length;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_MEM_PRIV_FLAGS mem_priv;\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_VLEN registered_size;\r
- DAT_VADDR registered_address;\r
- } DAT_LMR_PARAM;\r
-\r
-\r
-/****************************************************************************/\r
-\r
-/*\r
- * Kernel DAT function call definitions,\r
- */\r
-\r
-typedef DAT_RETURN (*DAT_LMR_KCREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_MEM_TYPE, /* mem_type */\r
- IN DAT_REGION_DESCRIPTION, /* region_description */\r
- IN DAT_VLEN, /* length */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_MEM_PRIV_FLAGS, /* privileges */\r
- IN DAT_MEM_OPTIMIZE_FLAGS, /* mem_optimization */\r
- OUT DAT_LMR_HANDLE *, /* lmr_handle */\r
- OUT DAT_LMR_CONTEXT *, /* lmr_context */\r
- OUT DAT_VLEN *, /* registered_length */\r
- OUT DAT_VADDR * ); /* registered_address */\r
-\r
-\r
-typedef DAT_RETURN (*DAT_IA_MEMTYPE_HINT_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_MEM_TYPE, /* mem_type */\r
- IN DAT_VLEN, /* length */\r
- IN DAT_MEM_OPTIMIZE_FLAGS, /* mem_optimization */\r
- OUT DAT_VLEN *, /* preferred_length */\r
- OUT DAT_VADDR * ); /* preferred_alignment */\r
-\r
-typedef DAT_RETURN (*DAT_EVD_KCREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_COUNT, /* evd_min_qlen */\r
- IN DAT_UPCALL_POLICY, /* upcall_policy */\r
- IN DAT_UPCALL_OBJECT, /* upcall */\r
- IN DAT_EVD_FLAGS, /* evd_flags */\r
- OUT DAT_EVD_HANDLE * ); /* evd_handle */\r
-\r
-typedef DAT_RETURN (*DAT_EVD_MODIFY_UPCALL_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_UPCALL_POLICY, /* upcall_policy */\r
- IN DAT_UPCALL_OBJECT ); /* upcall */\r
-\r
-/* The following two DAT function calls are also found in udat.h.\r
- * They were removed from dat.h to remove dependancy issues with \r
- * dat.h file. There may be a better way to fix the dependancy\r
- * \r
- */\r
-\r
-typedef DAT_RETURN (*DAT_IA_QUERY_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia handle */\r
- OUT DAT_EVD_HANDLE *, /* async_evd_handle */\r
- IN DAT_IA_ATTR_MASK, /* ia_attr_mask */\r
- OUT DAT_IA_ATTR *, /* ia_attr */\r
- IN DAT_PROVIDER_ATTR_MASK, /* provider_attr_mask */\r
- OUT DAT_PROVIDER_ATTR * ); /* provider_attr */\r
-\r
-typedef DAT_RETURN (*DAT_EVD_QUERY_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_EVD_PARAM_MASK, /* evd_param_mask */\r
- OUT DAT_EVD_PARAM * ); /* evd_param */\r
-\r
-typedef DAT_RETURN (*DAT_LMR_QUERY_FUNC)(\r
- IN DAT_LMR_HANDLE,\r
- IN DAT_LMR_PARAM_MASK,\r
- OUT DAT_LMR_PARAM *);\r
-\r
-#include <dat/kdat_redirection.h>\r
-\r
-#endif /* _KDAT_H_ */\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: kdat_config.h\r
- *\r
- * PURPOSE: defines the common DAT API for uDAPL and kDAPL.\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _KDAT_CONFIG_H_\r
-#define _UDAT_CONFIG_H_\r
-\r
-#define DAT_VERSION_MAJOR 1 \r
-#define DAT_VERSION_MINOR 1 \r
-\r
-\r
-/*\r
- * The official header files will default DAT_THREADSAFE to DAT_TRUE. If\r
- * your project does not wish to use this default, you must ensure that\r
- * DAT_THREADSAFE will be set to DAT_FALSE. This may be done by an\r
- * explicit #define in a common project header file that is included\r
- * before any DAT header files, or through command line directives to the\r
- * compiler (presumably controlled by the make environment).\r
- */\r
-\r
-/*\r
- * A site, project or platform may consider setting an alternate default\r
- * via their make rules, but are discouraged from doing so by editing\r
- * the official header files.\r
- */\r
-\r
-/*\r
- * The Reference Implementation is not Thread Safe. The Reference\r
- * Implementation has chosen to go with the first method and define it\r
- * explicitly in the header file.\r
- */\r
-\r
-#define DAT_THREADSAFE DAT_FALSE\r
-\r
-#ifndef DAT_THREADSAFE \r
-#define DAT_THREADSAFE DAT_TRUE \r
-#endif /* DAT_THREADSAFE */\r
-\r
-#endif /* _KDAT_CONFIG_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: kdat_redirection.h\r
- *\r
- * PURPOSE: Kernel DAT macro definitions\r
- *\r
- * Description: \r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- * \r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _KDAT_REDIRCTION_H_\r
-#define _KDAT_REDIRCTION_H_\r
-\r
-\r
-\r
-/* ia_memtype_hint macro */\r
-\r
-#define dat_ia_memtype_hint(ia,mem_type,len,mem_opt,pref_len,pref_align) \\r
- (DAT_HANDLE_TO_PROVIDER(ia)->ia_memtype_hint_func)(\\r
- (ia),\\r
- (mem_type),\\r
- (len),\\r
- (mem_opt),\\r
- (pref_len),\\r
- (pref_align))\r
-\r
-/* evd_modify_upcall macro */\r
-\r
-#define dat_evd_modify_upcall(evd,policy,upcall) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_modify_upcall_func)(\\r
- (evd),\\r
- (policy),\\r
- (upcall))\r
-\r
-/* evd_create macro */\r
-\r
-#define dat_evd_kcreate(ia,policy,upcall,qlen,flags,handle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->evd_kcreate_func)(\\r
- (ia),\\r
- (qlen),\\r
- (policy),\\r
- (upcall),\\r
- (flags),\\r
- (handle))\r
-\r
-/* lmr_create macro */\r
-\r
-#define dat_lmr_kcreate(ia,mtype,reg_desc,len,pz,priv,mem_opt,\\r
- lmr,context,reg_len,reg_addr) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->lmr_kcreate_func)(\\r
- (ia),\\r
- (mtype),\\r
- (reg_desc),\\r
- (len),\\r
- (pz),\\r
- (priv),\\r
- (mem_opt),\\r
- (lmr),\\r
- (context),\\r
- (reg_len),\\r
- (reg_addr))\r
-\r
-\r
-#include "dat_redirection.h"\r
-\r
-struct dat_provider\r
- {\r
- const char * device_name;\r
- DAT_PVOID extension;\r
-\r
- DAT_IA_OPEN_FUNC ia_open_func;\r
- DAT_IA_QUERY_FUNC ia_query_func;\r
- DAT_IA_CLOSE_FUNC ia_close_func;\r
- DAT_IA_MEMTYPE_HINT_FUNC ia_memtype_hint_func; /* kdat only */\r
-\r
- DAT_SET_CONSUMER_CONTEXT_FUNC set_consumer_context_func;\r
- DAT_GET_CONSUMER_CONTEXT_FUNC get_consumer_context_func;\r
- DAT_GET_HANDLE_TYPE_FUNC get_handle_type_func;\r
-\r
- DAT_CR_QUERY_FUNC cr_query_func;\r
- DAT_CR_ACCEPT_FUNC cr_accept_func;\r
- DAT_CR_REJECT_FUNC cr_reject_func;\r
-\r
- DAT_EVD_KCREATE_FUNC evd_kcreate_func;\r
- DAT_EVD_QUERY_FUNC evd_query_func;\r
-\r
- DAT_EVD_MODIFY_UPCALL_FUNC evd_modify_upcall_func; /* kdat only */\r
-\r
- DAT_EVD_RESIZE_FUNC evd_resize_func;\r
- DAT_EVD_POST_SE_FUNC evd_post_se_func;\r
- DAT_EVD_DEQUEUE_FUNC evd_dequeue_func;\r
- DAT_EVD_FREE_FUNC evd_free_func;\r
-\r
- DAT_EP_CREATE_FUNC ep_create_func;\r
- DAT_EP_QUERY_FUNC ep_query_func;\r
- DAT_EP_MODIFY_FUNC ep_modify_func;\r
- DAT_EP_CONNECT_FUNC ep_connect_func;\r
- DAT_EP_DUP_CONNECT_FUNC ep_dup_connect_func;\r
- DAT_EP_DISCONNECT_FUNC ep_disconnect_func;\r
- DAT_EP_POST_SEND_FUNC ep_post_send_func;\r
- DAT_EP_POST_RECV_FUNC ep_post_recv_func;\r
- DAT_EP_POST_RDMA_READ_FUNC ep_post_rdma_read_func;\r
- DAT_EP_POST_RDMA_WRITE_FUNC ep_post_rdma_write_func;\r
- DAT_EP_GET_STATUS_FUNC ep_get_status_func;\r
- DAT_EP_FREE_FUNC ep_free_func;\r
-\r
- DAT_LMR_KCREATE_FUNC lmr_kcreate_func;\r
- DAT_LMR_QUERY_FUNC lmr_query_func;\r
- DAT_LMR_FREE_FUNC lmr_free_func;\r
-\r
- DAT_RMR_CREATE_FUNC rmr_create_func;\r
- DAT_RMR_QUERY_FUNC rmr_query_func;\r
- DAT_RMR_BIND_FUNC rmr_bind_func;\r
- DAT_RMR_FREE_FUNC rmr_free_func;\r
-\r
- DAT_PSP_CREATE_FUNC psp_create_func;\r
- DAT_PSP_QUERY_FUNC psp_query_func;\r
- DAT_PSP_FREE_FUNC psp_free_func;\r
-\r
- DAT_RSP_CREATE_FUNC rsp_create_func;\r
- DAT_RSP_QUERY_FUNC rsp_query_func;\r
- DAT_RSP_FREE_FUNC rsp_free_func;\r
-\r
- DAT_PZ_CREATE_FUNC pz_create_func;\r
- DAT_PZ_QUERY_FUNC pz_query_func;\r
- DAT_PZ_FREE_FUNC pz_free_func;\r
- };\r
-\r
-#endif /* _KDAT_REDIRCTION_H_ */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
- \r
-/**********************************************************************\r
- * \r
- * HEADER: kdat_vendor_specific.h\r
- *\r
- * PURPOSE: \r
- *\r
- * Description: \r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _KDAT_VENDOR_SPECIFIC_H_\r
-#define _KDAT_VENDOR_SPECIFIC_H_\r
-\r
-/* General Provider attributes. kdat specific. */\r
-typedef struct dat_provider_attr\r
- {\r
- char provider_name[DAT_NAME_MAX_LENGTH];\r
- DAT_UINT32 provider_version_major;\r
- DAT_UINT32 provider_version_minor;\r
- DAT_UINT32 dapl_version_major;\r
- DAT_UINT32 dapl_version_minor;\r
- DAT_MEM_TYPE lmr_mem_types_supported;\r
- DAT_RMR_BIND_EVD_RESTRICTION_TYPE rmr_bind_evd_restriction;\r
- DAT_IOV_OWNERSHIP iov_ownership_on_return;\r
- DAT_QOS dat_qos_supported;\r
- DAT_COMPLETION_FLAGS completion_flags_supported;\r
- DAT_BOOLEAN is_thread_safe;\r
- DAT_COUNT max_private_data_size;\r
- DAT_BOOLEAN supports_multipath;\r
- DAT_EP_CREATOR_FOR_PSP ep_creator;\r
- DAT_UPCALL_POLICY upcall_policy;\r
- DAT_COUNT num_provider_specific_attr;\r
- DAT_NAMED_ATTR * provider_specific_attr;\r
- } DAT_PROVIDER_ATTR;\r
-\r
-typedef enum dat_provider_attr_mask\r
- {\r
- DAT_PROVIDER_FIELD_PROVIDER_NAME = 0x00001,\r
- DAT_PROVIDER_FIELD_PROVIDER_VERSION_MAJOR = 0x00002,\r
- DAT_PROVIDER_FIELD_PROVIDER_VERSION_MINOR = 0x00004,\r
- DAT_PROVIDER_FIELD_DAPL_VERSION_MAJOR = 0x00008,\r
- DAT_PROVIDER_FIELD_DAPL_VERSION_MINOR = 0x00010,\r
- DAT_PROVIDER_FIELD_LMR_MEM_TYPE_SUPPORTED = 0x00020,\r
- DAT_PROVIDER_FIELD_RMR_BIND_RESTRICTION = 0x00040,\r
- DAT_PROVIDER_FIELD_IOV_OWNERSHIP = 0x00080,\r
- DAT_PROVIDER_FIELD_DAT_QOS_SUPPORTED = 0x00100,\r
- DAT_PROVIDER_FIELD_COMPLETION_FLAGS_SUPPORTED = 0x00200,\r
- DAT_PROVIDER_FIELD_IS_THREAD_SAFE = 0x00400,\r
- DAT_PROVIDER_FIELD_MAX_PRIVATE_DATA_SIZE = 0x00800,\r
- DAT_PROVIDER_FIELD_SUPPORTS_MULTIPATH = 0x01000,\r
- DAT_PROVIDER_FIELD_EP_CREATOR = 0x02000,\r
- DAT_PROVIDER_FIELD_UPCALL_POLICY = 0x04000,\r
- DAT_PROVIDER_FIELD_NUM_PROVIDER_SPECIFIC_ATTR = 0x10000,\r
- DAT_PROVIDER_FIELD_PROVIDER_SPECIFIC_ATTR = 0x20000,\r
-\r
- DAT_PROVIDER_FIELD_ALL = 0x37FFF\r
- } DAT_PROVIDER_ATTR_MASK;\r
-\r
-#include "dat_vendor_specific.h" /* Interface Adaptor attributes */\r
-\r
-/* Vendor specific extensions */\r
-\r
-#if defined(_JNI)\r
-\r
-#elif defined(_INTEL)\r
-\r
-#elif defined(_INFINISWITCH)\r
-\r
-#elif defined(_MELLANOX)\r
-\r
-#elif defined(_INFINICON)\r
-\r
-#elif defined(_TOPSPIN)\r
-\r
-#endif\r
-\r
-#endif /* _KDAT_VENDOR_SPECIFIC_H_ */\r
-\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: udat.h\r
- *\r
- * PURPOSE: defines the user DAT API\r
- *\r
- * Description: Interfaces in this file are completely described in\r
- * the uDAPL 1.1 API\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- * \r
- **********************************************************************/\r
-\r
-#ifndef _UDAT_H_\r
-#define _UDAT_H_\r
-\r
-#include <dat/dat_platform_specific.h>\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-typedef enum dat_mem_type\r
- {\r
- /* Shared between udat and kdat */\r
- DAT_MEM_TYPE_VIRTUAL = 0x00,\r
- DAT_MEM_TYPE_LMR = 0x01,\r
- /* udat specific */\r
- DAT_MEM_TYPE_SHARED_VIRTUAL = 0x02\r
- } DAT_MEM_TYPE;\r
-\r
-/* dat handle types */\r
-typedef enum dat_handle_type\r
- {\r
- DAT_HANDLE_TYPE_CR,\r
- DAT_HANDLE_TYPE_EP,\r
- DAT_HANDLE_TYPE_EVD,\r
- DAT_HANDLE_TYPE_IA,\r
- DAT_HANDLE_TYPE_LMR,\r
- DAT_HANDLE_TYPE_PSP,\r
- DAT_HANDLE_TYPE_PZ,\r
- DAT_HANDLE_TYPE_RMR,\r
- DAT_HANDLE_TYPE_RSP,\r
- DAT_HANDLE_TYPE_CNO\r
- } DAT_HANDLE_TYPE;\r
-\r
-/* \r
- * EVD state consists of 3 orthogonal substates. One for \r
- * enabled/disabled, one for waitable/unwaitable, and one \r
- * for configuration. Within each substates the values are \r
- * mutually exclusive. \r
- */ \r
-typedef enum dat_evd_state \r
- { \r
- DAT_EVD_STATE_ENABLED = 0x01,\r
- DAT_EVD_STATE_DISABLED = 0x02,\r
- DAT_EVD_STATE_WAITABLE = 0x04,\r
- DAT_EVD_STATE_UNWAITABLE = 0x08,\r
- DAT_EVD_STATE_CONFIG_NOTIFY = 0x10,\r
- DAT_EVD_STATE_CONFIG_SOLICITED = 0x20,\r
- DAT_EVD_STATE_CONFIG_THRESHOLD = 0x30\r
- } DAT_EVD_STATE;\r
-\r
-typedef enum dat_evd_param_mask\r
- {\r
- DAT_EVD_FIELD_IA_HANDLE = 0x01,\r
- DAT_EVD_FIELD_EVD_QLEN = 0x02,\r
- DAT_EVD_FIELD_EVD_STATE = 0x04,\r
- DAT_EVD_FIELD_CNO = 0x08,\r
- DAT_EVD_FIELD_EVD_FLAGS = 0x10,\r
-\r
- DAT_EVD_FIELD_ALL = 0x1F\r
- } DAT_EVD_PARAM_MASK;\r
-\r
-#include <dat/udat_config.h>\r
-\r
-#include <dat/dat.h>\r
-\r
-typedef DAT_HANDLE DAT_CNO_HANDLE;\r
-\r
-typedef struct dat_evd_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_COUNT evd_qlen;\r
- DAT_EVD_STATE evd_state;\r
- DAT_CNO_HANDLE cno_handle;\r
- DAT_EVD_FLAGS evd_flags;\r
- } DAT_EVD_PARAM;\r
-\r
-#define DAT_LMR_COOKIE_SIZE 40 /* size of DAT_LMR_COOKIE in bytes */\r
-typedef char (* DAT_LMR_COOKIE)[DAT_LMR_COOKIE_SIZE];\r
-\r
-/* Format for OS wait proxy agent function */\r
-\r
-typedef void (DAT_API *DAT_AGENT_FUNC) \r
- (\r
- DAT_PVOID, /* instance data */\r
- DAT_EVD_HANDLE /* Event Dispatcher*/\r
- );\r
-\r
-/* Definition */\r
-\r
-typedef struct dat_os_wait_proxy_agent \r
- {\r
- DAT_PVOID instance_data;\r
- DAT_AGENT_FUNC proxy_agent_func;\r
- } DAT_OS_WAIT_PROXY_AGENT;\r
-\r
-/* Define NULL Proxy agent */\r
-\r
-#define DAT_OS_WAIT_PROXY_AGENT_NULL \\r
- (DAT_OS_WAIT_PROXY_AGENT) { \\r
- (DAT_PVOID) NULL, \\r
- (DAT_AGENT_FUNC) NULL }\r
-\r
-\r
-/* Flags */\r
-\r
-/* The value specified by the uDAPL Consumer for dat_ia_open to indicate \r
- * that not async EVD should be created for the opening instance of an IA.\r
- * The same IA have been open before that has the only async EVD to \r
- * handle async errors for all open instances of the IA. \r
- */\r
-\r
-#define DAT_EVD_ASYNC_EXISTS (DAT_EVD_HANDLE) 0x1 \r
-\r
-/*\r
- * The value return by the dat_ia_query for the case when there is no\r
- * async EVD for the IA instance. Consumer had specified the value of\r
- * DAT_EVD_ASYNC_EXISTS for the async_evd_handle for dat_ia_open.\r
- */\r
-\r
-#define DAT_EVD_OUT_OF_SCOPE (DAT_EVD_HANDLE) 0x2\r
-\r
-/*\r
- * Memory types\r
- *\r
- * Specifing memory type for LMR create. A consumer must use a single\r
- * value when registering memory. The union of any of these\r
- * flags is used in the provider parameters to indicate what memory\r
- * type provider supports for LMR memory creation.\r
- */\r
-\r
-\r
-\r
-/* For udapl only */\r
-\r
-typedef struct dat_shared_memory\r
- {\r
- DAT_PVOID virtual_address;\r
- DAT_LMR_COOKIE shared_memory_id;\r
- } DAT_SHARED_MEMORY;\r
-\r
-typedef union dat_region_description\r
- {\r
- DAT_PVOID for_va;\r
- DAT_LMR_HANDLE for_lmr_handle; \r
- DAT_SHARED_MEMORY for_shared_memory; /* For udapl only */\r
- } DAT_REGION_DESCRIPTION;\r
-\r
-/* LMR Arguments */\r
-\r
-typedef struct dat_lmr_param\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_MEM_TYPE mem_type;\r
- DAT_REGION_DESCRIPTION region_desc;\r
- DAT_VLEN length;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_MEM_PRIV_FLAGS mem_priv;\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_RMR_CONTEXT rmr_context;\r
- DAT_VLEN registered_size;\r
- DAT_VADDR registered_address;\r
- } DAT_LMR_PARAM;\r
-\r
-\r
-typedef struct dat_cno_param \r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_OS_WAIT_PROXY_AGENT agent;\r
- } DAT_CNO_PARAM;\r
-\r
-typedef enum dat_cno_param_mask\r
- {\r
- DAT_CNO_FIELD_IA_HANDLE = 0x1,\r
- DAT_CNO_FIELD_AGENT = 0x2,\r
-\r
- DAT_CNO_FIELD_ALL = 0x3\r
- } DAT_CNO_PARAM_MASK;\r
-\r
-#include <dat/udat_vendor_specific.h>\r
-\r
-/****************************************************************************/\r
-\r
-/*\r
- * User DAT functions definitions.\r
- */\r
-\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_LMR_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_MEM_TYPE, /* mem_type */\r
- IN DAT_REGION_DESCRIPTION, /* region_description */\r
- IN DAT_VLEN, /* length */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_MEM_PRIV_FLAGS, /* privileges */\r
- OUT DAT_LMR_HANDLE *, /* lmr_handle */\r
- OUT DAT_LMR_CONTEXT *, /* lmr_context */\r
- OUT DAT_RMR_CONTEXT *, /* rmr_context */\r
- OUT DAT_VLEN *, /* registered_length */\r
- OUT DAT_VADDR * ); /* registered_address */\r
-\r
-/* Event Functions */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_COUNT, /* evd_min_qlen */\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_EVD_FLAGS, /* evd_flags */\r
- OUT DAT_EVD_HANDLE * ); /* evd_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_MODIFY_CNO_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_CNO_HANDLE); /* cno_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CNO_CREATE_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT,/* agent */\r
- OUT DAT_CNO_HANDLE *); /* cno_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CNO_MODIFY_AGENT_FUNC)(\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_OS_WAIT_PROXY_AGENT);/* agent */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CNO_QUERY_FUNC)(\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_CNO_PARAM_MASK, /* cno_param_mask */\r
- OUT DAT_CNO_PARAM * ); /* cno_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CNO_FREE_FUNC)(\r
- IN DAT_CNO_HANDLE); /* cno_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_CNO_WAIT_FUNC)(\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- IN DAT_TIMEOUT, /* timeout */\r
- OUT DAT_EVD_HANDLE *); /* evd_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_ENABLE_FUNC)(\r
- IN DAT_EVD_HANDLE); /* evd_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_WAIT_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_TIMEOUT, /* Timeout */\r
- IN DAT_COUNT, /* Threshold */\r
- OUT DAT_EVENT *, /* event */\r
- OUT DAT_COUNT * ); /* N more events */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_DISABLE_FUNC)(\r
- IN DAT_EVD_HANDLE); /* evd_handle */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_SET_UNWAITABLE_FUNC)( \r
- IN DAT_EVD_HANDLE); /* evd_handle */ \r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_CLEAR_UNWAITABLE_FUNC)( \r
- IN DAT_EVD_HANDLE); /* evd_handle */\r
-\r
-/* The following three DAT function calls are also found in kdat.h.\r
- * They were removed from dat.h to remove dependancy issues with \r
- * dat.h file. There may be a better way to fix the dependancy.\r
- */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_IA_QUERY_FUNC)(\r
- IN DAT_IA_HANDLE, /* ia handle */\r
- OUT DAT_EVD_HANDLE *, /* async_evd_handle */\r
- IN DAT_IA_ATTR_MASK, /* ia_attr_mask */\r
- OUT DAT_IA_ATTR *, /* ia_attr */\r
- IN DAT_PROVIDER_ATTR_MASK, /* provider_attr_mask */\r
- OUT DAT_PROVIDER_ATTR * ); /* provider_attr */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_EVD_QUERY_FUNC)(\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_EVD_PARAM_MASK, /* evd_param_mask */\r
- OUT DAT_EVD_PARAM * ); /* evd_param */\r
-\r
-typedef DAT_RETURN (DAT_API *DAT_LMR_QUERY_FUNC)(\r
- IN DAT_LMR_HANDLE,\r
- IN DAT_LMR_PARAM_MASK,\r
- OUT DAT_LMR_PARAM *);\r
-\r
-#include <dat/udat_redirection.h>\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _UDAT_H_ */\r
-\r
-\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: udat_config.h\r
- *\r
- * PURPOSE: defines the common DAT API for uDAPL and kDAPL.\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _UDAT_CONFIG_H_\r
-#define _UDAT_CONFIG_H_\r
-\r
-#define DAT_VERSION_MAJOR 1 \r
-#define DAT_VERSION_MINOR 1 \r
-\r
-/*\r
- * The official header files will default DAT_THREADSAFE to DAT_TRUE. If\r
- * your project does not wish to use this default, you must ensure that\r
- * DAT_THREADSAFE will be set to DAT_FALSE. This may be done by an\r
- * explicit #define in a common project header file that is included\r
- * before any DAT header files, or through command line directives to the\r
- * compiler (presumably controlled by the make environment).\r
- */\r
-\r
-/*\r
- * A site, project or platform may consider setting an alternate default\r
- * via their make rules, but are discouraged from doing so by editing\r
- * the official header files.\r
- */\r
-\r
-/*\r
- * The Reference Implementation is not Thread Safe. The Reference\r
- * Implementation has chosen to go with the first method and define it\r
- * explicitly in the header file.\r
- */\r
-\r
-\r
-#ifndef DAT_THREADSAFE \r
-#define DAT_THREADSAFE DAT_TRUE \r
-#endif /* DAT_THREADSAFE */\r
-\r
-#endif /* _UDAT_CONFIG_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: udat_redirection.h\r
- *\r
- * PURPOSE: User DAT macro definitions\r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- * \r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _UDAT_REDIRECTION_H_\r
-#define _UDAT_REDIRECTION_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-#define dat_lmr_create(ia,mtype,reg_desc,len,pz,priv,\\r
- lmr,lmr_context,rmr_context,reg_len,reg_addr) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->lmr_create_func)(\\r
- (ia),\\r
- (mtype),\\r
- (reg_desc),\\r
- (len),\\r
- (pz),\\r
- (priv),\\r
- (lmr),\\r
- (lmr_context),\\r
- (rmr_context),\\r
- (reg_len),\\r
- (reg_addr))\r
-\r
-#define dat_evd_create(ia,qlen,cno,flags,handle) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->evd_create_func)(\\r
- (ia),\\r
- (qlen),\\r
- (cno),\\r
- (flags),\\r
- (handle))\r
-\r
-#define dat_evd_enable(evd) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_enable_func)(\\r
- (evd))\r
-\r
-#define dat_evd_wait(evd,timeout,threshold,event,nmore) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_wait_func)(\\r
- (evd),\\r
- (timeout),\\r
- (threshold),\\r
- (event),\\r
- (nmore))\r
-\r
-#define dat_evd_disable(evd) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_disable_func)(\\r
- (evd))\r
-\r
-#define dat_evd_set_unwaitable(evd) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_set_unwaitable_func)(\\r
- (evd))\r
-\r
-#define dat_evd_clear_unwaitable(evd) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_clear_unwaitable_func)(\\r
- (evd))\r
-\r
-#define dat_evd_modify_cno(evd,cno) \\r
- (*DAT_HANDLE_TO_PROVIDER(evd)->evd_modify_cno_func)(\\r
- (evd),\\r
- (cno))\r
-\r
-#define dat_cno_create(ia,proxy,cno) \\r
- (*DAT_HANDLE_TO_PROVIDER(ia)->cno_create_func)(\\r
- (ia),\\r
- (proxy),\\r
- (cno))\r
-\r
-#define dat_cno_modify_agent(cno,proxy) \\r
- (*DAT_HANDLE_TO_PROVIDER(cno)->cno_modify_agent_func)(\\r
- (cno),\\r
- (proxy))\r
-\r
-#define dat_cno_query(cno,mask,param) \\r
- (*DAT_HANDLE_TO_PROVIDER(cno)->cno_query_func)(\\r
- (cno),\\r
- (mask),\\r
- (param))\r
-\r
-#define dat_cno_free(cno) \\r
- (*DAT_HANDLE_TO_PROVIDER(cno)->cno_free_func)(\\r
- (cno))\r
-\r
-#define dat_cno_wait(cno,timeout,evd) \\r
- (*DAT_HANDLE_TO_PROVIDER(cno)->cno_wait_func)(\\r
- (cno),\\r
- (timeout),\\r
- (evd))\r
-\r
-#define dat_cr_handoff(cr,qual) \\r
- (*DAT_HANDLE_TO_PROVIDER(cr)->cr_handoff_func)(\\r
- (cr),\\r
- (qual))\r
-\r
-#include <dat/dat_redirection.h>\r
-\r
-struct dat_provider\r
- {\r
- const char * device_name;\r
- DAT_PVOID extension;\r
-\r
- DAT_IA_OPEN_FUNC ia_open_func;\r
- DAT_IA_QUERY_FUNC ia_query_func;\r
- DAT_IA_CLOSE_FUNC ia_close_func;\r
-\r
- DAT_SET_CONSUMER_CONTEXT_FUNC set_consumer_context_func;\r
- DAT_GET_CONSUMER_CONTEXT_FUNC get_consumer_context_func;\r
- DAT_GET_HANDLE_TYPE_FUNC get_handle_type_func;\r
-\r
- DAT_CNO_CREATE_FUNC cno_create_func; /* udat only */\r
- DAT_CNO_MODIFY_AGENT_FUNC cno_modify_agent_func; /* udat only */\r
- DAT_CNO_QUERY_FUNC cno_query_func; /* udat only */\r
- DAT_CNO_FREE_FUNC cno_free_func; /* udat only */\r
- DAT_CNO_WAIT_FUNC cno_wait_func; /* udat only */\r
-\r
- DAT_CR_QUERY_FUNC cr_query_func;\r
- DAT_CR_ACCEPT_FUNC cr_accept_func;\r
- DAT_CR_REJECT_FUNC cr_reject_func;\r
- DAT_CR_HANDOFF_FUNC cr_handoff_func; /* udat only */\r
-\r
- DAT_EVD_CREATE_FUNC evd_create_func;\r
- DAT_EVD_QUERY_FUNC evd_query_func;\r
-\r
- DAT_EVD_MODIFY_CNO_FUNC evd_modify_cno_func; /* udat only */\r
- DAT_EVD_ENABLE_FUNC evd_enable_func; /* udat only */\r
- DAT_EVD_DISABLE_FUNC evd_disable_func; /* udat only */\r
- DAT_EVD_WAIT_FUNC evd_wait_func; /* udat only */\r
-\r
- DAT_EVD_RESIZE_FUNC evd_resize_func;\r
- DAT_EVD_POST_SE_FUNC evd_post_se_func;\r
- DAT_EVD_DEQUEUE_FUNC evd_dequeue_func;\r
- DAT_EVD_FREE_FUNC evd_free_func;\r
-\r
- DAT_EP_CREATE_FUNC ep_create_func;\r
- DAT_EP_QUERY_FUNC ep_query_func;\r
- DAT_EP_MODIFY_FUNC ep_modify_func;\r
- DAT_EP_CONNECT_FUNC ep_connect_func;\r
- DAT_EP_DUP_CONNECT_FUNC ep_dup_connect_func;\r
- DAT_EP_DISCONNECT_FUNC ep_disconnect_func;\r
- DAT_EP_POST_SEND_FUNC ep_post_send_func;\r
- DAT_EP_POST_RECV_FUNC ep_post_recv_func;\r
- DAT_EP_POST_RDMA_READ_FUNC ep_post_rdma_read_func;\r
- DAT_EP_POST_RDMA_WRITE_FUNC ep_post_rdma_write_func;\r
- DAT_EP_GET_STATUS_FUNC ep_get_status_func;\r
- DAT_EP_FREE_FUNC ep_free_func;\r
-\r
- DAT_LMR_CREATE_FUNC lmr_create_func;\r
- DAT_LMR_QUERY_FUNC lmr_query_func;\r
-\r
- DAT_LMR_FREE_FUNC lmr_free_func;\r
-\r
- DAT_RMR_CREATE_FUNC rmr_create_func;\r
- DAT_RMR_QUERY_FUNC rmr_query_func;\r
- DAT_RMR_BIND_FUNC rmr_bind_func;\r
- DAT_RMR_FREE_FUNC rmr_free_func;\r
-\r
- DAT_PSP_CREATE_FUNC psp_create_func;\r
- DAT_PSP_QUERY_FUNC psp_query_func;\r
- DAT_PSP_FREE_FUNC psp_free_func;\r
-\r
- DAT_RSP_CREATE_FUNC rsp_create_func;\r
- DAT_RSP_QUERY_FUNC rsp_query_func;\r
- DAT_RSP_FREE_FUNC rsp_free_func;\r
-\r
- DAT_PZ_CREATE_FUNC pz_create_func;\r
- DAT_PZ_QUERY_FUNC pz_query_func;\r
- DAT_PZ_FREE_FUNC pz_free_func;\r
-\r
- /* udat-1.1 */ \r
- DAT_PSP_CREATE_ANY_FUNC psp_create_any_func;\r
- DAT_EP_RESET_FUNC ep_reset_func;\r
- DAT_EVD_SET_UNWAITABLE_FUNC evd_set_unwaitable_func; \r
- DAT_EVD_CLEAR_UNWAITABLE_FUNC evd_clear_unwaitable_func; \r
-\r
- };\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _UDAT_REDIRECTION_H_ */\r
-\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
- \r
-/**********************************************************************\r
- * \r
- * HEADER: udat_vendor_specific.h\r
- *\r
- * PURPOSE: \r
- *\r
- * Description: Header file for "uDAPL: User Direct Access Programming \r
- * Library, Version: 1.1"\r
- *\r
- * Mapping rules:\r
- * All global symbols are prepended with "DAT_" or "dat_"\r
- * All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'\r
- * The method table is in the provider definition structure.\r
- *\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef _UDAT_VENDOR_SPECIFIC_H_\r
-#define _UDAT_VENDOR_SPECIFIC_H_\r
-\r
-/* General Provider attributes. udat specific. */\r
-#ifdef __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-\r
-typedef enum dat_pz_support \r
- {\r
- DAT_PZ_UNIQUE,\r
- DAT_PZ_SAME,\r
- DAT_PZ_SHAREABLE\r
- } DAT_PZ_SUPPORT;\r
-\r
-/* Provider should support merging of all event stream types. Provider \r
- * attribute specify support for merging different event stream types. \r
- * It is a 2D binary matrix where each row and column represents an event\r
- * stream type. Each binary entry is 1 if the event streams of its raw \r
- * and column can fed the same EVD, and 0 otherwise. The order of event \r
- * streams in row and column is the same as in the definition of \r
- * DAT_EVD_FLAGS: index 0 - Software Event, 1- Connection Request, \r
- * 2 - DTO Completion, 3 - Connection event, 4 - RMR Bind Completion, \r
- * 5 - Asynchronous event. By definition each diagonal entry is 1.\r
- * Consumer allocates an array for it and passes it IN as a pointer \r
- * for the array that Provider fills. Provider must fill the array \r
- * that Consumer passes. \r
- */\r
-\r
-typedef struct dat_provider_attr\r
- {\r
- char provider_name[DAT_NAME_MAX_LENGTH];\r
- DAT_UINT32 provider_version_major;\r
- DAT_UINT32 provider_version_minor;\r
- DAT_UINT32 dapl_version_major;\r
- DAT_UINT32 dapl_version_minor;\r
- DAT_MEM_TYPE lmr_mem_types_supported;\r
- DAT_IOV_OWNERSHIP iov_ownership_on_return;\r
- DAT_QOS dat_qos_supported;\r
- DAT_COMPLETION_FLAGS completion_flags_supported;\r
- DAT_BOOLEAN is_thread_safe;\r
- DAT_COUNT max_private_data_size;\r
- DAT_BOOLEAN supports_multipath;\r
- DAT_EP_CREATOR_FOR_PSP ep_creator;\r
- DAT_UINT32 optimal_buffer_alignment; \r
- DAT_BOOLEAN evd_stream_merging_supported[6][6];\r
- DAT_PZ_SUPPORT pz_support;\r
- DAT_COUNT num_provider_specific_attr;\r
- DAT_NAMED_ATTR * provider_specific_attr;\r
- } DAT_PROVIDER_ATTR;\r
-\r
-typedef enum dat_provider_attr_mask\r
- {\r
- DAT_PROVIDER_FIELD_PROVIDER_NAME = 0x00001,\r
- DAT_PROVIDER_FIELD_PROVIDER_VERSION_MAJOR = 0x00002,\r
- DAT_PROVIDER_FIELD_PROVIDER_VERSION_MINOR = 0x00004,\r
- DAT_PROVIDER_FIELD_DAPL_VERSION_MAJOR = 0x00008,\r
- DAT_PROVIDER_FIELD_DAPL_VERSION_MINOR = 0x00010,\r
- DAT_PROVIDER_FIELD_LMR_MEM_TYPE_SUPPORTED = 0x00020,\r
- DAT_PROVIDER_FIELD_IOV_OWNERSHIP = 0x00040,\r
- DAT_PROVIDER_FIELD_DAT_QOS_SUPPORTED = 0x00080,\r
- DAT_PROVIDER_FIELD_COMPLETION_FLAGS_SUPPORTED = 0x00100,\r
- DAT_PROVIDER_FIELD_IS_THREAD_SAFE = 0x00200,\r
- DAT_PROVIDER_FIELD_MAX_PRIVATE_DATA_SIZE = 0x00400,\r
- DAT_PROVIDER_FIELD_SUPPORTS_MULTIPATH = 0x00800,\r
- DAT_PROVIDER_FIELD_EP_CREATOR = 0x01000,\r
- DAT_PROVIDER_FIELD_PZ_SUPPORT = 0x02000,\r
- DAT_PROVIDER_FIELD_OPTIMAL_BUFFER_ALIGNMENT = 0x04000, \r
- DAT_PROVIDER_FIELD_EVD_STREAM_MERGING_SUPPORTED = 0x08000,\r
- DAT_PROVIDER_FIELD_NUM_PROVIDER_SPECIFIC_ATTR = 0x10000,\r
- DAT_PROVIDER_FIELD_PROVIDER_SPECIFIC_ATTR = 0x20000,\r
-\r
- DAT_PROVIDER_FIELD_ALL = 0x37FFF\r
- } DAT_PROVIDER_ATTR_MASK;\r
-\r
-#include <dat/dat_vendor_specific.h>\r
-\r
-#if defined(_JNI)\r
-\r
-#elif defined(_INTEL)\r
-\r
-#elif defined(_INFINISWITCH)\r
-\r
-#elif defined(_MELLANOX)\r
-\r
-#elif defined(_INFINICON)\r
-\r
-#elif defined(_TOPSPIN)\r
-\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _UDAT_VENDOR_SPECIFIC_H_ */\r
-\r
-\r
-\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#*********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module\r
-#\r
-# $Id$\r
-#*********************************************************************/\r
-UNAME = $(strip $(shell /bin/uname -r))\r
-KERNEL_INCLUDE_DIR = /lib/modules/$(UNAME)/build/include\r
-\r
-TOPDIR = $(shell /bin/pwd)\r
-COMMON = $(TOPDIR)/../common\r
-\r
-SRC_PATH = $(TOPDIR)/\r
-OBJ_PATH = $(TOPDIR)/Obj/\r
-#TARGET_PATH = $(TOPDIR)/Target/$(UNAME)/ \r
-TARGET_PATH = $(TOPDIR)/Target\r
-\r
-TARGET = $(TARGET_PATH)/dat_registry.o \r
-\r
-CC=gcc \r
-\r
-#\r
-# CFLAGS definition\r
-#\r
-CFLAGS = -O $(CPPFLAGS)\r
-CFLAGS += -D__KERNEL__\r
-CFLAGS += -DMODULE\r
-CFLAGS += -I.\r
-CFLAGS += -I..\r
-CFLAGS += -I../include\r
-CFLAGS += -I./linux\r
-CFLAGS += -I../common\r
-CFLAGS += -I$(KERNEL_INCLUDE_DIR)\r
-CFLAGS += -Wall\r
-CFLAGS += -Wstrict-prototypes\r
-# The following two lines will cause warnings to appear on the\r
-# compile time output when including certain kernel .h files\r
-#CFLAGS += -Wmissing-prototypes\r
-#CFLAGS += -Wmissing-declarations\r
-CFLAGS += -Werror \r
-\r
-KDAT_SRCS = dat_kdapl.c \\r
- dat_module.c\r
-\r
-COMMON_SRCS = dat_data.c \\r
- dat_init.c \\r
- dat_register.c\r
-\r
-SRCS = $(KDAT_SRCS) $(COMMON_SRCS)\r
-\r
-KDAT_OBJS = $(KDAT_SRCS:%.c=$(OBJ_PATH)%.o)\r
-COMMON_OBJS = $(COMMON_SRCS:%.c=$(OBJ_PATH)%.o)\r
-\r
-OBJS = $(KDAT_OBJS) $(COMMON_OBJS)\r
-\r
-\r
-all: mkdirs $(TARGET)\r
-\r
-mkdirs:\r
- @[ -d $(TARGET_PATH) ] || /bin/mkdir -p $(TARGET_PATH)\r
- @[ -d $(OBJ_PATH) ] || /bin/mkdir -p $(OBJ_PATH)\r
-\r
-$(KDAT_OBJS): $(OBJ_PATH)%.o : %.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(COMMON_OBJS): $(OBJ_PATH)%.o : $(COMMON)/%.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(TARGET): $(OBJS)\r
- @echo Linking $(TARGET)\r
- $(LD) -r $^ -o $(TARGET) \r
-\r
-clean:\r
- rm -f $(OBJS)\r
- rm -f $(TARGET)\r
-\r
-load: $(TARGET)\r
- @sudo insmod $(TARGET)\r
- @sudo tail -3 /var/log/messages | grep -v sudo\r
-\r
-unload:\r
- @sudo rmmod dat_registry\r
- @sudo tail -3 /var/log/messages | grep -v sudo\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- *\r
- * MODULE: dat_kdapl.c\r
- *\r
- * PURPOSE: kdapl functions required to be part of the DAT registry.\r
- * Description: Interfaces in this file are completely described in\r
- *the kDAPL 1.0 API\r
- *\r
- * $Id$\r
- **********************************************************************/ \r
-\r
-#include "dat_osd.h"\r
-#include <dat/kdat.h>\r
-#include "dat_register.h" \r
-\r
-/***********************************************************************\r
- * Function: dat_ia_open\r
- ***********************************************************************/\r
-DAT_RETURN\r
-dat_ia_open (\r
- IN const DAT_NAME_PTR device_name,\r
- IN DAT_COUNT async_event_qlen,\r
- INOUT DAT_EVD_HANDLE *async_event_handle,\r
- OUT DAT_IA_HANDLE *ia_handle)\r
-{\r
- DAT_RETURN status;\r
- DAT_PROVIDER *provider; \r
-\r
- if (!ia_handle)\r
- {\r
- return DAT_INVALID_HANDLE | DAT_INVALID_HANDLE_IA;\r
- } \r
- *ia_handle = 0; \r
- dat_os_printf ("<1>DAT Registry: dat_ia_open\n"); \r
-\r
- /* make sure the provider is registered */\r
- provider = dat_get_provider(device_name);\r
- if (!provider)\r
- {\r
- status = DAT_NAME_NOT_FOUND;\r
- goto error_exit;\r
- } \r
-\r
- /* call the real provider open function */\r
- status = (*provider->ia_open_func) ( provider,\r
- async_event_qlen,\r
- async_event_handle,\r
- ia_handle); \r
-\r
- error_exit:\r
- return status;\r
-}\r
-\r
-/***********************************************************************\r
- * Function: dat_ia_close\r
- ***********************************************************************/\r
-DAT_RETURN\r
-dat_ia_close (IN DAT_IA_HANDLE ia_handle)\r
-{\r
- DAT_RETURN status;\r
- DAT_PROVIDER *provider; \r
-\r
- provider = DAT_HANDLE_TO_PROVIDER(ia_handle);\r
- status = (*provider->ia_close_func) (ia_handle);\r
-\r
- return status;\r
-}\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_module.c\r
- *\r
- * PURPOSE: DAT registry module implementation, exists in the Linux\r
- * kernel\r
- * Description: a linux module implementation\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dat_osd.h"\r
-#include <dat/kdat.h>\r
-#include "dat_data.h"\r
-\r
-/***********************************************************************\r
- * init_module\r
- *\r
- * Entry point for a Linux module, performs simple initialization\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * SUCCESS\r
- ***********************************************************************/\r
-\r
-int init_module(void)\r
-{\r
- int i;\r
-\r
- dat_os_printf ("<1>DAT Registry: Started\n");\r
-\r
- dat_os_lock_init(&dat_registry_lock);\r
- for (i = 0; i < DAT_MAX_NICS; i++)\r
- {\r
- dat_registry[i] = NULL;\r
- }\r
- return (0); /* success */\r
-}\r
-\r
-/***********************************************************************\r
- * cleanup_module\r
- *\r
- * Entry point for a Linux module, cleans up the module on exit\r
- *\r
- * Input:\r
- * none\r
- *\r
- * Output:\r
- * none\r
- *\r
- * Returns:\r
- * void\r
- ***********************************************************************/\r
-void cleanup_module(void)\r
-{\r
- dat_os_lock_destroy(&dat_registry_lock);\r
- dat_os_printf ("<1>DAT Registry: Stopped\n");\r
- return;\r
-}\r
-\r
-/* Module exports */\r
-\r
-EXPORT_SYMBOL (dat_ia_open);\r
-EXPORT_SYMBOL (dat_ia_close);\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_osd.c\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description: \r
- * Provide OS dependent functions with a canonical DAT\r
- * interface. Designed to be portable and hide OS specific quirks\r
- * of common functions.\r
- * \r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include <linux/module.h>\r
-#include <linux/sched.h>\r
-\r
-#include <dat/dat.h>\r
-#include "dat_osd.h"\r
-\r
-/*\r
- * Internal structures\r
- */\r
-\r
-typedef struct THREAD_INFO {\r
- void (*function)(void *);\r
- void *arg;\r
- int thread_id;\r
- DAT_OS_THREAD_STATE state;\r
- wait_queue_head_t wchan;\r
-} THREAD_INFO;\r
-\r
-\r
-/*\r
- * dat_os_start_thread\r
- *\r
- * Simple internal routine that allows us to catch the thread before\r
- * invoking the user supplied function. Linux threads are activated\r
- * and run, but our semantics allow us to create them in a sleep\r
- * state.\r
- *\r
- * Input:\r
- * arg Thread state structure to pass initial data\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-static int\r
-dat_os_thread_start (void *arg)\r
-{\r
- IN THREAD_INFO *thread_state = (THREAD_INFO *) arg;\r
-\r
- if (thread_state->state == DAT_OS_THREAD_WAIT)\r
- {\r
- /*\r
- * Wait for a wakeup event on our thread_state\r
- * structure. A thread_resume() or a signal will\r
- * wake us up.\r
- */\r
- interruptible_sleep_on (&thread_state->wchan);\r
- }\r
-\r
- /*\r
- * invoke the user specified routine\r
- */\r
- (thread_state->function) (thread_state->arg);\r
-\r
- return (0);\r
-}\r
-\r
-\r
-/*\r
- * dat_os_thread_create\r
- *\r
- * Returns a pointer to an internal thread structure that provides\r
- * the implementation with a measure of control over the threads.\r
- * Much of this is mandated by the desire to start threads in a\r
- * wait queue, then to enable them when the implementation is ready.\r
- *\r
- * There is no upfront checking, invoker is assumed to know what they\r
- * are doing.\r
- *\r
- * Input:\r
- * function Function to invoke thread\r
- * arg Argument to start routine\r
- * state Initial thread state\r
- * DAT_OS_THREAD_RUN Immediate execution\r
- * DAT_OS_THREAD_WAIT new thread will wait\r
- * thread_id User allocated space for thread ID.\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INSUFFICIENT_RESOURCES\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dat_os_thread_create (\r
- IN void (*function) (void *),\r
- IN void *arg,\r
- IN DAT_OS_THREAD_STATE state,\r
- OUT DAT_OS_THREAD *thread_id )\r
-{\r
- int pid;\r
- THREAD_INFO *thread_state;\r
-\r
- /* Get a thread_state structure and fill it in. */\r
- thread_state = kmalloc(sizeof(thread_state), GFP_ATOMIC);\r
- if (thread_state == NULL)\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- thread_state->function = function;\r
- thread_state->arg = arg;\r
- thread_state->state = state;\r
-\r
- /* set up a wait queue for a delayed start */\r
- if ( state == DAT_OS_THREAD_WAIT )\r
- {\r
- init_waitqueue_head (&thread_state->wchan);\r
- }\r
-\r
- if ((pid = kernel_thread (dat_os_thread_start, \r
- thread_state, /* argument */\r
- 0)) < 0) /* clone arguments 0 */\r
- {\r
- /* Error: options are:\r
- * EAGAIN: Need to try again\r
- * else, insufficient resources.\r
- * Just return INSUFFICIENT_RESOURCES for any error\r
- */\r
- kfree(thread_state);\r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
-\r
- thread_state->thread_id = pid;\r
- *thread_id = (DAT_OS_THREAD)thread_state;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dat_os_thread_resume\r
- *\r
- * Set a blocked thread running.\r
- *\r
- * Input:\r
- * thread_id Pointer to thread_state entry\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dat_os_thread_resume (\r
- IN DAT_OS_THREAD thread_id )\r
-{\r
- THREAD_INFO *thread_state = (THREAD_INFO *) thread_id;\r
-\r
- if (thread_state == NULL)\r
- {\r
- return DAT_INVALID_PARAMETER | DAT_INVALID_ARG1;\r
- }\r
-\r
- if (thread_state->state == DAT_OS_THREAD_WAIT)\r
- {\r
- /* Set the thread to running */\r
- thread_state->state = DAT_OS_THREAD_RUN;\r
- wake_up_interruptible (&thread_state->wchan);\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-/*\r
- * dat_os_thread_kill\r
- *\r
- * Set a blocked thread running.\r
- *\r
- * Input:\r
- * thread_id Pointer to thread_state entry\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- * DAT_INVALID_PARAMETER\r
- */\r
-DAT_RETURN\r
-dat_os_thread_destroy (\r
- IN DAT_OS_THREAD thread_id )\r
-{\r
- THREAD_INFO *thread_state = (THREAD_INFO *) thread_id;\r
-\r
- if (thread_state == NULL)\r
- {\r
- return DAT_INVALID_PARAMETER | DAT_INVALID_ARG1;\r
- }\r
-\r
- kill_proc (thread_state->thread_id, SIGTERM, 1);\r
-\r
- kfree(thread_state); /* release thread resources */\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * dat_os_get_time\r
- *\r
- * Return 64 bit value of current time in microseconds.\r
- *\r
- * Input:\r
- * tm User location to place current time\r
- *\r
- * Returns:\r
- * DAT_SUCCESS\r
- */\r
-DAT_RETURN\r
-dat_os_get_time (DAT_OS_TIMEVAL * loc)\r
-{\r
- struct timeval tv;\r
-\r
- do_gettimeofday (&tv);\r
- *loc = ((uint64_t) (tv.tv_sec) * 1000000L) + (uint64_t) tv.tv_usec;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_osd.h\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description:\r
- * Provide OS dependent data structures & functions with\r
- * a canonical DAT interface. Designed to be portable\r
- * and hide OS specific quirks of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_OSD_H_\r
-#define _DAT_OSD_H_\r
-\r
-/*\r
- * This file is defined for Linux systems only, including it on any\r
- * other build will cause an error\r
- */\r
-#ifndef __linux__\r
-#error UNDEFINED OS TYPE\r
-#endif /* __linux__ */\r
-\r
-#ifndef __KERNEL__\r
-#error "Must compile for the kernel"\r
-#endif /* __KERNEL__ */\r
-\r
-\r
-#include <dat/kdat.h>\r
-\r
-\r
-#include <linux/module.h>\r
-#include <linux/errno.h>\r
-#include <linux/slab.h>\r
-#include <asm/types.h>\r
-#include <asm/atomic.h>\r
-\r
-\r
-/*\r
- * Thread package\r
- */\r
-typedef void * DAT_OS_THREAD;\r
-\r
-typedef enum dat_os_thread_state \r
-{\r
- DAT_OS_THREAD_WAIT,\r
- DAT_OS_THREAD_RUN\r
-} DAT_OS_THREAD_STATE;\r
-\r
-\r
-/*\r
- * Lock functions: Simply use spinlocks at this point.\r
- *\r
- * N.B. No lock can be taken in both common code and an upcall,\r
- * which has the possibility of being called in interrupt\r
- * context. If this is a requirement we need to change\r
- * from buzz locks (spinlock) to semaphores.\r
- */\r
-typedef spinlock_t DAT_OS_LOCK;\r
-\r
-\r
-STATIC _INLINE_ void dat_os_lock_init(DAT_OS_LOCK *lock)\r
-{\r
- spin_lock_init( lock );\r
-}\r
-\r
-STATIC _INLINE_ void dat_os_lock_destroy(DAT_OS_LOCK *lock)\r
-{\r
- /* Nothing */;\r
-}\r
- \r
-STATIC _INLINE_ void dat_os_lock(DAT_OS_LOCK *lock)\r
-{\r
- spin_lock(lock); /* down(mutex); */\r
-}\r
-\r
-STATIC _INLINE_ void dat_os_unlock(DAT_OS_LOCK *lock)\r
-{\r
- spin_unlock(lock); /* up(mutex); */\r
-}\r
-\r
-\r
-/*\r
- * Atomic operations\r
- */\r
-typedef atomic_t DAT_OS_ATOMIC;\r
-\r
-STATIC _INLINE_ void dat_os_atomic_add(int i, DAT_OS_ATOMIC * v)\r
-{\r
- atomic_add(i,v);\r
-}\r
-\r
-STATIC _INLINE_ void dat_os_atomic_sub(int i, DAT_OS_ATOMIC * v)\r
-{\r
- atomic_sub(i,v);\r
-}\r
-\r
- \r
-/*\r
- * Memory Functions\r
- */\r
-STATIC _INLINE_ void *dat_os_alloc(int size)\r
-{\r
- return kmalloc(size, GFP_ATOMIC);\r
- /* If too much memory is requested from the Linux SLAB\r
- * allocator, we may need to use vmalloc(sz) instead\r
- */\r
-}\r
-\r
-STATIC _INLINE_ void dat_os_free(void *ptr, int size)\r
-{\r
- kfree(ptr);\r
- /* If too much memory is requested from the Linux SLAB\r
- * allocator, we may need to use vfree(ptr) instead\r
- */\r
-}\r
- \r
-\r
-/*\r
- * memory block functions\r
- */\r
-\r
-STATIC _INLINE_ void * dat_os_memzero(void *loc, int size)\r
-{\r
- return memset(loc,0,size);\r
-}\r
-\r
-STATIC _INLINE_ void * dat_os_memcpy(void *dest, void *src, int len)\r
-{\r
- return memcpy(dest,src,len);\r
-}\r
- \r
-STATIC _INLINE_ int dat_os_memcmp(void *mem1, void *mem2, int len)\r
-{\r
- return memcmp(mem1,mem2,len);\r
-}\r
-\r
-/*\r
- * Timers\r
- */\r
-typedef uint64_t DAT_OS_TIMEVAL;\r
-typedef struct timer_list *DAT_OS_TIMER;\r
-typedef unsigned long DAT_OS_TICKS;\r
-\r
-DAT_RETURN dat_os_get_time (DAT_OS_TIMEVAL *);\r
-\r
-STATIC _INLINE_ DAT_OS_TICKS dat_os_get_ticks(void)\r
-{\r
- return jiffies;\r
-}\r
-\r
-STATIC _INLINE_ int dat_os_ticks_to_seconds(DAT_OS_TICKS ticks)\r
-{\r
- return ticks / HZ;\r
-}\r
-\r
-\r
-/*\r
- * dat_os_set_timer()\r
- *\r
- * Set a timer. The timer will invoke the specified function\r
- * after a number of useconds expires.\r
- *\r
- * Input:\r
- * timer User provided timer structure\r
- * func Function to invoke when timer expires\r
- * data Argument passed to func()\r
- * expires microseconds until timer fires\r
- *\r
- * Returns:\r
- * no return value\r
- * \r
- */\r
-STATIC _INLINE_ void dat_os_set_timer(\r
- DAT_OS_TIMER timer,\r
- void (*func)(unsigned long),\r
- unsigned long data,\r
- DAT_OS_TIMEVAL expires )\r
-{\r
- init_timer(timer);\r
- timer->function = func;\r
- timer->data = data;\r
- /* Change from useconds to jiffies */\r
- expires += 1000000L / HZ - 1;\r
- expires /= 1000000L / HZ;\r
- /* set the timer */\r
- timer->expires = jiffies + (unsigned long)expires;\r
-\r
- add_timer(timer);\r
-}\r
-\r
-\r
-/*\r
- * dat_os_timer_cancel()\r
- *\r
- * Cancel a running timer. The timer will invoke the specified\r
- * function after a number of useconds expires.\r
- *\r
- * Input:\r
- * timer Running timer\r
- *\r
- * Returns:\r
- * no return value\r
- *\r
- */\r
-STATIC _INLINE_ void dat_os_timer_cancel(DAT_OS_TIMER timer)\r
-{\r
- /* del_timer_sync returns number of times timer was deleted;\r
- * just ignore */\r
- (void) del_timer_sync(timer);\r
-}\r
-\r
-\r
-/*\r
- * Thread functions: prototypes\r
- */\r
-DAT_RETURN dat_os_thread_create ( void (*)(void *), void *, \r
- DAT_OS_THREAD_STATE, DAT_OS_THREAD *);\r
-DAT_RETURN dat_os_thread_resume (DAT_OS_THREAD);\r
-DAT_RETURN dat_os_thread_destroy (DAT_OS_THREAD);\r
-\r
-\r
-/*\r
- * Debug helper routines in the Linux kernel\r
- */\r
-#define dat_os_printf printk\r
-#define dat_os_assert assert\r
-#define dat_os_breakpoint breakpoint \r
-\r
-\r
-#endif /* _DAT_OSD_H_ */\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#**********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module for CYGWIN environment\r
-#\r
-#*********************************************************************/\r
-\r
-\r
-##############################################################\r
-# Application variables\r
-#\r
-\r
-CP = cp -p -u\r
-AS = $(CROSS_COMPILE)as\r
-LD = $(CROSS_COMPILE)link.exe\r
-CC = $(CROSS_COMPILE)cl.exe\r
-CPP = $(CC) \r
-AR = $(CROSS_COMPILE)ar\r
-NM = $(CROSS_COMPILE)nm\r
-STRIP = $(CROSS_COMPILE)strip\r
-OBJCOPY = $(CROSS_COMPILE)objcopy\r
-OBJDUMP = $(CROSS_COMPILE)objdump\r
-RANLIB = $(CROSS_COMPILE)ranlib\r
-MKDIR = mkdir -p \r
-SED = /bin/sed\r
-SHELL = /bin/sh\r
-\r
-TOPDIR = .\r
-\r
-COMMON = $(TOPDIR)/../common\r
-WINDOWS = $(TOPDIR)/windows\r
-\r
-OBJ_DIR = $(TOPDIR)/Obj\r
-TARGET_DIR = $(TOPDIR)/Target\r
-\r
-SRCDIRS := \\r
- $(TOPDIR) \\r
- $(COMMON) \\r
- $(WINDOWS) \r
-\r
-INCDIRS := \\r
- $(SRCDIRS) \\r
- $(TOPDIR)/../include\r
-\r
-vpath %.c . ${SRCDIRS}\r
-vpath %.h . ${INCDIRS}\r
-\r
-\r
-##################################################\r
-# targets\r
-TARLIBS = dat\r
-TARSHLIBS = dat\r
-\r
-# data for user libraries\r
-dat_SOURCES = $(COMMON_SRCS) $(UDAT_SRCS) $(WIN_SRCS)\r
-\r
-UDAT_SRCS = dat_udapl.c\r
-\r
-WIN_SRCS = # dat_osd.c\r
-\r
-COMMON_SRCS = dat_data.c \\r
- dat_init.c \\r
- dat_register.c\r
-\r
-\r
-\r
-####################################################\r
-# compiler options CFLAGS\r
-#\r
-\r
-# common flags\r
-UOPTIONS += /nologo /MDd /W3 /GX /Od /FD /GZ /Gm /Zi\r
-\r
-# common defines\r
-UCOMDEFS += /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "_DEBUG" \\r
- -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 \r
-# other options: /FR /Fd\r
-\r
-# private defines\r
-UPRIVDEFS += /D "__WIN__" /D "__MSC__" /D "__i386__"\r
-\r
-CFLAGS += $(UOPTIONS) $(UCOMDEFS) $(UPRIVDEFS) \r
-\r
-###########################################################\r
-# common included libraries\r
-#\r
-ULDLIBS += kernel32 user32 gdi32 winspool \\r
- comdlg32 advapi32 shell32 ole32 oleaut32 \\r
- uuid odbc32 odbccp32 Ws2_32 \r
-\r
-\r
-#########################################################\r
-# link options LDFLAGS\r
-#\r
-\r
-MTARFLAGS= -cr\r
-\r
-TARFLAGS += cr\r
-\r
-# common flags\r
-ULDOPTIONS += /nologo /incremental:no /machine:I386 /debug\r
-\r
-# common directories\r
-ULDDIRS += /LIBPATH:"$(OBJ_DIR)"\r
-\r
-# module entry\r
-ULDENTRY = /noentry\r
-\r
-# specific DLL flags\r
-ifndef NO_DEF_FILE\r
-USE_DEF_FILE = /def:$(WINDOWS)/dat_win.def\r
-endif\r
-\r
-ifndef NO_LIB_FILE\r
-USE_LIB_FILE = $(@:%.dll=/implib:%.lib)\r
-endif\r
-\r
-ifndef NO_PDB_FILE\r
-USE_PDB_FILE = $(@:%.dll=/PDB:%.pdb)\r
-endif\r
-\r
-DLLFLAGS += $(USE_DEF_FILE) $(USE_LIB_FILE) $(USE_PDB_FILE)\r
-\r
-# DLL flags\r
-UDLLFLAGS += /dll $(DLLFLAGS) \r
-\r
-LDFLAGS += $(ULDOPTIONS) $(ULDENTRY) $(ULDDIRS) $(ULDLIBS:%=%.lib) \r
-\r
-# user DLL\r
-LDSHFLAGS += $(LDFLAGS) $(UDLLFLAGS)\r
-\r
-\r
-\r
-#############################################################\r
-# Local functions\r
-#\r
-bsndir = $(notdir $(basename $1))\r
-\r
-############################################################\r
-# Common rules\r
-# \r
-define COMPILE\r
-$(CC) -c $(strip ${CFLAGS}) $(strip $(INCDIRS:%=-I%)) $(EXTRA_CFLAGS) $($(@:${OBJ_DIR}/%.obj=%.c_CFLAGS)) /Fo"$@" $<\r
-endef\r
-\r
-define DEF_SET_VAR_SRCS\r
-@echo "$@_VAR_SRCS += $($(basename $(call bsndir,$@))_SOURCES)" >> $@\r
-endef\r
-\r
-define DEF_SET_VAR_OBJS\r
-@echo "$@_VAR_OBJS += $($(basename $(call bsndir,$@))_OBJECTS)" >> $@\r
-endef\r
-\r
-\r
-\r
-###########################################################################\r
-# Start rules\r
-# \r
-\r
-all: $(TARSHLIBS:%=${TARGET_DIR}/%.dll) $(TAROBJS:%=${OBJ_DIR}/%.obj) $(TARLIBS:%=${TARGET_DIR}/%.lib) \r
-\r
-\r
-##########################################################################\r
-# Simple objects (user) \r
-\r
-$(TAROBJS:%=${OBJ_DIR}/%.obj): ${OBJ_DIR}/%.obj: %.c\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- $(COMPILE)\r
-\r
-$(OBJ_DIR)/%.obj: %.c\r
- $(COMPILE)\r
-\r
-\r
-##########################################################################\r
-# Static libraries \r
-# \r
-$(TARLIBS:%=$(TARGET_DIR)/%.lib): % : %.mk\r
-$(TARLIBS:%=$(TARGET_DIR)/%.lib.mk): Makefile.cygwin\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- @if [ ! -d $(TARGET_DIR) ]; then mkdir -p $(TARGET_DIR); fi\r
- @echo "# Do not edit. Automatically generated file." > $@\r
- @\r
- @${DEF_SET_VAR_OBJS}\r
- @${DEF_SET_VAR_SRCS}\r
- @\r
- @echo "SOURCES += \$$($@_VAR_SRCS)" >> $@\r
- @\r
- @echo "$(@:%.mk=%): \$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) " >> $@\r
- @echo "$(@:%.mk=%): \$$($@_VAR_OBJS:%.c=$(OBJ_DIR)/%.obj) " >> $@\r
- @echo -e "\t\$$(AR) \$$(MTARFLAGS) \$$@ \c" >> $@\r
- @echo -e "\$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) \c" >> $@\r
- @echo "\$$($@_VAR_OBJS) \$$(\$$(@:$(OBJ_DIR)/%.lib=%)_ARFLAGS) " >> $@\r
- @echo -e "\t\$$(RANLIB) \$$@" >> $@\r
-\r
-\r
-ifneq ($(MAKECMDGOALS), clean)\r
-ifneq ($(strip $(TARLIBS)),)\r
--include $(patsubst %,$(OBJ_DIR)/%.lib.mk,$(TARLIBS))\r
-endif\r
-endif\r
-\r
-\r
-##########################################################################\r
-# Shared libraries \r
-# \r
-$(TARSHLIBS:%=$(TARGET_DIR)/%.dll): % : %.mk\r
-$(TARSHLIBS:%=$(TARGET_DIR)/%.dll.mk): Makefile.cygwin\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- @if [ ! -d $(TARGET_DIR) ]; then mkdir -p $(TARGET_DIR); fi\r
- @echo "# Do not edit. Automatically generated file." > $@\r
- @\r
- @${DEF_SET_VAR_OBJS}\r
- @${DEF_SET_VAR_SRCS}\r
- @\r
- @echo "SOURCES += \$$($@_VAR_SRCS)" >> $@\r
- @\r
- @echo "$(@:%.mk=%): \$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo "$(@:%.mk=%): \$$($@_VAR_OBJS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo -e "\t\$$(LD) \$$(LDSHFLAGS) /out:\"\$$@\" \c" >> $@ \r
- @echo -e "\$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) \c" >> $@\r
- @echo -e "\$$($@_VAR_OBJS) \c" >> $@\r
- @echo -e "\$$(LDSHLIBS:%=%) \$$(LIBSHDIRS:%=/LIBPATH:%) \c" >> $@\r
-\r
-\r
-ifneq ($(MAKECMDGOALS), clean)\r
-ifneq ($(strip $(TARSHLIBS)),)\r
--include $(patsubst %,$(TARGET_DIR)/%.dll.mk,$(TARSHLIBS))\r
-endif\r
-endif\r
-\r
-\r
-##########################################################################\r
-# Clean rules \r
-# \r
-CLEANDIRS = $(OBJ_DIR) $(TARGET_DIR)\r
-\r
-CLEANFILES = *.obj *.dll *.lib *.sys *.pdb *.idb *.exp *.ilk *.sbr *.mk\r
-\r
-clean: $(CLEANDIRS)\r
- @echo deleting dump files at $(shell pwd)\r
- @rm -f $(CLEANFILES) \r
- @if [ -d $(OBJ_DIR) ] ; then rm -f $(CLEANFILES:%=$(OBJ_DIR)/%); fi\r
- @if [ -d $(TARGET_DIR) ] ; then rm -f $(CLEANFILES:%=$(TARGET_DIR)/%); fi\r
-\r
+++ /dev/null
-\r
- #\r
- # Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- #\r
- # This Software is licensed under either one of the following two licenses:\r
- #\r
- # 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- # in the file LICENSE.txt in the root directory. The license is also\r
- # available from the Open Source Initiative, see\r
- # http://www.opensource.org/licenses/cpl.php.\r
- # OR\r
- #\r
- # 2) under the terms of the "The BSD License" a copy of which is in the file\r
- # LICENSE2.txt in the root directory. The license is also available from\r
- # the Open Source Initiative, see\r
- # http://www.opensource.org/licenses/bsd-license.php.\r
- #\r
- # Licensee has the right to choose either one of the above two licenses.\r
- #\r
- # Redistributions of source code must retain both the above copyright\r
- # notice and either one of the license notices.\r
- #\r
- # Redistributions in binary form must reproduce both the above copyright\r
- # notice, either one of the license notices in the documentation\r
- # and/or other materials provided with the distribution.\r
- #\r
-\r
-#*********************************************************************\r
-# \r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module\r
-#\r
-#*********************************************************************/\r
-\r
-IBA_HOME = ../../..\r
-\r
-UDAT_ROOT = $(shell /bin/pwd)\r
-UDAT_LINUX = $(UDAT_ROOT)/linux\r
-UDAT_COMMON = $(UDAT_ROOT)/../common\r
-\r
-DAT_HEADERS = $(UDAT_ROOT)/../include\r
-DAT_HEADERS_SYSTEM_PATH = /usr/include/dat\r
-\r
-VPATH = $(UDAT_ROOT) $(UDAT_LINUX) $(UDAT_COMMON)\r
-\r
-SO_TARGET = libdat.so.0.0\r
-SO_NAME = libdat.so\r
-L_TARGET := libdat.a\r
-\r
-DAT_OBJS = udat.o \\r
- dat_osd.o \\r
- dat_dictionary.o \\r
- dat_dr.o \\r
- dat_init.o \\r
- dat_sr.o \\r
- udat_sr_parser.o \\r
- dat_strerror.o\r
-\r
-S_OBJS = $(DAT_OBJS)\r
-L_OBJS = $(S_OBJS)\r
-\r
-EXTRA_CFLAGS = -O $(CPPFLAGS)\r
-EXTRA_CFLAGS += -g\r
-EXTRA_CFLAGS += -I. \r
-EXTRA_CFLAGS += -I.. \r
-EXTRA_CFLAGS += -I../.. \r
-EXTRA_CFLAGS += -I../common \r
-EXTRA_CFLAGS += -I./linux \r
-EXTRA_CFLAGS += -I$(DAT_HEADERS)\r
-EXTRA_CFLAGS += -Wall\r
-EXTRA_CFLAGS += -Wstrict-prototypes\r
-EXTRA_CFLAGS += -Wmissing-prototypes\r
-EXTRA_CFLAGS += -Wmissing-declarations\r
-EXTRA_CFLAGS += -Werror\r
-ifdef GPROF\r
-EXTRA_CFLAGS += -pg\r
-endif\r
-\r
-EXTRA_LDFLAGS = -init dat_init\r
-EXTRA_LDFLAGS += -fini dat_fini\r
-EXTRA_LDFLAGS += -ldl\r
-EXTRA_LDFLAGS += -lpthread\r
-\r
-include $(IBA_HOME)/Makefile.config\r
-include $(IBA_HOME)/Makefile.rules\r
+++ /dev/null
-#\r
-# Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
-# \r
-# This Software is licensed under the terms of the "IBM Common Public\r
-# License 1.0" a copy of which is in the file LICENSE.txt in the\r
-# root directory. The license is also available from the Open Source\r
-# Initiative, see http://www.opensource.org/licenses/ibmpl.html.\r
-#\r
-#\r
-\r
-#*********************************************************************\r
-# \r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module\r
-#\r
-# $Id$\r
-#*********************************************************************/\r
-\r
-UDAT_ROOT = $(shell /bin/pwd)\r
-UDAT_LINUX = $(UDAT_ROOT)/linux\r
-UDAT_COMMON = $(UDAT_ROOT)/../common\r
-\r
-VPATH = $(UDAT_ROOT) $(UDAT_LINUX) $(UDAT_COMMON)\r
-\r
-OBJ_PATH = $(UDAT_ROOT)/Obj\r
-TARGET_PATH = $(UDAT_ROOT)/Target\r
-\r
-STATIC = $(TARGET_PATH)/libdat.a\r
-DYNAMIC = $(TARGET_PATH)/libdat.so\r
-\r
-OBJS = $(OBJ_PATH)/udat.o \\r
- $(OBJ_PATH)/dat_osd.o \\r
- $(OBJ_PATH)/dat_osd_sr.o \\r
- $(OBJ_PATH)/dat_dictionary.o \\r
- $(OBJ_PATH)/dat_dr.o \\r
- $(OBJ_PATH)/dat_init.o \\r
- $(OBJ_PATH)/dat_sr.o \r
-\r
-#\r
-# CC definitions\r
-#\r
-\r
-CC = gcc\r
-\r
-CFLAGS = -O $(CPPFLAGS)\r
-CFLAGS += -g\r
-CFLAGS += -I. \r
-CFLAGS += -I.. \r
-CFLAGS += -I../.. \r
-CFLAGS += -I../include \r
-CFLAGS += -I./linux \r
-CFLAGS += -I../common \r
-CFLAGS += -Wall\r
-CFLAGS += -Wstrict-prototypes\r
-CFLAGS += -Wmissing-prototypes\r
-CFLAGS += -Wmissing-declarations\r
-CFLAGS += -Werror\r
-ifdef GPROF\r
-CFLAGS += -pg\r
-endif\r
-\r
-#\r
-# LD definitions\r
-#\r
-\r
-LD = ld\r
-\r
-LDFLAGS = -shared\r
-LDFLAGS += -ldl\r
-LDFLAGS += -init dat_init\r
-LDFLAGS += -fini dat_fini\r
-\r
-\r
-#\r
-# AR definitions\r
-#\r
-\r
-AR = ar\r
-\r
-ARFLAGS = r\r
-\r
-\r
-#\r
-# Rules\r
-#\r
-\r
-all: mkdirs $(DYNAMIC) $(STATIC)\r
-\r
-mkdirs:\r
- @[ -d $(TARGET_PATH) ] || /bin/mkdir -p $(TARGET_PATH)\r
- @[ -d $(OBJ_PATH) ] || /bin/mkdir -p $(OBJ_PATH)\r
-\r
-$(OBJ_PATH)/%.o : %.c\r
- @echo Compiling $<\r
- $(CC) $(CFLAGS) -c $< -o $@\r
-\r
-$(DYNAMIC): $(OBJS)\r
- @echo Linking $(DYNAMIC)\r
- $(LD) $(LDFLAGS) $^ -o $(DYNAMIC)\r
-\r
-$(STATIC): $(OBJS)\r
- @echo Archiving $(STATIC)\r
- $(AR) $(ARFLAGS) $(STATIC) $^\r
-\r
-clean: \r
- rm -f $(OBJ_PATH)/*.o\r
- rm -f $(DYNAMIC) \r
- rm -f $(STATIC)\r
-\r
-tidy:\r
- rm -f $(UDAT_ROOT)/*~\r
- rm -f $(UDAT_LINUX)/*~\r
- rm -f $(UDAT_COMMON)/*~\r
+++ /dev/null
-!if $(FREEBUILD)\r
-TARGETNAME=dat\r
-!else\r
-TARGETNAME=datd\r
-!endif\r
-TARGETPATH=..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
-TARGETTYPE=DYNLINK\r
-DLLENTRY=_DllMainCRTStartup\r
-!if $(_NT_TOOLS_VERSION) == 0x700\r
-# DDK\r
-DLLDEF=$O\udat_exports.def\r
-!else\r
-# WDK\r
-DLLDEF=$(OBJ_PATH)\$O\udat_exports.def\r
-!endif\r
-USE_MSVCRT=1\r
-\r
-SOURCES=udat.rc \\r
- udat.c \\r
- udat_sr_parser.c \\r
- udat_sources.c\r
-\r
-INCLUDES=windows;..\common;..\include;\r
-RCOPTIONS=/I..\..\..\..\inc;\r
-\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DEXPORT_DAT_SYMBOLS\r
-\r
-TARGETLIBS= \\r
- $(SDK_LIB_PATH)\kernel32.lib\r
-\r
-MSC_WARNING_LEVEL= /W3\r
+++ /dev/null
-# DAT configuration file\r
-#####################################\r
-\r
-HcaPort1 u1.1 threadsafe default dapl.dll ri.1.1 "IbalHca0 1" " "\r
-HcaPort2 u1.1 threadsafe default dapl.dll ri.1.1 "IbalHca0 2" " "\r
-# HcaPort1d u1.1 threadsafe default dapld.dll ri.1.1 "IbalHca0 1" " "\r
-# HcaPort2d u1.1 threadsafe default dapld.dll ri.1.1 "IbalHca0 2" " "\r
+++ /dev/null
-# DAPL IB hosts GID configuration \r
-#hostname Network Port GUID\r
-#-------- ------------------ ------------------\r
-#endrin_ib0 0xfe80000000000000 0x00066a00a0000405\r
-#rockaway_ib0 0xfe80000000000000 0x00066a00a0000117\r
-#gack_ib0 0xfe80000000000000 0x00066a00a00001f2\r
-#gack_ib1 0xfe80000000000000 0x00066a01a00001f2\r
+++ /dev/null
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-#\r
-# DAT Registry RPM SPEC file\r
-#\r
-\r
-%define make_dir udat\r
-\r
-#\r
-# Preamble\r
-#\r
-\r
-Summary: DAT Registry\r
-Name: dat\r
-Version: 1.1\r
-Release: 0 \r
-Vendor: Dat Collaborative\r
-Exclusiveos: Linux\r
-Exclusivearch: i386\r
-License: BSD and CPL\r
-Group: System/Libraries\r
-Source: %{name}-%{version}.tgz\r
-URL: http://www.datcollaborative.org\r
-\r
-%description\r
-This package contains the DAT Registry.\r
-\r
-#\r
-# Preparation\r
-#\r
-\r
-%prep\r
-%setup -n dat\r
-\r
-#\r
-# Build\r
-#\r
-\r
-%build\r
-cd %{make_dir}\r
-make\r
-\r
-#\r
-# Install\r
-#\r
-\r
-%install\r
-cd %{make_dir}\r
-make install\r
-\r
-#\r
-# Files\r
-#\r
-\r
-%files\r
-/usr/include/dat\r
-/usr/lib/libdat.so\r
-/usr/lib/libdat.a\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_osd.c\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description: \r
- * Provide OS dependent functions with a canonical DAPL\r
- * interface. Designed to be portable and hide OS specific quirks\r
- * of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dat_osd.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Constants *\r
- * *\r
- *********************************************************************/\r
-\r
-#define DAT_DBG_TYPE_ENV "DAT_DBG_TYPE"\r
-#define DAT_DBG_DEST_ENV "DAT_DBG_DEST"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Enumerations *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef int DAT_OS_DBG_DEST;\r
-\r
-typedef enum\r
-{\r
- DAT_OS_DBG_DEST_STDOUT = 0x1,\r
- DAT_OS_DBG_DEST_SYSLOG = 0x2,\r
- DAT_OS_DBG_DEST_ALL = 0x3\r
-} DAT_OS_DBG_DEST_TYPE;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_OS_DBG_TYPE_VAL g_dbg_type = 0;\r
-static DAT_OS_DBG_DEST g_dbg_dest = DAT_OS_DBG_DEST_STDOUT;\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_dbg_init\r
- ***********************************************************************/\r
-\r
-void\r
-dat_os_dbg_init( void ) \r
-{\r
- char *dbg_type;\r
- char *dbg_dest;\r
-\r
- if ( NULL != (dbg_type = dat_os_getenv (DAT_DBG_TYPE_ENV)) )\r
- {\r
- g_dbg_type = dat_os_strtol(dbg_type, NULL, 0);\r
- }\r
-\r
- if ( NULL != (dbg_dest = dat_os_getenv (DAT_DBG_DEST_ENV)) )\r
- {\r
- g_dbg_dest = dat_os_strtol(dbg_dest, NULL, 0);\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_dbg_print\r
- ***********************************************************************/\r
-\r
-void \r
-dat_os_dbg_print ( \r
- DAT_OS_DBG_TYPE_VAL type, \r
- const char * fmt, \r
- ...)\r
-{\r
- if ( (DAT_OS_DBG_TYPE_ERROR == type) || (type & g_dbg_type) )\r
- {\r
- va_list args;\r
- \r
- va_start(args, fmt);\r
-\r
- if ( DAT_OS_DBG_DEST_STDOUT & g_dbg_dest )\r
- {\r
- vfprintf(stderr, fmt, args);\r
- fflush(stderr);\r
- }\r
-\r
- if ( DAT_OS_DBG_DEST_SYSLOG & g_dbg_dest )\r
- {\r
- vsyslog(LOG_USER | LOG_DEBUG, fmt, args);\r
- }\r
-\r
- va_end(args);\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_library_load\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_os_library_load (\r
- const char *library_path,\r
- DAT_OS_LIBRARY_HANDLE *library_handle_ptr)\r
-{\r
- DAT_OS_LIBRARY_HANDLE library_handle;\r
-\r
- if ( NULL != (library_handle = dlopen(library_path, RTLD_NOW)) )\r
- {\r
- if ( NULL != library_handle_ptr ) \r
- { \r
- *library_handle_ptr = library_handle; \r
- }\r
- \r
- return DAT_SUCCESS;\r
- }\r
- else\r
- { \r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_ERROR,\r
- "DAT: library load failure: %s\n", \r
- dlerror());\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_library_unload\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_os_library_unload (\r
- const DAT_OS_LIBRARY_HANDLE library_handle)\r
-{\r
- if ( 0 != dlclose(library_handle) ) \r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- {\r
- return DAT_SUCCESS;\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_osd.h\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description:\r
- * Provide OS dependent data structures & functions with\r
- * a canonical DAT interface. Designed to be portable\r
- * and hide OS specific quirks of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_OSD_H_\r
-#define _DAT_OSD_H_\r
-\r
-/*\r
- * This file is defined for Linux systems only, including it on any\r
- * other build will cause an error\r
- */\r
-#ifndef __linux__\r
-#error "UNDEFINED OS TYPE"\r
-#endif /* __linux__ */\r
-\r
-#include <dat/udat.h>\r
-\r
-#include <assert.h>\r
-#include <ctype.h>\r
-#include <dlfcn.h>\r
-#include <errno.h>\r
-#include <pthread.h>\r
-#include <stdint.h>\r
-#include <stdarg.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <syslog.h>\r
-#include <unistd.h>\r
-\r
-#ifndef STATIC\r
-#define STATIC static\r
-#endif /* STATIC */\r
-\r
-#ifndef INLINE\r
-#define INLINE __inline__\r
-#endif /* INLINE */\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Debuging *\r
- * *\r
- *********************************************************************/\r
-\r
-#define dat_os_assert(expr) assert(expr)\r
-\r
-typedef int DAT_OS_DBG_TYPE_VAL;\r
-\r
-typedef enum\r
-{\r
- DAT_OS_DBG_TYPE_ERROR = 0x1,\r
- DAT_OS_DBG_TYPE_GENERIC = 0x2,\r
- DAT_OS_DBG_TYPE_SR = 0x4,\r
- DAT_OS_DBG_TYPE_DR = 0x8,\r
- DAT_OS_DBG_TYPE_PROVIDER_API = 0x10,\r
- DAT_OS_DBG_TYPE_CONSUMER_API = 0x20,\r
- DAT_OS_DBG_TYPE_ALL = 0xff\r
-} DAT_OS_DBG_TYPE;\r
-\r
-extern void\r
-dat_os_dbg_init ( void );\r
-\r
-extern void \r
-dat_os_dbg_print ( \r
- DAT_OS_DBG_TYPE_VAL type, \r
- const char * fmt, \r
- ...);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Utility Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-#define DAT_ERROR(Type,SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))\r
-\r
-typedef size_t DAT_OS_SIZE;\r
-typedef void * DAT_OS_LIBRARY_HANDLE;\r
-\r
-extern DAT_RETURN \r
-dat_os_library_load (\r
- const char *library_path,\r
- DAT_OS_LIBRARY_HANDLE *library_handle_ptr );\r
-\r
-STATIC INLINE void *\r
-dat_os_library_sym (\r
- DAT_OS_LIBRARY_HANDLE library_handle,\r
- char *sym)\r
-{\r
- return dlsym(library_handle, sym);\r
-}\r
-\r
-extern DAT_RETURN \r
-dat_os_library_unload (\r
- const DAT_OS_LIBRARY_HANDLE library_handle );\r
-\r
-STATIC INLINE char *\r
-dat_os_getenv (\r
- const char *name)\r
-{\r
- return getenv(name);\r
-}\r
-\r
-STATIC INLINE long int\r
-dat_os_strtol (\r
- const char *nptr, \r
- char **endptr, \r
- int base)\r
-{\r
- return strtol(nptr, endptr, base);\r
-}\r
-\r
-STATIC INLINE DAT_OS_SIZE\r
-dat_os_strlen (\r
- const char *s )\r
-{\r
- return strlen(s);\r
-}\r
-\r
-STATIC INLINE int\r
-dat_os_strncmp (\r
- const char *s1, \r
- const char *s2, \r
- DAT_OS_SIZE n)\r
-{\r
- return strncmp(s1, s2, n);\r
-}\r
-\r
-STATIC INLINE void * \r
-dat_os_strncpy (\r
- char *dest, \r
- const char *src, \r
- DAT_OS_SIZE len)\r
-{\r
- return strncpy (dest, src, len);\r
-}\r
-\r
-STATIC INLINE DAT_BOOLEAN\r
-dat_os_isblank( \r
- int c)\r
-{\r
- if ( (' ' == c) || ('\t' == c) )\r
- {\r
- return DAT_TRUE;\r
- }\r
- else\r
- {\r
- return DAT_FALSE;\r
- }\r
-}\r
-\r
-STATIC INLINE DAT_BOOLEAN\r
-dat_os_isdigit( \r
- int c)\r
-{\r
- if ( isdigit(c) )\r
- {\r
- return DAT_TRUE;\r
- }\r
- else\r
- {\r
- return DAT_FALSE;\r
- }\r
-}\r
-\r
-STATIC INLINE void \r
-dat_os_usleep( \r
- unsigned long usec)\r
-{\r
- usleep(usec);\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Memory Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC INLINE void *\r
-dat_os_alloc (\r
- int size)\r
-{\r
- return malloc (size);\r
-}\r
-\r
-STATIC INLINE void \r
-dat_os_free (\r
- void *ptr, \r
- int size)\r
-{\r
- free (ptr);\r
-}\r
-\r
-STATIC INLINE void * \r
-dat_os_memset (void *loc, int c, DAT_OS_SIZE size)\r
-{\r
- return memset (loc, c, size);\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * File I/O *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef FILE DAT_OS_FILE;\r
-typedef fpos_t DAT_OS_FILE_POS;\r
-\r
-\r
-STATIC INLINE DAT_OS_FILE *\r
-dat_os_fopen (\r
- const char * path)\r
-{\r
- /* always open files in read only mode*/\r
- return fopen(path, "r");\r
-}\r
-\r
-STATIC INLINE DAT_RETURN\r
-dat_os_fgetpos ( \r
- DAT_OS_FILE *file, \r
- DAT_OS_FILE_POS *pos)\r
-{\r
- if ( 0 == fgetpos(file, pos) ) \r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC INLINE DAT_RETURN\r
-dat_os_fsetpos ( \r
- DAT_OS_FILE *file, \r
- DAT_OS_FILE_POS *pos)\r
-{\r
- if ( 0 == fsetpos(file, pos) )\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-/* dat_os_fgetc() returns EOF on error or end of file. */\r
-STATIC INLINE int\r
-dat_os_fgetc ( \r
- DAT_OS_FILE *file)\r
-{\r
- return fgetc(file);\r
-}\r
-\r
-/* dat_os_fgetc() returns EOF on error or end of file. */\r
-STATIC INLINE int\r
-dat_os_fputc ( \r
- DAT_OS_FILE *file, int c)\r
-{\r
- return fputc(c, file);\r
-}\r
-\r
-/* dat_os_fread returns the number of bytes read from the file. */\r
-STATIC INLINE DAT_OS_SIZE\r
-dat_os_fread (\r
- DAT_OS_FILE *file,\r
- char *buf, \r
- DAT_OS_SIZE len)\r
-{\r
- return fread(buf, sizeof(char), len, file);\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_fclose (\r
- DAT_OS_FILE *file)\r
-{\r
- if ( 0 == fclose(file) ) { return DAT_SUCCESS; }\r
- else { return DAT_INTERNAL_ERROR; }\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Locks *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef pthread_mutex_t DAT_OS_LOCK;\r
-\r
-\r
-/* lock functions */\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock_init (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- /* pthread_mutex_init always returns 0 */\r
- pthread_mutex_init(m, NULL);\r
- \r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_lock(m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_unlock (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_unlock(m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock_destroy (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- if (0 == pthread_mutex_destroy(m))\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-#endif /* _DAT_OSD_H_ */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-#\r
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source\r
-# file to this component. This file merely indirects to the real make file\r
-# that is shared by all the driver components of the OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\..\inc\openib.def\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#*********************************************************************\r
-# \r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for DAT registration module\r
-#\r
-# $Id$\r
-#*********************************************************************/\r
-\r
-#*********************************************************************\r
-# \r
-# Dot Directives\r
-#\r
-#*********************************************************************/\r
-\r
-.SUFFIXES : # clear the .SUFFIXES list\r
-.SUFFIXES : .c # initialize .SUFFIXES list\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Macros\r
-#\r
-#*********************************************************************/\r
-\r
-UDAT_ROOT = .\r
-UDAT_COMMON = $(UDAT_ROOT)/../common\r
-UDAT_WINDOWS = $(UDAT_ROOT)/windows\r
-\r
-OBJ_PATH = $(UDAT_ROOT)/Obj\r
-TARGET_PATH = $(UDAT_ROOT)/Target\r
-\r
-OBJS = \\r
- $(OBJ_PATH)/udat.obj \\r
- $(OBJ_PATH)/dat_osd.obj \\r
- $(OBJ_PATH)/dat_dictionary.obj \\r
- $(OBJ_PATH)/dat_dr.obj \\r
- $(OBJ_PATH)/dat_init.obj \\r
- $(OBJ_PATH)/dat_sr.obj \\r
- $(OBJ_PATH)/udat_sr_parser.obj \\r
- $(OBJ_PATH)/dat_strerror.obj\r
-\r
-LIBRARY = $(TARGET_PATH)/dat.dll\r
-\r
-#\r
-# Compiler \r
-#\r
-\r
-CC = cl\r
-\r
-INC_FLAGS = \\r
- /I . \\r
- /I ../include \\r
- /I $(UDAT_COMMON) \\r
- /I $(UDAT_WINDOWS) \\r
- /I ../../../shared/include \\r
- /I ../../../winuser/include \r
-\r
-CC_FLAGS = \\r
- /nologo /Zel /Zp1 /Gy /W3 /Gd /QIfdiv- /QIf /QI0f /GB /Gi- /Gm- /GX- \\r
- /GR- /GF -Z7 /Od /Oi /Oy- /DWIN32 /D_X86_ -D__i386__ $(INC_FLAGS)\r
-\r
-\r
-#\r
-# Linker\r
-#\r
-\r
-LINK = link\r
-\r
-LIBS = libc.lib kernel32.lib\r
-\r
-LINK_FLAGS = \\r
- /nologo /dll /DEF:$(UDAT_WINDOWS)/dat_win.def \\r
- /DEBUG /incremental:no /machine:I386 $(LIBS)\r
-\r
-#\r
-# System Utilities\r
-#\r
-\r
-RM = rm -f\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Inference Rules\r
-#\r
-#*********************************************************************/\r
-\r
-{$(UDAT_ROOT)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-{$(UDAT_COMMON)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-{$(UDAT_WINDOWS)}.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-\r
-#*********************************************************************\r
-#\r
-# Description Blocks\r
-#\r
-#*********************************************************************/\r
-\r
-all : mkdirs $(LIBRARY)\r
-\r
-mkdirs :\r
- if not exist "$(OBJ_PATH)" mkdir "$(OBJ_PATH)"\r
- if not exist "$(TARGET_PATH)" mkdir "$(TARGET_PATH)"\r
-\r
-$(LIBRARY) : $(OBJS) \r
- $(LINK) $(LINK_FLAGS) /out:$(LIBRARY) $(OBJS)\r
-\r
-clean :\r
- $(RM) $(OBJS)\r
- $(RM) $(LIBRARY) \r
- $(RM) $(TARGET_PATH)/*.pdb $(TARGET_PATH)/*.exp $(TARGET_PATH)/*.lib\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: udat.c\r
- *\r
- * PURPOSE: DAT Provider and Consumer registry functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include <dat/udat.h>\r
-#include <dat/dat_registry.h> /* Provider API function prototypes */\r
-\r
-#include "dat_dr.h"\r
-#include "dat_init.h"\r
-#include "dat_osd.h"\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
-#include "dat_sr.h"\r
-#endif\r
-\r
-\r
-#define UDAT_IS_BAD_POINTER(p) ( NULL == (p) )\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-DAT_BOOLEAN\r
-udat_check_state ( void );\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-/*\r
- *\r
- * Provider API\r
- *\r
- */\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_registry_add_provider\r
- ***********************************************************************/\r
-\r
-DAT_RETURN DAT_API\r
-dat_registry_add_provider (\r
- IN DAT_PROVIDER *provider,\r
- IN const DAT_PROVIDER_INFO *provider_info )\r
-{\r
- DAT_DR_ENTRY entry;\r
-\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,\r
- "DAT Registry: dat_registry_add_provider () called\n");\r
-\r
- if ( UDAT_IS_BAD_POINTER (provider) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- }\r
-\r
- if ( UDAT_IS_BAD_POINTER (provider_info) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- }\r
-\r
- if ( DAT_FALSE == udat_check_state () )\r
- {\r
- return DAT_ERROR (DAT_INVALID_STATE, 0);\r
- }\r
-\r
- entry.ref_count = 0;\r
- entry.ia_open_func = provider->ia_open_func;\r
- entry.info = *provider_info;\r
-\r
- return dat_dr_insert (provider_info, &entry);\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_registry_remove_provider\r
-//***********************************************************************\r
-\r
-DAT_RETURN DAT_API\r
-dat_registry_remove_provider (\r
- IN DAT_PROVIDER *provider,\r
- IN const DAT_PROVIDER_INFO *provider_info )\r
-{\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,\r
- "DAT Registry: dat_registry_remove_provider () called\n");\r
-\r
- if ( UDAT_IS_BAD_POINTER (provider) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- }\r
-\r
- if ( DAT_FALSE == udat_check_state () )\r
- {\r
- return DAT_ERROR (DAT_INVALID_STATE, 0);\r
- }\r
-\r
- return dat_dr_remove (provider_info);\r
-}\r
-\r
-\r
-/*\r
- *\r
- * Consumer API\r
- *\r
- */\r
-\r
-/***********************************************************************\r
- * Function: dat_ia_open\r
- ***********************************************************************/\r
-\r
-DAT_RETURN DAT_API\r
-dat_ia_openv (\r
- IN const DAT_NAME_PTR name,\r
- IN DAT_COUNT async_event_qlen,\r
- INOUT DAT_EVD_HANDLE *async_event_handle,\r
- OUT DAT_IA_HANDLE *ia_handle,\r
- IN DAT_UINT32 dapl_major,\r
- IN DAT_UINT32 dapl_minor,\r
- IN DAT_BOOLEAN thread_safety )\r
-{\r
- DAT_IA_OPEN_FUNC ia_open_func;\r
- DAT_PROVIDER_INFO info;\r
- DAT_RETURN status;\r
- DAT_OS_SIZE len;\r
-\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: dat_ia_open () called\n");\r
-\r
- if ( UDAT_IS_BAD_POINTER (name) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- }\r
-\r
- len = dat_os_strlen(name);\r
-\r
- if ( DAT_NAME_MAX_LENGTH < len )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- }\r
-\r
- if ( UDAT_IS_BAD_POINTER (ia_handle) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
- }\r
-\r
- if ( DAT_FALSE == udat_check_state () )\r
- {\r
- return DAT_ERROR (DAT_INVALID_STATE, 0);\r
- }\r
- \r
- dat_os_strncpy(info.ia_name, name, len);\r
- info.ia_name[len] = '\0';\r
-\r
- info.dapl_version_major = dapl_major;\r
- info.dapl_version_minor = dapl_minor;\r
- info.is_thread_safe = thread_safety;\r
-\r
- /* \r
- * Since DAT allows providers to be loaded by either the static \r
- * registry or explicitly through OS dependent methods, do not \r
- * return an error if no providers are loaded via the static registry.\r
- * Don't even bother calling the static registry if DAT is compiled\r
- * with no static registry support.\r
- */\r
- \r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- (void) dat_sr_provider_open ( &info );\r
-#endif\r
-\r
- status = dat_dr_provider_open ( &info, &ia_open_func);\r
- if ( status != DAT_SUCCESS )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: dat_ia_open () provider information "\r
- "for IA name %s not found in dynamic registry\n",\r
- info.ia_name);\r
-\r
- return status;\r
- }\r
-\r
- return (*ia_open_func) (name, \r
- async_event_qlen,\r
- async_event_handle,\r
- ia_handle);\r
-}\r
-\r
-\r
-/************************************************************************\r
- * Function: dat_ia_close\r
- ***********************************************************************/\r
-\r
-DAT_RETURN DAT_API\r
-dat_ia_close (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_CLOSE_FLAGS ia_flags)\r
-{\r
- DAT_PROVIDER *provider;\r
- DAT_PROVIDER_ATTR provider_attr;\r
- DAT_RETURN status;\r
- const char *ia_name;\r
-\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: dat_ia_close () called\n");\r
-\r
- if ( UDAT_IS_BAD_POINTER (ia_handle) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);\r
- }\r
-\r
- if ( DAT_FALSE == udat_check_state () )\r
- {\r
- return DAT_ERROR (DAT_INVALID_STATE, 0);\r
- }\r
-\r
- provider = DAT_HANDLE_TO_PROVIDER(ia_handle);\r
-\r
- if ( !provider )\r
- return DAT_INVALID_HANDLE;\r
-\r
- ia_name = provider->device_name;\r
-\r
- if ( DAT_SUCCESS != (status = dat_ia_query (ia_handle, \r
- NULL, \r
- 0, \r
- NULL, \r
- DAT_PROVIDER_FIELD_ALL, \r
- &provider_attr)) )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: query function for %s provider failed\n",\r
- ia_name);\r
- }\r
- else if ( DAT_SUCCESS != (status = \r
- (*provider->ia_close_func)(ia_handle, ia_flags)) )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: close function for %s provider failed\n",\r
- ia_name);\r
- }\r
- else \r
- {\r
- DAT_PROVIDER_INFO info;\r
- DAT_OS_SIZE len;\r
-\r
- len = dat_os_strlen(ia_name);\r
- \r
- dat_os_assert( len <= DAT_NAME_MAX_LENGTH );\r
- \r
- dat_os_strncpy(info.ia_name, ia_name, len);\r
- info.ia_name[len] = '\0';\r
- \r
- info.dapl_version_major = provider_attr.dapl_version_major;\r
- info.dapl_version_minor = provider_attr.dapl_version_minor;\r
- info.is_thread_safe = provider_attr.is_thread_safe;\r
-\r
- status = dat_dr_provider_close ( &info );\r
- if ( DAT_SUCCESS != status )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: dynamic registry unable to close "\r
- "provider for IA name %s\n",\r
- ia_name);\r
- }\r
-\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- status = dat_sr_provider_close ( &info );\r
- if ( DAT_SUCCESS != status )\r
- {\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: static registry unable to close "\r
- "provider for IA name %s\n",\r
- ia_name);\r
- }\r
-#endif\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-//***********************************************************************\r
-// Function: dat_registry_list_providers\r
-//***********************************************************************\r
-\r
-DAT_RETURN DAT_API\r
-dat_registry_list_providers (\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO * (dat_provider_list[]))\r
-{\r
- DAT_RETURN dat_status;\r
-\r
- dat_status = DAT_SUCCESS;\r
- dat_os_dbg_print (DAT_OS_DBG_TYPE_CONSUMER_API,\r
- "DAT Registry: dat_registry_list_providers () called\n");\r
-\r
- if ( DAT_FALSE == udat_check_state () )\r
- {\r
- return DAT_ERROR (DAT_INVALID_STATE, 0);\r
- }\r
-\r
- if ( ( UDAT_IS_BAD_POINTER (entries_returned) ) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);\r
- }\r
-\r
- if (0 != max_to_return && ( UDAT_IS_BAD_POINTER (dat_provider_list) ) )\r
- {\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);\r
- }\r
-\r
- if ( 0 == max_to_return )\r
- {\r
- /* the user is allowed to call with max_to_return set to zero.\r
- * in which case we simply return (in *entries_returned) the\r
- * number of providers currently installed. We must also\r
- * (per spec) return an error\r
- */\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- (void) dat_sr_size ( entries_returned );\r
-#else\r
- (void) dat_dr_size ( entries_returned );\r
-#endif\r
- return DAT_ERROR (DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);\r
- }\r
- else\r
- {\r
-#ifndef DAT_NO_STATIC_REGISTRY\r
- dat_status = dat_sr_list (max_to_return,\r
- entries_returned,\r
- dat_provider_list);\r
-#else\r
- dat_status = dat_dr_list (max_to_return,\r
- entries_returned,\r
- dat_provider_list);\r
-#endif\r
- }\r
- return dat_status;\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-\r
-//***********************************************************************\r
-// Function: udat_check_state\r
-//***********************************************************************\r
-\r
-/*\r
- * This function returns TRUE if the DAT registry is in a state capable\r
- * of handling DAT API calls and false otherwise.\r
- */\r
-\r
-DAT_BOOLEAN\r
-udat_check_state ( void )\r
-{\r
- DAT_MODULE_STATE state;\r
- DAT_BOOLEAN status = DAT_FALSE;\r
-\r
- state = dat_module_get_state ();\r
-\r
- if ( DAT_MODULE_STATE_UNINITIALIZED == state )\r
- {\r
- dat_init ();\r
- state = dat_module_get_state ();\r
- }\r
- if ( DAT_MODULE_STATE_INITIALIZED == state )\r
- {\r
- status = DAT_TRUE;\r
- }\r
- return status;\r
-}\r
-\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2007 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE VFT_DLL\r
-#define VER_FILESUBTYPE VFT2_UNKNOWN\r
-\r
-#if DBG\r
-#define VER_FILEDESCRIPTION_STR "User-mode Direct Access Transport Library v1.1 (Debug)"\r
-#define VER_INTERNALNAME_STR "datd.dll"\r
-#define VER_ORIGINALFILENAME_STR "datd.dll"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR "User-mode Direct Access Transport Library v1.1"\r
-#define VER_INTERNALNAME_STR "dat.dll"\r
-#define VER_ORIGINALFILENAME_STR "dat.dll"\r
-#endif\r
-\r
-#include <common.ver>\r
+++ /dev/null
-#if DBG\r
-LIBRARY datd.dll\r
-#else\r
-LIBRARY dat.dll\r
-#endif\r
-\r
-#ifndef _WIN64\r
-EXPORTS\r
-dat_ia_openv\r
-dat_ia_close\r
-dat_registry_list_providers\r
-dat_strerror\r
-dat_registry_add_provider\r
-dat_registry_remove_provider\r
-#endif\r
+++ /dev/null
-/*\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-/* \r
- * Include all files that are not in children directories.\r
- */\r
-\r
-#include "../common/dat_dictionary.c"\r
-#include "../common/dat_dr.c"\r
-#include "../common/dat_init.c"\r
-#include "../common/dat_sr.c"\r
-#include "../common/dat_strerror.c"\r
-#include "windows/dat_osd.c"\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_sr_parser.c\r
- *\r
- * PURPOSE: static registry parser\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-\r
-#include "udat_sr_parser.h"\r
-#include "dat_sr.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Constants *\r
- * *\r
- *********************************************************************/\r
-\r
-#define DAT_SR_CONF_ENV "DAT_OVERRIDE"\r
-#define DAT_SR_SYSTEM_DRIVE "SystemDrive"\r
-#define DAT_SR_DRIVE_DEFAULT "C:"\r
-#define DAT_SR_CONF_DEFAULT "\\Dat\\dat.conf"\r
-#define DAT_SR_TOKEN_THREADSAFE "threadsafe"\r
-#define DAT_SR_TOKEN_NONTHREADSAFE "nonthreadsafe"\r
-#define DAT_SR_TOKEN_DEFAULT "default"\r
-#define DAT_SR_TOKEN_NONDEFAULT "nondefault"\r
-\r
-#define DAT_SR_CHAR_NEWLINE '\n'\r
-#define DAT_SR_CHAR_COMMENT '#'\r
-#define DAT_SR_CHAR_QUOTE '"'\r
-#define DAT_SR_CHAR_BACKSLASH '\\'\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Enumerations *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef enum\r
-{\r
- DAT_SR_TOKEN_STRING, /* text field (both quoted or unquoted) */\r
- DAT_SR_TOKEN_EOR, /* end of record (newline) */\r
- DAT_SR_TOKEN_EOF /* end of file */\r
-} DAT_SR_TOKEN_TYPE;\r
-\r
-typedef enum \r
-{\r
- DAT_SR_API_UDAT,\r
- DAT_SR_API_KDAT\r
-} DAT_SR_API_TYPE;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Structures *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef struct\r
-{\r
- DAT_SR_TOKEN_TYPE type;\r
- char * value; /* valid if type is DAT_SR_TOKEN_STRING */\r
- DAT_OS_SIZE value_len;\r
-} DAT_SR_TOKEN;\r
-\r
-typedef struct DAT_SR_STACK_NODE\r
-{\r
- DAT_SR_TOKEN token;\r
- struct DAT_SR_STACK_NODE *next;\r
-} DAT_SR_STACK_NODE;\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 major;\r
- DAT_UINT32 minor;\r
-} DAT_SR_VERSION;\r
-\r
-typedef struct\r
-{\r
- char * id;\r
- DAT_SR_VERSION version;\r
-} DAT_SR_PROVIDER_VERSION;\r
-\r
-typedef struct\r
-{\r
- DAT_SR_API_TYPE type;\r
- DAT_SR_VERSION version;\r
-} DAT_SR_API_VERSION;\r
-\r
-typedef struct \r
-{\r
- char * ia_name;\r
- DAT_SR_API_VERSION api_version;\r
- DAT_BOOLEAN is_thread_safe;\r
- DAT_BOOLEAN is_default;\r
- char * lib_path;\r
- DAT_SR_PROVIDER_VERSION provider_version;\r
- char * ia_params;\r
- char * platform_params;\r
-} DAT_SR_CONF_ENTRY;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_RETURN\r
-dat_sr_load_entry (\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_BOOLEAN\r
-dat_sr_is_valid_entry (\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static char * \r
-dat_sr_type_to_str(\r
- DAT_SR_TOKEN_TYPE type);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_eof(\r
- DAT_OS_FILE *file);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_entry(\r
- DAT_OS_FILE *file);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_ia_name(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_api(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_thread_safety(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_default(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_lib_path(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_provider_version(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_ia_params(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_platform_params(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_eoe(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry);\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_api(\r
- char *str, \r
- DAT_SR_API_VERSION *api_version);\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_thread_safety(\r
- char *str, \r
- DAT_BOOLEAN *is_thread_safe);\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_default(\r
- char *str, \r
- DAT_BOOLEAN *is_default);\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_provider_version(\r
- char *str, \r
- DAT_SR_PROVIDER_VERSION *provider_version);\r
-\r
-static DAT_RETURN\r
-dat_sr_get_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token);\r
-\r
-static DAT_RETURN\r
-dat_sr_put_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token);\r
-\r
-static DAT_RETURN\r
-dat_sr_read_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token);\r
-\r
-static DAT_RETURN\r
-dat_sr_read_str (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token,\r
- DAT_OS_SIZE token_len);\r
-\r
-static DAT_RETURN\r
-dat_sr_read_quoted_str (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token,\r
- DAT_OS_SIZE token_len,\r
- DAT_COUNT num_escape_seq);\r
-\r
-static void \r
-dat_sr_read_comment(\r
- DAT_OS_FILE *file);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_SR_STACK_NODE *g_token_stack = NULL;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * External Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_load\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_load (void)\r
-{\r
- char *sr_path;\r
- DAT_OS_FILE *sr_file;\r
- char env_path[256];\r
- \r
- dat_os_memset(env_path, 0, sizeof(env_path));\r
-\r
- sr_path = dat_os_getenv (DAT_SR_CONF_ENV);\r
- if ( sr_path == NULL )\r
- {\r
- sr_path = dat_os_getenv(DAT_SR_SYSTEM_DRIVE);\r
- if ( sr_path != NULL )\r
- {\r
- strncat(env_path,sr_path, __min(sizeof(env_path)-1,strlen(sr_path)));\r
- \r
- if ( strlen(env_path) < sizeof(env_path) )\r
- {\r
- strncat( &env_path[strlen(env_path)],DAT_SR_CONF_DEFAULT,\r
- __min(sizeof(env_path)-strlen(env_path)-1, strlen(DAT_SR_CONF_DEFAULT )));\r
- }\r
- sr_path = env_path;\r
- }\r
- else\r
- {\r
- strncat(env_path,DAT_SR_DRIVE_DEFAULT,sizeof(DAT_SR_DRIVE_DEFAULT));\r
- if ( strlen(env_path) < sizeof(env_path) )\r
- {\r
- strncat(&env_path[strlen(env_path)],DAT_SR_CONF_DEFAULT, \r
- __min( sizeof(env_path)-strlen(env_path)-1, strlen(DAT_SR_CONF_DEFAULT )));\r
- sr_path = env_path;\r
- }\r
- }\r
- }\r
-\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "DAT Registry: static registry file <%s> \n", sr_path);\r
-\r
- sr_file = dat_os_fopen(sr_path);\r
- if ( sr_file == NULL )\r
- {\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_ERROR, \r
- "DAT Registry: Failed to open static registry file <%s> \n", sr_path);\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- for (;;)\r
- {\r
- if ( DAT_SUCCESS == dat_sr_parse_eof(sr_file) )\r
- {\r
- break;\r
- }\r
- else if ( DAT_SUCCESS == dat_sr_parse_entry(sr_file) )\r
- {\r
- continue;\r
- }\r
- else\r
- {\r
- dat_os_assert(!"unable to parse static registry file");\r
- break;\r
- }\r
- }\r
-\r
- if ( 0 != dat_os_fclose(sr_file) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Internal Function Definitions *\r
- * *\r
- *********************************************************************/\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_is_valid_entry\r
- ***********************************************************************/\r
-\r
-DAT_BOOLEAN\r
-dat_sr_is_valid_entry (\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- if ( ( DAT_SR_API_UDAT == entry->api_version.type ) && \r
- (entry->is_default) )\r
- {\r
- return DAT_TRUE;\r
- }\r
- else \r
- {\r
- return DAT_FALSE;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_load_entry\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_load_entry (\r
- DAT_SR_CONF_ENTRY *conf_entry)\r
-{\r
- DAT_SR_ENTRY entry;\r
-\r
- if ( DAT_NAME_MAX_LENGTH < (strlen(conf_entry->ia_name) + 1) )\r
- {\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "DAT Registry: ia name %s is longer than "\r
- "DAT_NAME_MAX_LENGTH (%i)\n",\r
- conf_entry->ia_name, DAT_NAME_MAX_LENGTH);\r
- \r
- return DAT_INSUFFICIENT_RESOURCES;\r
- }\r
- \r
- dat_os_strncpy(entry.info.ia_name, conf_entry->ia_name, DAT_NAME_MAX_LENGTH);\r
- entry.info.dapl_version_major = conf_entry->api_version.version.major;\r
- entry.info.dapl_version_minor = conf_entry->api_version.version.minor;\r
- entry.info.is_thread_safe = conf_entry->is_thread_safe;\r
- entry.lib_path = conf_entry->lib_path;\r
- entry.ia_params = conf_entry->ia_params;\r
- entry.lib_handle = NULL;\r
- entry.ref_count = 0;\r
-\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "DAT Registry: loading provider for %s\n",\r
- conf_entry->ia_name);\r
- \r
- return dat_sr_insert(&entry.info, &entry);\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_type_to_str\r
- ***********************************************************************/\r
-\r
-char * \r
-dat_sr_type_to_str (\r
- DAT_SR_TOKEN_TYPE type)\r
-{\r
- static char *str_array[] = { "string", "eor", "eof" };\r
-\r
- if ( (type < 0) || (2 < type) )\r
- {\r
- return "error: invalid token type";\r
- }\r
-\r
- return str_array[type];\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_eof\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_eof(\r
- DAT_OS_FILE *file)\r
-{\r
- DAT_SR_TOKEN token;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_EOF == token.type )\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else \r
- {\r
- dat_sr_put_token(file, &token);\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_ia_name\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_entry(\r
- DAT_OS_FILE *file)\r
-{\r
- DAT_SR_CONF_ENTRY entry;\r
- DAT_RETURN status;\r
-\r
- dat_os_memset(&entry, 0, sizeof(DAT_SR_CONF_ENTRY));\r
-\r
- if ( (DAT_SUCCESS == dat_sr_parse_ia_name(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_api(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_thread_safety(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_default(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_lib_path(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_provider_version(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_ia_params(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_platform_params(file, &entry)) &&\r
- (DAT_SUCCESS == dat_sr_parse_eoe(file, &entry)) )\r
- {\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "\n"\r
- "DAT Registry: entry \n"\r
- " ia_name %s\n"\r
- " api_version\n"\r
- " type 0x%X\n"\r
- " major.minor %d.%d\n"\r
- " is_thread_safe %d\n"\r
- " is_default %d\n"\r
- " lib_path %s\n"\r
- " provider_version\n"\r
- " id %s\n"\r
- " major.minor %d.%d\n"\r
- " ia_params %s\n"\r
- "\n",\r
- entry.ia_name, \r
- entry.api_version.type, \r
- entry.api_version.version.major, \r
- entry.api_version.version.minor,\r
- entry.is_thread_safe,\r
- entry.is_default,\r
- entry.lib_path,\r
- entry.provider_version.id,\r
- entry.provider_version.version.major, \r
- entry.provider_version.version.minor,\r
- entry.ia_params);\r
-\r
- if ( DAT_TRUE == dat_sr_is_valid_entry(&entry) )\r
- {\r
- /* \r
- * The static registry configuration file may have multiple \r
- * entries with the same IA name. The first entry will be \r
- * installed in the static registry causing subsequent attempts \r
- * to register the same IA name to fail. Therefore the return code \r
- * from dat_sr_load_entry() is ignored. \r
- */\r
- (void) dat_sr_load_entry(&entry);\r
- }\r
- \r
- status = DAT_SUCCESS;\r
- }\r
- else /* resync */\r
- {\r
- DAT_SR_TOKEN token;\r
- \r
- /*\r
- * The static registry format is specified in the DAT specification. \r
- * While the registry file's contents may change between revisions of \r
- * the specification, there is no way to determine the specification \r
- * version to which the configuration file conforms. If an entry is \r
- * found that does not match the expected format, the entry is discarded \r
- * and the parsing of the file continues. There is no way to determine if \r
- * the entry was an error or an entry confirming to an alternate version \r
- * of specification.\r
- */\r
- \r
- for (;;)\r
- {\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- break;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_SUCCESS;\r
- break;\r
- }\r
- else \r
- {\r
- dat_os_free(token.value, \r
- (sizeof(char) * (int)dat_os_strlen(token.value)) + 1);\r
- continue;\r
- }\r
- }\r
- }\r
-\r
- /* free resources */\r
- if ( NULL != entry.ia_name )\r
- {\r
- dat_os_free(entry.ia_name,\r
- sizeof(char) * ((int)dat_os_strlen(entry.ia_name) + 1));\r
- }\r
- if ( NULL != entry.lib_path )\r
- {\r
- dat_os_free(entry.lib_path,\r
- sizeof(char) * ((int)dat_os_strlen(entry.lib_path) + 1));\r
- }\r
- \r
- if ( NULL != entry.provider_version.id )\r
- {\r
- dat_os_free(entry.provider_version.id,\r
- sizeof(char) * ((int)dat_os_strlen(entry.provider_version.id) + 1));\r
- }\r
- \r
- if ( NULL != entry.ia_params )\r
- {\r
- dat_os_free(entry.ia_params,\r
- sizeof(char) * ((int)dat_os_strlen(entry.ia_params) + 1));\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_ia_name\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_ia_name(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- {\r
- entry->ia_name = token.value;\r
-\r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_ia_name\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_api(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else if ( DAT_SUCCESS != dat_sr_convert_api(\r
- token.value, &entry->api_version) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else\r
- {\r
- dat_os_free(token.value, \r
- (sizeof(char) * (int)dat_os_strlen(token.value)) + 1);\r
-\r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
- \r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_thread_safety\r
- ***********************************************************************/\r
-\r
-static DAT_RETURN \r
-dat_sr_parse_thread_safety(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else if ( DAT_SUCCESS != dat_sr_convert_thread_safety(\r
- token.value, &entry->is_thread_safe) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- {\r
- dat_os_free(token.value, \r
- (sizeof(char) * (int)dat_os_strlen(token.value)) + 1);\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_default\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_default(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else if ( DAT_SUCCESS != dat_sr_convert_default(\r
- token.value, &entry->is_default) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- {\r
- dat_os_free(token.value, \r
- (sizeof(char) * (int)dat_os_strlen(token.value)) + 1);\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_lib_path\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_lib_path(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- { \r
- entry->lib_path = token.value;\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_provider_version\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_provider_version(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else if ( DAT_SUCCESS != dat_sr_convert_provider_version(\r
- token.value, &entry->provider_version) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- { \r
- dat_os_free(token.value, \r
- (sizeof(char) * (int)dat_os_strlen(token.value)) + 1);\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_ia_params\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_ia_params(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- { \r
- entry->ia_params = token.value;\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_platform_params\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_platform_params(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( DAT_SR_TOKEN_STRING != token.type )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- { \r
- entry->platform_params = token.value;\r
- \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_parse_eoe\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_parse_eoe(\r
- DAT_OS_FILE *file,\r
- DAT_SR_CONF_ENTRY *entry)\r
-{\r
- DAT_SR_TOKEN token;\r
- DAT_RETURN status;\r
-\r
- if( entry == NULL )\r
- return DAT_INVALID_PARAMETER;\r
-\r
- if ( DAT_SUCCESS != dat_sr_get_token(file, &token) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( (DAT_SR_TOKEN_EOF != token.type) && \r
- (DAT_SR_TOKEN_EOR != token.type) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- { \r
- status = DAT_SUCCESS;\r
- }\r
-\r
- if ( DAT_SUCCESS != status )\r
- {\r
- DAT_RETURN status_success;\r
- \r
- status_success = dat_sr_put_token(file, &token); \r
- dat_os_assert( DAT_SUCCESS == status_success);\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_convert_api\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_convert_api (\r
- char *str, \r
- DAT_SR_API_VERSION *api_version)\r
-{\r
- int i;\r
- int minor_i;\r
-\r
- dat_os_assert( 0 < dat_os_strlen(str) );\r
- \r
- if ( 'u' == str[0] )\r
- {\r
- api_version->type = DAT_SR_API_UDAT;\r
- }\r
- else if ( 'k' == str[0] )\r
- {\r
- api_version->type = DAT_SR_API_KDAT;\r
- }\r
- else \r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- for ( i = 1 /* move past initial [u|k] */; '\0' != str[i]; i++ )\r
- {\r
- if ( '.' == str[i] )\r
- {\r
- break;\r
- }\r
- else if ( DAT_TRUE != dat_os_isdigit(str[i]) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
-\r
- api_version->version.major = (DAT_UINT32) dat_os_strtol(str + 1, NULL, 10);\r
-\r
- /* move past '.' */\r
- minor_i = ++i;\r
-\r
- for ( ; '\0' != str[i]; i++ )\r
- {\r
- if ( DAT_TRUE != dat_os_isdigit(str[i]) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
- \r
- api_version->version.minor = (DAT_UINT32) dat_os_strtol(str + minor_i, NULL, 10);\r
-\r
- if ( '\0' != str[i] )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_convert_thread_safety\r
- ***********************************************************************/\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_thread_safety(\r
- char *str, \r
- DAT_BOOLEAN *is_thread_safe)\r
-{\r
- if ( !dat_os_strncmp(str, \r
- DAT_SR_TOKEN_THREADSAFE, \r
- dat_os_strlen(DAT_SR_TOKEN_THREADSAFE)) )\r
- {\r
- *is_thread_safe = DAT_TRUE;\r
- return DAT_SUCCESS;\r
- }\r
- else if ( !dat_os_strncmp(str, \r
- DAT_SR_TOKEN_NONTHREADSAFE, \r
- dat_os_strlen(DAT_SR_TOKEN_NONTHREADSAFE)) )\r
- {\r
- *is_thread_safe = DAT_FALSE;\r
- return DAT_SUCCESS;\r
- }\r
- else \r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_convert_default\r
- ***********************************************************************/\r
-\r
-static DAT_RETURN \r
-dat_sr_convert_default (\r
- char *str, \r
- DAT_BOOLEAN *is_default)\r
-{\r
- if ( !dat_os_strncmp(str, \r
- DAT_SR_TOKEN_DEFAULT, \r
- dat_os_strlen(DAT_SR_TOKEN_DEFAULT)) )\r
- {\r
- *is_default = DAT_TRUE;\r
- return DAT_SUCCESS;\r
- }\r
- else if ( !dat_os_strncmp(str, \r
- DAT_SR_TOKEN_NONDEFAULT, \r
- dat_os_strlen(DAT_SR_TOKEN_NONDEFAULT)) )\r
- {\r
- *is_default = DAT_FALSE;\r
- return DAT_SUCCESS;\r
- }\r
- else \r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_convert_provider_version\r
- ***********************************************************************/\r
-\r
-DAT_RETURN \r
-dat_sr_convert_provider_version (\r
- char *str, \r
- DAT_SR_PROVIDER_VERSION *provider_version)\r
-{\r
- DAT_RETURN status;\r
- int i;\r
- int decimal_i;\r
- \r
- dat_os_assert( 0 < dat_os_strlen(str) );\r
- dat_os_assert( NULL == provider_version->id );\r
-\r
- status = DAT_SUCCESS;\r
-\r
- for ( i = 0; '\0' != str[i]; i++ )\r
- {\r
- if ( '.' == str[i] )\r
- {\r
- break;\r
- }\r
- }\r
-\r
- /* if no id value was found */\r
- if ( 0 == i )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- \r
- if ( NULL == (provider_version->id = dat_os_alloc(sizeof(char) * (i + 1))) )\r
- {\r
- status = DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- goto exit;\r
- }\r
-\r
- dat_os_strncpy(provider_version->id, str, i);\r
- provider_version->id[i] = '\0';\r
-\r
- /* move past '.' */\r
- decimal_i = ++i;\r
- \r
- for ( ; '\0' != str[i]; i++ )\r
- {\r
- if ( '.' == str[i] )\r
- {\r
- break;\r
- }\r
- else if ( DAT_TRUE != dat_os_isdigit(str[i]) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- }\r
-\r
- /* if no version value was found */\r
- if ( decimal_i == i )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
-\r
- provider_version->version.major = (DAT_UINT32) \r
- dat_os_strtol(str + decimal_i, NULL, 10);\r
-\r
- /* move past '.' */\r
- decimal_i = ++i;\r
-\r
- for ( ; '\0' != str[i]; i++ )\r
- {\r
- if ( DAT_TRUE != dat_os_isdigit(str[i]) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- }\r
-\r
- /* if no version value was found */\r
- if ( decimal_i == i )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- \r
- provider_version->version.minor = (DAT_UINT32) \r
- dat_os_strtol(str + decimal_i, NULL, 10);\r
-\r
- if ( '\0' != str[i] )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
-\r
- exit:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != provider_version->id )\r
- {\r
- dat_os_free(provider_version->id, \r
- sizeof(char) * ((int)dat_os_strlen(provider_version->id) + 1));\r
- provider_version->id = NULL;\r
- }\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_get_token\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_get_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token)\r
-{\r
- if ( NULL == g_token_stack )\r
- {\r
- return dat_sr_read_token(file, token);\r
- }\r
- else\r
- {\r
- DAT_SR_STACK_NODE *top;\r
-\r
- top = g_token_stack;\r
-\r
- *token = top->token;\r
- g_token_stack = top->next;\r
-\r
- dat_os_free(top, sizeof(DAT_SR_STACK_NODE));\r
-\r
- return DAT_SUCCESS;\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_put_token\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_put_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token)\r
-{\r
- DAT_SR_STACK_NODE *top;\r
-\r
- if ( NULL == (top = dat_os_alloc(sizeof(DAT_SR_STACK_NODE))) )\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- top->token = *token;\r
- top->next = g_token_stack;\r
- g_token_stack = top;\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_read_token\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_read_token (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token)\r
-{\r
- DAT_OS_FILE_POS pos;\r
- DAT_OS_SIZE token_len;\r
- DAT_COUNT num_escape_seq;\r
- DAT_BOOLEAN is_quoted_str;\r
- DAT_BOOLEAN is_prev_char_backslash;\r
- DAT_OS_FILE_POS cur_pos = 0;\r
- /* \r
- * The DAT standard does not specify a maximum size for quoted strings.\r
- * Therefore the tokenizer must be able to read in a token of arbitrary \r
- * size. Instead of allocating a fixed length buffer, the tokenizer first \r
- * scans the input a single character at a time looking for the begining \r
- * and end of the token. Once the these positions are found, the entire \r
- * token is read into memory. By using this algorithm,the implementation \r
- * does not place an arbitrary maximum on the token size.\r
- */\r
-\r
- token_len = 0;\r
- num_escape_seq = 0;\r
- is_quoted_str = DAT_FALSE;\r
- is_prev_char_backslash = DAT_FALSE;\r
- \r
- for (;;)\r
- {\r
- \r
- int c;\r
-\r
- /* if looking for start of the token */\r
- if ( 0 == token_len ) \r
- {\r
- if ( DAT_SUCCESS != dat_os_fgetpos(file, &cur_pos) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
-\r
- c = dat_os_fgetc(file);\r
-\r
- /* if looking for start of the token */\r
- if ( 0 == token_len )\r
- {\r
- if ( EOF == c ) \r
- {\r
- token->type = DAT_SR_TOKEN_EOF;\r
- token->value = NULL;\r
- token->value_len = 0;\r
- goto success;\r
- }\r
- else if ( DAT_SR_CHAR_NEWLINE == c )\r
- {\r
- token->type = DAT_SR_TOKEN_EOR;\r
- token->value = NULL;\r
- token->value_len = 0;\r
- goto success;\r
- }\r
- else if ( dat_os_isblank(c) )\r
- {\r
- continue;\r
- }\r
- else if ( DAT_SR_CHAR_COMMENT == c )\r
- {\r
- dat_sr_read_comment(file);\r
- continue;\r
- } \r
- else \r
- {\r
- if ( DAT_SR_CHAR_QUOTE == c )\r
- {\r
- is_quoted_str = DAT_TRUE;\r
- }\r
-\r
- pos = cur_pos;\r
- token_len++;\r
- }\r
- }\r
- else /* looking for the end of the token */ \r
- {\r
- if ( EOF == c ) \r
- {\r
- break;\r
- }\r
- else if ( DAT_SR_CHAR_NEWLINE == c )\r
- {\r
- /* put back the newline */\r
- dat_os_fputc(file, c);\r
- break;\r
- }\r
- else if ( !is_quoted_str && dat_os_isblank(c) )\r
- {\r
- break;\r
- }\r
- else \r
- {\r
- token_len++;\r
- \r
- if ( (DAT_SR_CHAR_QUOTE == c) && !is_prev_char_backslash )\r
- {\r
- break;\r
- }\r
- else if ( (DAT_SR_CHAR_BACKSLASH == c) && !is_prev_char_backslash )\r
- {\r
- is_prev_char_backslash = DAT_TRUE;\r
- num_escape_seq++;\r
- }\r
- else \r
- {\r
- is_prev_char_backslash = DAT_FALSE;\r
- }\r
- }\r
- }\r
- }\r
-\r
- /* the token was a string */\r
- if ( DAT_SUCCESS != dat_os_fsetpos(file, &pos) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- if ( is_quoted_str )\r
- {\r
- if ( DAT_SUCCESS != dat_sr_read_quoted_str(file, \r
- token, \r
- token_len,\r
- num_escape_seq) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- if ( DAT_SUCCESS != dat_sr_read_str(file, \r
- token, \r
- token_len) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- }\r
-\r
- success:\r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_SR, \r
- "\n"\r
- "DAT Registry: token\n"\r
- " type %s\n"\r
- " value <%s>\n"\r
- "\n",\r
- dat_sr_type_to_str(token->type),\r
- ((DAT_SR_TOKEN_STRING == token->type) ? token->value : "") );\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_read_str\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_read_str (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token,\r
- DAT_OS_SIZE token_len)\r
-{\r
- token->type = DAT_SR_TOKEN_STRING;\r
- token->value_len = sizeof(char) * (token_len + 1); /* +1 for null termination */\r
- if ( NULL == (token->value = dat_os_alloc((int)token->value_len)) )\r
- {\r
- return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- }\r
-\r
- if ( token_len != dat_os_fread(file, token->value, token_len) )\r
- {\r
- dat_os_free(token->value, (int)token->value_len);\r
- token->value = NULL;\r
-\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-\r
- token->value[token->value_len - 1] = '\0';\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_read_quoted_str\r
- ***********************************************************************/\r
-\r
-DAT_RETURN\r
-dat_sr_read_quoted_str (\r
- DAT_OS_FILE *file, \r
- DAT_SR_TOKEN *token,\r
- DAT_OS_SIZE token_len,\r
- DAT_COUNT num_escape_seq)\r
-{\r
- DAT_OS_SIZE str_len;\r
- DAT_OS_SIZE i;\r
- DAT_OS_SIZE j;\r
- int c;\r
- DAT_RETURN status;\r
- DAT_BOOLEAN is_prev_char_backslash;\r
-\r
- str_len = token_len - 2; /* minus 2 " characters */\r
- is_prev_char_backslash = DAT_FALSE;\r
- status = DAT_SUCCESS;\r
-\r
- token->type = DAT_SR_TOKEN_STRING;\r
- /* +1 for null termination */\r
- token->value_len = sizeof(char) * (str_len - num_escape_seq + 1);\r
-\r
- if ( NULL == (token->value = dat_os_alloc((int)token->value_len)) )\r
- {\r
- status = DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;\r
- goto exit;\r
- }\r
-\r
- /* throw away " */\r
- if ( DAT_SR_CHAR_QUOTE != dat_os_fgetc(file) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- \r
- for ( i = 0, j = 0; i < str_len; i++ )\r
- { \r
- c = dat_os_fgetc(file);\r
-\r
- if ( EOF == c ) \r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
- else if ( (DAT_SR_CHAR_BACKSLASH == c) && !is_prev_char_backslash )\r
- {\r
- is_prev_char_backslash = DAT_TRUE;\r
- }\r
- else \r
- {\r
- token->value[j] = (DAT_UINT8)c;\r
- j++;\r
-\r
- is_prev_char_backslash = DAT_FALSE;\r
- }\r
- }\r
-\r
- /* throw away " */\r
- if ( DAT_SR_CHAR_QUOTE != dat_os_fgetc(file) )\r
- {\r
- status = DAT_INTERNAL_ERROR;\r
- goto exit;\r
- }\r
-\r
- token->value[token->value_len - 1] = '\0';\r
-\r
-exit:\r
- if ( DAT_SUCCESS != status )\r
- {\r
- if ( NULL != token->value )\r
- {\r
- dat_os_free(token->value, (int)token->value_len);\r
- token->value = NULL;\r
- }\r
- }\r
-\r
- return status;\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_sr_read_comment\r
- ***********************************************************************/\r
-\r
-void \r
-dat_sr_read_comment (\r
- DAT_OS_FILE *file)\r
-{\r
- int c;\r
-\r
- /* read up to an EOR or EOF to move past the comment */\r
- do \r
- {\r
- c = dat_os_fgetc(file);\r
- } while ( (DAT_SR_CHAR_NEWLINE != c) && (EOF != c) );\r
-\r
- /* put back the newline */\r
- dat_os_ungetc(file, c);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_sr_parser.h\r
- *\r
- * PURPOSE: static registry (SR) parser inteface declarations\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_SR_PARSER_H_\r
-#define _DAT_SR_PARSER_H_\r
-\r
-\r
-#include "dat_osd.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * The static registry exports the same interface regardless of \r
- * platform. The particular implementation of dat_sr_load() is \r
- * found with other platform dependent sources.\r
- */\r
-\r
-extern DAT_RETURN \r
-dat_sr_load (void);\r
-\r
-\r
-#endif /* _DAT_SR_PARSER_H_ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_osd.c\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description: \r
- * Provide OS dependent functions with a canonical DAPL\r
- * interface. Designed to be portable and hide OS specific quirks\r
- * of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#include "dat_osd.h"\r
-#include "dat_init.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Constants *\r
- * *\r
- *********************************************************************/\r
-\r
-#define DAT_DBG_LEVEL_ENV "DAT_DBG_LEVEL"\r
-#define DAT_DBG_DEST_ENV "DAT_DBG_DEST"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Enumerations *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef int DAT_OS_DBG_DEST;\r
-\r
-typedef enum\r
-{\r
- DAT_OS_DBG_DEST_STDOUT = 0x1,\r
-} DAT_OS_DBG_DEST_TYPE;\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Global Variables *\r
- * *\r
- *********************************************************************/\r
-\r
-static DAT_OS_DBG_TYPE_VAL g_dbg_type = DAT_OS_DBG_TYPE_ERROR;\r
-static DAT_OS_DBG_DEST g_dbg_dest = DAT_OS_DBG_DEST_STDOUT;\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_dbg_set_level\r
- ***********************************************************************/\r
-\r
-void\r
-dat_os_dbg_init ( void )\r
-{\r
- char *dbg_type;\r
- char *dbg_dest;\r
-\r
- dbg_type = dat_os_getenv (DAT_DBG_LEVEL_ENV);\r
- if ( dbg_type != NULL )\r
- {\r
- g_dbg_type = dat_os_strtol(dbg_type, NULL, 0);\r
- }\r
-\r
- dbg_dest = dat_os_getenv (DAT_DBG_DEST_ENV);\r
- if ( dbg_dest != NULL )\r
- {\r
- g_dbg_dest = dat_os_strtol(dbg_dest, NULL, 0);\r
- }\r
-}\r
-\r
-\r
-/***********************************************************************\r
- * Function: dat_os_dbg_print\r
- ***********************************************************************/\r
-\r
-void \r
-dat_os_dbg_print ( \r
- DAT_OS_DBG_TYPE_VAL type, \r
- const char * fmt, \r
- ...)\r
-{\r
- if ( (DAT_OS_DBG_TYPE_ERROR == type) || (type & g_dbg_type) )\r
- {\r
- va_list args;\r
- \r
- va_start(args, fmt);\r
-\r
- if ( DAT_OS_DBG_DEST_STDOUT & g_dbg_dest )\r
- {\r
- vfprintf(stdout, fmt, args);\r
- }\r
-\r
- va_end(args);\r
-\r
- fflush(stdout);\r
- }\r
-}\r
-\r
-\r
-BOOL APIENTRY\r
-DllMain(\r
- IN HINSTANCE h_module,\r
- IN DWORD ul_reason_for_call, \r
- IN LPVOID lp_reserved )\r
-{\r
- UNREFERENCED_PARAMETER( lp_reserved );\r
-\r
- switch( ul_reason_for_call )\r
- {\r
- case DLL_PROCESS_ATTACH:\r
- DisableThreadLibraryCalls( h_module );\r
- dat_init();\r
- break;\r
-\r
- case DLL_PROCESS_DETACH:\r
- dat_fini();\r
- }\r
- return TRUE;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * HEADER: dat_osd.h\r
- *\r
- * PURPOSE: Operating System Dependent layer\r
- * Description:\r
- * Provide OS dependent data structures & functions with\r
- * a canonical DAPL interface. Designed to be portable\r
- * and hide OS specific quirks of common functions.\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_OSD_H_\r
-#define _DAT_OSD_H_\r
-\r
-/*\r
- * This file is defined for windows systems only, including it on any\r
- * other build will cause an error\r
- */\r
-#ifndef WIN32\r
-#error "UNDEFINED OS TYPE"\r
-#endif /* WIN32 */\r
-\r
-#include <dat/udat.h>\r
-#include <dat/dat_registry.h>\r
-\r
-#include <windows.h>\r
-#include <assert.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <stdarg.h>\r
-\r
-#ifndef STATIC\r
-#define STATIC static\r
-#endif /* STATIC */\r
-\r
-#ifndef INLINE\r
-#define INLINE __inline\r
-#endif /* INLINE */\r
-\r
-/*********************************************************************\r
- * *\r
- * Debuging *\r
- * *\r
- *********************************************************************/\r
-\r
-#define dat_os_assert(expr) assert(expr)\r
-\r
-typedef int DAT_OS_DBG_TYPE_VAL;\r
-\r
-typedef enum\r
-{\r
- DAT_OS_DBG_TYPE_ERROR = 0x1,\r
- DAT_OS_DBG_TYPE_GENERIC = 0x2,\r
- DAT_OS_DBG_TYPE_SR = 0x4,\r
- DAT_OS_DBG_TYPE_DR = 0x8,\r
- DAT_OS_DBG_TYPE_PROVIDER_API = 0x10,\r
- DAT_OS_DBG_TYPE_CONSUMER_API = 0x20,\r
- DAT_OS_DBG_TYPE_ALL = 0xff\r
-} DAT_OS_DBG_TYPE_TYPE;\r
-\r
-extern void\r
-dat_os_dbg_init ( void );\r
-\r
-extern void \r
-dat_os_dbg_print ( \r
- DAT_OS_DBG_TYPE_VAL type, \r
- const char * fmt, \r
- ...);\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Utility Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-#define DAT_ERROR(Type,SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))\r
-\r
-typedef size_t DAT_OS_SIZE;\r
-typedef HMODULE DAT_OS_LIBRARY_HANDLE;\r
-\r
-STATIC INLINE DAT_RETURN\r
-dat_os_library_load (\r
- const char *library_path,\r
- DAT_OS_LIBRARY_HANDLE *library_handle_ptr)\r
-{\r
- DAT_OS_LIBRARY_HANDLE library_handle;\r
-\r
- if ( NULL != (library_handle = LoadLibrary(library_path)) )\r
- {\r
- if ( NULL != library_handle_ptr ) \r
- { \r
- *library_handle_ptr = library_handle; \r
- }\r
- \r
- return DAT_SUCCESS;\r
- }\r
- else\r
- { \r
- dat_os_dbg_print(DAT_OS_DBG_TYPE_ERROR,\r
- "DAT: library load failure\n");\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-#ifdef WIN32_LEAN_AND_MEAN\r
-#define dat_os_library_sym GetProcAddress\r
-#else\r
-STATIC INLINE\r
-dat_os_library_sym (\r
- DAT_OS_LIBRARY_HANDLE library_handle,\r
- char *sym)\r
-{\r
- return GetProcAddress(library_handle, sym);\r
-}\r
-#endif /* WIN32_LEAN_AND_MEAN */\r
-STATIC INLINE DAT_RETURN\r
-dat_os_library_unload (\r
- const DAT_OS_LIBRARY_HANDLE library_handle)\r
-{\r
- if ( 0 == FreeLibrary(library_handle) )\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- else \r
- {\r
- return DAT_SUCCESS;\r
- }\r
-}\r
-\r
-STATIC INLINE char *\r
-dat_os_getenv (\r
- const char *name)\r
-{\r
- return getenv(name);\r
-}\r
-\r
-STATIC INLINE long int\r
-dat_os_strtol (\r
- const char *nptr, \r
- char **endptr, \r
- int base)\r
-{\r
- return strtol(nptr, endptr, base);\r
-}\r
-\r
-STATIC INLINE DAT_OS_SIZE\r
-dat_os_strlen (\r
- const char *s )\r
-{\r
- return strlen(s);\r
-}\r
-\r
-STATIC INLINE int\r
-dat_os_strncmp (\r
- const char *s1, \r
- const char *s2, \r
- DAT_OS_SIZE n)\r
-{\r
- return strncmp(s1, s2, n);\r
-}\r
-\r
-STATIC INLINE void * \r
-dat_os_strncpy (\r
- char *dest, \r
- const char *src, \r
- DAT_OS_SIZE len)\r
-{\r
- return strncpy (dest, src, len);\r
-}\r
-\r
-STATIC INLINE DAT_BOOLEAN\r
-dat_os_isblank( \r
- int c)\r
-{\r
- if ( (' ' == c) || ('\t' == c) ) { return DAT_TRUE; }\r
- else { return DAT_FALSE; }\r
-}\r
-\r
-STATIC INLINE DAT_BOOLEAN\r
-dat_os_isdigit( \r
- int c)\r
-{\r
- if ( isdigit(c) ) { return DAT_TRUE; }\r
- else { return DAT_FALSE; }\r
-}\r
-\r
-STATIC INLINE void \r
-dat_os_usleep( \r
- unsigned long usec)\r
-{\r
- Sleep(usec/1000);\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Memory Functions *\r
- * *\r
- *********************************************************************/\r
-\r
-STATIC INLINE void *\r
-dat_os_alloc (\r
- int size)\r
-{\r
- return malloc (size);\r
-}\r
-\r
-STATIC INLINE void \r
-dat_os_free (\r
- void *ptr, \r
- int size)\r
-{\r
- free (ptr);\r
-}\r
-\r
-STATIC INLINE void * \r
-dat_os_memset (void *loc, int c, DAT_OS_SIZE size)\r
-{\r
- return memset (loc, c, size);\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * File I/O *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef FILE DAT_OS_FILE;\r
-typedef fpos_t DAT_OS_FILE_POS;\r
-\r
-\r
-STATIC INLINE DAT_OS_FILE *\r
-dat_os_fopen (\r
- const char * path)\r
-{\r
- /* always open files in read only mode*/\r
- return fopen(path, "r");\r
-}\r
-\r
-STATIC INLINE DAT_RETURN\r
-dat_os_fgetpos ( \r
- DAT_OS_FILE *file, \r
- DAT_OS_FILE_POS *pos)\r
-{\r
- if ( 0 == fgetpos(file, pos) )\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-STATIC INLINE DAT_RETURN\r
-dat_os_fsetpos ( \r
- DAT_OS_FILE *file, \r
- DAT_OS_FILE_POS *pos)\r
-{\r
- if ( 0 == fsetpos(file, pos) )\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-/* dat_os_fgetc() returns EOF on error or end of file. */\r
-STATIC INLINE int\r
-dat_os_fgetc ( \r
- DAT_OS_FILE *file)\r
-{\r
- return fgetc(file);\r
-}\r
-\r
-/* dat_os_fputc() returns int c or EOF on error */\r
-STATIC INLINE int\r
-dat_os_fputc ( \r
- DAT_OS_FILE *file, int c)\r
-{\r
- return fputc(c, file);\r
-}\r
-\r
-/* dat_os_ungetc() pushd 'c' back into stream for subsequent read.\r
- * returns EOF on error or pushed char c.\r
- */\r
-STATIC INLINE int\r
-dat_os_ungetc ( \r
- DAT_OS_FILE *file, int c)\r
-{\r
- return ungetc(c, file);\r
-}\r
-\r
-/* dat_os_fread returns the number of bytes read from the file. */\r
-STATIC INLINE DAT_OS_SIZE\r
-dat_os_fread (\r
- DAT_OS_FILE *file,\r
- char *buf, \r
- DAT_OS_SIZE len)\r
-{\r
- return fread(buf, sizeof(char), len, file);\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_fclose (\r
- DAT_OS_FILE *file)\r
-{\r
- if ( 0 == fclose(file) )\r
- {\r
- return DAT_SUCCESS;\r
- }\r
- else\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Locks *\r
- * *\r
- *********************************************************************/\r
-\r
-typedef HANDLE DAT_OS_LOCK;\r
-\r
-/* lock functions */\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock_init (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- *m = CreateMutex (0, FALSE, 0);\r
- if (*(HANDLE *)m == NULL)\r
- {\r
- return DAT_INTERNAL_ERROR;\r
- }\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- WaitForSingleObject(*m, INFINITE);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_unlock (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- ReleaseMutex (*m);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-STATIC INLINE DAT_RETURN \r
-dat_os_lock_destroy (\r
- IN DAT_OS_LOCK *m)\r
-{\r
- CloseHandle (*m);\r
-\r
- return DAT_SUCCESS;\r
-}\r
-\r
-\r
-#endif /* _DAT_OSD_H_ */\r
-\r
-/*\r
- * Local variables:\r
- * c-indent-level: 4\r
- * c-basic-offset: 4\r
- * tab-width: 8\r
- * End:\r
- */\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
- * \r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-/**********************************************************************\r
- * \r
- * MODULE: dat_osd_sr.h\r
- *\r
- * PURPOSE: static registry (SR) platform specific inteface declarations\r
- *\r
- * $Id$\r
- **********************************************************************/\r
-\r
-#ifndef _DAT_OSD_SR_H_\r
-#define _DAT_OSD_SR_H_\r
-\r
-\r
-#include "dat_osd.h"\r
-\r
-\r
-/*********************************************************************\r
- * *\r
- * Function Declarations *\r
- * *\r
- *********************************************************************/\r
-\r
-/*\r
- * The static registry exports the same interface regardless of \r
- * platform. The particular implementation of dat_sr_load() is \r
- * found with other platform dependent sources.\r
- */\r
-\r
-extern DAT_RETURN \r
-dat_sr_load (void);\r
-\r
-\r
-#endif /* _DAT_OSD_SR_H_ */\r
+++ /dev/null
-EXPORTS\r
-\r
-dat_init\r
-dat_fini\r
-dat_registry_add_provider\r
-dat_registry_remove_provider\r
-dat_registry_list_providers\r
-dat_ia_openv\r
-dat_ia_close\r
+++ /dev/null
-DIRS=\\r
- test \\r
- dat \\r
- dapl\r
+++ /dev/null
-#######################################################################\r
-# #\r
-# DAPL Coding style reference #\r
-# #\r
-# Steve Sears #\r
-# sjs2 at users.sourceforge.net #\r
-# #\r
-# 12/13/2002 #\r
-# #\r
-#######################################################################\r
-\r
-======================================================================\r
-Introduction\r
-======================================================================\r
-\r
-The purpose of this document is to establish the coding style adopted by\r
-the team implementing the DAPL reference implementation. The rules\r
-presented here were arrived at by consensus, they are intended to\r
-provide consistency of implementation and make it intuitive to work with\r
-the source code.\r
-\r
-======================================================================\r
-Source code conventions\r
-======================================================================\r
-\r
-1. Brackets\r
-\r
- Brackets should follow C99 conventions and declare a block. The\r
- following convention is followed:\r
-\r
- if (x)\r
- {\r
- statement;\r
- statement;\r
- }\r
-\r
- The following bracket styles are to be avoided:\r
-\r
- K&R style:\r
-\r
- if (x) { /* DON'T DO THIS */\r
- statement;\r
- }\r
-\r
- GNU style:\r
-\r
- if (x) /* DON'T DO THIS */\r
- {\r
- statement;\r
- }\r
-\r
- Statements are always indented from brackets.\r
-\r
- Brackets are always used for any statement in order to avoid dangling\r
- clause bugs. E.g.\r
-\r
- RIGHT:\r
- if ( x )\r
- {\r
- j = 0;\r
- }\r
-\r
- WRONG:\r
- if ( x )\r
- j = 0;\r
-\r
-2. Indents\r
-\r
- Indents are always 4, tabs 8. A tab may serve as a double\r
- indent. Many of the reference implementation file have an emacs\r
- format statement at the bottom.\r
-\r
-3. Comments\r
-\r
- Comments are always full C style comments, and never C++\r
- style. Comments take the form:\r
-\r
- /*\r
- * comment\r
- */\r
-\r
-4. Variable Declarations\r
-\r
- Variables are always declared on their own line, we do not declare\r
- multiple variables on the same line.\r
-\r
- Variables are never initialized in their declaration, they are\r
- initialized in the body of the code.\r
-\r
-5. Function Declarations\r
-\r
- The return type of a function is declared on a separate line from the\r
- function name.\r
-\r
- Parameters each receive a line and should be clearly labeled as IN\r
- or OUT or INOUT. Parameter declarations begin one tab stop from the\r
- margin.\r
-\r
- For example:\r
-\r
- DAT_RETURN\r
- dapl_function (\r
- IN DAT_IA_HANDLE ia_handle,\r
- OUT DAT_EP_HANDLE *ep_handle )\r
- {\r
- ... function body ...\r
- }\r
-\r
-5. White space\r
-\r
- Don't be afraid of white space, the goal is to make the code readable\r
- and maintainable. We use white space:\r
-\r
- - One space following function names or conditional expressions. It\r
- might be better to say one space before any open parenthesis.\r
-\r
- - Suggestion: One space following open parens and one space before\r
- closing parens. Not all of the code follows this convention, use\r
- your best judgment.\r
-\r
- Example:\r
-\r
- foo ( x1, x2 );\r
-\r
-6. Conditional code\r
-\r
- We generally try to avoid conditional compilation, but there are\r
- certain places where it cannot be avoided. Whenever possible, move\r
- the conditional code into a macro or otherwise work to put it into an\r
- include file that can be used by the platform (e.g. Linux or Windows\r
- osd files), or by the underlying provider (e.g. IBM Torrent or\r
- Mellanox Tavor).\r
-\r
- Conditionals should be descriptive, and the associated #endif should\r
- contain the declaration. E.g.\r
-\r
- #ifdef THIS_IS_AN_EXAMPLE\r
-\r
- /* code */\r
-\r
- #endif /* THIS_IS_AN_EXAMPLE */\r
-\r
- You may change the ending comment if a #else clause is present. E.g.\r
- \r
- #ifdef THIS_IS_AN_EXAMPLE\r
- /* code */\r
-\r
- #else\r
- /* other code */\r
-\r
- #endif /* !THIS_IS_AN_EXAMPLE */\r
- \r
-\r
-======================================================================\r
-Naming conventions\r
-======================================================================\r
-\r
-1. Variable Names\r
-\r
- Variable names for DAPL data structures generally follow their type\r
- and should be the same in all source files. A few examples:\r
-\r
- Handles\r
- DAT_IA_HANDLE ia_handle\r
- DAT_EP_HANDLE ep_handle\r
-\r
- Pointers\r
-\r
- DAPL_IA *ia_ptr;\r
- DAPL_EP *ep_ptr;\r
-\r
-2. Return Code Names\r
-\r
- There are at least two different subsystems supported in the DAPL\r
- reference implementation. In order to bring sanity to the error\r
- space, return codes are named and used for their appropriate\r
- subsystem. E.g.\r
-\r
- ib_status: InfiniBand status return code\r
- dat_status: DAT/DAPL return code\r
-\r
-3. Function Names\r
-\r
- Function names describe the scope to which they apply. There are\r
- essentially three names in the reference implementation:\r
-\r
- dapl_* Name of an exported function visible externally.\r
- These functions have a 1 to 1 correspondence to\r
- their DAT counterparts.\r
-\r
- dapls_* Name of a function that is called from more than one\r
- source file, but is limited to a subsystem.\r
-\r
- dapli_* Local function, internal to a file. Should always be\r
- of type STATIC.\r
-\r
-\r
-======================================================================\r
-Util files\r
-======================================================================\r
-\r
-The Reference implementation is organized such that a single, exported\r
-function is located in its' own file. If you are trying to find the DAPL\r
-function to create and End Point, it will be found in the dapl version\r
-of the DAT function in the spec. E.g.\r
-\r
-dapl_ep_create() is found in dapl_ep_create.c\r
-dapl_evd_free() is found in dapl_evd_free.c\r
-\r
-It is often the case that the implementation must interact with data\r
-structures or call into other subsystems. All utility functions for a\r
-subsystem are gathered into the appropriate "util" file. \r
-\r
-For example, dapl_ep_create must allocate a DAPL_EP structure. The\r
-routine to allocate and initialize memory is found in the\r
-dapl_ep_util.c file and is named dapl_ep_alloc(). Appropriate routines\r
-for the util file are\r
-\r
- - Alloc\r
- - Free\r
- - Assign defaults\r
- - linking routines\r
- - Check restrictions\r
- - Perform operations on a data structure.\r
-\r
-The idea of a util file is an object oriented idea for a non OO\r
-language. It encourages a clean implementation.\r
-\r
-For each util.c file, there is also a util.h file. The purpose of the\r
-util include file is to define the prototypes for the util file, and to\r
-supply any local flags or values necessary to the subsystem.\r
-\r
-======================================================================\r
-Include files, prototypes\r
-======================================================================\r
-\r
-Include files are organized according to subsystem and/or OS\r
-platform. The include directory contains files that are global to the\r
-entire source set. Prototypes are found in include files that pertain to\r
-the data they support.\r
-\r
-Commenting on the DAPL Reference Implementation tree:\r
-\r
- dapl/common\r
- dapl/include\r
- Contains global dapl data structures, symbols, and\r
- prototypes\r
- dapl/tavor\r
- Contains tavor prototypes and symbols\r
- dapl/torrent\r
- Contains torrent prototypes and symbols\r
- dapl/udapl\r
- Contains include files to support udapl specific files\r
- dapl/udapl/linux\r
- Contains osd files for Linux\r
- dapl/udapl/windows\r
- Contains osd files for Windows\r
-\r
-For completeness, the dat files described by the DAT Specification are\r
-in the tree under the dat/ subdirectory,\r
-\r
- dat/include/dat/\r
-\r
-\r
+++ /dev/null
-#######################################################################\r
-# #\r
-# DAPL End Point Management Design #\r
-# #\r
-# Steve Sears #\r
-# sjs2 at users.sourceforge.net #\r
-# #\r
-# 10/04/2002 #\r
-# #\r
-#######################################################################\r
-\r
-\r
-======================================================================\r
-Referenced Documents\r
-======================================================================\r
-\r
-uDAPL: User Direct Access Programming Library, Version 1.0. Published\r
-6/21/2002. http://www.datcollaborative.org/uDAPL_062102.pdf.\r
-Referred to in this document as the "DAT Specification".\r
-\r
-InfiniBand Access Application Programming Interface Specification,\r
-Version 1.2, 4/15/2002. In DAPL SourceForge repository at\r
-doc/api/access_api.pdf. Referred to in this document as the "IBM\r
-Access API Specification".\r
-\r
-InfiniBand Architecture Specification Volume 1, Release 1.0.a Referred\r
-to in this document at the "InfiniBand Spec".\r
-\r
-======================================================================\r
-Introduction to EndPoints\r
-======================================================================\r
-\r
-An EndPoint is the fundamental channel abstraction for the DAT API. An\r
-application communicates and exchanges data using an\r
-EndPoint. Most of the time EndPoints are explicitly allocated, but\r
-there is an exception whereby a connection event can yield an EndPoint\r
-as a side effect; this is not supported by all transports or\r
-implementations, and it is not currently supported in the InfiniBand\r
-reference implementation.\r
-\r
-Each DAT API function is implemented in a file named \r
-\r
- dapl_<function name>.c\r
-\r
-There is a simple mapping provided by the dat library that maps\r
-dat_* to dapl_*. For example, dat_pz_create is implemented in\r
-dapl_pz_create.c. For example:\r
-\r
- DAT DAPL Found in\r
- ------------ --------------- ------------------\r
- dat_ep_create dapl_ep_create dapl_ep_create.c\r
- dat_ep_query dapl_ep_query dapl_ep_query.c\r
-\r
-There are very few exceptions to this naming convention, the Reference\r
-Implementation tried to be consistent.\r
-\r
-There are also dapl_<object name>_util.{h,c} files for each object.\r
-For example, there are dapl_pz_util.h and dapl_pz_util.c files which\r
-contain common helper functions specific to the 'pz' subsystem. The\r
-use of util files follows the convention used elsewhere in the DAPL\r
-reference implementation. These files contain common object creation\r
-and destruction code, link list manipulation, other helper functions.\r
-\r
-This implementation has a simple naming convention designed to alert\r
-someone reading the source code to the nature and scope of a\r
-function. The convention is in the function name, such that:\r
-\r
- dapl_ Primary entry from a dat_ function, e.g. \r
- dapl_ep_create(), which mirrors dat_ep_create(). \r
- dapls_ The 's' restricts it to the subsystem, e.g. the\r
- 'ep' subsystem. dapls_ functions are not exposed\r
- externally, but are internal to dapl.\r
- dapli_ The 'i' restricts the function to the file where it \r
- is declared. These functions are always 'static' C\r
- functions.\r
-\r
-1. EndPoints (EPs)\r
--------------------------\r
-DAPL EndPoints provide a channel abstraction necessary to transmit and\r
-receive data. EndPoints interact with Service Points, either Public\r
-Service Points or Reserved Service Points, to establish a connection\r
-from one provider to another.\r
-\r
-The primary EP entry points in the DAT API as they relate to DAPL are\r
-listed in the following table:\r
-\r
- dat_ep_create \r
- dat_ep_query \r
- dat_ep_modify \r
- dat_ep_connect \r
- dat_ep_dup_connect \r
- dat_ep_disconnect \r
- dat_ep_post_send \r
- dat_ep_post_recv \r
- dat_ep_post_rdma_read \r
- dat_ep_post_rdma_write\r
- dat_ep_get_status \r
- dat_ep_free \r
-\r
-Additionally, the following connection functions interact with\r
-EndPoints:\r
- dat_psp_create \r
- dat_psp_query \r
- dat_psp_free \r
- dat_rsp_create \r
- dat_rsp_query \r
- dat_rsp_free \r
-\r
-The reference implementation maps the EndPoint abstraction onto an\r
-InfiniBand Queue Pair (QP).\r
-\r
-The DAPL_EP structure is used to maintain the state and components of\r
-the EP object and the underlying QP. As will be explained below,\r
-keeping track of the QP state is critical for successful\r
-operation. Accesses to the DAPL_EP fields are done atomically.\r
-\r
-\r
-======================================================================\r
-Goals\r
-======================================================================\r
-\r
-Initial goals\r
--------------\r
--- Implement the dat_ep_* calls described in the DAT Specification with\r
- the following exceptions:\r
- - dat_dup_connect\r
- - the timeout value of dap_ep_connect\r
-\r
--- Implement connection calls described in the DAT Specification with\r
- the following exceptions:\r
- - dat_rsp_* calls\r
- - support for DAT_PSP_PROVIDER flag on PSP creation\r
-\r
--- The implementation should be as portable as possible, to facilitate\r
- HCA Vendors efforts to implement vendor-specific versions of DAPL.\r
-\r
--- The implementation must be able to work during ongoing development\r
- of InfiniBand agents, drivers, etc.\r
-\r
-Later goals\r
------------\r
--- Examine various possible performance optimizations. This document\r
- lists potential performance improvements, but the specific\r
- performance improvements implemented should be guided by customer\r
- requirements. \r
-\r
--- Implement the dat_rsp_* calls described in the DAT 1.0 spec\r
-\r
--- Implement dat_dup_connect\r
-\r
--- Resolve the timeout issue for dat_ep_connect\r
-\r
--- Implement DAT_PSP_PROVIDER flag on PSP creation\r
-\r
--- Remove hacks & work arounds necessitated by developing IB\r
- implementations.\r
-\r
-============================================\r
-Requirements, constraints, and design inputs\r
-============================================\r
-\r
-The EndPoint is the base channel abstraction. An Endpoint must be\r
-established before data can be exchanged with a remote node. The\r
-EndPoint is mapped to the underlying InfiniBand QP channel\r
-abstraction. When a connection is initiated, the InfiniBand\r
-Connection Manager will be solicited. The implementation is\r
-constrained by the capabilities and behavior of the underlying\r
-InfiniBand facilities.\r
-\r
-An EP is not an exact match to an InfiniBand QP, the differences\r
-introduce constraints that are not obvious. There are three primary\r
-areas of conflict between the DAPL and InfiniBand models:\r
-\r
-1) EP and QP creation differences\r
-2) Provider provided EPs on passive side of connections\r
-3) Connection timeouts\r
-\r
--- EP and QP creation\r
-\r
-The most obvious difference between an EP and a QP is the presence of\r
-a memory handle with the object is created. InfiniBand requires a\r
-Protection Domain be specified when a QP is created; in the DAPL\r
-world, a Protection Zone (PZ) maps to an InfiniBand Protection Domain.\r
-DAPL does not require a PZ to be present when an EP is created, and\r
-that introduces two problems:\r
-\r
-1) If a PZ is NULL when an EP is created, a QP will not be bound to\r
- the EP until dat_ep_modify is used to assign it later. A PZ is\r
- required before RECV requests can be posted and before a connection\r
- can be established.\r
-\r
-2) If a DAPL user changes the PZ on an EP before it is connected,\r
- DAPL must release the current QP and create a new one with a\r
- new Protection Domain.\r
-\r
--- Provider provided EPs on connection\r
-\r
-The second area where the DAPL and IB models conflict is a direct result\r
-of the requirement to specify a Protection Domain when a QP is created.\r
-\r
-DAPL allows a PSP to be created in such a way that an EP will\r
-automatically be provided to the user when a connection occurs. This\r
-is not critical to the DAPL model but in fact does provide some\r
-convenience to the user. InfiniBand provides a similar mechanism, but\r
-with an important difference: InfiniBand requires the user to supply\r
-the Protection Domain for the passive connection endpoint that will be\r
-supplied to all QPs created as a result of connection requests; DAPL\r
-mandates a NULL PZ and requires the user to change the PZ before using\r
-the EP.\r
-\r
-The reference implementation will create an 'empty' EP when the user\r
-specifies the DAT_PSP_PROVIDER flag; it is empty in the sense that a\r
-QP is not attached to the EP. Before the user can dat_cr_accept the\r
-connection, the EP must be modified to have a PZ bound to it, which in\r
-turn will cause a QP to be bound to the EP.\r
-\r
--- Connection Timeouts\r
-\r
-The third difference in the DAPL and InfiniBand models has to do with\r
-timeouts on connections. InfiniBand does not provide a way to specify\r
-a connection timeout, it will wait indefinitely for a connection to\r
-occur. dat_ep_connect supports a timeout value providing the user with\r
-control over how long they are willing to wait for a connection to\r
-occur. The initial implementation does not resolve this mismatch,\r
-although it could be resolved with a separate timeout thread that will\r
-wakeup and terminate the connection request.\r
-\r
-======================================================================\r
-DAPL EP Subsystem Design\r
-======================================================================\r
-\r
-In section 6.5.1 of the DAT Specification there is a UML state\r
-transition diagram for an EndPoint which goes over the transitions and\r
-states during the lifetime of an EP. It is nearly impossible to read.\r
-The reference implementation is faithful to the DAT Spec and is\r
-believed to be correct.\r
-\r
-This description of the EP will follow from creation to connection to\r
-termination. It will also discuss the source code organization as this\r
-is part of the design expression.\r
-\r
--- EP and QP creation\r
-\r
-The preamble to creating an EP requires us to verify the attributes\r
-specified by the user. If a user were to specify max_recv_dtos as 0,\r
-for example, the EP would not be useful in any regard. If the user\r
-does not provide EP attrs, the DAPL layer will supply a set of common\r
-defaults resulting in a reasonable EP.\r
-\r
-A number of handles are bound to the EP, so a reference count is taken\r
-on each of them. All reference counts in the DAPL system are\r
-incremented or decremented using atomic operations; it is important to\r
-always use the OS dependent atomic routines and not substitute a lock,\r
-as it will not be observed elsewhere in the system and will have\r
-unpredictable results.\r
-\r
-As has been discussed above, each EP is bound to a QP before it can be\r
-connected. If a valid PZ is provided at creation time then a QP is bound\r
-to the EP immediately. If the user later uses ep_modify to change the PZ,\r
-the QP will be destroyed and a new one created with the appropriate\r
-Protection Domain.\r
-\r
-Finally, an EP is an IA resource and is linked onto the EP chain of\r
-the superior IA. EP's linked onto an IA are assumed to be complete,\r
-so this is the final step of EP creation.\r
-\r
-After an EP is created, the ep_state will be DAT_EP_STATE_UNCONNECTED\r
-and the qp_state will either be DAPL_QP_STATE_UNATTACHED or\r
-IB_QP_STATE_INIT. The qp_state indicates the QP binding and the\r
-current state of the QP.\r
-\r
-A qp_state of DAPL_QP_STATE_UNATTACHED indicates there is no QP bound\r
-to this EP. This is a result of a NULL PZ when dat_ep_create was\r
-invoked, and which has been explained in detail above. The user must\r
-call dat_ep_modify and install a valid PZ before the EP can be used.\r
-\r
-When a QP is created it is in the RESET state, which is specified in\r
-the InfiniBand Spec, section 10.3. However, DAPL requires an\r
-unconnected EP to be able to queue RECV requests before a connection\r
-occurs. The InfiniBand spec allows RECV requests to be queued on an QP\r
-if the QP is in the INIT state, so after creating a QP the DAPL code\r
-will transition it to the INIT state.\r
-\r
-There is an obvious design tradeoff in transitioning the QP\r
-state. Immediately moving the state to INIT takes extra time at\r
-creation but allows immediate posting of RECV operations; however, it\r
-will involve a more complex tear down procedure if the QP must be\r
-replaced as a side effect of a dat_ep_modify operation. The\r
-alternative would be to delay transitioning the QP to INIT until a\r
-post operation is invoked, but that requires a run time check for\r
-every post operation. This design assumes users will infrequently\r
-cause a QP to be replaced after it is created and prefer to pay the\r
-state transition penalty at creation time.\r
-\r
--- EP Query and Modify operations\r
-\r
-Because all of the ep_param data are kept up to date in the dapl_ep\r
-structure, and because they use the complete DAT specified structure, a\r
-query operation is trivial; a simple assignment from the internal\r
-structure to the user parameter. uDAPL allows the implementation to\r
-either return the fields specified by the user, or to return more than\r
-the user requested; the reference implementation does the latter. It is\r
-simpler and faster to copy the entire structure rather than to determine\r
-which of all of the possible fields the user requested.\r
-\r
-The ep_modify operation will modify the fields in the DAT_PARAM\r
-structure. There are some fields that cannot be updated, and there are\r
-others that can only be updated if the EP is in the correct state. The\r
-uDAPL spec outlines the EP states permitting ep modifications, but\r
-generally they are DAT_EP_STATE_UNCONNECTED and\r
-DAT_EP_STATE_PASSIVE_CONNECTION_PENDING.\r
-\r
-When replacing EVD handles it is a simple matter of releasing a\r
-reference on the previous handle and taking a new reference on the new\r
-handle. All of the implementation does resource tracking using\r
-reference counts, which guarantees a particular handle will not be\r
-released prematurely. Reference counts are checked in the free\r
-routines for various objects.\r
-\r
-As has been mentioned previously, if the PZ handle is changed then the\r
-QP must be released, if there is one, and a new QP must be created to\r
-bind to this EP.\r
-\r
-There are some fields in the DAT_PARAM structure that are related to the\r
-underlying hardware implementation. For these values DAPL will do a\r
-fresh query of the QP, rather than depend on stale values. Even so, the\r
-values returned are 'best effort' as a competing thread may change\r
-certain values before the requesting thread has the opportunity to read\r
-them. Applications should protect against this.\r
-\r
-Finally, the underlying IB provider is invoked to update the QP with\r
-the new values, but only if some of the attributes have been changed.\r
-As is true of most of the implementation, we only invoke the provider\r
-code when necessary.\r
-\r
-======================================================================\r
-Connections\r
-======================================================================\r
-\r
-There are of course two sides to a connection, and in the DAPL PSP model\r
-there is an Active and a Passive side. For clarity, the Passive side\r
-is a server waiting for a connection, and the Active side is a client\r
-requesting a connection from the Passive server. We will discuss each\r
-of these in turn.\r
-\r
-Connections happen in the InfiniBand world by using a Connection Manager\r
-interface. Those unfamiliar with the IB model of addressing and\r
-management agents may want to familiarize themselves with these aspects of\r
-the IB spec before proceeding in this document.\r
-\r
-First, let's walk through a primitive diagram of a connection:\r
-\r
-\r
-SERVER (passive) CLIENT (active)\r
---------------- ---------------\r
-1. dapl_psp_create\r
- [ now listening ]\r
-\r
-2. dapl_ep_connect\r
- <-------------\r
-3. dapls_cr_callback\r
- IB_CME_CONNECTION_REQUEST_PENDING_PRIVATE_DATA\r
- [ Create and post a DAT_CONNECTION_REQUEST_EVENT event ]\r
-\r
-4. Event code processing\r
-\r
-5. Create an EP (unless PSP created)\r
-\r
-6. dapl_cr_accept or dapl_cr_reject\r
- ------------->\r
-7. dapl_evd_connection_callback\r
- IB_CME_CONNECTED\r
- [ Create and post a\r
- DAT_CONNECTION_EVENT_ESTABLISHED\r
- event ]\r
-\r
-8i. <------------- RTU\r
-\r
-9. dapls_cr_callback\r
- IB_CME_CONNECTED\r
- [ Create and post a DAT_CONNECTION_EVENT_ESTABLISHED \r
- event ]\r
-\r
-10. ...processing...\r
-\r
-11. Either side issues a dat_ep_disconnect\r
-\r
-12. dapls_cr_callback\r
- IB_CME_DISCONNECTED\r
-\r
- [ Create and post a \r
- DAT_CONNECTION_EVENT_DISCONNECTED\r
- event ]\r
-\r
-13. dapl_evd_connection_callback\r
- IB_CME_DISCONNECTED\r
- [ Create and post a\r
- DAT_CONNECTION_EVENT_DISCONNECTED\r
- event ]\r
-\r
-\r
-In the above diagram, time is numbered in the left hand column and is\r
-represented vertically.\r
-\r
-We will continue our discussion of connections using the above\r
-diagram, following a sequential order for connection establishment.\r
-\r
-There are in fact two types of service points detailed in the uDAPL\r
-specification. At this time only the PSP model, which is a client\r
-server model, has been implemented, so our discussion will focus\r
-there.\r
-\r
-The reader should observe that all passive side connection events will\r
-be received by dapls_cr_callback(), and all active side connection\r
-events occur through dapl_evd_connection_callback(). At one point\r
-during the implementation these routines were combined as they are\r
-very similar, but there are subtle differences causing them to remain\r
-separate.\r
-\r
-Progressing through the series of events as outlined in the diagram\r
-above:\r
-\r
-1. dapl_psp_create\r
-\r
- When a PSP is created, the final act will be to set it listening\r
- for connections from remote nodes. It is important to realize that\r
- a connection may in fact arrive from a remote node before the\r
- routine setting up a listener has returned to dapl_psp_create; as\r
- soon as dapls_ib_setup_conn_listener() is invoked connection\r
- callbacks may arrive. To avoid race conditions this routine must be\r
- called as the last practical operation when creating a PSP.\r
-\r
- dapls_ib_setup_conn_listener() is provider specific. The key\r
- insight is that the DAPL connection qualifier (conn_qual) will\r
- become the InfiniBand Service ID. The passive side of the\r
- connection is now listening for connection requests. It should be\r
- obvious that the conn_qual must be unique.\r
-\r
-2. dapl_ep_connect\r
-\r
- The active side initiates a connection with dapl_ep_connect, which\r
- will transition the EP into DAT_EP_STATE_ACTIVE_CONNECTION_PENDING.\r
- Again, connections are in the domain of the providers' Connection\r
- Manager and the mechanics are very much provider specific. The key\r
- points are that a DAT_IA_ADDRESS_PTR must be translated to a GID\r
- before a connection initiation can occur. This is discussed below.\r
-\r
- InfiniBand supports different amounts of private data on various\r
- connection functions. The DAPL connection code does not enforce a\r
- fixed amount of private data, but rather makes available to the\r
- user all it has available. When initiating a connection, and when\r
- the remote node accepts a connection, we prefix the user data with\r
- a private data header. The header contains\r
-\r
- - Local host IP address\r
- - private data size\r
- - private data payload\r
-\r
- The underlying implementation will copy the private data into a\r
- buffer to be sent, so we need to assemble all of it before passing\r
- it down to the CM.\r
-\r
- The Local host IP address is required by the DAT spec when a\r
- connection event occurs, and there is no other way for the remote\r
- node to get it; even with a LID or GID the IB implementation could\r
- support multiple IP interfaces, so it must be supplied here.\r
-\r
- The private data size is transmitted to provide the obvious\r
- information. Some CM implementations do not keep track of the size,\r
- so it is required for them; for other implementations it is a\r
- convenience.\r
-\r
- At this time there is no InfiniBand API available that will allow us\r
- to transmit or obtain the host IP address. The DAT Spec is very\r
- careful to avoid imposing a protocol, and yet here is a wire protocol\r
- that vendors must implement if there is any hope of\r
- interoperability. The header just described is currently considered\r
- temporary until a better method can be ascertained, presumably with a\r
- fully working IPoIB implementation. However, it may be the case that\r
- this simple transmission of the host IP address in the private data\r
- is the best solution, in which case it should be promoted into the\r
- DAT Spec as required by InfiniBand providers.\r
-\r
- We observe in passing that the IP address can take up to 16 bytes,\r
- while there are 92 bytes total private data in a REQ message\r
- (connection request); leaving 76 bytes for an application. This\r
- exactly allows the SDP Hello Header to fit in the Private Data\r
- space remaining. An SDP implementation could be done on top of\r
- DAPL.\r
-\r
-\r
-* Addressing and Naming\r
-\r
- The DAT Spec calls for a DAT_IA_ADDRESS_PTR to be an IP address,\r
- either IPv4 or IPv6. It is in fact a struct sockaddr in most\r
- systems.\r
-\r
- The long term solution to resolving an IP address to a GID is to us\r
- an IPoIB implementation with an API capable of performing this\r
- function. At the time of this writing this API is being worked out\r
- with an HCA vendor, with the hope that other HCA vendors will\r
- follow suite.\r
-\r
- Until IPoIB is working properly, the DAPL implementation provides a\r
- simple name service facility under the #ifdef NO_NAME_SERVICE. This\r
- depends on two things: valid IP addresses registered and available\r
- to standard DNS system calls such as gethostbyname(); and a\r
- name/GID mapping file.\r
-\r
- IP addresses may be set up by system administrators or by a local\r
- power user simply by editing the values into the /etc/hosts file.\r
- Setting IP addresses up in this manner is beyond the scope of this\r
- document.\r
-\r
- A simple mapping of names to GIDs is maintained in the ibhosts\r
- file, currently located at /etc/dapl/ibhosts. The format of\r
- the file is:\r
-\r
- <IP name> 0x<GID Prefix> 0x<GUID>\r
-\r
- For example:\r
-\r
- dat-linux3-ib0p0 0xfe80000000000000 0x0001730000003d11\r
- dat-linux3-ib0p1 0xfe80000000000000 0x0001730000003d11\r
- dat-linux3-ib1 0xfe80000000000000 0x0001730000003d52\r
- dat-linux5-ib0 0xfe80000000000000 0x0001730000003d91\r
-\r
- And for each hostname, there must be an entry in the /etc/hosts file\r
- similar to:\r
-\r
- dat-linux3-ib0p0 198.165.10.11\r
- dat-linux3-ib0p1 198.165.10.12\r
- dat-linux3-ib1 198.165.10.21\r
- dat-linux5-ib0 198.165.10.31\r
-\r
-\r
- In this example we have adopted the convention of naming each\r
- InfiniBand interface by using the form\r
-\r
- <node_name>-ib<device_number>[port_number]\r
-\r
- In the above example we can see that the machine dat-linux3 has three\r
- InfiniBand interfaces, which in this case we have named two ports on\r
- the first HCA and another port on a second. Utilizing standard DNS\r
- naming, the conventions used for identifying individual ports is\r
- completely up to the administrator.\r
-\r
- The GID Prefix and GUID are obtained from the HCA and map a port on\r
- the HCA: together they form the GID that is required by a CM to\r
- connect with the remote node.\r
-\r
- The simple name service builds an internal table after processing\r
- the ibhosts file which contains IP addresses and GIDs. It will use\r
- the standard getaddrinfo() function to obtain IP address\r
- information.\r
-\r
- When an application invoked dat_ep_connect(), the\r
- DAT_IA_ADDRESS_PTR will be compared in the table for a match and\r
- the destination GID established if found. If the address is not\r
- found then the user must first add the name to the ibhosts file.\r
-\r
- With a valid GID for the destination node, the underlying CM is\r
- invoked to make a connection.\r
-\r
-* Connection Management\r
-\r
- Getting a working CM has taken some time, in fact the DAPL project\r
- was nearly complete by the time a CM was available. In order to\r
- make progress, a connection hack was introduced that allows\r
- specific connections to take place. This is noted in the code by\r
- the CM_BUSTED #def.\r
-\r
- CM_BUSTED takes the place of a CM and will manually transition a QP\r
- through the various states to connect: INIT->RTR->RTS. It will also\r
- disconnect the connection, although the Torrent implementation\r
- simply destroys the QP and recreates a new one rather than\r
- transitioning through the typical disconnect states (which didn't\r
- work on early IB implementations).\r
-\r
- CM_BUSTED makes some assumptions about the remote end of the\r
- connection as no real information is exchanged. The Torrent\r
- implementation assumes both HCAs have the same LID, which implies\r
- there is no SM running. The Tavor implementation assumes the LIDs\r
- are 0 and 1. Depending on the hardware, the LID value may in fact\r
- not make any difference. This code does not set the Global Route\r
- Header (GRH), which would cause the InfiniBand chip to be carefully\r
- checking LID information.\r
-\r
- The QP number is assumed to be identical on both ends of the\r
- connection, of differing by 1 if this is a loopback. There is an\r
- environment variable that will be read at initialization time if\r
- you are configured with a loopback, this value is checked when\r
- setting up a QP. The obvious downside to this scheme is that\r
- applications must stay synchronized in their QP usage or the\r
- initial exchange will fail as they are not truly connected.\r
-\r
- Add to this the limitation that HCAs must be connected in\r
- Point-to-Point topology or in a loopback. Without a GRH it will not\r
- work in a fabric. Again, using an SM will not work when CM_BUSTED\r
- is enabled.\r
-\r
- Despite these shortcomings, CM_BUSTED has proven very useful and\r
- will remain in the code for a while in order to aid development\r
- groups with new hardware and software.\r
-\r
-3. dapls_cr_callback\r
-\r
- The connection sequence is entirely event driven. An operation is\r
- posted, then an asynchronous event will occur some time later. The\r
- event may cause other actions to occur which may result in still\r
- more events.\r
-\r
- dapls_ib_setup_conn_listener() registered for a callback for\r
- connection events, and we now receive\r
- IB_CME_CONNECTION_REQUEST_PENDING_PRIVATE_DATA. As has been\r
- discussed above, DAPL will always send private data on a connection\r
- so this is the event we will get.\r
-\r
- The astute reader will observe that there is not a dapl_cr_create\r
- call: CR records are created as part of a connection attempt on the\r
- passive side of the connection. A CR is created now and set up. A\r
- point that will become important later, caps for emphasis:\r
-\r
- A CR WILL EXIST FOR THE LIFE OF A CONNECTION; THEY ARE DESTROYED AT\r
- DISCONNECT TIME.\r
-\r
- In the connection request processing a CR and an EVENT are created,\r
- the event will be posted along with the connection information just\r
- received.\r
-\r
- We also check the PSP to see if an EP is created at this point, and\r
- allocate one if so. The EP will be provided back to the user in the\r
- event, as per the DAT model.\r
-\r
-4. Event code processing\r
-5. Create an EP (unless PSP created)\r
-\r
- (4) and (5) are all done in user mode. The only interesting thing is\r
- that when the user calls dat_cr_accept a ready EP must be\r
- provided. If the EP was supplied by the PSP in the callback, it\r
- must have a PZ associated with it and whatever other attributes\r
- need to be set.\r
-\r
-6. dapl_cr_accept or dapl_cr_reject\r
-\r
- For discussion purposes, we will follow the accept\r
- path. dapl_cr_reject says you are done and there will be no further\r
- events to deal with.\r
-\r
- The accept call is intuitive and simple. Again, private data will\r
- be exchanged and so the private data header is used. The requesting\r
- node presumably know where the request comes from so we don't put\r
- the address into the header here.\r
-\r
-7. dapl_evd_connection_callback\r
-\r
- The connecting side of the connection will now get a callback in\r
- dapl_evd_connection_callback() with connection event\r
- IB_CME_CONNECTED.\r
-\r
- The code will transition the EP to CONNECTED and post a\r
- DAT_CONNECTION_EVENT_ESTABLISHED event for the user to pick up.\r
- The connection is now established, however the passive or server\r
- side of the connection doesn't know it yet: the EP is still in\r
- DAT_EP_STATE_PASSIVE_CONNECTION_PENDING.\r
-\r
-8i. RTU\r
-\r
- This item is labeled "8i" as it is internal to the InfiniBand\r
- implementation, it is not initiated by dapl. The final leg of a\r
- connection is an RTU sent from the initiating node to the server\r
- node, indicating the connection has been made successfully.\r
-\r
-9. dapls_cr_callback\r
-\r
- The RTU above results in another callback into dapls_cr_callback,\r
- this time with connection event IB_CME_CONNECTED.\r
-\r
- There is no reason to deal with private data, from a dapl point of\r
- view this was purely an internal message and simply a connection\r
- state change. A DAT_CONNECTION_EVENT_ESTABLISHED event is created\r
- and posted.\r
-\r
- The architectually interesting feature of this exchange occurs\r
- because of differences in the InfiniBand and the DAT connection\r
- models, which will be briefly outlined.\r
-\r
- InfiniBand maintains the original connecting objects throughout the\r
- life of the connection. That is, we originally get a callback event\r
- associated with the Service (DAT PSP) that is listening for\r
- connection events. A QP will be connected but the callback event\r
- will still be received on the Service. Later, a callback event will\r
- occur for a DISCONNECT, and again the Service will be the object of\r
- the connection. In the DAPL implementation, the Service will\r
- provide the PSP that is registered as listening on that connection\r
- qualifier.\r
-\r
- DAT has a PSP receive a connection event, but subsequently hands\r
- all connection events off to an EP. After a dat_cr_accept is\r
- issued, all connection/disconnection events occur on the EP.\r
-\r
- To support the DAT model the CR is maintained through the life of\r
- the connection. There is exactly one CR per connection, but any\r
- number of CRs may exist for any given PSP. CRs are maintained on a\r
- link list pointed to by the PSP structure. A search routine will\r
- match the cm_handle, unique for each connection, with the\r
- appropriate CR. This allows us to find the appropriate EP which\r
- will be used to create an event to be posted to the user.\r
-\r
-* dat_psp_destroy\r
-\r
- It should be understood that the PSP will maintain all of the CR\r
- records, and hence the PSP must persist until the final disconnect.\r
- In the DAT model there is no association between a PSP and a\r
- connected QP, so there is no reason not to destroy a PSP before the\r
- final disconnect.\r
-\r
- Because of the model mismatch we must preserve the PSP until the\r
- final disconnect. If the user invokes dat_psp_destroy(), all of the\r
- associations maintained by the PSP will be severed; but the PSP\r
- structure itself remains as a container for the CR records. The PSP\r
- structure maintains a simple count of CR records so we can easily\r
- determine the final disconnect and release memory. Once a\r
- disconnect event is received for a specific cm_handle, no further\r
- events will be received and it is safe to discard the CR record.\r
-\r
-10. ...processing...\r
-\r
- This is just a place holder to show that applications actually do\r
- something after making a connection. They might not too...\r
-\r
-11. Either side issues a dat_ep_disconnect\r
-\r
- dat_ep_disconnect() can be initiated by either side of a\r
- connection. There are two kinds of disconnect flags that can be\r
- passed in, but the final result is largely the same.\r
-\r
- DAT_CLOSE_ABRUPT_FLAG will cause the connection to be immediately\r
- terminated. In InfiniBand terms, the QP is immediately moved to the\r
- ERROR state, and after some time it will be moved to the RESET\r
- state.\r
-\r
- DAT_CLOSE_GRACEFUL_FLAG will allow in-progress DTOs to complete.\r
- The underlying implementation will first transition the QP to the\r
- SQE state, before going to RESET.\r
-\r
- Both cases are handled by the underlying CM, there is no extra work\r
- for DAPL.\r
-\r
-\r
-12. dapls_cr_callback\r
-\r
- A disconnect will arrive on the passive side of the connection\r
- through dapls_cr_callback() with connection event\r
- IB_CME_DISCONNECTED. With this event the EP lookup code will free\r
- the CR associated with the connection, and may free the PSP if it\r
- is no longer listening, indicating it has been freed by the\r
- application.\r
-\r
- The callback will create and post a\r
- DAT_CONNECTION_EVENT_DISCONNECTED event for the user.\r
-\r
-13. dapl_evd_connection_callback\r
-\r
- The active side of the connection will receive IB_CME_DISCONNECTED\r
- as the connection event for dapl_evd_connection_callback(), and\r
- will create and post a DAT_CONNECTION_EVENT_DISCONNECTED event.\r
- Other than transitioning the EP to the DISCONNECTED state, there is\r
- no further processing.\r
-\r
-\r
--- Notes on Disconnecting\r
-\r
-An EP can only be disconnected if it is connected or unconnected; you\r
-cannot disconnect 'in progress' connections. An 'in progress\r
-connection may in fact time out, but the DAT Spec does not allow you\r
-to 'kill' it. DAPL will use the CM interface to disconnect from the\r
-remote node; this of course results in an asynchronous callback\r
-notifying the application the disconnect is complete.\r
-\r
-Disconnecting an unconnected EP is currently the only way to remove\r
-pending RECV operations from the EP. The DAPL spec notes that all\r
-DTO's must be removed from an EP before it can be deallocated, yet\r
-there is no explicit interface to remove pending RECV DTOs. The user\r
-will disconnect an unconnected EP to force the pending operations off\r
-of the queue, resulting in DTO callbacks indicating an error. The\r
-underlying InfiniBand implementation will cause the correct behavior\r
-to result. When doing this operation the DAT_CLOSE flag is ignored,\r
-DAPL will instruct the IB layer to abruptly disconnect the QP.\r
-\r
-As has been noted previously, specifying DAT_CLOSE_ABRUPT_FLAG as the\r
-disconnect completion flag will cause the CM implementation to\r
-transition the QP to the ERROR state to abort all operations, and then\r
-transition to the RESET state; if the flag is DAT_CLOSE_GRACEFUL_FLAG,\r
-the CM will first move to the SQE state and allow all pending I/O's to\r
-drain before moving to the RESET state. In either case, DAPL only\r
-needs to know that the QP is now in the RESET state, as it will need\r
-to be transitioned to the INIT state before it can be used again.\r
-\r
-======================================================================\r
-Data Transfer Operations (DTOs)\r
-======================================================================\r
-\r
-The DTO code is a straightforward translation of the DAT_LMR_TRIPLET\r
-to an InfiniBand work request. Unfortunately, IB does not specify what\r
-a work request looks like so this tends to be very vendor specific\r
-code. Each provider will supply a routine for this operation.\r
-\r
-InfiniBand allows the DTO to attach a unique 64 bit work_req_id to\r
-each work request. The DAPL implementation will install a pointer to a\r
-DAPL_DTO_COOKIE in this field. Observe that a DAPL_DTO_COOKIE is not\r
-the same as the user DAT_DTO_COOKIE; indeed, the former has a pointer\r
-field pointing to the latter. Different values will be placed in the\r
-cookie, according to the type of operation it is and the type of data\r
-required by its completion event. This is a simple scheme to bind DAPL\r
-data to the DTO and associated completion callback. Each DTO has a\r
-unique cookie associated with it.\r
-\r
-DAPL_DTO_COOKIE structures are currently allocated using a simple\r
-malloc. An obvious performance gain can be had by using a ready made\r
-pool of structures to minimize the time involved on this critical\r
-path.\r
-\r
-The underlying InfiniBand implementation will invoke\r
-dapl_evd_dto_callback() upon completion of DTO operations. During the\r
-development of the Reference Implementation there was a period when\r
-DTO callbacks were not working, so we implemented a mechanism where a\r
-thread continually polls the CQs looking for completions, and then\r
-invokes the callback when something completes. This code may be useful\r
-in the future and is still maintained in the code under the\r
-POLLING_COMPLETIONS #ifdef.\r
-\r
-POLLING_COMPLETIONS will simulate callbacks but will not provide a high\r
-performance implementation.\r
-\r
-dapl_evd_dto_callback() is the asynchronous completion for a DTO and\r
-will create and post an event for the user. Much of this callback is\r
-concerned with managing error completions.\r
-\r
-\r
-======================================================================\r
-Data Structure\r
-======================================================================\r
-\r
-The main data structure for and EndPoint is the dapl_ep structure,\r
-defined in include/dapl.h. The reference implementation uses the\r
-InfiniBand QP to maintain hardware state, providing a relatively\r
-simple mapping.\r
-\r
-/* DAPL_EP maps to DAT_EP_HANDLE */\r
-struct dapl_ep\r
-{\r
- DAPL_HEADER header;\r
- /* What the DAT Consumer asked for */\r
- DAT_EP_PARAM param;\r
-\r
- /* The RC Queue Pair (IBM OS API) */\r
- ib_qp_handle_t qp_handle;\r
- int qpn; /* qp number */\r
- Ib_qp_state qp_state;\r
-\r
- /* communications manager handle (IBM OS API) */\r
- ib_cm_handle_t cm_handle;\r
-\r
- /* The DTO Circular buffers */\r
- DAPL_RING_BUFFER out;\r
- DAPL_RING_BUFFER in;\r
-\r
- /* state dependent connection event handler */\r
- DAPL_CONNECTION_STATE_HANDLER ep_connect_handler;\r
-};\r
-\r
-\r
-The simple explanation of the fields in the dapl_ep structure follows:\r
-\r
-header: The dapl object header, common to all dapl objects. \r
- It contains a lock field, links to appropriate lists, and\r
- handles specifying the IA domain it is a part of.\r
-\r
-param: The bulk of the EP attributes called out in the DAT \r
- specification and are maintained in the DAT_EP_PARAM\r
- structure. All internal references to these fields\r
- use this structure.\r
-\r
-qp_handle: Handle to the underlying InfiniBand provider implementation\r
- for a QP. All EPs are mapped to an InfiniBand QP.\r
-\r
-qpn: Number of the QP as returned by the underlying provider\r
- implementation. Primarily useful for debugging.\r
-\r
-qp_state: Current state of the QP. The values of this field indicate\r
- if a QP is bound to the EP, and the current state of a\r
- QP.\r
-\r
-cm_handle: Handle to the IB provider's CMA (Connection Manager Agent).\r
- Used for CM operations used to connect and disconnect.\r
-\r
-out: Ring buffer tracking all SEND work requests (WR). A WR\r
- is put into the list when a SEND is initiated, then removed\r
- when the send completes.\r
-\r
-in: Ring buffer tracking all RECV work requests (WR). A WR\r
- is put into the list when a RECV is initiated, then removed\r
- when the recv completes.\r
-\r
-ep_connect_handler:\r
- Pointer to callback routine invoked when CM events appear.\r
- MAY BE UNUSED IN THE IMPLEMENTATION.\r
+++ /dev/null
- DAPL Environment Guide v. 0.01\r
- ------------------------------\r
-\r
-The following environment variables affect the behavior of the DAPL\r
-provider library: \r
-\r
-\r
-DAPL_DBG_TYPE\r
--------------\r
-\r
- Value specifies which parts of the registry will print debugging\r
- information, valid values are \r
-\r
- DAPL_DBG_TYPE_ERR = 0x0001\r
- DAPL_DBG_TYPE_WARN = 0x0002\r
- DAPL_DBG_TYPE_EVD = 0x0004\r
- DAPL_DBG_TYPE_CM = 0x0008\r
- DAPL_DBG_TYPE_EP = 0x0010\r
- DAPL_DBG_TYPE_UTIL = 0x0020\r
- DAPL_DBG_TYPE_CALLBACK = 0x0040\r
- DAPL_DBG_TYPE_DTO_COMP_ERR = 0x0080\r
- DAPL_DBG_TYPE_API = 0x0100\r
- DAPL_DBG_TYPE_RTN = 0x0200\r
- DAPL_DBG_TYPE_EXCEPTION = 0x0400\r
-\r
- or any combination of these. For example you can use 0xC to get both \r
- EVD and CM output.\r
-\r
- Example setenv DAPL_DBG_TYPE 0xC\r
-\r
- \r
-DAPL_DBG_DEST\r
--------------\r
-\r
- Value sets the output destination, valid values are \r
- \r
- DAPL_DBG_DEST_STDOUT = 0x1\r
- DAPL_DBG_DEST_SYSLOG = 0x2 \r
- DAPL_DBG_DEST_ALL = 0x3 \r
- \r
- For example, 0x3 will output to both stdout and the syslog. \r
-\r
+++ /dev/null
- DAPL Event Subsystem Design v. 0.96\r
- -----------------------------------\r
-\r
-=================\r
-Table of Contents\r
-=================\r
-\r
-* Table of Contents\r
-* Referenced Documents\r
-* Goals\r
- + Initial Goals\r
- + Later Goals\r
-* Requirements, constraints, and design inputs\r
- + DAT Specification Constraints\r
- + Object and routine functionality, in outline\r
- + Detailed object and routine specification\r
- + Synchronization\r
- + IBM Access API constraints\r
- + Nature of DAPL Event Streams in IBM Access API.\r
- + Nature of access to CQs\r
- + Operating System (Pthread) Constraints\r
- + Performance model\r
- + A note on context switches\r
-* DAPL Event Subsystem Design\r
- + OS Proxy Wait Object\r
- + Definition\r
- + Suggested Usage\r
- + Event Storage\r
- + Synchronization\r
- + EVD Synchronization: Locking vs. Producer/Consumer queues\r
- + EVD Synchronization: Waiter vs. Callback\r
- + CNO Synchronization\r
- + Inter-Object Synchronization\r
- + CQ -> CQEH Assignments\r
- + CQ Callbacks\r
- + Dynamic Resizing of EVDs\r
- + Structure and pseudo-code\r
- + EVD\r
- + CNO\r
-* Future directions\r
- + Performance improvements: Reducing context switches\r
- + Performance improvements: Reducing copying of event data\r
- + Performance improvements: Reducing locking\r
- + Performance improvements: Reducing atomic operations\r
- + Performance improvements: Incrementing concurrency.\r
-\r
-====================\r
-Referenced Documents\r
-====================\r
-\r
-uDAPL: User Direct Access Programming Library, Version 1.0. Published\r
-6/21/2002. http://www.datcollaborative.org/uDAPL_062102.pdf.\r
-Referred to in this document as the "DAT Specification".\r
-\r
-InfiniBand Access Application Programming Interface Specification,\r
-Version 1.2, 4/15/2002. In DAPL SourceForge repository at\r
-doc/api/access_api.pdf. Referred to in this document as the "IBM\r
-Access API Specification".\r
-\r
-=====\r
-Goals\r
-=====\r
-\r
-Initial goals\r
--------------\r
--- Implement the dat_evd_* calls described in the DAT Specification (except\r
- for dat_evd_resize).\r
-\r
--- The implementation should be as portable as possible, to facilitate\r
- HCA Vendors efforts to implement vendor-specific versions of DAPL.\r
-\r
-Later goals\r
------------\r
--- Examine various possible performance optimizations. This document\r
- lists potential performance improvements, but the specific\r
- performance improvements implemented should be guided by customer\r
- requirements.\r
-\r
--- Implement the dat_cno_* calls described in the DAT 1.0 spec\r
-\r
--- Implement OS Proxy Wait Objects.\r
-\r
--- Implement dat_evd_resize\r
-\r
-Non-goals\r
----------\r
--- Thread safe implementation\r
-\r
-============================================\r
-Requirements, constraints, and design inputs\r
-============================================\r
-\r
-DAT Specification Constraints\r
------------------------------\r
-\r
--- Object and routine functionality, in outline\r
-\r
-The following section summarizes the requirements of the DAT\r
-Specification in a form that is simpler to follow for purposes of\r
-implementation. This section presumes the reader has read the DAT\r
-Specification with regard to events.\r
-\r
-Events are delivered to DAPL through Event Streams. Each Event Stream\r
-targets a specific Event Descriptor (EVD); multiple Event Streams may\r
-target the same EVD. The Event Stream<->EVD association is\r
-effectively static; it may not be changed after the time at which\r
-events start being delivered. The DAT Consumer always retrieves\r
-events from EVDs. EVDs are intended to be 1-to-1 associated with the\r
-"native" event convergence object on the underlying transport. For\r
-InfiniBand, this would imply a 1-to-1 association between EVDs and\r
-CQs.\r
-\r
-EVDs may optionally have an associated Consumer Notification Object\r
-(CNO). Multiple EVDs may target the same CNO, and the EVD<->CNO\r
-association may be dynamically altered. The DAT Consumer may wait for\r
-events on either EVDs or CNOs; if there is no waiter on an EVD and it\r
-is enabled, its associated CNO is triggered on event arrival. An EVD\r
-may have only a single waiter; a CNO may have multiple waiters.\r
-Triggering of a CNO is "sticky"; if there is no waiter on a CNO when\r
-it is triggered, the next CNO waiter will return immediately.\r
-\r
-CNOs may have an associated OS Proxy Wait Object, which is signaled\r
-when the CNO is triggered.\r
-\r
--- Detailed object and routine specification\r
-\r
-Individual events may be "signaling" or "non-signaling", depending\r
-on the interaction of:\r
- * Receive completion endpoint attributes\r
- * Request completion endpoint attributes\r
- * dat_ep_post_send completion flags\r
- * dat_ep_post_recv completion flags\r
-The nature of this interaction is outside the scope of this document;\r
-see the DAT Specification 1.0 (or, failing that, clarifications in a\r
-later version of the DAT Specification).\r
-\r
-A call to dat_evd_dequeue returns successfully if there are events on\r
-the EVD to dequeue. A call to dat_evd_wait blocks if there are fewer\r
-events present on the EVD than the value of the "threshold" parameter\r
-passed in the call. Such a call to dat_evd_wait will be awoken by the\r
-first signaling event arriving on the EVD that raises the EVD's event\r
-count to >= the threshold value specified by dat_evd_wait().\r
-\r
-If a signaling event arrives on an EVD that does not have a waiter,\r
-and that EVD is enabled, the CNO associated with the EVD will be\r
-triggered.\r
-\r
-A CNO has some number of associated waiters, and an optional\r
-associated OS Proxy Wait Object. When a CNO is triggered, two things\r
-happen independently:\r
- * The OS Proxy Wait Object associated with the CNO, if any, is\r
- signaled, given the handle of an EVD associated with the CNO\r
- that has an event on it, and disassociated from the CNO.\r
- * If:\r
- * there is one or more waiters associated with the\r
- CNO, one of the waiters is unblocked and given the\r
- handle of an EVD associated with the CNO that has an\r
- event on it.\r
- * there are no waiters associated with the CNO, the\r
- CNO is placed in the triggered state.\r
-\r
-When a thread waits on a CNO, if:\r
- * The CNO is in the untriggered state, the waiter goes to\r
- sleep pending the CNO being triggered.\r
- * The CNO is in the triggered state, the waiter returns\r
- immediately with the handle of an EVD associated with the\r
- CNO that has an event on it, and the CNO is moved to the\r
- untriggered state.\r
-\r
-Note specifically that the signaling of the OS Proxy Wait Object is\r
-independent of the CNO moving into the triggered state or not; it\r
-occurs based on the state transition from Not-Triggered to Triggered.\r
-Signaling the OS Proxy Wait Object only occurs when a CNO is\r
-triggered. In contrast, waiters on a CNO are unblocked whenever the\r
-CNO is in the triggered *state*, and that state is sticky.\r
-\r
-Note also that which EVD is returned to the caller in a CNO wait is\r
-not specified; it may be any EVD associated with the CNO on which an\r
-event arrival might have triggered the CNO. This includes the\r
-possibility that the EVD returned to the caller may not have any\r
-events on it, if the dat_cno_wait() caller raced with a separate\r
-thread doing a dat_evd_dequeue().\r
-\r
-The DAT Specification is silent as to what behavior is to be expected\r
-from an EVD after an overflow error has occurred on it. Thus this\r
-design will also be silent on that issue.\r
-\r
-The DAT Specification has minimal requirements on inter-Event Stream\r
-ordering of events. Specifically, any connection events must precede\r
-(in consumption order) any DTO Events for the same endpoint.\r
-Similarly, any successful disconnection events must follow any DTO\r
-Events for an endpoint.\r
-\r
--- Synchronization\r
-\r
-Our initial implementation is not thread safe. This means that we do\r
-not need to protect against the possibility of multiple simultaneous\r
-user calls occurring on the same object (EVD, CNO, EP, etc.); that is\r
-the responsibility of the DAT Consumer.\r
-\r
-However, there are synchronization guards that we do need to protect\r
-against because the DAT Consumer cannot. Specifically, since the user\r
-cannot control the timing of callbacks from the IBM Access API\r
-Implementation, we need to protect against possible collisions between\r
-user calls and such callbacks. We also need to make sure that such\r
-callbacks do not conflict with one another in some fashion, possibly\r
-by assuring that they are single-threaded.\r
-\r
-In addition, for the sake of simplicity in the user interface, I have\r
-defined "not thread safe" as "It is the DAT Consumer's responsibility\r
-to make sure that all calls against an individual object do not\r
-conflict". This does, however, suggest that the DAPL library needs to\r
-protect against calls to different objects that may result in\r
-collisions "under the covers" (e.g. a call on an EVD vs. a call on its\r
-associated CNO).\r
-\r
-So our synchronization requirements for this implementation are:\r
- + Protection against collisions between user calls and IBM\r
- Access API callbacks.\r
- + Avoidance of or protection against collisions between\r
- different IBM Access API callbacks.\r
- + Protection against collisions between user calls targeted at\r
- different DAT objects.\r
-\r
-IBM Access API constraints\r
---------------------------\r
-\r
--- Nature of DAPL Event Streams in IBM Access API\r
-\r
-DAPL Event Streams are delivered through the IBM Access API in two fashions:\r
- + Delivery of a completion to a CQ.\r
- + A callback is made directly to a previously registered DAPL\r
- function with parameters describing the event.\r
-(Software events are not delivered through the IBM Access API).\r
-\r
-The delivery of a completion to a CQ may spark a call to a previously\r
-registered callback depending on the attributes of the CQ and the\r
-reason for the completion. Event Streams that fall into this class\r
-are:\r
- + Send data transport operation\r
- + Receive data transport operation\r
- + RMR bind\r
-\r
-The Event Streams that are delivered directly through a IBM Access API\r
-callback include:\r
- + Connection request arrival\r
- + Connection resolution (establishment or rejection)\r
- + Disconnection\r
- + Asynchronous errors\r
-\r
-Callbacks associated with CQs are further structured by a member of a\r
-particular CQ Event Handling (CQEH) domain (specified at CQ creation\r
-time). All CQ callbacks within a CQEH domain are serviced by the same\r
-thread, and hence will not collide.\r
-\r
-In addition, all connection-related callbacks are serviced by the same\r
-thread, and will not collide. Similarly, all asynchronous error\r
-callbacks are serviced by the same thread, and will not collide.\r
-Collisions between any pair of a CQEH domain, a connection callback,\r
-and an asynchronous error callback are possible.\r
-\r
--- Nature of access to CQs\r
-\r
-The only probe operation the IBM Access API allows on CQs is\r
-dequeuing. The only notification operation the IBM Access API\r
-supports for CQs is calling a previously registered callback.\r
-\r
-Specifically, the IB Consumer may not query the number of completions\r
-on the CQ; the only way to find out the number of completions on a CQ\r
-is through dequeuing them all. It is not possible to block waiting\r
-on a CQ for the next completion to arrive, with or without a\r
-threshold parameter.\r
-\r
-Operating System Constraints\r
-----------------------------\r
-\r
-The initial platform for implementation of DAPL is RedHat Linux 7.2 on\r
-Intel hardware. On this platform, inter-thread synchronization is\r
-provided by a POSIX Pthreads implementation. From the viewpoint of\r
-DAPL, the details of the Pthreads interface are platform specific.\r
-However, Pthreads is a very widely used threading library, common on\r
-almost all Unix variants (though not used on the different variations\r
-of Microsoft Windows(tm)). In addition, RedHat Linux 7.2 provides\r
-POSIX thread semaphore operations (e.g. see sem_init(3)), which are\r
-not normally considered part of pthreads.\r
-\r
-Microsoft Windows(tm) provides many synchronization primitives,\r
-including mutual exclusion locks, and semaphores.\r
-\r
-DAPL defines an internal API (not exposed to the consumer), though\r
-which it accesses Operating Systems Dependent services; this is called\r
-the OSD API. It is intended that this layer contain all operating\r
-system dependencies, and that porting DAPL to a new operating system\r
-should only require changes to this layer.\r
-\r
-We have chosen to define the synchronization interfaces established at\r
-this layer in terms of two specific objects: mutexes and sempahores w/\r
-timeout on waiting. Mutexes provide mutual exclusion in a way that is\r
-common to all known operating systems. The functionality of\r
-semaphores also exists on most known operating systems, though the\r
-sempahores provided by POSIX do not provide timeout capabilities.\r
-This is for three reasons. First, in contrast to Condition Variables\r
-(the native pthreads waiting/signalling object), operations on\r
-sempahores do not require use of other synchronization variables\r
-(i.e. mutexes). Second, it is fairly easy to emulate sempahores using\r
-condition variables, and it is not simple to emulate condition\r
-variables using semaphores. And third, there are some anticipated\r
-platforms for DAPL that implement condition variables in relation to\r
-some types of locks but not others, and hence constrain appropriate\r
-implementation choices for a potential DAPL interface modeled after\r
-condition variables.\r
-\r
-Implementation of the DAPL OS Wait Objects will initially be based on\r
-condition variables (requiring the use of an internal lock) since\r
-POSIX semaphores do not provide a needed timeout capability. However,\r
-if improved performance is required, a helper thread could be created\r
-that arranges to signal waiting semaphores when timeouts have\r
-expired. This is a potential future (or vendor) optimization.\r
-\r
-Performance Model\r
------------------\r
-One constraint on the DAPL Event Subsystem implementation is that it\r
-should perform as well as possible. We define "as well as possible"\r
-by listing the characteristics of this subsystem that will affect its\r
-performance most strongly. In approximate order of importance, these\r
-are:\r
- + The number of context switches on critical path\r
- + The amount of copying on the critical path.\r
- + The base cost of locking (assuming no contention) on the\r
- critical path. This is proportional to the number of locks\r
- taken.\r
- + The amount of locking contention expected. We make a\r
- simplifying assumption and take this as the number of cycles\r
- for which we expect to hold locks on the critical path.\r
- + The number of "atomic" bus operations executed (these take\r
- more cycles than normal operations, as they require locking\r
- the bus).\r
-\r
-We obviously wish to minimize all of these costs.\r
-\r
--- A note on context switches\r
-\r
-In general, it's difficult to minimize context switches in a user\r
-space library directly communicating with a hardware board. This is\r
-because context switches, by their nature, have to go through the\r
-operating system, but the information about which thread to wake up\r
-and whether to wake it up is generally in user space. In addition,\r
-the IBM Access API delivers all Event Streams as callbacks in user\r
-context (as opposed to, for example, allowing a thread to block within\r
-the API waiting for a wakeup). For this reason, the default sequence\r
-of events for a wakeup generated from the hardware is:\r
- * Hardware interrupts the main processor.\r
- * Interrupt thread schedules a user-level IBM Access API\r
- provider service thread parked in the kernel.\r
- * Provider service thread wakes up the sleeping user-level\r
- event DAT implementation thread.\r
-This implies that any wakeup will involve three context switches.\r
-This could be reduced by one if there were a way for user threads to\r
-block in the kernel, we might skip the user-level provider thread.\r
-\r
-===========================\r
-DAPL Event Subsystem Design\r
-===========================\r
-\r
-\r
-OS Proxy Wait Object\r
---------------------\r
-\r
-The interface and nature of the OS Proxy Wait Object is specified in\r
-the uDAPL v. 1.0 header files as a DAT_OS_WAIT_PROXY_AGENT via the\r
-following defines:\r
-\r
-typedef void (*DAT_AGENT_FUNC)\r
- (\r
- DAT_PVOID, /* instance data */\r
- DAT_EVD_HANDLE /* Event Dispatcher*/\r
- );\r
-\r
-typedef struct dat_os_wait_proxy_agent\r
- {\r
- DAT_PVOID instance_data;\r
- DAT_AGENT_FUNC proxy_agent_func;\r
- } DAT_OS_WAIT_PROXY_AGENT;\r
-\r
-In other words, an OS Proxy Wait Object is a (function, data) pair,\r
-and signalling the OS Proxy Wait Object is a matter of calling the\r
-function on the data and an EVD handle associated with the CNO.\r
-The nature of that function and its associated data is completely up\r
-to the uDAPL consumer.\r
-\r
-Event Storage\r
--------------\r
-\r
-The data associated with an Event (the type, the EVD, and any type\r
-specific data required) must be stored between event production and\r
-event consumption. If storage is not provided by the underlying\r
-Verbs, that data must be stored in the EVD itself. This may require\r
-an extra copy (one at event production and one at event consumption).\r
-\r
-Event Streams associated purely with callbacks (i.e. IB events that\r
-are not mediated by CQs) or user calls (i.e. software events) don't\r
-have any storage allocated for them by the underlying verbs and hence\r
-must store their data in the EVD.\r
-\r
-Event Streams that are associated with CQs have the possibility of\r
-leaving the information associated with the CQ between the time the\r
-event is produced and the time it is consumed. However, even in this\r
-case, if the user calls dat_evd_wait with a threshold argument, the\r
-events information must be copied to storage in the CQ. This is\r
-because it is not possible to determine how many completions there are\r
-on a CQ without dequeuing them, and that determination must be made by\r
-the CQ notification callback in order to decide whether to wakeup a\r
-dat_evd_wait() waiter. Note that this determination must be made\r
-dynamically based on the arguments to dat_evd_wait().\r
-\r
-Further, leaving events from Event Streams associated with the CQs "in\r
-the CQs" until event consumption raises issues about in what order\r
-events should be dequeued if there are multiple event streams entering\r
-an EVD. Should the CQ events be dequeued first, or should the events\r
-stored in the EVD be dequeued first? In general this is a complex\r
-question; the uDAPL spec does not put many restrictions on event\r
-order, but the major one that it does place is to restrict connection\r
-events associated with a QP to be dequeued before DTOs associated with\r
-that QP, and disconnection events after. Unfortunately, if we adopt\r
-the policy of always dequeueing CQ events first, followed by EVD\r
-events, this means that in situations where CQ events have been copied\r
-to the EVD, CQ events may be received on the EVD out of order.\r
-\r
-However, leaving events from Event Streams associated with CQs allows\r
-us to avoid enabling CQ callbacks in cases where there is no waiter\r
-associated with the EVDs. This can be a potentially large savings of\r
-gratuitous context switches.\r
-\r
-For the initial implementation, we will leave all event information\r
-associated with CQs until dequeued by the consumer. All other event\r
-information will be put in storage on the EVD itself. We will always\r
-dequeue from the EVD first and the CQ second, to handle ordering among\r
-CQ events in cases in which CQ events have been copied to the EVD.\r
-\r
-\r
-Synchronization\r
----------------\r
-\r
--- EVD synchronization: Locking vs. Producer/Consumer queues.\r
-\r
-In the current code, two circular producer/consumer queues are used\r
-for non-CQ event storage (one holds free events, one holds posted\r
-events). Event producers "consume" events from the free queue, and\r
-produce events onto the posted event queue. Event consumers consume\r
-events from the posted event queue, and "produce" events onto the free\r
-queue. In what follows, we discuss synchronization onto the posted\r
-event queue, but since the usage of the queues is symmetric, all of\r
-what we say also applies to the free event queue (just in the reverse\r
-polarity).\r
-\r
-The reason for using these circular queues is to allow synchronization\r
-between producer and consumer without locking in some situations.\r
-Unfortunately, a circular queue is only an effective method of\r
-synchronization if we can guarantee that there are only two accessors\r
-to it at a given time: one producer, and one consumer. The model will\r
-not work if there are multiple producers, or if there are multiple\r
-consumers (though obviously a subsidiary lock could be used to\r
-single-thread either the producers or the consumers).\r
-\r
-There are several difficulties with guaranteeing the producers and\r
-consumers will each be single threaded in accessing the EVD:\r
- * Constraints of the IB specification and IBM Access API\r
- (differing sources for event streams without guarantees of\r
- IB provider synchronization between them) make it difficult\r
- to avoid multiple producers.\r
- * The primitives used for the producer/consumer queue are not\r
- as widely accepted as locks, and may render the design less\r
- portable.\r
-\r
-We will take locks when needed when producing events. The details of\r
-this plan are described below.\r
-\r
-This reasoning is described in more detail below to inform judgments\r
-about future performance improvements.\r
-\r
-* EVD producer synchronization\r
-\r
-The producers fall into two classes:\r
- * Callbacks announcing IA associated events such as connection\r
- requests, connections, disconnections, DT ops, RMR bind,\r
- etc.\r
- * User calls posting a software event onto the EVD.\r
-\r
-It is the users responsibility to protect against simultaneous\r
-postings of software events onto the same EVD. Similarly, the CQEH\r
-mechanism provided by the IBM Access API allows us to avoid collisions\r
-between IBM Access API callbacks associated with CQs. However, we\r
-must protect against software events colliding with IBM Access API\r
-callbacks, and against non-CQ associated IB verb callbacks (connection\r
-events and asynchronous errors) colliding with CQ associated IBM\r
-Access API callbacks, or with other non-CQ associated IBM Access API\r
-callbacks (i.e. a connection callback colliding with an asynchronous\r
-error callback).\r
-\r
-Note that CQ related callbacks do not act as producers on the circular\r
-list; instead they leave the event information on the CQ until\r
-dequeue; see "Event Storage" above. However, there are certain\r
-situations in which it is necessary for the consumer to determine the\r
-number of events on the EVD. The only way that IB provides to do this\r
-is to dequeue the CQEs from the CQ and count them. In these\r
-situations, the consumer will also act as an event producer for the\r
-EVD event storage, copying all event information from the CQ to the\r
-EVD.\r
-\r
-Based on the above, the only case in which we may do without locking\r
-on the producer side is when all Event Streams of all of the following\r
-types may be presumed to be single threaded:\r
- * Software events\r
- * Non-CQ associated callbacks\r
- * Consumer's within dat_evd_wait\r
-\r
-We use a lock on the producer side of the EVD whenever we have\r
-multiple threads of producers.\r
-\r
-* EVD Consumer synchronization\r
-\r
-It is the consumer's responsibility to avoid multiple callers into\r
-dat_evd_wait and dat_evd_dequeue. For this reason, there is no\r
-requirement for a lock on the consumer side.\r
-\r
-* CQ synchronization\r
-\r
-We simplify synchronization on the CQ by identifying the CQ consumer\r
-with the EVD consumer. In other words, we prohibit any thread other\r
-than a user thread in dat_evd_wait() or dat_evd_dequeue() from\r
-dequeueing events from the CQ. This means that we can rely on the\r
-uDAPL spec guarantee that only a single thread will be in the\r
-dat_evd_wait() or dat_evd_dequeue() on a single CQ at a time. It has\r
-the negative cost that (because there is no way to probe for the\r
-number of entries on a CQ without dequeueing) the thread blocked in\r
-dat_evd_wait() with a threshold argument greater than 1 will be woken\r
-up on each notification on that CQ, in order to dequeue entries from\r
-the CQ and determine if the threshold value has been reached.\r
-\r
--- EVD Synchronization: Waiter vs. Callback\r
-\r
-Our decision to restrict dequeueing from the IB CQ to the user thread\r
-(rather than the notification callback thread) means that\r
-re-requesting notifications must also be done from that thread. This\r
-leads to a subtle requirement for synchronization: the request for\r
-notification (ib_completion_notify) must be atomic with the wait on\r
-the condition variable by the user thread (atomic in the sense that\r
-locks must be held to force the signalling from any such notification\r
-to occur after the sleep on the condition variable). Otherwise it is\r
-possible for the notification requested by the ib_completion_notify\r
-call to occur before the return from that call. The signal done by\r
-that notify will be ignored, and no further notifications will be\r
-enabled, resulting in the thread sleep waiting forever. The CQE\r
-associated with the notification might be noticed upon return from the\r
-notify request, but that CQE might also have been reaped by a previous\r
-call.\r
-\r
--- CNO Synchronization\r
-\r
-In order to protect data items that are changed during CNO signalling\r
-(OS Proxy Wait Object, EVD associated with triggering, CNO state), it\r
-is necessary to use locking when triggering and waiting on a CNO.\r
-\r
-Note that the synchronization between trigerrer and waiter on CNO must\r
-take into account the possibility of the waiter returning from the\r
-wait because of a timeout. I.e. it must handle the possibility that,\r
-even though the waiter was detected and the OS Wait Object signalled\r
-under an atomic lock, there would be no waiter on the OS Wait Object\r
-when it was signalled. To handle this case, we make the job of the\r
-triggerer to be setting the state to triggered and signalling the OS\r
-Wait Object; all other manipulation is done by the waiter.\r
-\r
--- Inter-Object Synchronization\r
-\r
-By the requirements specified above, the DAPL implementation is\r
-responsible for avoiding collisions between DAT Consumer calls on\r
-different DAT objects, even in a non-thread safe implementation.\r
-Luckily, no such collisions exist in this implementation; all exported\r
-DAPL Event Subsystem calls involve operations only on the objects to\r
-which they are targeted. No inter-object synchronization is\r
-required.\r
-\r
-The one exception to this is the posting of a software event on an EVD\r
-associated with a CNO; this may result in triggering the CNO.\r
-However, this case was dealt with above in the discussion of\r
-synchronizing between event producers and consumers; the posting of a\r
-software event is a DAPL API call, but it's also a event producer.\r
-\r
-To avoid lock hierarchy issues between EVDs and CNOs and minimize lock\r
-contention, we arrange not to hold the EVD lock when triggering the\r
-CNO. That is the only context in which we would naturally attempt to\r
-hold both locks.\r
-\r
--- CQ -> CQEH Assignments\r
-\r
-For the initial implementation, we will assign all CQs to the same\r
-CQEH. This is for simplicity and efficient use of threading\r
-resources; we do not want to dedicate a thread per CQ (where the\r
-number of CQs may grow arbitrarily high), and we have no way of\r
-knowing which partitioning of CQs is best for the DAPL consumer.\r
-\r
-CQ Callbacks\r
-------------\r
-\r
-The responsibility of a CQ callback is to wakeup any waiters\r
-associated with the CQ--no data needs to be dequeued/delivered, since\r
-that is always done by the consumer. Therefore, CQ callbacks must be\r
-enabled when:\r
- * Any thread is in dat_evd_wait() on the EVD associated with\r
- the CQ.\r
- * The EVD is enabled and has a non-null CNO. (An alternative\r
- design would be to have waiters on a CNO enable callbacks on\r
- all CQs associated with all EVDs associated with the CNO,\r
- but this choice does not scale well as the number of EVDs\r
- associated with a CNO increases).\r
-\r
-Dynamic Resizing of EVDs\r
-------------------------\r
-\r
-dat_evd_resize() creates a special problem for the implementor, as it\r
-requires that the storage allocated in the EVD be changed in size as\r
-events may be arriving. If a lock is held by all operations that use\r
-the EVD, implementation of dat_evd_resize() is trivial; it substitutes\r
-a new storage mechanism for the old one, copying over all current\r
-events, all under lock.\r
-\r
-However, we wish to avoid universal locking for the initial\r
-implementation. This puts the implementation of dat_evd_resize() into\r
-a tar pit. Because of the DAT Consumer requirements for a non-thread\r
-safe DAPL Implementation, there will be no danger of conflict with\r
-Event Consumers. However, if an Event Producer is in process of\r
-adding an event to the circular list when the resize occurs, that\r
-event may be lost or overwrite freed memory.\r
-\r
-If we are willing to make the simplifying decision that any EVD that\r
-has non-CQ events on it will always do full producer side locking, we\r
-can solve this problem relatively easily. Resizing of the underlying\r
-CQ can be done via ib_cq_resize(), which we can assume available\r
-because of the IB spec. Resizing of the EVD storage may be done under\r
-lock, and there will be no collisions with other uses of the EVD as\r
-all other uses of the EVD must either take the lock or are prohibitted\r
-by the uDAPL spec.\r
-\r
-dat_evd_resize() has not yet been implemented in the DAPL Event\r
-subsystem.\r
-\r
-Structure and pseudo-code\r
--------------------------\r
-\r
--- EVD\r
-\r
-All EVDs will have associated with them:\r
- + a lock\r
- + A DAPL OS Wait Object\r
- + An enabled/disabled bit\r
- + A CNO pointer (may be null)\r
- + A state (no_waiter, waiter, dead)\r
- + A threshold count\r
- + An event list\r
- + A CQ (optional, but common)\r
-\r
-Posting an event to the EVD (presumably from a callback) will involve:\r
-^ + Checking for valid state\r
-|lock A + Putting the event on the event list\r
-| ^lock B + Signal the DAPL OS Wait Object, if appropriate\r
-v v (waiter & signaling event & over threshold)\r
- + Trigger the CNO if appropriate (enabled & signaling\r
- event & no waiter). Note that the EVD lock is not\r
- held for this operation to avoid holding multiple locks.\r
-\r
-("lock A" is used if producer side locking is needed. "lock B" is\r
-used if producer side locking is not needed. Regardless, the lock is\r
-only held to confirm that the EVD is in the WAITED state, not for\r
-the wakeup). \r
-\r
-Waiting on an EVD will include:\r
- + Loop:\r
- + Copy all elements from CQ to EVD\r
- + If we have enough, break\r
- + If we haven't enabled the CQ callback\r
- + Enable it\r
- + Continue\r
- + Sleep on DAPL OS Wait Object\r
- + Dequeue and return an event\r
-\r
-The CQ callback will include:\r
- + If there's a waiter:\r
- + Signal it\r
- + Otherwise, if the evd is in the OPEN state, there's\r
- a CNO, and the EVD is enabled:\r
- + Reenable completion\r
- + Trigger CNO\r
-\r
-Setting the enable/disable state of the EVD or setting the associated\r
-CNO will simply set the bits and enable the completion if needed (if a\r
-CNO trigger is implied); no locking is required.\r
-\r
--- CNO\r
-\r
-All CNOs will have associated with them:\r
- + A lock\r
- + A DAPL OS Wait Object\r
- + A state (triggered, untriggered, dead)\r
- + A waiter count\r
- + An EVD handle (last event which triggered the CNO)\r
- + An OS Proxy Wait Object pointer (may be null)\r
-\r
-Triggering a CNO will involve:\r
- ^ + If the CNO state is untriggerred:\r
- | + Set it to triggered\r
- | + Note the OS Proxy wait object and zero it.\r
- | + If there are any waiters associated with the CNO,\r
- | signal them.\r
- v + Signal the OS proxy wait object if noted\r
-\r
-Waiting on a CNO will involve:\r
- ^ + While the state is not triggered and the timeout has not occurred:\r
- | + Increment the CNO waiter count\r
- lock + Wait on the DAPL OS Wait Object\r
- | + Decrement the CNO waiter count\r
- v + If the state is trigerred, note fact&EVD and set to untrigerred.\r
- + Return EVD and success if state was trigerred\r
- + Return timeout otherwise\r
-\r
-Setting the OS Proxy Wait Object on a CNO, under lock, checks for a\r
-valid state and sets the OS Proxy Wait Object.\r
-\r
-\r
-==============\r
-Known Problems\r
-==============\r
-\r
--- Because many event streams are actually delivered to EVDs by\r
- callbacks, we cannot in general make any guarantees about the order\r
- in which those event streams arrive; we are at the mercy of the\r
- thread scheduler. Thus we cannot hold to the guarantee given by\r
- the uDAPL 1.0 specification that within a particular EVD,\r
- connection events on a QP will always be before successful DTO\r
- operations on that QP.\r
-\r
- Because we have chosen to dequeue EVD events first and CQ events\r
- second, we will also not be able to guarantee that all successful\r
- DTO events will be received before a disconnect event. Ability to\r
- probe the CQ for its number of entries would solve this problem.\r
-\r
-\r
-=================\r
-Future Directions\r
-=================\r
-\r
-This section includes both functionality enhancements, and a series of\r
-performance improvements. I mark these performance optimizations with\r
-the following flags:\r
- * VerbMod: Requires modifications to the IB Verbs/the IBM\r
- Access API to be effective.\r
- * VerbInteg: Requires integration between the DAPL\r
- implementation and the IB Verbs implementation and IB device\r
- driver.\r
-\r
-Functionality Enhancements\r
---------------------------\r
-\r
--- dat_evd_resize() may be implemented by forcing producer side\r
- locking whenever an event producer may occur asynchronously with\r
- calls to dat_evd_resize() (i.e. when there are non-CQ event streams\r
- associated with the EVD). See the details under "Dynamic Resizing\r
- of EVDs" above.\r
-\r
--- [VerbMod] If we ahd a verbs modification allowing us to probe for\r
- the current number of entries on a CQ, we could:\r
- * Avoid waking up a dat_evd_wait(threshold>1) thread until\r
- there were enough events for it.\r
- * Avoid copying events from the CQ to the EVD to satisfy the\r
- requirements of the "*nmore" out argument to dat_evd_wait(),\r
- as well as the non-unary threshold argument.\r
- * Implement the "all successful DTO operation events before\r
- disconnect event" uDAPL guarantee (because we would no\r
- longer have to copy CQ events to an EVD, and hence dequeue\r
- first from the EVD and then from the CQ.\r
- This optimization also is relevant for two of the performance\r
- improvements cases below (Reducing context switches, and reducing\r
- copies).\r
-\r
-\r
-Performance improvements: Reducing context switches\r
----------------------------------------------------\r
--- [VerbMod] If we had a verbs modification allowing us to probe for\r
- the current size of a CQ, we could avoid waking up a\r
- dat_evd_wait(threshhold>1) thread until there were enough events\r
- for it. See the Functionality Enhancement entry covering this\r
- possibility.\r
-\r
--- [VerbMod] If we had a verbs modification allowing threads to wait\r
- for completions to occur on CQs (presumably in the kernel in some\r
- efficient manner), we could optimize the case of\r
- dat_evd_wait(...,threshold=1,...) on EVDs with only a single CQ\r
- associated Event Stream. In this case, we could avoid the extra\r
- context switch into the user callback thread; instead, the user\r
- thread waiting on the EVD would be woken up by the kernel directly.\r
-\r
--- [VerbMod] If we had the above verbs modification with a threshold\r
- argument on CQs, we could implement the threshold=n case.\r
-\r
--- [VerbInteg] In general, It would be useful to provide ways for\r
- threads blocked on EVDs or CNOs to sleep in the hardware driver,\r
- and for the driver interrupt thread to determine if they should be\r
- awoken rather than handing that determination off to another,\r
- user-level thread. This would allow us to reduce by one the number\r
- of context switches required for waking up the various blocked\r
- threads.\r
-\r
--- If an EVD has only a single Event Stream coming into it that is\r
- only associated with one work queue (send or receive), it may be\r
- possible to create thresholding by marking only ever nth WQE on\r
- the associated send or receive WQ to signal a completion. The\r
- difficulty with this is that the threshold is specified when\r
- waiting on an EVD, and requesting completion signaling is\r
- specified when posting a WQE; those two events may not in general\r
- be synchronized enough for this strategy. It is probably\r
- worthwhile letting the consumer implement this strategy directly if\r
- they so choose, by specifying the correct flags on EP and DTO so\r
- that the CQ events are only signaling on every nth completion.\r
- They could then use dat_evd_wait() with a threshold of 1.\r
-\r
-Performance improvements: Reducing copying of event data\r
---------------------------------------------------------\r
--- [VerbMod] If we had the ability to query a CQ for the number of\r
- completions on it, we could avoid the cost of copying event data from the\r
- CQ to the EVD. This is a duplicate of the second entry under\r
- "Functionality Enhancements" above.\r
-\r
-Performance improvements: Reducing locking\r
-------------------------------------------\r
--- dat_evd_dequeue() may be modified to not take any locks.\r
-\r
--- If there is no waiter associated with an EVD and there is only a\r
- single event producer, we may avoid taking any locks in producing\r
- events onto that EVD. This must be done carefully to handle the\r
- case of racing with a waiter waiting on the EVD as we deliver the\r
- event.\r
-\r
--- If there is no waiter associated with an EVD, and we create a\r
- producer/consumer queue per event stream with a central counter\r
- modified with atomic operations, we may avoid locking on the EVD.\r
-\r
--- It may be possible, though judicious use of atomic operations, to\r
- avoid locking when triggering a CNO unless there is a waiter on the\r
- CNO. This has not been done to keep the initial design simple.\r
-\r
-Performance improvements: Reducing atomic operations\r
-----------------------------------------------------\r
--- We could combine the EVD circular lists, to avoid a single atomic\r
- operation on each production and each consumption of an event. In\r
- this model, event structures would not move from list to list;\r
- whether or not they had valid information on them would simply\r
- depend on where they were on the lists.\r
-\r
--- We may avoid the atomic increments on the circular queues (which\r
- have a noticeable performance cost on the bus) if all accesses to an\r
- EVD take locks.\r
-\r
-\r
-Performance improvements: Increasing concurrency\r
-------------------------------------------------\r
--- When running on a multi-CPU platform, it may be appropriate to\r
- assign CQs to several separate CQEHs, to increase the concurrency\r
- of execution of CQ callbacks. However, note that consumer code is\r
- never run within a CQ callback, so those callbacks should take very\r
- little time per callback. This plan would only make sense in\r
- situations where there were very many CQs, all of which were\r
- active, and for whatever reason (high threshold, polling, etc)\r
- user threads were usually not woken up by the execution of a\r
- provider CQ callback.\r
-\r
-\r
+++ /dev/null
-#######################################################################\r
-# #\r
-# DAPL Memory Management Design #\r
-# #\r
-# James Lentini #\r
-# jlentini at users.sourceforge.net #\r
-# #\r
-# Created 05/06/2002 #\r
-# Updated 08/22/2002 #\r
-# #\r
-#######################################################################\r
-\r
-\r
-Contents\r
--------\r
-0. Introduction\r
-1. Protection Zones (PZs)\r
-2. Local Memory Regions (LMRs)\r
-3. Remote Memory Regions (RMRs)\r
-\r
-\r
-0. Introduction\r
----------------\r
-\r
- The memory management subsystem allows consumers to register and \r
-unregister memory regions. The DAT API distinguishes between local \r
-and remote memory areas. The former server as local buffers for DTO \r
-operations while the later are used for RDMA operations. \r
-\r
-Each DAT function is implemented in a file named dapl_<function name>.c. \r
-For example, dat_pz_create is implemented in dapl_pz_create.c. There \r
-are also dapl_<object name>_util.{h,c} files for each object. For \r
-example, there are dapl_pz_util.h and dapl_pz_util.c files. The \r
-use of util files follows the convention used elsewhere in the DAPL \r
-reference provider. These files contain common object creation and \r
-destruction code.\r
-\r
-\r
-1. Protection Zones (PZs)\r
--------------------------\r
-\r
- DAPL protection zones provide consumers with a means to associate \r
-various DAPL objects with one another. The association can then be \r
-validated before allowing these objects to be manipulated. The DAT \r
-functions related to PZs are:\r
-\r
-dat_pz_create\r
-dat_pz_free\r
-dat_pz_query\r
-\r
-These are implemented in the DAPL reference provider by \r
-\r
-dapl_pz_create\r
-dapl_pz_free\r
-dapl_pz_query\r
-\r
-The reference implementation maps the DAPL PZ concept onto Infiniband \r
-protections domains (PDs). \r
-\r
-The DAT_PZ_HANDLE value returned to DAT consumers is a pointer to a \r
-DAPL_PZ data structure. The DAPL_PZ structure is used to represent all \r
-PZ objects. Code that manipulates this structure should atomically \r
-increment and decrement the ref_count member to track the number of \r
-objects referencing the PZ.\r
-\r
-\r
-2. Local Memory Regions (LMRs)\r
-------------------------------\r
-\r
- DAPL local memory regions represent a memory area on the host \r
-system that the consumer wishes to access via local DTO operations. \r
-The DAT functions related to LMRs are:\r
-\r
-dat_lmr_create\r
-dat_lmr_free\r
-dat_lmr_query\r
-\r
-These are implemented in \r
-\r
-dapl_lmr_create\r
-dapl_lmr_free\r
-dapl_lmr_query\r
-\r
-In the reference implementation, DAPL LMRs are mapped onto \r
-Infiniband memory regions (MRs). \r
-\r
-LMR creation produces two values: a DAT_LMR_CONTEXT and a \r
-DAT_LRM_HANDLE. \r
-\r
-The DAT_LMR_CONTEXT value is used to uniquely identify the LMR \r
-when posting data transfer operations. These values map directly \r
-to Infiniband L_KEYs.\r
-\r
-Since some DAT functions need to translate a DAT_LMR_CONTEXT value \r
-into a DAT_LMR_HANDLE (ex. dat_rmr_bind), a dictionary data structure \r
-is used to associate DAT_LMR_CONTEXT values with their corresponding \r
-DAT_LMR_HANDLE. Each time a new LMR is created, the DAT_LMR_HANDLE \r
-should be inserted into the dictionary with the associated \r
-DAT_LMR_CONTEXT as the key. \r
-\r
-A hash table was chosen to implement this data structure. Since the \r
-L_KEY values are being used by the CA hardware for indexing purposes, \r
-there distribution is expected to be uniform and hence ideal for hashing.\r
-\r
-The DAT_LMR_HANDLE value returned to DAT consumers is a pointer to \r
-a DAPL_LMR data structure. The DAPL_LMR structure is used to represent \r
-all LMR objects. The ref_count member should be used to track objects \r
-associated with a given LMR.\r
-\r
-The DAT API exposes the DAT_LMR_CONTEXT to consumers to allow \r
-for sharing of memory registrations between multiple address spaces. \r
-The mechanism by which such a feature would be implemented does not \r
-yet exist. Consumers may be able to take advantage of this \r
-feature on future transports. \r
-\r
-\r
-3. Remote Memory Regions (RMRs)\r
--------------------------------\r
-\r
- DAPL remote memory regions represent a memory area on the host \r
-system to which the consumer wishes to allow RMDA operations. The \r
-related DAT functions are\r
-\r
-dat_rmr_create\r
-dat_rmr_free\r
-dat_rmr_query\r
-dat_rmr_bind\r
-\r
-which are implemented in \r
-\r
-dapl_rmr_create\r
-dapl_rmr_free\r
-dapl_rmr_query\r
-dapl_rmr_bind\r
-\r
-The reference provider maps RMR objects onto Infiniband memory \r
-windows.\r
-\r
-The DAT_RMR_HANDLE value returned to DAT consumers is a pointer to \r
-a DAPL_RMR data structure. The DAPL_RMR structure is used to represent \r
-all RMR objects.\r
-\r
-The API for binding a LMR to a RMR has the following function \r
-signature:\r
-\r
-DAT_RETURN\r
-dapl_rmr_bind (\r
- IN DAT_RMR_HANDLE rmr_handle,\r
- IN const DAT_LMR_TRIPLET *lmr_triplet,\r
- IN DAT_MEM_PRIV_FLAGS mem_priv,\r
- IN DAT_EP_HANDLE ep_handle,\r
- IN DAT_RMR_COOKIE user_cookie,\r
- IN DAT_COMPLETION_FLAGS completion_flags,\r
- OUT DAT_RMR_CONTEXT *rmr_context )\r
-\r
-where a DAT_LMR_TRIPLET is defined as: \r
-\r
-typedef struct dat_lmr_triplet\r
- {\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_UINT32 pad;\r
- DAT_VADDR virtual_address;\r
- DAT_VLEN segment_length;\r
- } DAT_LMR_TRIPLET;\r
-\r
-In the case of IB, the DAT_LMR_CONTEXT value is a L_KEY.\r
-As described in the IB spec, the Bind Memory Window verb \r
-takes both a L_KEY and Memory Region Handle among other \r
-parameters. Therefore a data structure must be used to \r
-map a DAT_LMR_CONTEXT (L_KEY) value to a DAPL_LMR so \r
-that the needed memory region handle can be retrieved.\r
-The LMR hash table described above is used for this \r
-purpose.\r
+++ /dev/null
- DAT Registry Subsystem Design v. 0.90\r
- -------------------------------------\r
-\r
-=================\r
-Table of Contents\r
-=================\r
-\r
-* Table of Contents\r
-* Referenced Documents\r
-* Introduction\r
-* Goals\r
-* Provider API\r
-* Consumer API\r
-* Registry Design\r
- + Registry Database\r
- + Provider API pseudo-code\r
- + Consumer API pseudo-code\r
- + Platform Specific API pseudo-code\r
-\r
-====================\r
-Referenced Documents\r
-====================\r
-\r
-uDAPL: User Direct Access Programming Library, Version 1.0. Published\r
-6/21/2002. http://www.datcollaborative.org/uDAPL_062102.pdf. Referred\r
-to in this document as the "DAT Specification". \r
-\r
-============\r
-Introduction\r
-============\r
-\r
-The DAT architecture supports the use of multiple DAT providers within\r
-a single consumer application. Consumers implicitly select a provider\r
-using the Interface Adapter name parameter passed to dat_ia_open(). \r
-\r
-The subsystem that maps Interface Adapter names to provider\r
-implementations is known as the DAT registry. When a consumer calls\r
-dat_ia_open(), the appropriate provider is found and notified of the\r
-consumer's request to access the IA. After this point, all DAT API\r
-calls acting on DAT objects are automatically directed to the\r
-appropriate provider entry points.\r
-\r
-A persistent, administratively configurable database is used to store\r
-mappings from IA names to provider information. This provider\r
-information includes: the file system path to the provider library\r
-object, version information, and thread safety information. The\r
-location and format of the registry is platform dependent. This\r
-database is know as the Static Registry (SR). The process of adding a\r
-provider entry is termed Static Registration. \r
-\r
-Within each DAT consumer, there is a per-process database that\r
-maps from ia_name -> provider information. When dat_ia_open() is\r
-called, the provider library is loaded, the ia_open_func is found, and\r
-the ia_open_func is called. \r
-\r
-=====\r
-Goals\r
-=====\r
-\r
--- Implement the registration mechanism described in the uDAPL\r
- Specification. \r
-\r
--- The DAT registry should be thread safe.\r
- \r
--- On a consumer's performance critical data transfer path, the DAT\r
- registry should not require any significant overhead. \r
-\r
--- The DAT registry should not limit the number of IAs or providers\r
- supported. \r
-\r
--- The user level registry should be tolerant of arbitrary library \r
- initialization orders and support calls from library initialization \r
- functions.\r
-\r
-============\r
-Provider API\r
-============\r
-\r
-Provider libraries must register themselves with the DAT registry.\r
-Along with the Interface Adapter name they wish to map, they must\r
-provide a routines vector containing provider-specific implementations\r
-of all DAT APIs. If a provider wishes to service multiple Interface\r
-Adapter names with the same DAT APIs, it must register each name\r
-separately with the DAT registry. The Provider API is not exposed to\r
-consumers.\r
-\r
-The user level registry must ensure that the Provider API may be\r
-called from a library's initialization function. Therefore the\r
-registry must not rely on a specific library initialization order.\r
-\r
- DAT_RETURN\r
- dat_registry_add_provider(\r
- IN DAT_PROVIDER *provider ) \r
-\r
-Description: Allows the provider to add a mapping. It will return an\r
-error if the Interface Adapter name already exists. \r
-\r
- DAT_RETURN\r
- dat_registry_remove_provider(\r
- IN DAT_PROVIDER *provider )\r
-\r
-Description: Allows the Provider to remove a mapping. It will return\r
-an error if the mapping does not already exist. \r
-\r
-============\r
-Consumer API\r
-============\r
-\r
-Consumers that wish to use a provider library call the DAT registry to\r
-map Interface Adapter names to provider libraries. The consumer API is\r
-exposed to both consumers and providers.\r
-\r
- DAT_RETURN\r
- dat_ia_open (\r
- IN const DAT_NAME device_name,\r
- IN DAT_COUNT async_event_qlen,\r
- INOUT DAT_EVD_HANDLE *async_event_handle,\r
- OUT DAT_IA_HANDLE *ia_handle )\r
-\r
-Description: Upon success, this function returns an DAT_IA_HANDLE to\r
-the consumer. This handle, while opaque to the consumer, provides\r
-direct access to the provider supplied library. To support this\r
-feature, all DAT_HANDLEs must be pointers to a pointer to a\r
-DAT_PROVIDER structure.\r
-\r
- DAT_RETURN\r
- dat_ia_close (\r
- IN DAT_IA_HANDLE ia_handle )\r
-\r
-Description: Closes the Interface Adapter.\r
-\r
- DAT_RETURN\r
- dat_registry_list_providers(\r
- IN DAT_COUNT max_to_return,\r
- OUT DAT_COUNT *entries_returned,\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[]) )\r
-\r
-Description: Lists the current mappings.\r
-\r
-===============\r
-Registry Design\r
-===============\r
-\r
-There are three separate portions of the DAT registry system:\r
-\r
-* Registry Database\r
-\r
-* Provider API\r
-\r
-* Consumer API \r
-\r
-We address each of these areas in order. The final section will\r
-describe any necessary platform specific functions.\r
-\r
-Registry Database\r
------------------\r
-\r
-Static Registry\r
-................\r
-\r
-The Static Registry is a persistent database containing provider\r
-information keyed by Interface Adapter name. The Static Registry will\r
-be examined once when the DAT library is loaded. \r
-\r
-There is no synchronization mechanism protecting access to the Static\r
-Registry. Multiple readers and writers may concurrently access the\r
-Static Registry and as a result there is no guarantee that the\r
-database will be in a consistent format at any given time. DAT\r
-consumers should be aware of this and not run DAT programs when the\r
-registry is being modified (for example, when a new provider is being\r
-installed). However, the DAT library must be robust enough to recognize\r
-an inconsistent Static Registry and ignore invalid entries.\r
-\r
-Information in the Static Registry will be used to initialize the\r
-registry database. The registry will refuse to load libraries for DAT\r
-API versions different than its DAT API version. Switching API\r
-versions will require switching versions of the registry library (the\r
-library explicitly placed on the link line of DAPL programs) as well\r
-as the header files included by the program. \r
-\r
-Set DAT_NO_STATIC_REGISTRY at compile time if you wish to compile\r
-DAT without a static registry.\r
-\r
-UNIX Registry Format\r
-.....................\r
-\r
-The UNIX registry will be a plain text file with the following\r
-properties: \r
- * All characters after # on a line are ignored (comments). \r
- * Lines on which there are no characters other than whitespace\r
- and comments are considered blank lines and are ignored.\r
- * Non-blank lines must have seven whitespace separated fields.\r
- These fields may contain whitespace if the field is quoted\r
- with double quotes. Within fields quoated with double quotes, \r
- the following are valid escape sequences:\r
-\r
- \\ backslash\r
- \" quote\r
-\r
- * Each non-blank line will contain the following fields:\r
-\r
- - The IA Name.\r
- - The API version of the library:\r
- [k|u]major.minor where "major" and "minor" are both integers\r
- in decimal format. Examples: "k1.0", "u1.0", and "u1.1".\r
- - Whether the library is thread-safe:\r
- [threadsafe|nonthreadsafe]\r
- - Whether this is the default section: [default|nondefault]\r
- - The path name for the library image to be loaded. \r
- - The version of the driver: major.minor, for example, "5.13".\r
-\r
-The format of any remaining fields on the line is dependent on the API\r
-version of the library specified on that line. For API versions 1.0\r
-and 1.1 (both kDAPL and uDAPL), there is only a single additional\r
-field, which is:\r
-\r
- - An optional string with instance data, which will be passed to \r
- the loaded library as its run-time arguments.\r
-\r
-This file format is described by the following grammar:\r
-\r
-<entry-list> -> <entry> <entry-list> | <eof>\r
-<entry> -> <ia-name> <api-ver> <thread-safety> <default-section>\r
- <lib-path> <driver-ver> <ia-params> [<eor>|<eof>] | \r
- [<eor>|<eof]\r
-<ia-name> -> string\r
-<api-ver> -> [k|u]decimal.decimal\r
-<thread-safety> -> [threadsafe|nonthreadsafe]\r
-<default-section> -> [default|nondefault]\r
-<lib-path> -> string\r
-<driver-ver> -> decimal.decimal\r
-<ia-params> -> string\r
-<eof> -> end of file\r
-<eor> -> newline\r
-\r
-The location of this file may be specified by setting the environment\r
-variable DAT_CONF. If DAT_CONF is not set, the default location will\r
-be /etc/dat.conf.\r
-\r
-Windows Registry Format\r
-.......................\r
-\r
-Standardization of the Windows registry format is not complete at this\r
-time.\r
-\r
-Registry Database Data Structures\r
-.................................\r
-\r
-The Registry Database is implemented as a dictionary data structure that\r
-stores (key, value) pairs. \r
-\r
-Initially the dictionary will be implemented as a linked list. This\r
-will allow for an arbitrary number of mappings within the resource\r
-limits of a given system. Although the search algorithm will have O(n)\r
-worst case time when n elements are stored in the data structure, we\r
-do not anticipate this to be an issue. We believe that the number of\r
-IA names and providers will remain relatively small (on the order of\r
-10). If performance is found to be an issue, the dictionary can be\r
-re-implemented using another data structure without changing the\r
-Registry Database API. \r
-\r
-The dictionary uses IA name strings as keys and stores pointers to a\r
-DAT_REGISTRY_ENTRY structure, which contains the following\r
-information: \r
-\r
- - provider library path string, library_path\r
- - DAT_OS_LIBRARY_HANDLE, library_handle\r
- - IA parameter string, ia_params\r
- - DAT_IA_OPEN_FUNC function pointer, ia_open_func\r
- - thread safety indicator, is_thread_safe\r
- - reference counter, ref_count\r
-\r
-The entire registry database data structure is protected by a single\r
-lock. All threads that wish to query/modify the database must posses\r
-this lock. Serializing access in this manner is not expected to have a\r
-detrimental effect on performance as contention is expected to be\r
-minimal. \r
-\r
-An important property of the registry is that entries may be inserted\r
-into the registry, but no entries are ever removed. The contents of\r
-the static registry are used to populate the initially empty registry\r
-database. Since these mapping are by definition persistent, no\r
-mechanism is provided to remove them from the registry database.\r
-\r
-NOTE: There is currently no DAT interface to set a provider's IA \r
-specific parameters. A solution for this problem has been proposed for\r
-uDAPL 1.1.\r
-\r
-Registry Database API\r
-.....................\r
-\r
-The static variable Dat_Registry_Db is used to store information about\r
-the Registry Database and has the following members:\r
-\r
- - lock\r
- - dictionary\r
-\r
-The Registry Database is accessed via the following internal API:\r
-\r
-Algorithm: dat_registry_init\r
- Input: void\r
- Output: DAT_RETURN\r
-{\r
- initialize Dat_Registry_Db\r
-\r
- dat_os_sr_load()\r
-}\r
-\r
-Algorithm: dat_registry_insert\r
- Input: IN const DAT_STATIC_REGISTRY_ENTRY sr_entry\r
- Output: DAT_RETURN\r
-{\r
- dat_os_lock(&Dat_Registry_Db.lock)\r
-\r
- create and initialize DAT_REGISTRY_ENTRY structure \r
-\r
- dat_dictionary_add(&Dat_Registry_Db.dictionary, &entry)\r
-\r
- dat_os_unlock(&Dat_Registry_Db.lock)\r
-}\r
-\r
-Algorithm: dat_registry_search\r
- Input: IN const DAT_NAME_PTR ia_name\r
- IN DAT_REGISTRY_ENTRY **entry\r
- Output: DAT_RETURN\r
-{\r
- dat_os_lock(&Dat_Registry_Db.lock)\r
-\r
- entry gets dat_dictionary_search(&Dat_Registry_Db.dictionary, &ia_name)\r
-\r
- dat_os_unlock(&Dat_Registry_Db.lock)\r
-}\r
-\r
-Algorithm: dat_registry_list\r
- Input: IN DAT_COUNT max_to_return\r
- OUT DAT_COUNT *entries_returned\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[])\r
- Output: DAT_RETURN\r
-{\r
- dat_os_lock(&Dat_Registry_Db.lock)\r
-\r
- size = dat_dictionary_size(Dat_Registry_Db.dictionary)\r
-\r
- for ( i = 0, j = 0; \r
- (i < max_to_return) && (j < size); \r
- i++, j++ ) \r
- {\r
- initialize dat_provider_list[i] w/ j-th element in dictionary\r
- }\r
-\r
- dat_os_unlock(&Dat_Registry_Db.lock)\r
-\r
- *entries_returned = i;\r
-}\r
-\r
-Provider API pseudo-code\r
-------------------------\r
-\r
-+ dat_registry_add_provider()\r
-\r
-Algorithm: dat_registry_add_provider\r
- Input: IN DAT_PROVIDER *provider\r
- Output: DAT_RETURN\r
-{\r
- dat_init()\r
-\r
- dat_registry_search(provider->device_name, &entry)\r
-\r
- if IA name is not found then dat_registry_insert(new entry)\r
-\r
- if entry.ia_open_func is not NULL return an error\r
-\r
- entry.ia_open_func = provider->ia_open_func\r
-}\r
-\r
-+ dat_registry_remove_provider()\r
-\r
-Algorithm: dat_registry_remove_provider\r
- Input: IN DAT_PROVIDER *provider \r
- Output: DAT_RETURN\r
-{\r
- dat_init()\r
-\r
- dat_registry_search(provider->device_name, &entry)\r
-\r
- if IA name is not found return an error\r
-\r
- entry.ia_open_func = NULL\r
-} \r
-\r
-Consumer API pseudo-code\r
-------------------------\r
-\r
-* dat_ia_open() \r
-\r
-This function looks up the specified IA name in the ia_dictionary, \r
-loads the provider library, retrieves a function pointer to the\r
-provider's IA open function from the provider_dictionary, and calls\r
-the providers IA open function. \r
-\r
-Algorithm: dat_ia_open\r
- Input: IN const DAT_NAME_PTR name\r
- IN DAT_COUNT async_event_qlen\r
- INOUT DAT_EVD_HANDLE *async_event_handle\r
- OUT DAT_IA_HANDLE *ia_handle\r
- Output: DAT_RETURN \r
-\r
-{\r
- dat_registry_search(name, &entry)\r
-\r
- if the name is not found return an error\r
- \r
- dat_os_library_load(entry.library_path, &entry.library_handle)\r
-\r
- if the library fails to load return an error\r
- \r
- if the entry's ia_open_func is invalid \r
- {\r
- dl_os_library_unload(entry.library_handle)\r
- return an error\r
- }\r
-\r
- (*ia_open_func) (name, \r
- async_event_qlen,\r
- async_event_handle,\r
- ia_handle);\r
-}\r
-\r
-* dat_ia_close()\r
-\r
-Algorithm: dat_ia_close\r
- Input: IN DAT_IA_HANDLE ia_handle\r
- IN DAT_CLOSE_FLAGS ia_flags\r
- Output: DAT_RETURN \r
-{\r
- provider = DAT_HANDLE_TO_PROVIDER(ia_handle)\r
-\r
- (*provider->ia_close_func) (ia_handle, ia_flags)\r
-\r
- dat_registry_search(provider->device_name, &entry)\r
-\r
- dat_os_library_unload(entry.library_handle)\r
-}\r
-\r
-+ dat_registry_list_providers()\r
-\r
-Algorithm: dat_registry_list_providers\r
- Input: IN DAT_COUNT max_to_return\r
- OUT DAT_COUNT *entries_returned\r
- OUT DAT_PROVIDER_INFO *(dat_provider_list[])\r
- Output: DAT_RETURN\r
-{\r
- validate parameters\r
-\r
- dat_registry_list(max_to_return, entries_returned, dat_provider_list)\r
-}\r
-\r
-Platform Specific API pseudo-code\r
---------------------------------\r
-\r
-Below are descriptions of platform specific functions required by the\r
-DAT Registry. These descriptions are for Linux.\r
-\r
-Each entry in the static registry is represented by an OS specific\r
-structure, DAT_OS_STATIC_REGISTRY_ENTRY. On Linux, this structure will\r
-have the following members:\r
-\r
- - IA name string\r
- - API version\r
- - thread safety \r
- - default section\r
- - library path string\r
- - driver version\r
- - IA parameter string\r
-\r
-The tokenizer will return a DAT_OS_SR_TOKEN structure\r
-containing:\r
-\r
- - DAT_OS_SR_TOKEN_TYPE value\r
- - string with the fields value\r
-\r
-The tokenizer will ignore all white space and comments. The tokenizer\r
-will also translate any escape sequences found in a string.\r
-\r
-Algorithm: dat_os_sr_load\r
- Input: n/a\r
- Output: DAT_RETURN\r
-{\r
- if DAT_CONF environment variable is set\r
- static_registry_file = contents of DAT_CONF\r
- else\r
- static_registry_file = /etc/dat.conf\r
-\r
- sr_fd = dat_os_open(static_registry_file)\r
-\r
- forever\r
- {\r
- initialize DAT_OS_SR_ENTRY entry\r
-\r
- do \r
- {\r
- // discard blank lines\r
- dat_os_token_next(sr_fd, &token)\r
- } while token is newline\r
-\r
- if token type is EOF then break // all done\r
- // else the token must be a string\r
- \r
- entry.ia_name = token.value\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
- else if ( dat_os_convert_api(token.value, &entry.api) fails )\r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
- else if ( dat_os_convert_thread_safety(token.value, &entry.thread_safety) fails )\r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
- else if ( dat_os_convert_default(token.value, &entry.default) fails )\r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- entry.lib_path = token.value\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
- else if ( dat_os_convert_driver_version(token.value, &entry.driver_version) fails )\r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not string then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
-\r
- entry.ia_params = token.value\r
-\r
- dat_os_token_next(sr_fd, &token)\r
-\r
- if token type is EOF then break // all done\r
- else if token type is not newline then \r
- {\r
- // an error has occurred\r
- dat_os_token_sync(sr_fd)\r
- continue\r
- }\r
- \r
- if ( dat_os_sr_is_valid(entry) )\r
- {\r
- dat_registry_insert(entry)\r
- }\r
- }\r
-\r
- dat_os_close(sr_fd)\r
-}\r
-\r
-Algorithm: dat_os_library_load\r
- Input: IN const DAT_NAME_PTR *library_path\r
- OUT DAT_LIBRARY_HANDLE *library_handle\r
- Output: DAT_RETURN\r
-{\r
- *library_handle = dlopen(library_path);\r
-}\r
-\r
-Algorithm: dat_os_library_unload\r
- Input: IN const DAT_LIBRARY_HANDLE library_handle\r
- Output: DAT_RETURN\r
-{\r
- dlclose(library_handle)\r
-}\r
+++ /dev/null
-#######################################################################\r
-# #\r
-# DAPL Shared Memory Design #\r
-# #\r
-# James Lentini #\r
-# jlentini at users.sourceforge.net #\r
-# #\r
-# Created 09/17/2002 #\r
-# Version 0.03 #\r
-# #\r
-#######################################################################\r
-\r
-\r
-Contents\r
---------\r
-0. Introduction\r
-1. Referenced Documents\r
-2. Requirements\r
-3. Interface\r
-4. Implementation Options\r
-\r
-\r
-Introduction\r
-------------\r
-\r
-This document describes the design of shared memory registration for \r
-the DAPL reference implementation (RI).\r
-\r
-Implementing shared memory support completely within the DAPL RI \r
-would not be a ideal solution. A more robust and efficient\r
-implementation can be acheived by HCA vendors that integrate a DAT\r
-provider into their software stack. Therefore the RI will not contain\r
-an implementation of this feature. \r
-\r
-\r
-Referenced Documents\r
---------------------\r
-\r
-uDAPL: User Direct Access Programming Library, Version 1.1.\r
-Available at http://www.datcollaborative.org/uDAPLv11.pdf.\r
-Referred to in this document as the "DAT Specification".\r
-\r
-InfiniBand Access Application Programming Interface Specification,\r
-Version 1.2, 4/15/2002. In DAPL SourceForge repository at\r
-doc/api/access_api.pdf. Referred to in this document as the "IBM\r
-Access API Specification".\r
-\r
-InfiniBand Architecture Specification, Volumes 1 and 2, Release\r
-1.1, Available from http://www.infinibandta.org/\r
-Referred to in this document as the "Infiniband Specification".\r
-\r
-\r
-Requirements\r
-------------\r
-\r
-The DAT shared memory model can be characterized as a peer-to-peer\r
-model since the order in which consumers register a region is not\r
-dictated by the programming interface.\r
-\r
-The DAT API function used to register shared memory is:\r
-\r
-DAT_RETURN\r
-dat_lmr_create (\r
- IN DAT_IA_HANDLE ia_handle,\r
- IN DAT_MEM_TYPE mem_type,\r
- IN DAT_REGION_DESCRIPTION region_description,\r
- IN DAT_VLEN length,\r
- IN DAT_PZ_HANDLE pz_handle,\r
- IN DAT_MEM_PRIV_FLAGS mem_privileges,\r
- OUT DAT_LMR_HANDLE *lmr_handle,\r
- OUT DAT_LMR_CONTEXT *lmr_context,\r
- OUT DAT_RMR_CONTEXT *rmr_context,\r
- OUT DAT_VLEN *registered_length,\r
- OUT DAT_VADDR *registered_address );\r
-\r
-where a DAT_REGION_DESCRIPTION is defined as:\r
-\r
-typedef union dat_region_description\r
- {\r
- DAT_PVOID for_va;\r
- DAT_LMR_HANDLE for_lmr_handle;\r
- DAT_SHARED_MEMORY for_shared_memory;\r
- } DAT_REGION_DESCRIPTION;\r
-\r
-In the case of a shared memory registration the DAT consumer will set\r
-the DAT_MEM_TYPE flag to DAT_MEM_TYPE_SHARED_VIRTUAL and place a\r
-cookie in the DAT_REGION_DESCRIPTION union's DAT_SHARED_MEMORY\r
-member. The DAT_SHARED_MEMORY type is defined as follows:\r
-\r
-typedef struct dat_shared_memory\r
- {\r
- DAT_PVOID virtual_address;\r
- DAT_LMR_COOKIE shared_memory_id;\r
- } DAT_SHARED_MEMORY;\r
-\r
-Unlike the DAT peer-to-peer model, the Infiniband shared memory model\r
-requires a master-slave relationship. A memory region must first be\r
-registered using the Register Memory Region verb with subsequent\r
-registrations made using the Register Shared Memory Region verb. This \r
-verb is implemented in the IBM OS Access API as:\r
-\r
-ib_int32_t \r
-ib_mr_shared_register_us( \r
- ib_hca_handle_t hca_handle,\r
- ib_mr_handle_t *mr_handle, /* IN-OUT: could be changed */\r
- ib_pd_handle_t pd_handle, /* IN */\r
- ib_uint32_t access_control, /* IN */\r
- ib_uint32_t *l_key, /* OUT */\r
- ib_uint32_t *r_key, /* OUT: if remote access needed */\r
- ib_uint8_t **va ); /* IN-OUT: virt. addr. to register */\r
-\r
-The important parameter is the memory region handle which must be the\r
-same as an already registered region.\r
-\r
-Two requirements are implied by this difference between the DAT and \r
-Infiniband models. First, DAPL implementations need a way to determine\r
-the first registration of a shared region. Second implementations must\r
-map DAT_LMR_COOKIE values to memory region handles both within and\r
-across processes. To satisfy the above requirements DAPL must maintain\r
-this information in a system wide database.\r
-\r
-The difficulty of implementing such a database at the DAT provider\r
-level is the reason the RI's shared memory code is meant to be\r
-temporary. Such a database is much better suited as part of the HCA\r
-vendor's software stack, specifically as part of their HCA driver. \r
-\r
-If DAPL was based on a master-slave model like InfiniBand, the\r
-implementation of shared memory would be straight\r
-forward. Specifically the complexity is a result of the consumer being\r
-responsible for specifying the DAT_LMR_COOKIE values. If the DAPL\r
-spec. were changed to allow the provider and not the consumer to\r
-specify the DAT_LMR_COOKIE value, the implementation of this feature\r
-would be greatly simplified. Since the DAPL API already requires\r
-consumers to communicate the DAT_LMR_COOKIE values between processes,\r
-such a change places minimal additional requirements on the\r
-consumer. The dapl_lmr_query call could easily be adapted to allow the\r
-consumer to query the provider for a given LMR's DAT_LMR_COOKIE\r
-value. The only spec changes needed would be to add a DAT_LMR_COOKIE\r
-member to the DAT_LMR_PARAM structure and a DAT_LMR_FIELD_LMR_COOKIE\r
-constant to the DAT_LMR_PARAM_MASK enumeration. A provider could then\r
-store the given LMR's memory region handle in this value, greatly\r
-simplifying the implementation of shared memory in DAPL. \r
-\r
-\r
-Interface\r
----------\r
-\r
-To allow the database implementation to easily change, the RI would use\r
-a well defined interface between the memory subsystem and the\r
-database. Conceptually the database would contain a single table with\r
-the following columns:\r
-\r
-[ LMR Cookie ][ MR Handle ][ Reference Count ][ Initialized ]\r
-\r
-where the LMR Cookie column is the primary key.\r
-\r
-The following functions would be used to access the database:\r
-\r
-DAT_RETURN\r
-dapls_mrdb_init (\r
- void );\r
-\r
- Called by dapl_init(.) to perform any necessary database\r
- initialization. \r
-\r
-DAT_RETURN\r
-dapls_mrdb_exit (\r
- void );\r
-\r
- Called by dapl_fini(.) to perform any necessary database cleanup.\r
-\r
-DAT_RETURN\r
-dapls_mrdb_record_insert (\r
- IN DAPL_LMR_COOKIE cookie );\r
-\r
- If there is no record for the specified cookie, an empty record is\r
- added with a reference count of 1 and the initialized field is set to\r
- false. If a record already exists, the function returns an error.\r
-\r
-DAT_RETURN \r
-dapls_mrdb_record_update (\r
- IN DAPL_LMR_COOKIE cookie, \r
- IN ib_mr_handle_t mr_handle );\r
-\r
- If there is a record for the specified cookie, the MR handle field is\r
- set to the specified mr_handle value and the initialized field is set\r
- to true. Otherwise an error is returned.\r
-\r
-DAT_RETURN\r
-dapls_mrdb_record_query (\r
- IN DAPL_LMR_COOKIE cookie,\r
- OUT ib_mr_handle_t *mr_handle );\r
-\r
- If there is a record for the specified cookie and the initialized\r
- field is true, the MR handle field is returned and the reference\r
- count field is incremented. Otherwise an error is returned. \r
-\r
-DAT_RETURN\r
-dapls_mrdb_record_dec (\r
- IN DAPL_LMR_COOKIE cookie );\r
-\r
- If there is a record for the specified cookie, the reference count\r
- field is decremented. If the reference count is zero after the\r
- decrement, the record is removed from the database. Otherwise an\r
- error is returned. \r
-\r
-The generic algorithms for creating and destroying a shared memory\r
-region are:\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: CreateShared\r
- Inputs: \r
- ia_handle\r
- pz_handle\r
- address\r
- length\r
- lmr_cookie\r
- privileges\r
- Outputs:\r
- lmr_handle\r
- lmr_context\r
- registered_address\r
- registered_length\r
-\r
-forever \r
-{\r
- if dapls_mrdb_record_insert(cookie) is successful\r
- {\r
- if dapl_lmr_create_virtual is not successful \r
- dapls_mrdb_record_dec(cookie)\r
- return error\r
-\r
- else if dapls_mrdb_record_update(cookie, lmr->mr_handle) is not successful\r
- dapls_mrdb_record_dec(cookie)\r
- return error\r
-\r
- else break\r
- }\r
- else if dapls_mrdb_record_query(cookie, mr_handle) is successful\r
- {\r
- if ib_mrdb_shared_register_us is not successful\r
- dapls_mrdb_record_dec(cookie)\r
- return error\r
-\r
- else break\r
- }\r
-}\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: FreeShared\r
- Inputs: \r
- lmr\r
- Outputs:\r
-\r
-if dapls_ib_mr_deregister(lmr) is successful\r
- dapls_mrdb_record_dec(lmr->cookie)\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-\r
-Implementation Options\r
-----------------------\r
-\r
-As described above the crucial functionality needed to implement\r
-shared memory support is a system wide database for mapping LMR\r
-cookies to memory region handles. The following designs represent some\r
-of the options for implementing such a database. Adding a database\r
-increases the complexity of DAPL from both an implementor and user's\r
-perspective. These designs should be evaluated on the degree to which\r
-they minimize the additional complexity while still providing a robust\r
-solution. \r
-\r
-\r
- File System Database\r
- --------------------\r
-\r
-Employing a database that is already part of the system would be\r
-ideal. One option on Linux is to use the file system. An area of the\r
-file system could be set aside for the creation of files to represent\r
-each LMR cookie. The area of the file system could be specified\r
-through a hard coded value, an environment variable, or a\r
-configuration file. A good candidate would be a DAPL subdirectory of\r
-/tmp. \r
-\r
-Exclusive file creation is available through the creat(2) system call\r
-in Linux. The standard I/O interface (fopen(3), etc.) does not support\r
-this feature making porting difficult. However porting to other\r
-environments is not a goal of this design since the entire scheme is\r
-only a temporary solution. \r
-\r
-Determining when to delete the files is a difficult problem. A\r
-reference count is required to properly remove a file once all the\r
-memory regions it represents are deregistered. The synchronization\r
-mechanism necessary for maintaining the reference count is not easily\r
-implemented. As an alternative, a script could be provided to clean up\r
-the database by removing all the files. The script would need to be\r
-run before any DAPL consumers were started to ensure a clean\r
-database. The disadvantage of using a script is that no DAPL instances\r
-can be running when it is used. Another option would be to store the\r
-process ID (PID) of the process that created the file as part of the\r
-file's contents. Upon finding a record for a given LMR cookie value, a\r
-DAPL instance could determine if there was a process with the same PID\r
-in the system. To accomplish this the kill(2) system call could be\r
-used (ex. kill(pid, 0) ). This method of validating the record assumes\r
-that all DAPL instances can signal one another and that the PID values\r
-do not wrap before the check is made. \r
-\r
-Another difficulty with this solution is choosing an accessible\r
-portion of the file system. The area must have permissions that allow\r
-all processes using DAPL to access and modify its contents. System\r
-administrators are typically reluctant to allow areas without any\r
-access controls. Typically such areas are on a dedicated file system\r
-of a minimal size to ensure that malicious or malfunctioning software\r
-does not monopolize the system's storage capacity. Since very little\r
-information will be stored in each file it is unlikely that DAPL would\r
-need a large amount of storage space even if a large number of shared\r
-memory regions were in use. However since a file is needed for each\r
-shared region, a large number of shared registrations may lead to the\r
-consumption of all a file system's inodes. Again since this solution\r
-is meant to be only temporary this constraint may be acceptable.\r
-\r
-There is also the possibility for database corruption should a process\r
-crash or deadlock at an inopportune time. If a process creates file x\r
-and then crashes all other processes waiting for the memory handle to\r
-be written to x will fail. \r
-\r
-The database interface could be implemented as follows:\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_init\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_exit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_insert \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-file_name = convert cookie to valid file name\r
-\r
-fd = exclusively create file_name\r
-if fd is invalid\r
- return failure\r
-\r
-if close fd fails\r
- return failure\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_update \r
- Inputs: \r
- cookie\r
- mr_handle\r
- Outputs:\r
- \r
-file_name = convert cookie to valid file name\r
-\r
-fd = open file_name\r
-if fd is invalid\r
- return failure\r
-\r
-if write mr_handle to file_name fails\r
- return failure\r
-\r
-if close fd fails\r
- return failure\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_query \r
- Inputs: \r
- cookie\r
-\r
- Outputs:\r
- mr_handle\r
-\r
-file_name = convert cookie to valid file name\r
-\r
-fd = open file_name\r
-if fd is invalid\r
- return failure\r
-\r
-if read mr_handle from file_name fails\r
- return failure\r
-\r
-if close fd fails\r
- return failure\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_dec \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-\r
- Daemon Database\r
- ---------------\r
-\r
-The database could be maintained by a separate daemon process. \r
-The DAPL instances would act as clients of the daemon server and\r
-communicate with the daemon through the various IPC mechanisms\r
-available on Linux: Unix sockets, TCP/IP sockets, System V message\r
-queues, FIFOs, or RPCs.\r
-\r
-As with the file system based database, process crashes can potentially\r
-cause database corruption.\r
-\r
-While the portability of this implementation will depend on the chosen\r
-IPC mechanism, this approach will be at best Unix centric and possibly\r
-Linux specific. \r
-\r
-The database interface could be implemented as follows:\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_init\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-initialize IPC mechanism\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_exit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-shutdown IPC mechanism\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_insert \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-if send insert message for cookie fails\r
- return error \r
-\r
-if receive insert response message fails\r
- return error\r
-\r
-if insert success\r
- return success\r
-else return error\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_update \r
- Inputs: \r
- cookie\r
- mr_handle\r
-\r
- Outputs:\r
- \r
-if send update message for cookie and mr_handle fails\r
- return error\r
-else return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_query \r
- Inputs: \r
- cookie\r
-\r
- Outputs:\r
- mr_handle\r
-\r
-if send query message for cookie fails\r
- return error\r
-\r
-else if receive query response message with mr_handle fails\r
- return error \r
-\r
-else return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_dec \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-if send decrement message for cookie fails\r
- return error\r
-else return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-\r
- Shared Memory Database\r
- ----------------------\r
-\r
-The database could be maintained in an area of memory shared by all\r
-DAPL instances running on a system. Linux supports the System V shared\r
-memory functions shmget(2), shmctl(2), shmat(2), and shmdt(2). A hard\r
-coded key_t value could be used so that each DAPL instance attached to\r
-the same piece of shared memory. The size of the database would be\r
-constrained by the size of the shared memory region. Synchronization\r
-could be achieved by using atomic operations targeting memory in the\r
-shared region.\r
-\r
-Such a design would suffer from the corruption problems described\r
-above. If a process crashed there would be no easy way to clean up its\r
-locks and roll back the database to a consistent state.\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_init\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-attach shared region\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_exit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-detach shared region\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_insert \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-lock database\r
-\r
-if db does not contain cookie \r
- add record for cookie\r
-\r
-unlock database\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_update \r
- Inputs: \r
- cookie\r
- mr_handle\r
- Outputs:\r
- \r
-lock database\r
-\r
-if db contains cookie \r
- update record's mr_handle\r
-\r
-unlock database\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_query \r
- Inputs: \r
- cookie\r
-\r
- Outputs:\r
- mr_handle\r
-\r
-lock database\r
-\r
-if db contains cookie \r
- set mr_handle to record's value\r
- increment record's reference count\r
-\r
-unlock database\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_dec \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-lock database\r
-\r
-if db contains cookie \r
- decrement record's reference count\r
-\r
- if reference count is 0\r
- remove record\r
-\r
-unlock database\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-\r
- Kernel Module Database\r
- ----------------------\r
-\r
-If the DAT library were integrated with an HCA vendor's software\r
-stack, the database could be managed by the HCA driver. Placing the\r
-database in the kernel would alleviate the synchronization problems\r
-posed by multiple processes. Since memory registration operations\r
-already involve a transition into the kernel, no extra overhead would\r
-be incurred by this design.\r
-\r
-The RI could include a kernel module with this functionality as a\r
-temporary solution. The module could identify itself as a character\r
-device driver and communicate with user level processes through an\r
-ioctl(2). The driver could also create an entry in the proc file\r
-system to display the database's contents for diagnostic purposes.\r
-\r
-A major benefit of a kernel based implementation is that the database\r
-can remain consistent even in the presence of application\r
-errors. Since DAPL instances communicate with the driver by means of\r
-ioctl(2) calls on a file, the driver can be arrange to be informed\r
-when the file is closed and perform any necessary actions. The driver\r
-is guaranteed to be notified of a close regardless of the manner in\r
-which the process exits. \r
-\r
-The database could be implemented as a dictionary using the LMR cookie\r
-values as keys. \r
-\r
-The following pseudo-code describes the functions needed by the kernel\r
-module and the database interface.\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: KernelModuleInit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-dictionary = create_dictionary()\r
-create_proc_entry()\r
-create_character_device_entry()\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: KernelModuleExit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-remove_character_device_entry()\r
-remove_proc_entry()\r
-fee_dictionary(dictionary)\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: DeviceOpen\r
- Inputs: \r
- file\r
-\r
- Outputs:\r
-\r
-dev_data = allocate device data\r
-\r
-file->private_data = dev_data\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: DeviceClose\r
- Inputs: \r
- file\r
-\r
- Outputs:\r
-\r
-dev_data = file->private_data \r
-\r
-for each record in dev_data\r
-{\r
- RecordDecIoctl\r
-}\r
-\r
-deallocate dev_data\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: RecordInsertIoctl\r
- Inputs: \r
- file\r
- cookie\r
-\r
- Outputs:\r
-\r
-lock dictionary\r
-\r
-if cookie is not in dictionary \r
- insert cookie into dictionary\r
- \r
-\r
-unlock dictionary\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: RecordUpdateIoctl\r
- Inputs: \r
- file\r
- cookie\r
- mr_handle\r
-\r
- Outputs:\r
-\r
-dev_data = file->private_data\r
-\r
-lock dictionary\r
-\r
-if cookie is in dictionary \r
- add record reference to dev_data\r
- update mr_handle \r
-\r
-unlock dictionary\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: RecordQueryIoctl\r
- Inputs: \r
- file\r
- cookie\r
-\r
- Outputs:\r
- mr_handle\r
-\r
-dev_data = file->private_data\r
-\r
-lock dictionary\r
-\r
-if cookie is in dictionary \r
- add record reference to dev_data\r
- retrieve mr_handle\r
-\r
-unlock dictionary\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: RecordDecIoctl\r
- Inputs: \r
- file\r
- cookie\r
-\r
- Outputs:\r
-\r
-dev_data = file->private_data\r
-remove record reference from dev_data\r
-\r
-lock dictionary\r
-\r
-if cookie is in dictionary \r
- decrement reference count\r
- if reference count is 0\r
- remove record\r
-\r
-unlock dictionary\r
-\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_init\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-fd = open device file\r
-\r
-if fd is invalid \r
- return error\r
-else \r
- return success\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_exit\r
- Inputs: \r
-\r
- Outputs:\r
-\r
-close fd\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_insert \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-ioctl on fd\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_update \r
- Inputs: \r
- cookie\r
- mr_handle\r
- Outputs:\r
- \r
-ioctl on fd\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_query \r
- Inputs: \r
- cookie\r
-\r
- Outputs:\r
- mr_handle\r
-\r
-ioctl on fd\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
- Function: dapls_mrdb_record_dec \r
- Inputs: \r
- cookie\r
- Outputs:\r
-\r
-ioctl on fd\r
-\r
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\r
+++ /dev/null
- Suggested Vendor-Specific Changes v. 0.92\r
- -----------------------------------------\r
-\r
-=================\r
-Table of Contents\r
-=================\r
-\r
-* Table of Contents\r
-* Introduction\r
-* Referenced documents\r
-* Functionality Changes\r
- + Missing Functionality\r
- + dat_evd_resize\r
- + Ordering guarantees on connect/disconnect.\r
- + Shared memory\r
- + dat_cr_handoff\r
-* Performance optimizations\r
- + Reduction of context switches\r
- [Many interrelated optimizations]\r
- + Reducing copying of data\r
- + Avoidance of s/g list copy on posting\r
- + Avoidance of event data copy from CQ to EVD\r
- + Elimination of locks\r
- + Eliminating subroutine calls \r
-\r
-\r
-============\r
-Introduction\r
-============\r
-\r
-This document is a list of functionality enhancements and\r
-optimizations hardware vendors porting uDAPL may want to consider as\r
-part of their port. The functionality enhancements mentioned in this\r
-document are situations in which HCA Vendors, with their access to\r
-driver and verb-level source code, and their reduced portability\r
-concerns, are in a much better position than the reference\r
-implementation to implement portions of the uDAPL v. 1.0\r
-specification. (Additional areas in which the reference\r
-implementation, because of a lack of time or resources, did not fully\r
-implement the uDAPL 1.0 specification are not addressed in this file;\r
-see the file doc/dapl_unimplemented_functionality.txt, forthcoming).\r
-Vendors should be guided in their implementation of these\r
-functionality enhancements by their customers need for the features\r
-involved. \r
-\r
-The optimizations suggested in this document have been identified by\r
-the uDAPL Reference Implementation team as areas in which performance\r
-may be improved by "breaching" the IB Verbs API boundary. They are\r
-inappropriate for the reference implementation (which has portability\r
-as one of its primary goals) but may be appropriate for a HCA-specific\r
-port of uDAPL. Note that no expected performance gain is attached to\r
-the suggested optimizations. This is intentional. Vendors should be\r
-guided in their performance improvements by performance evaluations\r
-done in the context of a representative workload, and the expected\r
-benefit from a particular optimization weighed against the cost in\r
-code complexity and scheduling, before the improvement is implemented.\r
-This document is intended to seed that process; it is not intended to\r
-be a roadmap for that process.\r
-\r
-We divide functionality changes into two categories\r
- * Areas in which functionality is lacking in the reference\r
- implementation. \r
- * Areas in which the functionality is present in the reference\r
- implementation, but needs improvement.\r
-\r
-We divide performance improvements into three types:\r
- * Reducing context switches\r
- * Reducing copying of data (*)\r
- * Eliminating subroutine calls\r
-\r
-(*) Note that the data referred to in "reducing copying of data" is\r
-the meta data describing an operation (e.g. scatter/gather list or\r
-event information), not the actual data to be transferred. No data\r
-transfer copies are required within the uDAPL reference\r
-implementation.\r
-\r
-====================\r
-Referenced Documents\r
-====================\r
-\r
-uDAPL: User Direct Access Programming Library, Version 1.0. Published\r
-6/21/2002. http://www.datcollaborative.org/uDAPL_062102.pdf.\r
-Referred to in this document as the "DAT Specification".\r
-\r
-InfiniBand Access Application Programming Interface Specification,\r
-Version 1.2, 4/15/2002. In DAPL SourceForge repository at\r
-doc/api/access_api.pdf. Referred to in this document as the "IBM\r
-Access API Specification".\r
-\r
-uDAPL Reference Implementation Event System Design. In DAPL\r
-SourceForge repository at doc/dapl_event_design.txt.\r
-\r
-uDAPL Reference Implementation Shared Memory Design. In DAPL\r
-SourceForge repository at doc/dapl_shared_memory_design.txt. \r
-\r
-uDAPL list of unimplmented functionality. In DAPL SourceForge\r
-repository at doc/dapl_unimplemented_funcitonality.txt (forthcoming). \r
-\r
-===========================================\r
-Suggested Vendor Functionality Enhancements\r
-===========================================\r
-\r
-Missing Functionality\r
----------------------\r
--- dat_evd_resize\r
-\r
-The uDAPL event system does not currently implement dat_evd_resize.\r
-The primary reason for this is that it is not currently possible to\r
-identify EVDs with the CQs that back them. Hence uDAPL must keep a\r
-separate list of events, and any changes to the size of that event\r
-list would require careful synchronization with all users of that EVD\r
-(see the uDAPL Event System design for more details). If the various\r
-vendor specific optimizations in this document were implemented that\r
-eliminated the requirement for the EVD to keep its own event list,\r
-dat_evd_resize might be easily implemented by a call or calls to\r
-ib_cq_resize. \r
-\r
--- Ordering guarantees on connect/disconnect.\r
-\r
-The DAPL 1.1 specification specifies that if an EVD combines event\r
-streams for connection events and DTO events for the same endpoint,\r
-there is an ordering guarantee: the connection event on the AP occurs\r
-before any DTO events, and the disconnection event occurs after all\r
-successful DTO events. Since DTO events are provided by the IBM OS\r
-Access API through ib_completion_poll (in response to consumer\r
-request) and connection events are provided through callbacks (which\r
-may race with consumer requests) there is no trivial way to implement\r
-this functionality. The functionality may be implemented through\r
-under the table synchronizations between EVD and EP; specifically:\r
- * The first time a DTO event is seen on an endpoint, if the\r
- connection event has not yet arrived it is created and\r
- delivered ahead of that DTO event.\r
- * When a connection event is seen on an endpoint, if a\r
- connection event has already been created for that endpoint\r
- it is silently discarded.\r
- * When a disconnection event is seen on an endpoint, it is\r
- "held" until either: a) all expected DTO events for that\r
- endpoint have completed, or b) a DTO marked as "flushed by\r
- disconnect" is received. At that point it is delivered.\r
- \r
-Because of the complexity and performance overhead of implementating\r
-this feature, the DAPL 1.1 reference implementation has chosen to take\r
-the second approach allowed by the 1.1 specification: disallowing\r
-integration of connection and data transfer events on the same EVD.\r
-This fineses the problem, is in accordance with the specification, and\r
-is more closely aligned with the ITWG IT-API currently in development,\r
-which only allows a single event stream type for each simple EVD.\r
-However, other vendors may choose to implement the functionality\r
-described above in order to support more integration of event streams.\r
-\r
--- Shared memory implementation\r
-\r
-The difficulties involved in the dapl shared memory implementation are\r
-fully described in doc/dapl_shared_memory_design.txt. To briefly\r
-recap: \r
-\r
-The uDAPL spec describes a peer-to-peer shared memory model; all uDAPL\r
-instances indicate that they want to share registration resources for\r
-a section of memory do so by providing the same cookie. No uDAPL\r
-instance is unique; all register their memory in the same way, and no\r
-communication between the instances is required.\r
-\r
-In contrast, the IB shared memory interface requires the first process\r
-to register the memory to do so using the standard memory registration\r
-verbs. All other processes after that must use the shared memory\r
-registration verb, and provide to that verb the memory region handle\r
-returned from the initial call. This means that the first process to\r
-register the memory must communicate the memory region handle it\r
-receives to all the other processes who wish to share this memory.\r
-This is a master-slave model of shared memory registration; the\r
-initial process (the master), is unique in its role, and it must tell\r
-the slaves how to register the memory after it.\r
-\r
-To translate between these two models, the uDAPL implementation\r
-requires some mapping between the shared cookie and the memory region\r
-handle. This mapping must be exclusive and must have inserts occur\r
-atomically with lookups (so that only one process can set the memory\r
-region handle; the others retrieve it). It must also track the\r
-deregistration of the shared memory, and the exiting of the processes\r
-registering the shared memory; when all processes have deregistered\r
-(possibly by exitting) it must remove the mapping from cookie to\r
-memory region handle.\r
-\r
-This mapping must obviously be shared between all uDAPL\r
-implementations on a given host. Implementing such a shared mapping\r
-is problematic in a pure user-space implementation (as the reference\r
-implementation is) but is expected to be relatively easy in vendor\r
-supplied uDAFS implementations, which will presumably include a\r
-kernel/device driver component. For this reason, we have chosen to\r
-leave this functionality unimplemented in the reference implementation.\r
-\r
--- Implementation of dat_cr_handoff\r
-\r
-Given that the change of service point involves a change in associated \r
-connection qualifier, which has been advertised at the underlying \r
-Verbs/driver level, it is not clear how to implement this function\r
-cleanly within the reference implementation. We thus choose to defer\r
-it for implementation by the hardware vendors.\r
-\r
-=========================\r
-Performance Optimizations\r
-=========================\r
-\r
-\r
-Reduction of context switches\r
------------------------------\r
-Currently, three context switches are required on the standard\r
-uDAPL notification path. These are:\r
- * Invocation of the hardware interrupt handler in the kernel.\r
- Through this method the hardware notifies the CPU of\r
- completion queue entries for operations that have requested\r
- notification. \r
- * Unblocking of the per-process IB provider service thread\r
- blocked within the driver. This thread returns to\r
- user-space within its process, where it causes \r
- * Unblocking of the user thread blocked within the uDAPL entry\r
- point (dat_evd_wait() or dat_cno_wait()).\r
- \r
-There are several reasons for the high number of context switches,\r
-specifically: \r
- * The fact that the IB interface delivers notifications\r
- through callbacks rather than through unblocking waiting\r
- threads; this does not match uDAPL's blocking interface.\r
- * The fact that the IB interface for blocking on a CQ doesn't\r
- have a threshhold. If it did, we could often convert a\r
- dat_evd_wait() into a wait on that CQ.\r
- * The lack of a parallel concept to the CNO within IB. \r
-\r
-These are all areas in which closer integration between the IB\r
-verbs/driver and uDAPL could allow the user thread to wait within the\r
-driver. This would allow the hardware interrupt thread to directly\r
-unblock the user thread, saving a context switch.\r
-\r
-A specific listing of the optimizations considered here are:\r
- * Allow blocking on an IB CQ. This would allow removal of the\r
- excess context switch for dat_evd_wait() in cases where\r
- there is a 1-to-1 correspondence between an EVD and a CQ and\r
- no threshold was passed to dat_evd_wait(). \r
- * Allow blocking on an IB CQ to take a threshold argument.\r
- This would allow removal of the excess context switch for\r
- dat_evd_wait() in cases where there is a 1-to-1\r
- correspondence between an EVD and a CQ regardless of the\r
- threshold value.\r
- * Give the HCA device driver knowledge of and access to the\r
- implementation of the uDAPL EVD, and implement dat_evd_wait()\r
- as an ioctl blocking within the device driver. This would\r
- allow removal of the excess context switch in all cases for\r
- a dat_evd_wait().\r
- * Give the HCA device driver knowledge of and access to the\r
- implementation of the uDAPL CNO, and implement dat_cno_wait()\r
- as an ioctl blocking within the device driver. This would\r
- allow removal of the excess context switch in all cases for\r
- a dat_cno_wait(), and could improve performance for blocking\r
- on OS Proxy Wait Objects related to the uDAPL CNO.\r
-\r
-See the DAPL Event Subsystem Design (doc/dapl_event_design.txt) for\r
-more details on this class of optimization.\r
-\r
-========================\r
-Reducing Copying of Data\r
-========================\r
-\r
-There are two primary places in which a closer integration between the\r
-IB verbs/driver and the uDAPL implementation could reducing copying\r
-costs:\r
-\r
--- Avoidance of s/g list copy on posting\r
-\r
-Currently there are two copies involved in posting a data transfer\r
-request in uDAPL:\r
- * From the user context to uDAPL. This copy is required\r
- because the scatter/gather list formats for uDAPL and IB\r
- differ; a copy is required to change formats.\r
- * From uDAPL to the WQE. This copy is required because IB\r
- specifies that all user parameters are owned by the user\r
- upon return from the IB call, and therefore IB must keep its\r
- own copy for use during the data transfer operation.\r
-\r
-If the uDAPL data transfer dispatch operations were implemented\r
-directly on the IB hardware, these copies could be combined.\r
-\r
--- Avoidance of Event data copy from CQ to EVD\r
-\r
-Currently there are two copies of data involved in receiving an event\r
-in a standard data transfer operation:\r
- * From the CQ on which the IB completion occurs to an event\r
- structure held within the uDAPL EVD. This is because the IB\r
- verbs provide no way to discover how many elements have been\r
- posted to a CQ. This copy is not\r
- required for dat_evd_dequeue. However, dat_evd_wait\r
- requires this copy in order to correctly implement the\r
- threshhold argument; the callback must know when to wakeup\r
- the waiting thread. In addition, copying all CQ entries\r
- (not just the one to be returned) is necessary before\r
- returning from dat_evd_wait in order to set the *nmore OUT\r
- parameter. \r
- * From the EVD into the event structure provided in the\r
- dat_evd_wait() call. This copy is required because of the\r
- DAT specification, which requires a user-provided event\r
- structure to the dat_evd_wait() call in which the event\r
- information will be returned. If dat_evd_wait() were\r
- instead, for example, to hand back a pointer to the already\r
- allocated event structure, that would eventually require the\r
- event subsystem to allocate more event structures. This is\r
- avoided in the critical path. \r
-\r
-A tighter integration between the IB verbs/driver and the uDAPL\r
-implementation would allow the avoidance of the first copy.\r
-Specifically, providing a way to get information as to the number of\r
-completions on a CQ would allow avoidance of that copy.\r
-\r
-See the uDAPL Event Subsystem Design for more details on this class of\r
-optimization.\r
-\r
-====================\r
-Elimination of Locks\r
-====================\r
-\r
-Currently there is only a single lock used on the critical path in the\r
-reference implementation, in dat_evd_wait() and dat_evd_dequeue().\r
-This lock is in place because the ib_completion_poll() routine is not\r
-defined as thread safe, and both dat_evd_wait() and dat_evd_dequeue()\r
-are. If there was some way for a vendor to make ib_completion_poll()\r
-thread safe without a lock (e.g. if the appropriate hardware/software\r
-interactions were naturally safe against races), and certain other\r
-modifications made to the code, the lock might be removed.\r
-\r
-The modifications required are:\r
- * Making racing consumers from DAPL ring buffers thread safe.\r
- This is possible, but somewhat tricky; the key is to make\r
- the interaction with the producer occur through a count of\r
- elements on the ring buffer (atomically incremented and\r
- decremented), but to dequeue elements with a separate atomic\r
- pointer increment. The atomic modification of the element\r
- count synchronizes with the producer and acquires the right\r
- to do an atomic pointer increment to get the actual data.\r
- The atomic pointer increment synchronizes with the other\r
- consumers and actually gets the buffer data.\r
- * The optimization described above for avoiding copies from\r
- the CQ to the DAPL EVD Event storage queue. Without this\r
- optimization a potential race between dat_evd_dequeue() and\r
- dat_evd_wait() exists where dat_evd_dequeue will return an\r
- element advanced in the event stream from the one returned\r
- from dat_evd_wait():\r
-\r
- dat_evd_dequeue() called\r
-\r
- EVD state checked; ok for\r
- dat_evd_dequeue()\r
- dat_evd_wait() called\r
-\r
- State changed to reserve EVD\r
- for dat_evd_wait() \r
-\r
- Partial copy of CQ to EVD Event store\r
-\r
- Dequeue of CQE from CQ\r
-\r
- Completion of copy of CQ to EVD Event store\r
-\r
- Return of first CQE copied to EVD Event store.\r
-\r
- Return of thie CQE from the middle\r
- of the copied stream.\r
-\r
-\r
- If no copy occurs, dat_evd_wait() and dat_evd_dequeue() may\r
- race, but if all operations on which they may race (access\r
- to the EVD Event Queue and access to the CQ) are thread\r
- safe, this race will cause no problems.\r
-\r
-============================\r
-Eliminating Subroutine Calls\r
-============================\r
-\r
-This area is the simplest, as there are many DAPL calls on the\r
-critical path that are very thin veneers on top of their IB\r
-equivalents. All of these calls are canidates for being merged with\r
-those IB equivalents. In cases where there are other optimizations\r
-that may be acheived with the call described above (e.g. within the\r
-event subsystem, the data transfer operation posting code), that call\r
-is not mentioned here: \r
- * dat_pz_create\r
- * dat_pz_free\r
- * dat_pz_query\r
- * dat_lmr_create\r
- * dat_lmr_free\r
- * dat_lmr_query\r
- * dat_rmr_create\r
- * dat_rmr_free\r
- * dat_rmr_query\r
- * dat_rmr_bind\r
-\r
- \r
+++ /dev/null
-#\r
-# Generic DAT 1.1 configuration file\r
-#\r
-\r
-# Each entry should have the following fields:\r
-# <ia_name> <api_version> <threadsafety> <default> <dapl_lib_path> \\r
-# <provider_version> <ia_params> <platform_params>\r
-\r
-# This is the dapl provider configuration for HCA0 port 1\r
-IbalHca0 u1.1 nonthreadsafe default /usr/lib/libdapl.so.0.0 mv_dapl.1.1 "IbalHca0 1" ""\r
-\r
+++ /dev/null
- DAT Environment Guide v. 0.01\r
- -----------------------------\r
-\r
-The following environment variables affect the behavior of the DAT\r
-library: \r
-\r
-\r
-DAT_OVERRIDE\r
-------------\r
- Value used as the static registry configuration file, overriding the\r
- default location, /etc/dat.conf\r
-\r
- Example: setenv DAT_OVERRIDE /path/to/my/private.conf\r
-\r
-\r
-DAT_DBG_TYPE\r
-------------\r
-\r
- Value specifies which parts of the registry will print debugging\r
- information, valid values are \r
-\r
- DAT_OS_DBG_TYPE_ERROR = 0x1\r
- DAT_OS_DBG_TYPE_GENERIC = 0x2\r
- DAT_OS_DBG_TYPE_SR = 0x4\r
- DAT_OS_DBG_TYPE_DR = 0x8\r
- DAT_OS_DBG_TYPE_PROVIDER_API = 0x10\r
- DAT_OS_DBG_TYPE_CONSUMER_API = 0x20\r
- DAT_OS_DBG_TYPE_ALL = 0xff\r
-\r
- or any combination of these. For example you can use 0xC to get both \r
- static and dynamic registry output.\r
-\r
- Example setenv DAT_DBG_TYPE 0xC\r
- \r
-DAT_DBG_DEST\r
------------- \r
-\r
- Value sets the output destination, valid values are \r
- \r
- DAT_OS_DBG_DEST_STDOUT = 0x1\r
- DAT_OS_DBG_DEST_SYSLOG = 0x2 \r
- DAT_OS_DBG_DEST_ALL = 0x3 \r
- \r
- For example, 0x3 will output to both stdout and the syslog. \r
-\r
+++ /dev/null
-dat-linux3-ib0 0xfe80000000000000 0x0001730000003d11\r
-dat-linux5-ib0 0xfe80000000000000 0x0001730000003d91\r
-dat-linux6-ib0 0xfe80000000000000 0x0001730000009791\r
+++ /dev/null
-\r
-Source Forge Notes\r
-\r
-1) Log onto Source Force site\r
- a. http://infiniband.sourceforge.net\r
-\r
-2) Download "Bitkeeper" software\r
- a. Click on Bitkeeper Repository link (under Source Forge Services)\r
- b. Click on download link\r
- c. Click on Download Bitkeeper\r
- d. Determine proper platform and complete download\r
- e. Note: You must fill in form and provide email address. \r
- SW will email you login info to "bitmover site"\r
- f. http://www.bitmover.com/download\r
- * login: bitkeeper\r
- * password: get bitkeeper\r
-\r
-3) After you have downloaded bitkeeper software, change the mode of the \r
- file to make it executable (i.e. chmod a+x *.bin)\r
- a. chmod a+x 3.0.1-x86-glibc22-linux.bin\r
- b. ./ 3.0.1-x86-glibc22-linux.bin\r
-\r
-4) The above process creates an executable called "bk". It also creates \r
- a symbolic link from bk to /usr/bin/bk\r
-\r
-5) Create a directory where you would like to place the SF project\r
- a. Ex. mkdir /usr/sf-iba\r
-\r
-6) Use the bk program to pick up a clone of the latest Source Force release \r
- for iba\r
- a. cd /usr/sf-iba\r
- b. bk clone http://project.bkbits.net/repository\r
- where: project = infiniband, repository = iba; producing:\r
- c. bk clone http:/infiniband.bkbits.net/iba\r
-\r
-7) Running "bk" will create a sub_folder in your current working directory\r
- a. => /usr/sf-iba/iba\r
-\r
-8) Add Mellanox source to newly downloaded source tree\r
- a. cd /usr/sf-iba/iba\r
- b. Download and copy mellanox_xxx.tgz file to this directory and \r
- unzip/untar file. Note: archive will place into base and create \r
- linux folders. It is very important that you place the mellanox \r
- files into the correct directory structure\r
- c. tar xzvf mellanox_xxx.tgz. This will create the following:\r
- * /usr/sf-iba/iba/base/linux/hca/mellanox\r
- * /usr/sf-iba/iba/linux/run\r
-\r
-9) Create a build tree for the project using the "mktree" command. \r
- This will pull out all sources from the base directory to a directory \r
- of your choosing\r
- a. cd /usr/sf-iba/iba/base/linux/utils\r
- b. ./mktree -source /usr/sf-iba/iba -target /usr/sf-iba/iba\r
- * mktree create 2 new directories linux and linuxuser in \r
- /usr/sf-iba/iba\r
-\r
-10) Rebuild the kernel and boot with new kernel (example using \r
- linux-2.4.18-10 kernel tree)\r
- a. cd /usr/src/linux-2.4.18-10\r
- b. make xconfig \r
- * make any changes to fit your hardware configuration:\r
- o SMP/UP option (YES for Process type and features/Symmetric \r
- multi-processing support buttons)\r
- o network driver (YES for Network device support/Ethernet \r
- (10 or 100Mbit)/Ethernet (10 or 100Mbit)... buttons\r
- o scsi driver (YES for SCSI support/ SCSI low-level drivers/... \r
- buttons)\r
- o local file system (YES for File systems/Ext3 journaling \r
- file system support - Second extended fs support buttons)\r
- * hit "save and exit" button\r
- c. Patch the kernel to support IPoIB with larger MAX_ADDR_LEN\r
- * edit /usr/src/linux-2.4.18-10/include/linux/netdevice.h to \r
- change MAX_ADDR_LEN = 8 to = 32\r
- * edit /usr/src/linux-2.4.18-10/net/core/dev.c to change:\r
- The SIOCGIFHWADDR case from:\r
- memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, MAX_ADDR_LEN);\r
- to\r
- memcpy(ifr->ifr_hwaddr.sa_data, dev->dev_addr, \r
- min((unsigned char) sizeof(ifr->ifr_hwaddr.sa_data), \r
- dev->addr_len));\r
- \r
- The SIOCSIFHWBROADCAST case from:\r
- memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, MAX_ADDR_LEN);\r
- to\r
- memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, \r
- min((unsigned char) sizeof(ifr->ifr_hwaddr.sa_data), \r
- dev->addr_len)); \r
- d. make dep\r
- e. make bzImage\r
- f. make install\r
- g. verify /etc/lilo.conf (or /etc/grub.conf) to reboot the system \r
- with new kernel\r
-\r
-11) Install Mellanox MST and MSDK\r
- a. install mst driver\r
- b. install MSDK\r
- c. verify the installation (at least run vapi start)\r
-\r
-12) The next step is to build all the driver for the stack (including \r
- Mellanox module)\r
- a. cd /usr/sf-iba/iba/linux\r
- b. edit Makeconf.inc\r
- * edit LINUX_VERSION = 2.4.18-10\r
- * edit REDHAT=1 if you run original kernel from RH installation. \r
- In our case, we are running costumed kernel, we leave it as default\r
- * edit LINUX_SRC. In our case, we edit LINUX_VERSION; therefore, \r
- we leave this as default\r
- c. edit Makefile.config\r
- * Change BUILD_SMP line to: BUILD_SMP =0 (if kernel is UP)\r
- * Change BUILD_SMP line to: BUILD_SMP =1 (if kernel is SMP)\r
- d. Edit Makefile; Change "MLNX=n" to "MLNX=y, MODEL,SHIM=y to \r
- MODEL,SHIM=n)\r
-\r
-13) Build/Compile kernel driver components by running make from top level \r
- directory\r
- a. cd /usr/sf-iba/iba/linux\r
- b. make debug (or free)\r
- c. All the object files are in \r
- * ~bin/$(ARCH)/$(LINUX_VERSION)/$(MP_MODE)/$BLD\r
- * in our case ARCH=x86, LINUX_VERSION=2.4.18-10, MP_MODE=up, BLD=debug\r
-\r
-14) Build/Compile user mode driver components.\r
- a. cd /usr/sf-iba/iba/linuxuser/iba\r
- b. make debug (or free)\r
- c. All the executable files (opensm, alts...) are in \r
- /usr/sf-iba/iba/linuxuser/bin/$(ARCH)/$(LINUX_VERSION)/bin/$(BLD)\r
- d. All the libraries are in \r
- /usr/sf-iba/iba/linuxuser/bin/$(ARCH)/$(LINUX_VERSION)/lib/$(BLD)\r
- e. In our case ARCH=x86, LINUX_VERSION=2.4.18-10, BLD=debug\r
- f. create the symbolic link for liballib, libcomplib and libmlnx_uvp\r
- * cd /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/lib/debug\r
- * ln -s liballib.so.0.0 liballib.so\r
- * ln -s libcomplib.so.0.0 libcomplib.so\r
-\r
-15) Run the stack with "ibal" script which is the equivalent to "vapi" script\r
- a. cd /usr/sf-iba/iba/linux/run\r
- b. edit ibal\r
- * edit line 35,36. \r
- * Assuming that we are running UP kernel and debug mode then\r
- o line 35 should be MODPATH_I=$IBAL_PATH/bin/x86/$KERVER/up/debug\r
- o line 36 should be \r
- MODPATH_TV=$IBAL_PATH/drivers/iba/hca/mellanox/thh/obj_linux_x86_up\r
- * Assuming that we are running SMP kernel and free mode then\r
- o line 35 should be MODPATH_I=$IBAL_PATH/bin/x86/$KERVER/smp/free\r
- o line 36 should be \r
- MODPATH_TV=$IBAL_PATH/drivers/iba/hca/mellanox/thh/obj_linux_x86_smp\r
- c. cd /usr/sf-iba/iba/linux and issue command "run/ibal start"\r
-\r
-16) Set up the linking library path. There are two ways.\r
- a. Edit the /root/.bashrc and add in the following line\r
- * export LD_LIBRARY_PATH=\r
- /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/lib/debug\r
- b. Or \r
- * edit /etc/ld.so.conf and add in the following line \r
- /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/lib/debug\r
- * run ldconfig\r
-\r
-17) Run the OPENSM\r
- a. opensm executable file locates at \r
- /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/bin/debug or \r
- /usr/sf-iba/iba/linuxuser/iba/opensm directories\r
- b. cd /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/bin/debug\r
- c. ./opensm \r
- d. Whew... finally\r
- e. leave the opensm running still (sweeping mode)\r
-\r
-18) Run IPoIB\r
- a. cd /usr/sf-iba/iba/linux/bin/x86/2.4.18-10/up/debug\r
- b. insmod ipoib.o\r
- c. ifconfig -a ( you will see ib01 and ib02 pop up)\r
- d. ifconfig ib01 11.0.0.1\r
- e. ping 11.0.0.1\r
-\r
-19) Run uDAPL\r
- a. edit /etc/hosts to add in IPaddress for all DAPL nodes in cluster. \r
- Distribute the file for every node in the cluster. IPaddress\r
- can be the same as IPoIB IP address as long as node name has to end\r
- with "xx-ibX". Even though you are not running IPoIB, you have to add \r
- in Interface Adapter Address (IP address) for DAPL IA. For now, \r
- one IP address for each DAPL IA (for each HCA)\r
- \r
- Example: local node is mtilab10\r
- \r
- 10.2.2.10 mtilab10 ==> this is ethernet 0\r
- 10.2.2.11 mtilab11 \r
- 192.0.0.10 mtilab10-ib0 ==> this is IPoIB or Interface Adapter \r
- address for local DAPL IA 1\r
- 192.0.0.14 mtilab10-ib0a ==> this is IPoIB or Interface Adapter \r
- address for local DAPL IA 1 port 1\r
- 192.0.0.12 mtilab10-ib1 ==> this is IPoIB or Interface Adapter\r
- address for local DAPL IA 2\r
- 192.0.0.11 mtilab11-ib0 ==> this is IPoIB or Interface Adapter\r
- address for remote DAPL IA \r
- \r
- b. Copy mv_dapl/doc/dat.conf to /etc/dat.conf. Please read\r
- mv_dapl/doc/dapl_registry_design.txt for more infomation how to\r
- edit /etc/dat.conf correctly\r
-\r
- NOTES: If you compile dapltest with EXPLICIT_LINK=1 then dapltest\r
- is explicitly linked to libdapl.so library; therefore, you\r
- have to uncomment the entry in dat.conf or do not have\r
- dat.conf in /etc.\r
-\r
- c. dapltest executable file locates at\r
- /usr/sf-iba/iba/linuxuser/bin/x86/2.4.18-10/up(smp)/debug(free) or\r
- /usr/sf-iba/iba/linuxuser/iba/mv_dapl/test/udapl/dapltest\r
-\r
- c. Run dapltest testsuite for 2 nodes (mtilab10-ib0 and mtilab11-ib0)\r
- * At both nodes\r
- o start the driver (ibal start)\r
- o cd /usr/sf-iba/iba/linuxuser/iba/mv_dapl/test/udapl/dapltest\r
-\r
- * At mtilab10-ib0\r
- o ./srv.sh ==> start server\r
-\r
- * At mtilab11-ib0\r
- o ./bw.sh mtilab10-ib0 ==> run bw test\r
- o ./lat_poll.sh mtilab10-ib0 ==> run latency polling mode test\r
- o ./lat_block.sh mtilab10-ib0 ==> run latency blocking mode test\r
- o ./cl.sh mtilab10-ib0 ==> run transaction tests\r
- o ./regress.sh mtilab10-ib0 ==> run transaction regression test\r
- o ./quit.sh mtilab10-ib0 ==> instruct the server to quit\r
- \r
- * both can run limit test ./lim.sh (don't need to run server)\r
-\r
- d. Please reference to dapltest.txt for more test options \r
+++ /dev/null
- Release Notes for uDAPL/IBAL\r
- \r
-RELEASE NOTES\r
-\r
- We would like to officially announce the availability of a\r
- public source implementation of uDAPL over IBAL API. \r
-\r
- This uDAPL source code is derived from Source Forge DAPL foundry, see\r
-\r
- http://sourceforge.net/projects/dapl\r
-\r
-BETA RELEASE July 7, 2004\r
-\r
-1. What is new from Alpha 2.0 Release\r
-\r
- Performance Improvements, additional functionality, bug fixes. \r
- Tested with SourceForge BK Changeset 1.275.\r
- \r
- * DAT 1.1 compliance\r
- * dat_evd_resize implemented\r
- * async callbacks for CQ, QP, and IA implemented\r
- * dat_psp_create_any improvements, no longer require kernel IOCTL.\r
- * Performance enhancements, MTU, removed malloc in speed path, disconnect processing\r
- * cleaned up many disconnect/close serialization issues\r
- \r
- * dynamic DTO-EVD sizing based on request/receive DTO depths\r
- * enable re-use of EP, with dap_ep_reset, after EP connection termination.\r
- * enhancements to dat_evd_wait to prevent missing completions\r
- * dapls_ib_post_send; add refs/checking for disconnecting state, avoids losing completion\r
- * dapl and dapltest build warnings resolved\r
-\r
-2. Expected Bugs and status\r
-\r
-\r
-ALPHA 2.0 RELEASE Sept 25, 2003\r
-\r
-1. What news from Alpha 1.1 Release\r
-\r
- This release is equivalent to Beta 1.09 uDAPL Source Forge Releases\r
- It basically inherits the feature sets of Source Forge Beta 1.09 \r
- Release plus extra feature sets coming from previous Alpha 1.1 Release\r
-\r
- Please refer to Beta 1.09 uDAPL Soure Force Release README for further\r
- infomation.\r
-\r
-\r
-ALPHA 1.1 RELEASE Jun 20, 2003\r
-\r
-1. Feature sets\r
-\r
- This release is equivalent to Alpha 10-16 uDAPL Source Forge Releases\r
- It basically inherit the feature sets of those Releases with minus/plus\r
- followed features\r
-\r
- * Shared memory design and reference implementation\r
-\r
- * Map IA per HCA and/or individual port work.\r
- \r
- * Retry connection after a reject\r
-\r
- * Global LMR context hash table per HCA data structure\r
-\r
- * Implementing dat_psp_create_any functionality\r
-\r
- * Partial compliance to DAT 1.1\r
-\r
-2. Expected Bugs and status\r
-\r
- * dapltest transaction test server fail to RDMA Read/Write to client \r
- due to timing racing issue; however, client can do RDMA Read/Write \r
- to server.\r
- --> fixed\r
-\r
- * While dapltest server and client setup connections, abnormally kill\r
- dapltest (ctrl+c) server and/or client, then unload the driver will\r
- crash the system.\r
- --> half fixed. Sometimes we successfully unload the driver, \r
- sometimes we cannot due to resources are still dangling in kernel\r
- (lsmod shows that module ibal is still in-used by other modules)\r
- --> ChangeSet 1.112 target to fix this bug (# 745700); howerver, it\r
- introduce other bug which dapltest fail to retry connection after\r
- a reject.\r
- --> With ChangeSet 1.110, test is running fine except unloading the \r
- driver will crash system.\r
- \r
- * dapltest transaction test with multiple threads and multiple Endpoints\r
- will have segmentation fault at the end of the test when multiple\r
- threads exits\r
- --> opened\r
- \r
- * dapltest transaction test with multiple threads (30) and multiple \r
- Endpoints (100 for each thread) will fail to set up connection \r
- --> need to invest and collect trace. Preliminary assesmment show\r
- mad drop or SA/SM fail to response to queries.\r
-\r
-\r
-\r
-ALPHA 1.0 RELEASE May 29, 2003\r
-\r
-1. Feature sets\r
- \r
- This release is derived from Alpha 9.0 uDAPL Source Forge Release\r
- It basically inherit the feature sets of Alpha 9.0 SF Release; moreover\r
- it has the following enhancements\r
-\r
- * Name Service and Address Resolution using SA/SM query mechanism.\r
- Moving away from troublesome IPoIB and file-based mechanisms\r
-\r
- * Introducing dat_cr_handoff functionality.\r
-\r
- * Creating infrastructure to map IA per HCA and/or individual port of \r
- the HCA. This feature can be selected for different type of \r
- applications to obtain the high bandwidth or high availability.\r
-\r
- * Creating infrastructure to operate in loopback mode when the fabric\r
- is down (without SA/SM)\r
-\r
-2. Expected bugs\r
-\r
- * dapltest transaction test server fail to RDMA Read/Write to client \r
- due to timing racing issue; however, client can do RDMA Read/Write \r
- to server.\r
- \r
- * dapltest transaction test with multiple threads and multiple Endpoints\r
- will have segmentation fault at the end of the test when multiple\r
- threads exits\r
-\r
- * While dapltest server and client setup connections, abnormally kill\r
- dapltest (ctrl+c) server and/or client, then unload the driver will\r
- crash the system.\r
-\r
-3. Future Enhancements\r
-\r
- * Performance enhancement. Test and measure performance when OS bypass\r
- functionality of IBAL is available\r
-\r
- * Fixing the bug list mentioned above.\r
-\r
- * Selectively migrate to Source Forge Alpha 10.0 - 15.0 Releases\r
-\r
- * Shared memory region: mapping peer-to-peer DAPL shared memory region\r
- model to master-slave InfiniBand shared memory region model.\r
-\r
- * Implement dat_psp_create_any() functionality\r
-\r
- * Conforming to DAT 1.1 Specification\r
-\r
-4. Performance Statistics \r
-\r
- * The performance of this release is limited due to the inavailability \r
- of OS kernel bypass functionality of IBAL - Mellanox uVP/kVP \r
- \r
- * Testing with the following configuration:\r
- o PIII 1 Ghz, PCI 64/66, 512 MB, ServerWork Grand Champion LE chipset\r
- o Tavor A0 back to back\r
- o Mellanox MSDK 0.0.6, FW 1.18\r
- o 2.4.18 & 2.4.18-10 UP/SMP kernels\r
-\r
- Bandwidth: 210 MB/s for 64-KB message\r
- Latency polling mode: 26.2 usecs for 4-byte message \r
- Latency blocking mode: 61.2 usecs for 4-byte message\r
-\r
- * With Xeon 2.4 Ghz, PCI-X 133 Mhz, Serverwork chipset for hardware\r
- configuration and OS bypass enable for SW, we expect to achieve\r
- 700-750 MB/s , 15 usecs for polling latency, and 35 usecs for\r
- blocking latency \r
- \r
+++ /dev/null
-DIRS=udapl\r
+++ /dev/null
-#\r
-# Defaults for dapltest (chosen for the author's convenience)\r
-#\r
-setenv DBG " " # to debug, or not to debug, that is the question\r
-setenv THR 1 # number of threads to use\r
-setenv EPS 1 # number of EPs per thread\r
-setenv ITER 10 # number of iterations over the set of OPs\r
-setenv HOST dat-linux3 # hostname running the server side of dapltest\r
-setenv DEV JniIbdd0 # name of IA device\r
-setenv CMD SR # OP command: SR, RW, RR\r
-setenv SZ 4096 # OP buffer segment size\r
-setenv SEGS 1 # OP number of segments\r
+++ /dev/null
-#\r
-# time format: %U user %S sys %E elapsed %P CPU\r
-# %w block (voluntarily, eg: dat_evd_wait)\r
-# %c cswitch (involuntary, eg: time slice expired)\r
-#\r
-# dapltest: whatever is requested, plus 2 ops for inter-loop sync\r
-#\r
-/usr/bin/time -f "%U user %S sys %E real %P cpu %w block" \\r
-dapltest -T T $DBG -t $THR -w $EPS -i $ITER -s $HOST -D $DEV \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client $CMD $SZ $SEGS client $CMD $SZ $SEGS \\r
- client SR 8 1 -f server SR 8 1 -f\r
+++ /dev/null
-#!/bin/csh -f\r
-#\r
-# Run through a number of DAPL test cases \r
-#\r
-set wholename = $0\r
-set me = $wholename:t\r
-unset wholename\r
-set echo\r
-#\r
-# Set Defaults\r
-#\r
-source .DT_defaults\r
-#\r
-# Iterate over the three transfer methods\r
-#\r
-foreach CMD ( SR RW RR)\r
- #\r
- # Iterate over the sizes of interest\r
- #\r
- foreach SZ ( 8 256 4096 65536 262144 )\r
- #\r
- # XXX Following code is here because server side is run-once;\r
- # XXX when fixed, move out of loops, above. (BURT 79002)\r
- # Run the server asynchronously\r
- #\r
- if ($?DAPL_LOOPBACK) then\r
- dapltest -T S -D $DEV &\r
- else\r
- rsh -n $HOST dapltest -T S -D $DEV &\r
- endif\r
- #\r
- # Run the client side here, 'inline'\r
- #\r
- echo ===== $CMD $SZ =====\r
- source .DT_onetest\r
- #\r
- # wait for the async server\r
- #\r
- wait\r
- echo ""\r
- end\r
-end\r
+++ /dev/null
-NAME\r
-\r
- dapltest - test for the Direct Access Programming Library (DAPL)\r
-\r
-DESCRIPTION\r
-\r
- Dapltest is a set of tests developed to exercise, characterize,\r
- and verify the DAPL interfaces during development and porting.\r
- At least two instantiations of the test must be run. One acts\r
- as the server, fielding requests and spawning server-side test\r
- threads as needed. Other client invocations connect to the\r
- server and issue test requests.\r
-\r
- The server side of the test, once invoked, listens continuously\r
- for client connection requests, until quit or killed. Upon\r
- receipt of a connection request, the connection is established,\r
- the server and client sides swap version numbers to verify that\r
- they are able to communicate, and the client sends the test\r
- request to the server. If the version numbers match, and the\r
- test request is well-formed, the server spawns the threads\r
- needed to run the test before awaiting further connections.\r
-\r
-USAGE\r
-\r
- dapltest [ -f script_file_name ]\r
- [ -T S|Q|T|P|L ] [ -D device_name ] [ -d ] [ -R HT|LL|EC|PM|BE ]\r
-\r
- With no arguments, dapltest runs as a server using default values,\r
- and loops accepting requests from clients. The -f option allows\r
- all arguments to be placed in a file, to ease test automation.\r
- The following arguments are common to all tests:\r
-\r
- [ -T S|Q|T|P|L ] Test function to be performed:\r
- S - server loop\r
- Q - quit, client requests that server\r
- wait for any outstanding tests to\r
- complete, then clean up and exit\r
- T - transaction test, transfers data between \r
- client and server\r
- P - performance test, times DTO operations\r
- L - limit test, exhausts various resources,\r
- runs in client w/o server interaction\r
- Default: S\r
-\r
- [ -D device_name ] Specifies the name of the device (interface adapter).\r
- Default: host-specific, look for DT_MdepDeviceName\r
- in dapl_mdep.h\r
-\r
- [ -d ] Enables extra debug verbosity, primarily tracing\r
- of the various DAPL operations as they progress.\r
- Repeating this parameter increases debug spew.\r
- Errors encountered result in the test spewing some\r
- explanatory text and stopping; this flag provides\r
- more detail about what lead up to the error.\r
- Default: zero\r
-\r
- [ -R BE ] Indicate the quality of service (QoS) desired.\r
- Choices are:\r
- HT - high throughput\r
- LL - low latency\r
- EC - economy (neither HT nor LL)\r
- PM - premium\r
- BE - best effort\r
- Default: BE\r
-\r
-USAGE - Quit test client\r
-\r
- dapltest [Common_Args] [ -s server_name ]\r
-\r
- Quit testing (-T Q) connects to the server to ask it to clean up and\r
- exit (after it waits for any outstanding test runs to complete).\r
- In addition to being more polite than simply killing the server,\r
- this test exercises the DAPL object teardown code paths.\r
- There is only one argument other than those supported by all tests:\r
-\r
- -s server_name Specifies the name of the server interface.\r
- No default.\r
-\r
-\r
-USAGE - Transaction test client\r
-\r
- dapltest [Common_Args] [ -s server_name ]\r
- [ -t threads ] [ -w endpoints ] [ -i iterations ] [ -Q ] \r
- [ -V ] [ -P ] OPclient OPserver [ op3, \r
-\r
- Transaction testing (-T T) transfers a variable amount of data between \r
- client and server. The data transfer can be described as a sequence of \r
- individual operations; that entire sequence is transferred 'iterations' \r
- times by each thread over all of its endpoint(s).\r
-\r
- The following parameters determine the behavior of the transaction test:\r
-\r
- -s server_name Specifies the hostname of the dapltest server.\r
- No default.\r
-\r
- [ -t threads ] Specify the number of threads to be used.\r
- Default: 1\r
-\r
- [ -w endpoints ] Specify the number of connected endpoints per thread.\r
- Default: 1\r
-\r
- [ -i iterations ] Specify the number of times the entire sequence\r
- of data transfers will be made over each endpoint.\r
- Default: 1000\r
-\r
- [ -Q ] Funnel completion events into a CNO.\r
- Default: use EVDs\r
-\r
- [ -V ] Validate the data being transferred.\r
- Default: ignore the data\r
-\r
- [ -P ] Turn on DTO completion polling\r
- Default: off\r
-\r
- OP1 OP2 [ OP3, ... ]\r
- A single transaction (OPx) consists of:\r
-\r
- server|client Indicates who initiates the\r
- data transfer.\r
-\r
- SR|RR|RW Indicates the type of transfer:\r
- SR send/recv\r
- RR RDMA read\r
- RW RDMA write\r
- Defaults: none\r
-\r
- [ seg_size [ num_segs ] ]\r
- Indicates the amount and format\r
- of the data to be transferred.\r
- Default: 4096 1\r
- (i.e., 1 4KB buffer)\r
-\r
- [ -f ] For SR transfers only, indicates\r
- that a client's send transfer\r
- completion should be reaped when\r
- the next recv completion is reaped.\r
- Sends and receives must be paired\r
- (one client, one server, and in that\r
- order) for this option to be used.\r
-\r
- Restrictions: \r
- \r
- Due to the flow control algorithm used by the transaction test, there \r
- must be at least one SR OP for both the client and the server. \r
-\r
- Requesting data validation (-V) causes the test to automatically append \r
- three OPs to those specified. These additional operations provide \r
- synchronization points during each iteration, at which all user-specified \r
- transaction buffers are checked. These three appended operations satisfy \r
- the "one SR in each direction" requirement.\r
-\r
- The transaction OP list is printed out if -d is supplied.\r
-\r
-USAGE - Performance test client\r
-\r
- dapltest [Common_Args] -s server_name [ -m p|b ]\r
- [ -i iterations ] [ -p pipeline ] OP\r
-\r
- Performance testing (-T P) times the transfer of an operation.\r
- The operation is posted 'iterations' times.\r
-\r
- The following parameters determine the behavior of the transaction test:\r
-\r
- -s server_name Specifies the hostname of the dapltest server.\r
- No default.\r
-\r
- -m b|p Used to choose either blocking (b) or polling (p)\r
- Default: blocking (b)\r
-\r
- [ -i iterations ] Specify the number of times the entire sequence\r
- of data transfers will be made over each endpoint.\r
- Default: 1000\r
-\r
- [ -p pipeline ] Specify the pipline length, valid arguments are in \r
- the range [0,MAX_SEND_DTOS]. If a value greater than \r
- MAX_SEND_DTOS is requested the value will be\r
- adjusted down to MAX_SEND_DTOS.\r
- Default: MAX_SEND_DTOS\r
-\r
- OP\r
- An operation consists of:\r
-\r
- RR|RW Indicates the type of transfer:\r
- RR RDMA read\r
- RW RDMA write\r
- Default: none\r
-\r
- [ seg_size [ num_segs ] ]\r
- Indicates the amount and format\r
- of the data to be transferred.\r
- Default: 4096 1\r
- (i.e., 1 4KB buffer)\r
-\r
-USAGE - Limit test client\r
-\r
- Limit testing (-T L) neither requires nor connects to any server\r
- instance. The client runs one or more tests which attempt to\r
- exhaust various resources to determine DAPL limits and exercise\r
- DAPL error paths. If no arguments are given, all tests are run.\r
-\r
- Limit testing creates the sequence of DAT objects needed to\r
- move data back and forth, attempting to find the limits supported\r
- for the DAPL object requested. For example, if the LMR creation\r
- limit is being examined, the test will create a set of\r
- {IA, PZ, CNO, EVD, EP} before trying to run dat_lmr_create() to\r
- failure using that set of DAPL objects. The 'width' parameter\r
- can be used to control how many of these parallel DAPL object\r
- sets are created before beating upon the requested constructor.\r
- Use of -m limits the number of dat_*_create() calls that will\r
- be attempted, which can be helpful if the DAPL in use supports\r
- essentailly unlimited numbers of some objects.\r
-\r
- The limit test arguments are:\r
-\r
- [ -m maximum ] Specify the maximum number of dapl_*_create()\r
- attempts.\r
- Default: run to object creation failure\r
-\r
- [ -w width ] Specify the number of DAPL object sets to\r
- create while initializing.\r
- Default: 1\r
-\r
- [ limit_ia ] Attempt to exhaust dat_ia_open()\r
-\r
- [ limit_pz ] Attempt to exhaust dat_pz_create()\r
-\r
- [ limit_cno ] Attempt to exhaust dat_cno_create()\r
-\r
- [ limit_evd ] Attempt to exhaust dat_evd_create()\r
-\r
- [ limit_ep ] Attempt to exhaust dat_ep_create()\r
-\r
- [ limit_rsp ] Attempt to exhaust dat_rsp_create()\r
-\r
- [ limit_psp ] Attempt to exhaust dat_psp_create()\r
-\r
- [ limit_lmr ] Attempt to exhaust dat_lmr_create(4KB)\r
-\r
- [ limit_rpost ] Attempt to exhaust dat_ep_post_recv(4KB)\r
-\r
- [ limit_size_lmr ] Probe maximum size dat_lmr_create()\r
-\r
- Default: run all tests\r
-\r
-\r
-EXAMPLES\r
-\r
- dapltest -T S -d -D ibnic0\r
-\r
- Starts a server process with debug verbosity.\r
- \r
- dapltest -T T -d -s winIB -D ibnic0 -i 100 \\r
- client SR 4096 2 server SR 4096 2\r
-\r
- Runs a transaction test, with both sides\r
- sending one buffer with two 4KB segments,\r
- one hundred times; dapltest server is on host winIB.\r
-\r
- dapltest -T P -d -s winIB -D JniIbdd0 -i 100 SR 4096 2\r
-\r
- Runs a performance test, with the client \r
- sending one buffer with two 4KB segments,\r
- one hundred times.\r
-\r
- dapltest -T Q -s winIB -D ibnic0\r
-\r
- Asks the dapltest server at host 'winIB' to clean up and exit.\r
-\r
- dapltest -T L -D ibnic0 -d -w 16 -m 1000\r
-\r
- Runs all of the limit tests, setting up\r
- 16 complete sets of DAPL objects, and\r
- creating at most a thousand instances\r
- when trying to exhaust resources.\r
-\r
- dapltest -T T -V -d -t 2 -w 4 -i 55555 -s winIB -D ibnic0 \\r
- client RW 4096 1 server RW 2048 4 \\r
- client SR 1024 4 server SR 4096 2 \\r
- client SR 1024 3 -f server SR 2048 1 -f\r
-\r
- Runs a more complicated transaction test,\r
- with two thread using four EPs each,\r
- sending a more complicated buffer pattern\r
- for a larger number of iterations,\r
- validating the data received.\r
-\r
-\r
-BUGS (and To Do List)\r
-\r
- Use of CNOs (-Q) is not yet supported.\r
-\r
- Further limit tests could be added.\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#**********************************************************************\r
-#\r
-# MODULE: Makefile\r
-#\r
-# PURPOSE: Makefile for dapl reference provider for CYGWIN environment\r
-#\r
-#*********************************************************************/\r
-\r
-\r
-##############################################################\r
-# Application variables\r
-#\r
-\r
-LD = $(CROSS_COMPILE)link.exe\r
-CC = $(CROSS_COMPILE)cl.exe\r
-CPP = $(CC) \r
-AR = $(CROSS_COMPILE)ar\r
-NM = $(CROSS_COMPILE)nm\r
-STRIP = $(CROSS_COMPILE)strip\r
-OBJCOPY = $(CROSS_COMPILE)objcopy\r
-OBJDUMP = $(CROSS_COMPILE)objdump\r
-RANLIB = $(CROSS_COMPILE)ranlib\r
-MKDIR = mkdir -p \r
-SED = /bin/sed\r
-SHELL = /bin/sh\r
-\r
-TOPDIR = .\r
-\r
-OBJ_DIR = $(TOPDIR)\r
-TARGET_DIR = $(TOPDIR)\r
-\r
-INCDIRS := \\r
- ../../../dat/include \r
-\r
-vpath %.h . ${INCDIRS}\r
-\r
-\r
-##################################################\r
-# targets\r
-TAREXES = dapltest\r
-\r
-# data for user libraries\r
-dapltest_SOURCES = $(SRCS)\r
-\r
-SRCS := \\r
- dapl_bpool.c \\r
- dapl_client.c \\r
- dapl_client_info.c \\r
- dapl_cnxn.c \\r
- dapl_endian.c \\r
- dapl_fft_cmd.c \\r
- dapl_fft_connmgt.c \\r
- dapl_fft_dataxfer.c \\r
- dapl_fft_dataxfer_client.c \\r
- dapl_fft_endpoint.c \\r
- dapl_fft_hwconn.c \\r
- dapl_fft_mem.c \\r
- dapl_fft_pz.c \\r
- dapl_fft_queryinfo.c \\r
- dapl_fft_test.c \\r
- dapl_fft_util.c \\r
- dapl_getopt.c \\r
- dapl_limit.c \\r
- dapl_limit_cmd.c \\r
- dapl_main.c \\r
- dapl_mdep.c \\r
- dapl_memlist.c \\r
- dapl_netaddr.c \\r
- dapl_params.c \\r
- dapl_performance_client.c \\r
- dapl_performance_cmd.c \\r
- dapl_performance_server.c \\r
- dapl_performance_stats.c \\r
- dapl_performance_util.c \\r
- dapl_quit_cmd.c \\r
- dapl_server.c \\r
- dapl_server_cmd.c \\r
- dapl_server_info.c \\r
- dapl_test_data.c \\r
- dapl_test_util.c \\r
- dapl_thread.c \\r
- dapl_transaction_cmd.c \\r
- dapl_transaction_stats.c \\r
- dapl_transaction_test.c \\r
- dapl_transaction_util.c \\r
- dapl_util.c \r
-\r
-\r
-####################################################\r
-# compiler options CFLAGS\r
-#\r
-\r
-# common flags\r
-UOPTIONS += /nologo /MDd /W3 /GX /Od /FD /GZ /Gm /Zi\r
-\r
-# common defines\r
-UCOMDEFS += /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "WIN32" /D "_DEBUG" \\r
- -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 \r
-# other options: /FR /Fd\r
-\r
-# private defines\r
-UPRIVDEFS += /D "__WIN__" /D "__MSC__" /D "__i386__"\r
-\r
-CFLAGS += $(UOPTIONS) $(UCOMDEFS) $(UPRIVDEFS) \r
-\r
-#\r
-# Provider specific CFLAGS definition\r
-#\r
-\r
-###########################################################\r
-# common included libraries\r
-# Provider specific included libraries\r
-#\r
-ULDLIBS = dapl dat Ws2_32 advapi32\r
- \r
-\r
-\r
-\r
-#########################################################\r
-# link options LDFLAGS\r
-#\r
-\r
-MTARFLAGS= -cr\r
-\r
-TARFLAGS += cr\r
-\r
-# common flags\r
-ULDOPTIONS += /nologo /incremental:no /machine:I386 /debug\r
-\r
-# common directories\r
-ULDDIRS += /LIBPATH:"$(OBJ_DIR)"\r
-ULDDIRS += /LIBPATH:"$(TOPDIR)/../../../dat/udat/Target" \r
-ULDDIRS += /LIBPATH:"$(TOPDIR)/../../../dapl/udapl/Target" \r
-\r
-LDFLAGS += $(ULDOPTIONS) $(ULDDIRS) $(ULDLIBS:%=%.lib) \r
-\r
-#\r
-# Provider specific ULDFLAGS\r
-#\r
-LDFLAGS += /LIBPATH:"$(MTHOME)/lib"\r
-\r
-\r
-#############################################################\r
-# Local functions\r
-#\r
-bsndir = $(notdir $(basename $1))\r
-\r
-############################################################\r
-# Common rules\r
-# \r
-define COMPILE\r
-$(CC) -c $(strip ${CFLAGS}) $(strip $(INCDIRS:%=-I%)) $(EXTRA_CFLAGS) $($(@:${OBJ_DIR}/%.obj=%.c_CFLAGS)) /Fo"$@" $<\r
-endef\r
-\r
-define DEF_SET_VAR_SRCS\r
-@echo "$@_VAR_SRCS += $($(basename $(call bsndir,$@))_SOURCES)" >> $@\r
-endef\r
-\r
-define DEF_SET_VAR_OBJS\r
-@echo "$@_VAR_OBJS += $($(basename $(call bsndir,$@))_OBJECTS)" >> $@\r
-endef\r
-\r
-\r
-\r
-###########################################################################\r
-# Start rules\r
-# \r
-\r
-all: $(TAREXES:%=${TARGET_DIR}/%) $(TAROBJS:%=${OBJ_DIR}/%.obj) \r
-\r
-\r
-##########################################################################\r
-# Simple objects (user) \r
-\r
-$(TAROBJS:%=${OBJ_DIR}/%.obj): ${OBJ_DIR}/%.obj: %.c\r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- $(COMPILE)\r
-\r
-\r
-$(OBJ_DIR)/%.obj: %.c\r
- $(COMPILE)\r
-\r
-\r
-##########################################################################\r
-# Simple executables\r
-#\r
-$(TAREXES:%=$(TARGET_DIR)/%): % : %.mk\r
-$(TAREXES:%=$(TARGET_DIR)/%.mk): Makefile.cygwin \r
- @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi\r
- @if [ ! -d $(TARGET_DIR) ]; then mkdir -p $(TARGET_DIR); fi\r
- @echo "# Do not edit. Automatically generated file." > $@\r
- @\r
- @${DEF_SET_VAR_OBJS}\r
- @${DEF_SET_VAR_SRCS}\r
- @\r
- @echo "SOURCES += $($(call bsndir,$@)_SOURCES)" >> $@\r
- @\r
- @echo "$(@:%.mk=%): \$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo "$(@:%.mk=%): \$$($@_VAR_OBJS:%.c=$(OBJ_DIR)/%.obj)" >> $@\r
- @echo -e "\t\$$(LD) \$$(LDFLAGS) \$$(\$$(@:$(OBJ_DIR)/%=%)_LDFLAGS) /out:\"\$$(@:%=%.exe)\" \c" >> $@\r
- @echo -e "\$$($@_VAR_SRCS:%.c=$(OBJ_DIR)/%.obj) \$$($@_VAR_OBJS) \c" >> $@\r
- @echo -e "\$$(LDLIBS:%=%.lib) \$$(LIBDIRS:%=/LIBPATH:%) \$$(\$$(@:$(OBJ_DIR)/%=%)_LDLIBS:%=%.lib) \c" >> $@\r
- @echo "\$$(\$$(@:$(OBJ_DIR)/%=%)_LIBDIRS:%=/LIBPATH:%)" >> $@ \r
-\r
- \r
-ifneq ($(MAKECMDGOALS), clean)\r
-ifneq ($(strip $(TAREXES)),)\r
--include $(patsubst %,$(OBJ_DIR)/%.mk,$(TAREXES))\r
-endif\r
-endif\r
-\r
-\r
-##########################################################################\r
-# Clean rules \r
-# \r
-CLEANDIRS = $(OBJ_DIR) $(TARGET_DIR)\r
-\r
-CLEANFILES = *.obj *.dll *.lib *.sys *.pdb *.idb *.exp *.ilk *.sbr *.mk *.exe\r
- \r
-clean: $(CLEANDIRS)\r
- @echo deleting dump files at $(shell pwd)\r
- @rm -f $(CLEANFILES) \r
- @if [ -d $(OBJ_DIR) ] ; then rm -f $(CLEANFILES:%=$(OBJ_DIR)/%); fi\r
-\r
+++ /dev/null
-#\r
-# Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
-# \r
-# This Software is licensed under the terms of the "IBM Common Public\r
-# License 1.0" a copy of which is in the file LICENSE.txt in the\r
-# root directory. The license is also available from the Open Source\r
-# Initiative, see http://www.opensource.org/licenses/ibmpl.html.\r
-#\r
-#\r
-\r
-# -----------------------------------------------------\r
-#\r
-# Description : Makefile for dapltest\r
-#\r
-# -----------------------------------------------------\r
-\r
-IBA_HOME = ../../../..\r
-DAPL_ROOT = ../../..\r
-\r
-M_OBJS = $(ALLOBJS)\r
-M_TARGET := dapltest\r
-I_TARGET := $(M_TARGET)\r
-\r
-EXTRA_CFLAGS = -g3 \r
-EXTRA_CFLAGS += -Wall\r
-EXTRA_CFLAGS += -Wmissing-prototypes\r
-EXTRA_CFLAGS += -Wstrict-prototypes\r
-EXTRA_CFLAGS += -Wmissing-declarations\r
-EXTRA_CFLAGS += -pipe\r
-EXTRA_CFLAGS += -D__LINUX__\r
-EXTRA_CFLAGS += -DDAT_THREAD_SAFE=DAT_FALSE\r
-EXTRA_CFLAGS += -I$(DAPL_ROOT)/dat/include/\r
-EXTRA_CFLAGS += -Werror\r
-\r
-\r
-EXTRA_LDFLAGS = -L$(DAPL_ROOT)/dat/udat\r
-EXTRA_LDFLAGS += -ldat\r
-EXTRA_LDFLAGS += -lpthread\r
-EXTRA_LDFLAGS += -ldl\r
-\r
-ifeq ($(EXPLICIT_LINK),1)\r
-EXTRA_LDFLAGS += -L$(DAPL_ROOT)/dapl/udapl\r
-EXTRA_LDFLAGS += -ldapl\r
-endif\r
-\r
-include $(IBA_HOME)/Makefile.config\r
-include $(IBA_HOME)/Makefile.rules\r
-\r
-ifneq ($(ARCH),ia64)\r
-EXTRA_CFLAGS += -Werror\r
-EXTRA_CFLAGS += -D__PENTIUM__\r
-else\r
-EXTRA_CFLAGS += -DIA64\r
-endif\r
+++ /dev/null
-#\r
-# Copyright (c) 2002, Network Appliance, Inc. All rights reserved. \r
-# \r
-# This Software is licensed under the terms of the "IBM Common Public\r
-# License 1.0" a copy of which is in the file LICENSE.txt in the\r
-# root directory. The license is also available from the Open Source\r
-# Initiative, see http://www.opensource.org/licenses/ibmpl.html.\r
-#\r
-#\r
-\r
-# -----------------------------------------------------\r
-#\r
-# Description : Makefile for dapltest\r
-#\r
-# -----------------------------------------------------\r
-\r
-\r
-.SILENT:\r
-\r
-\r
-#\r
-# Variables\r
-#\r
-\r
-# DAPL_ROOT = path to DAPL root directory\r
-DAPL_ROOT = $(shell pwd)/../../..\r
-# OBJECT_DIR = directory for object files\r
-OBJECT_DIR = .\r
-# SOURCE_DIRS = directories containing source files\r
-SOURCE_DIRS = .\r
-# EXEC = exectuable name\r
-EXEC = dapltest\r
-\r
-# -------------- Automatic Variables ------------------\r
-SOURCE_FILES = $(shell ls $(foreach DIR, $(SOURCE_DIRS), $(DIR)/*.c))\r
-OBJECT_FILES = ${patsubst %.c,$(OBJECT_DIR)/%.o,$(notdir ${SOURCE_FILES})}\r
-EXEC_FILE = $(OBJECT_DIR)/$(EXEC)\r
-\r
-VPATH = $(SOURCE_DIRS)\r
-# -----------------------------------------------------\r
-\r
-\r
-#\r
-# Tools\r
-#\r
-\r
-ECHO = echo\r
-INSTALL = /usr/bin/install\r
-MAKEDEPEND = makedepend\r
-RM = rm\r
-\r
-\r
-#\r
-# Compiler\r
-#\r
-\r
-CC = gcc\r
-\r
-# DEFINES\r
-DEFINES = __LINUX__\r
-DEFINES += __PENTIUM__\r
-\r
-# INCLUDE_DIRS = directories containing include files\r
-INCLUDE_DIRS = $(DAPL_ROOT)/dat/include/\r
-\r
-CC_FLAGS = -g3 \r
-CC_FLAGS += -Wall\r
-CC_FLAGS += -Wmissing-prototypes\r
-CC_FLAGS += -Wstrict-prototypes\r
-CC_FLAGS += -Wmissing-declarations\r
-CC_FLAGS += -Werror\r
-CC_FLAGS += -pipe\r
-\r
-# -------------- Automatic Variables ------------------\r
-INCLUDE_PATH = $(foreach DIR, $(SOURCE_DIRS), -I$(DIR))\r
-INCLUDE_PATH += $(foreach DIR, $(INCLUDE_DIRS), -I$(DIR))\r
-\r
-CC_FLAGS += $(INCLUDE_PATH)\r
-CC_FLAGS += $(foreach DEFINE, $(DEFINES), -D$(DEFINE))\r
-# -----------------------------------------------------\r
-\r
-\r
-#\r
-# Linker\r
-#\r
-\r
-LD = gcc\r
-\r
-# LIB_OBJS = library object files\r
-LIB_OBJS = dat\r
-LIB_OBJS += pthread\r
-\r
-# LIB_DIRS = directories for library object files\r
-LIB_DIRS = $(DAPL_ROOT)/dat/udat/Target\r
-\r
-# if the provider library should be explicitly linked \r
-EXPLICIT_LINK=1\r
-ifeq ($(EXPLICIT_LINK),1)\r
-# in addition to providers listed in the DAT static registry\r
-# the specified provider will be available to the consumer \r
-LIB_OBJS += dapl\r
-LIB_DIRS += $(DAPL_ROOT)/dapl/udapl/Target\r
-endif\r
-\r
-# -------------- Automatic Variables ------------------\r
-LD_FLAGS = $(foreach DIR, $(LIB_DIRS), -L$(DIR))\r
-LD_FLAGS += $(foreach DIR, $(LIB_DIRS), -Wl,-R$(DIR))\r
-LD_FLAGS += $(foreach OBJ, $(LIB_OBJS), -l$(OBJ))\r
-# -----------------------------------------------------\r
-\r
-\r
-#\r
-# Rules\r
-#\r
-\r
-all : $(EXEC_FILE)\r
-\r
-$(EXEC_FILE) : $(OBJECT_DIR) $(OBJECT_FILES)\r
- $(ECHO) "--- Linking $@ ---"\r
- $(LD) $(LD_FLAGS) $(OBJECT_FILES) -o $@\r
-\r
-$(OBJECT_DIR) :\r
- $(ECHO) "--- Creating Directory $@ ---"\r
- $(INSTALL) -d $@\r
-\r
-$(OBJECT_DIR)/%.o: %.c\r
- $(ECHO) "--- Compiling $< ---"\r
- $(CC) $(CC_FLAGS) -o $@ -c $<\r
-\r
-tidy:\r
- $(RM) -f $(foreach DIR, $(SOURCE_DIRS), $(DIR)/*~)\r
-\r
-clean: tidy\r
- $(RM) -f $(OBJECT_DIR)/*.o $(OBJECT_DIR)/$(EXEC) \r
+++ /dev/null
-!if $(FREEBUILD)\r
-TARGETNAME=dapltest\r
-!else\r
-TARGETNAME=dapltestd\r
-!endif\r
-TARGETPATH=..\..\..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
-TARGETTYPE=PROGRAM\r
-UMTYPE=console\r
-USE_MSVCRT=1\r
-\r
-SOURCES=dapltest.rc \\r
- dapl_bpool.c \\r
- dapl_client.c \\r
- dapl_client_info.c \\r
- dapl_cnxn.c \\r
- dapl_endian.c \\r
- dapl_fft_cmd.c \\r
- dapl_fft_connmgt.c \\r
- dapl_fft_dataxfer.c \\r
- dapl_fft_dataxfer_client.c \\r
- dapl_fft_endpoint.c \\r
- dapl_fft_hwconn.c \\r
- dapl_fft_mem.c \\r
- dapl_fft_pz.c \\r
- dapl_fft_queryinfo.c \\r
- dapl_fft_test.c \\r
- dapl_fft_util.c \\r
- dapl_getopt.c \\r
- dapl_limit.c \\r
- dapl_limit_cmd.c \\r
- dapl_main.c \\r
- dapl_mdep.c \\r
- dapl_memlist.c \\r
- dapl_netaddr.c \\r
- dapl_params.c \\r
- dapl_performance_client.c \\r
- dapl_performance_cmd.c \\r
- dapl_performance_server.c \\r
- dapl_performance_stats.c \\r
- dapl_performance_util.c \\r
- dapl_quit_cmd.c \\r
- dapl_server.c \\r
- dapl_server_cmd.c \\r
- dapl_server_info.c \\r
- dapl_test_data.c \\r
- dapl_test_util.c \\r
- dapl_thread.c \\r
- dapl_transaction_cmd.c \\r
- dapl_transaction_stats.c \\r
- dapl_transaction_test.c \\r
- dapl_transaction_util.c \\r
- dapl_util.c\r
-\r
-INCLUDES=..\..\..\dapl\include;..\..\..\dat\include;\r
-RCOPTIONS=/I..\..\..\..\..\inc;\r
-\r
-# Set defines particular to the driver. A good Idea to build listings\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DDYNAMIC_DAT_LOADING\r
-!if $(FREEBUILD)\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DDAT_DLL_NAME=\"dat.dll\"\r
-DATLIB=dat.lib\r
-!else\r
-USER_C_FLAGS=$(USER_C_FLAGS) -DDAT_DLL_NAME=\"datd.dll\"\r
-DATLIB=datd.lib\r
-!endif\r
-\r
-TARGETLIBS=$(TARGETPATH)\*\$(DATLIB) $(SDK_LIB_PATH)\ws2_32.lib\r
-\r
-MSC_WARNING_LEVEL= /W3\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample client invocation\r
-#\r
-#\r
-me=`basename $0`\r
-case $# in \r
-0) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-1) host=$1\r
- device=IbalHca0\r
- size=65536 ;;\r
-2) host=$1\r
- device=IbalHca0\r
- size=$2 ;;\r
-3) host=$1\r
- device=$3 \r
- size=$2 ;;\r
-*) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-./dapltest -T P -d -i 1024 -s ${host} -D ${device} \\r
- -p 16 -m p RW ${size} 1\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample client invocation\r
-#\r
-#\r
-me=`basename $0`\r
-case $# in \r
-0) host=mtilab11-ib0\r
- device=IbalHca0 ;;\r
-1) host=$1\r
- device=IbalHca0 ;;\r
-2) host=$1\r
- device=$2 ;;\r
-*) echo Usage: $me '[hostname [device] ]' 1>&2 ; exit 1;;\r
-esac\r
-#\r
-#\r
-# ./dapltest -T T -V -d -t 2 -w 2 -i 1000111 -s ${host} -D ${device} \ \r
-# client RW 4096 1 server RW 2048 4 \\r
-# client RR 1024 2 server RR 2048 2 \\r
-# client SR 1024 3 -f server SR 256 3 -f\r
-\r
- ./dapltest -T T -P -d -t 1 -w 1 -i 1024 -s ${host} -D ${device} \\r
- client RW 4096 1 server RW 2048 4 \\r
- server RR 1024 2 client RR 2048 2 \\r
- client SR 1024 3 -f server SR 256 3 -f\r
-\r
-#dapltest -T T -d -s ${host} -D ${device} -i 10000 -t 1 -w 1 \\r
-# client SR 256 \\r
-# server SR 256\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_test_data.h"\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-\r
-/*****************************************************************************/\r
-/*\r
- * Allocate buffer pool (data buffers)\r
- *\r
- * Caller wants to allocate <num_seg> buffers of <seg_size> bytes,\r
- * with each buffer aligned as requested. The caller is free to\r
- * use the buffers separately, or as one contiguous segment, so\r
- * we allocate IOV entries enough to support either usage.\r
- */\r
-Bpool *\r
-DT_BpoolAlloc (\r
- Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_PZ_HANDLE pz_handle,\r
- DAT_EP_HANDLE ep_handle,\r
- DAT_EVD_HANDLE rmr_evd_handle,\r
- DAT_COUNT seg_size,\r
- DAT_COUNT num_segs,\r
- DAT_COUNT alignment,\r
- DAT_BOOLEAN enable_rdma_write,\r
- DAT_BOOLEAN enable_rdma_read)\r
-{\r
- unsigned char *module = "DT_BpoolAlloc";\r
- unsigned char *alloc_ptr = 0;\r
- Bpool *bpool_ptr = 0;\r
- DAT_COUNT alloc_size;\r
- DAT_REGION_DESCRIPTION region;\r
- DAT_RETURN ret;\r
-\r
- /* We'll hand out aligned buffers, compensate here */\r
- seg_size = DT_RoundSize (seg_size, alignment);\r
- alloc_size = seg_size * num_segs + alignment;\r
-\r
- alloc_ptr = (unsigned char *) DT_MemListAlloc ( pt_ptr, "bpool", BUFF,\r
- alloc_size);\r
- if (!alloc_ptr)\r
- {\r
- DT_Mdep_printf ("No Memory to create bpool buffer!\n");\r
- goto err;\r
- }\r
-\r
- bpool_ptr = (Bpool *) DT_MemListAlloc (pt_ptr, "bpool", BPOOL, sizeof (Bpool)\r
- + num_segs * sizeof (DAT_LMR_TRIPLET));\r
- if (!bpool_ptr)\r
- {\r
- DT_Mdep_printf ("No Memory to create Bpool!\n");\r
- goto err;\r
- }\r
-\r
- bpool_ptr->alloc_ptr = alloc_ptr;\r
- bpool_ptr->alloc_size = alloc_size;\r
- bpool_ptr->pz_handle = pz_handle;\r
- bpool_ptr->num_segs = num_segs;\r
- bpool_ptr->ep_handle = ep_handle;\r
- bpool_ptr->buffer_size = seg_size * num_segs;\r
- bpool_ptr->buffer_start = DT_AlignPtr (alloc_ptr, alignment);\r
- bpool_ptr->tripl_start = (DAT_LMR_TRIPLET *) (bpool_ptr + 1);\r
- bpool_ptr->seg_size = seg_size;\r
- bpool_ptr->enable_rdma_write = enable_rdma_write;\r
- bpool_ptr->enable_rdma_read = enable_rdma_read;\r
- bpool_ptr->rmr_evd_handle = rmr_evd_handle;\r
-\r
- DT_Mdep_spew (3, ("lmr_create [%p, %x]\n", bpool_ptr->buffer_start,\r
- bpool_ptr->buffer_size));\r
-\r
- memset (®ion, 0, sizeof (region));\r
- region.for_va = bpool_ptr->buffer_start;\r
- ret = dat_lmr_create (ia_handle,\r
- DAT_MEM_TYPE_VIRTUAL,\r
- region,\r
- bpool_ptr->buffer_size,\r
- pz_handle,\r
- DAT_MEM_PRIV_ALL_FLAG,\r
- &bpool_ptr->lmr_handle,\r
- &bpool_ptr->lmr_context,\r
- &bpool_ptr->rmr_context,\r
- &bpool_ptr->reg_size,\r
- &bpool_ptr->reg_addr);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_create failed %s\n",\r
- module, DT_RetToString (ret));\r
- goto err;\r
- }\r
- /* verify that the outputs are reasonable */\r
- if (((uintptr_t)bpool_ptr->reg_addr > (uintptr_t)bpool_ptr->buffer_start)\r
- || (bpool_ptr->reg_size < bpool_ptr->buffer_size +\r
- ((uintptr_t)bpool_ptr->buffer_start - (uintptr_t)bpool_ptr->reg_addr)))\r
- {\r
- DT_Mdep_printf ( "%s: dat_lmr_create bogus"\r
- "in: 0x%p, %x out 0x" F64x ", " F64x "\n",\r
- module,\r
- bpool_ptr->buffer_start, bpool_ptr->buffer_size,\r
- (DAT_UVERYLONG)bpool_ptr->reg_addr, \r
- (DAT_UVERYLONG)bpool_ptr->reg_size);\r
- goto err;\r
- }\r
-\r
- DT_Mdep_spew (3, ("lmr_create OK [0x" F64x ", " F64x ", lctx=%x]\n",\r
- (DAT_UVERYLONG)bpool_ptr->reg_addr, \r
- (DAT_UVERYLONG)bpool_ptr->reg_size, bpool_ptr->lmr_context));\r
-#ifdef ALLOW_MW /* no BIND RMR */ /* Enable RDMA if requested */\r
- if (enable_rdma_write || enable_rdma_read)\r
- {\r
- DAT_LMR_TRIPLET iov;\r
- DAT_RMR_COOKIE cookie;\r
- DAT_MEM_PRIV_FLAGS mflags;\r
- DAT_RMR_BIND_COMPLETION_EVENT_DATA rmr_stat;\r
-\r
- /* create the RMR */\r
- ret = dat_rmr_create (pz_handle, &bpool_ptr->rmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rmr_create failed %s\n",\r
- module, DT_RetToString (ret));\r
- goto err;\r
- }\r
-\r
- /* bind the RMR */\r
- iov.virtual_address = bpool_ptr->reg_addr;\r
- iov.segment_length = bpool_ptr->reg_size;\r
- iov.lmr_context = bpool_ptr->lmr_context;\r
- cookie.as_64 = (DAT_UINT64)0UL;\r
- cookie.as_ptr = (DAT_PVOID) (uintptr_t) bpool_ptr->reg_addr;\r
- mflags = (enable_rdma_write && enable_rdma_read ? DAT_MEM_PRIV_ALL_FLAG\r
- : (enable_rdma_write ? DAT_MEM_PRIV_WRITE_FLAG\r
- : (enable_rdma_read ? DAT_MEM_PRIV_READ_FLAG : 0)));\r
-\r
- DT_Mdep_spew (3, ("rmr_bind [" F64x ", " F64x "]\n",\r
- (DAT_UVERYLONG)bpool_ptr->reg_addr, \r
- (DAT_UVERYLONG)bpool_ptr->reg_size));\r
-\r
- ret = dat_rmr_bind ( bpool_ptr->rmr_handle,\r
- &iov,\r
- mflags,\r
- bpool_ptr->ep_handle,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG,\r
- &bpool_ptr->rmr_context);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rmr_bind failed %s\n",\r
- module, DT_RetToString (ret));\r
- goto err;\r
- }\r
-\r
- DT_Mdep_spew (3, ("rmr_bind-wait\n"));\r
-\r
- /* await the bind result */\r
- if (!DT_rmr_event_wait (bpool_ptr->rmr_evd_handle, &rmr_stat) ||\r
- !DT_rmr_check (&rmr_stat,\r
- bpool_ptr->rmr_handle,\r
- (DAT_PVOID) (uintptr_t) bpool_ptr->reg_addr,\r
- "Bpool"))\r
- {\r
- goto err;\r
- }\r
-\r
- DT_Mdep_spew (3, ("rmr_bound [OK Rctx=%x]\n", bpool_ptr->rmr_context));\r
- }\r
-#endif /** ALLOW_MW */\r
-\r
- /*\r
- * Finally! Return the newly created Bpool.\r
- */\r
- return ( bpool_ptr );\r
-\r
-\r
- /* *********************************\r
- * Whoops - clean up and return NULL\r
- */\r
-err:\r
- if (bpool_ptr)\r
- {\r
- if (bpool_ptr->rmr_handle)\r
- {\r
- ret = dat_rmr_free (bpool_ptr->rmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rmr_free failed %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- }\r
- if (bpool_ptr->lmr_handle)\r
- {\r
- ret = dat_lmr_free (bpool_ptr->lmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_free failed %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- }\r
- DT_MemListFree (pt_ptr, bpool_ptr);\r
- }\r
- if (alloc_ptr)\r
- {\r
- DT_MemListFree (pt_ptr, alloc_ptr);\r
- }\r
-\r
- return ( 0 );\r
-}\r
-\r
-/*****************************************************************************/\r
-bool\r
-DT_Bpool_Destroy (Per_Test_Data_t * pt_ptr,\r
- Bpool * bpool_ptr)\r
-{\r
- unsigned char *module = "DT_Bpool_Destroy";\r
- bool rval = true;\r
-\r
- if (bpool_ptr)\r
- {\r
- if (bpool_ptr->alloc_ptr)\r
- {\r
- if (bpool_ptr->rmr_handle)\r
- {\r
- DAT_LMR_TRIPLET iov;\r
- DAT_RMR_COOKIE cookie;\r
- DAT_RETURN ret;\r
-\r
- iov.virtual_address = bpool_ptr->reg_addr;\r
- iov.segment_length = 0; /* un-bind */\r
- iov.lmr_context = bpool_ptr->lmr_context;\r
- cookie.as_64 = (DAT_UINT64)0UL;\r
- cookie.as_ptr = (DAT_PVOID) (uintptr_t)bpool_ptr->reg_addr;\r
-\r
- /*\r
- * Do not attempt to unbind here. The remote node\r
- * is going through the same logic and may disconnect\r
- * before an unbind completes. Any bind/unbind\r
- * operation requires a CONNECTED QP to complete,\r
- * a disconnect will cause problems. Unbind is\r
- * a simple optimization to allow rebinding of\r
- * an RMR, doing an rmr_free will pull the plug\r
- * and cleanup properly.\r
- */\r
- ret = dat_rmr_free (bpool_ptr->rmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rmr_free failed %s\n",\r
- module, DT_RetToString (ret));\r
- rval = false;\r
- }\r
- }\r
-\r
- if (bpool_ptr->lmr_handle)\r
- {\r
- DAT_RETURN ret = dat_lmr_free (bpool_ptr->lmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_free failed %s\n",\r
- module, DT_RetToString (ret));\r
- rval = false;\r
- }\r
- }\r
- DT_MemListFree (pt_ptr, bpool_ptr->alloc_ptr);\r
- }\r
- DT_MemListFree (pt_ptr, bpool_ptr);\r
- }\r
-\r
- return (rval);\r
-}\r
-\r
-/*****************************************************************************/\r
-unsigned char *\r
-DT_Bpool_GetBuffer (Bpool * bpool_ptr, int index)\r
-{\r
- return ( bpool_ptr->buffer_start + index * bpool_ptr->seg_size );\r
-}\r
-\r
-/*****************************************************************************/\r
-DAT_COUNT\r
-DT_Bpool_GetBuffSize (Bpool * bpool_ptr, int index)\r
-{\r
- return ( bpool_ptr->seg_size );\r
-}\r
-\r
-/*****************************************************************************/\r
-DAT_LMR_TRIPLET *\r
-DT_Bpool_GetIOV (Bpool * bpool_ptr, int index)\r
-{\r
- return ( bpool_ptr->tripl_start + index );\r
-}\r
-\r
-/*****************************************************************************/\r
-DAT_LMR_CONTEXT\r
-DT_Bpool_GetLMR (Bpool * bpool_ptr, int index)\r
-{\r
- return ( bpool_ptr->lmr_context );\r
-}\r
-\r
-/*****************************************************************************/\r
-DAT_RMR_CONTEXT\r
-DT_Bpool_GetRMR (Bpool * bpool_ptr, int index)\r
-{\r
- return ( bpool_ptr->rmr_context );\r
-}\r
-\r
-/*****************************************************************************/\r
-void\r
-DT_Bpool_print (Bpool * bpool_ptr)\r
-{\r
- DT_Mdep_printf ("BPOOL %p\n", bpool_ptr);\r
- DT_Mdep_printf ("BPOOL alloc_ptr %p\n", (unsigned char *) bpool_ptr->alloc_ptr);\r
- DT_Mdep_printf ("BPOOL alloc_size %x\n", (int) bpool_ptr->alloc_size);\r
- DT_Mdep_printf ("BPOOL pz_handle %p\n", (uintptr_t*) bpool_ptr->pz_handle);\r
- DT_Mdep_printf ("BPOOL num_segs %x\n", (int) bpool_ptr->num_segs);\r
- DT_Mdep_printf ("BPOOL seg_size %x\n", (int) bpool_ptr->seg_size);\r
- DT_Mdep_printf ("BPOOL tripl_start %p\n", bpool_ptr->tripl_start);\r
- DT_Mdep_printf ("BPOOL buffer_start %p\n", bpool_ptr->buffer_start);\r
- DT_Mdep_printf ("BPOOL buffer_size %x\n", (int) bpool_ptr->buffer_size);\r
- DT_Mdep_printf ("BPOOL rdma_write %x\n",\r
- (int) bpool_ptr->enable_rdma_write);\r
- DT_Mdep_printf ("BPOOL rdmaread %x\n",\r
- (int) bpool_ptr->enable_rdma_read);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_BPOOL_H__\r
-#define __DAPL_BPOOL_H__\r
-\r
-#include "dapl_mdep.h"\r
-#include <dat/udat.h>\r
-\r
-#pragma pack(1)\r
-typedef struct Bpool_tag Bpool;\r
-/*\r
- * struct Bpool\r
- */\r
-\r
-struct Bpool_tag\r
-{\r
- unsigned char *alloc_ptr;\r
- DAT_UINT32 alloc_size;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_COUNT seg_size;\r
- DAT_COUNT num_segs; /* num segments */\r
- unsigned char *buffer_start; /* Start of buffer area */\r
- DAT_COUNT buffer_size; /* Size of data buffer (rounded) */\r
- DAT_VADDR reg_addr; /* start of registered area */\r
- DAT_VLEN reg_size; /* size of registered area */\r
- DAT_EP_HANDLE ep_handle; /* EP area is registered to */\r
- DAT_LMR_HANDLE lmr_handle; /* local access */\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_LMR_TRIPLET*tripl_start; /* local IOV */\r
- DAT_BOOLEAN enable_rdma_write; /* remote access */\r
- DAT_BOOLEAN enable_rdma_read;\r
- DAT_RMR_HANDLE rmr_handle;\r
- DAT_RMR_CONTEXT rmr_context;\r
- DAT_EVD_HANDLE rmr_evd_handle;\r
-};\r
-#pragma pack()\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_server_info.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_transaction_test.h"\r
-#include "dapl_version.h"\r
-#include "dapl_cnxn.h"\r
-#include <dat/dat.h>\r
-#include <dat/udat.h>\r
-\r
-#define DFLT_QLEN 40 /* default event queue length */\r
-#define MAX_CONN_RETRY 8\r
-\r
-/*\r
- * Client control routine Connect to the server, send the command across.\r
- * Then start the client-side of the test - creating threads as needed\r
- */\r
-void\r
-DT_cs_Client (Params_t * params_ptr,\r
- char *dapl_name,\r
- char *server_name,\r
- DAT_UINT32 total_threads)\r
-{\r
- Per_Test_Data_t *pt_ptr = NULL;\r
- DAT_IA_HANDLE ia_handle = DAT_HANDLE_NULL;\r
- DAT_PZ_HANDLE pz_handle = DAT_HANDLE_NULL;\r
- DAT_EVD_HANDLE recv_evd_hdl = DAT_HANDLE_NULL;\r
- DAT_EVD_HANDLE reqt_evd_hdl = DAT_HANDLE_NULL;\r
- DAT_EVD_HANDLE conn_evd_hdl = DAT_HANDLE_NULL;\r
- DAT_EVD_HANDLE async_evd_hdl = DAT_HANDLE_NULL;\r
- DAT_EP_HANDLE ep_handle = DAT_HANDLE_NULL;\r
- Server_Info_t *sinfo = NULL;\r
- Transaction_Cmd_t *Transaction_Cmd = NULL;\r
- Performance_Cmd_t *Performance_Cmd = NULL;\r
- Quit_Cmd_t *Quit_Cmd = NULL;\r
- Bpool *bpool = NULL;\r
- DAT_IA_ADDRESS_PTR remote_netaddr = NULL;\r
- unsigned char *module = "DT_cs_Client";\r
- unsigned int did_connect = 0;\r
- unsigned int retry_cnt = 0;\r
- DAT_DTO_COOKIE dto_cookie;\r
-\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_EVENT_NUMBER event_num;\r
- unsigned char * buffp;\r
- DAT_RETURN ret;\r
-\r
- dto_cookie.as_64 = LZERO;\r
-\r
- DT_Mdep_printf ("%s: Starting Test ... \n", module);\r
-\r
- /* Set up the Per_Test_Data */\r
- pt_ptr = DT_Alloc_Per_Test_Data ();\r
- if (!pt_ptr)\r
- {\r
- DT_Mdep_printf ("%s: no memory for Per_Test_Data\n", module);\r
- return;\r
- }\r
- DT_MemListInit (pt_ptr); /* init MemlistLock and memListHead */\r
- DT_Thread_Init (pt_ptr); /* init ThreadLock and threadcount */\r
- pt_ptr->local_is_server = false;\r
- pt_ptr->Client_Info.dapltest_version = DAPLTEST_VERSION;\r
- pt_ptr->Client_Info.is_little_endian = DT_local_is_little_endian;\r
- pt_ptr->Client_Info.test_type = params_ptr->test_type;\r
- pt_ptr->Client_Info.total_threads = total_threads;\r
- memcpy ( (void *) (uintptr_t) &pt_ptr->Params,\r
- (const void *) params_ptr,\r
- sizeof (Params_t));\r
-\r
- /* Allocate and fill in the Server's address */\r
- remote_netaddr = DT_NetAddrAlloc (pt_ptr);\r
- if ( !remote_netaddr\r
- || !DT_NetAddrLookupHostAddress (remote_netaddr, server_name))\r
- {\r
- DT_Mdep_printf ("%s: Cannot find server address\n", module);\r
- goto client_exit;\r
- }\r
-\r
-#ifdef DYNAMIC_DAT_LOADING\r
- /* Open the IA */\r
- ret = dat_open (dapl_name,\r
- DFLT_QLEN,\r
- &async_evd_hdl,\r
- &ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- ret = dat_ia_open (dapl_name,\r
- DFLT_QLEN,\r
- &async_evd_hdl,\r
- &ia_handle);\r
-#endif //DYNAMIC_DAT_LOADING\r
-\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf( "%s: Could not open %s (%s)\n",\r
- module, dapl_name, DT_RetToString (ret));\r
- ia_handle = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
- DT_Mdep_debug (("%s: IA %s opened\n", module, dapl_name));\r
-\r
- /* Create a PZ */\r
- ret = dat_pz_create (ia_handle, &pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_create error: %s\n",\r
- module, DT_RetToString (ret));\r
- pz_handle = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
-\r
- /* Create 3 events - recv, request, connect */\r
- ret = dat_evd_create (ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG,\r
- &recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (recv) failed %s\n",\r
- module, DT_RetToString (ret));\r
- recv_evd_hdl = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
- ret = dat_evd_create (ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (send) failed %s\n",\r
- module, DT_RetToString (ret));\r
- reqt_evd_hdl = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
- ret = dat_evd_create (ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CONNECTION_FLAG,\r
- &conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (conn) failed %s\n",\r
- module, DT_RetToString (ret));\r
- conn_evd_hdl = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
-\r
- /* Create an EP */\r
- ret = dat_ep_create (ia_handle, /* IA */\r
- pz_handle, /* PZ */\r
- recv_evd_hdl, /* recv */\r
- reqt_evd_hdl, /* request */\r
- conn_evd_hdl, /* connect */\r
- (DAT_EP_ATTR *) NULL,\r
- &ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_create error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- ep_handle = DAT_HANDLE_NULL;\r
- goto client_exit;\r
- }\r
- DT_Mdep_debug (("%s: EP created\n", module));\r
-\r
- /*\r
- * Gather whatever info we want about defaults,\r
- * and check that we can handle the requested parameters.\r
- */\r
- if (!DT_query (pt_ptr, ia_handle, ep_handle) ||\r
- !DT_check_params (pt_ptr, module))\r
- {\r
- goto client_exit;\r
- }\r
-\r
- bpool = DT_BpoolAlloc (pt_ptr,\r
- ia_handle,\r
- pz_handle,\r
- ep_handle,\r
- DAT_HANDLE_NULL, /* no RMR */\r
- DT_RoundSize (sizeof (Transaction_Cmd_t), 8192),\r
- 3, /* num_buffers */\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if (bpool == 0)\r
- {\r
- DT_Mdep_printf ("%s: no memory for command buffer pool.\n", module);\r
- goto client_exit;\r
- }\r
-\r
- DT_Mdep_spew (3, ("RecvSrvInfo 0 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- bpool, 0)));\r
- DT_Mdep_spew (3, ("SndCliInfo 1 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- bpool, 1)));\r
- DT_Mdep_spew (3, ("SndCommand 2 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- bpool, 2)));\r
-\r
- /* Post recv buffer for Server_Info (1st buffer in pool) */\r
- DT_Mdep_debug (("%s: Posting 1 recv buffer\n", module));\r
-retry_repost:\r
- if (!DT_post_recv_buffer (ep_handle,\r
- bpool,\r
- 0,\r
- DT_Bpool_GetBuffSize (bpool, 0)))\r
- {\r
- DT_Mdep_printf ("%s: cannot post Server_Info recv buffer.\n", module);\r
- goto client_exit;\r
- }\r
-\r
- DT_Mdep_debug (("%s: Connect Endpoint\n", module));\r
-retry:\r
- ret = dat_ep_connect (ep_handle,\r
- remote_netaddr,\r
- SERVER_PORT_NUMBER,\r
- DAT_TIMEOUT_INFINITE,\r
- 0, (DAT_PVOID) 0, /* no private data */\r
- params_ptr->ReliabilityLevel,\r
- DAT_CONNECT_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: Cannot connect Endpoint %s\n",\r
- module, DT_RetToString (ret));\r
- goto client_exit;\r
- }\r
-\r
- DT_Mdep_debug (("%s: Await connection ...\n", module));\r
- if (!DT_conn_event_wait (ep_handle, conn_evd_hdl, &event_num))\r
- {\r
- if ( event_num == DAT_CONNECTION_EVENT_PEER_REJECTED )\r
- {\r
- DAT_EVENT event;\r
- DAT_COUNT drained = 0;\r
-\r
- DT_Mdep_Sleep (1000);\r
- DT_Mdep_printf ("%s: retrying connection...\n", module);\r
- retry_cnt++;\r
- /*\r
- * See if any buffers were flushed as a result of\r
- * the REJECT; clean them up and repost if so\r
- */\r
- dat_ep_reset (ep_handle);\r
- do\r
- {\r
-\r
- ret = dat_evd_dequeue ( recv_evd_hdl,\r
- &event);\r
- drained++;\r
- } while (ret != DAT_QUEUE_EMPTY);\r
-\r
- if (drained > 1 && retry_cnt < MAX_CONN_RETRY)\r
- {\r
- DT_Mdep_printf("Reposting!!! %d\n", drained);\r
- goto retry_repost;\r
- } \r
- if (retry_cnt < MAX_CONN_RETRY)\r
- {\r
- goto retry;\r
- }\r
- }\r
- DT_Mdep_printf ("%s: bad connection event\n", module);\r
- goto client_exit;\r
- }\r
-\r
- did_connect++;\r
- if (DT_dapltest_debug)\r
- {\r
- DT_Mdep_debug (("%s: Connected!\n", module));\r
- get_ep_connection_state (ep_handle);\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (1000);\r
-#endif\r
-\r
-\r
- /* Send Client_Info (using 2nd buffer in the pool) */\r
- DT_Mdep_debug (("%s: Sending Client_Info\n", module));\r
- buffp = DT_Bpool_GetBuffer (bpool, 1);\r
- memcpy ( (void *)buffp,\r
- (const void *) &pt_ptr->Client_Info,\r
- sizeof (Client_Info_t));\r
- DT_Client_Info_Endian ((Client_Info_t *) buffp);\r
- if (!DT_post_send_buffer ( ep_handle,\r
- bpool,\r
- 1,\r
- DT_Bpool_GetBuffSize (bpool, 1)))\r
- {\r
- DT_Mdep_printf ("%s: cannot send Client_Info\n", module);\r
- goto client_exit;\r
- }\r
- /* reap the send and verify it */\r
- dto_cookie.as_ptr = (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( bpool, 1);\r
- DT_Mdep_debug (("%s: Sent Client_Info - awaiting completion\n", module));\r
- if (!DT_dto_event_wait (reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ep_handle,\r
- DT_Bpool_GetBuffSize (bpool, 1),\r
- dto_cookie,\r
- "Client_Info_Send"))\r
- {\r
- goto client_exit;\r
- }\r
-\r
- /* Set up the Command (using 3rd buffer in pool) */\r
- DT_Mdep_debug (("%s: Sending Command\n", module));\r
- buffp = DT_Bpool_GetBuffer (bpool, 2);\r
- switch (pt_ptr->Client_Info.test_type)\r
- {\r
- case QUIT_TEST:\r
- {\r
- Quit_Cmd = &pt_ptr->Params.u.Quit_Cmd;\r
- memcpy ( (void *)buffp,\r
- (const void *)Quit_Cmd,\r
- sizeof (Quit_Cmd_t));\r
- DT_Quit_Cmd_Endian ((Quit_Cmd_t *) buffp, true);\r
- break;\r
- }\r
- case TRANSACTION_TEST:\r
- {\r
- Transaction_Cmd = &pt_ptr->Params.u.Transaction_Cmd;\r
- memcpy ( (void *)buffp,\r
- (const void *)Transaction_Cmd,\r
- sizeof (Transaction_Cmd_t));\r
- DT_Transaction_Cmd_Endian ((Transaction_Cmd_t *)buffp, true);\r
- break;\r
- }\r
- case PERFORMANCE_TEST:\r
- {\r
- Performance_Cmd = &pt_ptr->Params.u.Performance_Cmd;\r
- memcpy ( (void *)buffp,\r
- (const void *)Performance_Cmd,\r
- sizeof (Performance_Cmd_t));\r
- DT_Performance_Cmd_Endian ((Performance_Cmd_t *)buffp);\r
- break;\r
- }\r
- default:\r
- {\r
- DT_Mdep_printf ("Unknown Test Type\n");\r
- goto client_exit;\r
- }\r
- }\r
-\r
- /* Send the Command buffer */\r
- if (!DT_post_send_buffer ( ep_handle,\r
- bpool,\r
- 2,\r
- DT_Bpool_GetBuffSize (bpool, 2)))\r
- {\r
- DT_Mdep_printf ("%s: cannot send Command\n", module);\r
- goto client_exit;\r
- }\r
- /* reap the send and verify it */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr = (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( bpool, 2);\r
- DT_Mdep_debug (("%s: Sent Command - awaiting completion\n", module));\r
- if (!DT_dto_event_wait (reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ep_handle,\r
- DT_Bpool_GetBuffSize (bpool, 2),\r
- dto_cookie,\r
- "Client_Cmd_Send"))\r
- {\r
- goto client_exit;\r
- }\r
-\r
- /************************************************************************/\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr = (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( bpool, 0);\r
- DT_Mdep_debug (("%s: Waiting for Server_Info\n", module));\r
- if (!DT_dto_event_wait (recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ep_handle,\r
- DT_Bpool_GetBuffSize (bpool, 0),\r
- dto_cookie,\r
- "Server_Info_Recv"))\r
- {\r
- goto client_exit;\r
- }\r
-\r
- DT_Mdep_debug (("%s: Server_Info Received\n", module));\r
- sinfo = (Server_Info_t*) DT_Bpool_GetBuffer (bpool, 0);\r
- DT_Server_Info_Endian (sinfo);\r
- memcpy ( (void *) (uintptr_t)&pt_ptr->Server_Info,\r
- (const void *)sinfo,\r
- sizeof (Server_Info_t));\r
-\r
- /* Perform obligatory version check */\r
- if (pt_ptr->Server_Info.dapltest_version != DAPLTEST_VERSION)\r
- {\r
- DT_Mdep_printf ("%s: DAPLTEST VERSION MISMATCH: Server %d, Client %d\n",\r
- module,\r
- pt_ptr->Server_Info.dapltest_version,\r
- DAPLTEST_VERSION);\r
- goto client_exit;\r
- }\r
- DT_Mdep_debug (("%s: Version OK!\n", module));\r
-\r
- /* Dump out what we know, if requested */\r
- if (DT_dapltest_debug)\r
- {\r
- DT_Server_Info_Print (&pt_ptr->Server_Info);\r
- DT_Client_Info_Print (&pt_ptr->Client_Info);\r
- }\r
-\r
- /* Onward to running the actual test requested */\r
- switch (pt_ptr->Client_Info.test_type)\r
- {\r
- case TRANSACTION_TEST:\r
- {\r
- if (Transaction_Cmd->debug)\r
- {\r
- DT_Transaction_Cmd_Print (Transaction_Cmd);\r
- }\r
- DT_Transaction_Test_Client (pt_ptr,\r
- ia_handle,\r
- remote_netaddr);\r
- break;\r
- }\r
- case PERFORMANCE_TEST:\r
- {\r
- if (Performance_Cmd->debug)\r
- {\r
- DT_Performance_Cmd_Print (Performance_Cmd);\r
- }\r
- DT_Performance_Test_Client (pt_ptr,\r
- ia_handle,\r
- remote_netaddr);\r
- break;\r
- }\r
- case QUIT_TEST:\r
- {\r
- DT_Quit_Cmd_Print (Quit_Cmd);\r
- break;\r
- }\r
- }\r
-\r
- /*********************************************************************\r
- * Done - clean up and go home\r
- */\r
-client_exit:\r
- DT_Mdep_debug (("%s: Cleaning Up ...\n", module));\r
-\r
- /* Disconnect the EP */\r
- if (ep_handle)\r
- {\r
- /*\r
- * graceful attempt might fail because we got here due to\r
- * some error above, so we may as well try harder.\r
- */\r
- ret = dat_ep_disconnect (ep_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_disconnect (abrupt) error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- }\r
- else if (did_connect &&\r
- !DT_disco_event_wait (conn_evd_hdl, NULL))\r
- {\r
- DT_Mdep_printf ("%s: bad disconnect event\n", module);\r
- }\r
- }\r
-\r
- /* Free the bpool (if any) */\r
- DT_Bpool_Destroy (pt_ptr, bpool);\r
-\r
- /* Free the EP */\r
- if (ep_handle)\r
- {\r
- DAT_EVENT event;\r
- /*\r
- * Drain off outstanding DTOs that may have been\r
- * generated by racing disconnects\r
- */\r
- do\r
- {\r
- ret = dat_evd_dequeue ( recv_evd_hdl,\r
- &event);\r
- } while ( DAT_GET_TYPE(ret) != DAT_QUEUE_EMPTY );\r
-\r
- ret = dat_ep_free (ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep going */\r
- }\r
- }\r
-\r
- /* Free the 3 EVDs */\r
- if (conn_evd_hdl)\r
- {\r
- ret = dat_evd_free (conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (conn) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep going */\r
- }\r
- }\r
- if (reqt_evd_hdl)\r
- {\r
- ret = dat_evd_free (reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (reqt) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep going */\r
- }\r
- }\r
- if (recv_evd_hdl)\r
- {\r
- ret = dat_evd_free (recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (recv) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep going */\r
- }\r
- }\r
-\r
- /* Free the PZ */\r
- if (pz_handle)\r
- {\r
- ret = dat_pz_free (pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_free error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep going */\r
- }\r
- }\r
-\r
- /* Close the IA */\r
- if (ia_handle)\r
- {\r
- /* DT_ia_close cleans up async evd handle, too */\r
- ret = DT_ia_close (ia_handle, DAT_CLOSE_GRACEFUL_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (graceful) error: %s\n",\r
- module, DT_RetToString (ret));\r
- ret = DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (abrupt) error: %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- /* keep going */\r
- }\r
- else\r
- {\r
- DT_Mdep_debug (("%s: IA %s closed\n", module, dapl_name));\r
- }\r
- }\r
-\r
- /* Free the Server's address */\r
- if (remote_netaddr)\r
- {\r
- DT_NetAddrFree (pt_ptr, remote_netaddr);\r
- }\r
-\r
- /* Free the Per_Test_Data */\r
- DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);\r
- DT_PrintMemList (pt_ptr); /* check if we return all space allocated */\r
- DT_Mdep_LockDestroy (&pt_ptr->MemListLock);\r
- DT_Free_Per_Test_Data (pt_ptr);\r
-\r
- DT_Mdep_printf ("%s: ========== End of Work -- Client Exiting\n", module);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_client_info.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-void\r
-DT_Client_Info_Endian (Client_Info_t * client_info)\r
-{\r
- client_info->dapltest_version = DT_Endian32 (client_info->dapltest_version);\r
- client_info->is_little_endian = DT_Endian32 (client_info->is_little_endian);\r
- client_info->test_type = DT_Endian32 (client_info->test_type);\r
- client_info->total_threads = DT_Endian32 (client_info->total_threads);\r
-}\r
-\r
-\r
-void\r
-DT_Client_Info_Print (Client_Info_t * client_info)\r
-{\r
- DT_Mdep_printf ("-------------------------------------\n");\r
- DT_Mdep_printf ("Client_Info.dapltest_version : %d\n",\r
- client_info->dapltest_version);\r
- DT_Mdep_printf ("Client_Info.is_little_endian : %d\n",\r
- client_info->is_little_endian);\r
- DT_Mdep_printf ("Client_Info.test_type : %d\n",\r
- client_info->test_type);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_CLIENT_INFO_H__\r
-#define __DAPL_CLIENT_INFO_H__\r
-\r
-#include "dapl_mdep.h"\r
-#include <dat/udat.h>\r
-\r
-#pragma pack(1)\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 dapltest_version;\r
- DAT_UINT32 is_little_endian;\r
- DAT_UINT32 test_type;\r
- DAT_UINT32 total_threads;\r
-} Client_Info_t;\r
-#pragma pack()\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_cnxn.h"\r
-\r
-\r
-/****************************************************************************/\r
-int\r
-get_ep_connection_state (DAT_EP_HANDLE ep_handle)\r
-{\r
- DAT_EP_STATE ep_state;\r
- DAT_BOOLEAN in_dto_idle;\r
- DAT_BOOLEAN out_dto_idle;\r
- DAT_RETURN ret;\r
- char *recv_status = "Idle";\r
- char *req_status = "Idle";\r
- ret = dat_ep_get_status (ep_handle, &ep_state, &in_dto_idle,\r
- &out_dto_idle);\r
- if (ret != 0)\r
- {\r
- DT_Mdep_printf ("DAT_ERROR: Can't get Connection State %s\n",\r
- DT_RetToString (ret));\r
- }\r
- else\r
- {\r
- if (in_dto_idle == 0)\r
- {\r
- recv_status = "Active";\r
- }\r
- if (out_dto_idle == 0)\r
- {\r
- req_status = "Active";\r
- }\r
-\r
- DT_Mdep_printf ("DAT_STATE: %s\n", DT_State2Str (ep_state));\r
- DT_Mdep_printf ("DAT_STATE: Inbound DTO Status: %s \n", recv_status);\r
- DT_Mdep_printf ("DAT_STATE: Outbound DTO Status: %s\n", req_status);\r
- }\r
-\r
- return 0;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_CNXN_H__\r
-#define __DAPL_CNXN_H__\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-\r
-#define MAXHOSTNAMELEN 256\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_COMMON_H__\r
-#define __DAPL_COMMON_H__\r
-\r
-#include <dat/udat.h>\r
-\r
-typedef enum\r
-{\r
- RDMA_READ,\r
- RDMA_WRITE,\r
- SEND_RECV\r
-} DT_Transfer_Type;\r
-\r
-\r
-typedef struct\r
-{\r
- DAT_RMR_CONTEXT rmr_context;\r
- DAT_CONTEXT mem_address;\r
-} RemoteMemoryInfo;\r
-\r
-\r
-#endif /* __DAPL_COMMON_H__ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-\r
-void\r
-DT_Endian_Init (void)\r
-{\r
- int endian;\r
- endian = 1;\r
- DT_local_is_little_endian = * ((unsigned char *) (&endian)) == 1;\r
-}\r
-\r
-/*\r
- * Big/Little Endian conversion functions\r
- */\r
-\r
-#define c1a32 ((DAT_UINT32)0x00FF00FF)\r
-#define c1b32 ((DAT_UINT32)0xFF00FF00)\r
-#define c2a32 ((DAT_UINT32)0x0000FFFF)\r
-#define c2b32 ((DAT_UINT32)0xFFFF0000)\r
-#define c164 ((DAT_UINT64)0x00FF00FF)\r
-#define c1a64 (c164 | (c164 << 32))\r
-#define c1b64 (c1a64 << 8)\r
-#define c264 ((DAT_UINT64)0x0000FFFF)\r
-#define c2a64 (c264 | (c264 << 32))\r
-#define c2b64 (c2a64 << 16)\r
-#define c3a64 ((DAT_UINT64)0xFFFFFFFF)\r
-#define c3b64 (c3a64 << 32)\r
-\r
-DAT_UINT32\r
-DT_Endian32 (DAT_UINT32 val)\r
-{\r
- if (DT_local_is_little_endian)\r
- {\r
- return val;\r
- }\r
- val = ((val & c1a32) << 8) | ((val & c1b32) >> 8);\r
- val = ((val & c2a32) << 16) | ((val & c2b32) >> 16);\r
- return (val);\r
-}\r
-\r
-DAT_UINT64\r
-DT_Endian64 (DAT_UINT64 val)\r
-{\r
- if (DT_local_is_little_endian)\r
- {\r
- return val;\r
- }\r
- val = ((val & c1a64) << 8) | ((val & c1b64) >> 8);\r
- val = ((val & c2a64) << 16) | ((val & c2b64) >> 16);\r
- val = ((val & c3a64) << 32) | ((val & c3b64) >> 32);\r
- return (val);\r
-}\r
-\r
-DAT_UINT32\r
-DT_EndianMemHandle (DAT_UINT32 val)\r
-{\r
- val = ((val & c1a32) << 8) | ((val & c1b32) >> 8);\r
- val = ((val & c2a32) << 16) | ((val & c2b32) >> 16);\r
- return (val);\r
-}\r
-\r
-DAT_UINT64\r
-DT_EndianMemAddress (DAT_UINT64 val)\r
-{\r
- DAT_UINT64 val64;\r
- val64 = val;\r
- val64 = ((val64 & c1a64) << 8) | ((val64 & c1b64) >> 8);\r
- val64 = ((val64 & c2a64) << 16) | ((val64 & c2b64) >> 16);\r
- val64 = ((val64 & c3a64) << 32) | ((val64 & c3b64) >> 32);\r
- return val64;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_cmd.h"\r
-\r
-//---------------------------------------------------------------------------\r
-void DT_FFT_Cmd_Init (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- memset ((void *)cmd, 0, sizeof (FFT_Cmd_t));\r
- cmd->fft_type = NONE;\r
- cmd->device_name[0] = '\0';\r
- cmd->server_name[0] = '\0';\r
- for (i=0; i<MAXCASES; i++)\r
- {\r
- cmd->cases_flag[i] = false;\r
- }\r
- cmd->size = 0;\r
- cmd->num_iter = 1000;\r
- cmd->num_threads = 10;\r
- cmd->num_vis = 500;\r
- cmd->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
-}\r
-\r
-//------------------------------------------------------------------------------\r
-bool DT_FFT_Cmd_Parse (FFT_Cmd_t *cmd,\r
- int my_argc,\r
- char ** my_argv,\r
- mygetopt_t *opts)\r
-{\r
- char c;\r
- int i, caseNum;\r
- unsigned int len;\r
-\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "D:f:s:i:t:v:R:", opts);\r
- if (c == EOF)\r
- {\r
- break;\r
- }\r
- switch (c)\r
- {\r
- case 'D': //device name\r
- {\r
- strcpy (cmd->device_name, opts->optarg);\r
- break;\r
- }\r
- case 's': //server name\r
- {\r
- strcpy (cmd->server_name, opts->optarg);\r
- break;\r
- }\r
- case 'i': // num iterations\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -i<iterations> option\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_iter = atoi (opts->optarg);\r
- break;\r
- }\r
- case 't': // num threads\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -t<num_threads> option\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_threads = atoi (opts->optarg);\r
- break;\r
- }\r
- case 'v': // num vis\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -v<num_vis> option\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_vis = atoi (opts->optarg);\r
- break;\r
- }\r
- case 'f': //function feature\r
- {\r
- if (strcmp (opts->optarg, "hwconn")==0)\r
- {\r
- cmd->fft_type = HWCONN;\r
- cmd->size = 4; //4 cases for hwconn\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "cqmgt")==0)\r
- {\r
- cmd->fft_type = CQMGT;\r
- cmd->size = 10; //10 cases for cqmgt\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "endpoint")==0)\r
- {\r
- cmd->fft_type = ENDPOINT;\r
- cmd->size = 3; //13 cases for endpoint\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "pz")==0)\r
- {\r
- cmd->fft_type = PTAGMGT;\r
- cmd->size = 3; //10 cases for Ptagmgt\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "mem")==0)\r
- {\r
- cmd->fft_type = MEMMGT;\r
- cmd->size = 5; //12 cases for Memmgt\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "connmgt")==0)\r
- {\r
- cmd->fft_type = CONNMGT;\r
- cmd->size = 2; //16 cases for connmgt\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "connmgt_client")==0)\r
- {\r
- cmd->fft_type = CONNMGT_CLIENT;\r
- cmd->size = 16; //16 cases for connmgt_client\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "dataxfer")==0)\r
- {\r
- cmd->fft_type = DATAXFER;\r
- cmd->size = 4; //21 cases for dataxfer\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "dataxfer_client")==0)\r
- {\r
- cmd->fft_type = DATAXFER_CLIENT;\r
- cmd->size = 1; //21 cases for dataxfer_client\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "queryinfo")==0)\r
- {\r
- cmd->fft_type = QUERYINFO;\r
- cmd->size = 18; //18 cases for queryinfo\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "ns")==0)\r
- {\r
- cmd->fft_type = NS;\r
- cmd->size = 10; //10 cases for ns\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "errhand")==0)\r
- {\r
- cmd->fft_type = ERRHAND;\r
- cmd->size = 2; //2 cases for errhand\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "unsupp")==0)\r
- {\r
- cmd->fft_type = UNSUPP;\r
- cmd->size = 2; //2 cases for unsupp\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "stress")==0)\r
- {\r
- cmd->fft_type = STRESS;\r
- cmd->size = 6; //6 cases for stress\r
- break;\r
- }\r
- else if (strcmp (opts->optarg, "stress_client")==0)\r
- {\r
- cmd->fft_type = STRESS_CLIENT;\r
- cmd->size = 6; //6 cases for stress_client\r
- break;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("don't know this function feature: %s\n",\r
- opts->optarg);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- case 'R': // Service Reliability Level\r
- {\r
- cmd->ReliabilityLevel = DT_ParseQoS (opts->optarg);\r
- if (0 == cmd->ReliabilityLevel)\r
- {\r
- DT_Mdep_printf ("Invalid FFT Test Parameter: %c\n", c);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- break;\r
- }\r
-\r
- case '?':\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid FFT Test Parameter: %c\n", c);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
- if (cmd->device_name[0] == '\0')\r
- {\r
- if (!DT_Mdep_GetDefaultDeviceName (cmd->device_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
-\r
- if (cmd->fft_type ==NONE)\r
- {\r
- DT_Mdep_printf ("must define the function feature with -f to test\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- if (cmd->server_name[0] =='\0' && \r
- (cmd->fft_type==CONNMGT_CLIENT || cmd->fft_type == DATAXFER_CLIENT ||\r
- cmd->fft_type == UNSUPP || cmd->fft_type == STRESS_CLIENT))\r
- {\r
- DT_Mdep_printf ("must define the server name with -s option\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- if (cmd->server_name[0] =='\0' && cmd->fft_type==NS )\r
- {\r
- DT_Mdep_printf ("\\r
- Must specify host name or host IP address with -s option to be tested\n");\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- //now parse the test cases\r
- if (opts->optind == my_argc) //default: test all cases\r
- {\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- cmd->cases_flag[i] = true;\r
- }\r
- return true;\r
- }\r
-\r
- //test specified cases\r
- i = opts->optind;\r
- while (i<my_argc)\r
- {\r
- if (strlen (my_argv[i])<5 || strncmp (my_argv[i], "case", 4) !=0)\r
- {\r
- DT_Mdep_printf ("test cases format is not correct: %s\n", my_argv[i]);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- len = (unsigned int)strspn (my_argv[i] + 4, "0123456789");\r
- if (len==0 || len != strlen (my_argv[i] + 4) )\r
- {\r
- DT_Mdep_printf ("must specify case number: %s\n", my_argv[i]);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- caseNum = atoi (my_argv[i] + 4);\r
- if (caseNum<0 || caseNum>=cmd->size)\r
- {\r
- DT_Mdep_printf ("test case number must be within range : 0 -- %d\n",\r
- cmd->size-1);\r
- DT_FFT_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->cases_flag[caseNum] = true;\r
- i++;\r
- }\r
- return (true);\r
-}\r
-\r
-//--------------------------------------------------------------\r
-void DT_FFT_Cmd_Usage (void)\r
-{\r
- char usage[] =\r
- {\r
- "dapltest -T F [-D <dev_name>] -f <funcfeature> [-i <iter_num>] \n"\r
- "[-t <num_threads>] [-v <num_vis>] [-s <server_name>] [case0] [case1] [...]\n"\r
- "USAGE: [-D <device Name>]\n"\r
- "USAGE: (Linux: JniIbdd0)\n"\r
- "USAGE: -f <func_feature>\n"\r
- "USAGE: hwconn\n"\r
- "USAGE: endpoint\n"\r
- "USAGE: pz\n"\r
- "USAGE: mem\n"\r
- "USAGE: dataxfer\n"\r
- "USAGE: dataxfer_client\n"\r
- "USAGE: connmgt\n"\r
- "USAGE: connmgt_client (not yet implemented)\n"\r
- "USAGE: cqmgt (not yet implemented)\n"\r
- "USAGE: queryinfo\n"\r
- "USAGE: ns (not yet implemented)\n"\r
- "USAGE: errhand (not yet implemented)\n"\r
- "USAGE: unsupp (not yet implemented)\n"\r
- "USAGE: stress (not yet implemented)\n"\r
- "USAGE: stress_client (not yet implemented)\n"\r
- "USAGE: -i <iter_num>: itreration time for stress test\n"\r
- "USAGE: -t <num_threads>: number of threads for stress test\n"\r
- "USAGE: -v <num_vis>: number of vis for stress test\n"\r
- "USAGE: -s <server_name>\n"\r
- "USAGE: server host name or ip address\n"\r
- "USAGE: [-R <service reliability>]\n"\r
- "USAGE: (BE == QOS_BEST_EFFORT - Default )\n"\r
- "USAGE: (HT == QOS_HIGH_THROUGHPUT))\n"\r
- "USAGE: (LL == QOS_LOW_LATENCY)\n"\r
- "USAGE: (EC == QOS_ECONOMY)\n"\r
- "USAGE: (PM == QOS_PREMIUM)\n"\r
- "NOTE: iter_num is just for stress_client test, default 100000\n"\r
- "NOTE: Server_name must be specified for connmgt_client, dataxfer_client, \n"\r
- " NS and unsupp function feature.\n"\r
- "NOTE: if test cases are not specified, test all cases in that function\n"\r
- " feature. else just test the specified cases\n"\r
- };\r
-\r
- DT_Mdep_printf ("USAGE: -------FFT TEST------------\n");\r
- DT_Mdep_printf ("%s\n", usage);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_FFT_CMD_H__\r
-#define __DAPL_FFT_CMD_H__\r
-\r
-#include "dapl_mdep.h"\r
-\r
-#define MAXCASES 100\r
-\r
-typedef enum\r
-{\r
- NONE,\r
- HWCONN,\r
- CQMGT,\r
- ENDPOINT,\r
- PTAGMGT,\r
- MEMMGT,\r
- CONNMGT,\r
- CONNMGT_CLIENT,\r
- DATAXFER,\r
- DATAXFER_CLIENT,\r
- QUERYINFO,\r
- NS,\r
- ERRHAND,\r
- UNSUPP,\r
- STRESS,\r
- STRESS_CLIENT,\r
-} FFT_Type_e;\r
-\r
-\r
-typedef struct\r
-{\r
- FFT_Type_e fft_type;\r
- char device_name[256]; //-D\r
- char server_name[256];\r
- bool cases_flag[MAXCASES];\r
- int size;\r
- int num_iter; //-i\r
- int num_threads; //-t\r
- int num_vis; //-v\r
- DAT_QOS ReliabilityLevel; //-R\r
-} FFT_Cmd_t;\r
-\r
-typedef struct\r
-{\r
- int (*fun) ( FFT_Cmd_t*);\r
-} FFT_Testfunc_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-int DT_connmgt_case0 (FFT_Cmd_t *cmd)\r
-{\r
- FFT_Connection_t conn;\r
- int res = 1;\r
- DAT_RETURN rc = 0;\r
-\r
- DT_Mdep_printf ("\\r
- Description: Ensure time in dat_evd_wait works correctly\n");\r
-\r
- DT_fft_init_server (cmd, &conn);\r
- DT_assert (NULL != conn.ia_handle);\r
-\r
- rc = dat_evd_wait (conn.cr_evd, 10*1000000, 1, &conn.event, \r
- &conn.count);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_TIMEOUT_EXPIRED);\r
-\r
-cleanup:\r
- rc = DT_fft_destroy_conn_struct (&conn);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
-\r
- return res;\r
-}\r
-\r
-int DT_connmgt_case1 (FFT_Cmd_t *cmd)\r
-{\r
- FFT_Connection_t conn;\r
- int res = 1;\r
- DAT_RETURN rc;\r
-\r
- DT_Mdep_printf ("\\r
- Description: Attempt to use timeout of 0 in dat_evd_wait\n");\r
-\r
- DT_fft_init_server (cmd, &conn);\r
- DT_assert (NULL != conn.ia_handle);\r
-\r
- rc = dat_evd_wait (conn.cr_evd, 0, 1, &conn.event, &conn.count);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_TIMEOUT_EXPIRED);\r
-\r
-cleanup:\r
- rc = DT_fft_destroy_conn_struct (&conn);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- return res;\r
-\r
-}\r
-\r
-\r
-void DT_connmgt_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_connmgt_case0 },\r
- { DT_connmgt_case1 },\r
- };\r
-\r
- for (i = 0; i < cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Connect Management (Server side) case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_dataxfer_generic ( FFT_Cmd_t *cmd, int test_case)\r
-{\r
- FFT_Connection_t conn;\r
- DAT_RETURN rc=0;\r
- int res=1;\r
- DT_fft_init_server (cmd, &conn);\r
- DT_assert (NULL != conn.ia_handle);\r
-\r
- DT_fft_listen (&conn);\r
-\r
- switch (test_case)\r
- {\r
- case 0:\r
- {\r
- DT_Mdep_printf ("Posting null send buffer\n");\r
- rc = DT_post_send_buffer (0, conn.bpool, 0, \r
- DT_Bpool_GetBuffSize (conn.bpool, 0));\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_INVALID_HANDLE);\r
- break;\r
- }\r
- case 1:\r
- {\r
- DT_Mdep_printf ("Call evd wait with null evd\n");\r
- rc =dat_evd_wait (0, DAT_TIMEOUT_INFINITE, 1, &conn.event, \r
- &conn.count);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_INVALID_HANDLE);\r
- break;\r
- }\r
- case 2:\r
- {\r
- DT_Mdep_printf ("Call evd wait with empty send queue\n");\r
- rc =dat_evd_wait (conn.send_evd, 10*1000000, 1, &conn.event, \r
- &conn.count);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_TIMEOUT_EXPIRED);\r
- break;\r
- }\r
- case 3:\r
- {\r
- DT_Mdep_printf ("Posting null recv buffer\n");\r
- rc =DT_post_recv_buffer (0, conn.bpool, 0, \r
- DT_Bpool_GetBuffSize (conn.bpool, 0));\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_INVALID_HANDLE);\r
- break;\r
- }\r
- }\r
-cleanup:\r
- DT_assert_clean (DT_fft_destroy_conn_struct (&conn));\r
- return res;\r
-}\r
-\r
-int DT_dataxfer_case0 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Call dat_ep_post_send with null ep_handle.\n");\r
- return DT_dataxfer_generic (cmd, 0);\r
-}\r
-\r
-int DT_dataxfer_case1 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Call dat_evd_wait with null evd.\n");\r
- return DT_dataxfer_generic (cmd, 1);\r
-}\r
-\r
-int DT_dataxfer_case2 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Call dat_evd_wait with null evd.\n");\r
- return DT_dataxfer_generic (cmd, 2);\r
-}\r
-\r
-int DT_dataxfer_case3 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Call dat_evd_wait with null evd.\n");\r
- return DT_dataxfer_generic (cmd, 3);\r
-}\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_dataxfer_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_dataxfer_case0 },\r
- { DT_dataxfer_case1 },\r
- { DT_dataxfer_case2 },\r
- { DT_dataxfer_case3 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Protection Zone management case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-#define CONN_STATE 1\r
-#define TIMEOUT_TEST 2\r
-#define DATAXFER_TEST 3\r
-\r
-int DT_dataxfer_client_generic (FFT_Cmd_t *cmd, int flag)\r
-{\r
- int res=1;\r
- FFT_Connection_t conn;\r
- DAT_RETURN rc=0;\r
-\r
- DT_fft_init_client (cmd, &conn);\r
- DT_assert_dat(conn.ia_handle != NULL)\r
-\r
- DT_assert (DT_fft_connect (&conn));\r
-\r
- if (flag == CONN_STATE)\r
- {\r
- res = 1;\r
- goto cleanup;\r
- }\r
- else if (flag == TIMEOUT_TEST)\r
- {\r
-\r
-\r
- }\r
- else if (flag == DATAXFER_TEST)\r
- {\r
- conn.bpool = DT_BpoolAlloc (0, conn.ia_handle, conn.pz_handle, NULL, \r
- NULL, 4096, 2, DAT_OPTIMAL_ALIGNMENT, false, false);\r
- DT_assert (conn.bpool != 0);\r
- rc = DT_post_send_buffer (conn.ep_handle, conn.bpool, 0, \r
- DT_Bpool_GetBuffSize (conn.bpool, 0));\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = dat_evd_wait (conn.send_evd, 10*1000000, 1, &conn.event, \r
- &conn.count);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- res = 1;\r
- goto cleanup;\r
- }\r
- // cleanup\r
-cleanup:\r
-\r
- if (conn.ep_handle)\r
- {\r
- // disconnect\r
- DT_Mdep_printf ("Disconnect\n");\r
- rc = dat_ep_disconnect (conn.ep_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- rc = DT_fft_destroy_conn_struct (&conn);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
-\r
- return res;\r
-}\r
-\r
-int DT_dataxfer_client_case0 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: This is a helper case on the client side for dataxfer case0.\n");\r
- return DT_dataxfer_client_generic (cmd, CONN_STATE);\r
-}\r
-\r
-void DT_dataxfer_client_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_dataxfer_client_case0 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Dataxfer client case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
-\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-#define CQENTRYCOUNT 100\r
-#define BUFFSIZE 1024\r
-#define DEFAULT_QUEUE_LEN 10\r
-\r
-int DT_endpoint_generic (FFT_Cmd_t *cmd,\r
- bool destroy_pz_early)\r
-{\r
- char *dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_EVD_HANDLE conn_evd_handle;\r
- DAT_EVD_HANDLE send_evd_handle;\r
- DAT_EVD_HANDLE recv_evd_handle;\r
- DAT_RETURN rc, wanted;\r
- int res;\r
-\r
- res = 1;\r
- ia_handle = NULL;\r
- pz_handle = NULL;\r
- ep_handle = NULL;\r
- evd_handle = NULL;\r
- conn_evd_handle = NULL;\r
- send_evd_handle = NULL;\r
- recv_evd_handle = NULL;\r
- dev_name = cmd->device_name;\r
- evd_handle = DAT_HANDLE_NULL;\r
-\r
-#ifdef DYNAMIC_DAT_LOADING\r
- rc = dat_open ((const DAT_NAME_PTR)dev_name, \r
- DEFAULT_QUEUE_LEN, &evd_handle, &ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- rc = dat_ia_open ((const DAT_NAME_PTR)dev_name, \r
- DEFAULT_QUEUE_LEN, &evd_handle, &ia_handle);\r
-#endif //DYNAMIC_DAT_LOADING\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_pz_create (ia_handle, &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- if (destroy_pz_early)\r
- {\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
- }\r
-\r
- rc = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, NULL, \r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &send_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, NULL, DAT_EVD_DTO_FLAG,\r
- &recv_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, NULL,\r
- DAT_EVD_CONNECTION_FLAG, &conn_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_ep_create (ia_handle, pz_handle, recv_evd_handle, send_evd_handle, \r
- conn_evd_handle, NULL, &ep_handle);\r
- if (destroy_pz_early)\r
- {\r
- wanted = DAT_INVALID_HANDLE;\r
- }\r
- else\r
- {\r
- wanted = DAT_SUCCESS;\r
- }\r
- DT_assert_dat (DAT_GET_TYPE(rc) == wanted);\r
-\r
-cleanup:\r
- if (ep_handle)\r
- {\r
- rc = dat_ep_free (ep_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (send_evd_handle)\r
- {\r
- rc = dat_evd_free (send_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (recv_evd_handle)\r
- {\r
- rc = dat_evd_free (recv_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (conn_evd_handle)\r
- {\r
- rc = dat_evd_free (conn_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (!destroy_pz_early && pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (ia_handle)\r
- {\r
- rc = DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- return res;\r
-}\r
-\r
-int DT_endpoint_case0 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Test if we can normally create endpoint and destory it.\n");\r
- DT_Mdep_printf ("\\r
- The endpoint is not associated with a CQ\n");\r
- return DT_endpoint_generic (cmd, \r
- false); /* destroy pz early */\r
-}\r
-\r
-int DT_endpoint_case1 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: try to create endpoint with pz already destroyed\n");\r
- return DT_endpoint_generic (cmd,\r
- true); /* destroy pz early */\r
-}\r
-\r
-int DT_endpoint_case2 (FFT_Cmd_t *cmd)\r
-{\r
- char *dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EVD_HANDLE send_evd, conn_evd, recv_evd, cr_evd;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EVENT event;\r
- Bpool *bpool;\r
- int res;\r
- DAT_RETURN rc;\r
-\r
- DT_Mdep_printf ("\\r
- Description: try to destroy ep with descriptor still in working queue\n");\r
- res = 1;\r
- bpool = 0;\r
- pz_handle = 0;\r
- ia_handle = 0;\r
- ep_handle = 0;\r
- send_evd = 0;\r
- conn_evd = 0;\r
- recv_evd = 0;\r
- cr_evd = 0;\r
- dev_name = cmd->device_name;\r
-\r
- rc = DT_ia_open (dev_name, &ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = dat_pz_create (ia_handle, &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = DT_ep_create (ia_handle, pz_handle, &cr_evd, &conn_evd, &send_evd,\r
- &recv_evd, &ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- bpool = DT_BpoolAlloc (0, ia_handle, pz_handle, NULL, NULL, 4096, 1, \r
- DAT_OPTIMAL_ALIGNMENT, false, false);\r
- DT_assert (bpool != 0);\r
- DT_assert (DT_post_recv_buffer (ep_handle, bpool, 0, 4096) == true);\r
- if (ep_handle)\r
- {\r
- rc = dat_ep_free (ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
-\r
- /*\r
- * Remove all DTOs. The disconnect above may have\r
- * flushed all posted operations, so this is just a\r
- * clean up.\r
- */\r
- do\r
- {\r
- rc = dat_evd_dequeue ( recv_evd,\r
- &event);\r
- } while ( DAT_GET_TYPE(rc) != DAT_QUEUE_EMPTY );\r
-cleanup:\r
- if (bpool)\r
- {\r
- rc = DT_Bpool_Destroy (0, bpool);\r
- DT_assert_clean (rc != false);\r
- }\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (ia_handle)\r
- {\r
- rc = DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- return res;\r
-\r
-}\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_endpoint_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_endpoint_case0 },\r
- { DT_endpoint_case1 },\r
- { DT_endpoint_case2 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: EndPoint management case: %d\n", i\r
- );\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_hwconn_case0 ( FFT_Cmd_t *cmd)\r
-{\r
- char* dev_name;\r
- DAT_IA_HANDLE nic_handle;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_RETURN rc;\r
- int res = 1;\r
-\r
- DT_Mdep_printf ("\\r
- Description: Test if we can normally Open NIC and then close it\n");\r
-\r
- dev_name= cmd->device_name;\r
- nic_handle=0;\r
- evd_handle = DAT_HANDLE_NULL;\r
-#ifdef DYNAMIC_DAT_LOADING\r
- rc=dat_open ((const DAT_NAME_PTR)dev_name, 10, &evd_handle, &nic_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- rc=dat_ia_open ((const DAT_NAME_PTR)dev_name, 10, &evd_handle, &nic_handle);\r
-#endif // DYNAMIC_DAT_LOADING\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc=DT_ia_close (nic_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-cleanup:\r
-\r
- return res;\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_hwconn_case1 ( FFT_Cmd_t *cmd)\r
-{\r
- DAT_IA_HANDLE nic_handle;\r
- DAT_RETURN rc;\r
- DAT_EVD_HANDLE evd_handle;\r
- char dev_name[100];\r
- int i;\r
-\r
- DT_Mdep_printf ("Description: try to open NIC with incorrect device name\n");\r
- DT_Mdep_printf (" (just num, one letter, multiple letter, num_letter\n");\r
- DT_Mdep_printf ("letter_num). You alse can do this test manually\n");\r
- DT_Mdep_printf ("dapltest -T F -D <device_name> -f hwconn <case>\n");\r
-\r
- for (i=0; i< 5; i++)\r
- {\r
- if (i==0)\r
- {\r
- sprintf (dev_name, "%s", "40"); /* just number */\r
- }\r
- else if (i==1)\r
- {\r
- sprintf (dev_name, "%s", "x"); /* just letter */\r
- }\r
- else if (i==2)\r
- {\r
- sprintf (dev_name, "%s", "xsdf"); /* multiple letter */\r
- }\r
- else if (i==3)\r
- {\r
- sprintf (dev_name, "%s", "x34"); /* letter_number */\r
- }\r
- else if (i==4)\r
- {\r
- sprintf (dev_name, "%s", "34df"); /* number_letter */\r
- }\r
-\r
- evd_handle = DAT_HANDLE_NULL;\r
-#ifdef DYNAMIC_DAT_LOADING\r
- rc=dat_open ((const DAT_NAME_PTR)dev_name, 10, &evd_handle, &nic_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- rc=dat_ia_open ((const DAT_NAME_PTR)dev_name, 10, &evd_handle, &nic_handle);\r
-#endif //DYNAMIC_DAT_LOADING\r
- if (DAT_GET_TYPE(rc) != DAT_PROVIDER_NOT_FOUND)\r
- {\r
- //const char *major_msg, *minor_msg;\r
-\r
- DT_Mdep_printf (" \\r
- fff not get expected result when open NIC with device name: %s\n", dev_name);\r
- //dat_strerror (rc, &major_msg, &minor_msg);\r
- DT_Mdep_printf ("ERROR: %x \n",rc);\r
- \r
-\r
- if (rc==DAT_SUCCESS)\r
- {\r
- rc = DT_ia_close (nic_handle, DAT_CLOSE_ABRUPT_FLAG);\r
-\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- return 0;\r
- }\r
- }\r
- return 1;\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_hwconn_case2 ( FFT_Cmd_t *cmd)\r
-{\r
- DAT_IA_HANDLE nic_handle;\r
- DAT_RETURN rc;\r
- int res=1;\r
-\r
- DT_Mdep_printf ("\\r
- Description: Try to close nic with Nic handle is null (NIC not open)\n");\r
- nic_handle=0;\r
- rc=DT_ia_close (nic_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_dat (DAT_GET_TYPE(rc) ==DAT_INVALID_HANDLE);\r
-\r
-cleanup:\r
- return res;\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_hwconn_case3 ( FFT_Cmd_t *cmd)\r
-{\r
- FFT_Connection_t conn;\r
- DAT_RETURN rc;\r
- int res;\r
-\r
- DT_Mdep_printf ("Description: Test if we can close NIC when the created \n");\r
- DT_Mdep_printf ("endpoint has not been destroyed.\n");\r
- DT_Mdep_printf ("The problem for this case is that once the hca is closed, \n");\r
- DT_Mdep_printf ("there is no way to destroy the endpoint's resources\n");\r
- DT_Mdep_printf ("thus the test leaks a small amount of memory\n");\r
-\r
- res=1;\r
-\r
- DT_fft_init_client (cmd, &conn);\r
-\r
- /* try to close nic when vi have not destroyed */\r
- if (conn.ia_handle)\r
- {\r
- rc= DT_ia_close (conn.ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- if (rc !=DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Warning: DT_ia_close fails %s, reboot for cleanup\n", \r
- DT_RetToString (rc));\r
- return 0;\r
- }\r
- }\r
- /* if nic is closed, it is impossible to destory vi and ptag */\r
- //DT_fft_destroy_conn_struct(&conn);\r
- return res;\r
-\r
-}\r
-\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_hwconn_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_hwconn_case0 },\r
- { DT_hwconn_case1 },\r
- { DT_hwconn_case2 },\r
- { DT_hwconn_case3 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Hardware connection case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-#include <dat/udat.h>\r
-\r
-#define CQENTRYCOUNT 100\r
-#define BUFFSIZE 1024\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_mem_generic (FFT_Cmd_t *cmd, int flag)\r
-{\r
- DAT_RETURN rc, expect;\r
- FFT_Connection_t conn;\r
- DAT_REGION_DESCRIPTION region;\r
- DAT_VLEN reg_size;\r
- DAT_LMR_HANDLE lmr_handle;\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_VADDR reg_addr;\r
- unsigned char *alloc_ptr;\r
- int res;\r
- DAT_COUNT buffer_size;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
-\r
- rc = 0;\r
- expect = 0;\r
- res = 1;\r
- lmr_handle = 0;\r
- lmr_context = 0;\r
- reg_addr = 0;\r
- alloc_ptr = 0;\r
- ia_handle = 0;\r
- pz_handle = 0;\r
-\r
- DT_fft_init_client (cmd, &conn);\r
- DT_assert (NULL != conn.ia_handle);\r
-\r
- if (flag == 2)\r
- {\r
- buffer_size = 0;\r
- alloc_ptr = 0;\r
- }\r
- else\r
- {\r
- buffer_size = BUFFSIZE * sizeof (unsigned char);\r
- alloc_ptr = (unsigned char *)DT_Mdep_Malloc (buffer_size);\r
- DT_assert (alloc_ptr);\r
- }\r
-\r
-\r
- memset (®ion, 0, sizeof (region));\r
- region.for_va = alloc_ptr;\r
-\r
- ia_handle = conn.ia_handle;\r
-\r
- if (flag != 3)\r
- {\r
- pz_handle = conn.pz_handle;\r
- }\r
-\r
- if (flag != 4)\r
- {\r
- DT_Mdep_printf ("Registering memory\n");\r
- rc = dat_lmr_create (ia_handle,\r
- DAT_MEM_TYPE_VIRTUAL,\r
- region,\r
- buffer_size,\r
- conn.pz_handle,\r
- DAT_MEM_PRIV_ALL_FLAG,\r
- &lmr_handle,\r
- &lmr_context,\r
- NULL, /* FIXME */\r
- ®_size,\r
- ®_addr);\r
- if (flag == 2)\r
- {\r
- expect = DAT_LENGTH_ERROR;\r
- }\r
- else\r
- {\r
- expect = DAT_SUCCESS;\r
- }\r
- DT_assert_dat (DAT_GET_TYPE(rc) == expect);\r
- }\r
- if (flag == 1)\r
- {\r
- if (lmr_handle)\r
- {\r
- rc = dat_lmr_free (lmr_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
- lmr_handle = 0;\r
-\r
- rc = dat_lmr_create (conn.ia_handle,\r
- DAT_MEM_TYPE_VIRTUAL,\r
- region,\r
- buffer_size,\r
- conn.pz_handle,\r
- DAT_MEM_PRIV_ALL_FLAG,\r
- &lmr_handle,\r
- &lmr_context,\r
- NULL, /* FIXME */\r
- ®_size,\r
- ®_addr);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
-\r
-cleanup:\r
- if (lmr_handle)\r
- {\r
- rc = dat_lmr_free (lmr_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (alloc_ptr)\r
- {\r
- DT_Mdep_Free (alloc_ptr);\r
- }\r
- rc = DT_fft_destroy_conn_struct (&conn);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
-\r
- return res;\r
-\r
-}\r
-int DT_mem_case0 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Test if we can register typical size of memory\n");\r
- DT_Mdep_printf ("\\r
- then deregister it.\n");\r
- return DT_mem_generic (cmd, 0);\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_mem_case1 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Test if we can register typical size of memory\n");\r
- DT_Mdep_printf ("\\r
- deregister, then register it again.\n");\r
- return DT_mem_generic (cmd, 1);\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_mem_case2 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Try to register memory with memory size 0\n");\r
- return DT_mem_generic (cmd, 2);\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_mem_case3 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Try to register memory with null pz\n");\r
- return DT_mem_generic (cmd, 3);\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_mem_case4 ( FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("\\r
- Description: Try to deregister memory with null lmr_handle\n");\r
- return DT_mem_generic (cmd, 4);\r
-}\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_mem_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_mem_case0 },\r
- { DT_mem_case1 },\r
- { DT_mem_case2 },\r
- { DT_mem_case3 },\r
- { DT_mem_case4 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Memory register/deregister case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_cmd.h"\r
-#include "dapl_fft_util.h"\r
-\r
-#define CQENTRYCOUNT 100\r
-#define BUFFSIZE 1024\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_pz_case0 ( FFT_Cmd_t *cmd)\r
-{\r
- char* dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_RETURN rc;\r
- int res;\r
-\r
- DT_Mdep_printf ("\\r
- Description: Test if we can normally create pz and destroy it.\n");\r
-\r
- res=1;\r
- ia_handle=0;\r
- pz_handle =0;\r
- evd_handle = DAT_HANDLE_NULL;\r
- dev_name= cmd->device_name;\r
-\r
- rc = DT_ia_open (dev_name, &ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = dat_pz_create (ia_handle, &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
-cleanup:\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
- if (ia_handle)\r
- {\r
- rc = DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
- return res;\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_pz_case1 ( FFT_Cmd_t *cmd)\r
-{\r
- char* dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EVD_HANDLE conn_evd, send_evd, recv_evd, cr_evd;\r
- DAT_RETURN rc;\r
- int res;\r
-\r
- DT_Mdep_printf ("\\r
- Description: try to destroy pz with vi still associated with it\n");\r
-\r
- res=1;\r
- ia_handle=0;\r
- pz_handle =0;\r
- ep_handle=0;\r
- conn_evd = 0;\r
- send_evd = 0;\r
- recv_evd = 0;\r
- cr_evd = 0;\r
- dev_name= cmd->device_name;\r
-\r
- rc = DT_ia_open (dev_name, &ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_pz_create (ia_handle, &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = DT_ep_create (ia_handle, pz_handle, &cr_evd, &conn_evd, &send_evd,\r
- &recv_evd, &ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_INVALID_STATE);\r
- }\r
-\r
-cleanup:\r
- /* corrrect order */\r
- if (ep_handle)\r
- {\r
- rc=dat_ep_free (ep_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn_evd)\r
- {\r
- rc = dat_evd_free (conn_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (send_evd)\r
- {\r
- rc = dat_evd_free (send_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (recv_evd)\r
- {\r
- rc = dat_evd_free (recv_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (pz_handle)\r
- {\r
- rc=dat_pz_free (pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (ia_handle)\r
- {\r
- rc=DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- return res;\r
-}\r
-\r
-/*--------------------------------------------------------*/\r
-int DT_pz_case2 ( FFT_Cmd_t *cmd)\r
-{\r
- char* dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- Bpool *bpool;\r
- DAT_RETURN rc;\r
- int res;\r
-\r
- DT_Mdep_printf ("\\r
- Description: try to destroy pz with registered memory still\n");\r
- DT_Mdep_printf ("\\r
- associated with it\n");\r
-\r
- res=1;\r
- ia_handle=0;\r
- pz_handle =0;\r
- bpool=0;\r
- dev_name= cmd->device_name;\r
-\r
- rc = DT_ia_open (dev_name, &ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_pz_create (ia_handle, &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* allocate and register bpool */\r
- bpool = DT_BpoolAlloc (0, ia_handle, pz_handle, NULL,\r
- NULL, BUFFSIZE, 1, DAT_OPTIMAL_ALIGNMENT,\r
- false, false);\r
- DT_assert (bpool != 0);\r
-\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_dat (DAT_GET_TYPE(rc) == DAT_INVALID_STATE);\r
- }\r
-\r
-cleanup:\r
-\r
- /* deregister and free bpool */\r
- if (DT_Bpool_Destroy (0, bpool)==false)\r
- {\r
- DT_Mdep_printf ("Warning: Destroy bpool fails, reboot for cleanup\n");\r
- return 0;\r
- }\r
- if (pz_handle)\r
- {\r
- rc=dat_pz_free (pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (ia_handle)\r
- {\r
- rc=DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- return res;\r
-}\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_pz_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_pz_case0 },\r
- { DT_pz_case1 },\r
- { DT_pz_case2 },\r
- };\r
-\r
- for (i=0; i<cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- DT_Mdep_printf ("\\r
- Function feature: Protection Zone management case: %d\n", i);\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res ==-1)\r
- {\r
- DT_Mdep_printf ("Result: use other test tool\n");\r
- }\r
- else if (res ==-2)\r
- {\r
- DT_Mdep_printf ("Result: not support or next stage to develop\n");\r
- }\r
-\r
- DT_Mdep_printf ("\\r
- *********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-#define CQENTRYCOUNT 100\r
-#define BUFFSIZE 1024\r
-#define DEFAULT_QUEUE_LEN 10\r
-\r
-#if defined(WIN32)\r
-static DAT_OS_WAIT_PROXY_AGENT NULLPROXY = {\r
- (DAT_PVOID) NULL,(DAT_AGENT_FUNC) NULL};\r
-#endif\r
-\r
-int DT_queryinfo_basic (FFT_Cmd_t *cmd, \r
- FFT_query_enum object_to_query, \r
- DAT_RETURN result_wanted)\r
-{\r
- char *dev_name;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_IA_ATTR ia_attributes;\r
- DAT_PROVIDER_ATTR provider_attributes;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_EVD_HANDLE conn_evd_handle;\r
- DAT_EVD_HANDLE cr_evd_handle;\r
- DAT_EVD_HANDLE send_evd_handle;\r
- DAT_EVD_HANDLE recv_evd_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EP_PARAM ep_param;\r
- DAT_CNO_HANDLE cno_handle;\r
- DAT_CNO_PARAM cno_param;\r
- DAT_EVD_PARAM evd_param;\r
- DAT_PSP_HANDLE psp_handle;\r
- DAT_PSP_PARAM psp_param;\r
- DAT_RSP_HANDLE rsp_handle;\r
- DAT_RSP_PARAM rsp_param;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_PZ_PARAM pz_param;\r
- DAT_LMR_HANDLE lmr_handle;\r
- DAT_LMR_PARAM lmr_param;\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_RMR_HANDLE rmr_handle;\r
- DAT_RMR_PARAM rmr_param;\r
- DAT_REGION_DESCRIPTION region;\r
- DAT_VLEN reg_size;\r
- DAT_VADDR reg_addr;\r
- DAT_COUNT buffer_size;\r
- unsigned char *alloc_ptr;\r
-\r
- DAT_RETURN rc;\r
- int res = 1;\r
- buffer_size = BUFFSIZE * sizeof (unsigned char);\r
- reg_addr = 0;\r
- alloc_ptr = 0;\r
-\r
- ia_handle = NULL;\r
- pz_handle = NULL;\r
- ep_handle = NULL;\r
- lmr_handle = NULL;\r
- rmr_handle = NULL;\r
- pz_handle = NULL;\r
- psp_handle = NULL;\r
- rsp_handle = NULL;\r
- cno_handle = NULL;\r
-\r
- evd_handle = DAT_HANDLE_NULL;\r
- conn_evd_handle = DAT_HANDLE_NULL;\r
- cr_evd_handle = DAT_HANDLE_NULL;\r
- recv_evd_handle = DAT_HANDLE_NULL;\r
- send_evd_handle = DAT_HANDLE_NULL;\r
- dev_name = cmd->device_name;\r
-\r
- /* All functions require an ia_handle to be created */\r
-#ifdef DYNAMIC_DAT_LOADING\r
- rc = dat_open ((const DAT_NAME_PTR)dev_name, \r
- DEFAULT_QUEUE_LEN,\r
- &evd_handle, \r
- &ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- rc = dat_ia_open ((const DAT_NAME_PTR)dev_name, \r
- DEFAULT_QUEUE_LEN,\r
- &evd_handle, \r
- &ia_handle);\r
-#endif // DYNAMIC_DAT_LOADING\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* These functions require a pz_handle to be created */\r
- if ( (object_to_query == QUERY_EVD) || \r
- (object_to_query == QUERY_RMR) ||\r
- (object_to_query == QUERY_LMR) ||\r
- (object_to_query == QUERY_EP) ||\r
- (object_to_query == QUERY_RSP) ||\r
- (object_to_query == QUERY_PZ) )\r
- { \r
- rc = dat_pz_create (ia_handle, \r
- &pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
-\r
- /* These functions require a ep_handle to be created */\r
- if ( (object_to_query == QUERY_EP) || \r
- (object_to_query == QUERY_RSP) )\r
- { \r
- rc = dat_evd_create (ia_handle,\r
- DEFAULT_QUEUE_LEN,\r
- cno_handle,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &send_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_evd_create (ia_handle,\r
- DEFAULT_QUEUE_LEN,\r
- cno_handle,\r
- DAT_EVD_DTO_FLAG,\r
- &recv_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_evd_create (ia_handle,\r
- DEFAULT_QUEUE_LEN,\r
- cno_handle,\r
- DAT_EVD_CONNECTION_FLAG,\r
- &conn_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- rc = dat_ep_create (ia_handle, \r
- pz_handle, \r
- recv_evd_handle, \r
- send_evd_handle, \r
- conn_evd_handle,\r
- NULL,\r
- &ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
-\r
- /* These functions require a CR EVD to be created. */\r
- if ( (object_to_query == QUERY_PSP) || \r
- (object_to_query == QUERY_RSP) )\r
- { \r
- rc = dat_evd_create (ia_handle,\r
- DEFAULT_QUEUE_LEN,\r
- cno_handle,\r
- DAT_EVD_CR_FLAG,\r
- &cr_evd_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- }\r
-\r
- /* Test dat_ia_query function */\r
- if (object_to_query == QUERY_IA) \r
- {\r
- if (result_wanted == DAT_SUCCESS)\r
- {\r
- rc = dat_ia_query (ia_handle,\r
- &evd_handle,\r
- DAT_IA_ALL,\r
- &ia_attributes,\r
- DAT_PROVIDER_FIELD_ALL,\r
- &provider_attributes);\r
- }\r
- else if (result_wanted == DAT_INVALID_PARAMETER)\r
- {\r
- /*\r
- * The only way to get an invalid parameter is to\r
- * NULL out ia_attr and for the DAT_IA_ATTR_MASK to\r
- * have values\r
- */\r
- rc = dat_ia_query (ia_handle,\r
- &evd_handle,\r
- DAT_IA_ALL,\r
- NULL,\r
- DAT_PROVIDER_FIELD_ALL,\r
- &provider_attributes);\r
- }\r
- else if (result_wanted == DAT_INVALID_HANDLE)\r
- {\r
- rc = dat_ia_query (evd_handle,\r
- &evd_handle,\r
- DAT_IA_ALL,\r
- &ia_attributes,\r
- DAT_PROVIDER_FIELD_ALL,\r
- &provider_attributes);\r
- }\r
- }\r
-\r
- /* Test dat_cno_query function */\r
- else if (object_to_query == QUERY_CNO)\r
- { \r
-#if defined(WIN32)\r
- rc = dat_cno_create (ia_handle,\r
- NULLPROXY,\r
- &cno_handle);\r
-#else\r
- rc = dat_cno_create (ia_handle, \r
- DAT_OS_WAIT_PROXY_AGENT_NULL, \r
- &cno_handle);\r
-#endif\r
-\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- if (result_wanted == DAT_SUCCESS)\r
- {\r
- rc = dat_cno_query (cno_handle,\r
- DAT_CNO_FIELD_ALL,\r
- &cno_param);\r
- }\r
- else if (result_wanted == DAT_INVALID_PARAMETER)\r
- {\r
- rc = dat_cno_query (cno_handle,\r
- DAT_CNO_FIELD_ALL,\r
- NULL);\r
- }\r
- else if (result_wanted == DAT_INVALID_HANDLE)\r
- {\r
- rc = dat_cno_query (ia_handle,\r
- DAT_CNO_FIELD_ALL,\r
- &cno_param);\r
- }\r
- }\r
- /* Test dat_evd_query function */\r
- else if (object_to_query == QUERY_EVD)\r
- { \r
- if (result_wanted == DAT_SUCCESS)\r
- {\r
- rc = dat_evd_query (evd_handle,\r
- DAT_EVD_FIELD_ALL,\r
- &evd_param);\r
- }\r
- else if (result_wanted == DAT_INVALID_PARAMETER)\r
- {\r
- rc = dat_evd_query (evd_handle,\r
- DAT_EVD_FIELD_ALL,\r
- NULL);\r
- }\r
- else if (result_wanted == DAT_INVALID_HANDLE)\r
- {\r
- rc = dat_evd_query (ia_handle,\r
- DAT_EVD_FIELD_ALL,\r
- &evd_param);\r
- }\r
- }\r
-\r
- /* Test dat_psp_query function */\r
- else if (object_to_query == QUERY_PSP)\r
- { \r
- rc = dat_psp_create (ia_handle, \r
- SERVER_PORT_NUMBER,\r
- cr_evd_handle,\r
- DAT_PSP_PROVIDER_FLAG,\r
- &psp_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- if (result_wanted == DAT_SUCCESS)\r
- {\r
- rc = dat_psp_query (psp_handle,\r
- DAT_PSP_FIELD_ALL,\r
- &psp_param);\r
- }\r
- else if (result_wanted == DAT_INVALID_PARAMETER)\r
- {\r
- rc = dat_psp_query (psp_handle,\r
- DAT_PSP_FIELD_ALL,\r
- NULL);\r
- }\r
- else if (result_wanted == DAT_INVALID_HANDLE)\r
- {\r
- rc = dat_psp_query (evd_handle,\r
- DAT_PSP_FIELD_ALL,\r
- &psp_param);\r
- }\r
- }\r
-\r
- /* Test dat_rsp_query function */\r
- else if (object_to_query == QUERY_RSP)\r
- { \r
- rc = dat_rsp_create (ia_handle,\r
- SERVER_PORT_NUMBER,\r
- ep_handle,\r
- cr_evd_handle,\r
- &rsp_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = dat_rsp_query (rsp_handle,\r
- DAT_RSP_FIELD_ALL,\r
- &rsp_param);\r
- }\r
-\r
- /* Test dat_cr_query function */\r
- else if (object_to_query == QUERY_CR)\r
- { \r
- /* This query is tested in the conmgt test */\r
- res = -1;\r
- }\r
-\r
- /* Test dat_ep_query function */\r
- else if (object_to_query == QUERY_EP)\r
- { \r
- rc = dat_ep_query (ep_handle,\r
- DAT_EP_FIELD_ALL, \r
- &ep_param);\r
- }\r
-\r
- /* Test dat_pz_query function */\r
- else if (object_to_query == QUERY_PZ)\r
- { \r
- rc = dat_pz_query (pz_handle,\r
- DAT_PZ_FIELD_ALL,\r
- &pz_param);\r
- }\r
-\r
- /* Test dat_lmr_query function */\r
- else if (object_to_query == QUERY_LMR)\r
- { \r
- alloc_ptr = (unsigned char *)DT_Mdep_Malloc (buffer_size);\r
- DT_assert (alloc_ptr);\r
- memset (®ion, 0, sizeof (region));\r
- region.for_va = alloc_ptr;\r
- rc = dat_lmr_create (ia_handle,\r
- DAT_MEM_TYPE_VIRTUAL,\r
- region,\r
- buffer_size,\r
- pz_handle,\r
- DAT_MEM_PRIV_ALL_FLAG,\r
- &lmr_handle,\r
- &lmr_context,\r
- NULL, /* FIXME */\r
- ®_size,\r
- ®_addr);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- rc = dat_lmr_query (lmr_handle, \r
- DAT_LMR_FIELD_ALL,\r
- &lmr_param);\r
- }\r
-\r
- /* Test dat_rmr_query function */\r
- else if (object_to_query == QUERY_RMR)\r
- { \r
- rc = dat_rmr_create (pz_handle,\r
- &rmr_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
- /* We don't bind the RMR to anything, so don't ask for the\r
- * LMR_TRIPLET flag\r
- */\r
- rc = dat_rmr_query (rmr_handle,\r
- DAT_RMR_FIELD_ALL - DAT_RMR_FIELD_LMR_TRIPLET,\r
- &rmr_param);\r
- }\r
-\r
- DT_assert_dat (DAT_GET_TYPE(rc) == result_wanted);\r
-\r
-cleanup:\r
- if (rsp_handle)\r
- {\r
- rc = dat_rsp_free (rsp_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (ep_handle)\r
- {\r
- rc = dat_ep_free (ep_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (send_evd_handle)\r
- {\r
- rc = dat_evd_free (send_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (recv_evd_handle)\r
- {\r
- rc = dat_evd_free (recv_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (conn_evd_handle)\r
- {\r
- rc = dat_evd_free (conn_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (lmr_handle)\r
- {\r
- rc = dat_lmr_free (lmr_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (rmr_handle)\r
- {\r
- rc = dat_rmr_free (rmr_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (cno_handle)\r
- {\r
- rc = dat_cno_free (cno_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (psp_handle)\r
- {\r
- rc = dat_psp_free (psp_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (cr_evd_handle)\r
- {\r
- rc = dat_evd_free (cr_evd_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (pz_handle)\r
- {\r
- rc = dat_pz_free (pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- if (ia_handle)\r
- {\r
- rc = DT_ia_close (ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
-\r
- return res;\r
-}\r
-\r
-int DT_queryinfo_case0 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify IA Querying information is successful using\nDAT_IA_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_IA, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case1 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify CNO Querying information is successful using\nDAT_CNO_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_CNO, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case2 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify EVD Querying information is successful using\nDAT_EVD_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_EVD, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case3 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify PSP Querying information is successful using\nDAT_PSP_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_PSP, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case4 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify RSP Querying information is successful using\nDAT_RSP_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_RSP, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case5 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify CR Querying information is successful using\nDAT_CR_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_CR, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case6 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify EP Querying information is successful using\nDAT_EP_QUERY.\n");\r
- return DT_queryinfo_basic (cmd, QUERY_EP, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case7 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify PZ Querying information is successful using\n");\r
- DT_Mdep_printf ("DAT_PZ_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_PZ, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case8 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify LMR Querying information is successful using\n");\r
- DT_Mdep_printf ("DAT_LMR_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_LMR, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case9 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify RMR Querying information is successful using\n");\r
- DT_Mdep_printf ("DAT_RMR_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_RMR, DAT_SUCCESS);\r
-}\r
-\r
-int DT_queryinfo_case10 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify IA Querying fails with DAT_INVALID_PARAMETER when\n");\r
- DT_Mdep_printf ("passing a bad parameter to DAT_IA_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_IA, DAT_INVALID_PARAMETER);\r
-}\r
-\r
-int DT_queryinfo_case11 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify IA Querying fails with DAT_INVALID_HANDLE when\n");\r
- DT_Mdep_printf ("passing an invalid handle to DAT_IA_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_IA, DAT_INVALID_HANDLE);\r
-}\r
-\r
-int DT_queryinfo_case12 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify CNO Querying fails with DAT_INVALID_PARAMETER when\n");\r
- DT_Mdep_printf ("passing a bad parameter to DAT_CNO_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_CNO, DAT_INVALID_PARAMETER);\r
-}\r
-\r
-int DT_queryinfo_case13 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify CNO Querying fails with DAT_INVALID_HANDLE when\n");\r
- DT_Mdep_printf ("passing an invalid handle to DAT_CNO_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_CNO, DAT_INVALID_HANDLE);\r
-}\r
-\r
-int DT_queryinfo_case14 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify EVD Querying fails with DAT_INVALID_PARAMETER when\n");\r
- DT_Mdep_printf ("passing a bad parameter to DAT_EVD_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_EVD, DAT_INVALID_PARAMETER);\r
-}\r
-\r
-int DT_queryinfo_case15 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify EVD Querying fails with DAT_INVALID_HANDLE when\n");\r
- DT_Mdep_printf ("passing an invalid handle to DAT_EVD_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_EVD, DAT_INVALID_HANDLE);\r
-}\r
-\r
-int DT_queryinfo_case16 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify PSP Querying fails with DAT_INVALID_PARAMETER when\n");\r
- DT_Mdep_printf ("passing a bad parameter to DAT_PSP_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_PSP, DAT_INVALID_PARAMETER);\r
-}\r
-\r
-int DT_queryinfo_case17 (FFT_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("Description: Verify PSP Querying fails with DAT_INVALID_HANDLE when\n");\r
- DT_Mdep_printf ("passing an invalid handle to DAT_PSP_QUERY\n");\r
- return DT_queryinfo_basic (cmd, QUERY_PSP, DAT_INVALID_HANDLE);\r
-}\r
-\r
-/*-------------------------------------------------------------*/\r
-void DT_queryinfo_test (FFT_Cmd_t *cmd)\r
-{\r
- int i;\r
- int res;\r
- FFT_Testfunc_t cases_func[] =\r
- {\r
- { DT_queryinfo_case0 },\r
- { DT_queryinfo_case1 },\r
- { DT_queryinfo_case2 },\r
- { DT_queryinfo_case3 },\r
- { DT_queryinfo_case4 },\r
- { DT_queryinfo_case5 },\r
- { DT_queryinfo_case6 },\r
- { DT_queryinfo_case7 },\r
- { DT_queryinfo_case8 },\r
- { DT_queryinfo_case9 },\r
- { DT_queryinfo_case10 },\r
- { DT_queryinfo_case11 },\r
- { DT_queryinfo_case12 },\r
- { DT_queryinfo_case13 },\r
- { DT_queryinfo_case14 },\r
- { DT_queryinfo_case15 },\r
- { DT_queryinfo_case16 },\r
- { DT_queryinfo_case17 },\r
- };\r
-\r
- for (i=0; i < cmd->size; i++)\r
- {\r
- if (cmd->cases_flag[i])\r
- {\r
- DT_Mdep_printf ("*********************************************************************\n");\r
- DT_Mdep_printf ("Function feature: Queryinfo case: %d\n", i\r
- );\r
- res = cases_func[i].fun (cmd);\r
- if (res==1)\r
- {\r
- DT_Mdep_printf ("Result: PASS\n");\r
- }\r
- else if (res ==0)\r
- {\r
- DT_Mdep_printf ("Result: FAIL\n");\r
- }\r
- else if (res == -1)\r
- {\r
- DT_Mdep_printf ("Result: UNSUPP\n");\r
- }\r
-\r
- DT_Mdep_printf ("*********************************************************************\n");\r
- }\r
- }\r
- return;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_cmd.h"\r
-#include <dat/udat.h>\r
-\r
-void \r
-DT_cs_FFT (FFT_Cmd_t * cmd)\r
-{\r
- switch (cmd->fft_type)\r
- {\r
- case HWCONN:\r
- {\r
- DT_hwconn_test (cmd);\r
- break;\r
- }\r
- case ENDPOINT:\r
- {\r
- DT_endpoint_test (cmd);\r
- break;\r
- }\r
- case PTAGMGT:\r
- {\r
- DT_pz_test (cmd);\r
- break;\r
- }\r
- case MEMMGT:\r
- {\r
- DT_mem_test (cmd);\r
- break;\r
- }\r
- case CONNMGT:\r
- {\r
- DT_connmgt_test (cmd);\r
- break;\r
- }\r
- case DATAXFER:\r
- {\r
- DT_dataxfer_test (cmd);\r
- break;\r
- }\r
- case DATAXFER_CLIENT:\r
- {\r
- DT_dataxfer_client_test (cmd);\r
- break;\r
- }\r
- case QUERYINFO:\r
- {\r
- DT_queryinfo_test (cmd);\r
- break;\r
- }\r
- case CONNMGT_CLIENT:\r
- case NS:\r
- case ERRHAND:\r
- case UNSUPP:\r
- case STRESS:\r
- case STRESS_CLIENT:\r
- case CQMGT:\r
- {\r
- DT_Mdep_printf ("Not Yet Implemented\n");\r
- break;\r
- }\r
- default:\r
- {\r
- DT_Mdep_printf ("don't know this test\n");\r
- break;\r
- }\r
- }\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_fft_util.h"\r
-\r
-#define DEFAULT_QUEUE_LEN 10\r
-\r
-\r
-/* function that is called when an assertion fails, printing out the line\r
- * that failed vi DT_Mdep_printf\r
- */\r
-void DT_assert_fail (char *exp, char *file, char *baseFile, int line)\r
-{\r
- if (!strcmp (file, baseFile))\r
- {\r
- DT_Mdep_printf ("%s failed in file %s, line %d\n", exp, file,\r
- line);\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("%s failed in file %s (included from %s), line %d\n",\r
- exp, file, baseFile, line);\r
- }\r
-}\r
-\r
-/* helper function to open an IA */\r
-int DT_ia_open (DAT_NAME_PTR dev_name, DAT_IA_HANDLE *ia_handle)\r
-{\r
- DAT_EVD_HANDLE evd_handle;\r
- evd_handle = DAT_HANDLE_NULL;\r
-#ifdef DYNAMIC_DAT_LOADING\r
- return dat_open (dev_name, DEFAULT_QUEUE_LEN, &evd_handle, ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- return dat_ia_open (dev_name, DEFAULT_QUEUE_LEN, &evd_handle, ia_handle);\r
-#endif //DYNAMIC_DAT_LOADING\r
-\r
-}\r
-\r
-DAT_RETURN\r
-DT_ia_close (DAT_IA_HANDLE ia_handle, DAT_CLOSE_FLAGS flags)\r
-{\r
-#ifdef DYNAMIC_DAT_LOADING\r
- return dat_close (ia_handle, flags);\r
-#else\r
- return dat_ia_close (ia_handle, flags);\r
-#endif\r
-}\r
-\r
-/* helper function to create an endpoint and its associated EVDs */\r
-int DT_ep_create (DAT_IA_HANDLE ia_handle, DAT_PZ_HANDLE pz_handle,\r
- DAT_EVD_HANDLE *cr_evd,\r
- DAT_EVD_HANDLE *conn_evd, DAT_EVD_HANDLE *send_evd,\r
- DAT_EVD_HANDLE *recv_evd, DAT_EP_HANDLE *ep_handle)\r
-{\r
- DAT_RETURN status;\r
- *conn_evd= 0;\r
- *send_evd= 0;\r
- *recv_evd= 0;\r
- *cr_evd= 0;\r
-\r
- status = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, DAT_HANDLE_NULL,\r
- DAT_EVD_CR_FLAG, cr_evd);\r
- if (status != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("dat_evd_create failed %s\n", DT_RetToString (status));\r
- return status;\r
- }\r
-\r
- status = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, DAT_HANDLE_NULL,\r
- DAT_EVD_CONNECTION_FLAG, conn_evd);\r
- if (status != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("dat_evd_create failed %s\n", DT_RetToString (status));\r
- return status;\r
- }\r
-\r
- status = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- send_evd);\r
- if (status != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("dat_evd_create failed %s\n", DT_RetToString (status));\r
- return status;\r
- }\r
-\r
- status = dat_evd_create (ia_handle, DEFAULT_QUEUE_LEN, DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG, recv_evd);\r
- if (status != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("dat_evd_create failed %s\n", DT_RetToString (status));\r
- return status;\r
- }\r
-\r
- status = dat_ep_create (ia_handle, pz_handle, *recv_evd, \r
- *send_evd, *conn_evd, NULL, ep_handle);\r
- if (status != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("dat_ep_create failed %s\n", DT_RetToString (status));\r
- }\r
- return status;\r
-}\r
-\r
-/* function that initializes the connection struct */\r
-void DT_fft_init_conn_struct (FFT_Connection_t *conn)\r
-{\r
- conn->ia_handle = 0;\r
- conn->pz_handle = 0;\r
- conn->psp_handle = 0;\r
- conn->ep_handle = 0;\r
- conn->cr_evd = 0;\r
- conn->send_evd = 0;\r
- conn->conn_evd = 0;\r
- conn->recv_evd = 0;\r
- conn->cr_handle = 0;\r
- conn->remote_netaddr = 0;\r
- conn->bpool = 0;\r
- conn->pt_ptr = 0;\r
- conn->connected = false;\r
-}\r
-\r
-/* helper function that simplifies many dat calls for the initiialization of a\r
- * dat "client"\r
- */\r
-void DT_fft_init_client (FFT_Cmd_t *cmd, FFT_Connection_t *conn)\r
-{\r
- int res;\r
- DAT_RETURN rc=0;\r
-\r
- /* initialize the struct's members */\r
- DT_fft_init_conn_struct (conn);\r
-\r
- /* open the IA */\r
- rc = DT_ia_open (cmd->device_name, &conn->ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* create a PZ */\r
- rc = dat_pz_create (conn->ia_handle, &conn->pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* create an EP and its EVDs */\r
- rc =DT_ep_create (conn->ia_handle, conn->pz_handle, &conn->cr_evd,\r
- &conn->conn_evd, &conn->send_evd, &conn->recv_evd,\r
- &conn->ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* if a server name is given, allocate memory for a net address and set it\r
- * up appropriately\r
- */\r
- if (cmd->server_name && strlen (cmd->server_name))\r
- {\r
- conn->pt_ptr = DT_Alloc_Per_Test_Data ();\r
- DT_assert (conn->pt_ptr);\r
- DT_MemListInit (conn->pt_ptr);\r
- conn->remote_netaddr = DT_NetAddrAlloc (conn->pt_ptr);\r
- DT_assert (conn->remote_netaddr);\r
- DT_assert (DT_NetAddrLookupHostAddress (conn->remote_netaddr, \r
- cmd->server_name));\r
- }\r
-cleanup:\r
- return;\r
-}\r
-\r
-/* helper function to break down a client or server created with one of the\r
- * init helper functions\r
- */\r
-int DT_fft_destroy_conn_struct (FFT_Connection_t *conn)\r
-{\r
- DAT_RETURN rc = DAT_SUCCESS;\r
- if (conn->ep_handle)\r
- {\r
- if (conn->connected)\r
- {\r
- rc = dat_ep_disconnect (conn->ep_handle, DAT_CLOSE_DEFAULT);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
-\r
- if (!DT_disco_event_wait ( conn->cr_evd, NULL ))\r
-\r
- {\r
- DT_Mdep_printf ("DT_fft_destroy_conn_struct: bad disconnect event\n");\r
- }\r
- }\r
- rc = dat_ep_free (conn->ep_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->bpool)\r
- {\r
- DT_Bpool_Destroy (0, conn->bpool);\r
- }\r
- if (conn->psp_handle)\r
- {\r
- rc = dat_psp_free (conn->psp_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->cr_evd)\r
- {\r
- rc = dat_evd_free (conn->cr_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->conn_evd)\r
- {\r
- rc = dat_evd_free (conn->conn_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->send_evd)\r
- {\r
- rc = dat_evd_free (conn->send_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->recv_evd)\r
- {\r
- rc = dat_evd_free (conn->recv_evd);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->remote_netaddr)\r
- {\r
- DT_NetAddrFree (conn->pt_ptr, conn->remote_netaddr);\r
- }\r
- if (conn->pt_ptr)\r
- {\r
- DT_Free_Per_Test_Data (conn->pt_ptr);\r
- }\r
- if (conn->pz_handle)\r
- {\r
- rc = dat_pz_free (conn->pz_handle);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- if (conn->ia_handle)\r
- {\r
- rc = DT_ia_close (conn->ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- DT_assert_clean (rc == DAT_SUCCESS);\r
- }\r
- return rc;\r
-}\r
-\r
-/* helper function to init a dat "server" */\r
-void DT_fft_init_server (FFT_Cmd_t *cmd, FFT_Connection_t *conn)\r
-{\r
- int res;\r
- DAT_RETURN rc=0;\r
-\r
- /* init the connection struct's members */\r
- DT_fft_init_conn_struct (conn);\r
-\r
- /* open the IA */\r
- rc = DT_ia_open (cmd->device_name, &conn->ia_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* create a PZ */\r
- rc = dat_pz_create (conn->ia_handle, &conn->pz_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* create an EP and its EVDs */\r
- rc =DT_ep_create (conn->ia_handle, conn->pz_handle, &conn->cr_evd,\r
- &conn->conn_evd, &conn->send_evd, &conn->recv_evd,\r
- &conn->ep_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* create a PSP */\r
- rc = dat_psp_create (conn->ia_handle, SERVER_PORT_NUMBER, conn->cr_evd,\r
- DAT_PSP_CONSUMER_FLAG, &conn->psp_handle);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* allocate memory for buffers */\r
- conn->bpool = DT_BpoolAlloc (0, conn->ia_handle, conn->pz_handle, NULL, NULL,\r
- 8192, 2, DAT_OPTIMAL_ALIGNMENT, false, false);\r
- DT_assert (conn->bpool);\r
-cleanup:\r
- return;\r
-}\r
-\r
-/* helper function that allows a server to listen for a connection */\r
-void DT_fft_listen (FFT_Connection_t *conn)\r
-{\r
- int res;\r
- DAT_RETURN rc=0;\r
-\r
- /* wait on a CR event via the CR EVD */\r
- DT_assert_dat (DT_cr_event_wait (conn->cr_evd, &conn->cr_stat) && \r
- DT_cr_check (&conn->cr_stat, conn->psp_handle, SERVER_PORT_NUMBER, \r
- &conn->cr_handle, "DT_fft_listen"));\r
-\r
- /* accept the connection */\r
- rc =dat_cr_accept (conn->cr_handle, conn->ep_handle, 0, (DAT_PVOID)0);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* wait on a conn event via the conn EVD */\r
- DT_assert (DT_conn_event_wait (conn->ep_handle, conn->conn_evd, \r
- &conn->event_num) == true);\r
- conn->connected = true;\r
-cleanup:\r
- return;\r
-}\r
-\r
-/* helper function that allows a client to connect to a server */\r
-int DT_fft_connect (FFT_Connection_t *conn)\r
-{\r
- int wait_count;\r
- int res;\r
- DAT_RETURN rc=0;\r
-\r
- /* try 10 times to connect */\r
- for (wait_count = 0; wait_count < 10; wait_count++)\r
- {\r
- DT_Mdep_printf ("Connection to server, attempt #%d\n", wait_count+1);\r
-\r
- /* attempt to connect, timeout = 10 secs */\r
- rc = dat_ep_connect (conn->ep_handle, conn->remote_netaddr,\r
- SERVER_PORT_NUMBER, 10*1000, 0, (DAT_PVOID)0,\r
- DAT_QOS_BEST_EFFORT, DAT_CONNECT_DEFAULT_FLAG);\r
- DT_assert_dat (rc == DAT_SUCCESS);\r
-\r
- /* wait on conn event */\r
- DT_assert (DT_conn_event_wait (conn->ep_handle, conn->conn_evd,\r
- &conn->event_num) == true);\r
-\r
- /* make sure we weren't rejected by the peer */\r
- if (conn->event_num == DAT_CONNECTION_EVENT_PEER_REJECTED)\r
- {\r
- DT_Mdep_Sleep (1000);\r
- DT_Mdep_printf ("Connection rejected by peer; retrying\n");\r
- }\r
- }\r
-cleanup:\r
- if (conn->event_num == DAT_CONNECTION_EVENT_ESTABLISHED)\r
- {\r
- conn->connected = true;\r
- }\r
- /* returns true if connected, false otherwise */\r
- return (conn->connected);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef DAPL_FFT_UTIL_H\r
-#define DAPL_FFT_UTIL_H\r
-\r
-#define DT_assert_dat(x) if(x) ; \\r
- else { \\r
- DT_assert_fail(#x, __FILE__, __BASE_FILE__, __LINE__); \\r
- DT_Mdep_printf("Error = %d, %s\n", rc, DT_RetToString(rc)); \\r
- res = 0; \\r
- goto cleanup; \\r
- }\r
-\r
-#define DT_assert(x) if(x) ; \\r
- else { \\r
- DT_assert_fail(#x, __FILE__, __BASE_FILE__, __LINE__); \\r
- res = 0; \\r
- goto cleanup; \\r
- }\r
-\r
-#define DT_assert_clean(x) if(x) ; \\r
- else { \\r
- DT_assert_fail(#x, __FILE__, __BASE_FILE__, __LINE__); \\r
- DT_Mdep_printf("Error = %d, %s\n", rc, DT_RetToString(rc)); \\r
- return 0; \\r
- }\r
-\r
-typedef struct\r
-{\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_PSP_HANDLE psp_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EVD_HANDLE cr_evd, conn_evd, send_evd, recv_evd;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
- DAT_CR_HANDLE cr_handle;\r
- Bpool *bpool;\r
- DAT_CR_ARRIVAL_EVENT_DATA cr_stat;\r
- DAT_EVENT_NUMBER event_num;\r
- DAT_IA_ADDRESS_PTR remote_netaddr;\r
- Per_Test_Data_t *pt_ptr;\r
- bool connected;\r
-} FFT_Connection_t;\r
-\r
-typedef enum\r
- {\r
- QUERY_CNO,\r
- QUERY_CR,\r
- QUERY_EP,\r
- QUERY_EVD,\r
- QUERY_IA,\r
- QUERY_LMR,\r
- QUERY_RMR,\r
- QUERY_PSP,\r
- QUERY_RSP,\r
- QUERY_PZ,\r
-} FFT_query_enum;\r
-\r
-#endif\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef _DAPL_I\r
-#define _DAPL_I\r
-\r
-#define IN\r
-#define OUT\r
-\r
-/* Interface Prefixes */\r
-#define DATIB_INTERFACE_PREFIX "ib"\r
-\r
-/* Types of DAPL functions, taken from uDAPL 1.0 */\r
-\r
-\r
-#define DAT_CALLTYPE\r
-\r
-/**********************************************************************\r
- * Types of user-supplied callbacks\r
- **********************************************************************/\r
-\r
-/**********************************************************************\r
- * Types of basic functions\r
- **********************************************************************/\r
-\r
-/**********************************************************************\r
- * Types of Peer-to-Peer Connection Model APIs\r
- *********************************************************************/\r
-\r
-/**********************************************************************\r
- * Types of Name service APIs\r
- *********************************************************************/\r
-\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_getopt.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-\r
-#define GETOPT_MAGIC 0x04030201\r
-\r
-#define BADCH '?'\r
-#define BADARG ':'\r
-#define EMSG ""\r
-\r
-/**\r
- * Initialize the getopt fields in preparation for parsing\r
- * a command line.\r
- */\r
-void\r
-DT_mygetopt_init (mygetopt_t * opts)\r
-{\r
- opts->magic = GETOPT_MAGIC;\r
- opts->place = EMSG;\r
- opts->opterr = 1;\r
- opts->optind = 1;\r
- opts->optopt = 0;\r
- opts->optarg = 0;\r
-}\r
-\r
-/**\r
- * Parse command line arguments.\r
- *\r
- * Return either the option discovered, or\r
- * (int) -1 when there are no more options\r
- * (int) '?' when an illegal option is found\r
- * (int) ':' when a required option argument is missing.\r
- */\r
-char\r
-DT_mygetopt_r (int argc, char *const * argv,\r
- const char *ostr, mygetopt_t * opts)\r
-{\r
- char *p;\r
- char *oli; /* option letter list index */\r
- if (GETOPT_MAGIC != opts->magic)\r
- {\r
- DT_Mdep_printf ("%s: getopt warning: "\r
- "option argument is not properly initialized.\n",\r
- argc > 0 ? argv[0] : "unknown command");\r
- DT_mygetopt_init (opts);\r
- }\r
- if (!* (opts->place)) /* update scanning pointer */\r
- {\r
- if ((opts->optind) >= argc ||\r
- * ((opts->place) = argv[ (opts->optind)]) != '-')\r
- {\r
- (opts->place) = EMSG;\r
- return (EOF);\r
- }\r
- if ((opts->place)[0] != '-')\r
- {\r
- /* Invalid 1st argument */\r
- return (BADCH);\r
- }\r
- if ((opts->place)[1] && *++ (opts->place) == '-')\r
- {\r
- /* found "--" which is an invalid option */\r
- ++ (opts->optind);\r
- (opts->place) = EMSG;\r
- return (BADCH);\r
- }\r
- } /* option letter okay? */\r
- opts->optopt = (int) * (opts->place)++;\r
- oli = strchr (ostr, (opts->optopt));\r
- if (opts->optopt == (int) ':' || ! oli)\r
- {\r
- /*\r
- * if the user didn't specify '-' as an option, assume it means EOF.\r
- */\r
- if ((opts->optopt) == (int) '-')\r
- {\r
- /* return (EOF); */\r
- return (BADCH);\r
- }\r
- if (!* (opts->place))\r
- {\r
- ++ (opts->optind);\r
- }\r
- if ((opts->opterr) && *ostr != ':')\r
- {\r
- p = strchr (*argv, '/');\r
- if (!p)\r
- {\r
- p = *argv;\r
- }\r
- else\r
- {\r
- ++p;\r
- }\r
-\r
- if (opts->optopt != '?') /* Anything but '?' needs error */\r
- {\r
- DT_Mdep_printf ("%s: Illegal option -- %c\n",\r
- p, (opts->optopt));\r
- }\r
- }\r
- return (BADCH);\r
- }\r
- if (*++oli != ':') /* don't need argument */\r
- {\r
- (opts->optarg) = NULL;\r
- if (!* (opts->place))\r
- {\r
- ++ (opts->optind);\r
- }\r
- }\r
- else /* need an argument */\r
- {\r
- if (* (opts->place)) /* no white space */\r
- {\r
- (opts->optarg) = (opts->place);\r
- }\r
- else\r
- {\r
- if (argc <= ++ (opts->optind)) /* no arg */\r
- {\r
- (opts->place) = EMSG;\r
- if (*ostr == ':')\r
- {\r
- return (BADARG);\r
- }\r
- p = strchr (*argv, '/');\r
- if (!p)\r
- {\r
- p = *argv;\r
- }\r
- else\r
- {\r
- ++p;\r
- }\r
- if ((opts->opterr))\r
- {\r
- DT_Mdep_printf (\r
- "%s: option requires an argument -- %c\n",\r
- p, (opts->optopt));\r
- }\r
- return (BADCH);\r
- }\r
- else /* white space */\r
- {\r
- (opts->optarg) = argv[ (opts->optind)];\r
- }\r
- }\r
- (opts->place) = EMSG;\r
- ++ (opts->optind);\r
- }\r
- return (opts->optopt); /* dump back option letter */\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_GETOPT_H__\r
-#define __DAPL_GETOPT_H__\r
-\r
-typedef struct\r
-{\r
- int magic;\r
- char *place;\r
-\r
- int opterr;\r
- int optind;\r
- char optopt;\r
- char *optarg;\r
-} mygetopt_t;\r
-/* function prototypes */\r
-void\r
-DT_mygetopt_init (mygetopt_t * opts);\r
-char\r
-DT_mygetopt_r (int argc,\r
- char *const * argv,\r
- const char *ostr,\r
- mygetopt_t * opts);\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_proto.h"\r
-#include "dapl_limit_cmd.h"\r
-\r
-/*\r
- * Increase the size of an array of handles\r
- */\r
-static bool\r
-more_handles (DAT_HANDLE **old_ptrptr, /* pointer to current pointer */\r
- unsigned int *old_count, /* number pointed to */\r
- unsigned int size) /* size of one datum */\r
-{\r
- unsigned int count = *old_count;\r
- DAT_HANDLE *old_handles = *old_ptrptr;\r
- DAT_HANDLE *handle_tmp = DT_Mdep_Malloc (count * 2 * size);\r
-\r
- if (!handle_tmp)\r
- {\r
- DT_Mdep_printf ("Out of memory for more DAT_HANDLEs\n");\r
- return (false);\r
- }\r
-\r
- memcpy (handle_tmp, old_handles, count*size);\r
- DT_Mdep_Free (old_handles);\r
- *old_ptrptr = handle_tmp;\r
- *old_count = count * 2;\r
- return (true);\r
-}\r
-\r
-\r
-/*\r
- * Limit test workhorse.\r
- *\r
- * This test creates the sequence of DAT objects needed to move\r
- * data back and forth, attempting to find the limits supported\r
- * for the DAT object indicated by 'depth'. For example, if\r
- * depth == LIM_LMR, the test will create a set of {IA,PZ,CNO,EVD,EP}\r
- * before trying to exhaust LMR creation using the {IA,PZ,CNO,EVD,EP} set.\r
- *\r
- * The 'cmd->width' parameter can be used to control how may of these\r
- * parallel DAT object sets we create before stopping to beat upon\r
- * the constructor for the object indicated by 'depth', providing for\r
- * increased (or at least different) stress on the DAPL.\r
- */\r
-static bool\r
-limit_test ( Limit_Cmd_t *cmd,\r
- Limit_Index depth)\r
-{\r
- typedef struct obj_set\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_EVD_HANDLE ia_async_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_CNO_HANDLE cno_handle;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_LMR_HANDLE lmr_handle;\r
- char * lmr_buffer;\r
- DAT_LMR_CONTEXT lmr_context;\r
- DAT_RMR_HANDLE rmr_handle;\r
- DAT_RMR_CONTEXT rmr_context;\r
- } Obj_Set;\r
-\r
- Obj_Set *hdl_sets = (Obj_Set *) NULL;\r
- bool retval = false;\r
- char *module = "LimitTest";\r
-#if defined (WIN32)\r
- /*\r
- * The Windows compiler will not deal with complex definitions\r
- * in macros, so create a variable here.\r
- */\r
-#if defined (DAT_OS_WAIT_PROXY_AGENT_NULL)\r
- #undef DAT_OS_WAIT_PROXY_AGENT_NULL\r
-#endif\r
- DAT_OS_WAIT_PROXY_AGENT DAT_OS_WAIT_PROXY_AGENT_NULL = {NULL, NULL};\r
-#endif\r
-\r
- DAT_RETURN ret;\r
- # define DFLT_QLEN 10 /* a small event queue size */\r
- # define START_COUNT 1024 /* initial # handles */\r
- # define DFLT_BUFFSZ 4096 /* default size for buffer */\r
- # define CONN_QUAL0 0xAffab1e\r
-\r
- /* Allocate 'width' Obj_Sets */\r
- if (depth && ! (hdl_sets = DT_Mdep_Malloc (sizeof (Obj_Set) * cmd->width)))\r
- {\r
- DT_Mdep_printf ("%s: No memory for handle array!\n", module);\r
- goto clean_up_now;\r
- }\r
-\r
- /* -----------\r
- * IA handling\r
- */\r
- if (depth > LIM_IA)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
-\r
- DT_Mdep_debug (("%s: dat_ia_open X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- /* Specify that we want to get back an async EVD. */\r
- hdl_sets[w].ia_async_handle = DAT_HANDLE_NULL;\r
-#ifdef DYNAMIC_DAT_LOADING\r
- ret = dat_open (cmd->device_name,\r
- DFLT_QLEN, \r
- &hdl_sets[w].ia_async_handle,\r
- &hdl_sets[w].ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- ret = dat_ia_open (cmd->device_name,\r
- DFLT_QLEN, \r
- &hdl_sets[w].ia_async_handle,\r
- &hdl_sets[w].ia_handle);\r
-#endif // DYNAMIC_DAT_LOADING\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ia_open (%s) #%d fails: %s\n",\r
- module, cmd->device_name,\r
- w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].ia_async_handle = DAT_HANDLE_NULL;\r
- hdl_sets[w].ia_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_IA)\r
- {\r
- /*\r
- * See how many IAs we can create\r
- */\r
- typedef struct _ia\r
- {\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_EVD_HANDLE ia_async_handle;\r
- }\r
- OneOpen;\r
- unsigned int count = START_COUNT;\r
- OneOpen *hdlptr = (OneOpen *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* IA Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_ia_open\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: IAs opened: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- /* Specify that we want to get back an async EVD. */\r
- hdlptr[w].ia_async_handle = DAT_HANDLE_NULL;\r
-#ifdef DYNAMIC_DAT_LOADING\r
- ret = dat_open (cmd->device_name,\r
- DFLT_QLEN, \r
- &hdlptr[w].ia_async_handle,\r
- &hdlptr[w].ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- ret = dat_ia_open (cmd->device_name,\r
- DFLT_QLEN, \r
- &hdlptr[w].ia_async_handle,\r
- &hdlptr[w].ia_handle);\r
-#endif // DYNAMIC_DAT_LOADING\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ia_open (%s) #%d fails: %s\n",\r
- module, cmd->device_name,\r
- w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: IAs opened: %d\n", module, w);\r
- retval = true;\r
-\r
- /* IA Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = DT_ia_close (hdlptr[tmp].ia_handle,\r
- DAT_CLOSE_GRACEFUL_FLAG);\r
-\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (graceful) fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- ret = DT_ia_close (hdlptr[tmp].ia_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (abrupt) fails: %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End IA handling */\r
-\r
- /* -----------\r
- * PZ handling\r
- */\r
- if (depth > LIM_PZ)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
-\r
- DT_Mdep_debug (("%s: dat_pz_create X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- ret = dat_pz_create (hdl_sets[w].ia_handle,\r
- &hdl_sets[w].pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].pz_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_PZ)\r
- {\r
- /*\r
- * See how many PZs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_PZ_HANDLE *hdlptr = (DAT_PZ_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* PZ Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_pz_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: PZs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- ret = dat_pz_create (hdl_sets[w % cmd->width].ia_handle,\r
- &hdlptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: PZs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* PZ Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_pz_free (hdlptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End PZ handling */\r
-\r
- /* -----------\r
- * CNO handling\r
- */\r
-\r
- if (depth > LIM_CNO)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
-\r
- DT_Mdep_debug (("%s: dat_cno_create X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- ret = dat_cno_create (hdl_sets[w].ia_handle,\r
- DAT_OS_WAIT_PROXY_AGENT_NULL,\r
- &hdl_sets[w].cno_handle);\r
- if (DAT_GET_TYPE(ret) == DAT_NOT_IMPLEMENTED)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_create unimplemented\n", module);\r
- hdl_sets[w].cno_handle = DAT_HANDLE_NULL;\r
- /* ignore this error */\r
- break;\r
- }\r
- else if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].cno_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_CNO)\r
- {\r
- /*\r
- * See how many CNOs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_CNO_HANDLE *hdlptr = (DAT_CNO_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* CNO Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_cno_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: CNOs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- ret = dat_cno_create (hdl_sets[w % cmd->width].ia_handle,\r
- DAT_OS_WAIT_PROXY_AGENT_NULL,\r
- &hdlptr[w]);\r
- if (DAT_GET_TYPE(ret) == DAT_NOT_IMPLEMENTED)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_create unimplemented\n",\r
- module);\r
- retval = true;\r
- break;\r
- }\r
- else if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: CNOs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* CNO Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_cno_free (hdlptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End CNO handling */\r
-\r
- /* -----------\r
- * EVD handling\r
- */\r
- if (depth > LIM_EVD)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
- DAT_EVD_FLAGS flags = ( DAT_EVD_DTO_FLAG\r
- /* | DAT_EVD_SOFTWARE_FLAG */\r
- | DAT_EVD_CONNECTION_FLAG\r
- | DAT_EVD_CR_FLAG\r
- | DAT_EVD_RMR_BIND_FLAG ); /* not ASYNC */\r
-\r
- DT_Mdep_debug (("%s: dat_evd_create X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- ret = dat_evd_create (hdl_sets[w].ia_handle,\r
- DFLT_QLEN,\r
- hdl_sets[w].cno_handle,\r
- flags,\r
- &hdl_sets[w].evd_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].evd_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_EVD)\r
- {\r
- /*\r
- * See how many EVDs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_EVD_HANDLE *hdlptr = (DAT_EVD_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
- DAT_EVD_FLAGS flags = ( DAT_EVD_DTO_FLAG\r
- | DAT_EVD_RMR_BIND_FLAG\r
- | DAT_EVD_CONNECTION_FLAG\r
- | DAT_EVD_CR_FLAG);\r
-\r
- /* EVD Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_evd_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: EVDs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- ret = dat_evd_create (hdl_sets[w % cmd->width].ia_handle,\r
- DFLT_QLEN,\r
- hdl_sets[w % cmd->width].cno_handle,\r
- flags,\r
- &hdlptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: EVDs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* EVD Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_evd_free (hdlptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End EVD handling */\r
-\r
- /* -----------\r
- * EP handling\r
- */\r
- if (depth > LIM_EP)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
-\r
- DT_Mdep_debug (("%s: dat_ep_create X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- ret = dat_ep_create (hdl_sets[w].ia_handle,\r
- hdl_sets[w].pz_handle,\r
- hdl_sets[w].evd_handle, /* recv */\r
- hdl_sets[w].evd_handle, /* request */\r
- hdl_sets[w].evd_handle, /* connect */\r
- (DAT_EP_ATTR *) NULL,\r
- &hdl_sets[w].ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].ep_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_EP)\r
- {\r
- /*\r
- * See how many EPs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_EP_HANDLE *hdlptr = (DAT_EP_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* EP Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_ep_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: EPs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- ret = dat_ep_create (hdl_sets[w % cmd->width].ia_handle,\r
- hdl_sets[w % cmd->width].pz_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- (DAT_EP_ATTR *) NULL,\r
- &hdlptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: EPs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* EP Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_ep_free (hdlptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End EP handling */\r
-\r
- /* -----------\r
- * RSP handling\r
- *\r
- * if (depth > LIM_RSP) {\r
- * Since RSPs are not part of the Obj_Set,\r
- * there's nothing to do.\r
- * } else ...\r
- */\r
- if (depth == LIM_RSP)\r
- {\r
- /*\r
- * See how many RSPs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_RSP_HANDLE *hdlptr = (DAT_RSP_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
- DAT_EP_HANDLE *epptr = (DAT_EP_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*epptr));\r
-\r
- /* RSP Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_rsp_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count)\r
- {\r
- unsigned int count1 = count;\r
- unsigned int count2 = count;\r
-\r
- if (!more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count1,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: RSPs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- if (!more_handles ((DAT_HANDLE **) &epptr,\r
- &count2,\r
- sizeof (*epptr)))\r
- {\r
- DT_Mdep_printf ("%s: RSPs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
-\r
- if (count1 != count2)\r
- {\r
- DT_Mdep_printf ("%s: Mismatch in allocation of handle arrays at point %d\n",\r
- module, w);\r
- retval = true;\r
- break;\r
- }\r
-\r
- count = count1;\r
- }\r
-\r
- /*\r
- * Each RSP needs a unique EP, so create one first\r
- */\r
- ret = dat_ep_create (hdl_sets[w % cmd->width].ia_handle,\r
- hdl_sets[w % cmd->width].pz_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- (DAT_EP_ATTR *) NULL,\r
- &epptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_create #%d fails: %s testing RSPs\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- break;\r
- }\r
-\r
- ret = dat_rsp_create (hdl_sets[w % cmd->width].ia_handle,\r
- CONN_QUAL0 + w,\r
- epptr[w],\r
- hdl_sets[w % cmd->width].evd_handle,\r
- &hdlptr[w]);\r
- if (DAT_GET_TYPE(ret) == DAT_NOT_IMPLEMENTED)\r
- {\r
- DT_Mdep_printf ("%s: dat_rsp_create unimplemented\n",\r
- module);\r
- /* ignore this error */\r
- retval = true;\r
- break;\r
- }\r
- else if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rsp_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* Cleanup the EP; no-one else will. */\r
- ret = dat_ep_free (epptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free (internal cleanup @ #%d) fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- }\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: RSPs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* RSP Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_rsp_free (hdlptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_rsp_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- /* Free EPs */\r
- ret = dat_ep_free (epptr[tmp]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free fails: %s for RSPs\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End RSP handling */\r
-\r
- /* -----------\r
- * PSP handling\r
- *\r
- * if (depth > LIM_PSP) {\r
- * Since PSPs are not part of the Obj_Set,\r
- * there's nothing to do.\r
- * } else ...\r
- */\r
- if (depth == LIM_PSP)\r
- {\r
- /*\r
- * See how many PSPs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_PSP_HANDLE *hdlptr = (DAT_PSP_HANDLE *)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* PSP Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_psp_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: PSPs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- ret = dat_psp_create (hdl_sets[w % cmd->width].ia_handle,\r
- CONN_QUAL0 + w,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- DAT_PSP_CONSUMER_FLAG,\r
- &hdlptr[w]);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_psp_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- retval = true;\r
- hdlptr[w] = DAT_HANDLE_NULL;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: PSPs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* PSP Cleanup loop */\r
- for (tmp = 0; tmp < w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- ret = dat_psp_free (hdlptr[tmp]);\r
- if (DAT_GET_TYPE(ret) == DAT_NOT_IMPLEMENTED)\r
- {\r
- DT_Mdep_printf ("%s: dat_psp_free unimplemented\n"\r
- "\tNB: Expect EVD+IA cleanup errors!\n",\r
- module);\r
- break;\r
- }\r
- else if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_psp_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End PSP handling */\r
-\r
- /* -----------\r
- * LMR handling\r
- */\r
- if (depth > LIM_LMR)\r
- {\r
- /*\r
- * The abuse is not for us this time, just prep Obj_Set.\r
- */\r
- unsigned int w;\r
-\r
- DT_Mdep_debug (("%s: dat_lmr_create X %d\n", module, cmd->width));\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- DAT_REGION_DESCRIPTION region;\r
- DAT_VLEN reg_size;\r
- DAT_VADDR reg_addr;\r
-\r
- hdl_sets[w].lmr_buffer = DT_Mdep_Malloc (DFLT_BUFFSZ);\r
- if (!hdl_sets[w].lmr_buffer)\r
- {\r
- DT_Mdep_printf ("%s: no memory for LMR buffers\n", module);\r
- goto clean_up_now;\r
- }\r
- memset (®ion, 0, sizeof (region));\r
- region.for_va = hdl_sets[w].lmr_buffer;\r
-\r
- ret = dat_lmr_create (hdl_sets[w].ia_handle,\r
- DAT_MEM_TYPE_VIRTUAL,\r
- region,\r
- DFLT_BUFFSZ,\r
- hdl_sets[w].pz_handle,\r
- DAT_MEM_PRIV_ALL_FLAG,\r
- &hdl_sets[w].lmr_handle,\r
- &hdl_sets[w].lmr_context,\r
- NULL, /* FIXME */\r
- ®_size, ®_addr);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_create #%d fails: %s\n",\r
- module, w+1, DT_RetToString (ret));\r
- /* handle contents undefined on failure */\r
- hdl_sets[w].lmr_handle = DAT_HANDLE_NULL;\r
- goto clean_up_now;\r
- }\r
- if ((uintptr_t)reg_addr > (uintptr_t)hdl_sets[w].lmr_buffer\r
- || (reg_size < DFLT_BUFFSZ + ((uintptr_t)reg_addr\r
- - (uintptr_t)hdl_sets[w].lmr_buffer)))\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_create bogus outputs "\r
- "in: 0x%p, %x out 0x%llx, %llx\n",\r
- module,\r
- hdl_sets[w].lmr_buffer, DFLT_BUFFSZ,\r
- (DAT_UVERYLONG)reg_addr, (DAT_UVERYLONG)reg_size);\r
- goto clean_up_now;\r
- }\r
- }\r
- }\r
- else if (depth == LIM_LMR)\r
- {\r
- /*\r
- * See how many LMRs we can create\r
- */\r
- unsigned int count = START_COUNT;\r
- Bpool **hdlptr = (Bpool **)\r
- DT_Mdep_Malloc (count * sizeof (*hdlptr));\r
-\r
- /* LMR Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int tmp;\r
-\r
- DT_Mdep_debug (("%s: Exhausting dat_lmr_create\n", module));\r
- for (w = 0; w < cmd->maximum; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: no memory for LMR handles\n",\r
- module);\r
- DT_Mdep_printf ("%s: LMRs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- /*\r
- * Let BpoolAlloc do the hard work; this means that\r
- * we're testing unique memory registrations rather\r
- * than repeatedly binding the same buffer set.\r
- */\r
- hdlptr[w] = DT_BpoolAlloc ((Per_Test_Data_t *)0,\r
- hdl_sets[w % cmd->width].ia_handle,\r
- hdl_sets[w % cmd->width].pz_handle,\r
- hdl_sets[w % cmd->width].ep_handle,\r
- hdl_sets[w % cmd->width].evd_handle,\r
- DFLT_BUFFSZ,\r
- 1,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if (!hdlptr[w])\r
- {\r
- DT_Mdep_printf ("%s: LMRs created: %d\n", module, w);\r
- retval = true;\r
- break;\r
- }\r
- }\r
-\r
- DT_Mdep_printf ("%s: LMRs created: %d\n", module, w);\r
- retval = true;\r
-\r
- /* LMR Cleanup loop */\r
- for (tmp = 0; tmp <= w; tmp++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (hdlptr[tmp])\r
- {\r
- /* ignore rval - DT_Bpool_Destroy will complain */\r
- (void) DT_Bpool_Destroy ((Per_Test_Data_t *)0, hdlptr[tmp]);\r
- }\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* End LMR handling */\r
-\r
- /* -----------\r
- * Posted receive buffer handling\r
- */\r
- if (depth == LIM_RPOST)\r
- {\r
- /*\r
- * See how many receive buffers we can post (to each EP).\r
- * We are posting the same buffer 'cnt' times, deliberately,\r
- * but that should be OK.\r
- */\r
- unsigned int count = START_COUNT;\r
- DAT_LMR_TRIPLET *hdlptr = (DAT_LMR_TRIPLET *)\r
- DT_Mdep_Malloc (count * cmd->width * sizeof (*hdlptr));\r
-\r
- /* Recv-Post Exhaustion test loop */\r
- if (hdlptr)\r
- {\r
- unsigned int w = 0;\r
- unsigned int i = 0;\r
- unsigned int done = 0;\r
-\r
- DT_Mdep_debug (("%s: Exhausting posting of recv buffers\n", module));\r
- for (w = 0; w < cmd->maximum && !done; w++)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- if (w == count\r
- && !more_handles ((DAT_HANDLE **) &hdlptr,\r
- &count,\r
- cmd->width * sizeof (*hdlptr)))\r
- {\r
- DT_Mdep_printf ("%s: no memory for IOVs \n",\r
- module);\r
- DT_Mdep_printf ("%s: recv buffers posted per EP: %d\n"\r
- "\t\t (total posted: %d)\n",\r
- module,\r
- w,\r
- w * cmd->width);\r
- done = retval = true;\r
- break;\r
- }\r
- for (i = 0; i < cmd->width; i++)\r
- {\r
- DAT_LMR_TRIPLET *iovp = &hdlptr[w * cmd->width + i];\r
- DAT_DTO_COOKIE cookie;\r
-\r
- iovp->virtual_address = (DAT_VADDR) (uintptr_t)\r
- hdl_sets[i].lmr_buffer;\r
- iovp->segment_length = DFLT_BUFFSZ;\r
- iovp->lmr_context = hdl_sets[i].lmr_context;\r
- cookie.as_64 = (DAT_UINT64)0UL;\r
- cookie.as_ptr = (DAT_PVOID) hdl_sets[i].lmr_buffer;\r
-\r
- DT_Mdep_printf ("%s: dat_ep_post_recv #%d\n", module,\r
- w * cmd->width + i + 1);\r
- ret = dat_ep_post_recv (hdl_sets[i].ep_handle,\r
- 1,\r
- iovp,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_post_recv fails: %s\n",\r
- module, DT_RetToString (ret));\r
- DT_Mdep_printf ("%s: recv buffers posted per EP: %d\n"\r
- "\t\t (total posted: %d)\n",\r
- module,\r
- w,\r
- w * cmd->width + i);\r
- done = retval = true;\r
- break;\r
- }\r
- } /* end for each EP wide */\r
- } /* end forever (!done) loop */\r
-\r
- retval = true;\r
- DT_Mdep_printf ("%s: recv buffers posted per EP: %d\n"\r
- "\t\t (total posted: %d)\n",\r
- module,\r
- w,\r
- w * cmd->width);\r
-\r
- /* Rpost Cleanup loop */\r
- for (i = 0; i < cmd->width; i++)\r
- {\r
- DAT_EVENT event;\r
-\r
- /*\r
- * Disconnecting an unconnected EP should complete\r
- * outstanding recv DTOs in error, and otherwise\r
- * be a no-op.\r
- */\r
- ret = dat_ep_disconnect (hdl_sets[i].ep_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_disconnect (abrupt) fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- else\r
- {\r
- /*\r
- * Remove all DTOs. The disconnect above should have\r
- * flushed all posted operations, so this is just a\r
- * clean up.\r
- */\r
- do\r
- {\r
- ret = dat_evd_dequeue ( hdl_sets[i].evd_handle,\r
- &event);\r
- } while ( DAT_GET_TYPE(ret) != DAT_QUEUE_EMPTY );\r
- }\r
-\r
- }\r
- DT_Mdep_Free (hdlptr);\r
- }\r
- } /* end depth == LIM_RPOST */\r
-\r
- /* -----------\r
- * Test maximum size of LMR allowed\r
- */\r
- if (depth == LIM_SIZE_LMR)\r
- {\r
- DAT_COUNT last_size = 0;\r
- DAT_COUNT test_size = DFLT_BUFFSZ;\r
-\r
- for (;;)\r
- {\r
-#ifdef _ONTAP_\r
- sk_preempt_msec(10);\r
-#endif\r
- Bpool *test_bpool = DT_BpoolAlloc ((Per_Test_Data_t *)0,\r
- hdl_sets[0].ia_handle,\r
- hdl_sets[0].pz_handle,\r
- hdl_sets[0].ep_handle,\r
- hdl_sets[0].evd_handle,\r
- test_size,\r
- 1,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
-\r
- if (!test_bpool)\r
- {\r
- DT_Mdep_printf ("%s: Largest LMR was 0x%x bytes\n"\r
- "\t (failed attempting 0x%x bytes)\n",\r
- module, last_size, test_size);\r
- retval = true;\r
- break;\r
- }\r
- else if (!DT_Bpool_Destroy ((Per_Test_Data_t *)0, test_bpool))\r
- {\r
- DT_Mdep_printf ("%s: Largest LMR was 0x%x bytes\n",\r
- module, test_size);\r
- retval = true;\r
- break;\r
- }\r
-\r
- last_size = test_size;\r
- test_size <<= 1;\r
- if (test_size < last_size)\r
- {\r
- /* could conceivably wrap on 32-bit architectures */\r
- DT_Mdep_printf ("%s: LMR of 0x%x bytes OK - %s\n",\r
- module, last_size, "stopping now.");\r
- retval = true;\r
- break;\r
- }\r
- } /* end forever loop */\r
- } /* end depth == LIM_SIZE_LMR */\r
-\r
- DT_Mdep_debug (("%s: Limit Testing Completed - %s\n",\r
- module,\r
- retval ? "Successfully" : "with errors"));\r
-\r
-\r
- /* ----------------------------------------------------------\r
- * Clean up and go home\r
- */\r
-clean_up_now:\r
-\r
- DT_Mdep_debug (("%s: Cleaning up ...\n", module));\r
-\r
- if (depth > LIM_LMR)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].lmr_handle)\r
- {\r
- ret = dat_lmr_free (hdl_sets[w].lmr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_lmr_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- if ((void *) hdl_sets[w].lmr_buffer)\r
- {\r
- DT_Mdep_Free ((void *) hdl_sets[w].lmr_buffer);\r
- }\r
- }\r
- } /* end LIM_LMR cleanup */\r
-\r
- /*\r
- * if (depth == LIM_PSP) {\r
- * Since PSPs are not part of the Obj_Set,\r
- * there's no cleanup to do.\r
- * }\r
- *\r
- * if (depth == LIM_RSP) {\r
- * Since RSPs are not part of the Obj_Set,\r
- * there'no cleanup nothing to do.\r
- * }\r
- */\r
-\r
- if (depth > LIM_EP)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].ep_handle)\r
- {\r
- ret = dat_ep_free (hdl_sets[w].ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- }\r
- } /* end LIM_EP cleanup */\r
-\r
- if (depth > LIM_EVD)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].evd_handle)\r
- {\r
- ret = dat_evd_free (hdl_sets[w].evd_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- }\r
- } /* end LIM_EVD cleanup */\r
-\r
- if (depth > LIM_CNO)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].cno_handle)\r
- {\r
- ret = dat_cno_free (hdl_sets[w].cno_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_cno_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- }\r
- } /* end LIM_CNO cleanup */\r
-\r
- if (depth > LIM_PZ)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].pz_handle)\r
- {\r
- ret = dat_pz_free (hdl_sets[w].pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_free fails: %s\n",\r
- module, DT_RetToString (ret));\r
- retval = false;\r
- }\r
- }\r
- }\r
- } /* end LIM_PZ cleanup */\r
-\r
- if (depth > LIM_IA)\r
- {\r
- unsigned int w;\r
-\r
- for (w = 0; w < cmd->width; w++)\r
- {\r
- if (hdl_sets[w].ia_handle)\r
- {\r
- /* DT_ia_close cleans up async evd handle, too */\r
- ret = DT_ia_close (hdl_sets[w].ia_handle,\r
- DAT_CLOSE_GRACEFUL_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (graceful) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /*\r
- * Since we take some pains to clean up properly,\r
- * this really is an error. But if we get here,\r
- * we may as well try the largest hammer we have.\r
- */\r
- retval = false;\r
- ret = DT_ia_close (hdl_sets[w].ia_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (abrupt) error: %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- }\r
- }\r
- }\r
- } /* end LIM_IA cleanup */\r
-\r
- if (depth && hdl_sets)\r
- {\r
- DT_Mdep_Free (hdl_sets);\r
- }\r
-\r
- DT_Mdep_debug (("%s: testing and cleanup complete.\n", module));\r
-\r
- return ( retval );\r
-}\r
-\r
-\r
-/*********************************************************************\r
- * Framework to run through all of the limit tests\r
- */\r
-void \r
-DT_cs_Limit (Limit_Cmd_t * cmd)\r
-{\r
- char *star =\r
- "**********************************************************************" ;\r
-\r
- if (cmd->Test_List[ LIM_IA ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_ia\n"\r
- "Description: Test max num of opens for the same physical IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_IA))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_PZ ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_pz\n"\r
- "Description: Test max num of PZs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_PZ))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_CNO ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_cno\n"\r
- "Description: Test max num of CNOs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_CNO))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_EVD ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_evd\n"\r
- "Description: Test max num of EVDs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_EVD))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_EP ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_ep\n"\r
- "Description: Test max num of EPs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_EP))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_RSP ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_rsp\n"\r
- "Description: Test max num of RSPs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_RSP))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_PSP ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_psp\n"\r
- "Description: Test max num of PSPs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_PSP))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_LMR ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_lmr\n"\r
- "Description: Test max num of LMRs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_LMR))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_RPOST ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_rpost\n"\r
- "Description: Test max num of receive buffers posted to an EP"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_RPOST))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- if (cmd->Test_List[ LIM_SIZE_LMR ])\r
- {\r
- char list[] =\r
- {\r
- "Limitation Test limit_size_lmr\n"\r
- "Description: Test max size of LMRs that are supported by an IA"\r
- }\r
- ;\r
-\r
- DT_Mdep_printf ("%s\n", star);\r
- DT_Mdep_printf ("%s\n", list);\r
- if (!limit_test (cmd, LIM_SIZE_LMR))\r
- {\r
- goto error;\r
- }\r
- DT_Mdep_printf ("%s\n", star);\r
- }\r
-\r
- /* More tests TBS ... */\r
-\r
- return;\r
-\r
-error:\r
- DT_Mdep_printf ("error occurs, can not continue with limit test\n");\r
- DT_Mdep_printf ("%s\n", star);\r
- return;\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_limit_cmd.h"\r
-\r
-/* --------------------------------------------------- */\r
-void \r
-DT_Limit_Cmd_Init (Limit_Cmd_t * cmd)\r
-{\r
- memset ((void *) cmd, 0, sizeof (Limit_Cmd_t));\r
- cmd->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
- cmd->width = 1;\r
- cmd->maximum = ~0U;\r
-}\r
-\r
-/* --------------------------------------------------- */\r
-bool\r
-DT_Limit_Cmd_Parse ( Limit_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts)\r
-{\r
- char c;\r
- int i;\r
-\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "dm:w:D:R:", opts);\r
- if (c == EOF)\r
- {\r
- break;\r
- }\r
- switch (c)\r
- {\r
- case 'D': /* device name */\r
- {\r
- strcpy (cmd->device_name, opts->optarg);\r
- break;\r
- }\r
- case 'R': /* Service Reliability Level */\r
- {\r
- cmd->ReliabilityLevel = DT_ParseQoS (opts->optarg);\r
- break;\r
- }\r
- case 'd': /* print debug messages */\r
- {\r
- DT_dapltest_debug++;\r
- cmd->debug = true;\r
- break;\r
- }\r
- case 'm': /* maximum for exhaustion testing */\r
- {\r
- unsigned int len = (unsigned int)strspn (opts->optarg, "0123456789");\r
-\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -m<maximum> option\n");\r
- DT_Limit_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->maximum = atol (opts->optarg);\r
- break;\r
- }\r
- case 'w': /* width (number of {ia,evd,ep,...} sets) */\r
- {\r
- unsigned int len = (unsigned int)strspn (opts->optarg, "0123456789");\r
-\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -w<width> option\n");\r
- DT_Limit_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->width = atol (opts->optarg);\r
- break;\r
- }\r
- case '?':\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Limit Test Parameter: %c\n", c);\r
- DT_Limit_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
- if (cmd->device_name[0] == '\0')\r
- {\r
- if (!DT_Mdep_GetDefaultDeviceName (cmd->device_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- DT_Limit_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
-\r
- /*\r
- * by default: test all limit tests\r
- * otherwise: parse the remaining limit test arguments\r
- */\r
- if (opts->optind == my_argc)\r
- {\r
- for (i = 0; i < LIM_NUM_TESTS; i++)\r
- {\r
- cmd->Test_List[i] = 1;\r
- }\r
- }\r
- else\r
- {\r
- for (i = opts->optind; i < my_argc; i++)\r
- {\r
-\r
- if (strcmp (my_argv[i], "limit_ia") == 0)\r
- {\r
- cmd->Test_List[LIM_IA] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_pz") == 0)\r
- {\r
- cmd->Test_List[LIM_PZ] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_cno") == 0)\r
- {\r
- cmd->Test_List[LIM_CNO] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_evd") == 0)\r
- {\r
- cmd->Test_List[LIM_EVD] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_ep") == 0)\r
- {\r
- cmd->Test_List[LIM_EP] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_rsp") == 0)\r
- {\r
- cmd->Test_List[LIM_RSP] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_psp") == 0)\r
- {\r
- cmd->Test_List[LIM_PSP] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_lmr") == 0)\r
- {\r
- cmd->Test_List[LIM_LMR] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_rpost") == 0)\r
- {\r
- cmd->Test_List[LIM_RPOST] = 1;\r
- continue;\r
- }\r
- if (strcmp (my_argv[i], "limit_size_lmr") == 0)\r
- {\r
- cmd->Test_List[LIM_SIZE_LMR] = 1;\r
- continue;\r
- }\r
-\r
- DT_Mdep_printf ("Cannot find this limit test: %s\n", my_argv[i]);\r
- DT_Limit_Cmd_Usage ();\r
- return (false);\r
-\r
- } /* end foreach remaining argv */\r
- }\r
-\r
- return (true);\r
-}\r
-\r
-/* --------------------------------------------------- */\r
-void \r
-DT_Limit_Cmd_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE: ---- LIMIT TEST ----\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T L\n");\r
- DT_Mdep_printf ("USAGE: [-D <device Name>]\n");\r
- DT_Mdep_printf ("USAGE: [-d] : debug (zero)\n");\r
- DT_Mdep_printf ("USAGE: [-w <width_of_resource_sets>]\n");\r
- DT_Mdep_printf ("USAGE: [-m <maximum_for_exhaustion_tests>]\n");\r
- DT_Mdep_printf ("USAGE: [-R <service reliability>]\n");\r
- DT_Mdep_printf ("USAGE: (BE == QOS_BEST_EFFORT - Default)\n");\r
- DT_Mdep_printf ("USAGE: (HT == QOS_HIGH_THROUGHPUT)\n");\r
- DT_Mdep_printf ("USAGE: (LL == QOS_LOW_LATENCY)\n");\r
- DT_Mdep_printf ("USAGE: (EC == QOS_ECONOMY)\n");\r
- DT_Mdep_printf ("USAGE: (PM == QOS_PREMIUM)\n");\r
- DT_Mdep_printf ("USAGE: [limit_ia [limit_pz] [limit_cno] ... ]\n");\r
- DT_Mdep_printf ("NOTE: If test is not specified, do all the limit tests\n");\r
- DT_Mdep_printf ("NOTE: Else, just do the specified tests\n");\r
- DT_Mdep_printf ("NOTE: Each test is separated by space, the test can be:\n");\r
-\r
- DT_Mdep_printf ("NOTE: [limit_ia] test max num of open IAs\n");\r
- DT_Mdep_printf ("NOTE: [limit_pz] test max num of PZs\n");\r
- DT_Mdep_printf ("NOTE: [limit_cno] test max num of CNOs\n");\r
- DT_Mdep_printf ("NOTE: [limit_evd] test max num of EVDs\n");\r
- DT_Mdep_printf ("NOTE: [limit_rsp] test max num of RSPs\n");\r
- DT_Mdep_printf ("NOTE: [limit_psp] test max num of PSPs\n");\r
- DT_Mdep_printf ("NOTE: [limit_ep] test max num of EPs\n");\r
- DT_Mdep_printf ("NOTE: [limit_lmr] test max num of LMRs\n");\r
- DT_Mdep_printf ("NOTE: [limit_rpost] test max num of recvs posted\n");\r
- DT_Mdep_printf ("NOTE: [limit_size_lmr] test max size of LMR\n");\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_LIMIT_CMD_H__\r
-#define __DAPL_LIMIT_CMD_H__\r
-\r
-#include "dapl_mdep.h"\r
-\r
-typedef enum\r
-{\r
- LIM_IA,\r
- LIM_PZ,\r
- LIM_CNO,\r
- LIM_EVD,\r
- LIM_EP,\r
- LIM_RSP,\r
- LIM_PSP,\r
- LIM_LMR,\r
- LIM_RPOST,\r
- LIM_SIZE_LMR,\r
- /* add further tests here */\r
- \r
- LIM_NUM_TESTS /* for array size & limit checks */\r
-} Limit_Index;\r
-\r
-//-------------------------------------\r
-typedef struct\r
-{\r
- char device_name[256]; /* -D */\r
- DAT_QOS ReliabilityLevel; /* -R */\r
- DAT_UINT32 width; /* -w */\r
- DAT_UINT32 debug; /* -d */\r
- DAT_UINT32 maximum; /* -m */\r
- DAT_UINT32 Test_List[ LIM_NUM_TESTS ];\r
-} Limit_Cmd_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_quit_cmd.h"\r
-#include "dapl_limit_cmd.h"\r
-\r
-DT_Mdep_LockType g_PerfTestLock; \r
-\r
-\r
-/* Main Entry Point */\r
-int __cdecl\r
-main (int argc, char *argv[])\r
-{\r
- return ( dapltest (argc, argv) );\r
-}\r
-\r
-\r
-/*\r
- * dapltest main program\r
- */\r
-int\r
-dapltest (int argc, char *argv[])\r
-{\r
- Params_t *params_ptr;\r
- Transaction_Cmd_t *Transaction_Cmd;\r
- Performance_Cmd_t *Performance_Cmd;\r
- Quit_Cmd_t *Quit_Cmd;\r
- Limit_Cmd_t *Limit_Cmd;\r
- FFT_Cmd_t *FFT_Cmd;\r
-\r
- /* check memory leaking */\r
- /*\r
- * DT_Mdep_LockInit(&Alloc_Count_Lock); alloc_count = 0;\r
- */\r
-\r
-#if defined(WIN32)\r
- /* Cannot be done from DT_Mdep_Init as dapl_init makes some socket\r
- * calls....So need to do this before calling dapl_init */\r
- WORD wversion = MAKEWORD (2, 2);\r
- WSADATA wsaData;\r
- int wsa_ret = WSAStartup (wversion, &wsaData);\r
- if ( wsa_ret != 0 )\r
- { DT_Mdep_printf("WinSock Init return err = %u\n", wsa_ret);\r
- return (wsa_ret);\r
- }\r
-#endif\r
-\r
- DT_Mdep_LockInit(&g_PerfTestLock); \r
-\r
-#ifdef GPROF\r
- {\r
- extern void dapl_init (void);dapl_init ();\r
- }\r
-#endif\r
- DT_dapltest_debug = 0;\r
-\r
- params_ptr = (Params_t *) DT_Mdep_Malloc (sizeof (Params_t));\r
- if (!params_ptr)\r
- {\r
- DT_Mdep_printf ("Cannot allocate memory for Params structure\n");\r
- return ( 1 );\r
- }\r
-\r
- DT_Endian_Init (); /* init endian of local machine */\r
- if ( !DT_Mdep_Init ()) /* init OS, libraries, etc. */\r
- {\r
- DT_Mdep_printf ("Failed To Load Dat Library\n");\r
- return 1;\r
- }\r
- /*\r
- * parse command line arguments\r
- */\r
- if (!DT_Params_Parse (argc, argv, params_ptr))\r
- {\r
- DT_Mdep_printf ("Command line syntax error\n");\r
- return 1;\r
- }\r
- switch (params_ptr->test_type)\r
- {\r
- case SERVER_TEST:\r
- {\r
- DT_cs_Server (params_ptr);\r
- break;\r
- }\r
- case TRANSACTION_TEST:\r
- {\r
- Transaction_Cmd = ¶ms_ptr->u.Transaction_Cmd;\r
- DT_cs_Client ( params_ptr,\r
- Transaction_Cmd->dapl_name,\r
- Transaction_Cmd->server_name,\r
- Transaction_Cmd->num_threads *\r
- Transaction_Cmd->eps_per_thread);\r
- break;\r
- }\r
- case PERFORMANCE_TEST:\r
- {\r
- Performance_Cmd = ¶ms_ptr->u.Performance_Cmd;\r
- DT_cs_Client ( params_ptr,\r
- Performance_Cmd->dapl_name,\r
- Performance_Cmd->server_name,\r
- 1);\r
- break;\r
- }\r
- case QUIT_TEST:\r
- {\r
- Quit_Cmd = ¶ms_ptr->u.Quit_Cmd;\r
- DT_cs_Client ( params_ptr,\r
- Quit_Cmd->device_name,\r
- Quit_Cmd->server_name,\r
- 0);\r
- break;\r
- }\r
- case LIMIT_TEST:\r
- {\r
- Limit_Cmd = ¶ms_ptr->u.Limit_Cmd;\r
- DT_cs_Limit (Limit_Cmd);\r
- break;\r
- }\r
- case FFT_TEST:\r
- {\r
- FFT_Cmd = ¶ms_ptr->u.FFT_Cmd;\r
- DT_cs_FFT (FFT_Cmd);\r
- break;\r
- }\r
- }\r
-\r
- /* cleanup */\r
-\r
- DT_Mdep_End ();\r
- DT_Mdep_Free (params_ptr);\r
-#ifdef GPROF\r
- {\r
- extern void dapl_fini (void);dapl_fini ();\r
- }\r
-#endif\r
-\r
- /*\r
- * check memory leaking DT_Mdep_printf("App allocated Memory left: %d\n",\r
- * alloc_count); DT_Mdep_LockDestroy(&Alloc_Count_Lock);\r
- */\r
-\r
- DT_Mdep_LockDestroy(&g_PerfTestLock);\r
-\r
- return ( 0 );\r
-}\r
-\r
-\r
-void\r
-Dapltest_Main_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE:\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T <Test_Type> [test-specific args]\n");\r
- DT_Mdep_printf ("USAGE: where <Test_Type>\n");\r
- DT_Mdep_printf ("USAGE: S = Run as a server\n");\r
- DT_Mdep_printf ("USAGE: T = Transaction Test\n");\r
- DT_Mdep_printf ("USAGE: Q = Quit Test\n");\r
- DT_Mdep_printf ("USAGE: L = Limit Test\n");\r
- DT_Mdep_printf ("USAGE: F = FFT Test\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
- DT_Mdep_printf ("NOTE:\tRun as server taking defaults (dapltest -T S)\n");\r
- DT_Mdep_printf ("NOTE: dapltest\n");\r
- DT_Mdep_printf ("NOTE:\n");\r
- DT_Mdep_printf ("NOTE:\tdapltest arguments may be supplied in a script file\n");\r
- DT_Mdep_printf ("NOTE:\tdapltest -f <script_file>\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-\r
-\r
-\r
-#if defined(__linux__)\r
-#include <pthread.h> /* needed for pthread_atfork() */\r
-#include <sys/time.h>\r
-#include <stdlib.h> /* needed for getenv() */\r
-#include <signal.h> /* needed for thread setup */\r
-\r
-#include <assert.h>\r
-#include <errno.h>\r
-#include <semaphore.h>\r
-#include <stdint.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <stdarg.h> /* for printf */\r
-#include <sys/time.h>\r
-#include <syslog.h>\r
-#include <netdb.h> /* for getaddrinfo */\r
-\r
-/*\r
- * Include files for setting up a network name\r
- */\r
-#include <unistd.h>\r
-#include <sys/types.h>\r
-#include <sys/socket.h>\r
-#include <ctype.h>\r
-\r
-#elif defined(__solaris__)\r
-#include <sys/times.h>\r
-#include <limits.h>\r
-#include <sys/time.h>\r
-#include <stdlib.h> /* needed for getenv() */\r
-#include <pthread.h> /* needed for pthread_atfork() */\r
-#include <signal.h> /* needed for thread setup */\r
-\r
-#elif defined(WIN32) || defined(_WIN64)\r
-#include <process.h>\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-#if defined(__linux__)\r
-static FILE *Stat_Fp = NULL;\r
-# define DT_STAT_FILE "/proc/stat"\r
-#endif\r
-\r
-#include "dapl_test_data.h" /* for alloc_count */\r
-\r
-\r
-/*\r
- * Machine dependant initialization\r
- */\r
-\r
-bool\r
-DT_Mdep_Init (void)\r
-{\r
-#if defined(__linux__)\r
- Stat_Fp = fopen (DT_STAT_FILE, "r");\r
- if ( NULL == Stat_Fp )\r
- {\r
- perror ("fopen of " DT_STAT_FILE " failed");\r
- exit (1);\r
- }\r
-#elif defined(__solaris__)\r
- /* nothing */\r
-#elif defined(WIN32)\r
- #ifdef DYNAMIC_DAT_LOADING\r
- bool status = false;\r
- HMODULE library_handle;\r
- if ( (library_handle = LoadLibrary(DAT_DLL_LIB)) == NULL )\r
- {\r
- DT_Mdep_printf("DAT: library load failure\n");\r
- return status;\r
- }\r
- dat_open = (DAT_IA_OPENV_FUNC)GetProcAddress(library_handle, (LPCSTR)DAT_LIB_OPEN_ENTRY);\r
- dat_close =(DAT_IA_CLOSE_FUNC)GetProcAddress(library_handle, (LPCSTR)DAT_LIB_CLOSE_ENTRY);\r
- if (dat_open != NULL && dat_close != NULL )\r
- {\r
- status = true;\r
- }\r
- if ( status != true )\r
- {\r
- DT_Mdep_printf("DAT: Failured to get ProcAddress of dat_open/dat_close\n");\r
- }\r
- return status;\r
- #else\r
- /*\r
- * Application shouled be explicitly linked to dat.lib\r
- */\r
- return true;\r
- #endif //DYNAMIC_DAT_LOADING\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Machine dependant deinitialization\r
- */\r
-\r
-void\r
-DT_Mdep_End (void)\r
-{\r
-#if defined(__linux__)\r
- if ( 0 != fclose (Stat_Fp) )\r
- {\r
- perror ("fclose of " DT_STAT_FILE " failed");\r
- exit (1);\r
- }\r
-#elif defined(__solaris__)\r
- /* nothing */\r
-#elif defined(WIN32)\r
- WSACleanup ();\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Generate name of IB device\r
- */\r
-\r
-bool\r
-DT_Mdep_GetDefaultDeviceName (char *dapl_name)\r
-{\r
- strcpy (dapl_name, DT_MdepDeviceName);\r
- return true;\r
-}\r
-\r
-/*\r
- * Sleep specified number of milliseconds\r
- */\r
-\r
-void\r
-DT_Mdep_Sleep (int msec)\r
-{\r
-#if defined(__linux__)\r
- struct timespec t;\r
- t.tv_sec = msec / 1000; /* Whole seconds */\r
- t.tv_nsec = (msec % 1000) * 1000 * 1000;\r
- nanosleep (&t, 0);\r
-#elif defined(__solaris__)\r
- struct timespec t;\r
- t.tv_sec = msec / 1000; /* Whole seconds */\r
- t.tv_nsec = (msec % 1000) * 1000 * 1000;\r
- nanosleep (&t, 0);\r
-#elif defined(WIN32)\r
- Sleep (msec);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Get system statistics including uptime and idle time \r
- */\r
-\r
-bool\r
-DT_Mdep_GetCpuStat ( \r
- DT_CpuStat *cpu_stat )\r
-{\r
-#if defined(__linux__)\r
-\r
- #define DT_CPU_STAT_STR "cpu"\r
- #define DT_CPU_STAT_BUFFER_SIZE 1024\r
- #define DT_CPU_STAT_DELIMITER " "\r
-\r
- static char buffer[DT_CPU_STAT_BUFFER_SIZE];\r
-\r
- if ( 0 != fflush (Stat_Fp) )\r
- {\r
- perror ("fflush of " DT_STAT_FILE " failed");\r
- exit (1);\r
- }\r
-\r
- for (;;)\r
- {\r
- if ( NULL == fgets (buffer, DT_CPU_STAT_BUFFER_SIZE, Stat_Fp) )\r
- {\r
- printf (DT_CPU_STAT_STR " not found\n");\r
- exit (1);\r
- }\r
-\r
- if ( !strncmp (buffer, DT_CPU_STAT_STR, strlen (DT_CPU_STAT_STR) ) )\r
- {\r
- break;\r
- }\r
- }\r
-\r
- (void) strtok (buffer, DT_CPU_STAT_DELIMITER);\r
- cpu_stat->user = strtoul (strtok (NULL, DT_CPU_STAT_DELIMITER), NULL, 0);\r
- cpu_stat->user += strtoul (strtok (NULL, DT_CPU_STAT_DELIMITER), NULL, 0);\r
- cpu_stat->system = strtoul (strtok (NULL, DT_CPU_STAT_DELIMITER), NULL, 0);\r
- cpu_stat->idle = strtoul (strtok (NULL, DT_CPU_STAT_DELIMITER), NULL, 0);\r
-\r
- rewind (Stat_Fp);\r
-\r
- return true;\r
-\r
-#elif defined(__solaris__)\r
- /* FIXME not implemented */\r
- return true;\r
-#elif defined(WIN32)\r
- /* FIXME not implemented */\r
- return true;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Get current time in milliseconds (relative to some fixed point)\r
- */\r
-unsigned long\r
-DT_Mdep_GetTime (void)\r
-{\r
-#if defined(__linux__)\r
- struct tms ts;\r
- clock_t t = times (&ts);\r
- return (unsigned long) ((DAT_UINT64) t * 1000 / CLK_TCK);\r
-#elif defined(__solaris__)\r
- struct tms ts;\r
- clock_t t = times (&ts);\r
- return (unsigned long) ((DAT_UINT64) t * 1000 / CLK_TCK);\r
-#elif defined(WIN32)\r
- return GetTickCount ();\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-double\r
-DT_Mdep_GetCpuMhz (\r
- void )\r
-{\r
-#if defined(__linux__)\r
- #define DT_CPU_MHZ_BUFFER_SIZE 128\r
- #define DT_CPU_MHZ_MHZ "cpu MHz"\r
- #define DT_CPU_MHZ_DELIMITER ":"\r
-\r
- FILE *fp;\r
- char buffer[DT_CPU_MHZ_BUFFER_SIZE];\r
- char *mhz_str;\r
-\r
- fp = fopen ("/proc/cpuinfo", "r");\r
- if ( NULL == fp )\r
- {\r
- perror ("fopen of /proc/cpuinfo failed");\r
- exit (1);\r
- }\r
-\r
- for (;;)\r
- {\r
- if ( NULL == fgets (buffer, DT_CPU_MHZ_BUFFER_SIZE, fp) )\r
- {\r
- printf ("cpu MHZ not found\n");\r
- exit (1);\r
- }\r
-\r
- if ( !strncmp (buffer, DT_CPU_MHZ_MHZ, strlen (DT_CPU_MHZ_MHZ) ) )\r
- {\r
- (void) strtok (buffer, DT_CPU_MHZ_DELIMITER);\r
- mhz_str = strtok (NULL, DT_CPU_MHZ_DELIMITER);\r
-\r
- break;\r
- }\r
- }\r
-\r
- if ( 0 != fclose (fp) )\r
- {\r
- perror ("fclose of /proc/cpuinfo failed");\r
- exit (1);\r
- }\r
-\r
- return strtod (mhz_str, NULL);\r
-#elif defined(WIN32)\r
- LONG retVal;\r
- HKEY hKey;\r
- DWORD cpuSpeed = 0;\r
- DWORD dataSize = sizeof (DWORD);\r
-\r
- /* For windows need to query the registry to get the CPU\r
- * Information...-SVSV */\r
- retVal = RegOpenKeyEx (HKEY_LOCAL_MACHINE,\r
- TEXT ("Hardware\\Description\\System\\CentralProcessor\\0"),\r
- 0,\r
- KEY_QUERY_VALUE,\r
- &hKey);\r
-\r
- if (retVal == ERROR_SUCCESS)\r
- {\r
- retVal = RegQueryValueEx (hKey,\r
- TEXT ("~MHz"), NULL, NULL,\r
- (LPBYTE)&cpuSpeed, &dataSize);\r
-\r
- }\r
-\r
- RegCloseKey (hKey);\r
-\r
- return cpuSpeed;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-\r
-unsigned long \r
-DT_Mdep_GetContextSwitchNum (void )\r
-{\r
-#if defined(__linux__)\r
-\r
- #define DT_CTXT_STR "ctxt"\r
- #define DT_CTXT_BUFFER_SIZE 1024\r
- #define DT_CTXT_DELIMITER " "\r
-\r
- static char buffer[DT_CTXT_BUFFER_SIZE];\r
- char *ctxt_str;\r
-\r
- if ( 0 != fflush (Stat_Fp) )\r
- {\r
- perror ("fflush of " DT_STAT_FILE " failed");\r
- exit (1);\r
- }\r
-\r
- for (;;)\r
- {\r
- if ( NULL == fgets (buffer, DT_CTXT_BUFFER_SIZE, Stat_Fp) )\r
- {\r
- printf (DT_CTXT_STR " not found\n");\r
- exit (1);\r
- }\r
-\r
- if ( !strncmp (buffer, DT_CTXT_STR, strlen (DT_CTXT_STR) ) )\r
- {\r
- (void) strtok (buffer, DT_CTXT_DELIMITER);\r
- ctxt_str = strtok (NULL, DT_CTXT_DELIMITER);\r
-\r
- break;\r
- }\r
- }\r
-\r
- rewind (Stat_Fp);\r
-\r
- return strtoul (ctxt_str, NULL, 0);\r
-#elif defined(WIN32)\r
- return 0;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Memory allocate and free routines for control blocks (objects) - regular\r
- * memory, always zeroed.\r
- */\r
-void *\r
-DT_Mdep_Malloc (size_t l_)\r
-{\r
- void *rval;\r
-\r
- /*\r
- * check memory leaking DT_Mdep_Lock(&Alloc_Count_Lock); alloc_count++;\r
- * DT_Mdep_Unlock(&Alloc_Count_Lock);\r
- */\r
-\r
-#if defined(__linux__)\r
- rval = malloc (l_);\r
-#elif defined(__solaris__)\r
- rval = malloc (l_);\r
-#elif defined(WIN32)\r
- rval = malloc (l_);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-\r
- if (rval)\r
- {\r
- memset (rval, 0, l_);\r
- }\r
- return ( rval );\r
-}\r
-\r
-void\r
-DT_Mdep_Free (void *a_)\r
-{\r
- /*\r
- * check memory leaking DT_Mdep_Lock(&Alloc_Count_Lock); alloc_count--;\r
- * DT_Mdep_Unlock(&Alloc_Count_Lock);\r
- */\r
-\r
-#if defined(__linux__)\r
- free (a_);\r
-#elif defined(__solaris__)\r
- free (a_);\r
-#elif defined(WIN32)\r
- free (a_);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Lock support\r
- *\r
- * Lock object constructor\r
- */\r
-bool\r
-DT_Mdep_LockInit (DT_Mdep_LockType * lock_ptr)\r
-{\r
-#if defined(__linux__)\r
- return pthread_mutex_init (lock_ptr, 0) ? false : true;\r
-#elif defined(__solaris__)\r
- return pthread_mutex_init (lock_ptr, 0) ? false : true;\r
-#elif defined(WIN32)\r
- *lock_ptr = CreateMutex (0, FALSE, 0);\r
- return *lock_ptr ? true : false;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Lock object destructor\r
- */\r
-void\r
-DT_Mdep_LockDestroy (DT_Mdep_LockType * lock_ptr)\r
-{\r
-#if defined(__linux__)\r
- pthread_mutex_destroy (lock_ptr);\r
-#elif defined(__solaris__)\r
- pthread_mutex_destroy (lock_ptr);\r
-#elif defined(WIN32)\r
- CloseHandle (*lock_ptr);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Lock\r
- */\r
-void\r
-DT_Mdep_Lock (DT_Mdep_LockType * lock_ptr)\r
-{\r
-#if defined(__linux__)\r
- pthread_mutex_lock (lock_ptr);\r
-#elif defined(__solaris__)\r
- pthread_mutex_lock (lock_ptr);\r
-#elif defined(WIN32)\r
- WaitForSingleObject (*lock_ptr, INFINITE);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * unlock\r
- */\r
-void\r
-DT_Mdep_Unlock (DT_Mdep_LockType * lock_ptr)\r
-{\r
-#if defined(__linux__)\r
- pthread_mutex_unlock (lock_ptr);\r
-#elif defined(__solaris__)\r
- pthread_mutex_unlock (lock_ptr);\r
-#elif defined(WIN32)\r
- ReleaseMutex (*lock_ptr);\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Init Thread Attributes\r
- */\r
-void\r
-DT_Mdep_Thread_Init_Attributes (Thread * thread_ptr)\r
-{\r
-#if defined(__linux__)\r
- pthread_attr_init (&thread_ptr->attr);\r
- pthread_attr_setstacksize (&thread_ptr->attr, thread_ptr->stacksize);\r
- /* Create thread in detached state to free resources on termination;\r
- * this precludes doing a pthread_join, but we don't do it\r
- */\r
- pthread_attr_setdetachstate (&thread_ptr->attr, PTHREAD_CREATE_DETACHED);\r
-#elif defined(__solaris__)\r
- pthread_attr_init (&thread_ptr->attr);\r
- pthread_attr_setstacksize (&thread_ptr->attr, thread_ptr->stacksize);\r
- /* Create thread in detached state to free resources on termination;\r
- * this precludes doing a pthread_join, but we don't do it\r
- */\r
- pthread_attr_setdetachstate (&thread_ptr->attr, PTHREAD_CREATE_DETACHED);\r
-\r
-#elif defined(WIN32)\r
- /* nothing */\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Destroy Thread Attributes\r
- */\r
-void\r
-DT_Mdep_Thread_Destroy_Attributes (Thread * thread_ptr)\r
-{\r
-#if defined(__linux__)\r
- pthread_attr_destroy (&thread_ptr->attr);\r
-#elif defined(__solaris__)\r
- pthread_attr_destroy (&thread_ptr->attr);\r
-#elif defined(WIN32)\r
- /* nothing */\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Start the thread\r
- */\r
-bool\r
-DT_Mdep_Thread_Start (Thread * thread_ptr)\r
-{\r
-#if defined(__linux__)\r
- return pthread_create (&thread_ptr->thread_handle,\r
- &thread_ptr->attr,\r
- DT_Mdep_Thread_Start_Routine,\r
- thread_ptr) == 0;\r
-#elif defined(__solaris__)\r
- return pthread_create (&thread_ptr->thread_handle,\r
- &thread_ptr->attr,\r
- DT_Mdep_Thread_Start_Routine,\r
- thread_ptr) == 0;\r
-#elif defined(WIN32)\r
- thread_ptr->thread_handle =\r
- CreateThread (NULL,\r
- thread_ptr->stacksize,\r
- (LPTHREAD_START_ROUTINE)thread_ptr->function,\r
- thread_ptr->param,\r
- 0,\r
- thread_ptr->threadId); // NULL);\r
- if (thread_ptr->thread_handle == NULL)\r
- {\r
- return false;\r
- }\r
- return true;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Thread execution entry point function\r
- */\r
-DT_Mdep_Thread_Start_Routine_Return_Type \r
-DT_Mdep_Thread_Start_Routine (void *thread_handle)\r
-{\r
- Thread *thread_ptr;\r
- thread_ptr = (Thread *) thread_handle;\r
-\r
- thread_ptr->function (thread_ptr->param);\r
-#if defined(__linux__)\r
- return 0;\r
-#elif defined(__solaris__)\r
- return 0;\r
-#elif defined(WIN32)\r
- /* nothing */\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Thread detach routine. Allows the pthreads\r
- * interface to clean up resources properly at\r
- * thread's end.\r
- */\r
-void DT_Mdep_Thread_Detach ( int thread_id ) /* AMM */\r
-{\r
-\r
-#if defined(__linux__)\r
-\r
- pthread_detach(thread_id);\r
-#elif defined(__solaris__)\r
- pthread_detach( thread_id);\r
-#elif defined(WIN32)\r
-\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Allows a thread to get its own ID so it\r
- * can pass it to routines wanting to act\r
- * upon themselves. \r
- */\r
-\r
-int DT_Mdep_Thread_SELF (void) /* AMM */\r
-{\r
-\r
-#if defined(__linux__)\r
-\r
- return (pthread_self());\r
-#elif defined(__solaris__)\r
-\r
- return (pthread_self());\r
-#elif defined(WIN32)\r
- return 0;\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-\r
-/*\r
- * Allow a thread to exit and cleanup resources. \r
- */\r
-\r
-void DT_Mdep_Thread_EXIT ( void * thread_handle ) /* AMM */\r
-{\r
-\r
-#if defined(__linux__)\r
-\r
- pthread_exit( thread_handle );\r
-#elif defined(__solaris__)\r
-\r
- pthread_exit( thread_handle );\r
-#elif defined(WIN32)\r
- /* nothing */\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * DT_Mdep_wait_object_init\r
- *\r
- * Initialize a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * 0 if successful\r
- * -1 if unsuccessful\r
- */\r
-int\r
-DT_Mdep_wait_object_init (\r
- IN DT_WAIT_OBJECT *wait_obj)\r
-{\r
-\r
-#if defined(__linux__) || defined(__solaris__)\r
-\r
- wait_obj->signaled = DAT_FALSE;\r
- if ( 0 != pthread_cond_init ( &wait_obj->cv, NULL ) )\r
- {\r
- return (-1);\r
- }\r
-\r
- /* Always returns 0. */\r
- pthread_mutex_init ( &wait_obj->lock, NULL );\r
- return 0;\r
-#elif defined(WIN32)\r
- *wait_obj = CreateEvent(NULL,FALSE,FALSE,NULL);\r
-\r
- if ( *wait_obj == NULL )\r
- {\r
- return -1;\r
- }\r
-\r
- return 0;\r
-\r
-\r
-#else\r
- #error "Undefined Platform"\r
-\r
-#endif\r
-\r
-}\r
-\r
-\r
-/* Wait on the supplied wait object, up to the specified time_out.\r
- * A timeout of DAT_TIMEOUT_INFINITE will wait indefinitely.\r
- * Timeout should be specified in micro seconds.\r
- *\r
- * Functional returns:\r
- * 0 -- another thread invoked dapl_os_wait object_wakeup\r
- * -1 -- someone else is already waiting in this wait\r
- * object.\r
- * only one waiter is allowed at a time.\r
- * -1 -- another thread invoked dapl_os_wait_object_destroy\r
- * -1 -- the specified time limit was reached.\r
- */\r
-\r
-int\r
-DT_Mdep_wait_object_wait (\r
- IN DT_WAIT_OBJECT *wait_obj, \r
- IN int timeout_val)\r
-{\r
-#if defined(__linux__) || defined(__solaris__)\r
-\r
- int dat_status;\r
- int pthread_status;\r
- struct timespec future;\r
-\r
- dat_status = 0;\r
- pthread_status = 0;\r
-\r
- if ( timeout_val != DAT_TIMEOUT_INFINITE )\r
- {\r
- struct timeval now;\r
- struct timezone tz;\r
- unsigned int microsecs;\r
-\r
- gettimeofday (&now, &tz);\r
- microsecs = now.tv_usec + (timeout_val % 1000000);\r
- if (microsecs > 1000000)\r
- {\r
- now.tv_sec = now.tv_sec + timeout_val / 1000000 + 1;\r
- now.tv_usec = microsecs - 1000000;\r
- }\r
- else\r
- {\r
- now.tv_sec = now.tv_sec + timeout_val / 1000000;\r
- now.tv_usec = microsecs;\r
- }\r
-\r
- /* Convert timeval to timespec */\r
- future.tv_sec = now.tv_sec;\r
- future.tv_nsec = now.tv_usec * 1000;\r
-\r
- pthread_mutex_lock (&wait_obj->lock);\r
- while ( wait_obj->signaled == DAT_FALSE && pthread_status == 0)\r
- {\r
- pthread_status = pthread_cond_timedwait (\r
- &wait_obj->cv , &wait_obj->lock , &future );\r
-\r
- /*\r
- * No need to reset &future if we go around the loop;\r
- * It's an absolute time.\r
- */\r
- }\r
- /* Reset the signaled status if we were woken up. */\r
- if (pthread_status == 0)\r
- {\r
- wait_obj->signaled = false;\r
- }\r
- pthread_mutex_unlock (&wait_obj->lock);\r
- }\r
- else\r
- {\r
- pthread_mutex_lock (&wait_obj->lock);\r
- while ( wait_obj->signaled == DAT_FALSE && pthread_status == 0)\r
- {\r
- pthread_status = pthread_cond_wait (\r
- &wait_obj->cv , &wait_obj->lock );\r
- }\r
- /* Reset the signaled status if we were woken up. */\r
- if (pthread_status == 0)\r
- {\r
- wait_obj->signaled = false;\r
- }\r
- pthread_mutex_unlock (&wait_obj->lock);\r
- }\r
-\r
- if (ETIMEDOUT == pthread_status)\r
- {\r
- return (-1);\r
- }\r
- else if ( 0 != pthread_status)\r
- {\r
- return (-1);\r
- }\r
-\r
- return 0;\r
-\r
-#elif defined(WIN32)\r
-\r
- DAT_RETURN status;\r
- DWORD op_status;\r
-\r
- status = DAT_SUCCESS;\r
-\r
- if ( DAT_TIMEOUT_INFINITE == timeout_val )\r
- {\r
- op_status = WaitForSingleObject(*wait_obj, INFINITE);\r
- }\r
- else\r
- {\r
- /* convert to milliseconds */\r
- op_status = WaitForSingleObject(*wait_obj, timeout_val/1000);\r
- }\r
-\r
- if (op_status == WAIT_TIMEOUT)\r
- {\r
- status = DAT_CLASS_ERROR | DAT_TIMEOUT_EXPIRED;\r
- }\r
- else if ( op_status == WAIT_FAILED)\r
- {\r
- status = DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return status;\r
-\r
-#else\r
- #error "Undefined Platform"\r
-\r
-#endif\r
-}\r
-\r
-\r
-/*\r
- * DT_Mdep_wait_object_wakeup\r
- *\r
- * Wakeup a thread waiting on a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * 0 if successful\r
- * -1 if not successful\r
- */\r
-int\r
-DT_Mdep_wait_object_wakeup (\r
- DT_WAIT_OBJECT *wait_obj )\r
-{\r
-#if defined(__linux__) || defined(__solaris__)\r
-\r
- pthread_mutex_lock ( &wait_obj->lock );\r
- wait_obj->signaled = true;\r
- pthread_mutex_unlock ( &wait_obj->lock );\r
- if ( 0 != pthread_cond_signal ( &wait_obj->cv ) )\r
- {\r
- return (-1);\r
- }\r
-\r
- return 0;\r
-\r
-#elif defined(WIN32)\r
- DWORD op_status;\r
-\r
- op_status = SetEvent(*wait_obj);\r
- if ( op_status == 0 )\r
- {\r
- return DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return DAT_SUCCESS;\r
-\r
-\r
-#else\r
- #error "Undefined Platform"\r
-\r
-#endif\r
-\r
-}\r
-\r
-\r
-/*\r
- * DT_Mdep_wait_object_destroy\r
- *\r
- * Destroy a wait object\r
- *\r
- * Input:\r
- * wait_obj\r
- *\r
- * Returns:\r
- * 0 if successful\r
- * -1 if not successful\r
- */\r
-int\r
-DT_Mdep_wait_object_destroy (\r
- IN DT_WAIT_OBJECT *wait_obj)\r
-{\r
-#if defined(__linux__) || defined(__solaris__)\r
-\r
- if ( 0 != pthread_cond_destroy ( &wait_obj->cv ) )\r
- {\r
- return (-1);\r
- }\r
- if ( 0 != pthread_mutex_destroy ( &wait_obj->lock ) )\r
- {\r
- return (-1);\r
- }\r
-\r
- return 0;\r
-\r
-\r
-#elif defined(WIN32)\r
-\r
- DWORD op_status;\r
- DAT_RETURN status = DAT_SUCCESS;\r
-\r
- op_status = CloseHandle(*wait_obj);\r
-\r
- if ( op_status == 0 )\r
- {\r
- status = DAT_CLASS_ERROR | DAT_INTERNAL_ERROR;\r
- }\r
-\r
- return status;\r
-\r
-#else\r
- #error "Undefined Platform"\r
-\r
-#endif\r
-\r
-\r
-\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_MDEP_H__\r
-#define __DAPL_MDEP_H__\r
-\r
-/* include files */\r
-\r
-#include <ctype.h>\r
-\r
-#if defined (__linux__)\r
-# include <stdlib.h>\r
-# include <inttypes.h>\r
-# include <netdb.h>\r
-# include <unistd.h>\r
-# include <pthread.h>\r
-# include <stdio.h>\r
-# include <string.h>\r
-# include <sys/times.h>\r
-\r
-#ifdef IA64\r
-# include <asm/timex.h>\r
-#endif\r
-\r
-#elif defined(__solaris__)\r
-# include <sys/int_types.h>\r
-# include <netdb.h>\r
-# include <unistd.h>\r
-# include <pthread.h>\r
-# include <stdio.h>\r
-# include <string.h>\r
-#elif defined (WIN32)\r
-# include <windows.h>\r
-# include <process.h>\r
-# include <stdio.h>\r
-# include <string.h>\r
-# include <winsock2.h>\r
-# include <ws2tcpip.h>\r
-#else\r
-# error "Undefined Platform"\r
-#endif\r
-\r
-/* Default Device Name */\r
-#if defined(__linux__)\r
-#define DT_MdepDeviceName "jni0a"\r
-\r
-#elif defined(__solaris__)\r
-#define DT_MdepDeviceName "jni0a"\r
-\r
-#elif defined(WIN32)\r
-#define DT_MdepDeviceName "ibnic0"\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-/* Boolean */\r
-#if defined(__linux__)\r
-typedef int bool;\r
-#elif defined(__solaris__)\r
-typedef int bool;\r
-#elif defined (WIN32)\r
-typedef int bool;\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-#define true (1)\r
-#define false (0)\r
-\r
-#ifndef __BASE_FILE__\r
-#define __BASE_FILE__ __FILE__\r
-#endif /* WIN32 */\r
-\r
-#ifndef _INLINE_\r
-#if defined(__linux__)\r
-#define _INLINE_ __inline__\r
-#elif defined(WIN32)\r
-#define _INLINE_ __inline\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-#endif\r
-\r
-/* Mdep function defines */\r
-\r
-#define DT_Mdep_spew(N, _X_) \\r
-{ \\r
- if (DT_dapltest_debug >= (N)) \\r
- { \\r
- DT_Mdep_printf _X_; \\r
- } \\r
-}\r
-\r
-#define DT_Mdep_debug(_X_) DT_Mdep_spew(1, _X_)\r
-\r
-#if defined(__linux__)\r
-#define DT_Mdep_printf printf\r
-#define DT_Mdep_vprintf vprintf\r
-#define DT_Mdep_flush() fflush(NULL)\r
-\r
-#elif defined(__solaris__)\r
-#define DT_Mdep_printf printf\r
-#define DT_Mdep_flush() fflush(NULL)\r
-\r
-#elif defined(WIN32)\r
-#define DT_Mdep_printf printf\r
-#define DT_Mdep_flush() fflush(NULL)\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-\r
-/*\r
- * Locks\r
- */\r
-\r
-#if defined(__linux__)\r
-typedef pthread_mutex_t DT_Mdep_LockType;\r
-\r
-#elif defined(__solaris__)\r
-typedef pthread_mutex_t DT_Mdep_LockType;\r
-\r
-#elif defined(WIN32)\r
-typedef __declspec(align(8)) HANDLE DT_Mdep_LockType;\r
-\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-/* Wait object used for inter thread communication */\r
-\r
-#if defined(__linux__)\r
-typedef struct\r
-{\r
- bool signaled;\r
- pthread_cond_t cv;\r
- pthread_mutex_t lock;\r
-} DT_WAIT_OBJECT;\r
-\r
-#elif defined(__solaris__)\r
-\r
-typedef struct\r
-{\r
- bool signaled;\r
- pthread_cond_t cv;\r
- pthread_mutex_t lock;\r
-} DT_WAIT_OBJECT;\r
-\r
-#elif defined(WIN32)\r
-\r
-typedef __declspec(align(8)) HANDLE DT_WAIT_OBJECT;\r
-\r
-#else\r
-\r
-#endif\r
-\r
-/*\r
- * Thread types\r
- */\r
-#if defined(__linux__)\r
-typedef pthread_t DT_Mdep_ThreadHandleType;\r
-typedef void (*DT_Mdep_ThreadFunction) (void *param);\r
-typedef void * DT_Mdep_Thread_Start_Routine_Return_Type;\r
-#define DT_MDEP_DEFAULT_STACK_SIZE 65536\r
-\r
-#elif defined(__solaris__)\r
-typedef pthread_t DT_Mdep_ThreadHandleType;\r
-typedef void (*DT_Mdep_ThreadFunction) (void *param);\r
-typedef void * DT_Mdep_Thread_Start_Routine_Return_Type;\r
-#define DT_MDEP_DEFAULT_STACK_SIZE 65536\r
-\r
-#elif defined(WIN32) || defined(_WIN64)\r
-typedef __declspec(align(8)) HANDLE DT_Mdep_ThreadHandleType;\r
-typedef void (*DT_Mdep_ThreadFunction) (void *param);\r
-typedef void DT_Mdep_Thread_Start_Routine_Return_Type;\r
-#define DT_MDEP_DEFAULT_STACK_SIZE 65536\r
-\r
-#else\r
-#error "Undefined Platform"\r
-#endif\r
-\r
-typedef __declspec(align(8)) struct\r
-{\r
- void (*function) (void *);\r
- void *param;\r
- DT_Mdep_ThreadHandleType thread_handle;\r
- unsigned int stacksize;\r
-#if defined(__solaris__)||defined(__linux__)\r
- pthread_attr_t attr; /* Thread attributes */\r
-#endif\r
-#if defined (WIN32)\r
- LPDWORD threadId;\r
-#endif\r
-} Thread;\r
-\r
-/*\r
- * System information\r
- *\r
- */\r
-\r
-typedef struct\r
-{\r
- unsigned long int system;\r
- unsigned long int user;\r
- unsigned long int idle;\r
-} DT_CpuStat;\r
-\r
-/*\r
- * Timing\r
- */\r
-\r
-#if defined(__linux__)\r
-typedef unsigned long long int DT_Mdep_TimeStamp;\r
-#elif defined(WIN32)\r
-typedef unsigned __int64 DT_Mdep_TimeStamp;\r
-#else\r
-# error "Undefined Platform"\r
-#endif\r
-\r
-static _INLINE_ DT_Mdep_TimeStamp\r
-DT_Mdep_GetTimeStamp ( void )\r
-{\r
-#if defined(__linux__)\r
-#if defined(__GNUC__) && defined(__PENTIUM__)\r
- DT_Mdep_TimeStamp x;\r
- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));\r
- return x;\r
-#else\r
-\r
-#ifdef IA64\r
- unsigned long x;\r
-\r
- x = get_cycles ();\r
- return x;\r
-#else\r
- #error "Non-Pentium Linux - unimplemented"\r
-#endif\r
-#endif\r
-\r
-#elif defined(WIN32)\r
-#if !defined (WIN64) && !defined (IA64) && !defined (AMD64)\r
- _asm rdtsc\r
-#else\r
-#ifdef AMD64\r
- return __rdtsc();\r
-#else\r
- LARGE_INTEGER val;\r
- QueryPerformanceCounter( &val );\r
- return val.QuadPart;\r
-#endif //endif WIN64\r
-\r
-#endif //endif WIN64, and IA64\r
-\r
-#else\r
- #error "Undefined Platform"\r
-#endif\r
-}\r
-\r
-/*\r
- * Define types for Window compatibility\r
- */\r
-#if defined(WIN32)\r
-\r
-#if !defined(IA64) && !defined(WIN64)\r
-#include <stddef.h>\r
-#endif\r
-\r
-typedef __int64 int64_t;\r
-typedef unsigned __int64 uint64_t;\r
-typedef __int32 int32_t;\r
-typedef unsigned __int32 uint32_t;\r
-\r
-\r
-#define bzero(x, y) memset(x, 0, y)\r
-\r
-#endif\r
-\r
-/*\r
- * Define long format types to be used in *printf format strings. We\r
- * use the C string constant concatenation ability to define 64 bit\r
- * formats, which unfortunatly are non standard in the C compiler\r
- * world. E.g. %llx for gcc, %I64x for Windows\r
- */\r
-#if defined(WIN32)\r
-#define F64d "%I64d"\r
-#define F64u "%I64u"\r
-#define F64x "%I64x"\r
-#define F64X "%I64X"\r
-\r
-#elif defined(__linux__)\r
-\r
-#define F64d "%lld"\r
-#define F64u "%llu"\r
-#define F64x "%llx"\r
-#define F64X "%llX"\r
-#endif\r
-\r
-\r
-/*\r
- * Define notion of a LONG LONG 0\r
- */\r
-#if defined(__linux__)\r
-#define LZERO 0ULL\r
-#elif defined(WIN32)\r
-#define LZERO 0UL\r
-#else\r
-#define LZERO 0\r
-#endif\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-\r
-\r
-void\r
-DT_MemListInit (Per_Test_Data_t * pt_ptr)\r
-{\r
- DT_Mdep_LockInit (&pt_ptr->MemListLock);\r
- pt_ptr->MemListHead = 0;\r
-}\r
-\r
-void *\r
-DT_MemListAlloc (Per_Test_Data_t * pt_ptr, char *file, mem_type_e t, int size)\r
-{\r
- void *buffptr;\r
- MemListEntry_t *entry_ptr;\r
- buffptr = 0;\r
- entry_ptr = 0;\r
-\r
- buffptr = DT_Mdep_Malloc (size);\r
- if (buffptr == 0)\r
- {\r
- return 0;\r
- }\r
- if (pt_ptr == 0) /* not use mem_list */\r
- {\r
- return buffptr;\r
- }\r
- entry_ptr = (MemListEntry_t *) DT_Mdep_Malloc (sizeof (MemListEntry_t));\r
- if (entry_ptr == 0)\r
- {\r
- DT_Mdep_Free (buffptr);\r
- return 0;\r
- }\r
- strcpy (entry_ptr->filename, file);\r
- entry_ptr->MemType = t;\r
- entry_ptr->mem_ptr = buffptr;\r
-\r
- DT_Mdep_Lock (&pt_ptr->MemListLock);\r
- entry_ptr->next = pt_ptr->MemListHead;\r
- pt_ptr->MemListHead = entry_ptr;\r
- DT_Mdep_Unlock (&pt_ptr->MemListLock);\r
-\r
- return buffptr;\r
-}\r
-\r
-void\r
-DT_MemListFree (Per_Test_Data_t * pt_ptr, void *ptr)\r
-{\r
- MemListEntry_t *pre, *cur;\r
- if (pt_ptr == 0) /* not use mem_list */\r
- {\r
- DT_Mdep_Free (ptr);\r
- return;\r
- }\r
- DT_Mdep_Lock (&pt_ptr->MemListLock);\r
- pre = 0;\r
- cur = pt_ptr->MemListHead;\r
- while (cur)\r
- {\r
- if (cur->mem_ptr == ptr)\r
- {\r
- if (!pre) /* first entry */\r
- {\r
- pt_ptr->MemListHead = cur->next;\r
- cur->next = 0;\r
- }\r
- else\r
- {\r
- pre->next = cur->next;\r
- cur->next = 0;\r
- }\r
- DT_Mdep_Free (ptr);\r
- DT_Mdep_Free (cur);\r
- goto unlock_and_return;\r
- }\r
- pre = cur;\r
- cur = cur->next;\r
- }\r
-unlock_and_return:\r
- DT_Mdep_Unlock (&pt_ptr->MemListLock);\r
-}\r
-\r
-void\r
-DT_PrintMemList (Per_Test_Data_t * pt_ptr)\r
-{\r
- char *type[10] =\r
- {\r
- "BPOOL", "BUFF", "PERTESTDATA", "IBNIC", "NETADDRESS",\r
- "TRANSACTIONTEST", "THREAD", "EPCONTEXT"\r
- };\r
- MemListEntry_t *cur;\r
-\r
- DT_Mdep_Lock (&pt_ptr->MemListLock);\r
- cur = pt_ptr->MemListHead;\r
- if (cur != 0)\r
- {\r
- DT_Mdep_printf ("the allocated memory that have not been returned are:\n");\r
- }\r
- while (cur)\r
- {\r
- DT_Mdep_printf ("file: dapl_%s, \tMemType:%s\n",\r
- cur->filename, type[cur->MemType]);\r
- cur = cur->next;\r
- }\r
- DT_Mdep_Unlock (&pt_ptr->MemListLock);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_MEMLIST_H__\r
-#define __DAPL_MEMLIST_H__\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-\r
-typedef enum\r
-{\r
- BPOOL,\r
- BUFF,\r
- PERTESTDATA,\r
- IBNIC,\r
- NETADDRESS,\r
- TRANSACTIONTEST,\r
- THREAD,\r
- EPCONTEXT\r
-} mem_type_e;\r
-\r
-struct Mem_list_entry\r
-{\r
- char filename[50];\r
- mem_type_e MemType;\r
- void *mem_ptr;\r
- struct Mem_list_entry *next;\r
-};\r
-\r
-typedef struct Mem_list_entry MemListEntry_t;\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_cnxn.h"\r
-#include <dat/udat.h>\r
-\r
-\r
-DAT_IA_ADDRESS_PTR\r
-DT_NetAddrAlloc (Per_Test_Data_t * pt_ptr)\r
-{\r
- DAT_IA_ADDRESS_PTR netaddr;\r
-\r
- netaddr = (DAT_IA_ADDRESS_PTR) DT_MemListAlloc (pt_ptr, "netaddr",\r
- NETADDRESS, sizeof (DAT_SOCK_ADDR));\r
- if (!netaddr)\r
- {\r
- DT_Mdep_printf ("dapltest: No Memory to create netaddr!\n");\r
- }\r
- return netaddr;\r
-}\r
-\r
-\r
-void\r
-DT_NetAddrFree (Per_Test_Data_t * pt_ptr, DAT_IA_ADDRESS_PTR netaddr)\r
-{\r
- DT_MemListFree (pt_ptr, netaddr);\r
-}\r
-\r
-\r
-bool\r
-DT_NetAddrLookupHostAddress (DAT_IA_ADDRESS_PTR to_netaddr,\r
- DAT_NAME_PTR hostname)\r
-{\r
- struct addrinfo *target;\r
- int rval;\r
-\r
- rval = getaddrinfo (hostname, NULL, NULL, &target);\r
- if (rval != 0)\r
- {\r
- char *whatzit = "unknown error return";\r
-\r
- switch (rval)\r
- {\r
- case EAI_FAMILY:\r
- {\r
- whatzit = "unsupported address family";\r
- break;\r
- }\r
- case EAI_SOCKTYPE:\r
- {\r
- whatzit = "unsupported socket type";\r
- break;\r
- }\r
- case EAI_BADFLAGS:\r
- {\r
- whatzit = "invalid flags";\r
- break;\r
- }\r
- case EAI_NONAME:\r
- {\r
- whatzit = "unknown node name";\r
- break;\r
- }\r
- case EAI_SERVICE:\r
- {\r
- whatzit = "service unavailable";\r
- break;\r
- }\r
-#if !defined(WIN32)\r
- case EAI_ADDRFAMILY:\r
- {\r
- whatzit = "node has no address in this family";\r
- break;\r
- }\r
- case EAI_NODATA:\r
- {\r
- whatzit = "node has no addresses defined";\r
- break;\r
- }\r
-#endif\r
- case EAI_MEMORY:\r
- {\r
- whatzit = "out of memory";\r
- break;\r
- }\r
- case EAI_FAIL:\r
- {\r
- whatzit = "permanent name server failure";\r
- break;\r
- }\r
- case EAI_AGAIN:\r
- {\r
- whatzit = "temporary name server failure";\r
- break;\r
- }\r
-#if !defined(WIN32)\r
- case EAI_SYSTEM:\r
- {\r
- whatzit = "system error";\r
- break;\r
- }\r
-#endif\r
- }\r
-\r
- DT_Mdep_printf ("getnameinfo (%s) failed (%s)\n",\r
- hostname, whatzit);\r
- return DAT_FALSE;\r
- }\r
-\r
- /* Pull out IP address and print it as a sanity check */\r
- rval = ((struct sockaddr_in *)target->ai_addr)->sin_addr.s_addr;\r
- DT_Mdep_printf ("Server Name: %s \n", hostname);\r
- DT_Mdep_printf ("Server Net Address: %d.%d.%d.%d\n",\r
- (rval >> 0) & 0xff,\r
- (rval >> 8) & 0xff,\r
- (rval >> 16) & 0xff,\r
- (rval >> 24) & 0xff);\r
-\r
- *to_netaddr = * ((DAT_IA_ADDRESS_PTR) target->ai_addr);\r
-\r
- return ( DAT_TRUE );\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_getopt.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-\r
-#include "dapl_server_cmd.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_quit_cmd.h"\r
-#include "dapl_limit_cmd.h"\r
-\r
-#define MAX_ARGC 500\r
-#define MAX_ARG_LEN 100\r
-\r
-\r
-/* Parse command line arguments */\r
-bool\r
-DT_Params_Parse (int argc, char *argv[], Params_t * params_ptr)\r
-{\r
- Server_Cmd_t *Server_Cmd;\r
- Transaction_Cmd_t *Transaction_Cmd;\r
- Performance_Cmd_t *Performance_Cmd;\r
- Quit_Cmd_t *Quit_Cmd;\r
- Limit_Cmd_t *Limit_Cmd;\r
- FFT_Cmd_t *FFT_Cmd;\r
-\r
- char *filename;\r
- FILE *fd;\r
- mygetopt_t opts;\r
- char c;\r
- char *cp;\r
- char *sp;\r
- char line[256];\r
- char *my_argv[MAX_ARGC];\r
- int my_argc;\r
- int i;\r
- DT_mygetopt_init (&opts);\r
- opts.opterr = 0; /* turn off automatical error handler */\r
-\r
- fd = 0;\r
- my_argc = 0;\r
- for (i = 0; i < MAX_ARGC; i++)\r
- {\r
- my_argv[i] = NULL;\r
- }\r
-\r
- /* dapltest with no arguments means run as a server with default values */\r
- if (argc == 1)\r
- {\r
- params_ptr->test_type = SERVER_TEST;\r
- params_ptr->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
- Server_Cmd = ¶ms_ptr->u.Server_Cmd;\r
- DT_Server_Cmd_Init (Server_Cmd);\r
- if (!DT_Mdep_GetDefaultDeviceName (Server_Cmd->dapl_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- return false;\r
- }\r
- return true;\r
- }\r
- /* check for a script file */\r
- if (strncmp (argv[1], "-f", 2) == 0)\r
- {\r
- if (argc == 2) /* dapltest -fdata */\r
- {\r
- filename = argv[1] + 2;\r
- }\r
- else\r
- {\r
- if (argc == 3 && strcmp (argv[1], "-f") == 0) /* dapltest -f data */\r
- {\r
- filename = argv[2];\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("-f <script_file> allows no additional options\n");\r
- goto main_usage;\r
- }\r
- }\r
-\r
- if (!filename || strlen (filename) == 0)\r
- {\r
- DT_Mdep_printf ("Missing <script_file> with -f option\n");\r
- goto main_usage;\r
- }\r
- /* read the script file and create a fake argc, argv */\r
- fd = fopen (filename, "r");\r
- if (fd == 0)\r
- {\r
- DT_Mdep_printf ("Cannot open script file: %s\n", filename);\r
- goto main_usage;\r
- }\r
- my_argc = 1;\r
- my_argv[0] = DT_Mdep_Malloc (MAX_ARG_LEN);\r
- if (!my_argv[0])\r
- {\r
- DT_Mdep_printf ("No Memory\n");\r
- goto error_return;\r
- }\r
- strcpy (my_argv[0], argv[0]);\r
- while (fgets (&line[0], 256, fd))\r
- {\r
- sp = &line[0];\r
- for (;;)\r
- {\r
- cp = strtok (sp, " \t\n");\r
- sp = 0; /* so can continue to parse this string */\r
- if (!cp) /* no more token found */\r
- {\r
- break;\r
- }\r
- if (*cp == '#') /* Comment; go to next line. */\r
- {\r
- break;\r
- }\r
- my_argv[my_argc] = DT_Mdep_Malloc (MAX_ARG_LEN);\r
- if (!my_argv[my_argc])\r
- {\r
- DT_Mdep_printf ("No Memory\n");\r
- goto error_return;\r
- }\r
- strcpy (my_argv[my_argc], cp);\r
- my_argc++;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- my_argc = argc;\r
- for (i = 0; i < argc; i++)\r
- {\r
- my_argv[i] = argv[i];\r
- }\r
- }\r
-\r
-#if 0\r
- for (i = 0; i < my_argc; i++)\r
- {\r
- DT_Mdep_printf ("ARG %s\n", my_argv[i]);\r
- }\r
- exit (1);\r
-#endif\r
-\r
- /* get test type - which must be the first arg */\r
- c = DT_mygetopt_r (my_argc, my_argv, "T:", &opts);\r
- if (c != 'T')\r
- {\r
- DT_Mdep_printf ("Must Specify Test (-T) option first\n");\r
- goto main_usage;\r
- }\r
- if ((opts.optarg == 0) || strlen (opts.optarg) == 0 || *opts.optarg == '-')\r
- {\r
- DT_Mdep_printf ("Must specify test type\n");\r
- goto main_usage;\r
- }\r
- switch (*opts.optarg)\r
- {\r
- case 'S': /* Server Test */\r
- {\r
- params_ptr->test_type = SERVER_TEST;\r
- Server_Cmd = ¶ms_ptr->u.Server_Cmd;\r
- DT_Server_Cmd_Init (Server_Cmd);\r
- if (!DT_Server_Cmd_Parse ( Server_Cmd,\r
- my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
- params_ptr->ReliabilityLevel = Server_Cmd->ReliabilityLevel;\r
- break;\r
- }\r
- case 'T': /* Transaction Test */\r
- {\r
- params_ptr->test_type = TRANSACTION_TEST;\r
- Transaction_Cmd = ¶ms_ptr->u.Transaction_Cmd;\r
- DT_Transaction_Cmd_Init (Transaction_Cmd);\r
- if (!DT_Transaction_Cmd_Parse ( Transaction_Cmd,\r
- my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
- params_ptr->ReliabilityLevel = Transaction_Cmd->ReliabilityLevel;\r
- break;\r
- }\r
- case 'P': /* Performance Test */\r
- {\r
- params_ptr->test_type = PERFORMANCE_TEST;\r
- Performance_Cmd = ¶ms_ptr->u.Performance_Cmd;\r
-\r
- if (!DT_Performance_Cmd_Init (Performance_Cmd))\r
- {\r
- goto error_return;\r
- }\r
-\r
- if (!DT_Performance_Cmd_Parse ( Performance_Cmd,\r
- my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
-\r
- params_ptr->ReliabilityLevel = Performance_Cmd->qos;\r
- break;\r
- }\r
- case 'Q': /* Quit server Test */\r
- {\r
- params_ptr->test_type = QUIT_TEST;\r
- Quit_Cmd = ¶ms_ptr->u.Quit_Cmd;\r
- DT_Quit_Cmd_Init (Quit_Cmd);\r
- if (!DT_Quit_Cmd_Parse ( Quit_Cmd,\r
- my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
- params_ptr->ReliabilityLevel = Quit_Cmd->ReliabilityLevel;\r
- break;\r
- }\r
- case 'L': /* Limit Test */\r
- {\r
- params_ptr->test_type = LIMIT_TEST;\r
- Limit_Cmd = ¶ms_ptr->u.Limit_Cmd;\r
- DT_Limit_Cmd_Init (Limit_Cmd);\r
- if (!DT_Limit_Cmd_Parse (Limit_Cmd,\r
- my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
- params_ptr->ReliabilityLevel = Limit_Cmd->ReliabilityLevel;\r
- break;\r
- }\r
- case 'F':\r
- {\r
- params_ptr->test_type = FFT_TEST;\r
- FFT_Cmd = ¶ms_ptr->u.FFT_Cmd;\r
- DT_FFT_Cmd_Init (FFT_Cmd);\r
- if (!DT_FFT_Cmd_Parse (FFT_Cmd, my_argc, my_argv, &opts))\r
- {\r
- goto error_return;\r
- }\r
- params_ptr->ReliabilityLevel = FFT_Cmd->ReliabilityLevel;\r
- break;\r
- }\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Test Type\n");\r
- goto main_usage;\r
- }\r
- }\r
-\r
- if (fd)\r
- {\r
- for (i = 0; i < my_argc; i++)\r
- {\r
- DT_Mdep_Free (my_argv[i]);\r
- }\r
- fclose (fd);\r
- }\r
- return true;\r
-\r
-main_usage:\r
- Dapltest_Main_Usage ();\r
-error_return:\r
- if (fd)\r
- {\r
- for (i = 0; i < my_argc; i++)\r
- {\r
- DT_Mdep_Free (my_argv[i]);\r
- }\r
- fclose (fd);\r
- }\r
- return false;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_PARAMS_H__\r
-#define __DAPL_PARAMS_H__\r
-\r
-\r
-#include "dapl_server_cmd.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_limit_cmd.h"\r
-#include "dapl_quit_cmd.h"\r
-#include "dapl_fft_cmd.h"\r
-\r
-typedef enum\r
-{\r
- SERVER_TEST,\r
- TRANSACTION_TEST,\r
- PERFORMANCE_TEST,\r
- LIMIT_TEST,\r
- QUIT_TEST,\r
- FFT_TEST\r
-} test_type_e;\r
-\r
-typedef struct\r
-{\r
- test_type_e test_type;\r
-\r
- union\r
- {\r
- Server_Cmd_t Server_Cmd;\r
- Transaction_Cmd_t Transaction_Cmd;\r
- Performance_Cmd_t Performance_Cmd;\r
- Limit_Cmd_t Limit_Cmd;\r
- Quit_Cmd_t Quit_Cmd;\r
- FFT_Cmd_t FFT_Cmd;\r
- } u;\r
-\r
- /* Needed here due to structure of command processing */\r
- DAT_QOS ReliabilityLevel;\r
-} Params_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include <dat/udat.h>\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_performance_stats.h"\r
-#include "dapl_performance_test.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-#define MAX_CONN_RETRY 8\r
-\r
-/****************************************************************************/\r
-void\r
-DT_Performance_Test_Client (\r
- Per_Test_Data_t *pt_ptr,\r
- DAT_IA_HANDLE *ia_handle,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr)\r
-{\r
- Performance_Test_t *test_ptr = NULL;\r
- int connected = 1;\r
-\r
- DT_Mdep_debug (("Client: Starting performance test\n"));\r
-\r
- if ( !DT_Performance_Test_Create (pt_ptr,\r
- ia_handle,\r
- remote_ia_addr,\r
- false,\r
- pt_ptr->Server_Info.is_little_endian,\r
- &test_ptr) )\r
- {\r
- DT_Mdep_debug (("Client: Resource Creation Failed\n"));\r
- connected = 0;\r
- }\r
- else if ( !DT_Performance_Test_Client_Connect (test_ptr) )\r
- {\r
- DT_Mdep_debug (("Client: Connection Failed\n"));\r
- connected = 0;\r
- }\r
-\r
- if ( connected )\r
- {\r
- if ( !DT_Performance_Test_Client_Exchange (test_ptr) )\r
- {\r
- DT_Mdep_debug (("Client: Test Failed\n"));\r
- }\r
- }\r
-\r
- /* If we never connected, then the test will hang here\r
- * because in the destroy of the test it will waits for a\r
- * disconnect event which will never arrive, simply\r
- * because there was never a connection.\r
- */\r
-\r
- DT_Performance_Test_Destroy (pt_ptr, test_ptr, false);\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- DT_Mdep_debug (("Client: Finished performance test\n"));\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_Performance_Test_Client_Connect (\r
- Performance_Test_t *test_ptr)\r
-{\r
- DAT_RETURN ret;\r
- DAT_EVENT_NUMBER event_num;\r
- unsigned int retry_cnt = 0;\r
-\r
- /*\r
- * Client - connect\r
- */\r
- DT_Mdep_debug (("Client[" F64x "]: Connect on port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- (DAT_UVERYLONG)test_ptr->ep_context.port));\r
-\r
-retry:\r
- ret = dat_ep_connect (test_ptr->ep_context.ep_handle,\r
- test_ptr->remote_ia_addr,\r
- test_ptr->ep_context.port,\r
- DAT_TIMEOUT_INFINITE,\r
- 0, \r
- (DAT_PVOID) 0, /* no private data */\r
- test_ptr->cmd->qos,\r
- DAT_CONNECT_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_connect error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- return false;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait (test_ptr->ep_context.ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- if ( event_num == DAT_CONNECTION_EVENT_PEER_REJECTED )\r
- {\r
- DAT_EVENT event;\r
- DAT_COUNT drained = 0;\r
-\r
- DT_Mdep_Sleep (1000);\r
- DT_Mdep_printf ("Test[" F64x "]: retrying connection...\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- retry_cnt++;\r
-\r
- dat_ep_reset (test_ptr->ep_context.ep_handle);\r
- do\r
- {\r
- ret = dat_evd_dequeue (test_ptr->recv_evd_hdl, &event);\r
- drained++;\r
- } while (ret != DAT_QUEUE_EMPTY);\r
-\r
- if (drained > 1 && retry_cnt < MAX_CONN_RETRY)\r
- {\r
- DT_Mdep_printf("Reposting!!! %d\n", drained);\r
- \r
- /*\r
- * Post recv and sync buffers\r
- */\r
- if ( !DT_post_recv_buffer (test_ptr->ep_context.ep_handle,\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_RECV_BUFFER_ID,\r
- DT_PERF_SYNC_BUFF_SIZE) )\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: repost buffer error: \n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- return false;\r
- }\r
- }\r
- \r
- if (retry_cnt < MAX_CONN_RETRY)\r
- {\r
- goto retry;\r
- }\r
- }\r
- /* error message printed by DT_cr_event_wait */\r
- return false;\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- DT_Mdep_debug (("Client[" F64x "]: Got Connection\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- return true;\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-static bool\r
-DT_Performance_Test_Client_Phase1 (\r
- Performance_Test_t *test_ptr,\r
- Performance_Stats_t *stats )\r
-{\r
- DT_Mdep_TimeStamp pre_ts;\r
- DT_Mdep_TimeStamp post_ts;\r
- DT_CpuStat pre_cpu_stat;\r
- DT_CpuStat post_cpu_stat;\r
- unsigned int post_cnt;\r
- unsigned int reap_cnt;\r
-\r
- /*\r
- * measure bandwidth, OPS, and CPU utilization\r
- */\r
-\r
- if ( !DT_Mdep_GetCpuStat (&pre_cpu_stat) )\r
- {\r
- return false;\r
- }\r
-\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- /*\r
- * Fill the pipe\r
- */\r
-\r
- for ( post_cnt = 0; post_cnt < (unsigned int)test_ptr->ep_context.pipeline_len; post_cnt++ )\r
- {\r
- if ( !DT_performance_post_rdma_op (&test_ptr->ep_context, \r
- test_ptr->reqt_evd_hdl,\r
- stats) )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Post %i failed\n", \r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- post_cnt));\r
- return false;\r
- }\r
- }\r
-\r
- /*\r
- * Reap completions and repost\r
- */\r
-\r
- for ( reap_cnt = 0; reap_cnt < test_ptr->cmd->num_iterations; )\r
- {\r
- unsigned int cur_reap_cnt;\r
- unsigned int cur_post_cnt;\r
- unsigned int cur_post_i;\r
-\r
- cur_reap_cnt = DT_performance_reap (test_ptr->reqt_evd_hdl, \r
- test_ptr->cmd->mode,\r
- stats);\r
-\r
- if ( 0 == cur_reap_cnt )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Poll %i failed\n", \r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- reap_cnt));\r
- return false;\r
- }\r
-\r
- /* repost */\r
- cur_post_cnt = DT_min (test_ptr->cmd->num_iterations - post_cnt, \r
- cur_reap_cnt);\r
-\r
- for ( cur_post_i = 0; cur_post_i < cur_post_cnt; cur_post_i++)\r
- {\r
- if ( !DT_performance_post_rdma_op (&test_ptr->ep_context, \r
- test_ptr->reqt_evd_hdl,\r
- stats) )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Post %i failed\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- post_cnt));\r
- return false;\r
- }\r
- }\r
-\r
- reap_cnt += cur_reap_cnt;\r
- post_cnt += cur_post_cnt;\r
- }\r
-\r
- /* end time and update stats */\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- stats->time_ts = post_ts - pre_ts;\r
- stats->num_ops = test_ptr->cmd->num_iterations;\r
-\r
- if ( !DT_Mdep_GetCpuStat (&post_cpu_stat) )\r
- {\r
- return false;\r
- }\r
-\r
- /* calculate CPU utilization */\r
- {\r
- unsigned long int system;\r
- unsigned long int user;\r
- unsigned long int idle;\r
- unsigned long int total;\r
-\r
- system = post_cpu_stat.system - pre_cpu_stat.system;\r
- user = post_cpu_stat.user - pre_cpu_stat.user;\r
- idle = post_cpu_stat.idle - pre_cpu_stat.idle;\r
-\r
- total = system + user + idle;\r
-\r
- if ( 0 == total )\r
- {\r
- stats->cpu_utilization = 0.0;\r
- }\r
- else\r
- {\r
- stats->cpu_utilization = 1.0 - ((double) idle / (double) total );\r
- stats->cpu_utilization *= 100;\r
- }\r
- }\r
-\r
- return true;\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-static bool\r
-DT_Performance_Test_Client_Phase2 (\r
- Performance_Test_t *test_ptr,\r
- Performance_Stats_t *stats )\r
-{\r
- DAT_LMR_TRIPLET *iov;\r
- DAT_RMR_TRIPLET rmr_triplet;\r
- DAT_DTO_COOKIE cookie;\r
- DAT_EVENT event;\r
- DAT_RETURN ret;\r
- Performance_Ep_Context_t *ep_context;\r
- Performance_Test_Op_t *op;\r
- DT_Mdep_TimeStamp pre_ts;\r
- DT_Mdep_TimeStamp post_ts;\r
- unsigned long int bytes;\r
- unsigned int i;\r
-\r
- /*\r
- * measure latency\r
- */\r
-\r
- ep_context = &test_ptr->ep_context;\r
- op = &ep_context->op;\r
- iov = DT_Bpool_GetIOV (op->bp, 0);\r
-\r
- bytes = op->seg_size * op->num_segs;\r
-\r
- /* Prep the inputs */\r
- for (i = 0; i < op->num_segs; i++)\r
- {\r
- iov[i].pad = 0U;\r
- iov[i].virtual_address = (DAT_VADDR) (uintptr_t) \r
- DT_Bpool_GetBuffer (op->bp, i);\r
- iov[i].segment_length = op->seg_size;\r
- iov[i].lmr_context = DT_Bpool_GetLMR (op->bp, i);\r
- }\r
-\r
- rmr_triplet.pad = 0U;\r
- rmr_triplet.target_address = (DAT_VADDR) (uintptr_t) op->Rdma_Address;\r
- rmr_triplet.segment_length = op->seg_size * op->num_segs;\r
- rmr_triplet.rmr_context = op->Rdma_Context;\r
-\r
- cookie.as_ptr = NULL;\r
-\r
- for ( i = 0; i < test_ptr->cmd->num_iterations; i++ )\r
- {\r
- if ( RDMA_WRITE == op->transfer_type )\r
- {\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
- \r
- ret = dat_ep_post_rdma_write (ep_context->ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
- }\r
- else\r
- {\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
- \r
- ret = dat_ep_post_rdma_read (ep_context->ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
- }\r
-\r
- if ( DAT_SUCCESS != ret )\r
- {\r
- return false;\r
- }\r
- \r
- for (;;)\r
- {\r
- ret = dat_evd_dequeue ( test_ptr->reqt_evd_hdl,\r
- &event);\r
- \r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- \r
- if (DAT_GET_TYPE(ret) == DAT_QUEUE_EMPTY)\r
- {\r
- continue;\r
- }\r
- else if ( DAT_SUCCESS != ret )\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_dequeue failed: %s\n",\r
- DT_RetToString (ret));\r
- return false;\r
- }\r
- else if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- DT_performance_stats_record_latency (stats, post_ts - pre_ts);\r
- break;\r
- }\r
- else /* error */\r
- {\r
- DT_Mdep_printf (\r
- "Warning: dapl_performance_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- \r
- return false;\r
- }\r
- }\r
- }\r
-\r
- return true;\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_Performance_Test_Client_Exchange (\r
- Performance_Test_t *test_ptr)\r
-{\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_DTO_COOKIE dto_cookie;\r
- Performance_Stats_t stats;\r
- RemoteMemoryInfo *rmi;\r
-\r
- test_ptr->ep_context.op.bp =\r
- DT_BpoolAlloc (test_ptr->pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context.ep_handle,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->ep_context.op.seg_size,\r
- test_ptr->ep_context.op.num_segs,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
-\r
- if ( !test_ptr->ep_context.op.bp )\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for buffers (RDMA/RD)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- return false;\r
- }\r
-\r
- /*\r
- * Recv the other side's info\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Waiting for Sync Msg\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_RECV_BUFFER_ID);\r
- if ( !DT_dto_event_wait (test_ptr->recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- test_ptr->ep_context.ep_handle,\r
- DT_PERF_SYNC_BUFF_SIZE,\r
- dto_cookie,\r
- "Recieve Sync_Msg") )\r
- {\r
- return false;\r
- }\r
-\r
- /*\r
- * Extract what we need\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Sync Msg Received\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- rmi = (RemoteMemoryInfo *) DT_Bpool_GetBuffer (test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_RECV_BUFFER_ID);\r
-\r
- /*\r
- * If the client and server are of different endiannesses,\r
- * we must correct the endianness of the handle and address\r
- * we pass to the other side. The other side cannot (and\r
- * better not) interpret these values.\r
- */\r
- if (DT_local_is_little_endian != test_ptr->is_remote_little_endian)\r
- {\r
- rmi->rmr_context = DT_EndianMemHandle (rmi->rmr_context);\r
- rmi->mem_address.as_64 =DT_EndianMemAddress (rmi->mem_address.as_64);\r
- }\r
-\r
- test_ptr->ep_context.op.Rdma_Context = rmi->rmr_context;\r
- test_ptr->ep_context.op.Rdma_Address = rmi->mem_address.as_ptr;\r
-\r
- DT_Mdep_spew (3, ("Got RemoteMemInfo [ va=%p, ctx=%x ]\n",\r
- test_ptr->ep_context.op.Rdma_Address,\r
- test_ptr->ep_context.op.Rdma_Context));\r
-\r
- /*\r
- * Get to work ...\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Begin...\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- DT_performance_stats_init (&stats);\r
- \r
- if ( !DT_Performance_Test_Client_Phase1(test_ptr, &stats) )\r
- {\r
- return false;\r
- }\r
-\r
- if ( !DT_Performance_Test_Client_Phase2(test_ptr, &stats) )\r
- {\r
- return false;\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: Sending Sync Msg\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- if (!DT_post_send_buffer (test_ptr->ep_context.ep_handle,\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_SEND_BUFFER_ID,\r
- DT_PERF_SYNC_BUFF_SIZE))\r
- {\r
- /* error message printed by DT_post_send_buffer */\r
- return false;\r
- }\r
-\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_SEND_BUFFER_ID);\r
- if (!DT_dto_event_wait (test_ptr->reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- test_ptr->ep_context.ep_handle,\r
- DT_PERF_SYNC_BUFF_SIZE,\r
- dto_cookie,\r
- "Client_Sync_Send"))\r
- {\r
- return false;\r
- }\r
-\r
- DT_performance_stats_print (&stats, test_ptr->cmd, test_ptr);\r
-\r
- return true;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-\r
-/*\r
- * Map Performance_Mode_Type values to readable strings\r
- */\r
-const char *\r
-DT_PerformanceModeToString (Performance_Mode_Type mode)\r
-{\r
- if ( BLOCKING_MODE == mode )\r
- {\r
- return "blocking";\r
- }\r
- else if ( POLLING_MODE == mode )\r
- {\r
- return "polling";\r
- }\r
- else\r
- {\r
- return "error: unkown mode";\r
- }\r
-}\r
-\r
-\r
-static void\r
-DT_Performance_Cmd_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE: ---- PERFORMANCE TEST ----\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T P\n");\r
- DT_Mdep_printf ("USAGE: -s <server Name>\n");\r
- DT_Mdep_printf ("USAGE: [-m b|p]\n");\r
- DT_Mdep_printf ("USAGE: [-D <device Name>]\n");\r
- DT_Mdep_printf ("USAGE: [-d] : debug (zero)\n");\r
- DT_Mdep_printf ("USAGE: [-i <num iterations>] : (1, 000)\n");\r
- DT_Mdep_printf ("USAGE: [-p <pipline>]\n");\r
- DT_Mdep_printf ("USAGE: [-R <service reliability>]\n");\r
- DT_Mdep_printf ("USAGE: (BE == QOS_BEST_EFFORT - Default)\n");\r
- DT_Mdep_printf ("USAGE: (HT == QOS_HIGH_THROUGHPUT)\n");\r
- DT_Mdep_printf ("USAGE: (LL == QOS_LOW_LATENCY)\n");\r
- DT_Mdep_printf ("USAGE: (EC == QOS_ECONOMY)\n");\r
- DT_Mdep_printf ("USAGE: (PM == QOS_PREMIUM)\n");\r
- DT_Mdep_printf ("USAGE: <OP>\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
- DT_Mdep_printf ("USAGE: Each OP consists of:\n");\r
- DT_Mdep_printf ("USAGE: <transfer_type> : \"RR\" (RDMA READ)\n");\r
- DT_Mdep_printf ("USAGE: : \"RW\" (RDMA WRITE)\n");\r
- DT_Mdep_printf ("USAGE: [seg_size [num_segs] ] : (4096, 1)\n");\r
-}\r
-\r
-static bool\r
-DT_Performance_Cmd_Parse_Op (\r
- Performance_Cmd_t * cmd, \r
- int index, \r
- int my_argc,\r
- char **my_argv)\r
-{\r
- int i;\r
-\r
- /*\r
- * Op Format: <RR/RW> [seg_size] [num_segs]\r
- */\r
-\r
- if ( index == my_argc )\r
- {\r
- DT_Mdep_printf ("Operation Missing Transfer Type\n");\r
- return (false);\r
- }\r
-\r
- for ( i = 0; index < my_argc; i++, index++ )\r
- {\r
- switch ( i )\r
- {\r
- case 0:\r
- {\r
- if ( 0 == strncmp (my_argv[index], "RR", strlen ("RR")) )\r
- {\r
- cmd->op.transfer_type = RDMA_READ;\r
- }\r
- else if ( 0 == strncmp (my_argv[index], "RW", strlen ("RW")) )\r
- {\r
- cmd->op.transfer_type = RDMA_WRITE;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("OP type must be <RR/RW/SR>\n");\r
- return (false);\r
- }\r
- break;\r
- }\r
- case 1:\r
- {\r
- cmd->op.seg_size = atoi (my_argv[index]);\r
- break;\r
- }\r
- case 2:\r
- {\r
- cmd->op.num_segs = atoi (my_argv[index]);\r
- break;\r
- }\r
- default:\r
- {\r
- DT_Mdep_printf ("Too many OP args\n");\r
- return (false);\r
- }\r
- }\r
- }\r
-\r
- return (true);\r
-}\r
-\r
-\r
-static bool\r
-DT_Performance_Cmd_Validate (\r
- Performance_Cmd_t *cmd)\r
-{\r
- if ( '\0' == cmd->server_name[0] )\r
- {\r
- DT_Mdep_printf ("Must specify server_name in command line or scriptfile\n");\r
- return (false);\r
- }\r
-\r
- if ( '\0' == cmd->dapl_name[0] )\r
- {\r
- DT_Mdep_printf ("Must specify device_name in command line or scriptfile\n");\r
- return (false);\r
- }\r
-\r
- if ( 0 == cmd->pipeline_len )\r
- {\r
- DT_Mdep_printf ("Pipeline size must not be 0\n");\r
- return (false);\r
- }\r
-\r
- if ( cmd->debug )\r
- {\r
- DT_Performance_Cmd_Print (cmd);\r
- }\r
-\r
- return true;\r
-}\r
-\r
-\r
-void\r
-DT_Performance_Cmd_Print (\r
- Performance_Cmd_t *cmd)\r
-{\r
- DT_Mdep_printf ("-------------------------------------\n");\r
- DT_Mdep_printf ("PerfCmd.server_name : %s\n",\r
- cmd->server_name);\r
- DT_Mdep_printf ("PerfCmd.dapl_name : %s\n",\r
- cmd->dapl_name);\r
- DT_Mdep_printf ("PerfCmd.mode : %s\n",\r
- (cmd->mode == BLOCKING_MODE) ? "BLOCKING" : "POLLING");\r
- DT_Mdep_printf ("PerfCmd.num_iterations : %d\n",\r
- cmd->num_iterations);\r
- DT_Mdep_printf ("PerfCmd.pipeline_len : %d\n",\r
- cmd->pipeline_len);\r
- DT_Mdep_printf ("PerfCmd.op.transfer_type : %s\n",\r
- cmd->op.transfer_type == RDMA_READ ? "RDMA_READ" :\r
- cmd->op.transfer_type == RDMA_WRITE ? "RDMA_WRITE" :\r
- "SEND_RECV");\r
- DT_Mdep_printf ("PerfCmd.op.num_segs : %d\n",\r
- cmd->op.num_segs);\r
- DT_Mdep_printf ("PerfCmd.op.seg_size : %d\n",\r
- cmd->op.seg_size);\r
-}\r
-\r
-\r
-bool\r
-DT_Performance_Cmd_Parse (\r
- Performance_Cmd_t *cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t *opts)\r
-{\r
- char c;\r
- unsigned int len;\r
-\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "D:dm:i:p:R:s:", opts);\r
-\r
- if ( EOF == c )\r
- {\r
- break;\r
- }\r
-\r
- switch ( c )\r
- {\r
- case 'D': /* device name */\r
- {\r
- strncpy (cmd->dapl_name, opts->optarg, NAME_SZ);\r
- break;\r
- }\r
- case 'd': /* print debug messages */\r
- {\r
- DT_dapltest_debug++;\r
- cmd->debug = true;\r
- break;\r
- }\r
- case 'm': /* mode */\r
- {\r
- if ( !strncmp (opts->optarg, "b", strlen ("b")) )\r
- {\r
- cmd->mode = BLOCKING_MODE;\r
- }\r
- else if ( !strncmp (opts->optarg, "p", strlen ("p")) )\r
- {\r
- cmd->mode = POLLING_MODE;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("Syntax Error -m <mode> option\n");\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- break;\r
- }\r
- case 'i': /* num iterations */\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -i <iterations> option\n");\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_iterations = atol (opts->optarg);\r
- break;\r
- }\r
- case 'p': /* pipline size */\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -p <piplein> option\n");\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->pipeline_len = atol (opts->optarg);\r
- break;\r
- }\r
- case 'R': /* Service Reliability Level */\r
- {\r
- cmd->qos = DT_ParseQoS (opts->optarg);\r
- break;\r
- }\r
- case 's': /* server name */\r
- {\r
- if ((opts->optarg == 0) || \r
- strlen (opts->optarg) == 0 || \r
- *opts->optarg == '-')\r
- {\r
- DT_Mdep_printf ("must specify server name\n");\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- strncpy (cmd->server_name, opts->optarg, NAME_SZ);\r
- break;\r
- }\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Performance Test Parameter: %c\n", c);\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * now parse the op\r
- */\r
- if ( !DT_Performance_Cmd_Parse_Op (cmd, opts->optind, my_argc, my_argv) )\r
- {\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- if ( !DT_Performance_Cmd_Validate (cmd) )\r
- {\r
- DT_Performance_Cmd_Usage ();\r
- return (false);\r
- }\r
-\r
- return (true);\r
-}\r
-\r
-\r
-bool\r
-DT_Performance_Cmd_Init (Performance_Cmd_t * cmd)\r
-{\r
- memset (cmd, 0, sizeof (Performance_Cmd_t));\r
- cmd->dapltest_version = DAPLTEST_VERSION;\r
- cmd->client_is_little_endian = DT_local_is_little_endian;\r
- cmd->qos = DAT_QOS_BEST_EFFORT;\r
- cmd->debug = false;\r
- cmd->num_iterations = 1000;\r
- cmd->pipeline_len = ~0;\r
-\r
- cmd->op.transfer_type = RDMA_WRITE;\r
- cmd->op.seg_size = 4096;\r
- cmd->op.num_segs = 1;\r
-\r
- if ( !DT_Mdep_GetDefaultDeviceName (cmd->dapl_name) )\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- return (false);\r
- }\r
-\r
- return (true);\r
-}\r
-\r
-\r
-void\r
-DT_Performance_Cmd_Endian (Performance_Cmd_t * cmd)\r
-{\r
- cmd->dapltest_version = DT_Endian32 (cmd->dapltest_version);\r
- cmd->qos = DT_Endian32 (cmd->qos);\r
- cmd->num_iterations = DT_Endian32 (cmd->num_iterations);\r
- cmd->debug = DT_Endian32 (cmd->debug);\r
-\r
- cmd->op.transfer_type = DT_Endian32 (cmd->op.transfer_type);\r
- cmd->op.seg_size = DT_Endian32 (cmd->op.seg_size);\r
- cmd->op.num_segs = DT_Endian32 (cmd->op.num_segs);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_PERFORMANCE_CMD_H__\r
-#define __DAPL_PERFORMANCE_CMD_H__\r
-\r
-#include <dat/udat.h>\r
-\r
-#define NAME_SZ 256\r
-\r
-typedef enum\r
-{\r
- BLOCKING_MODE,\r
- POLLING_MODE\r
-} Performance_Mode_Type;\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 transfer_type;\r
- DAT_UINT32 seg_size;\r
- DAT_UINT32 num_segs;\r
-}Performance_Cmd_Op_t;\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 dapltest_version;\r
- DAT_UINT32 client_is_little_endian;\r
- char server_name[NAME_SZ]; /* -s */\r
- char dapl_name[NAME_SZ]; /* -D */\r
- DAT_QOS qos;\r
- DAT_UINT32 debug; /* -d */\r
- Performance_Mode_Type mode; /* -m */\r
- DAT_UINT32 num_iterations; /* -i */\r
- DAT_UINT32 pipeline_len; /* -p */\r
- Performance_Cmd_Op_t op;\r
- DAT_UINT32 use_rsp; /* -r */\r
-\r
-} Performance_Cmd_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include <dat/udat.h>\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_performance_test.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-\r
-/****************************************************************************/\r
-void\r
-DT_Performance_Test_Server (\r
- void *var)\r
-{\r
- Per_Test_Data_t *pt_ptr = var;\r
- Performance_Test_t *test_ptr = NULL;\r
-\r
- int success = 1;\r
-\r
- DT_Mdep_debug (("Server: Starting performance test\n"));\r
-\r
- if ( !DT_Performance_Test_Create (pt_ptr,\r
- pt_ptr->ps_ptr->ia_handle,\r
- (DAT_IA_ADDRESS_PTR) 0,\r
- true,\r
- pt_ptr->Client_Info.is_little_endian,\r
- &test_ptr) )\r
- {\r
- DT_Mdep_printf ("Server: Resource Creation Failed\n");\r
- success = 0;\r
- }\r
- if ( 1 == success )\r
- {\r
- if (! DT_Performance_Test_Server_Connect (test_ptr) )\r
- {\r
- success = 0;\r
- DT_Mdep_printf ("Server: Connection Failed\n");\r
- }\r
- }\r
-\r
- if ( 1 == success )\r
- {\r
- if ( ! DT_Performance_Test_Server_Exchange (test_ptr) )\r
- {\r
- success = 0;\r
- DT_Mdep_printf ("Server: Test Failed\n");\r
- }\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
-\r
-\r
- DT_Performance_Test_Destroy (pt_ptr, test_ptr, true);\r
-\r
- DT_Mdep_printf ("Server: Finished performance test. Detaching.\n");\r
-\r
- DT_Mdep_Thread_Detach (DT_Mdep_Thread_SELF ()); /* AMM */\r
- DT_Thread_Destroy (pt_ptr->thread, pt_ptr); /* destroy Master thread */\r
-\r
- DT_Mdep_Lock (&pt_ptr->ps_ptr->num_clients_lock);\r
- pt_ptr->ps_ptr->num_clients--;\r
- DT_Mdep_Unlock (&pt_ptr->ps_ptr->num_clients_lock);\r
-\r
- DT_PrintMemList (pt_ptr); /* check if we return all space allocated */\r
- DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);\r
- DT_Mdep_LockDestroy (&pt_ptr->MemListLock);\r
- DT_Free_Per_Test_Data (pt_ptr);\r
-\r
- DT_Mdep_Unlock (&g_PerfTestLock);\r
- DT_Mdep_printf ("Server: Finished performance test. Exiting.\n");\r
-\r
- DT_Mdep_Thread_EXIT (NULL);\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_Performance_Test_Server_Connect (\r
- Performance_Test_t *test_ptr)\r
-{\r
- DAT_RETURN ret;\r
- bool status;\r
- DAT_RSP_HANDLE rsp_handle;\r
- DAT_PSP_HANDLE psp_handle;\r
-\r
- DAT_CR_ARRIVAL_EVENT_DATA cr_stat;\r
- DAT_CR_HANDLE cr_handle;\r
- DAT_EVENT_NUMBER event_num;\r
-\r
- rsp_handle = DAT_HANDLE_NULL;\r
- psp_handle = DAT_HANDLE_NULL;\r
-#if 0 /* FIXME */\r
- if (test_ptr->cmd->use_rsp)\r
- {\r
- /*\r
- * Server - create a single-use RSP and\r
- * await a connection for this EP\r
- */\r
- ret = dat_rsp_create (test_ptr->ia_handle,\r
- test_ptr->ep_context.port,\r
- test_ptr->ep_context.ep_handle,\r
- test_ptr->creq_evd_hdl,\r
- &rsp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_rsp_create error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- DT_Mdep_debug (("Server[" F64x "]: Listen on RSP port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- (DAT_UVERYLONG)test_ptr->ep_context.port));\r
-\r
- /* wait for the connection request */\r
- if (!DT_cr_event_wait (test_ptr->conn_evd_hdl, &cr_stat) ||\r
- !DT_cr_check ( &cr_stat,\r
- DAT_HANDLE_NULL,\r
- test_ptr->ep_context.port,\r
- &cr_handle,\r
- "Server") )\r
- {\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- /* what, me query? just try to accept the connection */\r
- ret = dat_cr_accept (cr_handle,\r
- test_ptr->ep_context.ep_handle,\r
- 0, (DAT_PVOID)0 /* no private data */ );\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_accept error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* cr_handle consumed on failure */\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait ( test_ptr->ep_context.ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- /* error message printed by DT_conn_event_wait */\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- }\r
- else\r
-#endif /* FIXME */\r
- {\r
- /*\r
- * Server - use a short-lived PSP instead of an RSP\r
- */\r
- status = true;\r
-\r
- ret = dat_psp_create (test_ptr->ia_handle,\r
- test_ptr->ep_context.port,\r
- test_ptr->creq_evd_hdl,\r
- DAT_PSP_CONSUMER_FLAG,\r
- &psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_psp_create error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- status = false;\r
- psp_handle = DAT_HANDLE_NULL;\r
- return (status);\r
- }\r
-\r
- }\r
-\r
- /*\r
- * Here's where we tell the main server process that \r
- * this thread is ready to wait for a connection request\r
- * from the remote end.\r
- */\r
- DT_Mdep_wait_object_wakeup (&test_ptr->pt_ptr->synch_wait_object);\r
-\r
- DT_Mdep_debug (("Server[" F64x "]: Listen on PSP port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- (DAT_UVERYLONG)test_ptr->ep_context.port));\r
-\r
- /* wait for a connection request */\r
- if (!DT_cr_event_wait (test_ptr->creq_evd_hdl, &cr_stat) ||\r
- !DT_cr_check ( &cr_stat,\r
- psp_handle,\r
- test_ptr->ep_context.port,\r
- &cr_handle,\r
- "Server") )\r
- {\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- /* what, me query? just try to accept the connection */\r
- ret = dat_cr_accept (cr_handle,\r
- test_ptr->ep_context.ep_handle,\r
- 0, \r
- (DAT_PVOID)0 /* no private data */ );\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_accept error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* cr_handle consumed on failure */\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait (test_ptr->ep_context.ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num ) )\r
- {\r
- /* error message printed by DT_cr_event_wait */\r
- status = false;\r
- goto psp_free;\r
- }\r
-\r
- DT_Mdep_debug (("Server[" F64x "]: Accept on port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, \r
- (DAT_UVERYLONG)test_ptr->ep_context.port));\r
-psp_free:\r
- if ( DAT_HANDLE_NULL != psp_handle )\r
- {\r
- /* throw away single-use PSP */\r
- ret = dat_psp_free (psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_psp_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- status = false;\r
- }\r
- }\r
- if ( DAT_HANDLE_NULL != rsp_handle )\r
- {\r
- /* throw away single-use PSP */\r
- ret = dat_rsp_free (rsp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_rsp_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- status = false;\r
- }\r
- } /* end short-lived PSP */\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- return status;\r
-}\r
-\r
-\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_Performance_Test_Server_Exchange (\r
- Performance_Test_t *test_ptr)\r
-{\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- RemoteMemoryInfo *rmi;\r
- DAT_DTO_COOKIE dto_cookie;\r
-\r
- test_ptr->ep_context.op.bp =\r
- DT_BpoolAlloc (test_ptr->pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context.ep_handle,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->ep_context.op.seg_size,\r
- test_ptr->ep_context.op.num_segs,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- true,\r
- true);\r
-\r
- if ( !test_ptr->ep_context.op.bp )\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for buffers (RDMA/RD)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- return false;\r
- }\r
-\r
- test_ptr->ep_context.op.Rdma_Context =\r
- DT_Bpool_GetRMR (test_ptr->ep_context.op.bp, 0);\r
- test_ptr->ep_context.op.Rdma_Address =\r
- (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer (test_ptr->ep_context.op.bp, 0);\r
-\r
- /*\r
- * Prep send buffer with memory information\r
- */\r
- rmi = (RemoteMemoryInfo *) DT_Bpool_GetBuffer (test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_SEND_BUFFER_ID);\r
-\r
- rmi->rmr_context = test_ptr->ep_context.op.Rdma_Context;\r
- rmi->mem_address.as_64 = (DAT_UINT64) LZERO;\r
- rmi->mem_address.as_ptr =test_ptr->ep_context.op.Rdma_Address;\r
-\r
- if ( rmi->mem_address.as_ptr )\r
- {\r
- DT_Mdep_spew (3, ("RemoteMemInfo va=" F64x ", ctx=%x\n",\r
- (DAT_UVERYLONG)rmi->mem_address.as_64,\r
- rmi->rmr_context));\r
- }\r
-\r
- /*\r
- * If the client and server are of different endiannesses,\r
- * we must correct the endianness of the handle and address\r
- * we pass to the other side. The other side cannot (and\r
- * better not) interpret these values.\r
- */\r
- if (DT_local_is_little_endian != test_ptr->is_remote_little_endian)\r
- {\r
- rmi->rmr_context = DT_EndianMemHandle (rmi->rmr_context);\r
- rmi->mem_address.as_64 =DT_EndianMemAddress (rmi->mem_address.as_64);\r
- }\r
-\r
- /*\r
- * Send our memory info\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Sending Sync Msg\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- /* post the send buffer */\r
- if (!DT_post_send_buffer (test_ptr->ep_context.ep_handle,\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_SEND_BUFFER_ID,\r
- DT_PERF_SYNC_BUFF_SIZE))\r
- {\r
- /* error message printed by DT_post_send_buffer */\r
- return false;\r
- }\r
-\r
- /* reap the send and verify it */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_SEND_BUFFER_ID);\r
- if ( !DT_dto_event_wait (test_ptr->reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check (&dto_stat,\r
- test_ptr->ep_context.ep_handle,\r
- DT_PERF_SYNC_BUFF_SIZE,\r
- dto_cookie,\r
- "Send Sync_Msg") )\r
- {\r
- return false;\r
- }\r
-\r
- /*\r
- * Recv the other side's info\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Waiting for Sync Msg\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_RECV_BUFFER_ID);\r
- if ( !DT_dto_event_wait (test_ptr->recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- test_ptr->ep_context.ep_handle,\r
- DT_PERF_SYNC_BUFF_SIZE,\r
- dto_cookie,\r
- "Recieve Sync_Msg") )\r
- {\r
- return false;\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: Received Sync Msg\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- return true;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_performance_stats.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-\r
-void\r
-DT_performance_stats_init (\r
- Performance_Stats_t *stats)\r
-{\r
- stats->num_ops = 0;\r
- stats->bytes = 0;\r
- stats->post_ctxt_switch_num = 0;\r
- stats->reap_ctxt_switch_num = 0;\r
-\r
- stats->cpu_utilization = 0.0;\r
- stats->time_ts = 0;\r
-\r
- stats->posts_sans_ctxt.num = 0;\r
- stats->posts_sans_ctxt.total_ts = 0;\r
- stats->posts_sans_ctxt.max_ts = 0;\r
- stats->posts_sans_ctxt.min_ts = ~0;\r
-\r
- stats->posts_with_ctxt.num = 0;\r
- stats->posts_with_ctxt.total_ts = 0;\r
- stats->posts_with_ctxt.max_ts = 0;\r
- stats->posts_with_ctxt.min_ts = ~0;\r
-\r
- stats->reaps_sans_ctxt.num = 0;\r
- stats->reaps_sans_ctxt.total_ts = 0;\r
- stats->reaps_sans_ctxt.max_ts = 0;\r
- stats->reaps_sans_ctxt.min_ts = ~0;\r
-\r
- stats->reaps_with_ctxt.num = 0;\r
- stats->reaps_with_ctxt.total_ts = 0;\r
- stats->reaps_with_ctxt.max_ts = 0;\r
- stats->reaps_with_ctxt.min_ts = ~0;\r
-\r
- stats->latency.num = 0;\r
- stats->latency.total_ts = 0;\r
- stats->latency.max_ts = 0;\r
- stats->latency.min_ts = ~0;\r
-}\r
-\r
-\r
-void \r
-DT_performance_stats_record_post (\r
- Performance_Stats_t *stats, \r
- unsigned long ctxt_switch_num,\r
- DT_Mdep_TimeStamp ts)\r
-{\r
- if ( ctxt_switch_num )\r
- {\r
- stats->posts_with_ctxt.num++;\r
- stats->posts_with_ctxt.total_ts += ts;\r
- stats->posts_with_ctxt.max_ts = \r
- DT_max (stats->posts_with_ctxt.max_ts, ts);\r
- stats->posts_with_ctxt.min_ts = \r
- DT_min (stats->posts_with_ctxt.min_ts, ts);\r
-\r
- stats->post_ctxt_switch_num += ctxt_switch_num;\r
- }\r
- else\r
- {\r
- stats->posts_sans_ctxt.num++;\r
- stats->posts_sans_ctxt.total_ts += ts;\r
- stats->posts_sans_ctxt.max_ts = \r
- DT_max (stats->posts_sans_ctxt.max_ts, ts);\r
- stats->posts_sans_ctxt.min_ts = \r
- DT_min (stats->posts_sans_ctxt.min_ts, ts);\r
- }\r
-}\r
-\r
-\r
-void \r
-DT_performance_stats_record_reap (\r
- Performance_Stats_t *stats, \r
- unsigned long ctxt_switch_num,\r
- DT_Mdep_TimeStamp ts)\r
-{\r
- if ( ctxt_switch_num )\r
- {\r
- stats->reaps_with_ctxt.num++;\r
- stats->reaps_with_ctxt.total_ts += ts;\r
- stats->reaps_with_ctxt.max_ts = \r
- DT_max (stats->reaps_with_ctxt.max_ts, ts);\r
- stats->reaps_with_ctxt.min_ts = \r
- DT_min (stats->reaps_with_ctxt.min_ts, ts);\r
-\r
- stats->reap_ctxt_switch_num += ctxt_switch_num;\r
- }\r
- else\r
- {\r
- stats->reaps_sans_ctxt.num++;\r
- stats->reaps_sans_ctxt.total_ts += ts;\r
- stats->reaps_sans_ctxt.max_ts = \r
- DT_max (stats->reaps_sans_ctxt.max_ts, ts);\r
- stats->reaps_sans_ctxt.min_ts = \r
- DT_min (stats->reaps_sans_ctxt.min_ts, ts);\r
- }\r
-}\r
-\r
-\r
-void \r
-DT_performance_stats_record_latency (\r
- Performance_Stats_t *stats, \r
- DT_Mdep_TimeStamp ts)\r
-{\r
- stats->latency.num++;\r
- stats->latency.total_ts += ts;\r
- stats->latency.max_ts = \r
- DT_max (stats->latency.max_ts, ts);\r
- stats->latency.min_ts = \r
- DT_min (stats->latency.min_ts, ts);\r
-}\r
-\r
-void\r
-DT_performance_stats_data_combine (\r
- Performance_Stats_Data_t *dest,\r
- Performance_Stats_Data_t *src_a,\r
- Performance_Stats_Data_t *src_b)\r
-{\r
- dest->num = src_a->num + src_b->num;\r
- dest->total_ts = src_a->total_ts + src_b->total_ts;\r
- dest->max_ts = DT_max (src_a->max_ts, src_b->max_ts);\r
- dest->min_ts = DT_min (src_a->min_ts, src_b->min_ts);\r
-}\r
-\r
-\r
-void\r
-DT_performance_stats_combine (\r
- Performance_Stats_t *dest,\r
- Performance_Stats_t *src_a,\r
- Performance_Stats_t *src_b)\r
-{\r
- dest->num_ops = \r
- src_a->num_ops + src_b->num_ops;\r
-\r
- dest->bytes = \r
- src_a->bytes + src_b->bytes;\r
-\r
- dest->post_ctxt_switch_num = \r
- src_a->post_ctxt_switch_num + src_b->post_ctxt_switch_num;\r
-\r
- dest->reap_ctxt_switch_num = \r
- src_b->reap_ctxt_switch_num + src_b->reap_ctxt_switch_num;\r
-\r
- dest->cpu_utilization = DT_max (src_a->cpu_utilization, \r
- src_b->cpu_utilization);\r
- dest->time_ts = DT_max (src_a->time_ts, src_b->time_ts);\r
-\r
- DT_performance_stats_data_combine (&dest->posts_sans_ctxt, \r
- &src_a->posts_sans_ctxt, \r
- &src_b->posts_sans_ctxt);\r
-\r
- DT_performance_stats_data_combine (&dest->posts_with_ctxt, \r
- &src_a->posts_with_ctxt, \r
- &src_b->posts_with_ctxt);\r
-\r
- DT_performance_stats_data_combine (&dest->reaps_sans_ctxt, \r
- &src_a->reaps_sans_ctxt, \r
- &src_b->reaps_sans_ctxt);\r
-\r
- DT_performance_stats_data_combine (&dest->reaps_with_ctxt, \r
- &src_a->reaps_with_ctxt, \r
- &src_b->reaps_with_ctxt);\r
-\r
- DT_performance_stats_data_combine (&dest->latency, \r
- &src_a->latency, \r
- &src_b->latency);\r
-}\r
-\r
-\r
-double \r
-DT_performance_stats_data_print (\r
- Performance_Stats_Data_t *data,\r
- double cpu_mhz)\r
-{\r
- double average;\r
-\r
- average = (double)data->total_ts / (data->num * cpu_mhz);\r
-\r
- DT_Mdep_printf ("%-32s : %11.04f us\n"\r
- "%-32s : %11.04f us\n"\r
- "%-32s : %11.04f us\n",\r
- " arithmetic mean",\r
- average,\r
- " maximum",\r
- (double)data->max_ts / cpu_mhz,\r
- " minimum",\r
- (double)data->min_ts / cpu_mhz);\r
-\r
- return average;\r
-}\r
-\r
-\r
-void\r
-DT_performance_stats_print (\r
- Performance_Stats_t *stats,\r
- Performance_Cmd_t *cmd,\r
- Performance_Test_t *test)\r
-{\r
- double cpu_mhz;\r
- double time_s;\r
- double mbytes;\r
- double ops_per_sec;\r
- double bandwidth;\r
- double latency;\r
- double time_per_post;\r
- double time_per_reap;\r
-\r
- cpu_mhz = DT_Mdep_GetCpuMhz ();\r
- latency = 0;\r
-\r
- time_s = ((double)stats->time_ts / (1000000.0 * cpu_mhz));\r
-\r
- mbytes = (double) (stats->bytes >> 20 );\r
-\r
- if ( 0.0 == time_s )\r
- {\r
- DT_Mdep_printf ("Error determining time\n");\r
- return;\r
- }\r
- else if ( 0 == stats->num_ops )\r
- {\r
- DT_Mdep_printf ("Error determining number of operations\n");\r
- return;\r
- }\r
- else if ( 0.0 == cpu_mhz )\r
- {\r
- DT_Mdep_printf ("Error determining CPU speed\n");\r
- return;\r
- }\r
-\r
- ops_per_sec = (double)stats->num_ops / time_s;\r
- bandwidth = mbytes / time_s;\r
-\r
- DT_Mdep_printf ("\n"\r
- "------------------------- Statistics -------------------------\n"\r
- "\n"\r
- "%-32s : %8s\n"\r
- "%-32s : %8s\n"\r
- "%-32s : %8u\n"\r
- "%-32s : %8u bytes\n"\r
- "%-32s : %8u\n"\r
- "%-32s : %8u\n"\r
- "\n",\r
- "Mode",\r
- DT_PerformanceModeToString (cmd->mode),\r
- "Operation Type",\r
- DT_TransferTypeToString (cmd->op.transfer_type),\r
- "Number of Operations",\r
- cmd->num_iterations,\r
- "Segment Size",\r
- cmd->op.seg_size,\r
- "Number of Segments",\r
- cmd->op.num_segs, \r
- "Pipeline Size",\r
- test->ep_context.pipeline_len);\r
-\r
- DT_Mdep_printf ("%-32s : %11.04f sec\n"\r
- "%-32s : %11.04f MB\n"\r
- "%-32s : %11.04f%%\n"\r
- "%-32s : %11.04f ops/sec\n"\r
- "%-32s : %11.04f MB/sec\n",\r
- "Total Time",\r
- time_s,\r
- "Total Data Exchanged",\r
- mbytes,\r
- "CPU Utilization",\r
- stats->cpu_utilization,\r
- "Operation Throughput",\r
- ops_per_sec,\r
- "Bandwidth",\r
- bandwidth);\r
-\r
- DT_Mdep_printf ("\n"\r
- "Latency\n"\r
- "\n");\r
-\r
- if ( stats->latency.num )\r
- {\r
- latency = DT_performance_stats_data_print (&stats->latency, cpu_mhz);\r
- }\r
-\r
- DT_Mdep_printf ("\n"\r
- "Time Per Post\n"\r
- "\n"\r
- "%-32s : %8u\n",\r
- " posts without context switches",\r
- stats->posts_sans_ctxt.num);\r
-\r
- if ( stats->posts_sans_ctxt.num )\r
- {\r
- DT_performance_stats_data_print (&stats->posts_sans_ctxt, cpu_mhz);\r
- }\r
-\r
- DT_Mdep_printf ("\n" \r
- "%-32s : %8u\n",\r
- " posts with context switches",\r
- stats->posts_with_ctxt.num);\r
-\r
- if ( stats->posts_with_ctxt.num )\r
- {\r
- DT_Mdep_printf ("%-32s : %8u\n",\r
- " number of context switches",\r
- stats->post_ctxt_switch_num);\r
- DT_performance_stats_data_print (&stats->posts_with_ctxt, cpu_mhz);\r
- }\r
-\r
- DT_Mdep_printf ("\n"\r
- "Time Per Reap\n"\r
- "\n"\r
- "%-32s : %8u\n",\r
- " reaps without context switches",\r
- stats->reaps_sans_ctxt.num);\r
-\r
- if ( stats->reaps_sans_ctxt.num )\r
- {\r
- DT_performance_stats_data_print (&stats->reaps_sans_ctxt, cpu_mhz);\r
- }\r
-\r
-\r
- DT_Mdep_printf ("\n" \r
- "%-32s : %8u\n",\r
- " reaps with context switches",\r
- stats->reaps_with_ctxt.num);\r
-\r
- if ( stats->reaps_with_ctxt.num )\r
- {\r
- DT_Mdep_printf ("%-32s : %8u\n",\r
- " number of context switches",\r
- stats->reap_ctxt_switch_num);\r
-\r
- DT_performance_stats_data_print (&stats->reaps_with_ctxt, cpu_mhz);\r
- }\r
-\r
- time_per_post = \r
- (int64_t) (stats->posts_sans_ctxt.total_ts + stats->posts_with_ctxt.total_ts) / \r
- (cpu_mhz * (stats->posts_sans_ctxt.num + stats->posts_with_ctxt.num));\r
-\r
- time_per_reap = \r
- (int64_t) (stats->reaps_sans_ctxt.total_ts + stats->reaps_with_ctxt.total_ts) / \r
- (cpu_mhz * (stats->reaps_sans_ctxt.num + stats->reaps_with_ctxt.num));\r
-\r
- DT_Mdep_printf ("\n"\r
- "NOTE:\n"\r
- " 1 MB = 1024 KB = 1048576 B \n"\r
- "-------------------------------------------------------------\n"\r
- "raw: %s, %u, %u, %u, %u, %f, %f, %f, %f, %f, %f \n"\r
- "-------------------------------------------------------------\n"\r
- "\n",\r
- DT_TransferTypeToString (cmd->op.transfer_type),\r
- cmd->num_iterations,\r
- cmd->op.seg_size,\r
- cmd->op.num_segs, \r
- test->ep_context.pipeline_len,\r
- stats->cpu_utilization,\r
- ops_per_sec,\r
- bandwidth,\r
- latency,\r
- time_per_post,\r
- time_per_reap);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_STATS_H__\r
-#define __DAPL_STATS_H__\r
-\r
-#include "dapl_mdep.h"\r
-\r
-#define DT_min(a,b) ((a < b) ? (a) : (b))\r
-#define DT_max(a,b) ((a > b) ? (a) : (b))\r
-#define DT_whole(num) ((unsigned int)(num))\r
-#define DT_hundredths(num) ((unsigned int)(((num) - (unsigned int)(num)) * 100))\r
-\r
-typedef struct\r
-{\r
- unsigned int num;\r
- DT_Mdep_TimeStamp total_ts;\r
- DT_Mdep_TimeStamp max_ts;\r
- DT_Mdep_TimeStamp min_ts;\r
-} Performance_Stats_Data_t;\r
-\r
-\r
-typedef struct\r
-{\r
- unsigned int num_ops;\r
- int64_t bytes;\r
- unsigned int post_ctxt_switch_num;\r
- unsigned int reap_ctxt_switch_num;\r
- double cpu_utilization;\r
- DT_Mdep_TimeStamp time_ts;\r
- Performance_Stats_Data_t posts_sans_ctxt;\r
- Performance_Stats_Data_t posts_with_ctxt;\r
- Performance_Stats_Data_t reaps_sans_ctxt;\r
- Performance_Stats_Data_t reaps_with_ctxt;\r
- Performance_Stats_Data_t latency;\r
-} Performance_Stats_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_PERFORMANCE_TEST_H__\r
-#define __DAPL_PERFORMANCE_TEST_H__\r
-\r
-#include "dapl_common.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_performance_cmd.h"\r
-\r
-\r
-#define DT_PERF_SYNC_SEND_BUFFER_ID 0\r
-#define DT_PERF_SYNC_RECV_BUFFER_ID 1\r
-#define DT_PERF_SYNC_BUFF_SIZE sizeof(RemoteMemoryInfo)\r
-#define DT_PERF_DFLT_EVD_LENGTH 8\r
-\r
-typedef struct\r
-{\r
- DT_Transfer_Type transfer_type;\r
- DAT_UINT32 num_segs;\r
- DAT_UINT32 seg_size;\r
- Bpool *bp;\r
-\r
- /* RDMA info */\r
- DAT_RMR_CONTEXT Rdma_Context;\r
- DAT_PVOID Rdma_Address;\r
-} Performance_Test_Op_t;\r
-\r
-typedef struct\r
-{\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EP_ATTR ep_attr;\r
- DAT_CONN_QUAL port;\r
- DAT_COUNT pipeline_len;\r
- Bpool *bp;\r
- Performance_Test_Op_t op;\r
-} Performance_Ep_Context_t;\r
-\r
-typedef struct\r
-{\r
- Per_Test_Data_t *pt_ptr;\r
- Performance_Cmd_t *cmd;\r
- DAT_IA_ADDRESS_PTR remote_ia_addr;\r
- DAT_BOOLEAN is_remote_little_endian;\r
- DAT_CONN_QUAL base_port;\r
- DAT_IA_ATTR ia_attr;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_CNO_HANDLE cno_handle;\r
- DAT_COUNT reqt_evd_length;\r
- DAT_EVD_HANDLE reqt_evd_hdl; /* request+rmr */\r
- DAT_COUNT recv_evd_length;\r
- DAT_EVD_HANDLE recv_evd_hdl; /* receive */\r
- DAT_COUNT conn_evd_length;\r
- DAT_EVD_HANDLE conn_evd_hdl; /* connect */\r
- DAT_COUNT creq_evd_length;\r
- DAT_EVD_HANDLE creq_evd_hdl; /* "" request */\r
- Performance_Ep_Context_t ep_context;\r
-} Performance_Test_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_performance_test.h"\r
-#include "dapl_proto.h"\r
-\r
-#define DT_Mdep_GetContextSwitchNum() 0 /* FIXME */\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_Performance_Test_Create (\r
- Per_Test_Data_t *pt_ptr,\r
- DAT_IA_HANDLE *ia_handle,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr,\r
- DAT_BOOLEAN is_server,\r
- DAT_BOOLEAN is_remote_little_endian,\r
- Performance_Test_t **perf_test)\r
-{\r
- Performance_Test_t *test_ptr;\r
- DAT_COUNT pipeline_len;\r
- DAT_RETURN ret;\r
-\r
- test_ptr = DT_MemListAlloc (pt_ptr,\r
- "transaction_test_t",\r
- TRANSACTIONTEST,\r
- sizeof (Performance_Test_t));\r
- if ( NULL == test_ptr )\r
- {\r
- return false;\r
- }\r
-\r
- *perf_test = test_ptr;\r
-\r
- test_ptr->pt_ptr = pt_ptr;\r
- test_ptr->remote_ia_addr = remote_ia_addr;\r
- test_ptr->is_remote_little_endian = is_remote_little_endian;\r
- test_ptr->base_port = (DAT_CONN_QUAL) pt_ptr->Server_Info.first_port_number;\r
- test_ptr->ia_handle = ia_handle;\r
- test_ptr->cmd = &pt_ptr->Params.u.Performance_Cmd;\r
-\r
- ret = dat_ia_query (test_ptr->ia_handle,\r
- NULL,\r
- DAT_IA_ALL,\r
- &test_ptr->ia_attr,\r
- 0,\r
- NULL);\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ia_query error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- return false;\r
- }\r
-\r
- pipeline_len = DT_min (\r
- DT_min (test_ptr->cmd->num_iterations, \r
- test_ptr->cmd->pipeline_len),\r
- (DAT_UINT32)DT_min (test_ptr->ia_attr.max_dto_per_ep,\r
- test_ptr->ia_attr.max_evd_qlen));\r
-\r
- if ( RDMA_READ == test_ptr->cmd->op.transfer_type )\r
- {\r
- pipeline_len = DT_min (pipeline_len, \r
- test_ptr->ia_attr.max_rdma_read_per_ep);\r
- }\r
-\r
- test_ptr->reqt_evd_length = pipeline_len;\r
- test_ptr->recv_evd_length = DT_PERF_DFLT_EVD_LENGTH;\r
- test_ptr->conn_evd_length = DT_PERF_DFLT_EVD_LENGTH;\r
- test_ptr->creq_evd_length = DT_PERF_DFLT_EVD_LENGTH;\r
-\r
- /* create a protection zone */\r
- ret = dat_pz_create (test_ptr->ia_handle, &test_ptr->pz_handle);\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_pz_create error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->pz_handle = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
-\r
- /* create 4 EVDs - recv, request+RMR, conn-request, connect */\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->recv_evd_length,\r
- test_ptr->cno_handle,\r
- DAT_EVD_DTO_FLAG,\r
- &test_ptr->recv_evd_hdl); /* recv */\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (recv) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->recv_evd_hdl = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
-\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->reqt_evd_length,\r
- test_ptr->cno_handle,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &test_ptr->reqt_evd_hdl); /* request + rmr bind */\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (request) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->reqt_evd_hdl = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
-\r
-\r
- if ( is_server )\r
- {\r
- /* Client-side doesn't need CR events */\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->creq_evd_length,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CR_FLAG,\r
- &test_ptr->creq_evd_hdl); /* cr */\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (cr) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->creq_evd_hdl = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
- }\r
-\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->conn_evd_length,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CONNECTION_FLAG,\r
- &test_ptr->conn_evd_hdl); /* conn */\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (conn) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->conn_evd_hdl = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
-\r
- /*\r
- * Set up the EP context:\r
- * create the EP\r
- * allocate buffers for remote memory info and sync message\r
- * post the receive buffers\r
- * connect\r
- * set up buffers and remote memory info\r
- * send across our info\r
- * recv the other side's info and extract what we need\r
- */\r
- test_ptr->ep_context.ep_attr = test_ptr->pt_ptr->ep_attr;\r
- test_ptr->ep_context.ep_attr.max_request_dtos = pipeline_len;\r
-\r
- /* Create EP */\r
- ret = dat_ep_create (test_ptr->ia_handle, /* IA */\r
- test_ptr->pz_handle, /* PZ */\r
- test_ptr->recv_evd_hdl, /* recv */\r
- test_ptr->reqt_evd_hdl, /* request */\r
- test_ptr->conn_evd_hdl, /* connect */\r
- &test_ptr->ep_context.ep_attr, /* EP attrs */\r
- &test_ptr->ep_context.ep_handle);\r
- if ( DAT_SUCCESS != ret)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_create error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->ep_context.ep_handle = DAT_HANDLE_NULL;\r
- return false;\r
- }\r
-\r
- /*\r
- * Allocate a buffer pool so we can exchange the\r
- * remote memory info and initialize.\r
- */\r
- test_ptr->ep_context.bp = DT_BpoolAlloc (test_ptr->pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context.ep_handle,\r
- DAT_HANDLE_NULL, /* rmr */\r
- DT_PERF_SYNC_BUFF_SIZE,\r
- 2, /* 2 RMIs */\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if ( !test_ptr->ep_context.bp )\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for remote memory buffers\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- return false;\r
- }\r
-\r
- DT_Mdep_spew (3, ("0: SYNC_SEND %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp, DT_PERF_SYNC_SEND_BUFFER_ID)));\r
- DT_Mdep_spew (3, ("1: SYNC_RECV %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context.bp, DT_PERF_SYNC_RECV_BUFFER_ID)));\r
-\r
- /*\r
- * Post recv and sync buffers\r
- */\r
- if ( !DT_post_recv_buffer (test_ptr->ep_context.ep_handle,\r
- test_ptr->ep_context.bp,\r
- DT_PERF_SYNC_RECV_BUFFER_ID,\r
- DT_PERF_SYNC_BUFF_SIZE) )\r
- {\r
- /* error message printed by DT_post_recv_buffer */\r
- return false;\r
- }\r
-\r
- /*\r
- * Fill in the test_ptr with relevant command info\r
- */\r
- test_ptr->ep_context.op.transfer_type\r
- = test_ptr->cmd->op.transfer_type;\r
- test_ptr->ep_context.op.num_segs\r
- = test_ptr->cmd->op.num_segs;\r
- test_ptr->ep_context.op.seg_size\r
- = test_ptr->cmd->op.seg_size;\r
-\r
- /*\r
- * Exchange remote memory info: If we're going to participate\r
- * in an RDMA, we need to allocate memory buffers and advertise\r
- * them to the other side.\r
- */\r
- test_ptr->ep_context.op.Rdma_Context = (DAT_RMR_CONTEXT) 0;\r
- test_ptr->ep_context.op.Rdma_Address = (DAT_PVOID) 0;\r
- test_ptr->ep_context.port = test_ptr->base_port;\r
- test_ptr->ep_context.pipeline_len = pipeline_len;\r
-\r
- return true;\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-void\r
-DT_Performance_Test_Destroy (\r
- Per_Test_Data_t *pt_ptr,\r
- Performance_Test_t *test_ptr,\r
- DAT_BOOLEAN is_server)\r
-{\r
- DAT_RETURN ret;\r
- DAT_EP_HANDLE ep_handle;\r
-\r
- ep_handle = DAT_HANDLE_NULL;\r
-\r
- /* Free the per-op buffers */\r
- if (test_ptr->ep_context.op.bp)\r
- {\r
- if (!DT_Bpool_Destroy (test_ptr->pt_ptr,\r
- test_ptr->ep_context.op.bp))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: Bpool destroy fails\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- /* carry on trying, regardless */\r
- }\r
- }\r
-\r
- /* Free the remote memory info exchange buffers */\r
- if (test_ptr->ep_context.bp)\r
- {\r
- if (!DT_Bpool_Destroy (test_ptr->pt_ptr,\r
- test_ptr->ep_context.bp))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: Bpool destroy fails\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- /* carry on trying, regardless */\r
- }\r
- }\r
-\r
- /*\r
- * Disconnect -- we may have left recv buffers posted, if we\r
- * bailed out mid-setup, or ran to completion\r
- * normally, so we use abrupt closure.\r
- */\r
- if (test_ptr->ep_context.ep_handle)\r
- {\r
- ret = dat_ep_disconnect (test_ptr->ep_context.ep_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: dat_ep_disconnect error %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- DT_RetToString (ret));\r
- /* carry on trying, regardless */\r
- }\r
- else if (!DT_disco_event_wait ( test_ptr->conn_evd_hdl,\r
- &ep_handle))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: bad disconnect event\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- }\r
- }\r
-\r
- if ( DAT_HANDLE_NULL != ep_handle)\r
- {\r
- /* Destroy the EP */\r
- ret = dat_ep_free (ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* carry on trying, regardless */\r
- }\r
- }\r
-\r
- /* clean up the EVDs */\r
- if (test_ptr->conn_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (conn) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- if (is_server)\r
- {\r
- if (test_ptr->creq_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->creq_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (creq) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- }\r
- if (test_ptr->reqt_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (reqt) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- if (test_ptr->recv_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (recv) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-\r
-#if 0 /* FIXME */\r
- /* clean up the CNO */\r
- if (test_ptr->cmd->use_cno && test_ptr->cno_handle)\r
- {\r
- ret = dat_cno_free (test_ptr->cno_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cno_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-#endif /* FIXME */\r
-\r
- /* clean up the PZ */\r
- if (test_ptr->pz_handle)\r
- {\r
- ret = dat_pz_free (test_ptr->pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_pz_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: cleanup is done\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- DT_MemListFree (test_ptr->pt_ptr, test_ptr);\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-bool\r
-DT_performance_post_rdma_op (\r
- Performance_Ep_Context_t *ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- Performance_Stats_t *stats)\r
-{\r
- unsigned int j;\r
- unsigned long int bytes;\r
- unsigned long pre_ctxt_num;\r
- unsigned long post_ctxt_num;\r
- DT_Mdep_TimeStamp pre_ts;\r
- DT_Mdep_TimeStamp post_ts;\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RETURN ret;\r
- Performance_Test_Op_t *op = &ep_context->op;\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (op->bp, 0);\r
- DAT_RMR_TRIPLET rmr_triplet;\r
-\r
- bytes = op->seg_size * op->num_segs;\r
-\r
- /* Prep the inputs */\r
- for (j = 0; j < op->num_segs; j++)\r
- {\r
- iov[j].pad = 0U;\r
- iov[j].virtual_address = (DAT_VADDR) (uintptr_t) \r
- DT_Bpool_GetBuffer (op->bp, j);\r
- iov[j].segment_length = op->seg_size;\r
- iov[j].lmr_context = DT_Bpool_GetLMR (op->bp, j);\r
- }\r
-\r
- rmr_triplet.pad = 0U;\r
- rmr_triplet.target_address = (DAT_VADDR) (uintptr_t) op->Rdma_Address;\r
- rmr_triplet.segment_length = op->seg_size * op->num_segs;\r
- rmr_triplet.rmr_context = op->Rdma_Context;\r
-\r
- cookie.as_ptr = NULL;\r
-\r
- if ( RDMA_WRITE == op->transfer_type )\r
- {\r
- pre_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- ret = dat_ep_post_rdma_write (ep_context->ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- post_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
-\r
- stats->bytes += bytes;\r
- }\r
- else\r
- {\r
- pre_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- ret = dat_ep_post_rdma_read (ep_context->ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- post_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
-\r
- stats->bytes += bytes;\r
- }\r
-\r
- if ( DAT_SUCCESS != ret )\r
- {\r
- return false;\r
- }\r
-\r
- DT_performance_stats_record_post (stats, \r
- post_ctxt_num - pre_ctxt_num, \r
- post_ts - pre_ts);\r
-\r
- return true;\r
-}\r
-\r
-/****************************************************************************/\r
-unsigned int\r
-DT_performance_reap (\r
- DAT_EVD_HANDLE evd_handle,\r
- Performance_Mode_Type mode,\r
- Performance_Stats_t *stats)\r
-{\r
- if ( BLOCKING_MODE == mode )\r
- {\r
- return DT_performance_wait (evd_handle, stats);\r
- }\r
- else\r
- {\r
- return DT_performance_poll (evd_handle, stats);\r
- }\r
-}\r
-\r
-/****************************************************************************/\r
-unsigned int\r
-DT_performance_wait (\r
- DAT_EVD_HANDLE evd_handle,\r
- Performance_Stats_t *stats)\r
-{\r
- DAT_COUNT i;\r
- DAT_COUNT queue_size;\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- unsigned long pre_ctxt_num;\r
- unsigned long post_ctxt_num;\r
- DT_Mdep_TimeStamp pre_ts;\r
- DT_Mdep_TimeStamp post_ts;\r
-\r
- queue_size = 0;\r
-\r
- pre_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- ret = dat_evd_wait ( evd_handle, \r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &queue_size);\r
-\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- post_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
-\r
- if ( DAT_SUCCESS != ret )\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_dequeue failed: %s\n",\r
- DT_RetToString (ret));\r
- return 0;\r
- }\r
- else if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- DT_performance_stats_record_reap (stats, \r
- post_ctxt_num - pre_ctxt_num, \r
- post_ts - pre_ts);\r
- }\r
- else\r
- {\r
- /* This should not happen. There has been an error if it does. */\r
-\r
- DT_Mdep_printf ("Warning: dapl_performance_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
-\r
- return 0;\r
- }\r
-\r
- for ( i = 0; i < queue_size; i++ )\r
- {\r
- pre_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- ret = dat_evd_dequeue ( evd_handle,\r
- &event);\r
-\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- post_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
-\r
- if (DAT_GET_TYPE(ret) == DAT_QUEUE_EMPTY)\r
- {\r
- continue;\r
- }\r
- else if ( DAT_SUCCESS != ret )\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_dequeue failed: %s\n",\r
- DT_RetToString (ret));\r
- return 0;\r
- }\r
- else if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- DT_performance_stats_record_reap (stats, \r
- post_ctxt_num - pre_ctxt_num, \r
- post_ts - pre_ts);\r
- }\r
- else\r
- {\r
- /* This should not happen. There has been an error if it does. */\r
-\r
- DT_Mdep_printf ("Warning: dapl_performance_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
-\r
- return 0;\r
- }\r
- }\r
-\r
- return ++queue_size;\r
-}\r
-\r
-/****************************************************************************/\r
-unsigned int\r
-DT_performance_poll (\r
- DAT_EVD_HANDLE evd_handle,\r
- Performance_Stats_t *stats)\r
-{\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- unsigned long pre_ctxt_num;\r
- unsigned long post_ctxt_num;\r
- DT_Mdep_TimeStamp pre_ts;\r
- DT_Mdep_TimeStamp post_ts;\r
-\r
- for (;;)\r
- {\r
- pre_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
- pre_ts = DT_Mdep_GetTimeStamp ();\r
-\r
- ret = dat_evd_dequeue ( evd_handle,\r
- &event);\r
-\r
- post_ts = DT_Mdep_GetTimeStamp ();\r
- post_ctxt_num = DT_Mdep_GetContextSwitchNum ();\r
-\r
- if (DAT_GET_TYPE(ret) == DAT_QUEUE_EMPTY)\r
- {\r
- continue;\r
- }\r
- else if ( DAT_SUCCESS != ret )\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_dequeue failed: %s\n",\r
- DT_RetToString (ret));\r
- return 0;\r
- }\r
- else if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- DT_performance_stats_record_reap (stats, \r
- post_ctxt_num - pre_ctxt_num, \r
- post_ts - pre_ts);\r
- return 1;\r
- }\r
- else\r
- {\r
- /* This should not happen. There has been an error if it does. */\r
-\r
- DT_Mdep_printf ("Warning: dapl_performance_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
-\r
- return 0;\r
- }\r
- }\r
-\r
- /*never reached */\r
- return 0;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_PROTO_H__\r
-#define __DAPL_PROTO_H__\r
-\r
-#include <ctype.h>\r
-#include <stdlib.h>\r
-#include <stdarg.h>\r
-#include <string.h>\r
-#include <dat/udat.h>\r
-#include "dapl_common.h"\r
-#include "dapl_client_info.h"\r
-#include "dapl_cnxn.h"\r
-#include "dapl_bpool.h"\r
-#include "dapl_client_info.h"\r
-#include "dapl_transaction_stats.h"\r
-#include "dapl_getopt.h"\r
-#include "dapl_limit_cmd.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_params.h"\r
-#include "dapl_performance_stats.h"\r
-#include "dapl_performance_test.h"\r
-#include "dapl_quit_cmd.h"\r
-#include "dapl_server_info.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_transaction_test.h"\r
-#include "dapl_version.h"\r
-#include "dapl_fft_cmd.h"\r
-#include "dapl_fft_util.h"\r
-\r
-/*\r
- * Prototypes\r
- */\r
-\r
-/* dapl_bpool.c */\r
-Bpool * DT_BpoolAlloc (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_PZ_HANDLE pz_handle,\r
- DAT_EP_HANDLE ep_handle,\r
- DAT_EVD_HANDLE rmr_evd_handle,\r
- DAT_COUNT seg_size,\r
- DAT_COUNT num_segs,\r
- DAT_COUNT alignment,\r
- DAT_BOOLEAN enable_rdma_write,\r
- DAT_BOOLEAN enable_rdma_read);\r
-\r
-bool DT_Bpool_Destroy (Per_Test_Data_t * pt_ptr,\r
- Bpool * bpool_ptr);\r
-\r
-unsigned char *DT_Bpool_GetBuffer (Bpool * bpool_ptr, int index);\r
-DAT_COUNT DT_Bpool_GetBuffSize (Bpool * bpool_ptr, int index);\r
-DAT_LMR_TRIPLET *DT_Bpool_GetIOV (Bpool * bpool_ptr, int index);\r
-DAT_LMR_CONTEXT DT_Bpool_GetLMR (Bpool * bpool_ptr, int index);\r
-DAT_RMR_CONTEXT DT_Bpool_GetRMR (Bpool * bpool_ptr, int index);\r
-\r
-void DT_Bpool_print (Bpool * bpool_ptr);\r
-\r
-/* dapl_cnxn.c */\r
-int get_ep_connection_state (DAT_EP_HANDLE ep_handle);\r
-\r
-/* dapl_client.c */\r
-void DT_cs_Client (Params_t * params_ptr,\r
- char *dapl_name,\r
- char *server_name,\r
- DAT_UINT32 total_threads);\r
-\r
-/* dapl_client_info.c */\r
-void DT_Client_Info_Endian (Client_Info_t * client_info);\r
-\r
-void DT_Client_Info_Print (Client_Info_t * client_info);\r
-\r
-/* dapl_transaction_stats.c */\r
-void DT_init_transaction_stats (Transaction_Stats_t * transaction_stats,\r
- unsigned int nums);\r
-void DT_transaction_stats_set_ready (Transaction_Stats_t * transaction_stats);\r
-\r
-bool DT_transaction_stats_wait_for_all (Transaction_Stats_t * transaction_stats);\r
-\r
-void DT_update_transaction_stats (Transaction_Stats_t * transaction_stats,\r
- unsigned int num_ops,\r
- unsigned int time_ms,\r
- unsigned int bytes_send,\r
- unsigned int bytes_recv,\r
- unsigned int bytes_rdma_read,\r
- unsigned int bytes_rdma_write);\r
-\r
-void DT_print_transaction_stats (Transaction_Stats_t * transaction_stats,\r
- unsigned int num_threads,\r
- unsigned int num_EPs);\r
-\r
-/* dapl_endian.c */\r
-void DT_Endian_Init (void);\r
-DAT_UINT32 DT_Endian32 (DAT_UINT32 val);\r
-DAT_UINT64 DT_Endian64 (DAT_UINT64 val);\r
-DAT_UINT32 DT_EndianMemHandle (DAT_UINT32 val);\r
-DAT_UINT64 DT_EndianMemAddress (DAT_UINT64 val);\r
-\r
-/* dapl_main.c */\r
-int __cdecl main (int argc, char *argv[]);\r
-\r
-int dapltest (int argc, char *argv[]);\r
-\r
-void Dapltest_Main_Usage (void);\r
-\r
-/* dapl_mdep.c */\r
-bool DT_Mdep_Init (void);\r
-void DT_Mdep_End (void);\r
-bool DT_Mdep_GetDefaultDeviceName (char *dapl_name);\r
-void DT_Mdep_Sleep (int msec);\r
-bool DT_Mdep_GetCpuStat (DT_CpuStat *sys_stat);\r
-unsigned long DT_Mdep_GetTime (void);\r
-double DT_Mdep_GetCpuMhz (void);\r
-unsigned long DT_Mdep_GetContextSwitchNum (void);\r
-void *DT_Mdep_Malloc (size_t l_);\r
-void DT_Mdep_Free (void *a_);\r
-bool DT_Mdep_LockInit (DT_Mdep_LockType * lock_ptr);\r
-void DT_Mdep_LockDestroy (DT_Mdep_LockType * lock_ptr);\r
-void DT_Mdep_Lock (DT_Mdep_LockType * lock_ptr);\r
-void DT_Mdep_Unlock (DT_Mdep_LockType * lock_ptr);\r
-void DT_Mdep_Thread_Init_Attributes (Thread * thread_ptr);\r
-void DT_Mdep_Thread_Destroy_Attributes (Thread * thread_ptr);\r
-bool DT_Mdep_Thread_Start (Thread * thread_ptr);\r
-\r
-void DT_Mdep_Thread_Detach (int thread_id);\r
-int DT_Mdep_Thread_SELF ( void ); \r
-void DT_Mdep_Thread_EXIT ( void * thread_handle ); \r
-int DT_Mdep_wait_object_init ( IN DT_WAIT_OBJECT *wait_obj);\r
-int DT_Mdep_wait_object_wait ( IN DT_WAIT_OBJECT *wait_obj, \r
- IN int timeout_val);\r
-int DT_Mdep_wait_object_wakeup ( IN DT_WAIT_OBJECT *wait_obj);\r
-int DT_Mdep_wait_object_destroy ( IN DT_WAIT_OBJECT *wait_obj);\r
-\r
-\r
-DT_Mdep_Thread_Start_Routine_Return_Type\r
- DT_Mdep_Thread_Start_Routine (void *thread_handle);\r
-\r
-/* dapl_memlist.c */\r
-void DT_MemListInit (Per_Test_Data_t * pt_ptr);\r
-void *DT_MemListAlloc (Per_Test_Data_t * pt_ptr,\r
- char *file,\r
- mem_type_e t,\r
- int size);\r
-void DT_MemListFree (Per_Test_Data_t * pt_ptr,\r
- void *ptr);\r
-void DT_PrintMemList (Per_Test_Data_t * pt_ptr);\r
-\r
-/* dapl_netaddr.c */\r
-bool DT_NetAddrLookupHostAddress (DAT_IA_ADDRESS_PTR to_netaddr,\r
- char *hostname);\r
-\r
-DAT_IA_ADDRESS_PTR DT_NetAddrAlloc (Per_Test_Data_t * pt_ptr);\r
-\r
-void DT_NetAddrFree (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_ADDRESS_PTR netaddr);\r
-\r
-/* dapl_params.c */\r
-bool DT_Params_Parse (int argc,\r
- char *argv[],\r
- Params_t * params_ptr);\r
-\r
-/* dapl_performance_cmd.c */\r
-const char * DT_PerformanceModeToString (Performance_Mode_Type mode);\r
-\r
-bool DT_Performance_Cmd_Init (Performance_Cmd_t * cmd);\r
-\r
-bool DT_Performance_Cmd_Parse (Performance_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-void DT_Performance_Cmd_Print (Performance_Cmd_t * cmd);\r
-\r
-void DT_Performance_Cmd_Endian (Performance_Cmd_t * cmd);\r
-\r
-/* dapl_performance_client.c */\r
-void DT_Performance_Test_Client (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE * ia_handle,\r
- DAT_IA_ADDRESS_PTR remote);\r
-\r
-bool DT_Performance_Test_Client_Connect (\r
- Performance_Test_t * test_ptr);\r
-\r
-bool DT_Performance_Test_Client_Exchange (\r
- Performance_Test_t *test_ptr);\r
-\r
-/* dapl_performance_server.c */\r
-void DT_Performance_Test_Server (void * pt_ptr);\r
-\r
-bool DT_Performance_Test_Server_Connect (\r
- Performance_Test_t * test_ptr);\r
-\r
-bool DT_Performance_Test_Server_Exchange (\r
- Performance_Test_t *test_ptr);\r
-\r
-/* dapl_performance_util.c */\r
-bool DT_Performance_Test_Create (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE * ia_handle,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr,\r
- DAT_BOOLEAN is_server,\r
- DAT_BOOLEAN is_remote_little_endian,\r
- Performance_Test_t **perf_test);\r
-\r
-void DT_Performance_Test_Destroy (Per_Test_Data_t * pt_ptr,\r
- Performance_Test_t *test_ptr,\r
- DAT_BOOLEAN is_server);\r
-\r
-bool DT_performance_post_rdma_op (Performance_Ep_Context_t *ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- Performance_Stats_t *stats);\r
-\r
-unsigned int DT_performance_reap (DAT_EVD_HANDLE evd_handle,\r
- Performance_Mode_Type mode,\r
- Performance_Stats_t *stats);\r
-\r
-unsigned int DT_performance_wait (DAT_EVD_HANDLE evd_handle,\r
- Performance_Stats_t *stats);\r
-\r
-unsigned int DT_performance_poll (DAT_EVD_HANDLE evd_handle,\r
- Performance_Stats_t *stats);\r
-\r
-/* dapl_performance_stats.c */\r
-void DT_performance_stats_init (Performance_Stats_t * stats);\r
-\r
-void DT_performance_stats_record_post (Performance_Stats_t *stats, \r
- unsigned long ctxt_switch_num,\r
- DT_Mdep_TimeStamp ts);\r
-\r
-void DT_performance_stats_record_reap (Performance_Stats_t *stats, \r
- unsigned long ctxt_switch_num,\r
- DT_Mdep_TimeStamp ts);\r
-\r
-void DT_performance_stats_record_latency (Performance_Stats_t *stats, \r
- DT_Mdep_TimeStamp ts);\r
-\r
-void DT_performance_stats_data_combine (Performance_Stats_Data_t * dest,\r
- Performance_Stats_Data_t * src_a,\r
- Performance_Stats_Data_t * src_b);\r
-\r
-void DT_performance_stats_combine (Performance_Stats_t * dest,\r
- Performance_Stats_t * src_a,\r
- Performance_Stats_t * src_b);\r
-\r
-double DT_performance_stats_data_print (Performance_Stats_Data_t * data,\r
- double cpu_mhz);\r
-\r
-void DT_performance_stats_print (Performance_Stats_t * stats,\r
- Performance_Cmd_t * cmd,\r
- Performance_Test_t * test);\r
-\r
-\r
-/* dapl_server.c */\r
-void DT_cs_Server (Params_t * params_ptr);\r
-\r
-/* dapl_server_cmd.c */\r
-void DT_Server_Cmd_Init (Server_Cmd_t * Server_Cmd);\r
-\r
-bool DT_Server_Cmd_Parse (Server_Cmd_t * Server_Cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-void DT_Server_Cmd_Print (Server_Cmd_t * Server_Cmd);\r
-\r
-void DT_Server_Cmd_Usage (void);\r
-\r
-/* dapl_server_info.c */\r
-void DT_Server_Info_Endian (Server_Info_t * server_info);\r
-\r
-void DT_Server_Info_Print (Server_Info_t * server_info);\r
-\r
-/* dapl_test_data.c */\r
-Per_Test_Data_t *DT_Alloc_Per_Test_Data (void);\r
-\r
-void DT_Free_Per_Test_Data (Per_Test_Data_t * pt_ptr);\r
-\r
-/* dapl_test_util.c */\r
-DAT_BOOLEAN DT_query (Per_Test_Data_t *pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_EP_HANDLE ep_handle);\r
-\r
-DAT_BOOLEAN DT_post_recv_buffer (DAT_EP_HANDLE ep_handle,\r
- Bpool * bp,\r
- int index,\r
- int size);\r
-\r
-DAT_BOOLEAN DT_post_send_buffer (DAT_EP_HANDLE ep_handle,\r
- Bpool * bp,\r
- int index,\r
- int size);\r
-\r
-bool DT_conn_event_wait (DAT_EP_HANDLE ep_handle,\r
- DAT_EVD_HANDLE evd_handle,\r
- DAT_EVENT_NUMBER *event_number);\r
-\r
-bool DT_disco_event_wait ( DAT_EVD_HANDLE evd_handle,\r
- DAT_EP_HANDLE *ep_handle );\r
-\r
-bool DT_cr_event_wait (DAT_EVD_HANDLE evd_handle,\r
- DAT_CR_ARRIVAL_EVENT_DATA *cr_stat_p);\r
-\r
-bool DT_dto_event_reap (DAT_EVD_HANDLE evd_handle,\r
- bool poll,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dtop);\r
-\r
-bool DT_dto_event_wait (DAT_EVD_HANDLE evd_handle,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dtop);\r
-\r
-bool DT_dto_event_poll (DAT_EVD_HANDLE evd_handle,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dtop);\r
-\r
-bool DT_rmr_event_wait (DAT_EVD_HANDLE evd_handle,\r
- DAT_RMR_BIND_COMPLETION_EVENT_DATA *rmr_ptr);\r
-\r
-bool DT_dto_check ( DAT_DTO_COMPLETION_EVENT_DATA *dto_p,\r
- DAT_EP_HANDLE ep_expected,\r
- DAT_VLEN len_expected,\r
- DAT_DTO_COOKIE cookie_expected,\r
- char *message);\r
-\r
-bool DT_rmr_check ( DAT_RMR_BIND_COMPLETION_EVENT_DATA *rmr_p,\r
- DAT_RMR_HANDLE rmr_expected,\r
- DAT_PVOID cookie_expected,\r
- char *message);\r
-\r
-bool DT_cr_check (DAT_CR_ARRIVAL_EVENT_DATA *cr_stat_p,\r
- DAT_PSP_HANDLE psp_handle_expected,\r
- DAT_CONN_QUAL port_expected,\r
- DAT_CR_HANDLE *cr_handlep,\r
- char *message);\r
-\r
-/* dapl_thread.c */\r
-void DT_Thread_Init (Per_Test_Data_t * pt_ptr);\r
-\r
-void DT_Thread_End (Per_Test_Data_t * pt_ptr);\r
-\r
-Thread *DT_Thread_Create (Per_Test_Data_t * pt_ptr,\r
- void (*fn) (void *),\r
- void *param,\r
- unsigned int stacksize);\r
-\r
-void DT_Thread_Destroy (Thread * thread_ptr,\r
- Per_Test_Data_t * pt_ptr);\r
-\r
-bool DT_Thread_Start (Thread * thread_ptr);\r
-\r
-/* dapl_quit_cmd.c */\r
-void DT_Quit_Cmd_Init (Quit_Cmd_t * cmd);\r
-\r
-bool DT_Quit_Cmd_Parse (Quit_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-bool DT_Quit_Cmd_Validate (Quit_Cmd_t * cmd);\r
-\r
-void DT_Quit_Cmd_Endian (Quit_Cmd_t * cmd,\r
- bool to_wire);\r
-\r
-void DT_Quit_Cmd_Print (Quit_Cmd_t * cmd);\r
-\r
-void DT_Quit_Cmd_Usage (void);\r
-\r
-/* dapl_transaction_cmd.c */\r
-void DT_Transaction_Cmd_Init (Transaction_Cmd_t * cmd);\r
-\r
-bool DT_Transaction_Cmd_Parse (Transaction_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-void DT_Transaction_Cmd_Print (Transaction_Cmd_t * cmd);\r
-\r
-void DT_Transaction_Cmd_Endian (Transaction_Cmd_t * cmd,\r
- bool to_wire);\r
-/* dapl_transaction_test.c */\r
-void DT_Transaction_Test_Client (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_IA_ADDRESS_PTR remote);\r
-\r
-void DT_Transaction_Test_Server (void *params);\r
-\r
-bool DT_Transaction_Create_Test (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE * ia_handle,\r
- DAT_BOOLEAN is_server,\r
- unsigned int port_num,\r
- DAT_BOOLEAN remote_is_little_endian,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr);\r
-\r
-void DT_Transaction_Main (void *param);\r
-bool DT_Transaction_Run (Transaction_Test_t * test_ptr);\r
-void DT_Transaction_Validation_Fill (Transaction_Test_t * test_ptr,\r
- unsigned int iteration);\r
-bool DT_Transaction_Validation_Check (Transaction_Test_t * test_ptr,\r
- int iteration);\r
-void DT_Print_Transaction_Test (Transaction_Test_t * test_ptr);\r
-void DT_Print_Transaction_Stats (Transaction_Test_t * test_ptr);\r
-\r
-/* dapl_transaction_util.c */\r
-bool DT_handle_post_recv_buf (Ep_Context_t * ep_context,\r
- unsigned int num_eps,\r
- int op_indx);\r
-\r
-bool DT_handle_send_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- int op_indx,\r
- bool poll);\r
-\r
-bool DT_handle_recv_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE recv_evd_hdl,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- int op_indx,\r
- bool poll,\r
- bool repost_recv);\r
-\r
-bool DT_handle_rdma_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- DT_Transfer_Type opcode,\r
- int op_indx,\r
- bool poll);\r
-\r
-bool DT_check_params (Per_Test_Data_t *pt_ptr,\r
- unsigned char *module);\r
-\r
-void DT_Test_Error (void);\r
-\r
-/* dapl_util.c */\r
-const char *DT_RetToString (DAT_RETURN ret_value);\r
-\r
-const char *DT_TransferTypeToString (DT_Transfer_Type type);\r
-\r
-const char *DT_AsyncErr2Str (DAT_EVENT_NUMBER error_code);\r
-\r
-const char *DT_EventToSTr (DAT_EVENT_NUMBER event_code);\r
-\r
-const char *DT_State2Str (DAT_EP_STATE state_code);\r
-\r
-DAT_QOS DT_ParseQoS (char *arg);\r
-\r
-unsigned char *DT_AlignPtr (void * val, unsigned int align);\r
-\r
-DAT_COUNT DT_RoundSize (DAT_COUNT val, DAT_COUNT align);\r
-\r
-/* dapl_limit_cmd.c */\r
-void DT_Limit_Cmd_Init ( Limit_Cmd_t * cmd);\r
-\r
-bool DT_Limit_Cmd_Parse ( Limit_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-void DT_Limit_Cmd_Usage (void);\r
-\r
-/* dapl_limit.c */\r
-void DT_cs_Limit (Limit_Cmd_t * cmd);\r
-\r
-/* dapl_fft_cmd.c */\r
-void DT_FFT_Cmd_Init ( FFT_Cmd_t * cmd);\r
-\r
-bool DT_FFT_Cmd_Parse ( FFT_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts);\r
-\r
-void DT_FFT_Cmd_Usage (void);\r
-\r
-/* dapl_fft_test.c */\r
-void DT_cs_FFT ( FFT_Cmd_t * cmd);\r
-\r
-/* dapl_fft_hwconn.c */\r
-void DT_hwconn_test (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case0 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case1 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case2 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case3 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case4 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case5 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case6 (FFT_Cmd_t *cmd);\r
-int DT_hwconn_case7 (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_endpoint.c */\r
-void DT_endpoint_test (FFT_Cmd_t *cmd);\r
-int DT_endpoint_generic (FFT_Cmd_t *cmd,\r
- bool destroy_pz_early);\r
-int DT_endpoint_case0 (FFT_Cmd_t *cmd);\r
-int DT_endpoint_case1 (FFT_Cmd_t *cmd);\r
-int DT_endpoint_case2 (FFT_Cmd_t *cmd);\r
-int DT_endpoint_case3 (FFT_Cmd_t *cmd);\r
-int DT_endpoint_case4 (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_pz.c */\r
-void DT_pz_test (FFT_Cmd_t *cmd);\r
-int DT_pz_case0 (FFT_Cmd_t *cmd);\r
-int DT_pz_case1 (FFT_Cmd_t *cmd);\r
-int DT_pz_case2 (FFT_Cmd_t *cmd);\r
-int DT_pz_case3 (FFT_Cmd_t *cmd);\r
-int DT_pz_case4 (FFT_Cmd_t *cmd);\r
-int DT_pz_case5 (FFT_Cmd_t *cmd);\r
-int DT_pz_case6 (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_util.c */\r
-void DT_assert_fail (char *exp, char *file, char *baseFile, int line);\r
-int DT_ia_open (DAT_NAME_PTR dev_name, DAT_IA_HANDLE *ia_handle);\r
-DAT_RETURN DT_ia_close (DAT_IA_HANDLE, DAT_CLOSE_FLAGS);\r
-int DT_ep_create (DAT_IA_HANDLE ia_handle, DAT_PZ_HANDLE pz_handle,\r
- DAT_EVD_HANDLE *cr_evd,\r
- DAT_EVD_HANDLE *conn_evd, DAT_EVD_HANDLE *send_evd,\r
- DAT_EVD_HANDLE *recv_evd, DAT_EP_HANDLE *ep_handle);\r
-void DT_fft_init_conn_struct (FFT_Connection_t *conn);\r
-void DT_fft_init_client (FFT_Cmd_t *cmd, FFT_Connection_t *conn);\r
-int DT_fft_destroy_conn_struct (FFT_Connection_t *conn);\r
-void DT_fft_init_server (FFT_Cmd_t *cmd, FFT_Connection_t *conn);\r
-void DT_fft_listen (FFT_Connection_t *conn);\r
-int DT_fft_connect (FFT_Connection_t *conn);\r
-\r
-/* dapl_fft_dataxfer.c */\r
-int DT_dataxfer_case0 (FFT_Cmd_t *cmd);\r
-int DT_dataxfer_case1 (FFT_Cmd_t *cmd);\r
-int DT_dataxfer_case2 (FFT_Cmd_t *cmd);\r
-int DT_dataxfer_case3 (FFT_Cmd_t *cmd);\r
-int DT_dataxfer_generic (FFT_Cmd_t *cmd, int test_case);\r
-void DT_dataxfer_test (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_dataxfer_client.c */\r
-int DT_dataxfer_client_generic (FFT_Cmd_t *cmd, int flag);\r
-int DT_dataxfer_client_case0 (FFT_Cmd_t *cmd);\r
-void DT_dataxfer_client_test (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_connmgt.c */\r
-int DT_connmgt_case0 (FFT_Cmd_t *cmd);\r
-int DT_connmgt_case1 (FFT_Cmd_t *cmd);\r
-void DT_connmgt_test (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_mem.c */\r
-int DT_mem_generic (FFT_Cmd_t *cmd, int flag);\r
-int DT_mem_case0 (FFT_Cmd_t *cmd);\r
-int DT_mem_case1 (FFT_Cmd_t *cmd);\r
-int DT_mem_case2 (FFT_Cmd_t *cmd);\r
-int DT_mem_case3 (FFT_Cmd_t *cmd);\r
-int DT_mem_case4 (FFT_Cmd_t *cmd);\r
-int DT_mem_case5 (FFT_Cmd_t *cmd);\r
-int DT_mem_case6 (FFT_Cmd_t *cmd);\r
-int DT_mem_case7 (FFT_Cmd_t *cmd);\r
-int DT_mem_case8 (FFT_Cmd_t *cmd);\r
-int DT_mem_case9 (FFT_Cmd_t *cmd);\r
-int DT_mem_case10 (FFT_Cmd_t *cmd);\r
-int DT_mem_case11 (FFT_Cmd_t *cmd);\r
-void DT_mem_test (FFT_Cmd_t *cmd);\r
-\r
-/* dapl_fft_queryinfo.c */\r
-int DT_queryinfo_basic (FFT_Cmd_t *cmd, \r
- FFT_query_enum object_to_query, \r
- DAT_RETURN result_wanted);\r
-int DT_queryinfo_case0 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case1 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case2 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case3 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case4 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case5 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case6 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case7 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case8 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case9 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case10 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case11 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case12 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case13 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case14 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case15 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case16 (FFT_Cmd_t *cmd);\r
-int DT_queryinfo_case17 (FFT_Cmd_t *cmd);\r
-void DT_queryinfo_test (FFT_Cmd_t *cmd);\r
-\r
-#ifdef DYNAMIC_DAT_LOADING\r
-#define DAT_DLL_LIB DAT_DLL_NAME\r
-#define DAT_LIB_OPEN_ENTRY "dat_ia_openv"\r
-#define DAT_LIB_CLOSE_ENTRY "dat_ia_close"\r
-DAT_IA_OPENV_FUNC dat_open;\r
-DAT_IA_CLOSE_FUNC dat_close;\r
-#endif //DYNAMIC_DAT_LOADING\r
-\r
-#endif /* __DAPL_PROTO_H__ */\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_getopt.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_quit_cmd.h"\r
-\r
-/*--------------------------------------------------------- */\r
-void\r
-DT_Quit_Cmd_Init (Quit_Cmd_t * cmd)\r
-{\r
- memset ((void *)cmd, 0, sizeof (Quit_Cmd_t));\r
- cmd->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
-}\r
-\r
-/*--------------------------------------------------------- */\r
-bool\r
-DT_Quit_Cmd_Parse (Quit_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts)\r
-{\r
- char c;\r
-\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "ds:D:R:", opts);\r
- if (c == EOF)\r
- {\r
- break;\r
- }\r
- switch (c)\r
- {\r
- case 'D':\r
- {\r
- strcpy (cmd->device_name, opts->optarg);\r
- break;\r
- }\r
- case 's':\r
- {\r
- strcpy (cmd->server_name, opts->optarg);\r
- break;\r
- }\r
- case 'd': /* print debug messages */\r
- {\r
- DT_dapltest_debug++;\r
- cmd->debug = true;\r
- break;\r
- }\r
- case 'R': /* Service Reliability Level */\r
- {\r
- cmd->ReliabilityLevel= DT_ParseQoS (opts->optarg);\r
- break;\r
- }\r
- case '?':\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Quit option: %c\n", opts->optopt);\r
- DT_Quit_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
- if (cmd->device_name[0] == '\0')\r
- {\r
- if (!DT_Mdep_GetDefaultDeviceName (cmd->device_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- DT_Quit_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- if (!DT_Quit_Cmd_Validate (cmd))\r
- {\r
- DT_Quit_Cmd_Usage ();\r
- return (false);\r
- }\r
- return (true);\r
-}\r
-\r
-/*------------------------------------------------------------------------------ */\r
-bool\r
-DT_Quit_Cmd_Validate (Quit_Cmd_t * cmd)\r
-{\r
- if (cmd->server_name[0] == '\0')\r
- {\r
- DT_Mdep_printf ("Must specify server_name in command line or scriptfile\n");\r
- return (false);\r
- }\r
- return (true);\r
-}\r
-\r
-/*--------------------------------------------------------- */\r
-void\r
-DT_Quit_Cmd_Endian (Quit_Cmd_t * cmd,\r
- bool to_wire)\r
-{\r
- /* do nothing */\r
-}\r
-\r
-/*--------------------------------------------------------- */\r
-void\r
-DT_Quit_Cmd_Print (Quit_Cmd_t * cmd)\r
-{\r
- DT_Mdep_printf ("Quit_Cmd.server_name: %s\n", cmd->server_name);\r
- DT_Mdep_printf ("Quit_Cmd.device_name: %s\n", cmd->device_name);\r
-}\r
-\r
-/*--------------------------------------------------------- */\r
-void\r
-DT_Quit_Cmd_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE: ---- QUIT TEST ----\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T Q\n");\r
- DT_Mdep_printf ("USAGE: -s <server Name>\n");\r
- DT_Mdep_printf ("USAGE: [-D <device Name>]\n");\r
- DT_Mdep_printf ("USAGE: [-d] : debug (zero)\n");\r
- DT_Mdep_printf ("USAGE: [-R <service reliability>]\n");\r
- DT_Mdep_printf ("USAGE: (BE == QOS_BEST_EFFORT - Default)\n");\r
- DT_Mdep_printf ("USAGE: (HT == QOS_HIGH_THROUGHPUT)\n");\r
- DT_Mdep_printf ("USAGE: (LL == QOS_LOW_LATENCY)\n");\r
- DT_Mdep_printf ("USAGE: (EC == QOS_ECONOMY)\n");\r
- DT_Mdep_printf ("USAGE: (PM == QOS_PREMIUM)\n");\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_QUIT_CMD_H__\r
-#define __DAPL_QUIT_CMD_H__\r
-\r
-\r
-typedef struct\r
-{\r
- char server_name[256]; /* -s */\r
- char device_name[256]; /* -D */\r
- DAT_UINT32 debug; /* -d */\r
- DAT_QOS ReliabilityLevel; /* -R */\r
-} Quit_Cmd_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include <dat/udat.h>\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_client_info.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_server_info.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_transaction_test.h"\r
-#include "dapl_performance_cmd.h"\r
-#include "dapl_performance_test.h"\r
-#include "dapl_version.h"\r
-\r
-#define DFLT_QLEN 40 /* default event queue length */\r
-\r
-int send_control_data(unsigned char *buffp,\r
- Per_Server_Data_t *ps_ptr,\r
- Per_Test_Data_t *pt_ptr);\r
-\r
-void\r
-DT_cs_Server (Params_t * params_ptr)\r
-{\r
- Server_Cmd_t *Server_Cmd = ¶ms_ptr->u.Server_Cmd;\r
- Client_Info_t *Client_Info = NULL;\r
- Transaction_Cmd_t *Transaction_Cmd= NULL;\r
- Performance_Cmd_t *Performance_Cmd= NULL;\r
- Quit_Cmd_t *Quit_Cmd = NULL;\r
- Per_Server_Data_t *ps_ptr = NULL;\r
- Per_Test_Data_t *pt_ptr = NULL;\r
- Started_server_t *temp_list = NULL;\r
- Started_server_t *pre_list = NULL;\r
- unsigned char *buffp = NULL;\r
- unsigned char *module = "DT_cs_Server";\r
-\r
- DAT_DTO_COOKIE dto_cookie;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_RETURN ret;\r
-\r
- /* Check if device from command line already in use */\r
- temp_list = DT_started_server_list;\r
- while (temp_list)\r
- {\r
- if (strcmp (temp_list->devicename, Server_Cmd->dapl_name) == 0)\r
- {\r
- DT_Mdep_printf ("NOTICE: server already started for this NIC: %s\n",\r
- Server_Cmd->dapl_name);\r
- return;\r
- }\r
- temp_list = temp_list->next;\r
- }\r
-\r
- /* Alloc memory for server list */\r
- temp_list = (Started_server_t *) DT_Mdep_Malloc (sizeof (Started_server_t));\r
- if (temp_list == 0)\r
- {\r
- DT_Mdep_printf ("no memory for server_list\n");\r
- return;\r
- }\r
- strcpy (temp_list->devicename, Server_Cmd->dapl_name);\r
- temp_list->next = DT_started_server_list;\r
- DT_started_server_list = temp_list;\r
-\r
- if (Server_Cmd->debug)\r
- {\r
- /* Echo our inputs if debugging */\r
- DT_Server_Cmd_Print (Server_Cmd);\r
- }\r
-\r
- /* Allocate memory for Per_Server_Data */\r
- ps_ptr = (Per_Server_Data_t *) DT_Mdep_Malloc (sizeof (Per_Server_Data_t));\r
- if (ps_ptr == 0)\r
- {\r
- DT_Mdep_printf ("no memory for ps_data\n");\r
- goto server_exit;\r
- }\r
- DT_Mdep_LockInit (&ps_ptr->num_clients_lock);\r
- ps_ptr->NextPortNumber = SERVER_PORT_NUMBER + 1;\r
- ps_ptr->num_clients = 0;\r
-\r
- /* Open the IA */\r
-#ifdef DYNAMIC_DAT_LOADING\r
- ret = dat_open (Server_Cmd->dapl_name,\r
- DFLT_QLEN,\r
- &ps_ptr->async_evd_hdl,\r
- &ps_ptr->ia_handle,\r
- DAT_VERSION_MAJOR,\r
- DAT_VERSION_MINOR,\r
- DAT_THREADSAFE);\r
-#else\r
- ret = dat_ia_open (Server_Cmd->dapl_name,\r
- DFLT_QLEN,\r
- &ps_ptr->async_evd_hdl,\r
- &ps_ptr->ia_handle);\r
-#endif //DYNAMIC_DAT_LOADING\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: Could not open %s (%s)\n",\r
- module,\r
- Server_Cmd->dapl_name,\r
- DT_RetToString (ret));\r
- ps_ptr->ia_handle = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: IA %s opened\n", module, Server_Cmd->dapl_name));\r
-\r
- /* Create a PZ */\r
- ret = dat_pz_create (ps_ptr->ia_handle, &ps_ptr->pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_create error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- ps_ptr->pz_handle = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: PZ created\n", module));\r
-\r
- /* Create 4 events - recv, request, connection-request, connect */\r
- ret = dat_evd_create (ps_ptr->ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG,\r
- &ps_ptr->recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (recv) failed %s\n",\r
- module, DT_RetToString (ret));\r
- ps_ptr->recv_evd_hdl = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- ret = dat_evd_create (ps_ptr->ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &ps_ptr->reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (send) failed %s\n",\r
- module, DT_RetToString (ret));\r
- ps_ptr->reqt_evd_hdl = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- ret = dat_evd_create (ps_ptr->ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CR_FLAG,\r
- &ps_ptr->creq_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (cr) failed %s\n",\r
- module, DT_RetToString (ret));\r
- ps_ptr->creq_evd_hdl = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- ret = dat_evd_create (ps_ptr->ia_handle,\r
- DFLT_QLEN,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CONNECTION_FLAG,\r
- &ps_ptr->conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_create (conn) failed %s\n",\r
- module, DT_RetToString (ret));\r
- ps_ptr->conn_evd_hdl = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
-\r
- /* Create the EP */\r
- ret = dat_ep_create (ps_ptr->ia_handle, /* IA */\r
- ps_ptr->pz_handle, /* PZ */\r
- ps_ptr->recv_evd_hdl, /* recv */\r
- ps_ptr->reqt_evd_hdl, /* request */\r
- ps_ptr->conn_evd_hdl, /* connect */\r
- (DAT_EP_ATTR *) NULL,\r
- &ps_ptr->ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_create error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- ps_ptr->ep_handle = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: EP created\n", module));\r
-\r
- /* Create PSP */\r
- ret = dat_psp_create (ps_ptr->ia_handle,\r
- SERVER_PORT_NUMBER,\r
- ps_ptr->creq_evd_hdl,\r
- DAT_PSP_CONSUMER_FLAG,\r
- &ps_ptr->psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_psp_create error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- ps_ptr->psp_handle = DAT_HANDLE_NULL;\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: PSP created\n", module));\r
-\r
- /*\r
- * Create two buffers, large enough to hold ClientInfo and the largest\r
- * command we'll use.\r
- */\r
- ps_ptr->bpool = DT_BpoolAlloc (NULL,\r
- ps_ptr->ia_handle,\r
- ps_ptr->pz_handle,\r
- ps_ptr->ep_handle,\r
- DAT_HANDLE_NULL, /* no RMR */\r
- DT_RoundSize (sizeof (Transaction_Cmd_t), 8192),\r
- 3, /* num_buffers */\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if (ps_ptr->bpool == 0)\r
- {\r
- DT_Mdep_printf ("%s: no memory for command buffer pool.\n", module);\r
- goto server_exit;\r
- }\r
-\r
- DT_Mdep_spew (3, ("Recv 0 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- ps_ptr->bpool, 0)));\r
- DT_Mdep_spew (3, ("Recv 1 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- ps_ptr->bpool, 1)));\r
- DT_Mdep_spew (3, ("SrvInfo 2 %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- ps_ptr->bpool, 2)));\r
-\r
- /* Initialize the performance test lock in case an incoming test\r
- * is a performance test, so we can allow only one at a time.\r
- * Otherwise, multiple performance tests cause a race condition\r
- * between the server creating a new thread trying to allocate a\r
- * PSP with the same ID as another thread that is either running\r
- * a test on that same ID or hasn't yet destroyed it. Only one\r
- * PSP with a particular ID can exist at a time. It's a\r
- * de-facto shared resource that must be protected.\r
- */\r
- /************************************************************************\r
- * Loop accepting connections and acting on them\r
- */\r
- for (;/* EVER */;)\r
- {\r
- DAT_CR_HANDLE cr_handle;\r
- DAT_CR_ARRIVAL_EVENT_DATA cr_stat;\r
- DAT_EVENT_NUMBER event_num;\r
-\r
- /* Set up the Per_Test_Data */\r
- pt_ptr = DT_Alloc_Per_Test_Data ();\r
- if (!pt_ptr)\r
- {\r
- DT_Mdep_printf ("%s: no memory for Per_Test_Data\n", module);\r
- goto server_exit;\r
- }\r
- DT_MemListInit (pt_ptr);\r
- DT_Thread_Init (pt_ptr);\r
- pt_ptr->local_is_server = true;\r
- pt_ptr->ps_ptr = ps_ptr;\r
- /* Server_Info, Client_Info, Params set up below */\r
-\r
- /* Gather whatever info we want about defaults */\r
- if (!DT_query (pt_ptr, ps_ptr->ia_handle, ps_ptr->ep_handle))\r
- {\r
- goto server_exit;\r
- }\r
-\r
- /* Post recv buffers for ClientInfo and Transaction_Cmd_t */\r
- DT_Mdep_debug (("%s: Posting 2 recvs\n", module));\r
- if (!DT_post_recv_buffer (ps_ptr->ep_handle,\r
- ps_ptr->bpool,\r
- 0,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 0)))\r
- {\r
- DT_Mdep_printf ("%s: cannot post ClientInfo recv buffer\n", module);\r
- goto server_exit;\r
- }\r
- if (!DT_post_recv_buffer (ps_ptr->ep_handle,\r
- ps_ptr->bpool,\r
- 1,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 1)))\r
- {\r
- DT_Mdep_printf ("%s: cannot post Transaction_Cmd_t recv buffer\n",\r
- module);\r
- goto server_exit;\r
- }\r
-\r
- /* message to help automated test scripts know when to start the client */\r
- DT_Mdep_printf ("Dapltest: Service Point Ready - %s\n",\r
- Server_Cmd->dapl_name);\r
-\r
- DT_Mdep_flush ();\r
-\r
- DT_Mdep_debug (("%s: Waiting for Connection Request\n", module));\r
- if (!DT_cr_event_wait (ps_ptr->creq_evd_hdl, &cr_stat) ||\r
- !DT_cr_check (&cr_stat,\r
- ps_ptr->psp_handle,\r
- SERVER_PORT_NUMBER,\r
- &cr_handle,\r
- module))\r
- {\r
-\r
- DT_Mdep_printf ("CR Check failed, file %s line %d\n", __FILE__,\r
- __LINE__);\r
- goto server_exit;\r
- }\r
-\r
- DT_Mdep_debug (("%s: Accepting Connection Request\n", module));\r
- ret = dat_cr_accept (cr_handle, ps_ptr->ep_handle, 0, (DAT_PVOID)0);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_cr_accept error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- goto server_exit;\r
- }\r
-\r
- DT_Mdep_debug (("%s: Awaiting connection ...\n", module));\r
- if (!DT_conn_event_wait (ps_ptr->ep_handle, ps_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- DT_Mdep_printf ("%s: error awaiting conn-established event\n",\r
- module);\r
- goto server_exit;\r
- }\r
-\r
- if (DT_dapltest_debug)\r
- {\r
- DT_Mdep_debug (("%s: Connected!\n", module));\r
- get_ep_connection_state (ps_ptr->ep_handle);\r
- }\r
-\r
- /* Wait for Client_Info */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( ps_ptr->bpool, 0);\r
- DT_Mdep_debug (("%s: Waiting for Client_Info\n", module));\r
- if (!DT_dto_event_wait (ps_ptr->recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ps_ptr->ep_handle,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 0),\r
- dto_cookie,\r
- "Client_Info_Recv"))\r
- {\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: Got Client_Info\n", module));\r
-\r
- /* Extract the Client_Info */\r
- Client_Info = (Client_Info_t*) DT_Bpool_GetBuffer (ps_ptr->bpool, 0);\r
- DT_Client_Info_Endian (Client_Info);\r
- memcpy ( (void *) (uintptr_t)&pt_ptr->Client_Info,\r
- (const void *)Client_Info,\r
- sizeof (Client_Info_t));\r
-\r
- /* Wait for client's command info */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( ps_ptr->bpool, 1);\r
- DT_Mdep_debug (("%s: Waiting for Client_Cmd_Info\n", module));\r
- if (!DT_dto_event_wait (ps_ptr->recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ps_ptr->ep_handle,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 1),\r
- dto_cookie,\r
- "Client_Cmd_Recv"))\r
- {\r
- goto server_exit;\r
- }\r
-\r
- /* Extract the client's command info */\r
- switch (Client_Info->test_type)\r
- {\r
- case TRANSACTION_TEST:\r
- {\r
- Transaction_Cmd = (Transaction_Cmd_t *)\r
- DT_Bpool_GetBuffer (ps_ptr->bpool, 1);\r
- DT_Transaction_Cmd_Endian (Transaction_Cmd, false);\r
- memcpy ( (void *) (uintptr_t)&pt_ptr->Params.u.Transaction_Cmd,\r
- (const void *)Transaction_Cmd,\r
- sizeof (Transaction_Cmd_t));\r
- break;\r
- }\r
-\r
- case PERFORMANCE_TEST:\r
- {\r
- Performance_Cmd = (Performance_Cmd_t *) \r
- DT_Bpool_GetBuffer (ps_ptr->bpool, 1);\r
- DT_Performance_Cmd_Endian (Performance_Cmd);\r
- memcpy ( (void *) (uintptr_t)&pt_ptr->Params.u.Performance_Cmd,\r
- (const void *)Performance_Cmd,\r
- sizeof (Performance_Cmd_t));\r
- break;\r
- }\r
-\r
- case QUIT_TEST:\r
- {\r
- Quit_Cmd = (Quit_Cmd_t*)DT_Bpool_GetBuffer (ps_ptr->bpool, 1);\r
- DT_Quit_Cmd_Endian (Quit_Cmd, false);\r
- memcpy ( (void *) (uintptr_t)&pt_ptr->Params.u.Quit_Cmd,\r
- (const void *)Quit_Cmd,\r
- sizeof (Quit_Cmd_t));\r
- break;\r
- }\r
-\r
- default:\r
- {\r
- DT_Mdep_printf ("Unknown TestType received\n");\r
- goto server_exit;\r
- break;\r
- }\r
- }\r
-\r
- /* Setup Server Info */\r
- DT_Mdep_debug (("%s: Send Server_Info\n", module));\r
- pt_ptr->Server_Info.dapltest_version = DAPLTEST_VERSION;\r
- pt_ptr->Server_Info.is_little_endian = DT_local_is_little_endian;\r
- pt_ptr->Server_Info.first_port_number = ps_ptr->NextPortNumber;\r
- ps_ptr->NextPortNumber += pt_ptr->Client_Info.total_threads;\r
-\r
- /* This had to be done here because the pt_ptr is being fed to\r
- * the thread as its context, and if it isn't properly\r
- * initialized before the thread spawns then the thread may\r
- * incorrectly set up its PSP and the server will be listening\r
- * on the WRONG PORT!\r
- */\r
-\r
- switch (Client_Info->test_type)\r
- {\r
- case TRANSACTION_TEST:\r
- {\r
- /* create a thread to handle this pt_ptr; */\r
- DT_Mdep_debug (("%s: Creating Transaction Test Thread\n", module));\r
- pt_ptr->thread = DT_Thread_Create (pt_ptr,\r
- DT_Transaction_Test_Server,\r
- pt_ptr,\r
- DT_MDEP_DEFAULT_STACK_SIZE);\r
- if (pt_ptr->thread == 0)\r
- {\r
- DT_Mdep_printf ("no memory to create thread\n");\r
- goto server_exit;\r
- }\r
- break;\r
- }\r
-\r
- case PERFORMANCE_TEST:\r
- {\r
- /* create a thread to handle this pt_ptr; */\r
- DT_Mdep_debug (("%s: Creating Performance Test Thread\n", module));\r
- pt_ptr->thread = DT_Thread_Create (pt_ptr,\r
- DT_Performance_Test_Server,\r
- pt_ptr,\r
- DT_MDEP_DEFAULT_STACK_SIZE);\r
- if (pt_ptr->thread == 0)\r
- {\r
- DT_Mdep_printf ("no memory to create thread\n");\r
- goto server_exit;\r
- }\r
- /* take the performance test lock to serialize */\r
- DT_Mdep_Lock ( &g_PerfTestLock );\r
-\r
- break;\r
- }\r
-\r
- case QUIT_TEST:\r
- {\r
- DT_Mdep_debug (("Client Requests Server to Quit\n"));\r
- (void) send_control_data(buffp, ps_ptr, pt_ptr);\r
- goto server_exit;\r
- break;\r
- }\r
-\r
- case LIMIT_TEST:\r
- {\r
- DT_Mdep_debug (("Limit Test is Client-side Only!\n"));\r
- (void) send_control_data(buffp, ps_ptr, pt_ptr);\r
- goto server_exit;\r
- break;\r
- }\r
-\r
- default:\r
- {\r
- DT_Mdep_printf ("Unknown TestType received\n");\r
- (void) send_control_data(buffp, ps_ptr, pt_ptr);\r
- goto server_exit;\r
- break;\r
- }\r
- }\r
-\r
- /* Start the new test thread */\r
- DT_Mdep_debug (("%s: Starting Test Thread\n", module));\r
- if (DT_Thread_Start (pt_ptr->thread) == false)\r
- {\r
- DT_Mdep_debug (("failed to start test thread\n"));\r
- goto server_exit;\r
- }\r
-\r
- buffp = DT_Bpool_GetBuffer (ps_ptr->bpool, 2); /* 3rd buffer */\r
- memcpy ( (void *)buffp,\r
- (const void *)&pt_ptr->Server_Info,\r
- sizeof (Server_Info_t));\r
- DT_Server_Info_Endian ((Server_Info_t *) buffp);\r
-\r
- /* Perform obligatory version check */\r
- if (pt_ptr->Client_Info.dapltest_version != DAPLTEST_VERSION)\r
- {\r
- DT_Mdep_printf ("%s: %s: Server %d, Client %d\n",\r
- module,\r
- "DAPLTEST VERSION MISMATCH",\r
- DAPLTEST_VERSION,\r
- pt_ptr->Client_Info.dapltest_version);\r
- goto server_exit;\r
- }\r
- DT_Mdep_debug (("%s: Version OK!\n", module));\r
-\r
- DT_Mdep_wait_object_wait (\r
- &pt_ptr->synch_wait_object, \r
- DAT_TIMEOUT_INFINITE);\r
-\r
- /* Send the Server_Info */\r
- DT_Mdep_debug (("%s: Send Server_Info\n", module));\r
-\r
- if (!DT_post_send_buffer ( ps_ptr->ep_handle,\r
- ps_ptr->bpool,\r
- 2,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 2)))\r
- {\r
- DT_Mdep_printf ("%s: cannot send Server_Info\n", module);\r
- goto server_exit;\r
- }\r
- /* reap the send and verify it */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( ps_ptr->bpool, 2);\r
- if (!DT_dto_event_wait (ps_ptr->reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ps_ptr->ep_handle,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 2),\r
- dto_cookie,\r
- "Server_Info_Send"))\r
- {\r
- goto server_exit;\r
- }\r
-\r
-\r
- /* Count this new client and get ready for the next */\r
- DT_Mdep_Lock (&ps_ptr->num_clients_lock);\r
- ps_ptr->num_clients++;\r
- DT_Mdep_Unlock (&ps_ptr->num_clients_lock);\r
-\r
- /* we passed the pt_ptr to the thread and must now 'forget' it */\r
- pt_ptr = 0;\r
-\r
-#ifdef CM_BUSTED\r
- DT_Mdep_debug (("%s: Server exiting because provider does not support\n"\r
- " multiple connections to the same service point\n", \r
- module));\r
- /* Until connections are healthier we run just one test */\r
- break;\r
-#else\r
- ret = dat_ep_disconnect (ps_ptr->ep_handle, DAT_CLOSE_GRACEFUL_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_disconnect fails: %s\n",\r
- module, DT_RetToString (ret));\r
- goto server_exit;\r
- }\r
- if (!DT_disco_event_wait ( ps_ptr->conn_evd_hdl, NULL))\r
- {\r
- DT_Mdep_printf ("%s: bad disconnect event\n", module);\r
- goto server_exit;\r
- }\r
-\r
- /* reset the EP to get back into the game */\r
- dat_ep_reset (ps_ptr->ep_handle);\r
- DT_Mdep_debug (("%s: Waiting for another client...\n", module));\r
-#endif\r
-\r
-\r
-\r
-\r
- } /* end loop accepting connections */\r
-\r
- /************************************************************************\r
- * Finished (or had an error) so clean up and go home\r
- */\r
-server_exit:\r
-\r
- /* Wait until all of our clients are gone */\r
- DT_Mdep_debug (("%s: Waiting for clients to all go away...\n", module));\r
- while (ps_ptr && ps_ptr->num_clients > 0)\r
- {\r
- DT_Mdep_Sleep (100);\r
- }\r
-\r
- /* Clean up the Per_Test_Data (if any) */\r
- DT_Mdep_debug (("%s: Cleaning up ...\n", module));\r
- if (pt_ptr)\r
- {\r
- DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);\r
- DT_Mdep_LockDestroy (&pt_ptr->MemListLock);\r
- DT_Free_Per_Test_Data (pt_ptr);\r
- }\r
-\r
- /* Clean up the Per_Server_Data */\r
- if (ps_ptr)\r
- {\r
-\r
- /*\r
- * disconnect the most recent EP\r
- *\r
- * we also get here on error, hence abrupt closure to\r
- * flush any lingering buffers posted.\r
- */\r
- if (ps_ptr->ep_handle)\r
- {\r
- ret = dat_ep_disconnect (ps_ptr->ep_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_disconnect fails: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- else if (!DT_disco_event_wait ( ps_ptr->conn_evd_hdl,\r
- NULL))\r
- {\r
- DT_Mdep_printf ("%s: bad disconnect event\n", module);\r
- }\r
- }\r
-\r
- /* Destroy the Bpool */\r
- if (ps_ptr->bpool)\r
- {\r
- if (!DT_Bpool_Destroy (NULL, ps_ptr->bpool))\r
- {\r
- DT_Mdep_printf ("%s: error destroying buffer pool\n", module);\r
- /* keep trying */\r
- }\r
- }\r
-\r
- /* Free the PSP */\r
- if (ps_ptr->psp_handle)\r
- {\r
- ret = dat_psp_free (ps_ptr->psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_psp_free error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
-\r
- /* Free the EP */\r
- if (ps_ptr->ep_handle)\r
- {\r
- ret = dat_ep_free (ps_ptr->ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_free error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
-\r
- /* Free the 4 EVDs */\r
- if (ps_ptr->conn_evd_hdl)\r
- {\r
- ret = dat_evd_free (ps_ptr->conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (conn) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
- if (ps_ptr->creq_evd_hdl)\r
- {\r
- ret = dat_evd_free (ps_ptr->creq_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (creq) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
- if (ps_ptr->reqt_evd_hdl)\r
- {\r
- ret = dat_evd_free (ps_ptr->reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (reqt) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
- if (ps_ptr->recv_evd_hdl)\r
- {\r
- ret = dat_evd_free (ps_ptr->recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_evd_free (recv) error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
-\r
- /* Free the PZ */\r
- if (ps_ptr->pz_handle)\r
- {\r
- ret = dat_pz_free (ps_ptr->pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_pz_free error: %s\n",\r
- module, DT_RetToString (ret));\r
- /* keep trying */\r
- }\r
- }\r
-\r
- /* Close the IA */\r
- if (ps_ptr->ia_handle)\r
- {\r
- /* DT_ia_close cleans up async evd handle, too */\r
- ret = DT_ia_close (ps_ptr->ia_handle, DAT_CLOSE_GRACEFUL_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (graceful) error: %s\n",\r
- module, DT_RetToString (ret));\r
- ret = DT_ia_close (ps_ptr->ia_handle, DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: DT_ia_close (abrupt) error: %s\n",\r
- module, DT_RetToString (ret));\r
- }\r
- /* keep trying */\r
- }\r
- else\r
- {\r
- DT_Mdep_debug (("%s: IA %s closed\n",\r
- module,\r
- Server_Cmd->dapl_name));\r
- }\r
- }\r
-\r
- /* Destroy the ps_ptr */\r
- DT_Mdep_LockDestroy (&ps_ptr->num_clients_lock);\r
- DT_Mdep_Free (ps_ptr);\r
- } /* end if ps_ptr */\r
-\r
- /* Clean up the server list */\r
- pre_list = 0;\r
- temp_list = DT_started_server_list;\r
- while (temp_list)\r
- {\r
- if (strcmp (temp_list->devicename, Server_Cmd->dapl_name) == 0)\r
- {\r
- if (pre_list == 0) /* first one */\r
- {\r
- DT_started_server_list = temp_list->next;\r
- }\r
- else\r
- {\r
- pre_list->next = temp_list->next;\r
- }\r
- DT_Mdep_Free (temp_list);\r
- break;\r
- }\r
- pre_list = temp_list;\r
- temp_list = temp_list->next;\r
- }\r
-\r
- DT_Mdep_printf ("%s (%s): Exiting.\n", module, Server_Cmd->dapl_name);\r
-}\r
-\r
-\r
-int\r
-send_control_data(\r
- unsigned char *buffp,\r
- Per_Server_Data_t *ps_ptr,\r
- Per_Test_Data_t *pt_ptr)\r
-{\r
- unsigned char *module = "send_control_data";\r
- DAT_DTO_COOKIE dto_cookie;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
-\r
- buffp = DT_Bpool_GetBuffer (ps_ptr->bpool, 2); /* 3rd buffer */\r
- memcpy ( (void *)buffp,\r
- (const void *)&pt_ptr->Server_Info,\r
- sizeof (Server_Info_t));\r
- DT_Server_Info_Endian ((Server_Info_t *) buffp);\r
-\r
- if (!DT_post_send_buffer ( ps_ptr->ep_handle,\r
- ps_ptr->bpool,\r
- 2,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 2)))\r
- {\r
- DT_Mdep_printf ("%s: cannot send Server_Info\n", module);\r
- return 1;\r
- }\r
- /* reap the send and verify it */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) (uintptr_t) DT_Bpool_GetBuffer ( ps_ptr->bpool, 2);\r
- if (!DT_dto_event_wait (ps_ptr->reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- ps_ptr->ep_handle,\r
- DT_Bpool_GetBuffSize (ps_ptr->bpool, 2),\r
- dto_cookie,\r
- "Server_Info_Send"))\r
- {\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_getopt.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_server_cmd.h"\r
-\r
-\r
-void\r
-DT_Server_Cmd_Init (Server_Cmd_t * Server_Cmd)\r
-{\r
- DT_dapltest_debug = 0;\r
- Server_Cmd->debug = false;\r
- Server_Cmd->dapl_name[0] = '\0';\r
- Server_Cmd->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
-}\r
-\r
-\r
-bool\r
-DT_Server_Cmd_Parse (Server_Cmd_t * Server_Cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts)\r
-{\r
- char c;\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "dD:R:", opts);\r
- if (c == EOF)\r
- {\r
- break;\r
- }\r
- switch (c)\r
- {\r
- case 'D':\r
- {\r
- strcpy (Server_Cmd->dapl_name, opts->optarg);\r
- break;\r
- }\r
- case 'd':\r
- {\r
- DT_dapltest_debug++;\r
- Server_Cmd->debug = true;\r
- break;\r
- }\r
- case 'R': /* Service Reliability Level */\r
- {\r
- Server_Cmd->ReliabilityLevel = DT_ParseQoS (opts->optarg);\r
- if (0 == Server_Cmd->ReliabilityLevel)\r
- {\r
- return (false);\r
- }\r
- break;\r
- }\r
- case '?':\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Server option: %c\n", opts->optopt);\r
- DT_Server_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
- if (Server_Cmd->dapl_name == '\0')\r
- {\r
- if (!DT_Mdep_GetDefaultDeviceName (Server_Cmd->dapl_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- DT_Server_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- return (true);\r
-}\r
-\r
-\r
-void\r
-DT_Server_Cmd_Print (Server_Cmd_t * Server_Cmd)\r
-{\r
- DT_Mdep_printf ("Server_Cmd.debug: %d\n", Server_Cmd->debug);\r
- DT_Mdep_printf ("Server_Cmd.dapl_name: %s\n", Server_Cmd->dapl_name);\r
-}\r
-\r
-void\r
-DT_Server_Cmd_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE: ---- SERVER MODE ----\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T S\n");\r
- DT_Mdep_printf ("USAGE: [-D <device Name>]\n");\r
- DT_Mdep_printf ("USAGE: [-d] : debug (zero)\n");\r
- DT_Mdep_printf ("USAGE: [-R <service reliability>]\n");\r
- DT_Mdep_printf ("USAGE: (BE == QOS_BEST_EFFORT - Default)\n");\r
- DT_Mdep_printf ("USAGE: (HT == QOS_HIGH_THROUGHPUT)\n");\r
- DT_Mdep_printf ("USAGE: (LL == QOS_LOW_LATENCY)\n");\r
- DT_Mdep_printf ("USAGE: (EC == QOS_ECONOMY)\n");\r
- DT_Mdep_printf ("USAGE: (PM == QOS_PREMIUM)\n");\r
- DT_Mdep_printf ("USAGE: Run as server using default parameters\n");\r
- DT_Mdep_printf ("USAGE: dapltest\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_SERVER_CMD_H__\r
-#define __DAPL_SERVER_CMD_H__\r
-\r
-#include "dapl_mdep.h"\r
-\r
-typedef struct\r
-{\r
- bool debug; /* -d */\r
- char dapl_name[256]; /* -D device name */\r
- DAT_QOS ReliabilityLevel; /* -R */\r
-} Server_Cmd_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_server_info.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-\r
-Started_server_t *DT_started_server_list = 0;\r
-\r
-void\r
-DT_Server_Info_Endian (Server_Info_t * server_info)\r
-{\r
- server_info->dapltest_version = DT_Endian32 (server_info->dapltest_version);\r
- server_info->is_little_endian = DT_Endian32 (server_info->is_little_endian);\r
- server_info->first_port_number= DT_Endian32 (server_info->first_port_number);\r
-}\r
-\r
-void\r
-DT_Server_Info_Print (Server_Info_t * server_info)\r
-{\r
- DT_Mdep_printf ("-------------------------------------\n");\r
- DT_Mdep_printf ("Server_Info.dapltest_version : %d\n",\r
- server_info->dapltest_version);\r
- DT_Mdep_printf ("Server_Info.is_little_endian : %d\n",\r
- server_info->is_little_endian);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_SERVER_INFO_H__\r
-#define __DAPL_SERVER_INFO_H__\r
-\r
-#include "dapl_mdep.h"\r
-#include <dat/udat.h>\r
-\r
-#pragma pack(1)\r
-\r
-struct started_server\r
-{\r
- char devicename[80];\r
- struct started_server *next;\r
-};\r
-\r
-typedef struct started_server Started_server_t;\r
-\r
-extern Started_server_t *DT_started_server_list;\r
-\r
-#define SERVER_PORT_NUMBER (0xBabb1e)\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 dapltest_version;\r
- DAT_UINT32 is_little_endian;\r
- DAT_UINT32 first_port_number;\r
-} Server_Info_t;\r
-#pragma pack()\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_server_info.h"\r
-#include "dapl_client_info.h"\r
-#include "dapl_transaction_test.h"\r
-\r
-DAT_COUNT DT_dapltest_debug = 0;\r
-bool DT_local_is_little_endian;\r
-/*\r
- * check memory leaking int alloc_count; DT_Mdep_LockType\r
- * Alloc_Count_Lock;\r
- */\r
-\r
-Per_Test_Data_t *\r
-DT_Alloc_Per_Test_Data (void)\r
-{\r
- Per_Test_Data_t *pt_ptr;\r
- pt_ptr = 0;\r
-\r
- pt_ptr = DT_Mdep_Malloc (sizeof (Per_Test_Data_t));\r
- if (!pt_ptr)\r
- {\r
- DT_Mdep_printf ("No Memory to create per_test_data!\n");\r
- }\r
-\r
- return (pt_ptr);\r
-}\r
-\r
-void\r
-DT_Free_Per_Test_Data (Per_Test_Data_t * pt_ptr)\r
-{\r
- DT_Mdep_Free (pt_ptr);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_TEST_DATA_H__\r
-#define __DAPL_TEST_DATA_H__\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_client_info.h"\r
-#include "dapl_transaction_stats.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_params.h"\r
-#include "dapl_server_info.h"\r
-#include <dat/udat.h>\r
-\r
-extern DAT_COUNT DT_dapltest_debug;\r
-extern bool DT_local_is_little_endian;\r
-\r
-/* This lock allows the client side to run\r
- * in a shell script loop without breaking\r
- * connections. Remove it and due to timing\r
- * problems on the server side occasionally\r
- * the server will reject connections.\r
- */\r
-extern DT_Mdep_LockType g_PerfTestLock; \r
-\r
-/*\r
- * check memory leaking extern int alloc_count ; extern\r
- * DT_Mdep_LockType Alloc_Count_Lock;\r
- */\r
-\r
-typedef struct\r
-{\r
- int NextPortNumber;\r
- int num_clients;\r
- DT_Mdep_LockType num_clients_lock;\r
- DAT_IA_HANDLE ia_handle;\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_EVD_HANDLE recv_evd_hdl;\r
- DAT_EVD_HANDLE reqt_evd_hdl;\r
- DAT_EVD_HANDLE conn_evd_hdl;\r
- DAT_EVD_HANDLE creq_evd_hdl;\r
- DAT_EVD_HANDLE async_evd_hdl;\r
- DAT_EVD_HANDLE rmr_evd_hdl;\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_PSP_HANDLE psp_handle;\r
- Bpool *bpool;\r
-} Per_Server_Data_t;\r
-\r
-typedef struct\r
-{\r
- DT_Mdep_LockType MemListLock;\r
- MemListEntry_t *MemListHead;\r
-\r
- DT_Mdep_LockType Thread_counter_lock;\r
- int Thread_counter;\r
- Thread *thread;\r
-\r
- bool local_is_server;\r
- Server_Info_t Server_Info;\r
- Client_Info_t Client_Info;\r
- Params_t Params;\r
- DAT_IA_ATTR ia_attr;\r
- DAT_PROVIDER_ATTR provider_attr;\r
- DAT_EP_ATTR ep_attr;\r
- Per_Server_Data_t *ps_ptr;\r
- Transaction_Stats_t Client_Stats;\r
-\r
- /* synchronize the server with the server's spawned test thread.\r
- * That test thread uses a PSP that only one test at a time can\r
- * use. If we don't synchronize access between the teardown and\r
- * creation of that PSP then the client will fail to connect\r
- * randomly, a symptom that the server is not coordinated with\r
- * its test threads. Remove this at your own peril, or if you\r
- * really want your test client to experience rejection on a\r
- * random but regular basis.\r
- */\r
- DT_WAIT_OBJECT synch_wait_object; \r
- int Countdown_Counter;\r
-\r
-} Per_Test_Data_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include <dat/udat.h>\r
-#include "dapl_test_data.h"\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Gather info about default attributes\r
- */\r
-DAT_BOOLEAN\r
-DT_query ( Per_Test_Data_t *pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_EP_HANDLE ep_handle)\r
-{\r
- unsigned char *module = "DT_query";\r
- DAT_EVD_HANDLE async_evd_hdl; /* not used */\r
- DAT_EP_PARAM ep_params;\r
- DAT_RETURN ret;\r
-\r
- /* Query the IA */\r
- ret = dat_ia_query (ia_handle,\r
- &async_evd_hdl,\r
- DAT_IA_ALL,\r
- &pt_ptr->ia_attr,\r
- DAT_PROVIDER_FIELD_ALL,\r
- &pt_ptr->provider_attr);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ia_query error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- return ( false );\r
- }\r
-\r
- /* Query the EP */\r
- ret = dat_ep_query ( ep_handle, \r
- DAT_EP_FIELD_ALL,\r
- &ep_params);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("%s: dat_ep_query error: %s\n",\r
- module,\r
- DT_RetToString (ret));\r
- return ( false );\r
- }\r
- pt_ptr->ep_attr = ep_params.ep_attr;\r
-\r
- /*\r
- * If debugging, print out some interesting attributes\r
- */\r
- if (DT_dapltest_debug)\r
- {\r
- DAT_SOCK_ADDR6 *ip6_addr;\r
- struct sockaddr_in *ip_addr;\r
-\r
- DT_Mdep_printf ("***** DAPL Characteristics *****\n");\r
- DT_Mdep_printf ("Provider: %s Version %d.%d DAPL %d.%d\n",\r
- pt_ptr->provider_attr.provider_name,\r
- pt_ptr->provider_attr.provider_version_major,\r
- pt_ptr->provider_attr.provider_version_minor,\r
- pt_ptr->provider_attr.dapl_version_major,\r
- pt_ptr->provider_attr.dapl_version_minor );\r
- DT_Mdep_printf ("Adapter: %s by %s Version %d.%d\n",\r
- pt_ptr->ia_attr.adapter_name,\r
- pt_ptr->ia_attr.vendor_name,\r
- pt_ptr->ia_attr.hardware_version_major,\r
- pt_ptr->ia_attr.hardware_version_minor );\r
- DT_Mdep_printf ("Supporting:\n");\r
- DT_Mdep_printf ("\t%d EPs with %d DTOs and %d RDMA/RDs each\n",\r
- pt_ptr->ia_attr.max_eps,\r
- pt_ptr->ia_attr.max_dto_per_ep,\r
- pt_ptr->ia_attr.max_rdma_read_per_ep );\r
- DT_Mdep_printf ("\t%d EVDs of up to %d entries "\r
- " (default S/R size is %d/%d)\n",\r
- pt_ptr->ia_attr.max_evds,\r
- pt_ptr->ia_attr.max_evd_qlen,\r
- pt_ptr->ep_attr.max_request_dtos,\r
- pt_ptr->ep_attr.max_recv_dtos );\r
- DT_Mdep_printf ("\tIOVs of up to %d elements\n",\r
- pt_ptr->ia_attr.max_iov_segments_per_dto );\r
- DT_Mdep_printf ("\t%d LMRs (and %d RMRs) of up to 0x" F64x " bytes\n",\r
- pt_ptr->ia_attr.max_lmrs,\r
- pt_ptr->ia_attr.max_rmrs,\r
- (DAT_UVERYLONG)pt_ptr->ia_attr.max_lmr_block_size );\r
- DT_Mdep_printf ("\tMaximum MTU 0x" F64x " bytes, RDMA 0x" F64x " bytes\n",\r
- (DAT_UVERYLONG)pt_ptr->ia_attr.max_mtu_size,\r
- (DAT_UVERYLONG)pt_ptr->ia_attr.max_rdma_size );\r
- DT_Mdep_printf ("\tMaximum Private data size %d bytes\n",\r
- pt_ptr->provider_attr.max_private_data_size );\r
-\r
- ip6_addr = (DAT_SOCK_ADDR6 *)pt_ptr->ia_attr.ia_address_ptr;\r
- if (ip6_addr->sin6_family == AF_INET6 )\r
- {\r
- DT_Mdep_printf ("\tLocal IP address %x:%x:%x:%x:%x:%x:%x:%x:\n",\r
- ip6_addr->sin6_addr.s6_addr[0],\r
- ip6_addr->sin6_addr.s6_addr[1],\r
- ip6_addr->sin6_addr.s6_addr[2],\r
- ip6_addr->sin6_addr.s6_addr[3],\r
- ip6_addr->sin6_addr.s6_addr[4],\r
- ip6_addr->sin6_addr.s6_addr[5],\r
- ip6_addr->sin6_addr.s6_addr[6],\r
- ip6_addr->sin6_addr.s6_addr[7]);\r
- DT_Mdep_printf ("%x:%x:%x:%x:%x:%x:%x:%x\n",\r
- ip6_addr->sin6_addr.s6_addr[8],\r
- ip6_addr->sin6_addr.s6_addr[9],\r
- ip6_addr->sin6_addr.s6_addr[10],\r
- ip6_addr->sin6_addr.s6_addr[11],\r
- ip6_addr->sin6_addr.s6_addr[12],\r
- ip6_addr->sin6_addr.s6_addr[13],\r
- ip6_addr->sin6_addr.s6_addr[14],\r
- ip6_addr->sin6_addr.s6_addr[15]);\r
- }\r
- else if (ip6_addr->sin6_family == AF_INET )\r
-\r
- {\r
- int rval;\r
-\r
- ip_addr = (struct sockaddr_in *)pt_ptr->ia_attr.ia_address_ptr;\r
- rval = (int) ip_addr->sin_addr.s_addr;\r
-\r
- DT_Mdep_printf ("\tLocal IP address %d.%d.%d.%d\n",\r
- (rval >> 0) & 0xff,\r
- (rval >> 8) & 0xff,\r
- (rval >> 16) & 0xff,\r
- (rval >> 24) & 0xff);\r
- }\r
-\r
- DT_Mdep_printf ("***** ***** ***** ***** ***** *****\n");\r
- }\r
-\r
- return ( true );\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Post a recv buffer\r
- */\r
-DAT_BOOLEAN\r
-DT_post_recv_buffer (DAT_EP_HANDLE ep_handle,\r
- Bpool * bp,\r
- int index,\r
- int size)\r
-{\r
- unsigned char *buff = DT_Bpool_GetBuffer (bp, index);\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (bp, index);\r
- DAT_LMR_CONTEXT lmr_c = DT_Bpool_GetLMR (bp, index);\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RETURN ret;\r
-\r
- /*\r
- * Prep the inputs\r
- */\r
- iov->virtual_address = (DAT_VADDR) (uintptr_t) buff;\r
- iov->segment_length = size;\r
- iov->lmr_context = lmr_c;\r
- cookie.as_64 = (DAT_UINT64)0UL;\r
- cookie.as_ptr = (DAT_PVOID) buff;\r
-\r
- DT_Mdep_spew (3, ("Post-Recv #%d [%p, %x]\n", index, buff, size));\r
-\r
- /* Post the recv buffer */\r
- ret = dat_ep_post_recv (ep_handle,\r
- 1,\r
- iov,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dat_ep_post_recv failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- return false;\r
- }\r
- return true;\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Post a send buffer\r
- */\r
-DAT_BOOLEAN\r
-DT_post_send_buffer (DAT_EP_HANDLE ep_handle,\r
- Bpool * bp,\r
- int index,\r
- int size)\r
-{\r
- unsigned char *buff = DT_Bpool_GetBuffer (bp, index);\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (bp, index);\r
- DAT_LMR_CONTEXT lmr_c = DT_Bpool_GetLMR (bp, index);\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RETURN ret;\r
-\r
- /*\r
- * Prep the inputs\r
- */\r
- iov->virtual_address = (DAT_VADDR) (uintptr_t) buff;\r
- iov->segment_length = size;\r
- iov->lmr_context = lmr_c;\r
- cookie.as_64 = (DAT_UINT64)0UL;\r
- cookie.as_ptr = (DAT_PVOID) buff;\r
-\r
- DT_Mdep_spew (3, ("Post-Send #%d [%p, %x]\n", index, buff, size));\r
-\r
- /* Post the recv buffer */\r
- ret = dat_ep_post_send (ep_handle,\r
- 1,\r
- iov,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dat_ep_post_send failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- return false;\r
- }\r
- return true;\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Wait for a CR event, returning false on error.\r
- */\r
-bool\r
-DT_cr_event_wait ( DAT_EVD_HANDLE evd_handle,\r
- DAT_CR_ARRIVAL_EVENT_DATA *cr_stat_p)\r
-{\r
- int err_cnt;\r
-\r
- err_cnt = 0;\r
-\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
-\r
- ret = dat_evd_wait ( evd_handle,\r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &count);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (CR) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- /*\r
- * If we get an error due to the client breaking the \r
- * connection early or some transients, just ignore it\r
- * and keep going. If we get a bunch of errors, bail\r
- * out.\r
- */\r
-/* if ( err_cnt++ < 10 ) */\r
-/* { */\r
-/* continue; */\r
-/* } */\r
-\r
- break;\r
- }\r
-\r
- if (event.event_number == DAT_CONNECTION_REQUEST_EVENT)\r
- {\r
- /*\r
- * Pass back what we know, if requested.\r
- */\r
- if (cr_stat_p)\r
- {\r
- *cr_stat_p = event.event_data.cr_arrival_event_data;\r
- }\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: cr_event_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Wait for a connection event, returning false on error.\r
- */\r
-bool\r
-DT_conn_event_wait (DAT_EP_HANDLE ep_handle,\r
- DAT_EVD_HANDLE evd_handle,\r
- DAT_EVENT_NUMBER *event_number)\r
-\r
-{\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
-\r
- ret = dat_evd_wait (evd_handle,\r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &count);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (CONN) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- break;\r
- }\r
- *event_number = event.event_number;\r
- if (event.event_number == DAT_CONNECTION_EVENT_PEER_REJECTED\r
- || event.event_number == DAT_CONNECTION_EVENT_NON_PEER_REJECTED\r
- || event.event_number == DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR\r
- || event.event_number == DAT_CONNECTION_EVENT_DISCONNECTED\r
- || event.event_number == DAT_CONNECTION_EVENT_BROKEN\r
- || event.event_number == DAT_CONNECTION_EVENT_UNREACHABLE\r
- || event.event_number == DAT_CONNECTION_EVENT_TIMED_OUT)\r
- {\r
- DT_Mdep_printf ("Warning: conn_event_wait %s\n",\r
- DT_EventToSTr (event.event_number));\r
- break;\r
- }\r
- if (event.event_number == DAT_CONNECTION_EVENT_ESTABLISHED)\r
- {\r
- /*\r
- * Could return DAT_CONNECTION_EVENT_DATA and verify:\r
- * event.event_data.connect_event_data.ep_handle\r
- * event.event_data.connect_event_data.private_data_size\r
- * event.event_data.connect_event_data.private_data\r
- */\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: conn_event_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Wait for a disconnection event, returning false on error.\r
- */\r
-bool\r
-DT_disco_event_wait ( DAT_EVD_HANDLE evd_handle,\r
- DAT_EP_HANDLE *ep_handle )\r
-{\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
-\r
- ret = dat_evd_wait (evd_handle,\r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &count);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (DISCONN) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- break;\r
- }\r
- if (event.event_number == DAT_CONNECTION_EVENT_PEER_REJECTED\r
- || event.event_number == DAT_CONNECTION_EVENT_NON_PEER_REJECTED\r
- || event.event_number == DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR\r
- || event.event_number == DAT_CONNECTION_EVENT_BROKEN\r
- || event.event_number == DAT_CONNECTION_EVENT_UNREACHABLE\r
- || event.event_number == DAT_CONNECTION_EVENT_TIMED_OUT)\r
- {\r
- DT_Mdep_printf ("Warning: disconn_event_wait %s\n",\r
- DT_EventToSTr (event.event_number));\r
- break;\r
- }\r
-\r
-\r
- if (event.event_number == DAT_CONNECTION_EVENT_DISCONNECTED)\r
- {\r
- if ( ep_handle != NULL )\r
- {\r
- *ep_handle = event.event_data.connect_event_data.ep_handle;\r
- }\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: conn_event_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Reap a DTO event using a wait or polling, returning false on error.\r
- */\r
-bool\r
-DT_dto_event_reap (DAT_EVD_HANDLE evd_handle,\r
- bool poll,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dto_statusp)\r
-{\r
- if (poll)\r
- {\r
- return DT_dto_event_poll (evd_handle, dto_statusp);\r
- }\r
- else\r
- {\r
- return DT_dto_event_wait (evd_handle, dto_statusp);\r
- }\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Poll for a DTO event, returning false on error.\r
- */\r
-bool\r
-DT_dto_event_poll (DAT_EVD_HANDLE evd_handle,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dto_statusp)\r
-{\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
-\r
- ret = dat_evd_dequeue ( evd_handle,\r
- &event);\r
-\r
- if (DAT_GET_TYPE(ret) == DAT_QUEUE_EMPTY)\r
- {\r
- continue;\r
- }\r
-\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (DTO) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- break;\r
- }\r
-\r
- if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- /*\r
- * Pass back all the useful bits if requested:\r
- * ep_handle, user_cookie.as_ptr\r
- * status, transfered_length\r
- */\r
- if (dto_statusp)\r
- {\r
- *dto_statusp = event.event_data.dto_completion_event_data;\r
- }\r
-\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: dto_event_poll swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Wait for a DTO event, returning false on error.\r
- */\r
-bool\r
-DT_dto_event_wait (DAT_EVD_HANDLE evd_handle,\r
- DAT_DTO_COMPLETION_EVENT_DATA *dto_statusp)\r
-{\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
-\r
- ret = dat_evd_wait ( evd_handle,\r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &count);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (DTO) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- break;\r
- }\r
-\r
- if (event.event_number == DAT_DTO_COMPLETION_EVENT)\r
- {\r
- /*\r
- * Pass back all the useful bits if requested:\r
- * ep_handle, user_cookie.as_ptr\r
- * status, transfered_length\r
- */\r
- if (dto_statusp)\r
- {\r
- *dto_statusp = event.event_data.dto_completion_event_data;\r
- }\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: dto_event_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Wait for a RMR event, returning false on error.\r
- */\r
-bool\r
-DT_rmr_event_wait (DAT_EVD_HANDLE evd_handle,\r
- DAT_RMR_BIND_COMPLETION_EVENT_DATA *rmr_statusp)\r
-{\r
- for (;;)\r
- {\r
- DAT_RETURN ret;\r
- DAT_EVENT event;\r
- DAT_COUNT count;\r
-\r
- ret = dat_evd_wait ( evd_handle,\r
- DAT_TIMEOUT_INFINITE,\r
- 1,\r
- &event,\r
- &count);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dapl_event_wait (RMR) failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- break;\r
- }\r
-\r
- if (event.event_number == DAT_RMR_BIND_COMPLETION_EVENT)\r
- {\r
- /*\r
- * Pass back all the useful bits if requested:\r
- * rmr_handle, user_cookie, status\r
- */\r
- if (rmr_statusp)\r
- {\r
- *rmr_statusp = event.event_data.rmr_completion_event_data;\r
- }\r
- return (true);\r
- }\r
-\r
- DT_Mdep_printf ("Warning: rmr_event_wait swallowing %s event\n",\r
- DT_EventToSTr (event.event_number));\r
- }\r
-\r
- return (false);\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Check a DTO and print some debug info if anything is amiss.\r
- */\r
-bool\r
-DT_dto_check ( DAT_DTO_COMPLETION_EVENT_DATA *dto_p,\r
- DAT_EP_HANDLE ep_expected,\r
- DAT_VLEN len_expected,\r
- DAT_DTO_COOKIE cookie_expected,\r
- char *message )\r
-{\r
- static char *completion_status_msg[]={\r
- "DAT_DTO_SUCCESS",\r
- "DAT_DTO_ERR_FLUSHED", \r
- "DAT_DTO_ERR_LOCAL_LENGTH",\r
- "DAT_DTO_ERR_LOCAL_EP", \r
- "DAT_DTO_ERR_LOCAL_PROTECTION", \r
- "DAT_DTO_ERR_BAD_RESPONSE",\r
- "DAT_DTO_ERR_REMOTE_ACCESS",\r
- "DAT_DTO_ERR_REMOTE_RESPONDER",\r
- "DAT_DTO_ERR_TRANSPORT",\r
- "DAT_DTO_ERR_RECEIVER_NOT_READY",\r
- "DAT_DTO_ERR_PARTIAL_PACKET",\r
- "DAT_RMR_OPERATION_FAILED"\r
- };\r
- if ( ( (ep_expected != NULL) && (dto_p->ep_handle != ep_expected) )\r
- || dto_p->transfered_length != len_expected\r
- || dto_p->user_cookie.as_64 != cookie_expected.as_64\r
- || dto_p->status != DAT_DTO_SUCCESS )\r
- {\r
- DT_Mdep_printf ("Test Error: %s-reaping DTO problem, status = %s\n",\r
- message, (completion_status_msg[dto_p->status]));\r
- DT_Test_Error ();\r
- if ( (ep_expected != NULL) && (dto_p->ep_handle != ep_expected) )\r
- {\r
- DT_Mdep_printf ("\tEndPoint mismatch (got %p wanted %p)\n",\r
- dto_p->ep_handle,\r
- ep_expected);\r
- }\r
- if (dto_p->transfered_length != len_expected)\r
- {\r
- DT_Mdep_printf (\r
- "\tLength mismatch (xfer 0x" F64x " wanted 0x" F64x ")\n",\r
- (DAT_UVERYLONG)dto_p->transfered_length,\r
- (DAT_UVERYLONG)len_expected);\r
- }\r
- if (dto_p->user_cookie.as_64 != cookie_expected.as_64)\r
- {\r
- DT_Mdep_printf ("\tCookie mismatch (got " F64x " wanted " F64x ")\n",\r
- (DAT_UVERYLONG)dto_p->user_cookie.as_64,\r
- (DAT_UVERYLONG)cookie_expected.as_64);\r
- }\r
- return ( false );\r
- }\r
-\r
- return ( true );\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Check an RMR Bind and print some debug info if anything is amiss.\r
- */\r
-bool\r
-DT_rmr_check ( DAT_RMR_BIND_COMPLETION_EVENT_DATA *rmr_p,\r
- DAT_RMR_HANDLE rmr_expected,\r
- DAT_PVOID cookie_expected,\r
- char *message)\r
-{\r
- if ( rmr_p->rmr_handle != rmr_expected\r
- || rmr_p->user_cookie.as_ptr != cookie_expected\r
- || rmr_p->status != DAT_RMR_BIND_SUCCESS )\r
- {\r
-\r
- DT_Mdep_printf ("Test Error: %s RMR bind problem, status = %s\n",\r
- message,\r
- (rmr_p->status == DAT_RMR_BIND_SUCCESS\r
- ? "OK" : "FAILURE"));\r
- DT_Test_Error ();\r
- if (rmr_p->rmr_handle != rmr_expected)\r
- {\r
- DT_Mdep_printf ("\tRMR handle mismatch (got 0x%p wanted 0x%p)\n",\r
- rmr_p->rmr_handle,\r
- rmr_expected);\r
- }\r
- if (rmr_p->user_cookie.as_ptr != cookie_expected)\r
- {\r
- DT_Mdep_printf ("\tCookie mismatch (got %p wanted %p)\n",\r
- rmr_p->user_cookie.as_ptr,\r
- cookie_expected);\r
- }\r
- return ( false );\r
- }\r
-\r
- return ( true );\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Check a CR and print some debug info if anything is amiss.\r
- */\r
-bool\r
-DT_cr_check ( DAT_CR_ARRIVAL_EVENT_DATA *cr_stat_p,\r
- DAT_PSP_HANDLE psp_handle_expected,\r
- DAT_CONN_QUAL port_expected,\r
- DAT_CR_HANDLE *cr_handlep,\r
- char *message)\r
-{\r
- DAT_RETURN ret;\r
-\r
- if (cr_handlep)\r
- {\r
- *cr_handlep = (DAT_CR_HANDLE) 0;\r
- }\r
-\r
- if (cr_stat_p->conn_qual != port_expected ||\r
- (psp_handle_expected &&\r
- cr_stat_p->sp_handle.psp_handle != psp_handle_expected))\r
- {\r
-\r
- DT_Mdep_printf ("Test Error: %s CR data problem\n", message);\r
- DT_Test_Error ();\r
- if (cr_stat_p->conn_qual != port_expected)\r
- {\r
- DT_Mdep_printf ("\tCR conn_qual mismatch "\r
- " (got 0x" F64x " wanted 0x" F64x ")\n",\r
- (DAT_UVERYLONG)cr_stat_p->conn_qual, \r
- (DAT_UVERYLONG)port_expected);\r
- }\r
- if (psp_handle_expected &&\r
- cr_stat_p->sp_handle.psp_handle != psp_handle_expected)\r
- {\r
- DT_Mdep_printf ("\tPSP mismatch (got 0x%p wanted 0x%p)\n",\r
- cr_stat_p->sp_handle.psp_handle,\r
- psp_handle_expected);\r
- }\r
- if (!cr_stat_p->cr_handle)\r
- {\r
- DT_Mdep_printf ("\tGot NULL cr_handle\n");\r
- }\r
- else \r
- {\r
- ret = dat_cr_reject (cr_stat_p->cr_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("\tdat_cr_reject error: %s\n",\r
- DT_RetToString (ret));\r
- }\r
- }\r
- return ( false );\r
- }\r
-\r
- if (cr_handlep)\r
- {\r
- *cr_handlep = cr_stat_p->cr_handle;\r
- }\r
- return ( true );\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-/*\r
- * Class Thread\r
- *\r
- * Threads subsystem initialization\r
- */\r
-void\r
-DT_Thread_Init (Per_Test_Data_t * pt_ptr)\r
-{\r
- DT_Mdep_LockInit (&pt_ptr->Thread_counter_lock);\r
- pt_ptr->Thread_counter = 0;\r
-\r
- /* \r
- * Initialize the synchronization event in the pt_ptr so it's ready\r
- * to be signalled when the time comes. The countdown counter\r
- * lets me coordinate with all the test threads so that the server\r
- * thread doesn't get notified that the test endpoints are ready\r
- * until they actually are. Only transaction tests use this *\r
- * functionality; if the performance test gets changed to use\r
- * multiple threads on the server side then that code semantic\r
- * will need to be added for final test endpoint setup\r
- * notification or there will continue to be a race condition\r
- * between the main server thread and the server test threads.\r
- */ \r
- DT_Mdep_wait_object_init(&pt_ptr->synch_wait_object);\r
- pt_ptr->Countdown_Counter = 0;\r
- \r
-}\r
-\r
-/*\r
- * Threads subsystem destroying\r
- */\r
-void\r
-DT_Thread_End (Per_Test_Data_t * pt_ptr)\r
-{\r
- DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);\r
-\r
- /*\r
- * destroy the wait object created by init.\r
- */\r
- DT_Mdep_wait_object_destroy (\r
- &pt_ptr->synch_wait_object );\r
-\r
-}\r
-\r
-/*\r
- * Thread constructor\r
- *\r
- * NOTE: This routine does NOT create a thread as the name implies. The thread\r
- * is created in DT_Thread_Start (which is counter intuitive)\r
- */\r
-Thread *\r
-DT_Thread_Create (Per_Test_Data_t * pt_ptr,\r
- void (*fn) (void *),\r
- void *param,\r
- unsigned int stacksize)\r
-{\r
- Thread *thread_ptr;\r
- thread_ptr = (Thread *) DT_MemListAlloc (pt_ptr, "thread.c", THREAD, sizeof (Thread));\r
- if (thread_ptr == NULL)\r
- {\r
- return NULL;\r
- }\r
- thread_ptr->param = param;\r
- thread_ptr->function = fn;\r
- thread_ptr->thread_handle = 0;\r
- thread_ptr->stacksize = stacksize;\r
-\r
- DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);\r
- pt_ptr->Thread_counter++;\r
- DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);\r
-\r
- DT_Mdep_Thread_Init_Attributes (thread_ptr);\r
-\r
- return thread_ptr;\r
-}\r
-\r
-/*\r
- * Thread destructor\r
- */\r
-void\r
-DT_Thread_Destroy (Thread * thread_ptr, Per_Test_Data_t * pt_ptr)\r
-{\r
- if (thread_ptr)\r
- {\r
- DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);\r
- pt_ptr->Thread_counter--;\r
- DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);\r
-\r
- DT_Mdep_Thread_Destroy_Attributes (thread_ptr);\r
- DT_MemListFree (pt_ptr, thread_ptr);\r
- }\r
-}\r
-\r
-/*\r
- * Start thread execution NOTE: This routine DOES create a thread in addition\r
- * to starting it whereas DT_Thread_Create just sets up some data structures.\r
- * (this is counter-intuitive)\r
- */\r
-bool\r
-DT_Thread_Start (Thread * thread_ptr)\r
-{\r
- return DT_Mdep_Thread_Start (thread_ptr);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_transaction_test.h"\r
-\r
-\r
-static bool\r
-DT_Transaction_Cmd_Parse_Op (Transaction_Cmd_t * cmd, char *arg)\r
-{\r
- char *c_ptr;\r
- int op;\r
- if (cmd->num_ops >= MAX_OPS)\r
- {\r
- DT_Mdep_printf ("Client: Too Many Ops - Max %d\n", MAX_OPS);\r
- goto error_return;\r
- }\r
- op = cmd->num_ops;\r
- cmd->num_ops++;\r
-\r
- /* set some defaults */\r
- cmd->op[op].seg_size = 4096;\r
- cmd->op[op].num_segs = 1;\r
- cmd->op[op].reap_send_on_recv = false;\r
-\r
- /*\r
- * packet format: <server/client> <RR/RW/SR> [seg_size] [num_segs]\r
- */\r
- c_ptr = strtok (arg, " \t");\r
- if (!c_ptr)\r
- {\r
- DT_Mdep_printf ("OP first arg must <server/client>\n");\r
- goto error_return;\r
- }\r
- /* first token is <who>: */\r
- if (strcmp (c_ptr, "server") == 0)\r
- {\r
- cmd->op[op].server_initiated = true;\r
- }\r
- else\r
- {\r
- if (strcmp (c_ptr, "client") == 0)\r
- {\r
- cmd->op[op].server_initiated = false;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("OP first arg must <server/client>\n");\r
- goto error_return;\r
- }\r
- }\r
-\r
- c_ptr = strtok (0, " \t");\r
- if (!c_ptr)\r
- {\r
- DT_Mdep_printf ("OP Second arg must be <RR/RW/SR>\n");\r
- goto error_return;\r
- }\r
- /* second token is <transfer_type>: */\r
- if (strcmp (c_ptr, "RR") == 0)\r
- {\r
- cmd->op[op].transfer_type = RDMA_READ;\r
- }\r
- else\r
- {\r
- if (strcmp (c_ptr, "RW") == 0)\r
- {\r
- cmd->op[op].transfer_type = RDMA_WRITE;\r
- }\r
- else\r
- {\r
- if (strcmp (c_ptr, "SR") == 0)\r
- {\r
- cmd->op[op].transfer_type = SEND_RECV;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("OP Second arg must be <RR/RW/SR>\n");\r
- goto error_return;\r
- }\r
- }\r
- }\r
- /*\r
- * there may or may not be additional parameters... [seg_size] [num_segs]\r
- * [-f]\r
- */\r
- c_ptr = strtok (0, " \t");\r
- if (c_ptr && strspn (c_ptr, "0123456789") != 0)\r
- {\r
- cmd->op[op].seg_size = atoi (c_ptr);\r
- c_ptr = strtok (0, " \t");\r
- }\r
- if (c_ptr && strspn (c_ptr, "0123456789") != 0)\r
- {\r
- cmd->op[op].num_segs = atoi (c_ptr);\r
- c_ptr = strtok (0, " \t");\r
- }\r
- if (c_ptr && strcmp (c_ptr, "-f") == 0)\r
- {\r
- cmd->op[op].reap_send_on_recv = true;\r
- if (cmd->op[op].transfer_type != SEND_RECV)\r
- {\r
- DT_Mdep_printf ("OP: -f only valid on SEND_RECV\n");\r
- goto error_return;\r
- }\r
- c_ptr = strtok (0, " \t");\r
- }\r
- if (c_ptr)\r
- {\r
- DT_Mdep_printf ("OP too many args \n");\r
- goto error_return;\r
- }\r
- return true;\r
-\r
-error_return:\r
- return false;\r
-}\r
-\r
-\r
-void\r
-DT_Transaction_Cmd_Print (Transaction_Cmd_t * cmd)\r
-{\r
- unsigned int i;\r
- DT_Mdep_printf ("-------------------------------------\n");\r
- DT_Mdep_printf ("TransCmd.server_name : %s\n",\r
- cmd->server_name);\r
- DT_Mdep_printf ("TransCmd.num_iterations : %d\n",\r
- cmd->num_iterations);\r
- DT_Mdep_printf ("TransCmd.num_threads : %d\n",\r
- cmd->num_threads);\r
- DT_Mdep_printf ("TransCmd.eps_per_thread : %d\n",\r
- cmd->eps_per_thread);\r
- DT_Mdep_printf ("TransCmd.validate : %d\n",\r
- cmd->validate);\r
- DT_Mdep_printf ("TransCmd.dapl_name : %s\n",\r
- cmd->dapl_name);\r
- DT_Mdep_printf ("TransCmd.num_ops : %d\n",\r
- cmd->num_ops);\r
-\r
- for (i = 0; i < cmd->num_ops; i++)\r
- {\r
- DT_Mdep_printf ("TransCmd.op[%d].transfer_type : %s %s\n",\r
- i,\r
- cmd->op[i].transfer_type == 0 ? "RDMA_READ" :\r
- cmd->op[i].transfer_type == 1 ? "RDMA_WRITE" :\r
- "SEND_RECV",\r
- cmd->op[i].server_initiated ? " (server)" : " (client)" );\r
- DT_Mdep_printf ("TransCmd.op[%d].seg_size : %d\n",\r
- i,\r
- cmd->op[i].seg_size);\r
- DT_Mdep_printf ("TransCmd.op[%d].num_segs : %d\n",\r
- i,\r
- cmd->op[i].num_segs);\r
- DT_Mdep_printf ("TransCmd.op[%d].reap_send_on_recv : %d\n",\r
- i,\r
- cmd->op[i].reap_send_on_recv);\r
- }\r
-}\r
-\r
-\r
-static bool\r
-DT_Transaction_Cmd_Validate (Transaction_Cmd_t * cmd)\r
-{\r
- unsigned int i;\r
- bool has_server_send;\r
- bool has_client_send;\r
- unsigned int reap_count;\r
- has_server_send = false;\r
- has_client_send = false;\r
- reap_count = 0;\r
-\r
- if (cmd->server_name[0] == '\0')\r
- {\r
- DT_Mdep_printf ("Must specify server_name in command line or scriptfile\n");\r
- return (false);\r
- }\r
- for (i = 0; i < cmd->num_ops; i++)\r
- {\r
- switch (cmd->op[i].transfer_type)\r
- {\r
- case SEND_RECV:\r
- {\r
- if (cmd->op[i].server_initiated)\r
- {\r
- has_server_send = true;\r
- }\r
- else\r
- {\r
- has_client_send = true;\r
- }\r
- if (cmd->op[i].reap_send_on_recv)\r
- {\r
- if (!cmd->op[i].server_initiated)\r
- {\r
- /* client */\r
- reap_count++;\r
- }\r
- else\r
- {\r
- /* server */\r
- if (reap_count > 0)\r
- {\r
- reap_count--;\r
- }\r
- else\r
- {\r
- DT_Mdep_printf ("OP: Unbalanced -f options\n");\r
- return false;\r
- }\r
- }\r
- }\r
- break;\r
- }\r
- case RDMA_READ:\r
- {\r
- break;\r
- }\r
- case RDMA_WRITE:\r
- {\r
- break;\r
- }\r
- }\r
- }\r
-\r
- if (!has_server_send || !has_client_send)\r
- {\r
- DT_Mdep_printf ("Error: Transaction test requires \n");\r
- DT_Mdep_printf ("Error: At least one server SR and one client SR Operation\n");\r
- return false;\r
- }\r
- if (reap_count != 0)\r
- {\r
- DT_Mdep_printf ("OP: Unbalanced -f options\n");\r
- return false;\r
- }\r
- if (cmd->debug)\r
- {\r
- DT_Transaction_Cmd_Print (cmd);\r
- }\r
- return true;\r
-}\r
-\r
-\r
-static void\r
-DT_Transaction_Cmd_Usage (void)\r
-{\r
- DT_Mdep_printf ("USAGE: ---- TRANSACTION TEST ----\n");\r
- DT_Mdep_printf ("USAGE: dapltest -T T\n");\r
- DT_Mdep_printf ("USAGE: -s <server Name>\n");\r
- DT_Mdep_printf ("USAGE: [-D <device Name>]\n");\r
- DT_Mdep_printf ("USAGE: [-d] : debug (zero)\n");\r
- DT_Mdep_printf ("USAGE: [-i <num iterations>] : (1, 000)\n");\r
- DT_Mdep_printf ("USAGE: [-t <num threads>] : (1)\n");\r
- DT_Mdep_printf ("USAGE: [-w <num EPs per thread>] : (1)\n");\r
- DT_Mdep_printf ("USAGE: [-V ] : Validate data: (false)\n");\r
- DT_Mdep_printf ("USAGE: [-P ] : DTO Completion Polling: (false)\n");\r
- DT_Mdep_printf ("USAGE: [-Q ] : Use CNOs: (false)\n");\r
- DT_Mdep_printf ("USAGE: [-r ] : Use RSPs: (false)\n");\r
- DT_Mdep_printf ("USAGE: [-R <service reliability>]\n");\r
- DT_Mdep_printf ("USAGE: (BE == QOS_BEST_EFFORT - Default)\n");\r
- DT_Mdep_printf ("USAGE: (HT == QOS_HIGH_THROUGHPUT)\n");\r
- DT_Mdep_printf ("USAGE: (LL == QOS_LOW_LATENCY)\n");\r
- DT_Mdep_printf ("USAGE: (EC == QOS_ECONOMY)\n");\r
- DT_Mdep_printf ("USAGE: (PM == QOS_PREMIUM)\n");\r
- DT_Mdep_printf ("USAGE: <OP [OP...]\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
- DT_Mdep_printf ("USAGE: Each OP consists of:\n");\r
- DT_Mdep_printf ("USAGE: <who> : \"server\"/\"client\"\n");\r
- DT_Mdep_printf ("USAGE: <transfer_type> : \"SR\" (SEND/RECV)\n");\r
- DT_Mdep_printf ("USAGE: : \"RR\" (RDMA READ)\n");\r
- DT_Mdep_printf ("USAGE: : \"RW\" (RDMA WRITE)\n");\r
- DT_Mdep_printf ("USAGE: [seg_size [num_segs] ] : (4096, 1)\n");\r
- DT_Mdep_printf ("USAGE: [-f] : Reap sends on recv\n");\r
- DT_Mdep_printf ("USAGE:\n");\r
- DT_Mdep_printf ("NOTE: -f is only allowed on \"SR\" OPs\n");\r
- DT_Mdep_printf ("NOTE: -f must appear in pairs (one client, one server)\n");\r
- DT_Mdep_printf (\r
- "NOTE: At least one server SR and one client SR OP are required\n");\r
- DT_Mdep_printf (\r
- "NOTE: and use of -V results in the use of three extra OPs\n");\r
-}\r
-\r
-\r
-void\r
-DT_Transaction_Cmd_Init (Transaction_Cmd_t * cmd)\r
-{\r
- memset ((void *)cmd, 0, sizeof (Transaction_Cmd_t));\r
- cmd->dapltest_version = DAPLTEST_VERSION;\r
- cmd->client_is_little_endian = DT_local_is_little_endian;\r
- cmd->num_iterations = 1000;\r
- cmd->num_threads = 1;\r
- cmd->eps_per_thread = 1;\r
- cmd->debug = false;\r
- cmd->validate = false;\r
- cmd->ReliabilityLevel = DAT_QOS_BEST_EFFORT;\r
-}\r
-\r
-\r
-bool\r
-DT_Transaction_Cmd_Parse (Transaction_Cmd_t * cmd,\r
- int my_argc,\r
- char **my_argv,\r
- mygetopt_t * opts)\r
-{\r
- char c;\r
- unsigned int len;\r
- int i;\r
- char op[100];\r
- for (;;)\r
- {\r
- c = DT_mygetopt_r (my_argc, my_argv, "rQVPdw:s:D:i:t:v:R:", opts);\r
- if (c == EOF)\r
- {\r
- break;\r
- }\r
- switch (c)\r
- {\r
- case 's': /* server name */\r
- {\r
- if ((opts->optarg == 0) || strlen (opts->optarg) == 0\r
- || *opts->optarg == '-')\r
- {\r
- DT_Mdep_printf ("must specify server name\n");\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- strcpy (cmd->server_name, opts->optarg);\r
- break;\r
- }\r
- case 'D': /* device name */\r
- {\r
- strcpy (cmd->dapl_name, opts->optarg);\r
- break;\r
- }\r
-\r
- case 'i': /* num iterations */\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -i<iterations> option\n");\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_iterations = atol (opts->optarg);\r
-\r
- break;\r
- }\r
- case 't': /* num threads */\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -t<num threads> option\n");\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->num_threads = atol (opts->optarg);\r
- break;\r
- }\r
- case 'w': /* num EPs per thread */\r
- {\r
- len = (unsigned int)strspn (opts->optarg, "0123456789");\r
- if (len == 0 || len != strlen (opts->optarg))\r
- {\r
- DT_Mdep_printf ("Syntax Error -w<EPs/thread> option\n");\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- cmd->eps_per_thread = atol (opts->optarg);\r
- break;\r
- }\r
- case 'd': /* print debug messages */\r
- {\r
- DT_dapltest_debug++;\r
- cmd->debug = true;\r
- break;\r
- }\r
- case 'Q': /* funnel EVDs => CNO */\r
- {\r
- cmd->use_cno = true;\r
- break;\r
- }\r
- case 'r': /* use RSP instead of PSP */\r
- {\r
- cmd->use_rsp = true;\r
- break;\r
- }\r
- case 'V': /* validate data being sent/received */\r
- {\r
- cmd->validate = true;\r
- break;\r
- }\r
- case 'P': /* use completion polling */\r
- {\r
- cmd->poll = true;\r
- break;\r
- }\r
- case 'R': /* Service Reliability Level */\r
- {\r
- cmd->ReliabilityLevel = DT_ParseQoS (opts->optarg);\r
- break;\r
- }\r
- case '?':\r
- default:\r
- {\r
- DT_Mdep_printf ("Invalid Transaction Test Parameter: %c\n", c);\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- }\r
- if (cmd->dapl_name[0] == '\0')\r
- {\r
- if (!DT_Mdep_GetDefaultDeviceName (cmd->dapl_name))\r
- {\r
- DT_Mdep_printf ("can't get default device name\n");\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
- /*\r
- * now parse the transaction ops this is ugly, but it's easier to gather\r
- * each transaction into a single string\r
- */\r
- for (i = opts->optind; i < my_argc; i++)\r
- {\r
- strcpy (&op[0], my_argv[i]);\r
- while (i < my_argc - 1)\r
- {\r
- i++;\r
- if ((strncmp (my_argv[i], "client", 6) == 0) ||\r
- strncmp (my_argv[i], "server", 6) == 0)\r
- {\r
- i--;\r
- break;\r
- }\r
- strcat (op, " ");\r
- strcat (op, my_argv[i]);\r
- }\r
- if (!DT_Transaction_Cmd_Parse_Op (cmd, op))\r
- {\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- }\r
-\r
- /*\r
- * If we're going to validate the data, we append 3 OPs that\r
- * serve as barriers so that both the client and server can\r
- * validate their entire set of recv transactions without\r
- * interference.\r
- *\r
- * The first op appended serves to notify the client that the\r
- * server is at the rendezvous and will transfer nothing else,\r
- * so the client can validate all recv buffers. The second op\r
- * notifies the server that the client is quiescent, so the\r
- * server can safely validate its recv buffers. The final op\r
- * tells the client that the server is done, and both can\r
- * proceed with the next iteration.\r
- */\r
- if (cmd->validate)\r
- {\r
- DT_Mdep_printf ("NOTE: Adding OP \"server SR\" - for validation\n");\r
- memcpy (op, "server SR", strlen ("server SR") + 1);\r
- DT_Transaction_Cmd_Parse_Op (cmd, op);\r
-\r
- DT_Mdep_printf ("NOTE: Adding OP \"client SR\" - for validation\n");\r
- memcpy (op, "client SR", strlen ("client SR") + 1);\r
- DT_Transaction_Cmd_Parse_Op (cmd, op);\r
-\r
- DT_Mdep_printf ("NOTE: Adding OP \"server SR\" - for validation\n");\r
- memcpy (op, "server SR", strlen ("server SR") + 1);\r
- DT_Transaction_Cmd_Parse_Op (cmd, op);\r
- }\r
- if (!DT_Transaction_Cmd_Validate (cmd))\r
- {\r
- DT_Transaction_Cmd_Usage ();\r
- return (false);\r
- }\r
- return (true);\r
-}\r
-\r
-\r
-void\r
-DT_Transaction_Cmd_Endian (Transaction_Cmd_t * cmd, bool to_wire)\r
-{\r
- unsigned int i;\r
-\r
- cmd->dapltest_version = DT_Endian32 (cmd->dapltest_version);\r
- cmd->num_iterations = DT_Endian32 (cmd->num_iterations);\r
- cmd->num_threads = DT_Endian32 (cmd->num_threads);\r
- cmd->eps_per_thread = DT_Endian32 (cmd->eps_per_thread);\r
- cmd->use_cno = DT_Endian32 (cmd->use_cno);\r
- cmd->use_rsp = DT_Endian32 (cmd->use_rsp);\r
- cmd->debug = DT_Endian32 (cmd->debug);\r
- cmd->validate = DT_Endian32 (cmd->validate);\r
- cmd->ReliabilityLevel = DT_Endian32 (cmd->ReliabilityLevel);\r
-\r
- if (!to_wire)\r
- {\r
- cmd->num_ops = DT_Endian32 (cmd->num_ops);\r
- }\r
- for (i = 0; i < cmd->num_ops; i++)\r
- {\r
- cmd->op[i].server_initiated = DT_Endian32 (cmd->op[i].server_initiated);\r
- cmd->op[i].transfer_type = DT_Endian32 (cmd->op[i].transfer_type);\r
- cmd->op[i].num_segs = DT_Endian32 (cmd->op[i].num_segs);\r
- cmd->op[i].seg_size = DT_Endian32 (cmd->op[i].seg_size);\r
- cmd->op[i].reap_send_on_recv =\r
- DT_Endian32 (cmd->op[i].reap_send_on_recv);\r
- }\r
- if (to_wire)\r
- {\r
- cmd->num_ops = DT_Endian32 (cmd->num_ops);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_TRANSACTION_CMD_H__\r
-#define __DAPL_TRANSACTION_CMD_H__\r
-\r
-#include "dapl_mdep.h"\r
-#include <dat/udat.h>\r
-\r
-#define MAX_OPS 100\r
-#define NAME_SZ 256\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 server_initiated;\r
- DAT_UINT32 transfer_type;\r
- DAT_UINT32 num_segs;\r
- DAT_UINT32 seg_size;\r
- DAT_UINT32 reap_send_on_recv;\r
-}Transaction_Cmd_Op_t;\r
-\r
-typedef struct\r
-{\r
- DAT_UINT32 dapltest_version;\r
- DAT_UINT32 client_is_little_endian;\r
- char server_name[NAME_SZ]; /* -s */\r
- DAT_UINT32 num_iterations; /* -i */\r
- DAT_UINT32 num_threads; /* -t */\r
- DAT_UINT32 eps_per_thread; /* -w */\r
- DAT_UINT32 use_cno; /* -Q */\r
- DAT_UINT32 use_rsp; /* -r */\r
- DAT_UINT32 debug; /* -d */\r
- DAT_UINT32 validate; /* -V */\r
- DAT_UINT32 poll; /* -P */\r
- char dapl_name[NAME_SZ]; /* -D */\r
- DAT_QOS ReliabilityLevel;\r
- DAT_UINT32 num_ops;\r
- Transaction_Cmd_Op_t op[MAX_OPS];\r
-} Transaction_Cmd_t;\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_transaction_stats.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_test_data.h"\r
-\r
-void\r
-DT_init_transaction_stats (Transaction_Stats_t * transaction_stats, unsigned int num)\r
-{\r
- DT_Mdep_LockInit (&transaction_stats->lock);\r
-\r
- transaction_stats->wait_count = num;\r
- transaction_stats->num_ops = 0;\r
- transaction_stats->time_ms = 0;\r
- transaction_stats->bytes_send = 0;\r
- transaction_stats->bytes_recv = 0;\r
- transaction_stats->bytes_rdma_read = 0;\r
- transaction_stats->bytes_rdma_write = 0;\r
-}\r
-\r
-void\r
-DT_transaction_stats_set_ready (Transaction_Stats_t * transaction_stats)\r
-{\r
- DT_Mdep_Lock (&transaction_stats->lock);\r
- transaction_stats->wait_count--;\r
-\r
- DT_Mdep_debug (("Received Sync Message from server (%d left)\n",\r
- transaction_stats->wait_count));\r
- DT_Mdep_Unlock (&transaction_stats->lock);\r
-}\r
-\r
-bool\r
-DT_transaction_stats_wait_for_all (Transaction_Stats_t * transaction_stats)\r
-{\r
- unsigned int loop_count;\r
- loop_count = 100 * 10; /* 100 * 10ms * 10 = 10 seconds */\r
- while (transaction_stats->wait_count != 0 && loop_count != 0)\r
- {\r
- DT_Mdep_Sleep (10);\r
- loop_count--;\r
- }\r
- if (loop_count == 0)\r
- {\r
- DT_Mdep_printf ("FAIL: %d Server test connections did not report ready.\n",\r
- transaction_stats->wait_count);\r
- return false;\r
- }\r
- return true;\r
-}\r
-\r
-\r
-/*\r
- *\r
- */\r
-void\r
-DT_update_transaction_stats (Transaction_Stats_t * transaction_stats,\r
- unsigned int num_ops,\r
- unsigned int time_ms,\r
- unsigned int bytes_send,\r
- unsigned int bytes_recv,\r
- unsigned int bytes_rdma_read,\r
- unsigned int bytes_rdma_write)\r
-{\r
- DT_Mdep_Lock (&transaction_stats->lock);\r
-\r
- /* look for the longest time... */\r
- if (time_ms > transaction_stats->time_ms)\r
- {\r
- transaction_stats->time_ms = time_ms;\r
- }\r
-\r
- transaction_stats->num_ops += num_ops;\r
- transaction_stats->bytes_send += bytes_send;\r
- transaction_stats->bytes_recv += bytes_recv;\r
- transaction_stats->bytes_rdma_read += bytes_rdma_read;\r
- transaction_stats->bytes_rdma_write += bytes_rdma_write;\r
- DT_Mdep_Unlock (&transaction_stats->lock);\r
-}\r
-\r
-/*\r
- *\r
- */\r
-void\r
-DT_print_transaction_stats (Transaction_Stats_t * transaction_stats,\r
- unsigned int num_threads,\r
- unsigned int num_EPs)\r
-{\r
- double time_s;\r
- double mbytes_send;\r
- double mbytes_recv;\r
- double mbytes_rdma_read;\r
- double mbytes_rdma_write;\r
- int total_ops;\r
- DT_Mdep_Lock (&transaction_stats->lock);\r
- time_s = (double) (transaction_stats->time_ms) / 1000;\r
- if (time_s == 0.0)\r
- {\r
- DT_Mdep_printf ("----- Test completed successfully, but cannot calculate stats as not\n"\r
- "----- enough time has lapsed.\n"\r
- "----- Try running the test with more iterations.\n");\r
- goto unlock_and_return;\r
- }\r
- mbytes_send = (double) transaction_stats->bytes_send / 1000 / 1000;\r
- mbytes_recv = (double) transaction_stats->bytes_recv / 1000 / 1000;\r
- mbytes_rdma_read = (double) transaction_stats->bytes_rdma_read / 1000 / 1000;\r
- mbytes_rdma_write = (double) transaction_stats->bytes_rdma_write / 1000 / 1000;\r
- total_ops = transaction_stats->num_ops;\r
-\r
- if ( 0 == total_ops )\r
- {\r
- DT_Mdep_printf ("----- Test completed successfully, but no operations!\n");\r
- goto unlock_and_return;\r
- }\r
-\r
- DT_Mdep_printf ("----- Stats ---- : %u threads, %u EPs\n",\r
- num_threads, num_EPs);\r
- DT_Mdep_printf ("Total IBWQE : %7d.%02d WQE/Sec\n",\r
- whole (total_ops / time_s),\r
- hundredths (total_ops / time_s));\r
- DT_Mdep_printf ("Total Time : %7d.%02d sec\n",\r
- whole (time_s),\r
- hundredths (time_s));\r
- DT_Mdep_printf ("Total Send : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_send),\r
- hundredths (mbytes_send),\r
- whole (mbytes_send / time_s),\r
- hundredths (mbytes_send / time_s));\r
- DT_Mdep_printf ("Total Recv : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_recv),\r
- hundredths (mbytes_recv),\r
- whole (mbytes_recv / time_s),\r
- hundredths (mbytes_recv / time_s));\r
- DT_Mdep_printf ("Total RDMA Read : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_rdma_read),\r
- hundredths (mbytes_rdma_read),\r
- whole (mbytes_rdma_read / time_s),\r
- hundredths (mbytes_rdma_read / time_s));\r
- DT_Mdep_printf ("Total RDMA Write : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_rdma_write),\r
- hundredths (mbytes_rdma_write),\r
- whole (mbytes_rdma_write / time_s),\r
- hundredths (mbytes_rdma_write / time_s));\r
-\r
-unlock_and_return:\r
- DT_Mdep_Unlock (&transaction_stats->lock);\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_TRANSACTION_STATS_H__\r
-#define __DAPL_TRANSACTION_STATS_H__\r
-\r
-#include "dapl_mdep.h"\r
-\r
-#define whole(num) ((unsigned int)(num))\r
-#define hundredths(num) ((unsigned int)(((num) - (unsigned int)(num)) * 100))\r
-#pragma pack(1)\r
-typedef struct\r
-{\r
- DT_Mdep_LockType lock;\r
- unsigned int wait_count;\r
- unsigned int num_ops;\r
- unsigned int time_ms;\r
- unsigned int bytes_send;\r
- unsigned int bytes_recv;\r
- unsigned int bytes_rdma_read;\r
- unsigned int bytes_rdma_write;\r
-} Transaction_Stats_t;\r
-#pragma pack()\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_transaction_stats.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_memlist.h"\r
-#include "dapl_proto.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_transaction_test.h"\r
-#include <dat/udat.h>\r
-\r
-#define RMI_SEND_BUFFER_ID 0\r
-#define RMI_RECV_BUFFER_ID 1\r
-#define SYNC_SEND_BUFFER_ID 2\r
-#define SYNC_RECV_BUFFER_ID 3\r
-\r
-/*\r
- * The sync buffers are sent to say "Go!" to the other side.\r
- * This is a handy place to test whether a zero-sized send into\r
- * a zero-sized buffer actually works. If the client side hangs\r
- * in 'Wait for Sync Message' when this is zero, it's a DAPL bug.\r
- */\r
-#define SYNC_BUFF_SIZE 64\r
-\r
-#define DFLT_QLEN 8 /* default event queue length */\r
-#define DFLT_TMO 10 /* default timeout (seconds) */\r
-#define MAX_CONN_RETRY 8\r
-\r
-/****************************************************************************/\r
-void\r
-DT_Transaction_Test_Client (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE ia_handle,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr)\r
-{\r
- Transaction_Cmd_t *cmd = &pt_ptr->Params.u.Transaction_Cmd;\r
- unsigned int i;\r
-\r
- DT_init_transaction_stats (&pt_ptr->Client_Stats,\r
- cmd->num_threads * cmd->eps_per_thread);\r
-\r
- /* Now go set up the client test threads */\r
- for (i = 0; i < cmd->num_threads; i++)\r
- {\r
- unsigned int port_num = pt_ptr->Server_Info.first_port_number\r
- + i * cmd->eps_per_thread;\r
-\r
- DT_Mdep_debug (("Client: Starting Client side of test\n"));\r
- if (!DT_Transaction_Create_Test (pt_ptr,\r
- ia_handle,\r
- false,\r
- port_num,\r
- pt_ptr->Server_Info.is_little_endian,\r
- remote_ia_addr))\r
- {\r
- DT_Mdep_printf ("Client: Cannot Create Test!\n");\r
- break;\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- }\r
-\r
- /* Wait until end of all threads */\r
- while (pt_ptr->Thread_counter > 0)\r
- {\r
- DT_Mdep_Sleep (100);\r
- }\r
-\r
- DT_print_transaction_stats (&pt_ptr->Client_Stats,\r
- cmd->num_threads, \r
- cmd->eps_per_thread);\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-void\r
-DT_Transaction_Test_Server (void *params)\r
-{\r
- Per_Test_Data_t *pt_ptr = (Per_Test_Data_t *) params;\r
- Transaction_Cmd_t *cmd = &pt_ptr->Params.u.Transaction_Cmd;\r
- unsigned int i;\r
-\r
- pt_ptr->Countdown_Counter = cmd->num_threads; \r
-\r
- for (i = 0; i < cmd->num_threads; i++)\r
- {\r
- unsigned int port_num = pt_ptr->Server_Info.first_port_number\r
- + i * cmd->eps_per_thread;\r
-\r
- if (!DT_Transaction_Create_Test (pt_ptr,\r
- pt_ptr->ps_ptr->ia_handle,\r
- true,\r
- port_num,\r
- pt_ptr->Client_Info.is_little_endian,\r
- (DAT_IA_ADDRESS_PTR) 0))\r
- {\r
- DT_Mdep_printf ("Server: Cannot Create Test!\n");\r
- break;\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- }\r
-\r
- /* Wait until end of all sub-threads */\r
- while (pt_ptr->Thread_counter > 1)\r
- {\r
- DT_Mdep_Sleep (100);\r
- }\r
- DT_Thread_Destroy (pt_ptr->thread, pt_ptr); /* destroy Master thread */\r
-\r
- DT_Mdep_Lock (&pt_ptr->ps_ptr->num_clients_lock);\r
- pt_ptr->ps_ptr->num_clients--;\r
- DT_Mdep_Unlock (&pt_ptr->ps_ptr->num_clients_lock);\r
-\r
- /* NB: Server has no pt_ptr->remote_netaddr */\r
- DT_PrintMemList (pt_ptr); /* check if we return all space allocated */\r
- DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);\r
- DT_Mdep_LockDestroy (&pt_ptr->MemListLock);\r
- DT_Free_Per_Test_Data (pt_ptr);\r
- DT_Mdep_printf ("Server: Transaction Test Finished for this client\n");\r
- /*\r
- * check memory leaking DT_Mdep_printf("Server: App allocated Memory Left:\r
- * %d\n", alloc_count);\r
- */\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-/*\r
- * DT_Transaction_Create_Test()\r
- *\r
- * Initialize what we can in the test structure. Then fork a thread to do the\r
- * work.\r
- */\r
-\r
-bool\r
-DT_Transaction_Create_Test (Per_Test_Data_t * pt_ptr,\r
- DAT_IA_HANDLE *ia_handle,\r
- DAT_BOOLEAN is_server,\r
- unsigned int port_num,\r
- DAT_BOOLEAN remote_is_little_endian,\r
- DAT_IA_ADDRESS_PTR remote_ia_addr)\r
-{\r
- Transaction_Test_t *test_ptr;\r
-\r
- test_ptr = (Transaction_Test_t *) DT_MemListAlloc (pt_ptr,\r
- "transaction_test_t",\r
- TRANSACTIONTEST,\r
- sizeof (Transaction_Test_t));\r
- if (!test_ptr)\r
- {\r
- DT_Mdep_printf ("No Memory to create transaction test structure!\n");\r
- return false;\r
- }\r
-\r
- /* Unused fields zeroed by allocator */\r
- test_ptr->remote_is_little_endian = remote_is_little_endian;\r
- test_ptr->is_server = is_server;\r
- test_ptr->pt_ptr = pt_ptr;\r
- test_ptr->ia_handle = ia_handle;\r
- test_ptr->base_port = (DAT_CONN_QUAL) port_num;\r
- test_ptr->cmd = &pt_ptr->Params.u.Transaction_Cmd;\r
- test_ptr->time_out = DFLT_TMO * 1000; /* DFLT_TMO seconds */\r
-\r
- /* FIXME more analysis needs to go into determining the minimum */\r
- /* possible value for DFLT_QLEN. This evd_length value will be */\r
- /* used for all EVDs. There are a number of dependencies imposed */\r
- /* by this design (ex. min(cr_evd_len) != min(recv_evd_len) ). */\r
- /* In the future it may be best to use individual values. */\r
- test_ptr->evd_length = DT_max (\r
- DFLT_QLEN,\r
- test_ptr->cmd->eps_per_thread * test_ptr->cmd->num_ops);\r
-\r
- test_ptr->remote_ia_addr = remote_ia_addr;\r
-\r
- test_ptr->thread = DT_Thread_Create (pt_ptr,\r
- DT_Transaction_Main,\r
- test_ptr,\r
- DT_MDEP_DEFAULT_STACK_SIZE);\r
- if (test_ptr->thread == 0)\r
- {\r
- DT_Mdep_printf ("No memory!\n");\r
- DT_MemListFree (test_ptr->pt_ptr, test_ptr);\r
- return false;\r
- }\r
- DT_Thread_Start (test_ptr->thread);\r
-\r
- return true;\r
-}\r
-\r
-\r
-/****************************************************************************/\r
-/*\r
- * Main Transaction Test Execution Routine\r
- *\r
- * Both client and server threads start here, with IA already open.\r
- * Each test thread establishes a connection with its counterpart.\r
- * They swap remote memory information (if necessary), then set up\r
- * buffers and local data structures. When ready, the two sides\r
- * synchronize, then testing begins.\r
- */\r
-void\r
-DT_Transaction_Main (void *param)\r
-{\r
- Transaction_Test_t *test_ptr = (Transaction_Test_t *) param;\r
- DAT_RETURN ret;\r
- DAT_UINT32 i, j;\r
- bool success = false;\r
- Per_Test_Data_t *pt_ptr;\r
- Thread *thread;\r
- DAT_DTO_COOKIE dto_cookie;\r
- char *private_data_str = "DAPL and RDMA rule! Test 4321.";\r
- DAT_EVENT_NUMBER event_num;\r
-\r
- pt_ptr = test_ptr->pt_ptr;\r
- thread = test_ptr->thread;\r
-\r
- /* create a protection zone */\r
- ret = dat_pz_create (test_ptr->ia_handle, &test_ptr->pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_pz_create error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->pz_handle = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
-\r
- /* Create a CNO if necessary */\r
- if (test_ptr->cmd->use_cno)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: CNO use not yet supported (%s)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, "ignored");\r
- /* ignored - just fall through */\r
- }\r
-\r
- /* create 4 EVDs - recv, request+RMR, conn-request, connect */\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->evd_length,\r
- test_ptr->cno_handle,\r
- DAT_EVD_DTO_FLAG,\r
- &test_ptr->recv_evd_hdl); /* recv */\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (recv) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->recv_evd_hdl = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
-\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->evd_length,\r
- test_ptr->cno_handle,\r
- DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG,\r
- &test_ptr->reqt_evd_hdl); /* request + rmr bind */\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (request) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->reqt_evd_hdl = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
-\r
- if (pt_ptr->local_is_server)\r
- {\r
- /* Client-side doesn't need CR events */\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->evd_length,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CR_FLAG,\r
- &test_ptr->creq_evd_hdl); /* cr */\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (cr) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->creq_evd_hdl = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
- }\r
-\r
- ret = dat_evd_create (test_ptr->ia_handle,\r
- test_ptr->evd_length,\r
- DAT_HANDLE_NULL,\r
- DAT_EVD_CONNECTION_FLAG,\r
- &test_ptr->conn_evd_hdl); /* conn */\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_create (conn) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- test_ptr->conn_evd_hdl = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
-\r
- /* Allocate per-EP data */\r
- test_ptr->ep_context = (Ep_Context_t *)\r
- DT_MemListAlloc (pt_ptr,\r
- "transaction_test",\r
- EPCONTEXT,\r
- test_ptr->cmd->eps_per_thread\r
- * sizeof (Ep_Context_t));\r
- if (!test_ptr->ep_context)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for EP context\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- goto test_failure;\r
- }\r
-\r
- /*\r
- * Set up the per-EP contexts:\r
- * create the EP\r
- * allocate buffers for remote memory info exchange\r
- * post the receive buffers\r
- * connect\r
- * set up buffers and remote memory info\r
- * send across our info\r
- * recv the other side's info and extract what we need\r
- */\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_EP_ATTR ep_attr;\r
- DAT_UINT32 buff_size = MAX_OPS * sizeof (RemoteMemoryInfo);\r
-\r
- /*\r
- * Adjust default EP attributes to fit the requested test.\r
- * This is simplistic; in that we don't count ops of each\r
- * type and direction, checking EP limits. We just try to\r
- * be sure the EP's WQs are large enough. The "+2" is for\r
- * the RemoteMemInfo and Sync receive buffers.\r
- */\r
- ep_attr = pt_ptr->ep_attr;\r
- if (ep_attr.max_recv_dtos < (DAT_COUNT)test_ptr->cmd->num_ops + 2)\r
- {\r
- ep_attr.max_recv_dtos = (DAT_COUNT)test_ptr->cmd->num_ops + 2;\r
- }\r
- if (ep_attr.max_request_dtos < (DAT_COUNT)test_ptr->cmd->num_ops + 2)\r
- {\r
- ep_attr.max_request_dtos = test_ptr->cmd->num_ops + 2;\r
- }\r
-\r
- /* Create EP */\r
- ret = dat_ep_create (test_ptr->ia_handle, /* IA */\r
- test_ptr->pz_handle, /* PZ */\r
- test_ptr->recv_evd_hdl, /* recv */\r
- test_ptr->reqt_evd_hdl, /* request */\r
- test_ptr->conn_evd_hdl, /* connect */\r
- &ep_attr, /* EP attrs */\r
- &test_ptr->ep_context[i].ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_create #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- test_ptr->ep_context[i].ep_handle = DAT_HANDLE_NULL;\r
- goto test_failure;\r
- }\r
-\r
- /*\r
- * Allocate a buffer pool so we can exchange the\r
- * remote memory info and initialize.\r
- */\r
- test_ptr->ep_context[i].bp = DT_BpoolAlloc (pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context[i].ep_handle,\r
- DAT_HANDLE_NULL, /* rmr */\r
- buff_size,\r
- 4,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if (!test_ptr->ep_context[i].bp)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for remote memory buffers\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- goto test_failure;\r
- }\r
-\r
- DT_Mdep_spew (3, ("0: RMI_SEND %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp, 0)));\r
- DT_Mdep_spew (3, ("1: RMI_RECV %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp, 1)));\r
- DT_Mdep_spew (3, ("2: SYNC_SEND %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp, 2)));\r
- DT_Mdep_spew (3, ("3: SYNC_RECV %p\n", (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp, 3)));\r
-\r
- /*\r
- * Post recv and sync buffers\r
- */\r
- if (!DT_post_recv_buffer ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- RMI_RECV_BUFFER_ID,\r
- buff_size))\r
- {\r
- /* error message printed by DT_post_recv_buffer */\r
- goto test_failure;\r
- }\r
- if (!DT_post_recv_buffer ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- SYNC_RECV_BUFFER_ID,\r
- SYNC_BUFF_SIZE))\r
- {\r
- /* error message printed by DT_post_recv_buffer */\r
- goto test_failure;\r
- }\r
-\r
- /*\r
- * Establish the connection\r
- */\r
- test_ptr->ep_context[i].ia_port = test_ptr->base_port + i;\r
-\r
- if (pt_ptr->local_is_server)\r
- {\r
- if (test_ptr->cmd->use_rsp)\r
- {\r
- /*\r
- * Server - create a single-use RSP and\r
- * await a connection for this EP\r
- */\r
-\r
- ret = dat_rsp_create (test_ptr->ia_handle,\r
- test_ptr->ep_context[i].ia_port,\r
- test_ptr->ep_context[i].ep_handle,\r
- test_ptr->creq_evd_hdl,\r
- &test_ptr->ep_context[i].rsp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_rsp_create #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- goto test_failure;\r
- }\r
- }\r
- else\r
- {\r
- ret = dat_psp_create (test_ptr->ia_handle,\r
- test_ptr->ep_context[i].ia_port,\r
- test_ptr->creq_evd_hdl,\r
- DAT_PSP_CONSUMER_FLAG,\r
- &test_ptr->ep_context[i].psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_psp_create #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- goto test_failure;\r
- }\r
-\r
- DT_Mdep_debug (("Server[" F64x "]: Listen #%d on PSP port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i,\r
- (DAT_UVERYLONG)test_ptr->ep_context[i].ia_port));\r
- }\r
- }\r
- }\r
-\r
- /* Here's where we tell the server process that this thread is\r
- * ready to wait for connection requests from the remote end.\r
- * Modify the synch wait semantics at your own risk - if these\r
- * signals and waits aren't here, there will be chronic\r
- * connection rejection timing problems.\r
- */\r
- if (pt_ptr->local_is_server)\r
- {\r
- DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);\r
- pt_ptr->Countdown_Counter--;\r
- /* Deliberate pre-decrement. Post decrement won't\r
- * work here, so don't do it.\r
- */\r
- if (pt_ptr->Countdown_Counter <= 0 )\r
- {\r
- DT_Mdep_wait_object_wakeup(&pt_ptr->synch_wait_object);\r
- }\r
-\r
- DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);\r
- }\r
-\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_UINT32 buff_size = MAX_OPS * sizeof (RemoteMemoryInfo);\r
- RemoteMemoryInfo *RemoteMemInfo;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_CR_ARRIVAL_EVENT_DATA cr_stat;\r
- DAT_CR_HANDLE cr_handle;\r
-\r
- /*\r
- * Establish the connection\r
- */\r
-\r
- if (pt_ptr->local_is_server)\r
- {\r
- DAT_CR_PARAM cr_param;\r
-\r
- if (test_ptr->cmd->use_rsp)\r
- {\r
-\r
- /* wait for the connection request */\r
- if (!DT_cr_event_wait (test_ptr->creq_evd_hdl, &cr_stat) ||\r
- !DT_cr_check ( &cr_stat,\r
- test_ptr->ep_context[i].rsp_handle,\r
- test_ptr->ep_context[i].ia_port,\r
- &cr_handle,\r
- "Server") )\r
- {\r
- goto test_failure;\r
- }\r
-\r
- ret = dat_cr_query (cr_handle,\r
- DAT_CR_FIELD_ALL,\r
- &cr_param);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_query #%d error:(%x) %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, ret, DT_RetToString (ret));\r
- } \r
- else\r
- {\r
- if ( cr_param.private_data_size == 0 ||\r
- strncmp((char *)cr_param.private_data, \r
- private_data_str, \r
- cr_param.private_data_size) != 0 )\r
- {\r
- DT_Mdep_printf ("--Private Data mismatch!\n");\r
- }\r
- else\r
- {\r
- DT_Mdep_debug ( ("--Private Data: %d: <%s>\n",\r
- cr_param.private_data_size,\r
- (char *)cr_param.private_data) );\r
- }\r
- }\r
-\r
- /* what, me query? just try to accept the connection */\r
- ret = dat_cr_accept (cr_handle,\r
- 0, /* NULL for RSP */\r
- 0, (DAT_PVOID)0 /* no private data */ );\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_accept #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- /* cr_handle consumed on failure */\r
- goto test_failure;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- /* error message printed by DT_conn_event_wait */\r
- goto test_failure;\r
- }\r
- /* throw away single-use PSP */\r
- ret = dat_rsp_free (test_ptr->ep_context[i].rsp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_rsp_free #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- goto test_failure;\r
- }\r
-\r
- }\r
- else\r
- {\r
- /*\r
- * Server - use a short-lived PSP instead of an RSP\r
- */\r
- /* wait for a connection request */\r
- if (!DT_cr_event_wait (test_ptr->creq_evd_hdl,\r
- &cr_stat) )\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_psp_create #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- goto test_failure;\r
- }\r
-\r
- if ( !DT_cr_check ( &cr_stat,\r
- test_ptr->ep_context[i].psp_handle,\r
- test_ptr->ep_context[i].ia_port,\r
- &cr_handle,\r
- "Server") )\r
- {\r
- goto test_failure;\r
- }\r
-\r
- ret = dat_cr_query (cr_handle,\r
- DAT_CR_FIELD_ALL,\r
- &cr_param);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_query #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- } \r
- else\r
- {\r
- if ( cr_param.private_data_size == 0 ||\r
- strncmp((char *)cr_param.private_data, \r
- private_data_str, \r
- cr_param.private_data_size) != 0 )\r
- {\r
- DT_Mdep_printf ("--Private Data mismatch!\n");\r
- }\r
- else\r
- {\r
- DT_Mdep_debug ( ("--Private Data: %d: <%s>\n",\r
- cr_param.private_data_size,\r
- (char *)cr_param.private_data) );\r
- }\r
- }\r
-\r
-\r
- /* what, me query? just try to accept the connection */\r
- ret = dat_cr_accept (cr_handle,\r
- test_ptr->ep_context[i].ep_handle,\r
- 0, (DAT_PVOID)0 /* no private data */ );\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cr_accept #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- /* cr_handle consumed on failure */\r
- (void) dat_psp_free (test_ptr->ep_context[i].psp_handle);\r
- goto test_failure;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- /* error message printed by DT_cr_event_wait */\r
- (void) dat_psp_free (&test_ptr->ep_context[i].psp_handle);\r
- goto test_failure;\r
- }\r
-\r
- /* throw away single-use PSP */\r
- ret = dat_psp_free (test_ptr->ep_context[i].psp_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_psp_free #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- goto test_failure;\r
- }\r
- } /* end short-lived PSP */\r
-\r
- DT_Mdep_debug (("Server[" F64x "]: Accept #%d on port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i,\r
- (DAT_UVERYLONG)test_ptr->ep_context[i].ia_port));\r
- }\r
- else\r
- {\r
- /*\r
- * Client - connect\r
- */\r
- unsigned int retry_cnt = 0;\r
- DAT_UINT32 buff_size = MAX_OPS * sizeof (RemoteMemoryInfo);\r
-\r
- DT_Mdep_debug (("Client[" F64x "]: Connect #%d on port 0x" F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i,\r
- (DAT_UVERYLONG)test_ptr->ep_context[i].ia_port));\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
-retry:\r
- ret = dat_ep_connect (test_ptr->ep_context[i].ep_handle,\r
- test_ptr->remote_ia_addr,\r
- test_ptr->ep_context[i].ia_port,\r
- DAT_TIMEOUT_INFINITE,\r
- (DAT_COUNT)strlen(private_data_str),private_data_str,\r
- /* 0, (DAT_PVOID) 0, */ /* no private data */\r
- pt_ptr->Params.ReliabilityLevel,\r
- DAT_CONNECT_DEFAULT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_connect #%d error: %s (0x%x)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret), ret);\r
- goto test_failure;\r
- }\r
-\r
- /* wait for DAT_CONNECTION_EVENT_ESTABLISHED */\r
- if (!DT_conn_event_wait ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->conn_evd_hdl,\r
- &event_num))\r
- {\r
- /* error message printed by DT_cr_event_wait */\r
- if ( event_num == DAT_CONNECTION_EVENT_PEER_REJECTED )\r
- {\r
- DT_Mdep_Sleep (1000);\r
- /*\r
- * See if any buffers were flushed as a result of\r
- * the REJECT; clean them up and repost if so\r
- */\r
- {\r
- DAT_EVENT event;\r
- DAT_COUNT drained = 0;\r
-\r
- dat_ep_reset (test_ptr->ep_context[i].ep_handle);\r
- do\r
- {\r
- ret = dat_evd_dequeue ( test_ptr->recv_evd_hdl,\r
- &event);\r
- drained++;\r
- } while (ret != DAT_QUEUE_EMPTY);\r
-\r
- if (drained > 1)\r
- {\r
- /*\r
- * Post recv and sync buffers\r
- */\r
- if (!DT_post_recv_buffer ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- RMI_RECV_BUFFER_ID,\r
- buff_size))\r
- {\r
- /* error message printed by DT_post_recv_buffer */\r
- goto test_failure;\r
- }\r
- if (!DT_post_recv_buffer ( test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- SYNC_RECV_BUFFER_ID,\r
- SYNC_BUFF_SIZE))\r
- {\r
- /* error message printed by DT_post_recv_buffer */\r
- goto test_failure;\r
- }\r
- }\r
- }\r
- DT_Mdep_printf ("Client[" F64x "]: retrying connection...\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- retry_cnt++;\r
- if (retry_cnt < MAX_CONN_RETRY)\r
- {\r
- goto retry;\r
- }\r
- }\r
- /* error message printed by DT_cr_event_wait */\r
- goto test_failure;\r
- }\r
-\r
- DT_Mdep_debug (("Client[" F64x "]: Got Connection #%d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i));\r
- }\r
-\r
-#ifdef CM_BUSTED\r
- /***** XXX Chill out a bit to give the kludged CM a chance ...\r
- *****/DT_Mdep_Sleep (5000);\r
-#endif\r
-\r
- /*\r
- * Fill in the test_ptr with relevant command info\r
- */\r
- for (j = 0; j < test_ptr->cmd->num_ops; j++)\r
- {\r
- test_ptr->ep_context[i].op[j].server_initiated\r
- = test_ptr->cmd->op[j].server_initiated;\r
- test_ptr->ep_context[i].op[j].transfer_type\r
- = test_ptr->cmd->op[j].transfer_type;\r
- test_ptr->ep_context[i].op[j].num_segs\r
- = test_ptr->cmd->op[j].num_segs;\r
- test_ptr->ep_context[i].op[j].seg_size\r
- = test_ptr->cmd->op[j].seg_size;\r
- test_ptr->ep_context[i].op[j].reap_send_on_recv\r
- = test_ptr->cmd->op[j].reap_send_on_recv;\r
- }\r
-\r
- /*\r
- * Exchange remote memory info: If we're going to participate\r
- * in an RDMA, we need to allocate memory buffers and advertise\r
- * them to the other side.\r
- */\r
- for (j = 0; j < test_ptr->cmd->num_ops; j++)\r
- {\r
- DAT_BOOLEAN us;\r
-\r
- us = (pt_ptr->local_is_server &&\r
- test_ptr->ep_context[i].op[j].server_initiated) ||\r
- (!pt_ptr->local_is_server &&\r
- !test_ptr->ep_context[i].op[j].server_initiated);\r
-\r
- test_ptr->ep_context[i].op[j].Rdma_Context = (DAT_RMR_CONTEXT) 0;\r
- test_ptr->ep_context[i].op[j].Rdma_Address = (DAT_PVOID) 0;\r
-\r
- switch (test_ptr->ep_context[i].op[j].transfer_type)\r
- {\r
- case RDMA_READ:\r
- {\r
- test_ptr->ep_context[i].op[j].bp =\r
- DT_BpoolAlloc (pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context[i].ep_handle,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->ep_context[i].op[j].seg_size,\r
- test_ptr->ep_context[i].op[j].num_segs,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- !us ? true : false);\r
- if (!test_ptr->ep_context[i].op[j].bp)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for buffers (RDMA/RD)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- goto test_failure;\r
- }\r
- if (!us)\r
- {\r
- test_ptr->ep_context[i].op[j].Rdma_Context =\r
- DT_Bpool_GetRMR (test_ptr->ep_context[i].op[j].bp, 0);\r
- test_ptr->ep_context[i].op[j].Rdma_Address =\r
- (DAT_PVOID) (uintptr_t)\r
- DT_Bpool_GetBuffer (test_ptr->ep_context[i].op[j].bp,\r
- 0);\r
- DT_Mdep_spew (3, ("not-us: RDMA/RD [ va=%p, ctxt=%x ]\n",\r
- test_ptr->ep_context[i].op[j].Rdma_Address,\r
- test_ptr->ep_context[i].op[j].Rdma_Context));\r
- }\r
- break;\r
- }\r
-\r
- case RDMA_WRITE:\r
- {\r
- test_ptr->ep_context[i].op[j].bp =\r
- DT_BpoolAlloc (pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context[i].ep_handle,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->ep_context[i].op[j].seg_size,\r
- test_ptr->ep_context[i].op[j].num_segs,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- !us ? true : false,\r
- false);\r
- if (!test_ptr->ep_context[i].op[j].bp)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for buffers (RDMA/WR)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- goto test_failure;\r
- }\r
- if (!us)\r
- {\r
- test_ptr->ep_context[i].op[j].Rdma_Context =\r
- DT_Bpool_GetRMR (test_ptr->ep_context[i].op[j].bp, 0);\r
- test_ptr->ep_context[i].op[j].Rdma_Address =\r
- (DAT_PVOID) (uintptr_t)\r
- DT_Bpool_GetBuffer (test_ptr->ep_context[i].op[j].bp,\r
- 0);\r
- DT_Mdep_spew (3, ("not-us: RDMA/WR [ va=%p, ctxt=%x ]\n",\r
- test_ptr->ep_context[i].op[j].Rdma_Address,\r
- test_ptr->ep_context[i].op[j].Rdma_Context));\r
- }\r
- break;\r
- }\r
-\r
- case SEND_RECV:\r
- {\r
- test_ptr->ep_context[i].op[j].bp =\r
- DT_BpoolAlloc (pt_ptr,\r
- test_ptr->ia_handle,\r
- test_ptr->pz_handle,\r
- test_ptr->ep_context[i].ep_handle,\r
- DAT_HANDLE_NULL, /* rmr */\r
- test_ptr->ep_context[i].op[j].seg_size,\r
- test_ptr->ep_context[i].op[j].num_segs,\r
- DAT_OPTIMAL_ALIGNMENT,\r
- false,\r
- false);\r
- if (!test_ptr->ep_context[i].op[j].bp)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: no memory for buffers (S/R)\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- goto test_failure;\r
- }\r
-\r
- DT_Mdep_spew (3, ("%d: S/R [ va=%p ]\n", j, (DAT_PVOID)\r
- DT_Bpool_GetBuffer ( test_ptr->ep_context[i].op[j].bp, 0)));\r
- break;\r
- }\r
- }\r
- } /* end foreach op */\r
-\r
- /*\r
- * Prep send buffer with memory information\r
- */\r
- RemoteMemInfo = (RemoteMemoryInfo *)\r
- DT_Bpool_GetBuffer (test_ptr->ep_context[i].bp,\r
- RMI_SEND_BUFFER_ID);\r
-\r
- for (j = 0; j < test_ptr->cmd->num_ops; j++)\r
- {\r
- RemoteMemInfo[j].rmr_context =\r
- test_ptr->ep_context[i].op[j].Rdma_Context;\r
- RemoteMemInfo[j].mem_address.as_64 = (DAT_UINT64) 0UL;\r
- RemoteMemInfo[j].mem_address.as_ptr =\r
- test_ptr->ep_context[i].op[j].Rdma_Address;\r
- if (RemoteMemInfo[j].mem_address.as_ptr)\r
- {\r
- DT_Mdep_spew (3, ("RemoteMemInfo[%d] va=" F64x ", ctx=%x\n",\r
- j,\r
- (DAT_UVERYLONG)RemoteMemInfo[j].mem_address.as_64,\r
- RemoteMemInfo[j].rmr_context));\r
- }\r
- /*\r
- * If the client and server are of different endiannesses,\r
- * we must correct the endianness of the handle and address\r
- * we pass to the other side. The other side cannot (and\r
- * better not) interpret these values.\r
- */\r
- if (DT_local_is_little_endian != test_ptr->remote_is_little_endian)\r
- {\r
- RemoteMemInfo[j].rmr_context =\r
- DT_EndianMemHandle (RemoteMemInfo[j].rmr_context);\r
- RemoteMemInfo[j].mem_address.as_64 =\r
- DT_EndianMemAddress (RemoteMemInfo[j].mem_address.as_64);\r
- }\r
- } /* end foreach op */\r
-\r
- /*\r
- * Send our memory info (synchronously)\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Sending %s Memory Info\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- test_ptr->is_server ? "Server" : "Client"));\r
-\r
- /* post the send buffer */\r
- if (!DT_post_send_buffer (test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- RMI_SEND_BUFFER_ID,\r
- buff_size))\r
- {\r
- /* error message printed by DT_post_send_buffer */\r
- goto test_failure;\r
- }\r
- /* reap the send and verify it */\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp,\r
- RMI_SEND_BUFFER_ID);\r
- if (!DT_dto_event_wait (test_ptr->reqt_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- test_ptr->ep_context[i].ep_handle,\r
- buff_size,\r
- dto_cookie,\r
- test_ptr->is_server ? "Client_Mem_Info_Send"\r
- : "Server_Mem_Info_Send"))\r
- {\r
- goto test_failure;\r
- }\r
-\r
- /*\r
- * Recv the other side's info\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Waiting for %s Memory Info\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- test_ptr->is_server ? "Client" : "Server"));\r
- dto_cookie.as_64 = LZERO;\r
- dto_cookie.as_ptr =\r
- (DAT_PVOID) DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[i].bp,\r
- RMI_RECV_BUFFER_ID);\r
- if (!DT_dto_event_wait (test_ptr->recv_evd_hdl, &dto_stat) ||\r
- !DT_dto_check ( &dto_stat,\r
- test_ptr->ep_context[i].ep_handle,\r
- buff_size,\r
- dto_cookie,\r
- test_ptr->is_server ? "Client_Mem_Info_Recv"\r
- : "Server_Mem_Info_Recv"))\r
- {\r
- goto test_failure;\r
- }\r
-\r
- /*\r
- * Extract what we need\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Memory Info received \n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- RemoteMemInfo = (RemoteMemoryInfo *)\r
- DT_Bpool_GetBuffer (test_ptr->ep_context[i].bp,\r
- RMI_RECV_BUFFER_ID);\r
- for (j = 0; j < test_ptr->cmd->num_ops; j++)\r
- {\r
- DAT_BOOLEAN us;\r
-\r
- us = (pt_ptr->local_is_server &&\r
- test_ptr->ep_context[i].op[j].server_initiated) ||\r
- (!pt_ptr->local_is_server &&\r
- !test_ptr->ep_context[i].op[j].server_initiated);\r
- if (us &&\r
- (test_ptr->ep_context[i].op[j].transfer_type == RDMA_READ ||\r
- test_ptr->ep_context[i].op[j].transfer_type == RDMA_WRITE))\r
- {\r
- test_ptr->ep_context[i].op[j].Rdma_Context =\r
- RemoteMemInfo[j].rmr_context;\r
- test_ptr->ep_context[i].op[j].Rdma_Address =\r
- RemoteMemInfo[j].mem_address.as_ptr;\r
- DT_Mdep_spew (3, ("Got RemoteMemInfo [ va=%p, ctx=%x ]\n",\r
- test_ptr->ep_context[i].op[j].Rdma_Address,\r
- test_ptr->ep_context[i].op[j].Rdma_Context));\r
- }\r
- }\r
- } /* end foreach EP context */\r
-\r
- /*\r
- * Dump out the state of the world if we're debugging\r
- */\r
- if (test_ptr->cmd->debug)\r
- {\r
- DT_Print_Transaction_Test (test_ptr);\r
- }\r
-\r
- /*\r
- * Finally! Run the test.\r
- */\r
- success = DT_Transaction_Run (test_ptr);\r
-\r
- /*\r
- * Now clean up and go home\r
- */\r
-test_failure:\r
- if (test_ptr->ep_context)\r
- {\r
-\r
- /* Foreach EP */\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_EP_HANDLE ep_handle;\r
-\r
- ep_handle = DAT_HANDLE_NULL;\r
-\r
- /* Free the per-op buffers */\r
- for (j = 0; j < test_ptr->cmd->num_ops; j++)\r
- {\r
- if (test_ptr->ep_context[i].op[j].bp)\r
- {\r
- if (!DT_Bpool_Destroy (pt_ptr,\r
- test_ptr->ep_context[i].op[j].bp))\r
- {\r
- DT_Mdep_printf ("test[" F64x "]: Warning: Bpool destroy fails\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- /* carry on trying, regardless */\r
- }\r
- }\r
- }\r
-\r
- /* Free the remote memory info exchange buffers */\r
- if (test_ptr->ep_context[i].bp)\r
- {\r
- if (!DT_Bpool_Destroy (pt_ptr,\r
- test_ptr->ep_context[i].bp))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: Bpool destroy fails\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- /* carry on trying, regardless */\r
- }\r
- }\r
-\r
- /*\r
- * Disconnect -- we may have left recv buffers posted, if we\r
- * bailed out mid-setup, or ran to completion\r
- * normally, so we use abrupt closure.\r
- */\r
- if (test_ptr->ep_context[i].ep_handle)\r
- {\r
- ret = dat_ep_disconnect (test_ptr->ep_context[i].ep_handle,\r
- DAT_CLOSE_ABRUPT_FLAG);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Warning: dat_ep_disconnect (%s) "\r
- "#%d error %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- success ? "graceful" : "abrupt",\r
- i, DT_RetToString (ret));\r
- /* carry on trying, regardless */\r
- }\r
- }\r
-\r
- /*\r
- * Wait on each of the outstanding EP handles. Some of them\r
- * may be disconnected by the remote side, we are racing\r
- * here.\r
- */\r
-\r
- if ( success ) /* Ensure DT_Transaction_Run did not return error otherwise may get stuck waiting for disconnect event*/\r
- {\r
- if (!DT_disco_event_wait ( test_ptr->conn_evd_hdl,\r
- &ep_handle))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: bad disconnect event\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- }\r
- else\r
- {\r
- /*\r
- * We have successfully obtained a completed EP. We are\r
- * racing with the remote node on disconnects, so we\r
- * don't know which EP this is. Run the list and\r
- * remove it so we don't disconnect a disconnected EP\r
- */\r
- for (j = 0; j < test_ptr->cmd->eps_per_thread; j++)\r
- {\r
- if ( test_ptr->ep_context[j].ep_handle == ep_handle )\r
- {\r
- test_ptr->ep_context[j].ep_handle = NULL;\r
- }\r
- }\r
- }\r
- } else /* !success - QP may be in error state */\r
- ep_handle = test_ptr->ep_context[i].ep_handle;\r
-\r
- /*\r
- * Free the handle returned by the disconnect event.\r
- * With multiple EPs, it may not be the EP we just\r
- * disconnected as we are racing with the remote side\r
- * disconnects.\r
- */\r
- if ( DAT_HANDLE_NULL != ep_handle)\r
- {\r
- DAT_EVENT event;\r
- /*\r
- * Drain off outstanding DTOs that may have been\r
- * generated by racing disconnects\r
- */\r
- do\r
- {\r
- ret = dat_evd_dequeue ( test_ptr->recv_evd_hdl,\r
- &event);\r
- } while ( DAT_GET_TYPE(ret) != DAT_QUEUE_EMPTY );\r
- /* Destroy the EP */\r
- ret = dat_ep_free (ep_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_ep_free #%d error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, i, DT_RetToString (ret));\r
- /* carry on trying, regardless */\r
- }\r
- }\r
- } /* end foreach per-EP context */\r
-\r
- DT_MemListFree (pt_ptr, test_ptr->ep_context);\r
- }\r
-\r
- /* clean up the EVDs */\r
- if (test_ptr->conn_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->conn_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (conn) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- if (pt_ptr->local_is_server)\r
- {\r
- if (test_ptr->creq_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->creq_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (creq) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- }\r
- if (test_ptr->reqt_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->reqt_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (reqt) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
- if (test_ptr->recv_evd_hdl)\r
- {\r
- ret = dat_evd_free (test_ptr->recv_evd_hdl);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_evd_free (recv) error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-\r
- /* clean up the CNO */\r
- if (test_ptr->cmd->use_cno && test_ptr->cno_handle)\r
- {\r
- ret = dat_cno_free (test_ptr->cno_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_cno_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-\r
- /* clean up the PZ */\r
- if (test_ptr->pz_handle)\r
- {\r
- ret = dat_pz_free (test_ptr->pz_handle);\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: dat_pz_free error: %s\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, DT_RetToString (ret));\r
- /* fall through, keep trying */\r
- }\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: cleanup is done\n", (DAT_UVERYLONG)test_ptr->base_port));\r
- DT_MemListFree ( pt_ptr, test_ptr );\r
- DT_Thread_Destroy ( thread, pt_ptr );\r
- DT_Mdep_Thread_Detach ( DT_Mdep_Thread_SELF() ); /* AMM */\r
- DT_Mdep_Thread_EXIT(NULL); /* AMM */\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------------------\r
- * The actual performance test\r
- */\r
-bool\r
-DT_Transaction_Run (Transaction_Test_t * test_ptr)\r
-{\r
- unsigned int op;\r
- unsigned int iteration;\r
- int bytes;\r
- bool ours;\r
- bool success = false;\r
- bool repost_recv;\r
- unsigned int i;\r
-\r
- /* pre-post all receive buffers */\r
- for (op = 0; op < test_ptr->cmd->num_ops; op++)\r
- {\r
- /* if it is a SEND/RECV, we must post receive buffers */\r
- if (test_ptr->ep_context[0].op[op].transfer_type == SEND_RECV)\r
- {\r
- ours = (test_ptr->is_server ==\r
- test_ptr->ep_context[0].op[op].server_initiated);\r
- if (!ours)\r
- {\r
- if (!DT_handle_post_recv_buf (test_ptr->ep_context,\r
- test_ptr->cmd->eps_per_thread,\r
- op))\r
- {\r
- goto bail;\r
- }\r
- }\r
- }\r
- }\r
-\r
- /* initialize data if we are validating it */\r
- if (test_ptr->cmd->validate)\r
- {\r
- DT_Transaction_Validation_Fill (test_ptr, 0);\r
- }\r
-\r
- /*\r
- * Now that we've posted our receive buffers...\r
- * synchronize with the other side.\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Synchronize with the other side\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
-\r
- /*\r
- * Each server thread sends a sync message to the corresponding\r
- * client thread. All clients wait until all server threads\r
- * have sent their sync messages. Then all clients send \r
- * sync message.\r
- *\r
- * Since all of the events are directed to the same EVD, \r
- * we do not use DT_dto_check(.) to verify the attributes \r
- * of the sync message event. DT_dto_check(.) requires the \r
- * comsumer to pass the expected EP, but we do not know \r
- * what to expect. DAPL does not guarantee the order of \r
- * completions across EPs. Therfore we only know that \r
- * test_ptr->cmd->eps_per_thread number of completion events \r
- * will be generated but not the order in which they will \r
- * complete.\r
- */\r
-\r
- if (test_ptr->is_server)\r
- {\r
- /*\r
- * Server\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Send Sync to Client\n", \r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- if (!DT_post_send_buffer (test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- SYNC_SEND_BUFFER_ID,\r
- SYNC_BUFF_SIZE))\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Server sync send error\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- goto bail;\r
- }\r
- }\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
-\r
- if ( !DT_dto_event_wait (test_ptr->reqt_evd_hdl, &dto_stat) )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Server sync send error\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
-\r
- goto bail;\r
- }\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: Wait for Sync Message\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
-\r
- if ( !DT_dto_event_wait (test_ptr->recv_evd_hdl, &dto_stat) )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Server sync recv error\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- goto bail;\r
- }\r
- }\r
- }\r
- else\r
- {\r
- /*\r
- * Client\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Wait for Sync Message\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
-\r
- if ( !DT_dto_event_wait (test_ptr->recv_evd_hdl, &dto_stat) )\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Client sync recv error\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- goto bail;\r
- }\r
- DT_transaction_stats_set_ready (&test_ptr->pt_ptr->Client_Stats);\r
- }\r
-\r
- /* check if it is time for client to send sync */\r
- if (!DT_transaction_stats_wait_for_all (&test_ptr->pt_ptr->Client_Stats))\r
- {\r
- goto bail;\r
- }\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: Send Sync Msg\n", (DAT_UVERYLONG)test_ptr->base_port));\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- if (!DT_post_send_buffer (test_ptr->ep_context[i].ep_handle,\r
- test_ptr->ep_context[i].bp,\r
- SYNC_SEND_BUFFER_ID,\r
- SYNC_BUFF_SIZE))\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: Client sync send error\n",\r
- (DAT_UVERYLONG)test_ptr->base_port));\r
- goto bail;\r
- }\r
- }\r
- for (i = 0; i < test_ptr->cmd->eps_per_thread; i++)\r
- {\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
-\r
- if ( !DT_dto_event_wait (test_ptr->reqt_evd_hdl, &dto_stat) )\r
- {\r
- goto bail;\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * Get to work ...\r
- */\r
- DT_Mdep_debug (("Test[" F64x "]: Begin...\n", (DAT_UVERYLONG)test_ptr->base_port));\r
- test_ptr->stats.start_time = DT_Mdep_GetTime ();\r
-\r
- for (iteration = 0;\r
- iteration < test_ptr->cmd->num_iterations;\r
- iteration++)\r
- {\r
-\r
- DT_Mdep_debug (("iteration: %d\n", iteration));\r
-\r
- /* repost unless this is the last iteration */\r
- repost_recv = (iteration + 1 != test_ptr->cmd->num_iterations);\r
-\r
- for (op = 0; op < test_ptr->cmd->num_ops; op++)\r
- {\r
- ours = (test_ptr->is_server ==\r
- test_ptr->ep_context[0].op[op].server_initiated);\r
- bytes = (test_ptr->ep_context[0].op[op].seg_size *\r
- test_ptr->ep_context[0].op[op].num_segs *\r
- test_ptr->cmd->eps_per_thread);\r
-\r
- switch (test_ptr->ep_context[0].op[op].transfer_type)\r
- {\r
- case RDMA_READ:\r
- {\r
- test_ptr->stats.stat_bytes_rdma_read += bytes;\r
- if (ours)\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: RdmaRead [%d]\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- op));\r
- if (!DT_handle_rdma_op (test_ptr->ep_context,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->cmd->eps_per_thread,\r
- RDMA_READ,\r
- op,\r
- test_ptr->cmd->poll))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: RdmaRead error[%d]\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, op);\r
- goto bail;\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case RDMA_WRITE:\r
- {\r
- test_ptr->stats.stat_bytes_rdma_write += bytes;\r
- if (ours)\r
- {\r
- DT_Mdep_debug (("Test[" F64x "]: RdmaWrite [%d]\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- op));\r
- if (!DT_handle_rdma_op (test_ptr->ep_context,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->cmd->eps_per_thread,\r
- RDMA_WRITE,\r
- op,\r
- test_ptr->cmd->poll))\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: RdmaWrite error[%d]\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, op);\r
- goto bail;\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case SEND_RECV:\r
- {\r
- if (ours)\r
- {\r
- test_ptr->stats.stat_bytes_send += bytes;\r
- DT_Mdep_debug (("Test[" F64x "]: postsend [%d] \n",\r
- (DAT_UVERYLONG)test_ptr->base_port, op));\r
- /* send data */\r
- if (!DT_handle_send_op (test_ptr->ep_context,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->cmd->eps_per_thread,\r
- op,\r
- test_ptr->cmd->poll))\r
- {\r
- goto bail;\r
- }\r
- }\r
- else\r
- {\r
- test_ptr->stats.stat_bytes_recv += bytes;\r
- DT_Mdep_debug (("Test[" F64x "]: RecvWait and Re-Post [%d] \n",\r
- (DAT_UVERYLONG)test_ptr->base_port, op));\r
-\r
- if (!DT_handle_recv_op (test_ptr->ep_context,\r
- test_ptr->recv_evd_hdl,\r
- test_ptr->reqt_evd_hdl,\r
- test_ptr->cmd->eps_per_thread,\r
- op,\r
- test_ptr->cmd->poll,\r
- repost_recv))\r
- {\r
- goto bail;\r
- }\r
- }\r
-\r
- /* now before going on, is it time to validate? */\r
- if (test_ptr->cmd->validate)\r
- {\r
- if (!test_ptr->pt_ptr->local_is_server) /* CLIENT */\r
- {\r
- /* the client validates on the third to last op */\r
- if (op == test_ptr->cmd->num_ops - 3)\r
- {\r
- if (!DT_Transaction_Validation_Check (test_ptr,\r
- iteration))\r
- {\r
- goto bail;\r
- }\r
- DT_Transaction_Validation_Fill (test_ptr,\r
- iteration + 1);\r
- }\r
- }\r
- else /* SERVER */\r
- {\r
- /* the server validates on the second to last op */\r
- if (op == test_ptr->cmd->num_ops - 2)\r
- {\r
- if (!DT_Transaction_Validation_Check (test_ptr,\r
- iteration))\r
- {\r
- goto bail;\r
- }\r
- DT_Transaction_Validation_Fill (test_ptr,\r
- iteration + 1);\r
- }\r
- }\r
- } /* end validate */\r
- break;\r
- }\r
- } /* end switch for transfer type */\r
- } /* end loop for each op */\r
- } /* end loop for iteration */\r
-\r
- /* end time and print stats */\r
- test_ptr->stats.end_time = DT_Mdep_GetTime ();\r
- if (!test_ptr->pt_ptr->local_is_server)\r
- {\r
- DT_update_transaction_stats (&test_ptr->pt_ptr->Client_Stats,\r
- test_ptr->cmd->eps_per_thread * test_ptr->cmd->num_ops *\r
- test_ptr->cmd->num_iterations,\r
- test_ptr->stats.end_time - test_ptr->stats.start_time,\r
- test_ptr->stats.stat_bytes_send,\r
- test_ptr->stats.stat_bytes_recv,\r
- test_ptr->stats.stat_bytes_rdma_read,\r
- test_ptr->stats.stat_bytes_rdma_write);\r
- }\r
- DT_Mdep_debug (("Test[" F64x "]: End Successfully\n", (DAT_UVERYLONG)test_ptr->base_port));\r
- success = true;\r
-\r
-bail:\r
- return ( success );\r
-}\r
-\r
-\r
-/*------------------------------------------------------------------------------ */\r
-void\r
-DT_Transaction_Validation_Fill ( Transaction_Test_t * test_ptr,\r
- unsigned int iteration)\r
-{\r
- bool ours;\r
- unsigned int op;\r
- unsigned int i;\r
- unsigned int j;\r
- unsigned int ind;\r
- unsigned char *buff;\r
-\r
- if (iteration >= test_ptr->cmd->num_iterations)\r
- {\r
- return;\r
- }\r
- DT_Mdep_debug (("Test[" F64x "]: FILL Buffers Iteration %d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port, iteration));\r
-\r
- /*\r
- * fill all but the last three ops, which\r
- * were added to create barriers for data validation\r
- */\r
- for (ind = 0; ind < test_ptr->cmd->eps_per_thread; ind++)\r
- {\r
- for (op = 0; op < test_ptr->cmd->num_ops - 3; op++)\r
- {\r
- ours = (test_ptr->is_server ==\r
- test_ptr->ep_context[ind].op[op].server_initiated);\r
-\r
- switch (test_ptr->ep_context[ind].op[op].transfer_type)\r
-\r
- {\r
- case RDMA_READ:\r
- {\r
- if (!ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs;\r
- i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp, i);\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
- /* Avoid using all zero bits the 1st time */\r
- buff[j] = (iteration + 1) & 0xFF;\r
- }\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case RDMA_WRITE:\r
- {\r
- if (ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs;\r
- i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp, i);\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
- /* Avoid using all zero bits the 1st time */\r
- buff[j] = (iteration + 1) & 0xFF;\r
- }\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case SEND_RECV:\r
- {\r
- if (ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs;\r
- i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp,\r
- i);\r
- /*****\r
- DT_Mdep_printf(\r
- "\tFill: wq=%d op=%d seg=%d ptr=[%p, %d]\n",\r
- ind, op, i, buff, j);\r
- *****/\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
- /* Avoid using all zero bits the 1st time */\r
- buff[j] = (iteration + 1) & 0xFF;\r
- }\r
- }\r
- }\r
- break;\r
- }\r
- } /* end switch transfer_type */\r
- } /* end for each op */\r
- } /* end for each ep per thread */\r
-}\r
-\r
-\r
-/*------------------------------------------------------------------------------ */\r
-bool\r
-DT_Transaction_Validation_Check (Transaction_Test_t * test_ptr,\r
- int iteration)\r
-{\r
- bool ours;\r
- bool success = true;\r
- unsigned int op;\r
- unsigned int i;\r
- unsigned int j;\r
- unsigned int ind;\r
- unsigned char *buff;\r
- unsigned char expect;\r
- unsigned char got;\r
-\r
- DT_Mdep_debug (("Test[" F64x "]: VALIDATE Buffers Iteration %d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- iteration));\r
-\r
- /*\r
- * fill all but the last three ops, which\r
- * were added to create barriers for data validation\r
- */\r
- for (ind = 0; ind < test_ptr->cmd->eps_per_thread; ind++)\r
- {\r
- for (op = 0; op < test_ptr->cmd->num_ops - 3; op++)\r
- {\r
- ours = (test_ptr->is_server ==\r
- test_ptr->ep_context[ind].op[op].server_initiated);\r
-\r
- switch (test_ptr->ep_context[ind].op[op].transfer_type)\r
- {\r
- case RDMA_READ:\r
- {\r
- if (ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs; i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp, i);\r
-\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
-\r
- expect = (iteration + 1) & 0xFF;\r
- got = buff[j];\r
- if (expect != got)\r
- {\r
- DT_Mdep_printf (\r
- "Test[" F64x "]: Validation Error :: %d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- op);\r
- DT_Mdep_printf (\r
- "Test[" F64x "]: Expected %x Got %x\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- expect,\r
- got);\r
- DT_Mdep_spew (3,\r
- ("\twq=%d op=%d seg=%d byte=%d ptr=%p\n",\r
- ind, op, i, j, buff));\r
- success = false;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case RDMA_WRITE:\r
- {\r
- if (!ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs;\r
- i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp, i);\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
-\r
- expect = (iteration + 1) & 0xFF;\r
- got = buff[j];\r
- if (expect != got)\r
- {\r
- DT_Mdep_printf ("Test[" F64x "]: Validation Error :: %d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- op);\r
- DT_Mdep_printf ("Test[" F64x "]: Expected %x Got %x\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- expect,\r
- got);\r
- DT_Mdep_spew (3,\r
- ("\twq=%d op=%d seg=%d byte=%d ptr=%p\n",\r
- ind, op, i, j, buff));\r
- success = false;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- break;\r
- }\r
-\r
- case SEND_RECV:\r
- {\r
- if (!ours)\r
- {\r
- for (i = 0;\r
- i < test_ptr->ep_context[ind].op[op].num_segs;\r
- i++)\r
- {\r
-\r
- buff = DT_Bpool_GetBuffer (\r
- test_ptr->ep_context[ind].op[op].bp, i);\r
- DT_Mdep_spew (3, (\r
- "\tCheck:wq=%d op=%d seg=%d ptr=[%p, %d]\n",\r
- ind, op, i, buff, \r
- test_ptr->ep_context[ind].op[op].seg_size));\r
-\r
- for (j = 0;\r
- j < test_ptr->ep_context[ind].op[op].seg_size;\r
- j++)\r
- {\r
-\r
- expect = (iteration + 1) & 0xFF;\r
- got = buff[j];\r
- if (expect != got)\r
- {\r
- DT_Mdep_printf (\r
- "Test[" F64x "]: Validation Error :: %d\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- op);\r
- DT_Mdep_printf ("Test[" F64x "]: Expected %x Got %x\n",\r
- (DAT_UVERYLONG)test_ptr->base_port,\r
- expect,\r
- got);\r
- DT_Mdep_spew (3,\r
- ("\twq=%d op=%d seg=%d byte=%d ptr=%p\n",\r
- ind, op, i, j, buff));\r
- success = false;\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- break;\r
- }\r
- } /* end switch transfer_type */\r
- } /* end for each op */\r
- } /* end for each ep per thread */\r
-\r
- return ( success );\r
-}\r
-\r
-\r
-/*------------------------------------------------------------------------------ */\r
-void\r
-DT_Print_Transaction_Test (Transaction_Test_t * test_ptr)\r
-{\r
- DT_Mdep_printf ("-------------------------------------\n");\r
- DT_Mdep_printf ("TransTest.is_server : %d\n",\r
- test_ptr->is_server);\r
- DT_Mdep_printf ("TransTest.remote_little_endian : %d\n",\r
- test_ptr->remote_is_little_endian);\r
- DT_Mdep_printf ("TransTest.base_port : " F64x "\n",\r
- (DAT_UVERYLONG)test_ptr->base_port);\r
- DT_Mdep_printf ("TransTest.pz_handle : %p\n",\r
- test_ptr->pz_handle);\r
- /* statistics */\r
- DT_Mdep_printf ("TransTest.bytes_send : %d\n",\r
- test_ptr->stats.stat_bytes_send);\r
- DT_Mdep_printf ("TransTest.bytes_recv : %d\n",\r
- test_ptr->stats.stat_bytes_recv);\r
- DT_Mdep_printf ("TransTest.bytes_rdma_read : %d\n",\r
- test_ptr->stats.stat_bytes_rdma_read);\r
- DT_Mdep_printf ("TransTest.bytes_rdma_write : %d\n",\r
- test_ptr->stats.stat_bytes_rdma_write);\r
-}\r
-\r
-\r
-/*------------------------------------------------------------------------------ */\r
-void\r
-DT_Print_Transaction_Stats (Transaction_Test_t * test_ptr)\r
-{\r
- double time;\r
- double mbytes_send;\r
- double mbytes_recv;\r
- double mbytes_rdma_read;\r
- double mbytes_rdma_write;\r
- int total_ops;\r
- time = (double) (test_ptr->stats.end_time - test_ptr->stats.start_time) / 1000;\r
- mbytes_send = (double) test_ptr->stats.stat_bytes_send / 1024 / 1024;\r
- mbytes_recv = (double) test_ptr->stats.stat_bytes_recv / 1024 / 1024;\r
- mbytes_rdma_read = (double) test_ptr->stats.stat_bytes_rdma_read / 1024 / 1024;\r
- mbytes_rdma_write = (double) test_ptr->stats.stat_bytes_rdma_write / 1024 / 1024;\r
- total_ops = test_ptr->cmd->num_ops * test_ptr->cmd->num_iterations;\r
-\r
- DT_Mdep_printf ("Test[: " F64x "] ---- Stats ----\n", (DAT_UVERYLONG)test_ptr->base_port);\r
- DT_Mdep_printf ("Iterations : %u\n", test_ptr->cmd->num_iterations);\r
- DT_Mdep_printf ("Ops : %7d.%02d Ops/Sec\n",\r
- whole (total_ops / time),\r
- hundredths (total_ops / time));\r
- DT_Mdep_printf ("Time : %7d.%02d sec\n",\r
- whole (time),\r
- hundredths (time));\r
- DT_Mdep_printf ("Sent : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_send),\r
- hundredths (mbytes_send),\r
- whole (mbytes_send / time),\r
- hundredths (mbytes_send / time));\r
- DT_Mdep_printf ("Recv : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_recv),\r
- hundredths (mbytes_recv),\r
- whole (mbytes_recv / time),\r
- hundredths (mbytes_recv / time));\r
- DT_Mdep_printf ("RDMA Read : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_rdma_read),\r
- hundredths (mbytes_rdma_read),\r
- whole (mbytes_rdma_read / time),\r
- hundredths (mbytes_rdma_read / time));\r
- DT_Mdep_printf ("RDMA Write : %7d.%02d MB - %7d.%02d MB/Sec\n",\r
- whole (mbytes_rdma_write),\r
- hundredths (mbytes_rdma_write),\r
- whole (mbytes_rdma_write / time),\r
- hundredths (mbytes_rdma_write / time));\r
-}\r
-\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_TRANSACTION_TEST_H__\r
-#define __DAPL_TRANSACTION_TEST_H__\r
-\r
-#include "dapl_common.h"\r
-#include "dapl_test_data.h"\r
-#include "dapl_transaction_cmd.h"\r
-#include "dapl_mdep.h"\r
-\r
-#pragma pack(1)\r
-typedef struct\r
-{\r
- DAT_BOOLEAN server_initiated;\r
- DT_Transfer_Type transfer_type;\r
- DAT_UINT32 num_segs;\r
- DAT_UINT32 seg_size;\r
- DAT_BOOLEAN reap_send_on_recv;\r
- Bpool *bp;\r
-\r
- /* RDMA info */\r
- DAT_RMR_CONTEXT Rdma_Context;\r
- DAT_PVOID Rdma_Address;\r
-} Transaction_Test_Op_t;\r
-\r
-typedef struct\r
-{\r
- DAT_EP_HANDLE ep_handle;\r
- DAT_EP_ATTR ep_attr;\r
- DAT_CONN_QUAL ia_port;\r
- Bpool *bp;\r
- Transaction_Test_Op_t op[ MAX_OPS ];\r
- DAT_RSP_HANDLE rsp_handle;\r
- DAT_PSP_HANDLE psp_handle;\r
-\r
-} Ep_Context_t;\r
-\r
-typedef struct\r
-{\r
- unsigned int stat_bytes_send;\r
- unsigned int stat_bytes_recv;\r
- unsigned int stat_bytes_rdma_read;\r
- unsigned int stat_bytes_rdma_write;\r
- unsigned int start_time;\r
- unsigned int end_time;\r
-} Transaction_Test_Stats_t;\r
-\r
-typedef struct\r
-{\r
- /* This group set up by DT_Transaction_Create_Test() */\r
- DAT_BOOLEAN is_server;\r
- DAT_BOOLEAN remote_is_little_endian;\r
- Per_Test_Data_t *pt_ptr;\r
- DAT_IA_HANDLE ia_handle;\r
- Transaction_Cmd_t *cmd;\r
- DAT_IA_ADDRESS_PTR remote_ia_addr;\r
- DAT_CONN_QUAL base_port;\r
- DAT_TIMEOUT time_out;\r
- DAT_COUNT evd_length;\r
- Thread *thread;\r
-\r
- /* This group set up by each thread in DT_Transaction_Main() */\r
- DAT_PZ_HANDLE pz_handle;\r
- DAT_CNO_HANDLE cno_handle;\r
- DAT_EVD_HANDLE recv_evd_hdl; /* receive */\r
- DAT_EVD_HANDLE reqt_evd_hdl; /* request+rmr */\r
- DAT_EVD_HANDLE conn_evd_hdl; /* connect */\r
- DAT_EVD_HANDLE creq_evd_hdl; /* "" request */\r
- Ep_Context_t *ep_context;\r
-\r
- /* Statistics set by DT_Transaction_Run() */\r
- Transaction_Test_Stats_t stats;\r
-} Transaction_Test_t;\r
-#pragma pack()\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_bpool.h"\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-\r
-/* -----------------------------------------------------------\r
- * Post a recv buffer on each of this thread's EPs.\r
- */\r
-bool\r
-DT_handle_post_recv_buf (Ep_Context_t * ep_context,\r
- unsigned int num_eps,\r
- int op_indx)\r
-{\r
- unsigned int i, j;\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op = &ep_context[i].op[op_indx];\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (op->bp, 0);\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RETURN ret;\r
-\r
- /* Prep the inputs */\r
- for (j = 0; j < op->num_segs; j++)\r
- {\r
- iov[j].pad = 0U;\r
- iov[j].virtual_address = (DAT_VADDR) (uintptr_t)\r
- DT_Bpool_GetBuffer (op->bp, j);\r
- iov[j].segment_length = op->seg_size;\r
- iov[j].lmr_context = DT_Bpool_GetLMR (op->bp, j);\r
- }\r
- cookie.as_64 = \r
- ((((DAT_UINT64) i) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- /* Post the recv */\r
- ret = dat_ep_post_recv ( ep_context[i].ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dat_ep_post_recv failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- return false;\r
- }\r
- }\r
-\r
- return true;\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Post a send buffer on each of this thread's EPs.\r
- */\r
-bool\r
-DT_handle_send_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- int op_indx,\r
- bool poll)\r
-{\r
- unsigned int i, j;\r
- unsigned char *completion_reaped;\r
-\r
- completion_reaped = DT_Mdep_Malloc (num_eps * sizeof (unsigned char));\r
-\r
- if (!completion_reaped)\r
- {\r
- return false;\r
- }\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op = &ep_context[i].op[op_indx];\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (op->bp, 0);\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RETURN ret;\r
-\r
- /* Prep the inputs */\r
- for (j = 0; j < op->num_segs; j++)\r
- {\r
- iov[j].pad = 0U;\r
- iov[j].virtual_address = (DAT_VADDR) (uintptr_t)\r
- DT_Bpool_GetBuffer (op->bp, j);\r
- iov[j].segment_length = op->seg_size;\r
- iov[j].lmr_context = DT_Bpool_GetLMR (op->bp, j);\r
- }\r
- cookie.as_64 =\r
- ((((DAT_UINT64) i) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- /* Post the send */\r
- ret = dat_ep_post_send ( ep_context[i].ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dat_ep_post_send failed: %s\n",\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return false;\r
- }\r
- }\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op = &ep_context[i].op[op_indx];\r
-\r
- if (op->reap_send_on_recv && !op->server_initiated)\r
- {\r
- /* we will reap the send on the recv (Client SR) */\r
- DT_Mdep_Free (completion_reaped);\r
- return true;\r
- }\r
- }\r
-\r
- bzero ((void *) completion_reaped, sizeof (unsigned char) * num_eps);\r
-\r
- /* reap the send completion */\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_DTO_COOKIE dto_cookie;\r
- unsigned int epnum;\r
-\r
- if (!DT_dto_event_reap (reqt_evd_hdl, poll, &dto_stat))\r
- {\r
- DT_Mdep_Free (completion_reaped);\r
- return false;\r
- }\r
-\r
- epnum = (uint32_t)(dto_stat.user_cookie.as_64 >> 32);\r
- if (epnum > num_eps)\r
- {\r
- DT_Mdep_printf ("Test Error: Send: Invalid endpoint completion reaped.\n"\r
- "\tEndpoint: 0x%p, Cookie: 0x" F64x ", Length: " F64u "\n",\r
- dto_stat.ep_handle, dto_stat.user_cookie.as_64,\r
- dto_stat.transfered_length);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return false;\r
- }\r
-\r
- op = &ep_context[epnum].op[op_indx];\r
-\r
- dto_cookie.as_64 = \r
- ((((DAT_UINT64) epnum) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- if (!DT_dto_check (&dto_stat,\r
- ep_context[epnum].ep_handle,\r
- op->num_segs * op->seg_size,\r
- dto_cookie,\r
- "Send"))\r
- {\r
- DT_Mdep_Free (completion_reaped);\r
- return false;\r
- }\r
-\r
- if (completion_reaped[epnum])\r
- {\r
- DT_Mdep_printf ("Test Error: Send: Secondary completion seen for endpoint 0x%p (%d)\n",\r
- ep_context[epnum].ep_handle, epnum);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
- completion_reaped[epnum] = 1;\r
- }\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- if (completion_reaped[i] == 0)\r
- {\r
- DT_Mdep_printf ("Test Error: Send: No completion seen for endpoint 0x%p (#%d)\n",\r
- ep_context[i].ep_handle, i);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
- }\r
-\r
- DT_Mdep_Free (completion_reaped);\r
- return true;\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Reap a recv op on each of this thread's EPs,\r
- * then if requested reap the corresponding send ops,\r
- * and re-post all of the recv buffers.\r
- */\r
-bool\r
-DT_handle_recv_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE recv_evd_hdl,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- int op_indx,\r
- bool poll,\r
- bool repost_recv)\r
-{\r
- unsigned int i;\r
- unsigned char *recv_completion_reaped;\r
- unsigned char *send_completion_reaped;\r
-\r
- recv_completion_reaped = DT_Mdep_Malloc (num_eps);\r
- if (recv_completion_reaped == NULL)\r
- {\r
- return false;\r
- }\r
-\r
- send_completion_reaped = DT_Mdep_Malloc (num_eps);\r
- if (send_completion_reaped == NULL)\r
- {\r
- DT_Mdep_Free (recv_completion_reaped);\r
- return false;\r
- }\r
-\r
- /* Foreach EP, reap */\r
- bzero ((void *) recv_completion_reaped, sizeof (unsigned char) * num_eps);\r
- bzero ((void *) send_completion_reaped, sizeof (unsigned char) * num_eps);\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_DTO_COOKIE dto_cookie;\r
- unsigned int epnum;\r
-\r
- /* First reap the recv DTO event */\r
- if (!DT_dto_event_reap (recv_evd_hdl, poll, &dto_stat))\r
- {\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- epnum = (uint32_t)(dto_stat.user_cookie.as_64 >> 32);\r
- if (epnum > num_eps)\r
- {\r
- DT_Mdep_printf ("Test Error: Receive: Invalid endpoint completion reaped.\n"\r
- "\tEndpoint: 0x%p, Cookie: 0x" F64x ", Length: " F64u "\n",\r
- dto_stat.ep_handle, dto_stat.user_cookie.as_64,\r
- dto_stat.transfered_length);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- op = &ep_context[epnum].op[op_indx];\r
- dto_cookie.as_64 = \r
- ((((DAT_UINT64) epnum) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- if (!DT_dto_check (&dto_stat,\r
- ep_context[epnum].ep_handle,\r
- op->num_segs * op->seg_size,\r
- dto_cookie,\r
- "Recv"))\r
- {\r
- DT_Mdep_printf ("Test Error: recv DTO problem\n");\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- if (recv_completion_reaped[epnum])\r
- {\r
- DT_Mdep_printf ("Test Error: Receive: Secondary completion seen for endpoint 0x%p (%d)\n",\r
- ep_context[epnum].ep_handle, epnum);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return ( false );\r
- }\r
- recv_completion_reaped[epnum] = 1;\r
-\r
- /*\r
- * Check the current op to see whether we are supposed\r
- * to reap the previous send op now.\r
- */\r
- if (op->reap_send_on_recv && op->server_initiated)\r
- {\r
- if (op_indx <= 0)\r
- /* shouldn't happen, but let's be certain */\r
- {\r
- DT_Mdep_printf ("Internal Error: reap_send_on_recv"\r
- " but current op == #%d\n", op_indx);\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- if (!DT_dto_event_reap (reqt_evd_hdl, poll, &dto_stat))\r
- {\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- epnum = (uint32_t)(dto_stat.user_cookie.as_64 >> 32);\r
- if (epnum > num_eps)\r
- {\r
- DT_Mdep_printf ("Test Error: Send (ror): Invalid endpoint completion reaped.\n"\r
- "\tEndpoint: 0x%p, Cookie: 0x" F64x ", Length: "F64u "\n",\r
- dto_stat.ep_handle, dto_stat.user_cookie.as_64,\r
- dto_stat.transfered_length);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- /*\r
- * We're reaping the last transaction, a\r
- * send completion that we skipped when it was sent.\r
- */\r
- op = &ep_context[epnum].op[op_indx - 1];\r
-\r
- dto_cookie.as_64 = \r
- ((((DAT_UINT64) epnum) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0))\r
- & 0xffffffffUL));\r
-\r
- /*\r
- * If we have multiple EPs we can't guarantee the order of\r
- * completions, so disable ep_handle check\r
- */\r
- if (!DT_dto_check (&dto_stat,\r
- num_eps == 1?ep_context[i].ep_handle: NULL,\r
- op->num_segs * op->seg_size,\r
- dto_cookie,\r
- "Send-reaped-on-recv"))\r
- {\r
- DT_Mdep_printf ("Test Error: send DTO problem\n");\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
-\r
- if (send_completion_reaped[epnum])\r
- {\r
- DT_Mdep_printf ("Test Error: Send (ror): Secondary completion seen for endpoint 0x%p (%d)\n",\r
- ep_context[epnum].ep_handle, epnum);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return ( false );\r
- }\r
- send_completion_reaped[epnum] = 1;\r
- }\r
- }\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- if (recv_completion_reaped[i] == 0)\r
- {\r
- DT_Mdep_printf ("Test Error: Receive: No completion seen for endpoint 0x%p (#%d)\n",\r
- ep_context[i].ep_handle, i);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return ( false );\r
- }\r
- }\r
-\r
- if (ep_context[0].op[op_indx].reap_send_on_recv\r
- && ep_context[0].op[op_indx].server_initiated)\r
- {\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- if (send_completion_reaped[i] == 0)\r
- {\r
- DT_Mdep_printf ("Test Error: Send (ror): No completion seen for endpoint 0x%p (#%d)\n",\r
- ep_context[i].ep_handle, i);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return ( false );\r
- }\r
- }\r
- }\r
-\r
- if (repost_recv)\r
- {\r
- /* repost the receive buffer */\r
- if (!DT_handle_post_recv_buf (ep_context, num_eps, op_indx))\r
- {\r
- DT_Mdep_printf ("Test Error: recv re-post problem\n");\r
- DT_Test_Error ();\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return false;\r
- }\r
- }\r
-\r
- DT_Mdep_Free (recv_completion_reaped);\r
- DT_Mdep_Free (send_completion_reaped);\r
- return true;\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Initiate an RDMA op (synchronous) on each of this thread's EPs.\r
- */\r
-bool\r
-DT_handle_rdma_op (Ep_Context_t * ep_context,\r
- DAT_EVD_HANDLE reqt_evd_hdl,\r
- unsigned int num_eps,\r
- DT_Transfer_Type opcode,\r
- int op_indx,\r
- bool poll)\r
-{\r
- unsigned int i, j;\r
- DAT_RETURN ret;\r
- unsigned char *completion_reaped;\r
-\r
- completion_reaped = DT_Mdep_Malloc (num_eps * sizeof (unsigned char));\r
-\r
- if (!completion_reaped)\r
- {\r
- return false;\r
- }\r
-\r
- /* Initiate the operation */\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op = &ep_context[i].op[op_indx];\r
- DAT_LMR_TRIPLET *iov = DT_Bpool_GetIOV (op->bp, 0);\r
- DAT_DTO_COOKIE cookie;\r
- DAT_RMR_TRIPLET rmr_triplet;\r
-\r
- /* Prep the inputs */\r
- for (j = 0; j < op->num_segs; j++)\r
- {\r
- iov[j].pad = 0U;\r
- iov[j].virtual_address = (DAT_VADDR) (uintptr_t) \r
- DT_Bpool_GetBuffer (op->bp, j);\r
- iov[j].segment_length = op->seg_size;\r
- iov[j].lmr_context = DT_Bpool_GetLMR (op->bp, j);\r
- }\r
- cookie.as_64 =\r
- ((((DAT_UINT64) i) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- rmr_triplet.pad = 0U;\r
- rmr_triplet.target_address = (DAT_VADDR) (uintptr_t) op->Rdma_Address;\r
- rmr_triplet.segment_length = op->seg_size * op->num_segs;\r
- rmr_triplet.rmr_context = op->Rdma_Context;\r
-\r
- DT_Mdep_spew (3, ("Call dat_ep_post_rdma_%s [" F64x ", sz=" F64x ", ctxt=%x]\n",\r
- (opcode == RDMA_WRITE ? "write" : "read"),\r
- rmr_triplet.target_address,\r
- rmr_triplet.segment_length,\r
- rmr_triplet.rmr_context ));\r
-\r
- /* Post the operation */\r
- if (opcode == RDMA_WRITE)\r
- {\r
-\r
- ret = dat_ep_post_rdma_write (ep_context[i].ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- }\r
- else /* opcode == RDMA_READ */\r
- {\r
-\r
- ret = dat_ep_post_rdma_read ( ep_context[i].ep_handle,\r
- op->num_segs,\r
- iov,\r
- cookie,\r
- &rmr_triplet,\r
- DAT_COMPLETION_DEFAULT_FLAG);\r
-\r
- }\r
- if (ret != DAT_SUCCESS)\r
- {\r
- DT_Mdep_printf ("Test Error: dat_ep_post_rdma_%s failed: %s\n",\r
- (opcode == RDMA_WRITE ? "write" : "read"),\r
- DT_RetToString (ret));\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
- else\r
- {\r
- DT_Mdep_spew (3, ("Done dat_ep_post_rdma_%s %s\n",\r
- (opcode == RDMA_WRITE ? "write" : "read"),\r
- " () Waiting ..."));\r
- }\r
- }\r
-\r
- bzero ((void *) completion_reaped, sizeof (unsigned char) * num_eps);\r
- /* Wait for it to happen */\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- Transaction_Test_Op_t *op;\r
- DAT_DTO_COMPLETION_EVENT_DATA dto_stat;\r
- DAT_DTO_COOKIE dto_cookie;\r
- unsigned int epnum;\r
-\r
- if (!DT_dto_event_reap (reqt_evd_hdl, poll, &dto_stat))\r
- {\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
-\r
- epnum = (uint32_t)(dto_stat.user_cookie.as_64 >> 32);\r
- if (epnum > num_eps)\r
- {\r
- DT_Mdep_printf ("Test Error: %s: Invalid endpoint completion reaped.\n"\r
- "\tEndpoint: 0x%p, Cookie: 0x" F64x ", Length: " F64u "\n",\r
- opcode == RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",\r
- dto_stat.ep_handle, dto_stat.user_cookie.as_64,\r
- dto_stat.transfered_length);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return false;\r
- }\r
- op = &ep_context[epnum].op[op_indx];\r
-\r
- dto_cookie.as_64 = \r
- ((((DAT_UINT64) epnum) << 32)\r
- | (((uintptr_t) DT_Bpool_GetBuffer (op->bp, 0)) & 0xffffffffUL));\r
-\r
- if (!DT_dto_check (&dto_stat,\r
- ep_context[epnum].ep_handle,\r
- op->num_segs * op->seg_size,\r
- dto_cookie,\r
- (opcode == RDMA_WRITE ? "RDMA/WR" : "RDMA/RD")))\r
- {\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
-\r
- if (completion_reaped[epnum])\r
- {\r
- DT_Mdep_printf ("Test Error: %s: Secondary completion seen for endpoint 0x%p (%d)\n",\r
- opcode == RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",\r
- ep_context[epnum].ep_handle, epnum);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
- completion_reaped[epnum] = 1;\r
-\r
- DT_Mdep_spew (3, ("dat_ep_post_rdma_%s OK\n",\r
- (opcode == RDMA_WRITE ? "RDMA/WR" : "RDMA/RD")));\r
- }\r
-\r
- for (i = 0; i < num_eps; i++)\r
- {\r
- if (completion_reaped[i] == 0)\r
- {\r
- DT_Mdep_printf ("Test Error: %s: No completion seen for endpoint 0x%p (#%d)\n",\r
- opcode == RDMA_WRITE ? "RDMA/WR" : "RDMA/RD",\r
- ep_context[i].ep_handle, i);\r
- DT_Test_Error ();\r
- DT_Mdep_Free (completion_reaped);\r
- return ( false );\r
- }\r
- }\r
-\r
- DT_Mdep_Free (completion_reaped);\r
-\r
- return ( true );\r
-}\r
-\r
-\r
-/* -----------------------------------------------------------\r
- * Verify whether we (the client side) can support\r
- * the requested 'T' test.\r
- */\r
-bool\r
-DT_check_params (Per_Test_Data_t *pt_ptr,\r
- unsigned char *module)\r
-{\r
- Transaction_Cmd_t * cmd = &pt_ptr->Params.u.Transaction_Cmd;\r
- unsigned long num_recvs = 0U;\r
- unsigned long num_sends = 0U;\r
- unsigned long num_rdma_rd = 0U;\r
- unsigned long num_rdma_wr = 0U;\r
- unsigned long max_size = 0U;\r
- unsigned long max_segs = 0U;\r
- bool rval = true;\r
- unsigned int i;\r
-\r
- /* Count up what's requested (including -V appended sync points) */\r
- for (i = 0; i < cmd->num_ops; i++)\r
- {\r
- unsigned int xfer_size;\r
-\r
- xfer_size = cmd->op[i].num_segs * cmd->op[i].seg_size;\r
- if (xfer_size > max_size)\r
- {\r
- max_size = xfer_size;\r
- }\r
- if (cmd->op[i].num_segs > max_segs)\r
- {\r
- max_segs = cmd->op[i].num_segs;\r
- }\r
-\r
- switch (cmd->op[i].transfer_type)\r
- {\r
- case SEND_RECV:\r
- {\r
- if (cmd->op[i].server_initiated)\r
- {\r
- num_recvs++;\r
- }\r
- else\r
- {\r
- num_sends++;\r
- }\r
- break;\r
- }\r
-\r
- case RDMA_READ:\r
- {\r
- num_rdma_rd++;\r
- break;\r
- }\r
-\r
- case RDMA_WRITE:\r
- {\r
- num_rdma_wr++;\r
- break;\r
- }\r
- }\r
- }\r
-\r
- /*\r
- * Now check the IA and EP attributes, and check for some of the\r
- * more obvious resource problems. This is hardly exhaustive,\r
- * and some things will inevitably fall through to run-time.\r
- *\r
- * We don't compare\r
- * num_rdma_rd > pt_ptr->ia_attr.max_rdma_read_per_ep\r
- * num_rdma_wr > pt_ptr->ia_attr.max_dto_per_ep\r
- * because each thread has its own EPs, and transfers are issued\r
- * synchronously (across a thread's EPs, and ignoring -f, which allows\r
- * a per-EP pipeline depth of at most 2 and applies only to SR ops),\r
- * so dapltest actually attempts almost no pipelining on a single EP.\r
- * But we do check that pre-posted recv buffers will all fit.\r
- */\r
- if ((DAT_COUNT)num_recvs > pt_ptr->ia_attr.max_dto_per_ep ||\r
- (DAT_COUNT)num_sends > pt_ptr->ia_attr.max_dto_per_ep)\r
- {\r
- DT_Mdep_printf (\r
- "%s: S/R: cannot supply %ld SR ops (maximum: %d)\n",\r
- module,\r
- num_recvs > num_sends ? num_recvs : num_sends,\r
- pt_ptr->ia_attr.max_dto_per_ep);\r
- rval = false;\r
- }\r
- if (max_size > pt_ptr->ia_attr.max_lmr_block_size)\r
- {\r
- DT_Mdep_printf (\r
- "%s: buffer too large: 0x%lx (maximum: " F64x " bytes)\n",\r
- module,\r
- max_size,\r
- pt_ptr->ia_attr.max_lmr_block_size);\r
- rval = false;\r
- }\r
- if ((DAT_COUNT)max_segs > pt_ptr->ep_attr.max_recv_iov ||\r
- (DAT_COUNT)max_segs > pt_ptr->ep_attr.max_request_iov)\r
- {\r
- /*\r
- * In an ideal world, we'd just ask for more segments\r
- * when creating the EPs for the test, rather than\r
- * checking against default EP attributes.\r
- */\r
- DT_Mdep_printf (\r
- "%s: cannot use %ld segments (maxima: S %d, R %d)\n",\r
- module,\r
- max_segs,\r
- pt_ptr->ep_attr.max_request_iov,\r
- pt_ptr->ep_attr.max_recv_iov );\r
- rval = false;\r
- }\r
-\r
- return ( rval );\r
-}\r
-\r
-/* Empty function in which to set breakpoints. */\r
-void\r
-DT_Test_Error (void)\r
-{\r
- ;\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#include "dapl_mdep.h"\r
-#include "dapl_proto.h"\r
-#include <dat/udat.h>\r
-\r
-\r
-\r
-/*\r
- * Map DAT_RETURN values to readable strings,\r
- * but don't assume the values are zero-based or contiguous.\r
- */\r
-const char *\r
-DT_RetToString (DAT_RETURN ret_value)\r
-{\r
- unsigned int i;\r
- static struct\r
- {\r
- const char *name;\r
- DAT_RETURN value;\r
- } dat_errors[] =\r
- {\r
- # define DATxx(x) { # x, x }\r
- DATxx (DAT_SUCCESS),\r
- DATxx (DAT_ABORT),\r
- DATxx (DAT_CONN_QUAL_IN_USE),\r
- DATxx (DAT_INSUFFICIENT_RESOURCES),\r
- DATxx (DAT_INTERNAL_ERROR),\r
- DATxx (DAT_INVALID_HANDLE),\r
- DATxx (DAT_INVALID_PARAMETER),\r
- DATxx (DAT_INVALID_STATE),\r
- DATxx (DAT_LENGTH_ERROR),\r
- DATxx (DAT_MODEL_NOT_SUPPORTED),\r
- DATxx (DAT_PROVIDER_NOT_FOUND),\r
- DATxx (DAT_PRIVILEGES_VIOLATION),\r
- DATxx (DAT_PROTECTION_VIOLATION),\r
- DATxx (DAT_QUEUE_EMPTY),\r
- DATxx (DAT_QUEUE_FULL),\r
- DATxx (DAT_TIMEOUT_EXPIRED),\r
- DATxx (DAT_PROVIDER_ALREADY_REGISTERED),\r
- DATxx (DAT_PROVIDER_IN_USE),\r
- DATxx (DAT_NOT_IMPLEMENTED)\r
- # undef DATxx\r
- };\r
- # define NUM_ERRORS (sizeof(dat_errors)/sizeof(dat_errors[0]))\r
-\r
- for (i = 0; i < NUM_ERRORS; i++)\r
- {\r
- if (dat_errors[i].value == DAT_GET_TYPE(ret_value))\r
- {\r
- return ( (dat_errors[i].name));\r
- }\r
-\r
- }\r
- return ( "Invalid_DAT_RETURN" );\r
-}\r
-\r
-/*\r
- * Map DAT_RETURN values to readable strings,\r
- * but don't assume the values are zero-based or contiguous.\r
- */\r
-const char *\r
-DT_TransferTypeToString (DT_Transfer_Type type)\r
-{\r
- static char *DT_Type[] =\r
- {\r
- "RR",\r
- "RW",\r
- "SR"\r
- };\r
-\r
- if ( (0 <= type) && (type <= 2) )\r
- {\r
- return DT_Type[type];\r
- }\r
- else\r
- {\r
- return "Error: Unkown Transfer Type";\r
- }\r
-}\r
-\r
-\r
-/*\r
- * Map DAT_ASYNC_ERROR_CODE values to readable strings\r
- */\r
-const char *\r
-DT_AsyncErr2Str (DAT_EVENT_NUMBER error_code)\r
-{\r
- unsigned int i;\r
- static struct\r
- {\r
- const char *name;\r
- DAT_RETURN value;\r
- } dat_errors[] =\r
- {\r
- # define DATxx(x) { # x, x }\r
- DATxx (DAT_DTO_COMPLETION_EVENT),\r
- DATxx (DAT_RMR_BIND_COMPLETION_EVENT),\r
- DATxx (DAT_CONNECTION_REQUEST_EVENT),\r
- DATxx (DAT_CONNECTION_EVENT_ESTABLISHED),\r
- DATxx (DAT_CONNECTION_EVENT_PEER_REJECTED),\r
- DATxx (DAT_CONNECTION_EVENT_NON_PEER_REJECTED),\r
- DATxx (DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR),\r
- DATxx (DAT_CONNECTION_EVENT_DISCONNECTED),\r
- DATxx (DAT_CONNECTION_EVENT_BROKEN),\r
- DATxx (DAT_CONNECTION_EVENT_TIMED_OUT),\r
- DATxx (DAT_ASYNC_ERROR_EVD_OVERFLOW),\r
- DATxx (DAT_ASYNC_ERROR_IA_CATASTROPHIC),\r
- DATxx (DAT_ASYNC_ERROR_EP_BROKEN),\r
- DATxx (DAT_ASYNC_ERROR_TIMED_OUT),\r
- DATxx (DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR),\r
- DATxx (DAT_SOFTWARE_EVENT)\r
- # undef DATxx\r
- };\r
- # define NUM_ERRORS (sizeof(dat_errors)/sizeof(dat_errors[0]))\r
-\r
- for (i = 0; i < NUM_ERRORS; i++)\r
- {\r
- if (dat_errors[i].value == error_code)\r
- {\r
- return ( dat_errors[i].name );\r
- }\r
- }\r
-\r
- return ( "Invalid_DAT_EVENT_NUMBER" );\r
-}\r
-\r
-/*\r
- * Map DAT_EVENT_CODE values to readable strings\r
- */\r
-const char *\r
-DT_EventToSTr (DAT_EVENT_NUMBER event_code)\r
-{\r
- unsigned int i;\r
- static struct\r
- {\r
- const char *name;\r
- DAT_RETURN value;\r
- }\r
- dat_events[] =\r
- {\r
- # define DATxx(x) { # x, x }\r
- DATxx (DAT_DTO_COMPLETION_EVENT),\r
- DATxx (DAT_RMR_BIND_COMPLETION_EVENT),\r
- DATxx (DAT_CONNECTION_REQUEST_EVENT),\r
- DATxx (DAT_CONNECTION_EVENT_ESTABLISHED),\r
- DATxx (DAT_CONNECTION_EVENT_PEER_REJECTED),\r
- DATxx (DAT_CONNECTION_EVENT_NON_PEER_REJECTED),\r
- DATxx (DAT_CONNECTION_EVENT_ACCEPT_COMPLETION_ERROR),\r
- DATxx (DAT_CONNECTION_EVENT_DISCONNECTED),\r
- DATxx (DAT_CONNECTION_EVENT_BROKEN),\r
- DATxx (DAT_CONNECTION_EVENT_TIMED_OUT),\r
- DATxx (DAT_CONNECTION_EVENT_UNREACHABLE),\r
- DATxx (DAT_ASYNC_ERROR_EVD_OVERFLOW),\r
- DATxx (DAT_ASYNC_ERROR_IA_CATASTROPHIC),\r
- DATxx (DAT_ASYNC_ERROR_EP_BROKEN),\r
- DATxx (DAT_ASYNC_ERROR_TIMED_OUT),\r
- DATxx (DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR),\r
- DATxx (DAT_SOFTWARE_EVENT)\r
- # undef DATxx\r
- };\r
- # define NUM_EVENTS (sizeof(dat_events)/sizeof(dat_events[0]))\r
-\r
- for (i = 0; i < NUM_EVENTS; i++)\r
- {\r
- if (dat_events[i].value == event_code)\r
- {\r
- return ( dat_events[i].name );\r
- }\r
- }\r
-\r
- return ( "Invalid_DAT_EVENT_NUMBER" );\r
-}\r
-\r
-\r
-/*\r
- * Map DAT_EP_STATE_CODE values to readable strings\r
- */\r
-const char *\r
-DT_State2Str (DAT_EP_STATE state_code)\r
-{\r
- unsigned int i;\r
- static struct\r
- {\r
- const char *name;\r
- DAT_RETURN value;\r
- }\r
- dat_state[] =\r
- {\r
- # define DATxx(x) { # x, x }\r
- DATxx (DAT_EP_STATE_UNCONNECTED),\r
- DATxx (DAT_EP_STATE_RESERVED),\r
- DATxx (DAT_EP_STATE_PASSIVE_CONNECTION_PENDING),\r
- DATxx (DAT_EP_STATE_ACTIVE_CONNECTION_PENDING),\r
- DATxx (DAT_EP_STATE_TENTATIVE_CONNECTION_PENDING),\r
- DATxx (DAT_EP_STATE_CONNECTED),\r
- DATxx (DAT_EP_STATE_DISCONNECT_PENDING),\r
- DATxx (DAT_EP_STATE_ERROR)\r
- # undef DATxx\r
- };\r
- # define NUM_STATES (sizeof(dat_state)/sizeof(dat_state[0]))\r
-\r
- for (i = 0; i < NUM_STATES; i++)\r
- {\r
- if (dat_state[i].value == state_code)\r
- {\r
- return ( dat_state[i].name );\r
- }\r
- }\r
-\r
- return ( "Invalid_DAT_STATE_NUMBER" );\r
-}\r
-\r
-\r
-/*\r
- * Parse a QOS argument into a DAT_QOS.\r
- *\r
- * Returns no errors: defaults to best effort.\r
- */\r
-DAT_QOS\r
-DT_ParseQoS (char *arg)\r
-{\r
- if (0 == strcmp (arg, "HT"))\r
- {\r
- return ( DAT_QOS_HIGH_THROUGHPUT );\r
- }\r
-\r
- if (0 == strcmp (arg, "LL"))\r
- {\r
- return ( DAT_QOS_LOW_LATENCY );\r
- }\r
-\r
- if (0 == strcmp (arg, "EC"))\r
- {\r
- return ( DAT_QOS_ECONOMY );\r
- }\r
-\r
- if (0 == strcmp (arg, "PM"))\r
- {\r
- return ( DAT_QOS_PREMIUM );\r
- }\r
- /*\r
- * Default to "BE" so no point in checking further\r
- */\r
- return ( DAT_QOS_BEST_EFFORT );\r
-}\r
-\r
-\r
-/*\r
- * A couple of round-up routines (for pointers and counters)\r
- * which both assume a power-of-two 'align' factor,\r
- * and do the correct thing if align == 0.\r
- */\r
-unsigned char *\r
-DT_AlignPtr (void * val, unsigned int align)\r
-{\r
- if (align)\r
- {\r
- return ( (unsigned char *)\r
- (((DAT_UVERYLONG)val + ((DAT_UVERYLONG)align) - 1) & ~ (((DAT_UVERYLONG)align) - 1)));\r
- }\r
- return (val);\r
-}\r
-\r
-DAT_COUNT\r
-DT_RoundSize (DAT_COUNT val, DAT_COUNT align)\r
-{\r
- if (align)\r
- {\r
- return ( ((val + align - 1) & ~ (align - 1)) );\r
- }\r
- return ( val );\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
- *\r
- * This Software is licensed under either one of the following two licenses:\r
- *\r
- * 1) under the terms of the "Common Public License 1.0" a copy of which is\r
- * in the file LICENSE.txt in the root directory. The license is also\r
- * available from the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/cpl.php.\r
- * OR\r
- *\r
- * 2) under the terms of the "The BSD License" a copy of which is in the file\r
- * LICENSE2.txt in the root directory. The license is also available from\r
- * the Open Source Initiative, see\r
- * http://www.opensource.org/licenses/bsd-license.php.\r
- *\r
- * Licensee has the right to choose either one of the above two licenses.\r
- *\r
- * Redistributions of source code must retain both the above copyright\r
- * notice and either one of the license notices.\r
- *\r
- * Redistributions in binary form must reproduce both the above copyright\r
- * notice, either one of the license notices in the documentation\r
- * and/or other materials provided with the distribution.\r
- */\r
-\r
-#ifndef __DAPL_VERSION_H\r
-#define __DAPL_VERSION_H\r
-/*\r
- * Dapltest version number\r
- *\r
- * This should be bumped everytime the "cross-the-wire" behavior changes.\r
- */\r
-\r
-#define DAPLTEST_VERSION 0x00000005\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- * Copyright (c) 2007 Intel Corporation. All rights reserved.\r
- *\r
- * This software is available to you under the OpenIB.org BSD license\r
- * below:\r
- *\r
- * Redistribution and use in source and binary forms, with or\r
- * without modification, are permitted provided that the following\r
- * conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer.\r
- *\r
- * - Redistributions in binary form must reproduce the above\r
- * copyright notice, this list of conditions and the following\r
- * disclaimer in the documentation and/or other materials\r
- * provided with the distribution.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
- * SOFTWARE.\r
- *\r
- * $Id$\r
- */\r
-\r
-\r
-#include <oib_ver.h>\r
-\r
-#define VER_FILETYPE VFT_APP\r
-#define VER_FILESUBTYPE VFT2_UNKNOWN\r
-\r
-#if DBG\r
-#define VER_FILEDESCRIPTION_STR "DAPL/DAT[1.1] test application (Debug)"\r
-#define VER_INTERNALNAME_STR "dapltestd.exe"\r
-#define VER_ORIGINALFILENAME_STR "dapltestd.exe"\r
-#else\r
-#define VER_FILEDESCRIPTION_STR "DAPL/DAT[1.1] test application"\r
-#define VER_INTERNALNAME_STR "dapltest.exe"\r
-#define VER_ORIGINALFILENAME_STR "dapltest.exe"\r
-#endif\r
-\r
-#include <common.ver>\r
-\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample client invocation\r
-#\r
-#\r
-me=`basename $0`\r
-case $# in \r
-0) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-1) host=$1\r
- device=IbalHca0\r
- size=4 ;;\r
-2) host=$1\r
- device=IbalHca0\r
- size=$2 ;;\r
-3) host=$1\r
- device=$3 \r
- size=$2 ;;\r
-*) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-./dapltest -T P -d -i 1024 -s ${host} -D ${device} \\r
- -p 1 -m b RW ${size} 1\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample client invocation\r
-#\r
-#\r
-me=`basename $0`\r
-case $# in \r
-0) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-1) host=$1\r
- device=IbalHca0\r
- size=4 ;;\r
-2) host=$1\r
- device=IbalHca0\r
- size=$2 ;;\r
-3) host=$1\r
- device=$3 \r
- size=$2 ;;\r
-*) echo Usage: $me '[hostname [size [device]]]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-./dapltest -T P -d -i 1024 -s ${host} -D ${device} \\r
- -p 1 -m p RW ${size} 1\r
+++ /dev/null
-#!/bin/sh\r
-\r
-me=`basename $0`\r
-\r
-case $# in \r
-0) device=IbalHca0 ;;\r
-1) device=$1 ;;\r
-*) echo Usage: $me '[device]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-#\r
-# -d debug verbosity\r
-# -w width sets up 'width' sets of IA,PZ,EVD,EP,LMR,RMR,...\r
-# -m maximum provides a bound on exhaustion tests\r
-#\r
-./dapltest -T L -D ${device} -d -w 8 -m 100 limit_ia limit_pz limit_evd \\r
- limit_ep limit_psp limit_lmr limit_rpost \r
+++ /dev/null
-#\r
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source\r
-# file to this component. This file merely indirects to the real make file\r
-# that is shared by all the driver components of the OpenIB Windows project.\r
-#\r
-\r
-!INCLUDE ..\..\..\..\..\inc\openib.def\r
+++ /dev/null
-#\r
-# Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.\r
-#\r
-# This Software is licensed under either one of the following two licenses:\r
-#\r
-# 1) under the terms of the "Common Public License 1.0" a copy of which is\r
-# in the file LICENSE.txt in the root directory. The license is also\r
-# available from the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/cpl.php.\r
-# OR\r
-#\r
-# 2) under the terms of the "The BSD License" a copy of which is in the file\r
-# LICENSE2.txt in the root directory. The license is also available from\r
-# the Open Source Initiative, see\r
-# http://www.opensource.org/licenses/bsd-license.php.\r
-#\r
-# Licensee has the right to choose either one of the above two licenses.\r
-#\r
-# Redistributions of source code must retain both the above copyright\r
-# notice and either one of the license notices.\r
-#\r
-# Redistributions in binary form must reproduce both the above copyright\r
-# notice, either one of the license notices in the documentation\r
-# and/or other materials provided with the distribution.\r
-#\r
-\r
-#*********************************************************************\r
-# \r
-# NMAKE Options (passed by macro) \r
-#\r
-# Option Invoke NMKAE\r
-# ----------------------- -----------------------\r
-# expilicit linking nmake EXPLCIT_LINK=1\r
-#\r
-#*********************************************************************/\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Dot Directives\r
-#\r
-#*********************************************************************/\r
-\r
-.SUFFIXES : # clear the .SUFFIXES list\r
-.SUFFIXES : .c # initialize .SUFFIXES list\r
-\r
-\r
-#*********************************************************************\r
-# \r
-# Macros\r
-#\r
-#*********************************************************************/\r
-\r
-DAT_PATH = ../../../dat\r
-\r
-OBJ_PATH = Obj\r
-TARGET_PATH = Target\r
-\r
-OBJS = $(OBJ_PATH)/dapl_bpool.obj \\r
- $(OBJ_PATH)/dapl_client.obj \\r
- $(OBJ_PATH)/dapl_client_info.obj \\r
- $(OBJ_PATH)/dapl_cnxn.obj \\r
- $(OBJ_PATH)/dapl_endian.obj \\r
- $(OBJ_PATH)/dapl_fft_cmd.obj \\r
- $(OBJ_PATH)/dapl_fft_connmgt.obj \\r
- $(OBJ_PATH)/dapl_fft_dataxfer.obj \\r
- $(OBJ_PATH)/dapl_fft_dataxfer_client.obj \\r
- $(OBJ_PATH)/dapl_fft_endpoint.obj \\r
- $(OBJ_PATH)/dapl_fft_hwconn.obj \\r
- $(OBJ_PATH)/dapl_fft_mem.obj \\r
- $(OBJ_PATH)/dapl_fft_pz.obj \\r
- $(OBJ_PATH)/dapl_fft_queryinfo.obj \\r
- $(OBJ_PATH)/dapl_fft_test.obj \\r
- $(OBJ_PATH)/dapl_fft_util.obj \\r
- $(OBJ_PATH)/dapl_getopt.obj \\r
- $(OBJ_PATH)/dapl_limit.obj \\r
- $(OBJ_PATH)/dapl_limit_cmd.obj \\r
- $(OBJ_PATH)/dapl_main.obj \\r
- $(OBJ_PATH)/dapl_mdep.obj \\r
- $(OBJ_PATH)/dapl_memlist.obj \\r
- $(OBJ_PATH)/dapl_netaddr.obj \\r
- $(OBJ_PATH)/dapl_params.obj \\r
- $(OBJ_PATH)/dapl_performance_client.obj \\r
- $(OBJ_PATH)/dapl_performance_cmd.obj \\r
- $(OBJ_PATH)/dapl_performance_server.obj \\r
- $(OBJ_PATH)/dapl_performance_stats.obj \\r
- $(OBJ_PATH)/dapl_performance_util.obj \\r
- $(OBJ_PATH)/dapl_quit_cmd.obj \\r
- $(OBJ_PATH)/dapl_server.obj \\r
- $(OBJ_PATH)/dapl_server_cmd.obj \\r
- $(OBJ_PATH)/dapl_server_info.obj \\r
- $(OBJ_PATH)/dapl_test_data.obj \\r
- $(OBJ_PATH)/dapl_test_util.obj \\r
- $(OBJ_PATH)/dapl_thread.obj \\r
- $(OBJ_PATH)/dapl_transaction_cmd.obj \\r
- $(OBJ_PATH)/dapl_transaction_stats.obj \\r
- $(OBJ_PATH)/dapl_transaction_test.obj \\r
- $(OBJ_PATH)/dapl_transaction_util.obj \\r
- $(OBJ_PATH)/dapl_util.obj\r
-\r
-EXEC = dapltest.exe\r
-\r
-#\r
-# Compiler \r
-#\r
-\r
-CC = cl\r
-\r
-INC_FLAGS = \\r
- /I $(DAT_PATH)/include \\r
- /I $(DAT_PATH)/common \\r
- /I $(DAT_PATH)/udat \\r
- /I $(DAT_PATH)/udat/windows\r
-\r
-CC_FLAGS= \\r
- /nologo /Zel /Zp1 /Gy /W3 /Gd /QIfdiv- /QIf /QI0f /GB /Gi- /Gm- /GX- \\r
- /GR- /GF -Z7 /Od /Oi /Oy- $(INC_FLAGS) \\r
- /DWIN32 /D_X86_ /D__i386__ /D__PENTIUM__ /DDAT_THREADSAFE=DAT_FALSE\r
-\r
-#\r
-# Linker\r
-#\r
-\r
-LINK = link\r
-\r
-LIBS = libc.lib ws2_32.lib advapi32.lib User32.lib $(DAT_PATH)/udat/Debug/udat.lib\r
-\r
-LINK_FLAGS = \\r
- /nologo /subsystem:console /DEBUG /incremental:yes /machine:I386 $(LIBS)\r
-\r
-#LIBS = ws2_32.lib advapi32.lib $(DAT_PATH)/udat/Target/UDAT.lib\r
-\r
-# if the provider library should be explicitly linked \r
-!IFDEF EXPLICIT_LINK\r
-# in addition to providers listed in the DAT static registry\r
-# the specified provider will be available to the consumer \r
-DAPL_PATH = ../../../dapl\r
-#\r
-# the /INCLUDE option is used to force a symbol reference to the DAPL \r
-# provider library. If there are no references, Windows will not load \r
-# the DAPL library when dapltest is executed.\r
-#\r
-LIBS = $(LIBS) $(DAPL_PATH)/udapl/Debug/dapl.lib /INCLUDE:_dapl_ia_open\r
-!ENDIF\r
-\r
-#\r
-# System Utilities\r
-#\r
-\r
-RM = rm -f\r
-\r
-\r
-#*********************************************************************\r
-# Inference Rules\r
-#\r
-#*********************************************************************/\r
-\r
-.c{$(OBJ_PATH)}.obj:\r
- $(CC) $(CC_FLAGS) /Fo$@ /c $< \r
-\r
-\r
-#*********************************************************************\r
-#\r
-# Description Blocks\r
-#\r
-#*********************************************************************/\r
-\r
-all : mkdirs $(EXEC)\r
-\r
-mkdirs:\r
- if not exist "$(OBJ_PATH)" mkdir "$(OBJ_PATH)"\r
- if not exist "$(TARGET_PATH)" mkdir "$(TARGET_PATH)"\r
-\r
-$(EXEC) : $(OBJS)\r
- $(LINK) $(LINK_FLAGS) /out:$(EXEC) $(OBJS)\r
-\r
-clean: \r
- $(RM) $(OBJS)\r
- $(RM) $(EXEC)\r
+++ /dev/null
-#!/bin/sh\r
-\r
-me=`basename $0`\r
-case $# in \r
-0) echo Usage: $me '[hostname [device] ]' 1>&2 ; exit 1;;\r
-1) host=$1\r
- device=IbalHca0 ;;\r
-2) host=$1\r
- device=$2 ;;\r
-*) echo Usage: $me '[hostname [device] ]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-\r
-#\r
-# -d debug verbosity\r
-# -w width sets up 'width' sets of IA,PZ,EVD,EP,LMR,RMR,...\r
-# -m maximum provides a bound on exhaustion tests\r
-#\r
-./dapltest -T Q -D ${device} -s ${host}\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample regression client invocation\r
-#\r
-\r
-me=`basename $0`\r
-case $# in \r
-0) echo Usage: $me '[hostname [device] ]' 1>&2 ; exit 1;;\r
-1) host=$1\r
- device=IbalHca0 ;;\r
-2) host=$1\r
- device=$2 ;;\r
-*) echo Usage: $me '[hostname [device] ]' 1>&2 ; exit 1;;\r
-esac\r
-\r
-\r
-#====================================================================\r
-#client1\r
-#====================================================================\r
-./dapltest -T T -s ${host} -D ${device} -d -i 10000 -t 1 -w 1 \\r
- client SR 256 \\r
- server SR 256 \r
-\r
-#====================================================================\r
-#client2\r
-#====================================================================\r
-./dapltest -T T -s ${host} -D ${device} -d -i 10000 -t 1 -w 1 \\r
- client SR 256 \\r
- client RW 4096 \\r
- server SR 256 \r
-\r
-#====================================================================\r
-#client3\r
-#====================================================================\r
-./dapltest -T T -s ${host} -D ${device} -d -i 10000 -t 1 -w 1 \\r
- client SR 256 \\r
- client RR 4096 \\r
- server SR 256 \r
-\r
-#====================================================================\r
-#client4\r
-#====================================================================\r
-./dapltest -T T -s ${host} -D ${device} -d -i 10000 -t 1 -w 1 \\r
- client SR 256 \\r
- client RW 4096 \\r
- server SR 256 \\r
- client SR 256 \\r
- client RR 4096 \\r
- server SR 256 \\r
- client SR 4096 \\r
- server SR 256 \r
- \r
-#====================================================================\r
-#client5\r
-#====================================================================\r
-./dapltest -T T -s ${host} -D ${device} -d -i 10000 -t 4 -w 8 \\r
- client SR 256 \\r
- client RW 4096 \\r
- server SR 256 \\r
- client SR 256 \\r
- client RR 4096 \\r
- server SR 256 \\r
- client SR 4096 \\r
- server SR 256\r
- \r
-\r
+++ /dev/null
-#!/bin/sh\r
-#\r
-# Sample server invocation\r
-#\r
-me=`basename $0`\r
-case $# in \r
-0) device=IbalHca0;;\r
-1) device=$1 ;;\r
-*) echo Usage: $me '[device]' 1>&2 ; exit 1;;\r
-esac\r
-#\r
-#\r
-# ./dapltest -T S -d -D ${device} \r
-\r
- ./dapltest -T S -d -D ${device}\r
+++ /dev/null
-DIRS=dapltest\r